diff --git a/app/views/generic_object_definition/_show_actions.html.haml b/app/views/generic_object_definition/_show_actions.html.haml index 9310d6b2f1d..ecd3527a223 100644 --- a/app/views/generic_object_definition/_show_actions.html.haml +++ b/app/views/generic_object_definition/_show_actions.html.haml @@ -1,6 +1,6 @@ #main_div = render :partial => "layouts/flash_msg" - - unless @record.custom_button_sets.empty? + - if @record.custom_button_sets.present? %hr %h3 = _('Button Groups') @@ -13,32 +13,14 @@ = _('Hover Text') %tbody - @record.custom_button_sets.each do |obj| - %tr{:title => 'hi'} + %tr %td.table-view-pf-select %i{:class => obj.set_data[:button_icon], :style => obj.set_data.key?(:button_color) ? "color: #{obj.set_data[:button_color]};" : nil} %td = obj[:name] %td = obj[:description] - - unless @record.custom_buttons.empty? - %hr - %h3 - = _('Buttons') - %table.table.table-bordered.table-hover.table-striped - %thead - %th.table-view-pf-select - %th - = _('Text') - %th - = _('Hover Text') - %tbody - - @record.custom_buttons.each do |obj| - %tr{:title => 'hi'} - %td.table-view-pf-select - %i{:class => obj.options[:button_icon], :style => obj.options.key?(:button_color) ? "color: #{obj.options[:button_color]};" : nil} - %td - = obj[:name] - %td - = obj[:description] + - if @record.custom_buttons.present? + = render :partial => 'table_button' , :locals => {:buttons => @record.custom_buttons.sort_by{ |button| button.name.downcase }} :javascript $('#searchbox').hide(); diff --git a/app/views/generic_object_definition/_show_custom_button_group.html.haml b/app/views/generic_object_definition/_show_custom_button_group.html.haml index 02394c843d7..2f916eb71fd 100644 --- a/app/views/generic_object_definition/_show_custom_button_group.html.haml +++ b/app/views/generic_object_definition/_show_custom_button_group.html.haml @@ -31,25 +31,7 @@ %hr = render :partial => 'layouts/info_msg', :locals => {:message => _("No Buttons found.")} - else - %hr - %h3 - = _('Buttons') - %table.table.table-bordered.table-hover.table-striped - %thead - %th.table-view-pf-select - %th - = _('Text') - %th - = _('Hover Text') - %tbody - - @record.custom_buttons.each do |obj| - %tr{:title => 'hi'} - %td.table-view-pf-select - %i{:class => obj.options[:button_icon], :style => obj.options.key?(:button_color) ? "color: #{obj.options[:button_color]};" : nil} - %td - = obj[:name] - %td - = obj[:description] + = render :partial => 'table_button', :locals => {:buttons => @record.set_data[:button_order].map{ |id| CustomButton.find_by(:id => id) }} %generic-object-definition-toolbar#generic_object_definition_show_form{'record-id' => @record.id, 'entity' => _('Custom Button Group'), diff --git a/app/views/generic_object_definition/_table_button.html.haml b/app/views/generic_object_definition/_table_button.html.haml new file mode 100644 index 00000000000..f481dd397ca --- /dev/null +++ b/app/views/generic_object_definition/_table_button.html.haml @@ -0,0 +1,19 @@ +%hr + %h3 + = _('Buttons') + %table.table.table-bordered.table-hover.table-striped + %thead + %th.table-view-pf-select + %th + = _('Text') + %th + = _('Hover Text') + %tbody + - buttons.each do |obj| + %tr + %td.table-view-pf-select + %i{:class => obj.options[:button_icon], :style => obj.options.key?(:button_color) ? "color: #{obj.options[:button_color]};" : nil} + %td + = obj[:name] + %td + = obj[:description]