From 7d58f640e89a89a4767e59883b864afcd4e9dad4 Mon Sep 17 00:00:00 2001 From: elijah Date: Mon, 17 Jun 2013 01:27:01 -0700 Subject: new ui - ticket navigation --- help/app/helpers/tickets_helper.rb | 20 ++++++++++++++++---- help/app/views/tickets/_order-nav.html.haml | 2 +- help/app/views/tickets/_status-nav.html.haml | 2 ++ help/app/views/tickets/_table-nav.html.haml | 9 ++++----- help/app/views/tickets/index.html.haml | 23 +++++++++-------------- help/app/views/tickets/new.html.haml | 25 ++++++++++++++++--------- help/config/locales/en.yml | 5 +++++ 7 files changed, 53 insertions(+), 33 deletions(-) diff --git a/help/app/helpers/tickets_helper.rb b/help/app/helpers/tickets_helper.rb index bd2c069..8b4ff71 100644 --- a/help/app/helpers/tickets_helper.rb +++ b/help/app/helpers/tickets_helper.rb @@ -1,7 +1,7 @@ module TicketsHelper def status - params[:open_status] || 'open' + params[:open_status] end def admin @@ -14,8 +14,14 @@ module TicketsHelper end def link_to_status(new_status) - label = new_status + ' issues' - link_to label, :open_status => new_status, :admin_status => admin, :sort_order => order + 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, tickets_path(:open_status => new_status, :admin_status => admin, :sort_order => order) end def link_to_order(order_field) @@ -35,8 +41,14 @@ module TicketsHelper direction = 'desc' end + if order_field == 'updated' + label = t(:updated) + elsif order_field == 'created' + label = t(:created) + end + link_to :sort_order => order_field + '_at_' + direction, :open_status => status, :admin_status => admin do - arrow + order_field + ' at' + arrow + label end end diff --git a/help/app/views/tickets/_order-nav.html.haml b/help/app/views/tickets/_order-nav.html.haml index 9e8bcee..a2ddb72 100644 --- a/help/app/views/tickets/_order-nav.html.haml +++ b/help/app/views/tickets/_order-nav.html.haml @@ -1,4 +1,4 @@ -%ul.nav.nav-pills.pull-right +%ul.nav.nav-pills.pull-right{:style => 'margin-bottom: 0'} %li{:class=> ("active" if order.start_with? 'created_at' )} = link_to_order('created') %li{:class=> ("active" if order.start_with? 'updated_at' )} diff --git a/help/app/views/tickets/_status-nav.html.haml b/help/app/views/tickets/_status-nav.html.haml index 69f4248..e1dca84 100644 --- a/help/app/views/tickets/_status-nav.html.haml +++ b/help/app/views/tickets/_status-nav.html.haml @@ -5,3 +5,5 @@ = link_to_status 'closed' %li{:class => ("active" if status == 'all')} = link_to_status 'all' + %li{:class => ("active" if action?(:new))} + = link_to icon(:plus, :black) + t(:new_ticket), new_ticket_path diff --git a/help/app/views/tickets/_table-nav.html.haml b/help/app/views/tickets/_table-nav.html.haml index 635b59b..45ebfb2 100644 --- a/help/app/views/tickets/_table-nav.html.haml +++ b/help/app/views/tickets/_table-nav.html.haml @@ -1,5 +1,4 @@ -.row - .span6 - = render 'tickets/status-nav' - .span4 - = render 'tickets/order-nav' +- unless action?(:new) + = render 'tickets/order-nav' += render 'tickets/status-nav' + diff --git a/help/app/views/tickets/index.html.haml b/help/app/views/tickets/index.html.haml index 23a503d..a3cbfcf 100644 --- a/help/app/views/tickets/index.html.haml +++ b/help/app/views/tickets/index.html.haml @@ -1,17 +1,12 @@ -%h1 tickets index +- if admin? + = render 'tickets/admin-nav' -Create a -= link_to "new ticket", new_ticket_path += render 'tickets/table-nav' + +%table.table-striped.table-bordered.table-hover + //{:style => "width:100%;"} + %tbody + = render @tickets.all += paginate @tickets -= #%div{"data-pjax-container" => ""} # not sure how to get this working right -.row - .span2 - - if admin? - = render 'tickets/admin-nav' - .span10 - = render 'tickets/table-nav' - %table.table-striped.table-bordered.table-hover{:style => "width:100%;"} - %tbody - = render @tickets.all - = paginate @tickets diff --git a/help/app/views/tickets/new.html.haml b/help/app/views/tickets/new.html.haml index 1aa689b..5442910 100644 --- a/help/app/views/tickets/new.html.haml +++ b/help/app/views/tickets/new.html.haml @@ -1,10 +1,17 @@ -.span12 - %h2=t :new_ticket - = simple_form_for @ticket, :validate => true, :html => {:class => 'form-horizontal'} do |f| - = f.input :title - = f.input :email if !current_user #hmm--might authenticated users want to submit an alternate email? + +//%h2.first= t :new_ticket + += render 'tickets/table-nav' + += simple_form_for @ticket, :validate => true, :html => {:class => 'form-horizontal'} do |f| + = f.input :title + - if user + = f.input :email, input_html: {value: user.email_address} + = f.input :regarding_user, input_html: {value: user.login} + - else + = f.input :email = f.input :regarding_user - = render :partial => 'new_comment', :locals => {:f => f} - .form-actions - = f.button :submit, :class => 'btn-primary' - = link_to t(:cancel), tickets_path, :class => :btn + = render :partial => 'new_comment', :locals => {:f => f} + .form-actions + = f.button :submit, :class => 'btn-primary' + = link_to t(:cancel), tickets_path, :class => :btn diff --git a/help/config/locales/en.yml b/help/config/locales/en.yml index 4ea662a..2835e4e 100644 --- a/help/config/locales/en.yml +++ b/help/config/locales/en.yml @@ -1,2 +1,7 @@ en: access_ticket_text: "You can later access this ticket at the url %{full_url}. You might want to bookmark this page to find it again. Anybody with this URL will be able to access this ticket, so if you are on a shared computer you might want to remove it from the browser history" + support_tickets: "Support Tickets" + all_tickets: "All Tickets" + open_tickets: "Open Tickets" + closed_tickets: "Closed Tickets" + new_ticket: "New Ticket" \ No newline at end of file -- cgit v1.2.3