Project

General

Profile

Download (2.84 KB) Statistics
| Branch: | Tag: | Revision:
<%= form_for @role do |f| %>
<%= base_errors_for @role %>

<ul class="nav nav-tabs" data-tabs="tabs">
<li class="active"><a href="#primary" data-toggle="tab"><%= _("Role") %></a></li>
<% if User.current.allowed_to?(:view_filters) %>
<li><a href="#filters" data-toggle="tab"><%= _('Filters') %></a></li>
<% end %>
</ul>

<div class="tab-content">
<div class="tab-pane active" id="primary">
<%= text_f f, :name, :class => @role.builtin? ? "disabled" : "" %>
<%= textarea_f f, :description, :rows=> 5, :size => "col-md-4" %>
<%= hidden_field_tag :original_role_id, @original_role_id if @cloned_role %>

<% if show_location_tab? || show_organization_tab? %>
<%= alert(:close => false, :class => 'alert-info', :header => '', :text => (_("Changes to following associations will propagate to all inheriting filters") + ' ' +
popover("", _("When the role's associated %{orgs_or_locs} are changed,<br> the change will propagate to all inheriting filters.
Filters that are set to override <br> will remain untouched. Overriding of role filters can be easily disabled by <br> pressing the \"Disable overriding\" button.
Note that not all filters support <br> %{orgs_and_locs}, so these always remain global.") % { :orgs_or_locs => org_loc_string('or'), :orgs_and_locs => org_loc_string('and') },
:title => _("Role %s.") % org_loc_string('and'))).html_safe) %>
<% end %>

<% if show_location_tab? %>
<%= multiple_checkboxes f, :locations, f.object, User.current.my_locations, { :label => _("Locations") } %>
<% end %>

<% if show_organization_tab? %>
<%= multiple_checkboxes f, :organizations, f.object, User.current.my_organizations, { :label => _("Organizations") } %>
<% end %>
</div>

<div class="tab-pane" id="filters">
<% if @role.new_record? %>
<%= alert :header => '', :class => 'alert-warning',
:text => _("Please save the role first. You can edit it later to add filters") %>
<% else %>
<div data-ajax-url="<%= filters_path(:role_id => @role, :paginate => 'client') %> table" data-on-complete="tfm.tools.activateDatatables">
<%= spinner(_('Loading filters ...')) %>
</div>
<hr>
<%= link_to_if_authorized(_("New filter"), hash_for_new_filter_path(:role_id => @role),
{ :class => 'btn btn-success pull-right'} ) %>
<% if Taxonomy.enabled_taxonomies.any? %>
<%= link_to_if_authorized(_('Disable all filters overriding'), hash_for_disable_filters_overriding_role_path(:id => @role),
:method => :patch, :class => 'btn btn-default pull-right') %>
<% end %>
<% end %>
</div>

<%= submit_or_cancel f %>
</div>
<% end %>
(1-1/4)