% roles = Role.order('builtin, position') %> <% shifts = Role.order('builtin, position') %> <% role_shifts = RoleShift.joins(:role, :shift) .where(:project_id => @project.id) .order("#{Role.table_name}.builtin, #{Role.table_name}.position") %> <%= error_messages_for 'role_shift' %>
<%= l(:field_role) %> (<%= l(:field_shift) %>) | <% role_shifts.each do |role_shift| %> |
---|---|
<%= role_shift.role.name %> (<%= role_shift.shift.name %>)
<% if defined? remote_form_for %>
<% form = remote_form_for(:role_shift, role_shift, :url => { :controller => 'role_shifts', :action => 'edit', :id => role_shift },
:method => :post,
:html => { :id => "role-shift-#{role_shift.id}-form", :class => 'hol' }) do |f| %>
<%= select_tag('role_shift[shift_id]', options_from_collection_for_select(shifts, :id, :name, role_shift.shift.id)) %> <%= submit_tag(l(:button_change), :class => "small") %> <%= link_to_function(l(:button_cancel), "$('role-shift-#{role_shift.id}-form').hide(); return false;") %> <% end %> <% else %> <% form = form_for(role_shift, :as => :role_shift, :url => { :controller => 'role_shifts', :action => 'edit', :id => role_shift }, :method => :post, :remote => true, :html => { :id => "role-shift-#{role_shift.id}-form", :class => 'hol' }) do |f| %><%= select_tag('role_shift[shift_id]', options_from_collection_for_select(shifts, :id, :name, role_shift.shift.id)) %> <%= submit_tag(l(:button_change), :class => "small") %> <%= link_to_function(l(:button_cancel), "$('#role-shift-#{role_shift.id}-form').hide(); return false;") %> <% end %> <% end %> <%= form if Rails::VERSION::MAJOR >= 3 %> |
<% if defined? link_to_remote %> <%= link_to_function(l(:button_edit), "$('role-shift-#{role_shift.id}-form').show(); return false;", :class => 'icon icon-edit') %> <%= link_to_remote(l(:button_delete), { :url => { :controller => 'role_shifts', :action => 'destroy', :id => role_shift }, :method => :post, :confirm => l(:text_are_you_sure) }, :title => l(:button_delete), :class => 'icon icon-del') %> <% else %> <%= link_to_function(l(:button_edit), "$('#role-shift-#{role_shift.id}-form').show(); return false;", :class => 'icon icon-edit') %> <%= link_to(l(:button_delete), { :controller => 'role_shifts', :action => 'destroy', :id => role_shift }, :method => :post, :remote => true, :confirm => l(:text_are_you_sure), :title => l(:button_delete), :class => 'icon icon-del') %> <% end %> |
<%= l(:label_no_data) %>
<% end %>