diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index a90ca1d12..ba1a2b817 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -805,7 +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 e0daa44f4..7cd46b65a 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/models/journals_for_message.rb b/app/models/journals_for_message.rb index 58880919e..997bb6f62 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/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index 179e2d58f..6f0b35ae9 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 67f3c5a8d..2e7607bbf 100644 --- a/app/views/courses/_course_form.html.erb +++ b/app/views/courses/_course_form.html.erb @@ -93,7 +93,8 @@ - ".html_safe %>

+ ".html_safe %> +

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

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

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

+ <% end %> +

@@ -291,12 +294,12 @@ - +

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

diff --git a/app/views/courses/_homework_form.html.erb b/app/views/courses/_homework_form.html.erb index b30785e1b..6e49fcdea 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 %>

diff --git a/app/views/courses/new_homework.html.erb b/app/views/courses/new_homework.html.erb index ec25cef0f..b3fff9e5f 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" %> 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 000000000..0ceb8f157 --- /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 000000000..9985d26cd --- /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 000000000..45e0b0600 --- /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 3fd5f1050..c5f15694e 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 000000000..246d9161f --- /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 000000000..9a9514372 --- /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 000000000..493bd7fd0 --- /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 027460e1f..cc3d68cba 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