Skip to content
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 15 commits into from
Jan 26, 2024
Merged
7 changes: 7 additions & 0 deletions app/assets/javascripts/_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ $(document).ready(function() {
$('form#ajax_form').submit(function(e){
e.preventDefault(); //Prevent the normal submission action
var form = $(this);
var hideElementAttr = form.attr('data-hide-target');
giladshanan marked this conversation as resolved.
Show resolved Hide resolved
var hideElement = $(`[${hideElementAttr}]`);
var submit = $("input[type='submit']",form);
var submit_val = submit.val();
submit.val("Please Wait...");
Expand All @@ -23,6 +25,11 @@ $(document).ready(function() {
$('#result').html(r);
submit.val(submit_val);
submit.attr("disabled", false);

if (hideElement) {
var input_value = form.find('input[type=text]').val();
giladshanan marked this conversation as resolved.
Show resolved Hide resolved
hideElement.attr('hidden', input_value.length > 0);
}
},
error: function() {
$('#result').html('<p>There was an error retrieving results. Please try again.</p>');
Expand Down
4 changes: 2 additions & 2 deletions app/views/product_users/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
= 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" }
= link_to t("reports.product_users.export"), url_for(format: :csv), class: "js--exportSearchResults pull-right", data: { form: ".search_form", action: "export_csv" }
giladshanan marked this conversation as resolved.
Show resolved Hide resolved

-# TODO: Use i8n
= form_tag polymorphic_path([:search, current_facility, @product, :users]), id: "ajax_form", method: :get do
= form_tag polymorphic_path([:search, current_facility, @product, :users]), id: "ajax_form", method: :get, data: { "hide-target": "data-action='export_csv'" } do
= label_tag :access_list_search, "Search"
= text_field_tag :search, nil, size: 50, class: "search-query", id: "access_list_search"
= submit_tag "Search", class: "btn"
Expand Down