summaryrefslogtreecommitdiff
path: root/help/app/helpers/auto_tickets_path_helper.rb
diff options
context:
space:
mode:
authorazul <azul@riseup.net>2014-04-17 10:12:05 +0200
committerazul <azul@riseup.net>2014-04-17 10:12:05 +0200
commit3513ad74f950b113af1ba1e3d06bc6a55c48fde5 (patch)
treedb49ebd4428053d5c8d720275b77594a531a1ad1 /help/app/helpers/auto_tickets_path_helper.rb
parentcb6442c344d6bdaf52c3878b2de2fcf4d85f2648 (diff)
parent3d3688647fab7049e5b531c45b85c1e46a1d528f (diff)
Merge pull request #146 from azul/refactor/engines
Refactor/engines
Diffstat (limited to 'help/app/helpers/auto_tickets_path_helper.rb')
-rw-r--r--help/app/helpers/auto_tickets_path_helper.rb53
1 files changed, 0 insertions, 53 deletions
diff --git a/help/app/helpers/auto_tickets_path_helper.rb b/help/app/helpers/auto_tickets_path_helper.rb
deleted file mode 100644
index 93f3cb9..0000000
--- a/help/app/helpers/auto_tickets_path_helper.rb
+++ /dev/null
@@ -1,53 +0,0 @@
-#
-# These "auto" forms of the normal ticket path route helpers allow us to do two things automatically:
-#
-# (1) include the user in the path if appropriate.
-# (2) retain the sort params, if appropriate.
-#
-# Tickets views with a user_id are limited to that user. For admins, they don't need a user_id for any ticket action.
-#
-# This is available both to the views and the tickets_controller.
-#
-module AutoTicketsPathHelper
-
- protected
-
- def auto_tickets_path(options={})
- return unless options.class == Hash
- options = ticket_view_options.merge options
- if @user
- user_tickets_path(@user, options)
- else
- tickets_path(options)
- end
- end
-
- def auto_ticket_path(ticket, options={})
- options = ticket_view_options.merge options
- if @user
- user_ticket_path(@user, ticket, options)
- else
- ticket_path(ticket, options)
- end
- end
-
- def auto_new_ticket_path(options={})
- return unless options.class == Hash
- options = ticket_view_options.merge options
- if @user
- new_user_ticket_path(@user, options)
- else
- new_ticket_path(options)
- end
- end
-
- 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
- end
-
-end \ No newline at end of file