diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 9cd398958..53a854f02 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -487,6 +487,7 @@ class ShixunsController < ApplicationController #@shixun.major_id = params[:major_id] @shixun.trainee = params[:trainee] @shixun.webssh = params[:webssh].to_i + @shixun.can_copy = params[:can_copy].to_i @shixun.identifier = identifier # if params[:course_id] # params[:course_id].each do |course_id| @@ -665,6 +666,7 @@ class ShixunsController < ApplicationController @shixun.language = params[:language] @shixun.trainee = params[:trainee] @shixun.webssh = params[:webssh].to_i + @shixun.can_copy = params[:can_copy].to_i # if params[:course_id] # @shixun.shixun_major_courses.destroy_all # params[:course_id].each do |course_id| diff --git a/app/views/shixuns/_form.html.erb b/app/views/shixuns/_form.html.erb index 4bf50e168..6de4bb834 100644 --- a/app/views/shixuns/_form.html.erb +++ b/app/views/shixuns/_form.html.erb @@ -102,6 +102,13 @@ +
  • + + + name="can_copy" value="1" id="can_copy" class="ml5 mr5 magic-checkbox" > + + +
  • 提交 <%= link_to "取消", shixuns_path, :class => "task-btn fr mr10" %> diff --git a/app/views/shixuns/_settings_edit.html.erb b/app/views/shixuns/_settings_edit.html.erb index 6d3741c93..1e8dadbac 100644 --- a/app/views/shixuns/_settings_edit.html.erb +++ b/app/views/shixuns/_settings_edit.html.erb @@ -50,7 +50,13 @@
  • - +
  • + + + name="can_copy" value="<%= @shixun.can_copy ? 1 : 0 %>" id="can_copy" class="ml5 mr5 magic-checkbox" > + + +
  • 保存
  • diff --git a/app/views/shixuns/_settings_show.html.erb b/app/views/shixuns/_settings_show.html.erb index fca669be8..1c7b6a309 100644 --- a/app/views/shixuns/_settings_show.html.erb +++ b/app/views/shixuns/_settings_show.html.erb @@ -58,6 +58,13 @@ +
  • + + + name="can_copy" value="<%= @shixun.can_copy ? 1 : 0 %>" id="can_copy" disabled="disabled" class="ml5 mr5 magic-checkbox" > + + +
  • diff --git a/app/views/shixuns/_shixun_top.html.erb b/app/views/shixuns/_shixun_top.html.erb index 386e43567..08b887ce8 100644 --- a/app/views/shixuns/_shixun_top.html.erb +++ b/app/views/shixuns/_shixun_top.html.erb @@ -29,16 +29,16 @@ <%= link_to "继续实战", operation_shixun_path(@shixun, :myshixun_id => myshixun.try(:id)), :class => "fr shixun-task-btn task-btn-orange mr15 ", :id => "shixun_operation", :remote => true %> <% end %> <%= link_to '发送至', search_user_courses_shixun_path(@shixun), :remote => true, :class => "fr shixun-task-btn task-btn-green mr15" %> - <% if User.current.manager_of_shixun?(@shixun) %> - <%= link_to "复制", copy_shixun_path(@shixun), :class => "fr shixun-task-btn task-btn-green mr15" %> - - <% end %> <% elsif @shixun.status == 3 %> <% unless myshixun.blank? %> <%= link_to "继续实战", operation_shixun_path(@shixun, :myshixun_id => myshixun.try(:id)), :class => "fr shixun-task-btn task-btn-orange mr15 ", :id => "shixun_operation", :remote => true %> <% end %> 已关闭 <% end %> + <% if @shixun.can_copy && User.current.manager_of_shixun?(@shixun) %> + <%= link_to "复制", copy_shixun_path(@shixun), :class => "fr shixun-task-btn task-btn-green mr15" %> + + <% end %> <% end %>
    <% unless User.current.manager_of_shixun?(@shixun) %>