-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
550e217
commit cb9702c
Showing
6 changed files
with
67 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,7 @@ | |
margin-bottom: 0px; | ||
} | ||
} | ||
|
||
.inline { | ||
display: inline; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,32 @@ | ||
#result | ||
%table.table.table-striped.table-hover | ||
%thead | ||
%table.table.table-striped.table-hover | ||
%thead | ||
%tr | ||
%th= t(".actions") | ||
%th= User.human_attribute_name(:name) | ||
%th= t(".date_added") | ||
%th= User.human_attribute_name(:username) | ||
%th= User.human_attribute_name(:email) | ||
- if local_assigns[:f] | ||
%th= ProductAccessGroup.model_name.human | ||
%tbody | ||
- @product_users.each do |product_user| | ||
- user = product_user.user | ||
%tr | ||
%th= t(".actions") | ||
%th= User.human_attribute_name(:name) | ||
%th= t(".date_added") | ||
%th= User.human_attribute_name(:username) | ||
%th= User.human_attribute_name(:email) | ||
- if local_assigns[:f] | ||
%th= ProductAccessGroup.model_name.human | ||
%tbody | ||
- @product_users.each do |product_user| | ||
- user = product_user.user | ||
%tr | ||
%td.centered | ||
= link_to t("shared.remove"), | ||
[current_facility, @product, user], | ||
method: :delete, | ||
data: { confirm: text("confirm_removal", product_type: @product.model_name.human.downcase) } | ||
%td.centered | ||
= link_to t("shared.remove"), | ||
[current_facility, @product, user], | ||
method: :delete, | ||
data: { confirm: text("confirm_removal", product_type: @product.model_name.human.downcase) } | ||
|
||
%td= link_to(user.last_first_name, [current_facility, user]) | ||
%td= month_day_year(product_user.approved_at) | ||
%td= user.username | ||
%td= user.email | ||
- if local_assigns[:f] | ||
%td | ||
= f.fields_for :product_users, product_user, index: product_user.id do |pu| | ||
= pu.select :product_access_group_id, | ||
options_from_collection_for_select(@product.product_access_groups, "id", "name", product_user.product_access_group_id), | ||
include_blank: true | ||
%td= link_to(user.last_first_name, [current_facility, user]) | ||
%td= month_day_year(product_user.approved_at) | ||
%td= user.username | ||
%td= user.email | ||
- if local_assigns[:f] | ||
%td | ||
= f.fields_for :product_users, product_user, index: product_user.id do |pu| | ||
= pu.select :product_access_group_id, | ||
options_from_collection_for_select(@product.product_access_groups, "id", "name", product_user.product_access_group_id), | ||
include_blank: true | ||
|
||
= will_paginate(@product_users) | ||
= will_paginate(@product_users) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,33 @@ | ||
- if @product_users.nil? | ||
- elsif @product_users.empty? | ||
-if @search_action_performed | ||
:javascript | ||
$(document).ready(function() { | ||
$("form#ajax_form").submit(submitAjaxForm); | ||
}) | ||
|
||
#result | ||
- if @product_users.present? || @search_action_performed | ||
-# There are users to search for or the search action was performed | ||
= form_tag polymorphic_path([:search, current_facility, @product, :users]), id: "ajax_form", class: "inline", method: :get do | ||
= label_tag :access_list_search, text("search_form.label") | ||
= text_field_tag :search, nil, size: 50, class: "search-query", id: "access_list_search", value: @search_action_performed | ||
= submit_tag text("search_form.button"), class: "btn" | ||
|
||
- if @product_users.nil? | ||
- # Access list not required for this product | ||
- elsif @product_users.empty? && @search_action_performed | ||
- # search results returned empty | ||
%p.notice= text("no_results") | ||
- else | ||
- elsif @product_users.empty? | ||
- # no users have access to this product, no search was performed | ||
%p.notice= text("empty_access_list") | ||
- else | ||
- if @product.has_product_access_groups? | ||
= form_for @product, url: [current_facility, @product, :update_restrictions], method: :put do |f| | ||
= render "table", f: f | ||
= f.submit text("update", plural_label: ProductAccessGroup.model_name.human.pluralize), | ||
class: ["btn", "btn-primary"] | ||
- else | ||
= render "table" | ||
- if @search_action_performed.blank? | ||
-# Search action wasn't performed or it was performed with the empty string | ||
= render "export_csv" | ||
|
||
- if @product.has_product_access_groups? | ||
= form_for @product, url: [current_facility, @product, :update_restrictions], method: :put do |f| | ||
= render "table", f: f | ||
= f.submit text("update", plural_label: ProductAccessGroup.model_name.human.pluralize), | ||
class: ["btn", "btn-primary"] | ||
- else | ||
= render "table" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters