summaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorazul <azul@leap.se>2014-07-09 13:25:31 +0200
committerazul <azul@leap.se>2014-07-09 13:25:31 +0200
commitdc740e4311101bf7297996788b25a99edafbe759 (patch)
treed989456179551fb167f6c41ba4b54bbd4a77a7ac /engines
parent19da5429308412c19176733d2b32ccbf2c08df1c (diff)
parent0cc11ebb609de225fbeacbf80788b992b88b6ce6 (diff)
Merge pull request #173 from azul/feature/unblock-handles
Allow admins to unblock handles
Diffstat (limited to 'engines')
-rw-r--r--engines/billing/config/initializers/braintree.rb23
-rw-r--r--engines/support/app/helpers/tickets_helper.rb42
-rw-r--r--engines/support/app/views/tickets/index.html.haml16
3 files changed, 22 insertions, 59 deletions
diff --git a/engines/billing/config/initializers/braintree.rb b/engines/billing/config/initializers/braintree.rb
deleted file mode 100644
index 3d87f4c..0000000
--- a/engines/billing/config/initializers/braintree.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# set logger
-#
-if APP_CONFIG[:logfile].blank?
- require 'syslog/logger'
- Braintree::Configuration.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new('webapp'))
-else
- Braintree::Configuration.logger = Logger.new('log/braintree.log')
-end
-
-#
-# You can set these per environment in config/config.yml:
-#
-# Environment must be one of: :development, :qa, :sandbox, :production
-#
-if billing = APP_CONFIG[:billing]
- if braintree = billing[:braintree]
- Braintree::Configuration.environment = braintree[:environment].downcase.to_sym
- Braintree::Configuration.merchant_id = braintree[:merchant_id]
- Braintree::Configuration.public_key = braintree[:public_key]
- Braintree::Configuration.private_key = braintree[:private_key]
- end
-end
diff --git a/engines/support/app/helpers/tickets_helper.rb b/engines/support/app/helpers/tickets_helper.rb
index 11b02e4..7db31dc 100644
--- a/engines/support/app/helpers/tickets_helper.rb
+++ b/engines/support/app/helpers/tickets_helper.rb
@@ -35,32 +35,32 @@ module TicketsHelper
#
def link_to_status(new_status)
- label = t(:".#{new_status}", cascade: true)
- link_to label, auto_tickets_path(:open_status => new_status, :sort_order => search_order)
+ label = ".#{new_status}"
+ link_to_navigation 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
+ direction = new_direction_for_order(order_field)
+ icon = icon_for_direction(direction)
+ # 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),
+ icon: icon
+ end
- label = t(:".#{order_field}", cascade: true)
- link_to auto_tickets_path(:sort_order => order_field + '_at_' + direction, :open_status => search_status) do
- arrow + label
- 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)
+ # Link to the other direction for the filtered field.
+ search_order.end_with?('asc') ? 'desc' : 'asc'
+ end
+
+ def icon_for_direction(direction)
+ # Don't display an icon if we do not filter this field
+ return if direction.blank?
+ direction == 'asc' ? 'arrow-down' : 'arrow-up'
end
end
diff --git a/engines/support/app/views/tickets/index.html.haml b/engines/support/app/views/tickets/index.html.haml
index 526cd6d..d107ce2 100644
--- a/engines/support/app/views/tickets/index.html.haml
+++ b/engines/support/app/views/tickets/index.html.haml
@@ -1,19 +1,5 @@
- @show_navigation = params[:user_id].present?
= render 'tickets/tabs'
-
-%table.table.table-striped.table-bordered
- %thead
- %tr
- %th= t(".subject")
- %th= t(".created")
- %th= t(".updated")
- %th= t(".voices")
- %tbody
- - if @tickets.any?
- = render @tickets.all
- - else
- %tr
- %td{:colspan=>4}= t(".none")
-
+= table @tickets, %w(subject created updated voices)
= paginate @tickets