From 5fb0bc945c7cc361e041fbf6d20594c61c148bd0 Mon Sep 17 00:00:00 2001 From: baiyu Date: Wed, 30 Oct 2013 21:22:44 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E2=80=9C=E6=88=91=E7=9A=84=E8=B4=A6=E5=8F=B7=E2=80=9D?= =?UTF-8?q?=E5=90=8E=E7=9A=84=E5=B0=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_base_college_header.html.erb | 4 +++- app/views/layouts/_base_enterprise_header.html.erb | 3 +++ lib/redmine.rb | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/_base_college_header.html.erb b/app/views/layouts/_base_college_header.html.erb index 3de3f5788..da9a58045 100644 --- a/app/views/layouts/_base_college_header.html.erb +++ b/app/views/layouts/_base_college_header.html.erb @@ -2,7 +2,9 @@ - +
+ <%= render_menu :account_menu -%> +
<%= content_tag('div', "#{link_to(l(:label_layouts_feedback)+'(' + User.current.count_new_jour.to_s + ')', feedback_path(User.current))}".html_safe, :id => 'loggedas') if User.current.logged? %> <%= content_tag('div', "#{l(:label_logged_as)} #{link_to_user(User.current, :format => :username)}".html_safe, :id => 'loggedas') if User.current.logged? %> diff --git a/app/views/layouts/_base_enterprise_header.html.erb b/app/views/layouts/_base_enterprise_header.html.erb index 06b3fb2bd..7fd21afe1 100644 --- a/app/views/layouts/_base_enterprise_header.html.erb +++ b/app/views/layouts/_base_enterprise_header.html.erb @@ -14,6 +14,9 @@
+
+ <%= render_menu :account_menu -%>
<%= content_tag('div', "#{link_to(l(:label_layouts_feedback)+'(' + User.current.count_new_jour.to_s + ')', feedback_path(User.current))}".html_safe, :id => 'loggedas') if User.current.logged? %> diff --git a/lib/redmine.rb b/lib/redmine.rb index 38b1a063e..4de558af3 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -254,7 +254,7 @@ end Redmine::MenuManager.map :account_menu do |menu| menu.push :login, :signin_path, :if => Proc.new { !User.current.logged? } menu.push :register, :register_path, :if => Proc.new { !User.current.logged? && Setting.self_registration? } - menu.push :my_account, { :controller => 'my', :action => 'account' }, :if => Proc.new { User.current.logged? } + # menu.push :my_account, { :controller => 'my', :action => 'account' }, :if => Proc.new { User.current.logged? } menu.push :logout, :signout_path, :html => {:method => 'post'}, :if => Proc.new { User.current.logged? } end ########fq From 9b9745ea0afa9f290ed190380d914609a5b3445f Mon Sep 17 00:00:00 2001 From: baiyu Date: Wed, 30 Oct 2013 21:46:40 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=AF=B9=E4=BA=8E=E5=BA=94=E6=A0=87?= =?UTF-8?q?=E9=9C=80=E6=B1=82=EF=BC=8C=E6=8F=90=E4=BA=A4=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=EF=BC=8C=E6=8F=90=E4=BA=A4=E7=AB=9E=E8=B5=9B=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E5=90=8E=E9=97=AA=E5=87=BA=E7=9A=84flash?= =?UTF-8?q?=E5=81=9A=E4=BA=86=E5=8C=BA=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 14 +++++++++++++- config/locales/zh.yml | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 6c4e6697f..3b03eb1ff 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -380,7 +380,19 @@ class BidsController < ApplicationController bid_message = params[:bid_for_save][:bid_message] if BidingProject.where("project_id = ? and bid_id = ?", project.id, @bid.id).size == 0 if BidingProject.cerate_bidding(@bid.id, project.id, bid_message) - flash[:notice] = l(:label_bidding_succeed) + + # added by bai type ==1 需求,type==2 竞赛, type==3 作业 + if @bid.reward_type == 1 + flash[:notice] = l(:label_bidding_succeed) + + elsif @bid.reward_type == 2 + flash[:notice] = l(:label_bidding_contest_succeed) + + else @bid.reward_type == 3 + flash[:notice] = l(:label_bidding_homework_succeed) + end + # end + end else if @bid.reward_type == 3 diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 7b766249e..2accfd9e4 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1298,6 +1298,8 @@ zh: label_wrong_budget: 错误的金额格式 label_wrong_date: 时间格式错误,请输入正确的时间 yyyy-mm-dd label_bidding_succeed: 应标成功 + label_bidding_contest_succeed: 竞赛提交成功 #added by bai + label_bidding_homework_succeed: 作业提交成功 #added by bai label_bidding_fail: 应标失败,该项目已经应标 label_bidding_homework_fail: 作业提交失败,该作业已经被提交! From f55a06e76deaf7c4b9d216df267c66b889f8fafb Mon Sep 17 00:00:00 2001 From: baiyu Date: Wed, 30 Oct 2013 22:04:47 +0800 Subject: [PATCH 3/5] =?UTF-8?q?1=E3=80=81"=E6=B4=BB=E5=8A=A8=E2=80=9C?= =?UTF-8?q?=E5=8F=98=E6=88=90=E4=BA=86=E5=8A=A8=E6=80=81=EF=BC=8C=E2=80=9D?= =?UTF-8?q?=E5=8F=AA=E7=9C=8B=E8=87=AA=E5=B7=B1=E2=80=9C=E6=94=B9=E6=88=90?= =?UTF-8?q?=E4=BA=86=E2=80=9D=E6=88=91=E7=9A=84=E5=8A=A8=E6=80=81=E2=80=9C?= =?UTF-8?q?=202=E3=80=81=E8=A7=A3=E9=87=8A=E4=BA=86=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=98=AF=E4=BB=80=E4=B9=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/user_projects.html.erb | 1 + config/locales/zh.yml | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/users/user_projects.html.erb b/app/views/users/user_projects.html.erb index afa7e522b..3df4bc5dd 100644 --- a/app/views/users/user_projects.html.erb +++ b/app/views/users/user_projects.html.erb @@ -1,4 +1,5 @@ +

温馨提示:项目可以是一次作业,也可以是别人或者自己创建的一项小工程~

<% if @user == User.current %> <%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type => @project_type}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %> <% end %> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 2accfd9e4..ec5ffca22 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -560,7 +560,7 @@ zh: label_assigned_to_me_issues: 指派给我的问题 label_last_login: 最后登录 label_registered_on: 注册于 - label_activity: 活动 + label_activity: 动态 # modified by bai label_overall_activity: 活动概览 label_user_activity: "%{value} 的活动" label_new: 新建 @@ -606,7 +606,7 @@ zh: label_settings: 配置 label_overview: 项目动态 label_course_overview: "课程动态" - label_question_student: 学生反馈 #huang + label_question_student: 作业交流 #bai label_homework_commit: 提交作业 #huang label_homework_info: 作业情况 #huang label_course_news: 课程通知 @@ -1500,7 +1500,7 @@ zh: label_newfeedback_quote: 回复 label_newfeedback_delete: 删除 label_user_all_activity: 所有动态 - label_user_activity_myself: 只看自己 + label_user_activity_myself: 我的动态 # modified by bai label_my_honework_no_homework: 暂无任何作业! label_user_all_respond: 所有反馈 label_layouts_feedback: 留言 From 5dfac1d8e345170cc1f784d8a198758d236dfabc Mon Sep 17 00:00:00 2001 From: xianbo Date: Wed, 30 Oct 2013 22:17:16 +0800 Subject: [PATCH 4/5] add modify about homework and modify the show of toll bar --- app/controllers/bids_controller.rb | 32 ++++++++++++++--- app/models/bid.rb | 5 ++- app/views/bids/_bid_homework_show.html.erb | 26 ++++++++------ app/views/bids/_homework_form.html.erb | 41 ++++++++++++++++++++++ app/views/bids/edit.html.erb | 9 +++++ app/views/layouts/base_courses.html.erb | 7 ++-- app/views/projects/homework.html.erb | 7 ---- config/locales/zh.yml | 3 +- config/routes.rb | 7 ++-- lib/redmine.rb | 2 +- 10 files changed, 107 insertions(+), 32 deletions(-) create mode 100644 app/views/bids/_homework_form.html.erb create mode 100644 app/views/bids/edit.html.erb diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 3b03eb1ff..36216530b 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -1,14 +1,15 @@ # fq class BidsController < ApplicationController #Added by young + menu_item l(:label_homework), :only => [:edit, :udpate] menu_item :respond menu_item :project, :only => [:show_project,:show_results] menu_item :homework_respond, :only => :homework_respond menu_item :homework_statistics, :only => :homework_statistics #Ended by young - before_filter :find_bid, :only => [:show, :show_project, :create,:destroy,:more,:back,:add,:new,:show_results,:set_reward, :add_homework, :fork, :create_fork, + before_filter :find_bid, :only => [:show, :show_project, :create, :destroy, :more, :back, :add,:new,:show_results,:set_reward, :add_homework, :fork, :create_fork, :show_course, :show_bid_project, :show_bid_user] - before_filter :require_login,:only => [:set_reward] + before_filter :require_login,:only => [:set_reward, :destroy, :add, :new, ] helper :watchers helper :attachments @@ -77,7 +78,6 @@ class BidsController < ApplicationController end #end end - #huang def contest @@ -583,7 +583,31 @@ class BidsController < ApplicationController render :action => 'new_bid' end end - + + def edit + @project_id = params[:project_id] + @bid = Bid.find(params[:bid_id]) + respond_to do |format| + format.html { + @project = Project.find(params[:project_id]) + @user= User.find(User.current.id) + render :layout => 'base_courses' + } + end + end + + def update + @bid = Bid.find(params[:id]) + if @bid.update_attributes(params[:bid]) + flash[:notice] = l(:label_update_homework_succeed) + @project = Project.find(params[:course_id]) + redirect_to project_homework_path(@project) + else + @bid.safe_attributes = params[:bid] + render :action => 'edit' + end + end + def add_homework # homework = HomeworkAttach.create(:bid_id => @bid.id, :user_id => User.current.id) # homework.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads])) diff --git a/app/models/bid.rb b/app/models/bid.rb index 0205df548..3bad65f3c 100644 --- a/app/models/bid.rb +++ b/app/models/bid.rb @@ -61,7 +61,10 @@ class Bid < ActiveRecord::Base safe_attributes 'name', 'description', 'budget', - 'deadline' + 'deadline', + 'homework_type', + 'reward_type' + # safe_attributes 'name', # 'description', diff --git a/app/views/bids/_bid_homework_show.html.erb b/app/views/bids/_bid_homework_show.html.erb index 78a4d6f40..66a83f1d8 100644 --- a/app/views/bids/_bid_homework_show.html.erb +++ b/app/views/bids/_bid_homework_show.html.erb @@ -8,14 +8,21 @@ + + <% if (User.current.admin?||User.current.id==bid.author_id)&&(bid.homework_type == 1)%> + <%= link_to( + l(:button_edit), + {:action => 'edit', :controller=>'bids', :project_id =>@project.id, :bid_id => bid.id}, + :class => 'icon icon-edit' + ) %> + <%= link_to( + l(:button_delete), + {:action => 'homework_destroy', :controller=>'bids', :course_id => bid.id}, + :method => :post, + :data => {:confirm => l(:text_are_you_sure)}, + :class => 'icon icon-del' + ) %> + <% end %> @@ -59,5 +66,4 @@
    <%= pagination_links_full bid_pages %>
      - - + \ No newline at end of file diff --git a/app/views/bids/_homework_form.html.erb b/app/views/bids/_homework_form.html.erb new file mode 100644 index 000000000..fe6f35fb3 --- /dev/null +++ b/app/views/bids/_homework_form.html.erb @@ -0,0 +1,41 @@ + + + + +<%= error_messages_for 'bid' %> + +

      <%= l(:label_homeworks_form_new_description) %>

      +

      <%= 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')%> +

      +

      <%= f.select :homework_type, homework_type_option %> +

      +

      <%= hidden_field_tag 'course_id', @project_id %> +

      +
      <%= l(:label_attachment_plural) %> +

      <%= render :partial => 'attachments/form', :locals => {:container => @homework} %>

      +
      \ No newline at end of file diff --git a/app/views/bids/edit.html.erb b/app/views/bids/edit.html.erb new file mode 100644 index 000000000..028a1a88e --- /dev/null +++ b/app/views/bids/edit.html.erb @@ -0,0 +1,9 @@ +

      修改作业

      + +<%= labelled_form_for @bid do |f| %> +
      + <%= render :partial => 'homework_form', :locals => { :f => f } %> + <%= submit_tag l(:button_create) %> + <%= javascript_tag "$('#bid_name').focus();" %> + <% end %> +
      \ No newline at end of file diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index b9ed0f1be..ac3938a0b 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -1,8 +1,7 @@ - - <%= h html_title %> + <%= csrf_meta_tag %> @@ -175,9 +174,7 @@ <% if User.current.logged? && (User.current.admin? || (!Member.where('user_id = ? and project_id = ?', User.current.id, @project.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @project.id).first.roles&Role.where('id = ? or id = ?', 3, 7)).size >0))%> -
    • - <%= link_to l(:label_course_settings), {:controller => 'projects', :action => 'settings', :id => @project}, :class => link_class(:settings)%> -
    • +
    <% end %> diff --git a/app/views/projects/homework.html.erb b/app/views/projects/homework.html.erb index 8db482544..37c4d71bd 100644 --- a/app/views/projects/homework.html.erb +++ b/app/views/projects/homework.html.erb @@ -11,13 +11,6 @@ <% end %> - - -
<%= link_to(bid.author.lastname+bid.author.firstname, user_path(bid.author), :class => 'bid_user') %>:  <%= link_to(bid.name, respond_path(bid), :class => 'bid_path') %> - - <%= link_to( - l(:button_delete), - {:action => 'homework_destroy', :controller=>'bids', :course_id => bid.id}, - :method => :post, - :data => {:confirm => l(:text_are_you_sure)}, - :class => 'icon icon-del' - ) if (User.current.admin?||User.current.id==bid.author_id)&&(bid.homework_type == 1)%>
-
diff --git a/config/locales/zh.yml b/config/locales/zh.yml index ec5ffca22..91e0e8d06 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1653,4 +1653,5 @@ zh: label_watch_no_projects: 没有关注任何项目 label_has_watched_project: 关注的项目 label_project_take: 参与的项目 - label_peoject_take_in: 加入了项目: \ No newline at end of file + label_peoject_take_in: 加入了项目: + label_update_homework_succeed: 作业更新成功 \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 6b2bee154..156bb8fd2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -132,7 +132,7 @@ RedmineApp::Application.routes.draw do post 'issues/:object_id/watchers', :to => 'watchers#create', :object_type => 'issue' delete 'issues/:object_id/watchers/:user_id' => 'watchers#destroy', :object_type => 'issue' - + resources :bids, :only=>[:edit,:update] resources :projects do member do get 'settings(/:tab)', :action => 'settings', :as => 'settings' @@ -147,7 +147,6 @@ RedmineApp::Application.routes.draw do get 'new_homework', :action => 'new_homework', :as => 'new_homework' #get 'news', :action => 'news', :as => 'news' #end - post 'modules' post 'archive' post 'unarchive' @@ -156,7 +155,7 @@ RedmineApp::Application.routes.draw do match 'copy', :via => [:get, :post] end - + #by young match '/member', :controller => 'projects', :action => 'member', :as => 'member', :via => :get match '/file', :controller => 'projects', :action => 'file', :as => 'file', :via => :get @@ -398,6 +397,8 @@ RedmineApp::Application.routes.draw do get 'autocomplete_for_new_user' end end + + match 'workflows', :controller => 'workflows', :action => 'index', :via => :get match 'workflows/edit', :controller => 'workflows', :action => 'edit', :via => [:get, :post] diff --git a/lib/redmine.rb b/lib/redmine.rb index 4de558af3..e4e639f91 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -324,7 +324,7 @@ Redmine::MenuManager.map :course_menu do |menu| # menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural # menu.push :files, { :controller => 'files', :action => 'index' }, :caption => :label_file_new, :param => :project_id menu.push :repository, { :controller => 'repositories', :action => 'show', :repository_id => nil, :path => nil, :rev => nil, :course => 1 } - menu.push :settings, { :controller => 'projects', :action => 'settings', :course => 1 }, :last => true + # menu.push :settings, { :controller => 'projects', :action => 'settings', :course => 1 }, :last => true end Redmine::MenuManager.map :user_menu do |menu| From c6eec75f1ff1d74896a4e7098976f56e0866a14e Mon Sep 17 00:00:00 2001 From: baiyu Date: Wed, 30 Oct 2013 22:17:40 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E9=83=A8?= =?UTF-8?q?=E5=88=86=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/locales/zh.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 91e0e8d06..a19b512fe 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1279,7 +1279,7 @@ zh: field_add: 添加于 %{time} 之前 button_more: 更多 label_user_response: 用户反馈 - label_student_response: 学生反馈 + label_student_response: 留言讨论区 # modified by bai label_bidding_project: 参与项目 label_homework_project: 已提交作业 #huang button_bidding: 我要参加 @@ -1340,7 +1340,7 @@ zh: label_investment_budget: 投资预算: label_investment_time_limit: 投资时限: label_my_respond: 我要反馈: - label_my_question: 有疑问请在此处提出! + label_my_question: 请在此处留下您的意见或者问题~ # modified by bai label_respond_requirement: 对需求进行了反馈 label_question_requirement: 对作业提出了问题! label_deadline: 投资时限yyyy-mm-dd @@ -1654,4 +1654,4 @@ zh: label_has_watched_project: 关注的项目 label_project_take: 参与的项目 label_peoject_take_in: 加入了项目: - label_update_homework_succeed: 作业更新成功 \ No newline at end of file + label_update_homework_succeed: 作业更新成功