From 09d79ae4e0b1b2ec25d175b4f2a8c4f3d73c80ba Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 27 Jun 2014 10:10:30 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=BB=98=E8=AE=A4=E6=97=A5=E6=9C=9F=E4=B8=BA?= =?UTF-8?q?=E5=BD=93=E5=89=8D=E6=97=B6=E9=97=B4=E7=9A=84=E4=B8=8B=E4=B8=80?= =?UTF-8?q?=E5=A4=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/_homework_form.html.erb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/courses/_homework_form.html.erb b/app/views/courses/_homework_form.html.erb index b30785e1..6e49fcde 100644 --- a/app/views/courses/_homework_form.html.erb +++ b/app/views/courses/_homework_form.html.erb @@ -25,11 +25,12 @@

<%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT %>

<%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT %>

- -

<%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;" %><%= calendar_for('bid_deadline')%> +<% time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') %> +

<%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;",:value => "#{time}") %><%= calendar_for('bid_deadline')%>

<%= f.select :is_evaluation, is_evaluation_option %>

From 3f8f1411079f86e25422e27198f5654f794d4843 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 27 Jun 2014 15:35:55 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=97=B6=EF=BC=8C=E7=94=B1=E4=BA=8E=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E5=8F=82=E6=95=B0=E9=94=99=E8=AF=AF=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E5=A4=B1=E8=B4=A5=E5=90=8E=EF=BC=8C=E5=86=8D?= =?UTF-8?q?=E6=AC=A1=E8=BE=93=E5=85=A5=E9=94=99=E8=AF=AF=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E4=BC=9A=E6=8A=A5=E9=94=99=E3=80=82=E5=A6=82=E5=86=8D=E6=AC=A1?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E5=8F=82=E6=95=B0=E6=AD=A3=E7=A1=AE=EF=BC=8C?= =?UTF-8?q?=E4=BC=9A=E8=BF=9B=E5=85=A5=E4=B8=80=E4=B8=AA=E7=A9=BA=E7=99=BD?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=20=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 4 ++++ app/controllers/courses_controller.rb | 16 +++------------- app/views/bids/_bid_homework_show.html.erb | 19 +++++++++++-------- app/views/courses/_course_form.html.erb | 13 ++++++++----- app/views/courses/new_homework.html.erb | 3 +-- 5 files changed, 27 insertions(+), 28 deletions(-) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 87879f24..ba1a2b81 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -805,6 +805,10 @@ class BidsController < ApplicationController @homework = @bid @course = Course.find_by_id(params[:course_id]) @course_id = @course.id + #respond_to do |format| + # format.html { redirect_to new_homework_course_path(params[:course_id]),:layout => 'base_courses'} + # format.api { render_validation_errors(@bid) } + #end render file: 'courses/new_homework', layout: 'base_courses' end end diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index c0d7c1e2..3a81d36d 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -489,19 +489,9 @@ class CoursesController < ApplicationController # 新建作业 def new_homework - if (User.current.logged? && - (User.current.admin? || - ( - !Member.where('user_id = ? and course_id = ?', User.current.id, @course.id).first.nil? && - ( - Member.where('user_id = ? and course_id = ?', User.current.id, @course.id).first.roles && - ( Role.where(id: [3, 4, 7, 9]).size > 0 ) - ) - ) - ) - ) - @homework = Bid.new - @homework.safe_attributes = params[:bid] + @homework = Bid.new + @homework.safe_attributes = params[:bid] + if (User.current.logged? && User.current.member_of_course?(Course.find params[:id] )) render :layout => 'base_courses' else render_404 diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index 179e2d58..6f0b35ae 100644 --- a/app/views/bids/_bid_homework_show.html.erb +++ b/app/views/bids/_bid_homework_show.html.erb @@ -70,8 +70,8 @@ - <% if bid.reward_type.nil? or bid.reward_type == 1 %> <%= l(:label_bids_reward_method) %><%= l(:label_call_bonus) %> <%= l(:label_RMB_sign) %> - <%= bid.budget%> <% elsif bid.reward_type == 2 %> <%= l(:label_bids_reward_method) %><%= bid.budget%> + <% if bid.reward_type.nil? or bid.reward_type == 1 %> <%= l(:label_bids_reward_method) %><%= l(:label_call_bonus) %> <%= l(:label_RMB_sign) %> + <%= bid.budget%> <% elsif bid.reward_type == 2 %> <%= l(:label_bids_reward_method) %><%= bid.budget%> <% else %> <% end %> @@ -83,9 +83,12 @@ - <%= l(:label_create_time) %> :  <%=format_time bid.created_on %> <%= l(:field_deadline) %> :  <%=bid.deadline %> - - + + + <%= l(:label_create_time) %> :  <%=format_time bid.created_on %> <%= l(:field_deadline) %> :  <%=bid.deadline %> + + + @@ -94,7 +97,7 @@ <% end %> \ No newline at end of file diff --git a/app/views/courses/_course_form.html.erb b/app/views/courses/_course_form.html.erb index d223bbad..ddcad7b9 100644 --- a/app/views/courses/_course_form.html.erb +++ b/app/views/courses/_course_form.html.erb @@ -94,7 +94,8 @@ - ".html_safe %>

+ ".html_safe %> +

<% elsif @course.time == 2009 %>

@@ -237,7 +238,8 @@ ".html_safe %>
<%= l(:label_term) %> *  

<% end %> - <% end %> + <% end %> + <% unless @course.nil? %> <% if @course.term == l(:label_spring) %> @@ -277,7 +279,8 @@ <% end %> - <% end %>

+ <% end %> +

@@ -292,12 +295,12 @@ - +

<%= l(:text_command) %> <% end %> - +

diff --git a/app/views/courses/new_homework.html.erb b/app/views/courses/new_homework.html.erb index e1fd553b..335ce910 100644 --- a/app/views/courses/new_homework.html.erb +++ b/app/views/courses/new_homework.html.erb @@ -1,6 +1,5 @@

<%=l(:label_course_new_homework)%>

- -<%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_homework'} do |f| %> +<%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_homework',:course_id => "#{params[:id] || params[:course_id]}"} do |f| %>
<%= render :partial => 'homework_form', :locals => { :f => f } %> <%= submit_tag l(:button_create), :class => "enterprise" %> From f6d9bfc91d46e787b3f95415369e91e21c977e49 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 30 Jun 2014 11:15:52 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=97=B6=E4=BC=A0=E9=80=92=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/new_homework.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/courses/new_homework.html.erb b/app/views/courses/new_homework.html.erb index ec25cef0..b3fff9e5 100644 --- a/app/views/courses/new_homework.html.erb +++ b/app/views/courses/new_homework.html.erb @@ -1,6 +1,6 @@

<%=l(:label_course_new_homework)%>

-<%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_homework',:course_id=>@course.id} do |f| %> +<%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_homework',:course_id => "#{params[:id] || params[:course_id]}"} do |f| %>
<%= render :partial => 'homework_form', :locals => { :f => f } %> <%= submit_tag l(:button_create), :class => "enterprise" %> From 9a8c5ebecc1affc657368ca5bd64f26d77713d3b Mon Sep 17 00:00:00 2001 From: z9hang Date: Mon, 30 Jun 2014 16:19:28 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E5=BE=97=E5=88=86?= =?UTF-8?q?=E8=A7=84=E5=88=99=E6=98=BE=E7=A4=BA=20=E7=95=99=E8=A8=80?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E6=9C=AA=E5=8A=A0=E5=88=86bug=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/journals_for_message.rb | 6 +- .../users/_activity_new_score_index.html.erb | 8 +++ .../users/_influence_new_score_index.html.erb | 6 ++ .../users/_project_new_score_index.html.erb | 2 + app/views/users/_show_new_score.html.erb | 10 +-- .../users/activity_new_score_index.js.erb | 1 + .../users/influence_new_score_index.js.erb | 1 + .../users/project_new_score_index.js.erb | 1 + db/schema.rb | 61 +++++++++++++++++-- 9 files changed, 84 insertions(+), 12 deletions(-) create mode 100644 app/views/users/_activity_new_score_index.html.erb create mode 100644 app/views/users/_influence_new_score_index.html.erb create mode 100644 app/views/users/_project_new_score_index.html.erb create mode 100644 app/views/users/activity_new_score_index.js.erb create mode 100644 app/views/users/influence_new_score_index.js.erb create mode 100644 app/views/users/project_new_score_index.js.erb diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 58880919..997bb6f6 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -15,9 +15,9 @@ class JournalsForMessage < ActiveRecord::Base "m_reply_id" # 回复某留言的留言id(a留言回复了b留言,这是b留言的id) acts_as_tree :foreign_key => 'm_parent_id', :counter_cache => :m_reply_count, :order => "#{JournalsForMessage.table_name}.created_on ASC" - belongs_to :project, - :foreign_key => 'jour_id', - :conditions => "#{self.table_name}.jour_type = 'Project' " + belongs_to :project + #:foreign_key => 'jour_id', + #:conditions => "#{self.table_name}.jour_type = 'Project' " belongs_to :course, :foreign_key => 'jour_id', :conditions => "#{self.table_name}.jour_type = 'Course' " diff --git a/app/views/users/_activity_new_score_index.html.erb b/app/views/users/_activity_new_score_index.html.erb new file mode 100644 index 00000000..0ceb8f15 --- /dev/null +++ b/app/views/users/_activity_new_score_index.html.erb @@ -0,0 +1,8 @@ +
技术得分:
+
    踩别人的帖子 -2
+
    帖子被一级会员顶 +4
+
    帖子被二级会员顶 +6
+
    帖子被三级会员顶 +8
+
    帖子被一级会员踩 -2
+
    帖子被二级会员踩 -4
+
    帖子被三级会员踩 -6
\ No newline at end of file diff --git a/app/views/users/_influence_new_score_index.html.erb b/app/views/users/_influence_new_score_index.html.erb new file mode 100644 index 00000000..9985d26c --- /dev/null +++ b/app/views/users/_influence_new_score_index.html.erb @@ -0,0 +1,6 @@ +
项目贡献得分:
+
    提交代码 +4
+
    提交文档 +4
+
    提交附件 +4
+
    更新缺陷完成度 +2
+
    发布缺陷 +4
\ No newline at end of file diff --git a/app/views/users/_project_new_score_index.html.erb b/app/views/users/_project_new_score_index.html.erb new file mode 100644 index 00000000..45e0b060 --- /dev/null +++ b/app/views/users/_project_new_score_index.html.erb @@ -0,0 +1,2 @@ +
影响力得分:
+
    被关注人数 +2/人
diff --git a/app/views/users/_show_new_score.html.erb b/app/views/users/_show_new_score.html.erb index 3fd5f105..c5f15694 100644 --- a/app/views/users/_show_new_score.html.erb +++ b/app/views/users/_show_new_score.html.erb @@ -48,23 +48,23 @@ - <%= l(:label_user_score) %> : + <%= link_to l(:label_user_score) , {:controller => 'users', :action => 'score_new_index', :remote => true} %> : <%= format("%.2f" , @user.user_score_attr.total_score).to_f %>
- <%= l(:label_user_score_of_collaboration) %> : + <%= link_to l(:label_user_score_of_collaboration), {:controller => 'users',:action => 'topic_new_score_index', :remote => true} %> : <%= format("%.2f" , @user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_f %>
- <%= l(:label_user_score_of_influence) %> : + <%= link_to l(:label_user_score_of_influence), {:controller => 'users',:action => 'project_new_score_index', :remote => true} %> : <%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence).to_f %>
- <%= l(:label_user_score_of_skill) %> : + <%= link_to l(:label_user_score_of_skill), {:controller => 'users',:action => 'activity_new_score_index', :remote => true} %> : <%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_f %>
- <%= l(:label_user_score_of_active) %> : + <%= link_to l(:label_user_score_of_active), {:controller => 'users',:action => 'influence_new_score_index', :remote => true} %> : <%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_f %>
diff --git a/app/views/users/activity_new_score_index.js.erb b/app/views/users/activity_new_score_index.js.erb new file mode 100644 index 00000000..246d9161 --- /dev/null +++ b/app/views/users/activity_new_score_index.js.erb @@ -0,0 +1 @@ +$('#show_score_detail').html('<%= escape_javascript(render :partial => 'users/activity_new_score_index', :locals => {:index =>0 }) %>'); \ No newline at end of file diff --git a/app/views/users/influence_new_score_index.js.erb b/app/views/users/influence_new_score_index.js.erb new file mode 100644 index 00000000..9a951437 --- /dev/null +++ b/app/views/users/influence_new_score_index.js.erb @@ -0,0 +1 @@ +$('#show_score_detail').html('<%= escape_javascript(render :partial => 'users/influence_new_score_index', :locals => {:index =>0 }) %>'); \ No newline at end of file diff --git a/app/views/users/project_new_score_index.js.erb b/app/views/users/project_new_score_index.js.erb new file mode 100644 index 00000000..493bd7fd --- /dev/null +++ b/app/views/users/project_new_score_index.js.erb @@ -0,0 +1 @@ +$('#show_score_detail').html('<%= escape_javascript(render :partial => 'users/project_new_score_index', :locals => {:index =>0 }) %>'); \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index 027460e1..cc3d68cb 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20140617013146) do +ActiveRecord::Schema.define(:version => 20140626012511) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -175,6 +175,58 @@ ActiveRecord::Schema.define(:version => 20140617013146) do add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true + create_table "code_review_assignments", :force => true do |t| + t.integer "issue_id" + t.integer "change_id" + t.integer "attachment_id" + t.string "file_path" + t.string "rev" + t.string "rev_to" + t.string "action_type" + t.integer "changeset_id" + end + + create_table "code_review_project_settings", :force => true do |t| + t.integer "project_id" + t.integer "tracker_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "updated_by" + t.boolean "hide_code_review_tab", :default => false + t.integer "auto_relation", :default => 1 + t.integer "assignment_tracker_id" + t.text "auto_assign" + t.integer "lock_version", :default => 0, :null => false + t.boolean "tracker_in_review_dialog", :default => false + end + + create_table "code_review_user_settings", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.integer "mail_notification", :default => 0, :null => false + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "code_reviews", :force => true do |t| + t.integer "project_id" + t.integer "change_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "line" + t.integer "updated_by_id" + t.integer "lock_version", :default => 0, :null => false + t.integer "status_changed_from" + t.integer "status_changed_to" + t.integer "issue_id" + t.string "action_type" + t.string "file_path" + t.string "rev" + t.string "rev_to" + t.integer "attachment_id" + t.integer "file_count", :default => 0, :null => false + t.boolean "diff_all" + end + create_table "comments", :force => true do |t| t.string "commented_type", :limit => 30, :default => "", :null => false t.integer "commented_id", :default => 0, :null => false @@ -374,12 +426,13 @@ ActiveRecord::Schema.define(:version => 20140617013146) do create_table "homework_attaches", :force => true do |t| t.integer "bid_id" t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.string "reward" t.string "name" t.string "description" t.integer "state" + t.integer "project_id", :default => 0 end create_table "homework_for_courses", :force => true do |t| @@ -740,7 +793,7 @@ ActiveRecord::Schema.define(:version => 20140617013146) do end create_table "relative_memos", :force => true do |t| - t.integer "osp_id", :null => false + t.integer "osp_id" t.integer "parent_id" t.string "subject", :null => false t.text "content", :null => false