From a56c200967fb5cf8ccdbdde78e385e5a5bca1621 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Mon, 26 May 2014 09:37:06 +0800
Subject: [PATCH 1/4] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8D=E4=BD=9C=E4=B8=9A?=
=?UTF-8?q?=E7=95=99=E8=A8=80=E8=B6=85=E8=BF=87=E4=B8=80=E9=A1=B5=E6=9D=A1?=
=?UTF-8?q?=E6=95=B0=E9=99=90=E5=88=B6=E6=97=B6=E4=B8=8D=E4=BC=9A=E5=87=BA?=
=?UTF-8?q?=E7=8E=B0=E6=8D=A2=E9=A1=B5=E6=A0=87=E7=AD=BE=E7=9A=84BUG=202.?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=82=B9=E5=87=BB=E4=BD=9C=E4=B8=9A=E5=90=8D?=
=?UTF-8?q?=E7=A7=B0=E4=B8=BA=E4=B8=8B=E8=BD=BD=E4=BD=9C=E4=B8=9A=EF=BC=8C?=
=?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=92=E8=AF=84=E6=8C=89=E9=92=AE=E8=BF=9B?=
=?UTF-8?q?=E5=85=A5=E4=BD=9C=E4=B8=9A=E4=BA=92=E8=AF=84=E9=A1=B5=E9=9D=A2?=
=?UTF-8?q?=203.=E5=A2=9E=E5=8A=A0=E5=88=A4=E6=96=AD=E5=BD=93=E5=89=8D?=
=?UTF-8?q?=E7=94=A8=E6=88=B7=E6=98=AF=E4=B8=8D=E6=98=AF=E6=8C=87=E5=AE=9A?=
=?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=9A=84=E6=88=90=E5=91=98=E7=9A=84=E6=96=B9?=
=?UTF-8?q?=E6=B3=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/bids_helper.rb | 11 +++++++++++
app/views/bids/_homework_list.html.erb | 2 +-
app/views/homework_attach/_showjour.html.erb | 10 +++++++++-
app/views/homework_attach/show.html.erb | 7 -------
4 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/app/helpers/bids_helper.rb b/app/helpers/bids_helper.rb
index 721b30361..a5c25ecb5 100644
--- a/app/helpers/bids_helper.rb
+++ b/app/helpers/bids_helper.rb
@@ -145,6 +145,17 @@ module BidsHelper
people.include?(User.current)
end
+ # 当前用户是否加入了此课程(包括教师)
+ def is_cur_course_user? bid
+ people = []
+ #people << bid.author
+ course = bid.courses.first
+ course.members.each do |member|
+ people << member.user
+ end
+ people.include?(User.current)
+ end
+
# def select_option_helper option
# tmp = Hash.new
# option.each do |project|
diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb
index f7db8a375..3bcd12964 100644
--- a/app/views/bids/_homework_list.html.erb
+++ b/app/views/bids/_homework_list.html.erb
@@ -44,7 +44,7 @@
<% end %>
Date: Fri, 30 May 2014 11:21:31 +0800
Subject: [PATCH 2/4] fix
---
app/views/homework_attach/show.html.erb.orig | 157 -------------------
1 file changed, 157 deletions(-)
delete mode 100644 app/views/homework_attach/show.html.erb.orig
diff --git a/app/views/homework_attach/show.html.erb.orig b/app/views/homework_attach/show.html.erb.orig
deleted file mode 100644
index 65b5424e0..000000000
--- a/app/views/homework_attach/show.html.erb.orig
+++ /dev/null
@@ -1,157 +0,0 @@
-
-
-<% is_student = is_cur_course_student? @homework.bid.courses.first %>
-<% is_teacher = is_course_teacher User.current,@homework.bid.courses.first %>
-
-<%= notice %>
-
-
-
-
-
-
-
-
- 作业基础信息<%=@count %>
-
-
-
- 发布人员:<%= link_to @homework.user, user_path(@homework.user)%>
-
- 发布时间:<%=format_time @homework.created_at %>
-
-
-
-
- 作业下载:
- <% options = {:author => true } %>
- <%= render :partial => 'app_link', :locals => {:attachments => @homework.attachments, :options => options} %>
-
-
- 所属任务:<%= link_to(@homework.bid.name, project_for_bid_path(@homework.bid))%>
-
-
-
-
- 平均评分:
- <%= rating_for @homework, :static => true, dimension: :quality, class: 'rateable div_inline' %>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 作业描述:
-
- <% @homework.attachments.map do |attachment| %>
- <% if attachment.description != nil && attachment.description != "" %>
-
-
- <%= attachment.description %>
-
-
- <% end %>
- <% end %>
-
-
-
-
-
-
-
-
- 作业得分:
-
-
-
-
得分比例
-
- <% 100.step(20,-20) do |star| %>
-
- <%= @stars_status_map["star#{(star/20).to_s}".to_sym] %>
-
- <% end %>
-
-
-
- <% score = @homework.average(:quality).try(:avg).try(:round, 2).to_s %>
-
最终得分
-
- <% if score == "" %>
- 0分
- <% else %>
- <%= score %>分
- <% end %>
-
-
- <%= rating_for @homework, :static => true, dimension: :quality, class: 'rateable div_inline' %>
-
-
-
-
打分总人数
-
-
- <%= @homework.raters(:quality).count%>
-
-
-
-
-
-
-
-
-
- <%= render :partial => 'comprehensive_evaluation', :locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework} %>
-
-
-
-
-
作业评论:
- <% if is_student %>
-
评分:
- <%= rating_for @homework, dimension: :quality, class: 'rateable div_inline' %>
- (您可以重新打分,打分结果以最后一次打分为主!)
-
- <% end %>
-
-
-<% if !is_teacher %>
-
-
- <%= render :partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0, :is_comprehensive_evaluation => nil} %>
-
-<% end %>
-
-
-
-<<<<<<< HEAD
- <%= render :partial => 'showjour', :locals => {:jour => @jour} %>
-=======
- <%= render :partial => 'showjour', :locals => {:jour => @jour,:homework => @homework} %>
->>>>>>> 8c33cf0afb89556112710759615cbd88bb0326f2
-
-
-
-
From e6c8dbef4f8ab3970553a20156028a2477acdbda Mon Sep 17 00:00:00 2001
From: "ShengYue.Xu" <27055684@qq.com>
Date: Wed, 20 Aug 2014 21:22:19 +0800
Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E7=89=88?=
=?UTF-8?q?=E6=9D=83=E7=AC=A6=E5=8F=B7=EF=BC=8C=E7=94=B1=E5=8E=9F=E6=9D=A5?=
=?UTF-8?q?=E7=9A=84@=E6=94=B9=E6=88=90=E4=BA=86=C2=A9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/layouts/_base_footer.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/layouts/_base_footer.html.erb b/app/views/layouts/_base_footer.html.erb
index 74610d14b..9aae725fc 100644
--- a/app/views/layouts/_base_footer.html.erb
+++ b/app/views/layouts/_base_footer.html.erb
@@ -11,7 +11,7 @@
<%=l(:label_organizers)%>
- <%=l(:label_copyright)%>@2007~2014
+ <%=l(:label_copyright)%>©2007~2014
From 047f6d2c952f5f5fb80fdeb3d4c388767e38b4b9 Mon Sep 17 00:00:00 2001
From: "ShengYue.Xu" <27055684@qq.com>
Date: Thu, 21 Aug 2014 19:57:49 +0800
Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E7=BC=BA?=
=?UTF-8?q?=E9=99=B7=E5=BD=93=E4=B8=AD=20#868=E3=80=81#780=E3=80=81#603?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/course.rb | 5 ++-
app/models/news.rb | 1 +
app/models/project.rb | 2 +-
.../contests/show_attendingcontest.html.erb | 16 ++++----
app/views/files/_course_file.html.erb | 37 +++++++++--------
app/views/files/_course_new.html.erb | 40 +++++++++----------
6 files changed, 53 insertions(+), 48 deletions(-)
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? %>
-
-
<%= l(:attachment_browse) %>
- <%= 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? %>
-
-
<%= l(:attachment_sufix_browse) %>
- <%= 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 %>
-
+
+
+
<%= l(:label_search_name) %>
+ <% if attachmenttypes.any? %>
+
+
<%= l(:attachment_browse) %>
+ <%= 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? %>
+
+
<%= l(:attachment_sufix_browse) %>
+ <%= 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) %>
+
<%= render :partial => 'course_new', locals: {course: @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 %>
+