summaryrefslogtreecommitdiff
path: root/engines/support
diff options
context:
space:
mode:
Diffstat (limited to 'engines/support')
-rw-r--r--engines/support/app/helpers/auto_tickets_path_helper.rb6
-rw-r--r--engines/support/app/helpers/tickets_helper.rb8
-rw-r--r--engines/support/app/views/tickets/_tabs.html.haml11
-rw-r--r--engines/support/test/integration/navigation_test.rb2
4 files changed, 13 insertions, 14 deletions
diff --git a/engines/support/app/helpers/auto_tickets_path_helper.rb b/engines/support/app/helpers/auto_tickets_path_helper.rb
index 5638222..c26aac7 100644
--- a/engines/support/app/helpers/auto_tickets_path_helper.rb
+++ b/engines/support/app/helpers/auto_tickets_path_helper.rb
@@ -45,10 +45,8 @@ module AutoTicketsPathHelper
private
def ticket_view_options
- hsh = {}
- hsh[:open_status] = params[:open_status] if params[:open_status] && !params[:open_status].empty?
- hsh[:sort_order] = params[:sort_order] if params[:sort_order] && !params[:sort_order].empty?
- hsh
+ hash = params.slice(:open_status, :sort_order)
+ hash.reject {|k,v| v.blank?}
end
end
diff --git a/engines/support/app/helpers/tickets_helper.rb b/engines/support/app/helpers/tickets_helper.rb
index 7db31dc..58b67ea 100644
--- a/engines/support/app/helpers/tickets_helper.rb
+++ b/engines/support/app/helpers/tickets_helper.rb
@@ -36,7 +36,8 @@ module TicketsHelper
def link_to_status(new_status)
label = ".#{new_status}"
- link_to_navigation label, auto_tickets_path(open_status: new_status, sort_order: search_order)
+ link_to_navigation label, auto_tickets_path(open_status: new_status),
+ active: search_status == new_status
end
def link_to_order(order_field)
@@ -45,11 +46,12 @@ module TicketsHelper
# for not-currently-filtered field link to descending direction
direction ||= 'desc'
label = ".#{order_field}"
- link_to_navigation label, auto_tickets_path(sort_order: order_field + '_at_' + direction, open_status: search_status),
+ link_to_navigation label,
+ auto_tickets_path(sort_order: order_field + '_at_' + direction),
+ active: search_order.start_with?(order_field),
icon: icon
end
-
def new_direction_for_order(order_field)
# return if we're not filtering by this field
return unless search_order.start_with?(order_field)
diff --git a/engines/support/app/views/tickets/_tabs.html.haml b/engines/support/app/views/tickets/_tabs.html.haml
index 7872bb5..a7347e1 100644
--- a/engines/support/app/views/tickets/_tabs.html.haml
+++ b/engines/support/app/views/tickets/_tabs.html.haml
@@ -4,8 +4,7 @@
- unless action?(:new) or action?(:create)
%ul.nav.nav-pills.pull-right.slim
- %w(created updated).each do |order|
- %li{:class=> ("active" if search_order.start_with? order)}
- = link_to_order(order)
+ = link_to_order(order)
-#
-# STATUS FILTER TABS
@@ -13,7 +12,7 @@
%ul.nav.nav-tabs
- if logged_in?
- %w(open closed all).each do |status|
- %li{:class => ("active" if search_status == status)}
- = link_to_status status
- %li{:class => ("active" if action?(:new) || action?(:create))}
- = link_to icon(:plus, :black) + t(".new", cascade: true), auto_new_ticket_path
+ = link_to_status status
+ = link_to_navigation ".new", auto_new_ticket_path,
+ active: action?(:new) || action?(:create),
+ icon: :plus
diff --git a/engines/support/test/integration/navigation_test.rb b/engines/support/test/integration/navigation_test.rb
index 1cf5825..13d51b6 100644
--- a/engines/support/test/integration/navigation_test.rb
+++ b/engines/support/test/integration/navigation_test.rb
@@ -13,7 +13,7 @@ class NavigationTest < BrowserIntegrationTest
click_on 'Created at'
uri = URI.parse(current_url)
assert_equal '/tickets', uri.path
- assert_equal 'open_status=open&sort_order=created_at_desc', uri.query
+ assert_equal 'sort_order=created_at_desc', uri.query
end
end
end