From a50aff3fb42429d6c9761c46f1deab32a43d52bd Mon Sep 17 00:00:00 2001 From: xianbo Date: Thu, 24 Oct 2013 20:36:57 +0800 Subject: [PATCH] 1.add special reward 2.give a root controller in bid controller && give the administrator the root can change the reward who is deadine. --- app/controllers/bids_controller.rb | 2 +- app/views/bids/_list_projects.html.erb | 8 ++- app/views/bids/set_reward.js.erb | 3 + app/views/context_menus/time_entries.html.erb | 62 ++++++++++-------- app/views/courses/_set_join.js.erb | 4 +- public/images/bid/special_reward.png | Bin 0 -> 5731 bytes 6 files changed, 46 insertions(+), 33 deletions(-) create mode 100644 public/images/bid/special_reward.png diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 557c0ae54..b1f0b987d 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -629,7 +629,7 @@ class BidsController < ApplicationController @b_p = nil @biding_project_id = nil - if params[:set_reward][:reward] + if params[:set_reward][:reward]&&((User.current.id==@bid.author_id)||User.current.admin) # @bid_id = params[:id] @biding_project_id = params[:set_reward][:b_id] @b_p = BidingProject.find_by_id(@biding_project_id) diff --git a/app/views/bids/_list_projects.html.erb b/app/views/bids/_list_projects.html.erb index 74207a315..f54c6f982 100644 --- a/app/views/bids/_list_projects.html.erb +++ b/app/views/bids/_list_projects.html.erb @@ -22,7 +22,7 @@ - + <%= l(:label_system_grade) %>:<%= (b_project.project.project_status.grade.nil? ? 0 : b_project.project.project_status.grade) unless (b_project.project.project_status.nil? && b_project.project.nil?) %> <% if get_prize(b_project).nil? or get_prize(b_project) == "" %> <% if @bid.deadline < Date.today %> @@ -41,6 +41,8 @@ <% end %> <% when 2 %> <% case get_prize(b_project) %> + <% when '-1' %> + <%= image_tag("/images/bid/special_reward.png")%> <% when '0' %> <%= image_tag("/images/bid/first_reward.png")%> <% when '1' %> @@ -84,7 +86,7 @@ - <% if User.current.id == @bid.author_id && @bid.deadline > Date.today %> + <% if ((User.current.id == @bid.author_id) && (@bid.deadline > Date.today))||User.current.admin %> <%= toggle_link '评价', b_project.id.to_s %> @@ -97,7 +99,7 @@ <%= f.select :reward," " .html_safe %> <% when 2 %> - <%= f.select :reward," " + <%= f.select :reward," " .html_safe %> <% when 3 %> <%= f.select :reward," diff --git a/app/views/bids/set_reward.js.erb b/app/views/bids/set_reward.js.erb index 868de83be..f3f20aa55 100644 --- a/app/views/bids/set_reward.js.erb +++ b/app/views/bids/set_reward.js.erb @@ -17,6 +17,9 @@ else end when 2 case get_prize(@b_p) + when '-1' + image_tag("/images/bid/s_reward.png") + when '1' when '0' image_tag("/images/bid/first_reward.png") when '1' diff --git a/app/views/context_menus/time_entries.html.erb b/app/views/context_menus/time_entries.html.erb index 10dbcafd2..fa2bd6188 100644 --- a/app/views/context_menus/time_entries.html.erb +++ b/app/views/context_menus/time_entries.html.erb @@ -1,33 +1,41 @@
    - <% if !@time_entry.nil? -%> -
  • <%= context_menu_link l(:button_edit), {:controller => 'timelog', :action => 'edit', :id => @time_entry}, - :class => 'icon-edit', :disabled => !@can[:edit] %>
  • - <% else %> -
  • <%= context_menu_link l(:button_edit), {:controller => 'timelog', :action => 'bulk_edit', :ids => @time_entries.collect(&:id)}, - :class => 'icon-edit', :disabled => !@can[:edit] %>
  • - <% end %> + <% if !@time_entry.nil? -%> +
  • + <%= context_menu_link l(:button_edit), {:controller => 'timelog', :action => 'edit', :id => @time_entry}, + :class => 'icon-edit', :disabled => !@can[:edit] %> +
  • + <% else %> +
  • + <%= context_menu_link l(:button_edit), {:controller => 'timelog', :action => 'bulk_edit', :ids => @time_entries.collect(&:id)}, + :class => 'icon-edit', :disabled => !@can[:edit] %> +
  • + <% end %> - <%= call_hook(:view_time_entries_context_menu_start, {:time_entries => @time_entries, :can => @can, :back => @back }) %> + <%= call_hook(:view_time_entries_context_menu_start, {:time_entries => @time_entries, :can => @can, :back => @back }) %> - <% if @activities.present? -%> -
  • - <%= l(:field_activity) %> -
      - <% @activities.each do |u| -%> -
    • <%= context_menu_link h(u.name), {:controller => 'timelog', :action => 'bulk_update', :ids => @time_entries.collect(&:id), :time_entry => {'activity_id' => u}, :back_url => @back}, :method => :post, - :selected => (@time_entry && u == @time_entry.activity), :disabled => !@can[:edit] %>
    • - <% end -%> -
    • <%= context_menu_link l(:label_none), {:controller => 'timelog', :action => 'bulk_update', :ids => @time_entries.collect(&:id), :time_entry => {'activity_id' => 'none'}, :back_url => @back}, :method => :post, - :selected => (@time_entry && @time_entry.activity.nil?), :disabled => !@can[:edit] %>
    • -
    -
  • - <% end %> + <% if @activities.present? -%> +
  • + <%= l(:field_activity) %> +
      + <% @activities.each do |u| -%> +
    • + <%= context_menu_link h(u.name), {:controller => 'timelog', :action => 'bulk_update', :ids => @time_entries.collect(&:id), :time_entry => {'activity_id' => u}, :back_url => @back}, :method => :post, + :selected => (@time_entry && u == @time_entry.activity), :disabled => !@can[:edit] %> +
    • + <% end -%> +
    • + <%= context_menu_link l(:label_none), {:controller => 'timelog', :action => 'bulk_update', :ids => @time_entries.collect(&:id), :time_entry => {'activity_id' => 'none'}, :back_url => @back}, :method => :post, + :selected => (@time_entry && @time_entry.activity.nil?), :disabled => !@can[:edit] %> +
    • +
    +
  • + <% end %> - <%= call_hook(:view_time_entries_context_menu_end, {:time_entries => @time_entries, :can => @can, :back => @back }) %> + <%= call_hook(:view_time_entries_context_menu_end, {:time_entries => @time_entries, :can => @can, :back => @back }) %> -
  • - <%= context_menu_link l(:button_delete), - {:controller => 'timelog', :action => 'destroy', :ids => @time_entries.collect(&:id), :back_url => @back}, - :method => :delete, :data => {:confirm => l(:text_time_entries_destroy_confirmation)}, :class => 'icon-del', :disabled => !@can[:delete] %> -
  • +
  • + <%= context_menu_link l(:button_delete), + {:controller => 'timelog', :action => 'destroy', :ids => @time_entries.collect(&:id), :back_url => @back}, + :method => :delete, :data => {:confirm => l(:text_time_entries_destroy_confirmation)}, :class => 'icon-del', :disabled => !@can[:delete] %> +
diff --git a/app/views/courses/_set_join.js.erb b/app/views/courses/_set_join.js.erb index 05120a415..32c7dc831 100644 --- a/app/views/courses/_set_join.js.erb +++ b/app/views/courses/_set_join.js.erb @@ -1,8 +1,8 @@ $('#join').replaceWith('<%= escape_javascript join_in_course(course, user) %>'); <% if @state %> <% if @state == 0 %> - alert("加入成功") + alert("加入成功") <% else %> - alert("密码错误") + alert("密码错误") <% end %> <% end %> diff --git a/public/images/bid/special_reward.png b/public/images/bid/special_reward.png new file mode 100644 index 0000000000000000000000000000000000000000..a3a4df59362d4a25d3e9739650b466139c81eb8d GIT binary patch literal 5731 zcmV-p7M$scP)KLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-RIA z6-eL&AQ0xu!e<4=008gy@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5 z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@^6=o|A>zVpu|i=NDG+7} zl4`aK{0#b-!z=TL9Wt0BGO&T{GJWpjryhdijfaIQ&2!o}p04JRKYg3k&Tf zVxhe-O!X z{f;To;xw^bEES6JSc$k$B2CA6xl)ltA<32E66t?3@gJ7`36pmX0IY^jz)rRYwaaY4 ze(nJRiw;=Qb^t(r^DT@T3y}a2XEZW-_W%Hszxj_qD**t_m!#tW0KDiJT&R>6OvVTR z07RgHDzHHZ48atvzz&?j9lXF70$~P3Knx_nJP<+#`N z#-MZ2bTkiLfR>_b(HgWKJ%F~Nr_oF3b#wrIijHG|(J>BYjM-sajE6;FiC7vY#};Gd zST$CUHDeuEH+B^pz@B062qXfFfD`NpUW5?BY=V%GM_5c)L#QR}BeW8_2v-S%gfYS= zB9o|3v?Y2H`NVi)In3rTB8+ej^> zQ=~r95NVuDChL%G$=>7$vVg20myx%S50Foi`^m%Pw-h?Xh~i8Mq9jtJloCocWk2Nv zrJpiFnV_ms&8eQ$2&#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