diff options
Diffstat (limited to 'engines/support/app')
8 files changed, 15 insertions, 37 deletions
diff --git a/engines/support/app/helpers/auto_tickets_path_helper.rb b/engines/support/app/helpers/auto_tickets_path_helper.rb index bc98a0a..17fc003 100644 --- a/engines/support/app/helpers/auto_tickets_path_helper.rb +++ b/engines/support/app/helpers/auto_tickets_path_helper.rb @@ -4,7 +4,8 @@ # (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. +# Tickets views with a user_id are limited to that user. +# Admins don't need a user_id for any ticket action. # # This is available both to the views and the tickets_controller. # @@ -13,7 +14,6 @@ module AutoTicketsPathHelper protected def auto_tickets_path(options={}) - return unless options.class == Hash options = ticket_view_options.merge options if @user.is_a? User user_tickets_path(@user, options) @@ -22,9 +22,9 @@ module AutoTicketsPathHelper end end - def auto_ticket_path(ticket, options={}) + def auto_ticket_path(ticket) return unless ticket.persisted? - options = ticket_view_options.merge options + options = ticket_view_options if @user.is_a? User user_ticket_path(@user, ticket, options) else @@ -32,10 +32,9 @@ module AutoTicketsPathHelper end end - def auto_new_ticket_path(options={}) - return unless options.class == Hash - options = ticket_view_options.merge options - if @user + def auto_new_ticket_path + options = ticket_view_options + if @user.is_a? User new_user_ticket_path(@user, options) else new_ticket_path(options) diff --git a/engines/support/app/models/account_extension/tickets.rb b/engines/support/app/models/account_extension/tickets.rb deleted file mode 100644 index f38d5fd..0000000 --- a/engines/support/app/models/account_extension/tickets.rb +++ /dev/null @@ -1,13 +0,0 @@ -module AccountExtension::Tickets - extend ActiveSupport::Concern - - def destroy_with_tickets(destroy_identities=false) - Ticket.destroy_all_from(self.user) - destroy_without_tickets(destroy_identities) - end - - included do - alias_method_chain :destroy, :tickets - end - -end diff --git a/engines/support/app/models/ticket.rb b/engines/support/app/models/ticket.rb index b1bdf8d..025e2ab 100644 --- a/engines/support/app/models/ticket.rb +++ b/engines/support/app/models/ticket.rb @@ -37,9 +37,11 @@ class Ticket < CouchRest::Model::Base # email can be nil, "", or valid address. # validation provided by 'valid_email' gem. + # mx validation depends on network availability and is disabled in test + # and development environment validates :email, :allow_blank => true, :email => true, - :mx_with_fallback => true + :mx_with_fallback => Rails.env.production? def self.search(options = {}) @selection = TicketSelection.new(options) @@ -50,7 +52,7 @@ class Ticket < CouchRest::Model::Base self.by_created_by.key(user.id).each do |ticket| ticket.destroy end - rescue RestClient::ResourceNotFound + rescue RESOURCE_NOT_FOUND # silently ignore if design docs are not yet created end diff --git a/engines/support/app/views/tickets/_edit_form.html.haml b/engines/support/app/views/tickets/_edit_form.html.haml index cd1dbe4..8d64256 100644 --- a/engines/support/app/views/tickets/_edit_form.html.haml +++ b/engines/support/app/views/tickets/_edit_form.html.haml @@ -34,12 +34,12 @@ = simple_form_for @ticket do |f| = hidden_ticket_fields = f.input :subject, input_html: {:class => 'large full-width'} - .row-fluid - .span4 + .row + .col-md-4 = f.input :is_open, as: :select, collection: [:true, :false], include_blank: false - .span4 + .col-md-4 = f.input :email - .span4 + .col-md-4 = f.input :regarding_user, label: (Ticket.human_attribute_name(:regarding_user) + " " + regarding_user_link).html_safe = f.button :loading - if admin? diff --git a/engines/support/app/views/tickets/edit.html.haml b/engines/support/app/views/tickets/edit.html.haml index 03bda7d..cdc5e16 100644 --- a/engines/support/app/views/tickets/edit.html.haml +++ b/engines/support/app/views/tickets/edit.html.haml @@ -1,4 +1,3 @@ -- @show_navigation = params[:user_id].present? - @comment = TicketComment.new .ticket diff --git a/engines/support/app/views/tickets/index.html.haml b/engines/support/app/views/tickets/index.html.haml index d107ce2..56c7012 100644 --- a/engines/support/app/views/tickets/index.html.haml +++ b/engines/support/app/views/tickets/index.html.haml @@ -1,5 +1,3 @@ -- @show_navigation = params[:user_id].present? - = render 'tickets/tabs' = table @tickets, %w(subject created updated voices) = paginate @tickets diff --git a/engines/support/app/views/tickets/new.html.haml b/engines/support/app/views/tickets/new.html.haml index d3580f9..d0b0f89 100644 --- a/engines/support/app/views/tickets/new.html.haml +++ b/engines/support/app/views/tickets/new.html.haml @@ -1,10 +1,5 @@ -- @show_navigation = params[:user_id].present? - = render 'tickets/tabs' -- user = @user if admin? -- user ||= current_user - = simple_form_for @ticket, :validate => true, :html => {:class => 'form-horizontal'} do |f| = hidden_ticket_fields = f.input :subject diff --git a/engines/support/app/views/tickets/show.html.haml b/engines/support/app/views/tickets/show.html.haml index 99afa2a..a625870 100644 --- a/engines/support/app/views/tickets/show.html.haml +++ b/engines/support/app/views/tickets/show.html.haml @@ -1,5 +1,3 @@ -- @show_navigation = params[:user_id].present? - .ticket = render 'tickets/edit_form' = render 'tickets/comments' |