Skip to content

Commit

Permalink
Merge pull request #12174 from Jaganathancse/disable_export_for_no_se…
Browse files Browse the repository at this point in the history
…lection

Disable export button when no profile is selected
  • Loading branch information
himdel committed Nov 21, 2016
2 parents 5c6e7b0 + 510b6b3 commit eaf5abc
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions app/views/miq_policy/_export.html.haml
@@ -1,5 +1,4 @@
- url = url_for(:action => 'export_field_changed')
- observe = {:url => url}.to_json
#profile_export_div
= render :partial => "layouts/flash_msg"
%h3
Expand Down Expand Up @@ -83,22 +82,30 @@
%div{:style => "overflow: auto; width: 400px; border: 1px solid #999999;"}
= select_tag('choices_chosen[]',
options_for_select(@sb[:new][:choices].sort),
:class => "selected-policies",
:size => 15,
:style => "width: 400px",
:multiple => true,
"data-miq_observe" => observe)
:multiple => true)
%table{:width => "100%"}
%tr
%td{:align => "right"}
#buttons
- t = _("Export Selected %{title}") % {:title => title}
= link_to(_('Export'),
{:action => "export", :button => "export"},
:class => "btn btn-primary",
:class => "btn btn-primary export-policies disabled",
:alt => t,
"data-miq_sparkle_on" => true,
"data-miq_sparkle_off" => true,
"data-submit" => "profile_export_div",
:remote => true,
"data-method" => :post,
:title => t)
:javascript
$('.selected-policies').change(function() {
if($(this).val()) {
$('.export-policies').removeClass('disabled');
} else {
$('.export-policies').addClass('disabled');
}
});

0 comments on commit eaf5abc

Please sign in to comment.