diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index aac107cfb..c75b9f9bf 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -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' } diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index cdeb17e54..44496c3d7 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -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 diff --git a/app/models/contest_notification.rb b/app/models/contest_notification.rb index c1f2fde6f..d525b4b3a 100644 --- a/app/models/contest_notification.rb +++ b/app/models/contest_notification.rb @@ -1,3 +1,4 @@ class ContestNotification < ActiveRecord::Base attr_accessible :content, :title + validates_length_of :title, maximum: 30 end diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb index 0677d324b..e5fbd3f82 100644 --- a/app/views/attachments/_form.html.erb +++ b/app/views/attachments/_form.html.erb @@ -1,6 +1,7 @@ - + <% 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| %> <%= 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}" %> <% end %> + <% else %> + <% container.attachments.each_with_index do |attachment, i| %> + + <%= 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(' '.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}" %> + + <% end %> + <% end %> <% end %>