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 end
else else
respond_to do |format| 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 { format.html {
render :action => 'contest_page_made' render :action => 'contest_page_made'
} }

View File

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

View File

@ -1,3 +1,4 @@
class ContestNotification < ActiveRecord::Base class ContestNotification < ActiveRecord::Base
attr_accessible :content, :title attr_accessible :content, :title
validates_length_of :title, maximum: 30
end 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 %> <% 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"> <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}][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;") + <%= 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}" %> <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span> </span>
<% end %> <% 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 %> <% end %>
</span> </span>
<script type='text/javascript'> <script type='text/javascript'>

View File

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

View File

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

View File

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

View File

@ -42,7 +42,7 @@
<!--[eoform:message]--> <!--[eoform:message]-->
<p><%= l(:label_attachment_plural) %><br /> <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> </div>

View File

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

View File

@ -45,8 +45,8 @@
</tr> </tr>
<tr> <tr>
<td style="width: 40%;text-align: right;font-size: 17px;color: rgb(17, 102, 153)"> <td style="width: 40%;text-align: right;font-size: 17px;color: rgb(17, 102, 153)">
<% #find_project_repository @project %> <!-- @project.repository.nil? || @project.project_status.nil? ? '0' : @project.project_status.changesets_count -->
<strong><%= content_tag('span', "#{@project.repository.nil? || @project.project_status.nil? ? '0' : @project.project_status.changesets_count }", :class => "info") %></strong> <strong><%= content_tag('span', "#{changesets_num(@project)}", :class => "info") %></strong>
</td> </td>
<td style="width: 60%;text-align: left"> <td style="width: 60%;text-align: left">
<%= content_tag('span', l(:label_commit_on)) %> <%= 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> <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;"> <div style="height: 167px; padding-top:6px;">
<fieldset style="padding-left: 36px; margin-left: 13px; height: 150px; width:380px; border-radius:10px;"> <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 class="underline-contests_four"></div>
<div id="up_zzjs"> <div id="up_zzjs">
<div id="marqueebox"> <div id="marqueebox">