Skip to content

Commit

Permalink
Merge pull request #1376 from epwinchell/responsive_selector
Browse files Browse the repository at this point in the history
make textarea based item selector responsive
  • Loading branch information
Dan Clarizio authored May 31, 2017
2 parents d7d80c6 + 9cf0eed commit c6e3ae2
Show file tree
Hide file tree
Showing 13 changed files with 608 additions and 724 deletions.
97 changes: 50 additions & 47 deletions app/views/catalog/_column_lists.html.haml
Original file line number Diff line number Diff line change
@@ -1,52 +1,55 @@
#column_lists
- url = url_for_only_path(:action => 'st_catalog_form_field_changed', :id => (@edit[:rec_id] || "new"))
%table.form#formtest{:width => "100%"}
%tr
%td.widthed{:align => "left"}= _('Unassigned:')
%td
%td{:align => "left"}= _('Selected:')
%tr
%td{:align => "right", :valign => "top"}
= select_tag("available_fields[]",
options_for_select(@edit[:new][:available_fields]),
:multiple => true,
:style => "width: 450px",
:size => 8,
:id => "available_fields")
%td.text-center{:width => "40"}
.btn-group-vertical
- if @edit[:new][:available_fields].length == 0
%button.btn.btn-default.disabled
%i.fa.fa-angle-right.fa-lg
- else
- t = _("Move Selected buttons right")
%button.btn.btn-default{:title => t,
"data-submit" => 'column_lists',
"data-miq_sparkle_on" => true,
:remote => true,
"data-method" => :post,
'data-click_url' => {:url => "#{url}?button=right"}.to_json}
%i.fa.fa-angle-right.fa-lg
.col-md-5
= _('Unassigned:')
= select_tag("available_fields[]",
options_for_select(@edit[:new][:available_fields]),
:multiple => true,
:class => "form-control",
:style => "overflow-x: scroll;",
:size => 8,
:id => "available_fields")

- if @edit[:new][:fields].length == 0
%button.btn.btn-default.disabled
%i.fa.fa-angle-left.fa-lg
- else
- t = _("Move Selected buttons left")
%button.btn.btn-default{:title => t,
"data-submit" => 'column_lists',
"data-miq_sparkle_on" => true,
:remote => true,
"data-method" => :post,
'data-click_url' => {:url => "#{url}?button=left"}.to_json}
%i.fa.fa-angle-left.fa-lg
.col-md-1{:style => "padding: 10px"}
.spacer
.spacer
- if @edit[:new][:available_fields].length == 0
%button.btn.btn-default.btn-block.disabled
%i.fa.fa-angle-right.fa-lg.hidden-xs.hidden-sm
%i.fa.fa-angle-right.fa-lg.fa-rotate-90.hidden-md.hidden-lg
- else
- t = _("Move Selected buttons right")
%button.btn.btn-default.btn-block{:title => t,
"data-submit" => 'column_lists',
"data-miq_sparkle_on" => true,
:remote => true,
"data-method" => :post,
'data-click_url' => {:url => "#{url}?button=right"}.to_json}
%i.fa.fa-angle-right.fa-lg.hidden-xs.hidden-sm
%i.fa.fa-angle-right.fa-lg.fa-rotate-90.hidden-md.hidden-lg

- if @edit[:new][:fields].length == 0
%button.btn.btn-default.btn-block.disabled
%i.fa.fa-angle-left.fa-lg.hidden-xs.hidden-sm
%i.fa.fa-angle-left.fa-lg.fa-rotate-90.hidden-md.hidden-lg
- else
- t = _("Move Selected buttons left")
%button.btn.btn-default.btn-block{:title => t,
"data-submit" => 'column_lists',
"data-miq_sparkle_on" => true,
:remote => true,
"data-method" => :post,
'data-click_url' => {:url => "#{url}?button=left"}.to_json}
%i.fa.fa-angle-left.fa-lg.hidden-xs.hidden-sm
%i.fa.fa-angle-left.fa-lg.fa-rotate-90.hidden-md.hidden-lg
.spacer


%td{:align => "left", :valign => "top"}
= select_tag("selected_fields[]",
options_for_select(@edit[:new][:fields], @selected),
:multiple => true,
:style => "width: 450px",
:size => 8,
:id => "selected_fields")
.col-md-5
= _('Selected:')
= select_tag("selected_fields[]",
options_for_select(@edit[:new][:fields], @selected),
:multiple => true,
:class => "form-control",
:style => "overflow-x: scroll;",
:size => 8,
:id => "selected_fields")
38 changes: 15 additions & 23 deletions app/views/miq_ae_class/_domains_priority_form.html.haml
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
= render :partial => "layouts/flash_msg"
#domains_list
%table#formtest.form{:width => '50%'}
%tr
%td.widthed{:align => "left"}= _("Domains:")
%td
%tr
%td{:align => "left", :valign => "top"}
= select_tag('seq_fields[]',
options_for_select(@edit[:new][:domain_order], @selected),
:multiple => true, :style => "width: 450px", :size => 20, :id => "seq_fields")
%td{:width => "30", :align => "left", :valign => "middle"}
= link_image_if(:cond => (@edit[:new][:domain_order].length < 2),
:image => image_path('toolbars/up.png'),
:opts_true => {:class => "dimmed small"},
:opts_false => {:class => "rollover small", :alt => t = _("Move selected fields up")},
:link => {:action => 'priority_form_field_changed', :button => 'up', :id => "priority__edit"},
:opts_link => {:remote => true, 'data-method' => :post, "data-submit" => "domains_list", :title => t})
= link_image_if(:cond => (@edit[:new][:domain_order].length < 2),
:image => image_path('toolbars/down.png'),
:opts_true => {:class => "dimmed small"},
:opts_false => {:class => "rollover small", :alt => (t = _("Move selected fields down"))},
:link => {:action => 'priority_form_field_changed', :button => 'down', :id => "priority__edit"},
:opts_link => {:remote => true, 'data-method' => :post, "data-submit" => "domains_list", :title => t})
#div.note= _('* Select one or more consecutive groups to move up or down.')
.row
.col-md-7.col-sm-10.col-xs-10
= _("Domains:")
= select_tag('seq_fields[]',
options_for_select(@edit[:new][:domain_order], @selected),
:multiple => true, :class => "form-control", :style => "overflow-x: scroll;", :size => 20, :id => "seq_fields")
%small= _('* Select one or more consecutive groups to move up or down.')

- button_params = @edit[:new][:domain_order].length >= 2 ? [[_("Move selected fields up"), 'domains_list', 'up', 'fa-angle-up'],
[_("Move selected fields down"), 'domains_list', 'down', 'fa-angle-down']] : []
= render :partial => "shared/views/seq_selector_buttons",
:locals => {:fields_count => @edit[:new][:domain_order].length,
:button_params => button_params,
:button_action => 'priority_form_field_changed',
:id => 'priority__edit'}
49 changes: 15 additions & 34 deletions app/views/miq_ae_class/_fields_seq_form.html.haml
Original file line number Diff line number Diff line change
@@ -1,39 +1,20 @@
= render :partial => "layouts/flash_msg"
#column_lists
%p
%table#formtest.form{:width => '50%'}
%tr
%td.widthed{:align => "left"}= _('Class Schema Sequencing:')
%td
%tr
%td{:align => "left", :valign => "top"}
= select_tag('seq_fields[]',
options_for_select(@edit[:new][:fields_list], @selected),
:multiple => true, :style => "width: 450px", :size => 20, :id => "seq_fields")
%td{:width => "30", :align => "left", :valign => "middle"}
= link_image_if(:cond => (@edit[:new][:fields].length < 2),
:image => image_path('toolbars/up.png'),
:opts_true => {:class => "dimmed small"},
:opts_false => {:class => "rollover small", :alt => (t = _("Move selected fields up"))},
:link => {:action => 'fields_seq_field_changed', :button => 'up', :id => "seq"},
:opts_link => {:title => t,
"data-miq_sparkle_on" => true,
"data-miq_sparkle_off" => true,
"data-submit" => 'column_lists',
"data-method" => :post,
:remote => true})
= link_image_if(:cond => (@edit[:new][:fields].length < 2),
:image => image_path('toolbars/down.png'),
:opts_true => {:class => "dimmed small"},
:opts_false => {:class => "rollover small", :alt => (t = _("Move selected fields down"))},
:link => {:action => 'fields_seq_field_changed', :button => 'down', :id => "seq"},
:opts_link => {:title => t,
"data-miq_sparkle_on" => true,
"data-miq_sparkle_off" => true,
"data-submit" => 'column_lists',
"data-method" => :post,
:remote => true})
.note= _('* Select one or more consecutive fields to move up or down.')
.col-md-7.col-sm-10.col-xs-10
= _('Class Schema Sequencing:')
= select_tag('seq_fields[]',
options_for_select(@edit[:new][:fields_list], @selected),
:multiple => true, :class => "form-control", :style => "overflow-x: scroll;", :size => 20, :id => "seq_fields")
%small= _('* Select one or more consecutive fields to move up or down.')

- button_params = @edit[:new][:fields].length >= 2 ? [[_("Move selected fields up"), 'column_lists', 'up', 'fa-angle-up'],
[_("Move selected fields down"), 'column_lists', 'down', 'fa-angle-down']] : []
= render :partial => "shared/views/seq_selector_buttons",
:locals => {:fields_count => @edit[:new][:fields].length,
:button_params => button_params,
:button_action => 'fields_seq_field_changed',
:id => 'seq'}

:javascript
// disable any other tabs on screen when in edit
miq_tabs_disable_inactive('#ae_tabs');
94 changes: 41 additions & 53 deletions app/views/miq_policy/_action_options.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -136,54 +136,47 @@
:form_action => "miq_action",
:field_changed_url => "action_field_changed"})
- when "evaluate_alerts"
%h3
= _("Select Alerts to be Evaluated")
.form-horizontal
.form-group
.col-md-8
%table#formtest.form{:width => "100%"}
%tr
%td{:align => "left"}= _('Available Alerts:')
%td
%td.widthed{:align => "left"}= _(' Selected Alerts:')
%tr
%td.widthed{:align => "left", :valign => "top"}
%span#choices_chosen_div
= select_tag('choices_chosen[]', options_for_select(@edit[:choices].sort),
:multiple => true,
:class => "widthed",
:size => 8,
:id => "choices_chosen")
%p
%td{:width => "20", :valign => "middle"}
= link_to(image_tag(image_path('toolbars/right.png'), :class => "rollover small", :alt => (t = _("Move selected Alerts into this Action"))),
{:action => 'action_edit',
:button => 'move_right',
:id => @action.id || 'new'},
"data-miq_sparkle_on" => true,
"data-miq_sparkle_off" => true,
"data-submit" => 'choices_chosen_div',
:remote => true,
"data-method" => :post,
:title => t)
= link_to(image_tag(image_path('toolbars/left.png'), :class => "rollover small", :alt => (t = _("Remove selected Alerts from this Action"))),
{:action => 'action_edit',
:button => 'move_left',
:id => @action.id || 'new'},
"data-miq_sparkle_on" => true,
"data-miq_sparkle_off" => true,
"data-submit" => 'members_chosen_div',
:remote => true,
"data-method" => :post,
:title => t)
%td{:align => "right", :valign => "top"}
%span#members_chosen_div
= select_tag('members_chosen[]',
options_for_select(@edit[:new][:alerts].sort),
:multiple => true,
:class => "widthed",
:size => 8,
:id => "members_chosen")
%h3= _("Select Alerts to be Evaluated")
#formtest.form
.col-md-5
= _('Available Alerts:')
%span#choices_chosen_div
= select_tag('choices_chosen[]', options_for_select(@edit[:choices].sort),
:multiple => true,
:class => "form-control",
:style => "overflow-x: scroll;",
:size => 8,
:id => "choices_chosen")

.col-md-1{:style => "padding: 10px"}
.spacer
.spacer
- [[_("Move selected Alerts into this Action"), 'choices_chosen_div', 'move_right', 'fa-angle-right'],
[_("Remove selected Alerts from this Action"), 'members_chosen_div', 'move_left', 'fa-angle-left']].each do |title, chosen_div, action, arrow_style|
%button.btn.btn-default.btn-block{:title => title,
:remote => true,
"data-submit" => chosen_div,
"data-method" => :post,
"data-miq_sparkle_on" => true,
"data-miq_sparkle_off" => true,
"data-click_url" => {:url => url_for_only_path(:action => 'action_edit',
:button => action,
:id => @action.id || 'new')}.to_json}
%i.fa.fa-lg.hidden-xs.hidden-sm{:class => arrow_style}
%i.fa.fa-lg.fa-rotate-90.hidden-md.hidden-lg{:class => arrow_style}
.spacer
.col-md-5
= _(' Selected Alerts:')
%span#members_chosen_div
= select_tag('members_chosen[]',
options_for_select(@edit[:new][:alerts].sort),
:multiple => true,
:class => "form-control",
:style => "overflow-x: scroll;",
:size => 8,
:id => "members_chosen")
- when "snmp_trap"
%h3
= _("SNMP Trap Settings")
Expand Down Expand Up @@ -367,8 +360,3 @@
:class => "form-control",
"data-miq_observe" => observe_with_interval)
= _('Enter a comma separated list of IP or DNS names')
Loading

0 comments on commit c6e3ae2

Please sign in to comment.