From 0cd386e0144601f5478f90bbdb401d55c019c828 Mon Sep 17 00:00:00 2001 From: elijah Date: Wed, 3 Jul 2013 11:11:10 -0700 Subject: better ticket view navigation: tickets are now either global in scope (for admins) or stay as a nested resource for a particular user (for normal users and when you visit the tickets list of a particular user). --- help/app/views/tickets/_admin-nav.html.haml | 5 ----- help/app/views/tickets/_edit_form.html.haml | 3 ++- help/app/views/tickets/_new_comment_form.html.haml | 3 ++- help/app/views/tickets/_order-nav.html.haml | 4 ++-- help/app/views/tickets/_status-nav.html.haml | 8 ++++---- help/app/views/tickets/_table-nav.html.haml | 3 --- help/app/views/tickets/_ticket.html.haml | 7 ++++--- help/app/views/tickets/index.html.haml | 2 ++ help/app/views/tickets/new.html.haml | 7 ++++++- help/app/views/tickets/show.html.haml | 2 ++ 10 files changed, 24 insertions(+), 20 deletions(-) delete mode 100644 help/app/views/tickets/_admin-nav.html.haml (limited to 'help/app/views') diff --git a/help/app/views/tickets/_admin-nav.html.haml b/help/app/views/tickets/_admin-nav.html.haml deleted file mode 100644 index 3e65e44..0000000 --- a/help/app/views/tickets/_admin-nav.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -.btn-group - %span.btn.disabled= t(:admin) + ':' - = link_to t(:my_tickets), {:admin_status => 'mine', :open_status => status, :sort_order => order}, :class => ['btn', ("active" if admin == 'mine')].join(' ') - = link_to t(:all_tickets), {:admin_status => 'all', :open_status => status, :sort_order => order}, :class => ['btn', ("active" if admin == 'all')].join(' ') -%br \ No newline at end of file diff --git a/help/app/views/tickets/_edit_form.html.haml b/help/app/views/tickets/_edit_form.html.haml index 151d6f1..9c981a3 100644 --- a/help/app/views/tickets/_edit_form.html.haml +++ b/help/app/views/tickets/_edit_form.html.haml @@ -14,6 +14,7 @@ - regarding_user_link = '' = form_for @ticket do |f| + = hidden_ticket_fields %p.first - if @ticket.is_open? %span.label.label-info= t(:open) @@ -40,5 +41,5 @@ - else = f.submit t(:open), :class => 'btn' - if admin? - = link_to t(:destroy), ticket_path, :confirm => 'are you sure?', :method => :delete, :class => 'btn' + = link_to t(:destroy), auto_ticket_path(@ticket), :confirm => t(:are_you_sure), :method => :delete, :class => 'btn' diff --git a/help/app/views/tickets/_new_comment_form.html.haml b/help/app/views/tickets/_new_comment_form.html.haml index de54259..ff136f3 100644 --- a/help/app/views/tickets/_new_comment_form.html.haml +++ b/help/app/views/tickets/_new_comment_form.html.haml @@ -2,6 +2,7 @@ -# for posting a new comment to an existing ticket. -# = simple_form_for @ticket, :html => {:class => 'slim'} do |f| + = hidden_ticket_fields = f.simple_fields_for :comments, @comment, :wrapper => :none, :html => {:class => 'slim'} do |c| = c.input :body, :label => false, :as => :text, :input_html => {:class => "full-width", :rows=> 5} - if admin? @@ -9,4 +10,4 @@ = f.button :submit, t(:post_reply), :class => 'btn-primary' - if logged_in? && @ticket.is_open = f.button :submit, t(:reply_and_close) - = link_to t(:cancel), tickets_path, :class => :btn + = link_to t(:cancel), auto_tickets_path, :class => :btn diff --git a/help/app/views/tickets/_order-nav.html.haml b/help/app/views/tickets/_order-nav.html.haml index a2ddb72..b235350 100644 --- a/help/app/views/tickets/_order-nav.html.haml +++ b/help/app/views/tickets/_order-nav.html.haml @@ -1,5 +1,5 @@ %ul.nav.nav-pills.pull-right{:style => 'margin-bottom: 0'} - %li{:class=> ("active" if order.start_with? 'created_at' )} + %li{:class=> ("active" if search_order.start_with? 'created_at' )} = link_to_order('created') - %li{:class=> ("active" if order.start_with? 'updated_at' )} + %li{:class=> ("active" if search_order.start_with? 'updated_at' )} = link_to_order('updated') diff --git a/help/app/views/tickets/_status-nav.html.haml b/help/app/views/tickets/_status-nav.html.haml index c8279ed..8e51497 100644 --- a/help/app/views/tickets/_status-nav.html.haml +++ b/help/app/views/tickets/_status-nav.html.haml @@ -1,10 +1,10 @@ %ul.nav.nav-tabs - if logged_in? - %li{:class => ("active" if status == 'open')} + %li{:class => ("active" if search_status == 'open')} = link_to_status 'open' - %li{:class => ("active" if status == 'closed')} + %li{:class => ("active" if search_status == 'closed')} = link_to_status 'closed' - %li{:class => ("active" if status == 'all')} + %li{:class => ("active" if search_status == 'all')} = link_to_status 'all' %li{:class => ("active" if action?(:new))} - = link_to icon(:plus, :black) + t(:new_ticket), new_ticket_path + = link_to icon(:plus, :black) + t(:new_ticket), auto_new_ticket_path diff --git a/help/app/views/tickets/_table-nav.html.haml b/help/app/views/tickets/_table-nav.html.haml index a5cf8be..45ebfb2 100644 --- a/help/app/views/tickets/_table-nav.html.haml +++ b/help/app/views/tickets/_table-nav.html.haml @@ -1,6 +1,3 @@ -- if admin? - = render 'tickets/admin-nav' - - unless action?(:new) = render 'tickets/order-nav' = render 'tickets/status-nav' diff --git a/help/app/views/tickets/_ticket.html.haml b/help/app/views/tickets/_ticket.html.haml index 9a1e899..a064c4e 100644 --- a/help/app/views/tickets/_ticket.html.haml +++ b/help/app/views/tickets/_ticket.html.haml @@ -1,5 +1,6 @@ +- url = auto_ticket_path(ticket) %tr - %td= link_to ticket.title, ticket - %td= link_to ticket.created_at.to_s(:short), ticket - %td= link_to ticket.updated_at.to_s(:short), ticket + %td= link_to ticket.title, url + %td= link_to ticket.created_at.to_s(:short), url + %td= link_to ticket.updated_at.to_s(:short), url %td= ticket.commenters diff --git a/help/app/views/tickets/index.html.haml b/help/app/views/tickets/index.html.haml index f4597a7..1b32dc1 100644 --- a/help/app/views/tickets/index.html.haml +++ b/help/app/views/tickets/index.html.haml @@ -1,3 +1,5 @@ +- @show_navigation = !params[:user_id].nil? + = render 'tickets/table-nav' %table.table.table-striped.table-bordered diff --git a/help/app/views/tickets/new.html.haml b/help/app/views/tickets/new.html.haml index 7d3f76c..04b091c 100644 --- a/help/app/views/tickets/new.html.haml +++ b/help/app/views/tickets/new.html.haml @@ -1,6 +1,9 @@ +- @show_navigation = !params[:user_id].nil? + = render 'tickets/table-nav' = simple_form_for @ticket, :validate => true, :html => {:class => 'form-horizontal'} do |f| + = hidden_ticket_fields = f.input :title, :label => t(:subject) - if user = f.input :email, input_html: {value: user.email_address} @@ -15,4 +18,6 @@ .form-actions = f.button :submit, :class => 'btn-primary' - if logged_in? - = link_to t(:cancel), tickets_path, :class => :btn + = link_to t(:cancel), auto_tickets_path, :class => :btn + - else + = link_to t(:cancel), root_path, :class => 'btn' \ No newline at end of file diff --git a/help/app/views/tickets/show.html.haml b/help/app/views/tickets/show.html.haml index ddd4e9f..bfdb773 100644 --- a/help/app/views/tickets/show.html.haml +++ b/help/app/views/tickets/show.html.haml @@ -1,3 +1,5 @@ +- @show_navigation = !params[:user_id].nil? + .ticket = render 'tickets/edit_form' %table.table.table-striped.table-bordered -- cgit v1.2.3