summaryrefslogtreecommitdiff
path: root/help/app/helpers/tickets_helper.rb
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2014-04-11 10:03:19 +0200
committerAzul <azul@leap.se>2014-04-11 10:07:23 +0200
commit636692f9921bd695d726695d2d46c91f5a6e56f3 (patch)
treea7cc0b89007bd273ae7719f31c16e052a141fec7 /help/app/helpers/tickets_helper.rb
parent32136605ddd405a0bf47f3b795b22fd4b49465b5 (diff)
move engines into engines directory
Also renamed help to support so it's harder to confuse it with documentation
Diffstat (limited to 'help/app/helpers/tickets_helper.rb')
-rw-r--r--help/app/helpers/tickets_helper.rb76
1 files changed, 0 insertions, 76 deletions
diff --git a/help/app/helpers/tickets_helper.rb b/help/app/helpers/tickets_helper.rb
deleted file mode 100644
index 7af50d6..0000000
--- a/help/app/helpers/tickets_helper.rb
+++ /dev/null
@@ -1,76 +0,0 @@
-module TicketsHelper
- #
- # FORM HELPERS
- #
-
- #
- # hidden fields that should be added to ever ticket form.
- # these are use for proper redirection after successful actions.
- #
- def hidden_ticket_fields
- haml_concat hidden_field_tag('open_status', params[:open_status])
- haml_concat hidden_field_tag('sort_order', params[:sort_order])
- haml_concat hidden_field_tag('user_id', params[:user_id])
- ""
- end
-
- #
- # PARAM HELPERS
- #
-
- def search_status
- if action?(:index)
- params[:open_status] || 'open'
- else
- nil
- end
- end
-
- def search_order
- params[:sort_order] || 'updated_at_desc'
- end
-
- #
- # LINK HELPERS
- #
-
- def link_to_status(new_status)
- if new_status == "open"
- label = t(:open_tickets)
- elsif new_status == "closed"
- label = t(:closed_tickets)
- elsif new_status == "all"
- label = t(:all_tickets)
- end
- link_to label, auto_tickets_path(:open_status => new_status, :sort_order => search_order)
- end
-
- def link_to_order(order_field)
- if search_order.start_with?(order_field)
- # link for currently-filtered field. Link to other direction of this field.
- if search_order.end_with? 'asc'
- direction = 'desc'
- icon_direction = 'up'
- else
- direction = 'asc'
- icon_direction = 'down'
- end
- arrow = content_tag(:i, '', class: 'icon-arrow-'+ icon_direction)
- else
- # for not-currently-filtered field, don't display an arrow, and link to descending direction
- arrow = ''
- direction = 'desc'
- end
-
- if order_field == 'updated'
- label = t(:updated)
- elsif order_field == 'created'
- label = t(:created)
- end
-
- link_to auto_tickets_path(:sort_order => order_field + '_at_' + direction, :open_status => search_status) do
- arrow + label
- end
- end
-
-end