diff --git a/app/models/course.rb b/app/models/course.rb index 5034ab0d8..7737f2a9b 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -34,10 +34,11 @@ class Course < ActiveRecord::Base acts_as_attachable :view_permission => :view_files, :delete_permission => :manage_files - validates_presence_of :password, :term,:name + validates_presence_of :password, :term,:name,:description validates_format_of :class_period, :with =>/^[1-9]\d*$/ validates_format_of :name,:with =>/^[a-zA-Z0-9_\u4e00-\u9fa5]+$/ - + validates_length_of :description, :maximum => 10000 + before_save :self_validate after_save :create_board_sync before_destroy :delete_all_members diff --git a/app/models/news.rb b/app/models/news.rb index 9a0f8b75c..1b7b25444 100644 --- a/app/models/news.rb +++ b/app/models/news.rb @@ -29,6 +29,7 @@ class News < ActiveRecord::Base validates_presence_of :title, :description validates_length_of :title, :maximum => 60 validates_length_of :summary, :maximum => 255 + validates_length_of :description, :maximum => 10000 acts_as_attachable :delete_permission => :manage_news acts_as_searchable :columns => ['title', 'summary', "#{table_name}.description"], :include => :project diff --git a/app/models/project.rb b/app/models/project.rb index 5efaf10ab..1c45b0680 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -115,7 +115,7 @@ class Project < ActiveRecord::Base validates_uniqueness_of :identifier validates_uniqueness_of :name validates_associated :repository, :wiki - # validates_length_of :description, :maximum => 255 + validates_length_of :description, :maximum => 10000 validates_length_of :name, :maximum => 255 validates_length_of :homepage, :maximum => 255 validates_length_of :identifier, :in => 1..IDENTIFIER_MAX_LENGTH diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb index ecdfd5ac5..24b05cc91 100644 --- a/app/views/contests/show_attendingcontest.html.erb +++ b/app/views/contests/show_attendingcontest.html.erb @@ -91,7 +91,7 @@ <%= l(:label_work_name) %> * : - <%= f.text_field :name, :required => true, :size => 60, :style => "width:400px;" %> + <%= f.text_field :name, :required => true,:maxlength => 25, :size => 60, :style => "width:400px;" %> (<%= l(:label_workname_lengthlimit) %>)
@@ -101,8 +101,8 @@ <%= l(:label_running_platform) %> * : - <%= f.text_field :android_min_version_available, :required => true, :size => 60, :style => "width:400px;" %> - + <%= f.text_field :android_min_version_available, :required => true,:maxlength => 125, :size => 60, :style => "width:400px;" %> + (<%= l(:label_workdescription_lengthlimit) %>)

@@ -112,8 +112,8 @@ <%= l(:label_work_type) %> * : - <%= f.text_field :app_type_name, :required => true, :size => 60, :style => "width:400px;" %> - + <%= f.text_field :app_type_name, :required => true,:maxlength => 125, :size => 60, :style => "width:400px;" %> + (<%= l(:label_workdescription_lengthlimit) %>)

@@ -122,7 +122,7 @@ <%= l(:label_work_description) %> * : - <%= f.text_field :description, :required => true, :size => 60, :style => "width:400px;" %> + <%= f.text_field :description, :required => true,:maxlength => 125, :size => 60, :style => "width:400px;" %> (<%= l(:label_workdescription_lengthlimit) %>)
@@ -132,8 +132,8 @@ <%= l(:label_softapplication_developers) %> * : - <%= f.text_field :application_developers, :required => true, :size => 60, :style => "width:400px;" %> - + <%= f.text_field :application_developers, :required => true,:maxlength => 125, :size => 60, :style => "width:400px;" %> + (<%= l(:label_workdescription_lengthlimit) %>)

diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index d9913539f..9e52cf71a 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -9,22 +9,25 @@ <%#= link_to(l(:label_attachment_new), 'javascript:void(0);', :onclick=>"$('#file_buttons').slideToggle();", :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @course) %>
- <%= link_to(l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") if User.current.allowed_to?(:manage_files, @course) %> - <%= link_to(l(:label_relation_files), 'javascript:void(0);', :onclick => "$('#upload_file_div').slideUp();$('#relation_file_div').slideToggle();", :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @course) %> - - <% if attachmenttypes.any? %> -       - - <%= select_tag "attachment_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_from_collection_for_select(attachmenttypes, "id", "typeName"), - :onchange => "course_attachmenttypes_searchex(this.value)" %> - <% end %> - <% if sufixtypes.any? %> -   - - <%= select_tag "attach_sufix_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_for_select(sufixtypes), - :onchange => "course_attachment_contenttypes_searchex(this.value)" %> - <% end %> - + +
+ + <% if attachmenttypes.any? %> +       + + <%= select_tag "attachment_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_from_collection_for_select(attachmenttypes, "id", "typeName"), + :onchange => "course_attachmenttypes_searchex(this.value)" %> + <% end %> + <% if sufixtypes.any? %> +   + + <%= select_tag "attach_sufix_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_for_select(sufixtypes), + :onchange => "course_attachment_contenttypes_searchex(this.value)" %> + <% end %> + + <%= link_to(l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") if User.current.allowed_to?(:manage_files, @course) %> + <%= link_to(l(:label_relation_files), 'javascript:void(0);', :onclick => "$('#upload_file_div').slideUp();$('#relation_file_div').slideToggle();", :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @course) %> + @@ -54,7 +57,7 @@
<% end -%> -
+
diff --git a/app/views/files/_course_new.html.erb b/app/views/files/_course_new.html.erb index 960b2d399..7a5aa265f 100644 --- a/app/views/files/_course_new.html.erb +++ b/app/views/files/_course_new.html.erb @@ -1,23 +1,23 @@ -

<%=l(:label_attachment_new)%>

-<% attachmenttypes = course.attachmenttypes %> -<%= error_messages_for 'attachment' %> -<%= form_tag(course_files_path(course), :multipart => true,:remote => true,:method => :post,:name=>"upload_form", :class => "tabular") do %> -
-

- <% if attachmenttypes.any? %> - <%= l(:attachment_type) %> - <%= select_tag "attachment_type", - options_from_collection_for_select(attachmenttypes, "id", - "typeName", 2), {style: 'width:100px'} %> - <% end %> -

- -

<%=l(:label_attachment_plural)%><%= render :partial => 'attachments/form' %>

-
-<%= submit_tag l(:button_add) %> -<% end %> -
- +
+ <%=l(:label_attachment_new)%> + <% attachmenttypes = course.attachmenttypes %> + <%= error_messages_for 'attachment' %> + <%= form_tag(course_files_path(course), :multipart => true,:remote => true,:method => :post,:name=>"upload_form", :class => "tabular") do %> + +

+ <% if attachmenttypes.any? %> + <%= l(:attachment_type) %> + <%= select_tag "attachment_type", + options_from_collection_for_select(attachmenttypes, "id", + "typeName", 2), {style: 'width:100px'} %> + <% end %> +

+ +

<%=l(:label_attachment_plural)%><%= render :partial => 'attachments/form' %>

+ + <%= submit_tag l(:button_add) %> + <% end %> +