Commit d2434652d13f308dade97e3b55b19f82097c3bdf

Authored by Manuel Meurer
1 parent 7172a22f
Exists in master and in 1 other branch production

Refactor multiple buttons into one line

Showing 1 changed file with 2 additions and 6 deletions   Show diff stats
app/views/problems/_table.html.haml
... ... @@ -48,9 +48,5 @@
48 48 = paginate problems
49 49 .tab-bar
50 50 %ul
51   - %li= submit_tag 'Merge', :id => 'merge_problems', :class => 'button', 'data-action' => merge_several_problems_path, :data => { :confirm => problem_confirm }
52   - %li= submit_tag 'Unmerge', :id => 'unmerge_problems', :class => 'button', 'data-action' => unmerge_several_problems_path, :data => { :confirm => problem_confirm }
53   - %li= submit_tag 'Resolve', :id => 'resolve_problems', :class => 'button', 'data-action' => resolve_several_problems_path, :data => { :confirm => problem_confirm }
54   - %li= submit_tag 'Unresolve', :id => 'unresolve_problems', :class => 'button', 'data-action' => unresolve_several_problems_path, :data => { :confirm => problem_confirm }
55   - %li= submit_tag 'Delete', :id => 'delete_problems', :class => 'button', 'data-action' => destroy_several_problems_path, :data => { :confirm => problem_confirm }
56   -
  51 + - %w(merge unmerge resolve unresolve delete).each do |action|
  52 + %li= submit_tag action.capitalize, :id => "#{action}_problems", :class => 'button', :data => { :action => polymorphic_path([action == 'delete' ? 'destroy' : action, 'several_problems']), :confirm => problem_confirm }
... ...