This commit is contained in:
sw 2014-08-22 11:50:10 +08:00
commit e1e8942dc7
11 changed files with 36 additions and 19 deletions

View File

@ -241,7 +241,7 @@ class AdminController < ApplicationController
end
else
respond_to do |format|
flash.now[:error] = "#{l :label_first_page_create_fail}: #{@first_page.errors.full_messages[0]}\n\t#{@contest_page.errors.full_messages[0]}"
flash.now[:error] = "#{l :label_first_page_create_fail}: #{@first_page.errors.full_messages[0]}\n\t#{@contest_page.errors.full_messages[0]}\n\t#{@notification.errors.full_messages[0]}"
format.html {
render :action => 'contest_page_made'
}

View File

@ -34,6 +34,7 @@ class MessagesController < ApplicationController
# Show a topic and its replies
def show
@isReply = true
page = params[:page]
# Find the page of the requested reply
if params[:r] && page.nil?
@ -103,6 +104,7 @@ class MessagesController < ApplicationController
# Edit a message
def edit
@isReply = false
if @project
(render_403; return false) unless @message.editable_by?(User.current)
else
@ -123,7 +125,6 @@ class MessagesController < ApplicationController
}
end
end
end
# Delete a messages

View File

@ -1,3 +1,4 @@
class ContestNotification < ActiveRecord::Base
attr_accessible :content, :title
validates_length_of :title, maximum: 30
end

View File

@ -1,6 +1,7 @@
<span id="attachments_fields">
<span id="attachments_fields" xmlns="http://www.w3.org/1999/html">
<% if defined?(container) && container && container.saved_attachments %>
<% container.attachments.each_with_index do |attachment, i| %>
<% if isReply %>
<% container.saved_attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= i %>" class="attachment">
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") +
@ -10,6 +11,18 @@
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span>
<% end %>
<% else %>
<% container.attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= i %>" class="attachment">
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") +
link_to('&nbsp;'.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %>
<%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public, :class => 'is_public')%>
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span>
<% end %>
<% end %>
<% end %>
</span>
<script type='text/javascript'>

View File

@ -4,14 +4,16 @@
<p><%= h("#{@attachment.description} - ") unless @attachment.description.blank? %>
<span class="author"><%= link_to_user(@attachment.author) %>, <%= format_time(@attachment.created_on) %></span></p>
<p><%= link_to_attachment @attachment, :text => l(:button_download), :download => true -%>
<span class="size">(<%= number_to_human_size @attachment.filesize %>)</span>&nbsp&nbsp&nbsp<span class="size">
<%= link = link_to(l(:button_add), {:controller => 'code_review',
<span class="size">(<%= number_to_human_size @attachment.filesize %>)</span>&nbsp&nbsp&nbsp
<span class="size">
<% if @attachment!=nil&&@attachment.container_type == 'Document' %>
<%= link = link_to(l(:button_add), {:controller => 'code_review',
:action => 'assign', :action_type => 'attachment',
:id=>@attachment.project,
:change_id => '', :attachment_id => @attachment.id,
}, :class => 'icon icon-add') %>
<% end %>
</span></p>
</div>
&nbsp;
<%= render :partial => 'common/file', :locals => {:content => @content, :filename => @attachment.filename} %>

View File

@ -1,14 +1,14 @@
<div class="autoscroll">
<table class="filecontent syntaxhl">
<table class="filecontent syntaxhl" >
<tbody>
<% line_num = 1 %>
<% syntax_highlight_lines(filename, Redmine::CodesetUtil.to_utf8_by_setting(content)).each do |line| %>
<tr>
<th class="line-num" id="L<%= line_num %>">
<a href="#L<%= line_num %>"><%= line_num %></a>
<th class="line-num" id="L<%= line_num %>" style="vertical-align: top;">
<a href="#L<%= line_num %>" style="padding-top: 0px;"><%= line_num %></a>
</th>
<td class="line-code">
<pre><%= line.html_safe %></pre>
<pre style="width:880px;word-wrap: break-word; word-break: normal; "><%= line.html_safe %></pre>
</td>
</tr>
<% line_num += 1 %>

View File

@ -75,14 +75,14 @@
l(:button_edit),
{:action => 'edit', :id => @topic},
:class => 'icon icon-edit'
) if @message.editable_by?(User.current) %>
) if @message.course_editable_by?(User.current) %>
<%= link_to(
l(:button_delete),
{:action => 'destroy', :id => @topic},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:class => 'icon icon-del'
) if @message.destroyable_by?(User.current) %>
) if @message.course_destroyable_by?(User.current) %>
</div>
<div class="lz-left">

View File

@ -42,7 +42,7 @@
<!--[eoform:message]-->
<p><%= l(:label_attachment_plural) %><br />
<%= render :partial => 'attachments/form', :locals => {:container => @message} %></p>
<%= render :partial => 'attachments/form', :locals => {:container => @message,:isReply => @isReply} %></p>
</div>

View File

@ -1,4 +1,4 @@
<!-- added by bai -->
<div><%= l(:label_file_number) %> * 4 = <%= document_num(@project) %> * 4 = <%= format("%.2f" , document_score(@project)).to_i %></div>
<div><%= l(:label_file_score) %> = <%= format("%.2f" , document_score(@project)).to_i %></div>
<div><%= l(:label_file_number) %> * 4 = <%= documents_num(@project) %> * 4 = <%= format("%.2f" , documents_score(@project)).to_i %></div>
<div><%= l(:label_file_score) %> = <%= format("%.2f" , documents_score(@project)).to_i %></div>
<!-- end -->

View File

@ -45,8 +45,8 @@
</tr>
<tr>
<td style="width: 40%;text-align: right;font-size: 17px;color: rgb(17, 102, 153)">
<% #find_project_repository @project %>
<strong><%= content_tag('span', "#{@project.repository.nil? || @project.project_status.nil? ? '0' : @project.project_status.changesets_count }", :class => "info") %></strong>
<!-- @project.repository.nil? || @project.project_status.nil? ? '0' : @project.project_status.changesets_count -->
<strong><%= content_tag('span', "#{changesets_num(@project)}", :class => "info") %></strong>
</td>
<td style="width: 60%;text-align: left">
<%= content_tag('span', l(:label_commit_on)) %>

View File

@ -197,7 +197,7 @@
<span style="margin-top: -20px;float: right; display: block;"><%#= link_to l(:label_more_information), forums_path %></span>
<div style="height: 167px; padding-top:6px;">
<fieldset style="padding-left: 36px; margin-left: 13px; height: 150px; width:380px; border-radius:10px;">
<div style="font-size:14px; color: #1166AD; padding-left:52px; "><strong><%= @contestNotification.title %></strong></div>
<div style="font-size:14px; color: #1166AD;text-align:center;word-break: break-all; "><strong style="margin:auto;"><%= @contestNotification.title %></strong></div>
<div class="underline-contests_four"></div>
<div id="up_zzjs">
<div id="marqueebox">