-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#161789] Access List Enhancements #3983
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
e084b6f
Increae pagination to 50
LeticiaErrandonea 3c7cfdf
Add search for Access List
LeticiaErrandonea 3af4f27
Refactor index and search methods
LeticiaErrandonea 93902bc
Hide/Show Export link
LeticiaErrandonea 590dbc6
Hide search form when there are no users
LeticiaErrandonea 12b1cf9
Remove irrelevant TODO comment
LeticiaErrandonea bd240f8
i8n
LeticiaErrandonea 4c0a0ba
Add specs
LeticiaErrandonea 61ab3e4
Rename @search to be more descriptive
LeticiaErrandonea 5c40130
Prefer double quotes
LeticiaErrandonea 94a8e0f
Remove TODO comment
LeticiaErrandonea 550e217
Move submit handler to function
LeticiaErrandonea 48973a3
Refactor to avoid extra JS usage
LeticiaErrandonea c1702c9
Rename instance var
LeticiaErrandonea 3f5fc07
Update translationg
LeticiaErrandonea File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
= form_tag polymorphic_path([current_facility, @product, :users], format: :csv), method: :get, class: "search_form inline" do | ||
= hidden_field_tag :email, current_user.email, disabled: true | ||
= hidden_field_tag :format, params[:format], disabled: true | ||
|
||
= link_to t("reports.product_users.export"), url_for(format: :csv), class: "js--exportSearchResults pull-right", data: { form: ".search_form" } |
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
:javascript | ||
$(document).ready(function() { | ||
$("form#ajax_form").submit(submitAjaxForm); | ||
}) | ||
|
||
#result | ||
- if @product_users.present? || @search_term | ||
-# 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_term | ||
= submit_tag text("search_form.button"), class: "btn" | ||
|
||
- if @product_users.nil? | ||
- # Access list not required for this product | ||
- elsif @product_users.empty? && @search_term | ||
- # search results returned empty | ||
%p.notice= text("no_results") | ||
- elsif @product_users.empty? | ||
- # no users have access to this product, no search was performed | ||
%p.notice= text("empty_access_list") | ||
- else | ||
- if @search_term.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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,22 +20,4 @@ | |
= text("import_button") | ||
%span{ style:"display:none" }= f.file_field :file, onchange: "form.submit()" | ||
|
||
- if @product_users.nil? | ||
- elsif @product_users.empty? | ||
%p.notice= text("none") | ||
giladshanan marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think there's an entry for this in |
||
- else | ||
= form_tag polymorphic_path([current_facility, @product, :users], format: :csv), method: :get, class: "search_form" do | ||
= hidden_field_tag :email, current_user.email, disabled: true | ||
= hidden_field_tag :format, params[:format], disabled: true | ||
|
||
= link_to t("reports.product_users.export"), url_for(format: :csv), class: "js--exportSearchResults pull-right", data: { form: ".search_form" } | ||
|
||
- 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" | ||
|
||
= will_paginate(@product_users) | ||
= render "users_results" |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
= render "users_results" |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this translation still work in the new partial?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!