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/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 ++++++++++++++++--------- 5 files changed, 32 insertions(+), 29 deletions(-) (limited to 'help/app/views/tickets') 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 -- cgit v1.2.3 From 8393058ac15d72be702a6de481d6129aed4bbef3 Mon Sep 17 00:00:00 2001 From: elijah Date: Wed, 19 Jun 2013 00:33:19 -0700 Subject: new ui for tickets --- help/app/views/tickets/_admin-nav.html.haml | 10 ++--- help/app/views/tickets/_comment.html.haml | 34 ++++++++-------- help/app/views/tickets/_edit_form.html.haml | 46 ++++++++++++++++++++++ help/app/views/tickets/_new_comment.html.haml | 4 -- help/app/views/tickets/_new_comment_form.html.haml | 13 ++++++ help/app/views/tickets/_table-nav.html.haml | 3 ++ help/app/views/tickets/_ticket.html.haml | 20 ++-------- help/app/views/tickets/_ticket_data.html.haml | 35 ---------------- help/app/views/tickets/index.html.haml | 21 ++++++---- help/app/views/tickets/new.html.haml | 10 ++--- help/app/views/tickets/show.html.haml | 26 +++++------- 11 files changed, 115 insertions(+), 107 deletions(-) create mode 100644 help/app/views/tickets/_edit_form.html.haml delete mode 100644 help/app/views/tickets/_new_comment.html.haml create mode 100644 help/app/views/tickets/_new_comment_form.html.haml delete mode 100644 help/app/views/tickets/_ticket_data.html.haml (limited to 'help/app/views/tickets') diff --git a/help/app/views/tickets/_admin-nav.html.haml b/help/app/views/tickets/_admin-nav.html.haml index 0e45c40..3e65e44 100644 --- a/help/app/views/tickets/_admin-nav.html.haml +++ b/help/app/views/tickets/_admin-nav.html.haml @@ -1,5 +1,5 @@ -%ul.nav.nav-pills.nav-stacked - %li{:class => ("active" if admin == 'mine')} - = link_to 'tickets i admin', {:admin_status => 'mine', :open_status => status, :sort_order => order} - %li{:class => ("active" if admin == 'all')} - = link_to 'all tickets', {:admin_status => 'all', :open_status => status, :sort_order => order} +.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/_comment.html.haml b/help/app/views/tickets/_comment.html.haml index 501ceec..c02246c 100644 --- a/help/app/views/tickets/_comment.html.haml +++ b/help/app/views/tickets/_comment.html.haml @@ -1,20 +1,20 @@ -- # style is super ugly but just for now - if admin? or !comment.private # only show comment if user is admin or comment is not private %tr - %td - - if comment.posted_by_user - %b - = 'Posted by' + (comment.posted_by_user.is_admin? ? ' admin' : '') + ':' - = comment.posted_by_user.login - - else - %b - Unauthenticated post + %td.user + %div + %strong + - if comment.posted_by_user + = comment.posted_by_user.login + - else + = t(:unknown) + %div= comment.posted_at.to_s(:short) + - if comment.posted_by_user.is_admin? + %div + %span.label.label-inverse + = t(:admin) - if comment.private - (Private comment) - .pull-right - %b - Posted at: - = comment.posted_at.to_s(:short) - %br - = comment.body - + %div + %span.label.label-important + = t(:private) + %td.comment + = comment.body \ 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 new file mode 100644 index 0000000..3d1d879 --- /dev/null +++ b/help/app/views/tickets/_edit_form.html.haml @@ -0,0 +1,46 @@ +- # created by user link +- if @ticket.created_by_user + - created_by = link_to(@ticket.created_by_user.login, user_overview_path(@ticket.created_by_user)) +- else + - created_by = t(:anonymous) + +- # regarding user link +- if admin? + - if @ticket.regarding_user_actual_user + - regarding_user_link = link_to @ticket.regarding_user_actual_user.login, user_overview_path(@ticket.regarding_user_actual_user) + - else + - regarding_user_link = "(#{t(:unknown)})" +- else + - regarding_user_link = '' + += form_for @ticket do |f| + %p.first + - if @ticket.is_open? + %span.label.label-info= t(:open) + - else + %span.label.label-success= t(:closed) + %span.label.label-clear= t(:created_by_on, :user => created_by, :time => @ticket.created_at.to_s(:short)).html_safe + = t(:subject) + %br + = f.text_field :title, :class => 'large full-width' + .row-fluid + .span4 + %div= t(:status) + = f.select :is_open, [[t(:open), "true"], [t(:closed), "false"]] + .span4 + %div= t(:email) + = f.text_field :email + .span4 + %div + = t(:regarding) + = regarding_user_link + = f.text_field :regarding_user + = f.submit t(:save), :class => 'btn' + - if @ticket.is_open? + = f.submit t(:close), :class => 'btn' + =# button_to t(:close), {:post => {:is_open => false}}, :method => :put, :class => 'btn' + - else + = f.submit t(:open), :class => 'btn' + =# button_to t(:open), {:post => {:is_open => true}}, :method => :put, :class => 'btn' + + diff --git a/help/app/views/tickets/_new_comment.html.haml b/help/app/views/tickets/_new_comment.html.haml deleted file mode 100644 index 96388ea..0000000 --- a/help/app/views/tickets/_new_comment.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -= f.simple_fields_for :comments, @comment do |c| - = c.input :body, :label => 'Comment', :as => :text, :input_html => {:class => "span9", :rows=>4} - - if admin? - = c.input :private, :as => :boolean, :label => false, :inline_label => true diff --git a/help/app/views/tickets/_new_comment_form.html.haml b/help/app/views/tickets/_new_comment_form.html.haml new file mode 100644 index 0000000..b273503 --- /dev/null +++ b/help/app/views/tickets/_new_comment_form.html.haml @@ -0,0 +1,13 @@ +-# +-# for posting a new comment to an existing ticket. +-# += simple_form_for @ticket, :html => {:class => 'slim'} do |f| + = 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? + = c.input :private, :as => :boolean, :label => false, :inline_label => true + = f.button :submit, t(:post_reply), :class => 'btn-primary' + - if @ticket.is_open + = f.button :submit, t(:reply_and_close) + = link_to t(:destroy), ticket_path, :confirm => 'are you sure?', :method => :delete, :class => 'btn btn-danger' if admin? + = link_to t(:cancel), tickets_path, :class => :btn diff --git a/help/app/views/tickets/_table-nav.html.haml b/help/app/views/tickets/_table-nav.html.haml index 45ebfb2..a5cf8be 100644 --- a/help/app/views/tickets/_table-nav.html.haml +++ b/help/app/views/tickets/_table-nav.html.haml @@ -1,3 +1,6 @@ +- 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 7b37652..9a1e899 100644 --- a/help/app/views/tickets/_ticket.html.haml +++ b/help/app/views/tickets/_ticket.html.haml @@ -1,17 +1,5 @@ -- updated_at_text = 'updated: ' + ticket.updated_at.to_s(:long) %tr - %td - %b - = link_to ticket.title, ticket - - if params[:controller] == 'tickets' - %br - %small - created: - = ticket.created_at.to_s(:long) - = updated_at_text - %small.pull-right - comments by: - = ticket.commenters - - else - %small - = updated_at_text \ No newline at end of file + %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= ticket.commenters diff --git a/help/app/views/tickets/_ticket_data.html.haml b/help/app/views/tickets/_ticket_data.html.haml deleted file mode 100644 index 6a1a896..0000000 --- a/help/app/views/tickets/_ticket_data.html.haml +++ /dev/null @@ -1,35 +0,0 @@ -.spam12 - %b - Created by: - - if @ticket.created_by_user - = link_to @ticket.created_by_user.login, user_path(@ticket.created_by_user) - - else - Unauthenticated ticket creator - - if @ticket.regarding_user - %b - Regarding user: - - if admin? - - if @ticket.regarding_user_actual_user - = link_to @ticket.regarding_user_actual_user.login, user_path(@ticket.regarding_user_actual_user) - - else - = @ticket.regarding_user + ' (no such user)' - - else # a non-admin is viewing the ticket, so they shouldn't see confirmation of whether the regarding_user exists or not. - = @ticket.regarding_user - - if @ticket.email - %b - email: - = @ticket.email - %b - Created at: - = @ticket.created_at.to_s(:short) - %b - Updated at: - = @ticket.updated_at.to_s(:short) - %b - = "Status:" - - if @ticket.is_open - = 'open' - = button_to 'Close', {:post => {:is_open => false}}, :method => :put, :class => 'btn btn-small' - - else - = 'closed' - = button_to 'Open', {:post => {:is_open => true}}, :method => :put, :class => 'btn btn-small' diff --git a/help/app/views/tickets/index.html.haml b/help/app/views/tickets/index.html.haml index a3cbfcf..f4597a7 100644 --- a/help/app/views/tickets/index.html.haml +++ b/help/app/views/tickets/index.html.haml @@ -1,12 +1,17 @@ -- if admin? - = render 'tickets/admin-nav' - = render 'tickets/table-nav' -%table.table-striped.table-bordered.table-hover - //{:style => "width:100%;"} +%table.table.table-striped.table-bordered + %thead + %tr + %th= t(:subject) + %th= t(:created) + %th= t(:updated) + %th= t(:voices) %tbody - = render @tickets.all -= paginate @tickets - + - if @tickets.any? + = render @tickets.all + - else + %tr + %td{:colspan=>4}= t(:none) += paginate @tickets diff --git a/help/app/views/tickets/new.html.haml b/help/app/views/tickets/new.html.haml index 5442910..acb9537 100644 --- a/help/app/views/tickets/new.html.haml +++ b/help/app/views/tickets/new.html.haml @@ -1,17 +1,17 @@ - -//%h2.first= t :new_ticket - = render 'tickets/table-nav' = simple_form_for @ticket, :validate => true, :html => {:class => 'form-horizontal'} do |f| - = f.input :title + = f.input :title, :label => t(:subject) - 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} + = f.simple_fields_for :comments, @comment do |c| + = c.input :body, :label => t(:description), :as => :text, :input_html => {:class => "full-width", :rows=> 5} + - if admin? + = c.input :private, :as => :boolean, :label => false, :inline_label => true .form-actions = f.button :submit, :class => 'btn-primary' = link_to t(:cancel), tickets_path, :class => :btn diff --git a/help/app/views/tickets/show.html.haml b/help/app/views/tickets/show.html.haml index a69048b..ddd4e9f 100644 --- a/help/app/views/tickets/show.html.haml +++ b/help/app/views/tickets/show.html.haml @@ -1,18 +1,10 @@ -.spam12 - %h2 - %a#title.editable.editable-click{"data-name" => "title", "data-resource" => "post", "data-type" => "text", "data-url" => ticket_path(@ticket.id), "data-pk" => @ticket.id, :href => "#"} - = @ticket.title - = render 'tickets/ticket_data' - %table.table-striped.table-bordered.table-hover{:style => "width:100%;"} +.ticket + = render 'tickets/edit_form' + %table.table.table-striped.table-bordered %tbody - = render(:partial => "comment", :collection => @ticket.comments) - = #render @ticket.comments should work if view is in /app/views/comments/_comment - - = simple_form_for @ticket, :html => {:class => 'form-horizontal'} do |f| # don't need validations so long as this is so simple - = render :partial => 'new_comment', :locals => {:f => f} - .span10.offset3 - = f.button :submit, @post_reply_str, :class => 'btn-primary' - - if @ticket.is_open - = f.button :submit, @reply_close_str - = link_to t(:Destroy), ticket_path, :confirm => 'are you sure?', :method => :delete, :class => 'btn btn-danger' if admin? - = link_to t(:cancel), tickets_path, :class => :btn + = render :partial => 'tickets/comment', :collection => @ticket.comments + %tr + %td.user + = logged_in? ? current_user.login : t(:anonymous) + %td.comment + = render 'tickets/new_comment_form' \ No newline at end of file -- cgit v1.2.3 From d121373b7c21a29e47708e8b67aeb964202e52c5 Mon Sep 17 00:00:00 2001 From: elijah Date: Sun, 23 Jun 2013 22:14:45 -0700 Subject: fix several issues with tickets: js error, when to redirect, navigation, localization. --- help/app/views/tickets/_comment.html.haml | 4 ++-- help/app/views/tickets/_edit_form.html.haml | 10 ++++------ help/app/views/tickets/_new_comment_form.html.haml | 5 ++--- help/app/views/tickets/_status-nav.html.haml | 13 +++++++------ help/app/views/tickets/new.html.haml | 3 ++- 5 files changed, 17 insertions(+), 18 deletions(-) (limited to 'help/app/views/tickets') diff --git a/help/app/views/tickets/_comment.html.haml b/help/app/views/tickets/_comment.html.haml index c02246c..4252eee 100644 --- a/help/app/views/tickets/_comment.html.haml +++ b/help/app/views/tickets/_comment.html.haml @@ -6,9 +6,9 @@ - if comment.posted_by_user = comment.posted_by_user.login - else - = t(:unknown) + = t(:anonymous) %div= comment.posted_at.to_s(:short) - - if comment.posted_by_user.is_admin? + - if comment.posted_by_user && comment.posted_by_user.is_admin? %div %span.label.label-inverse = t(:admin) diff --git a/help/app/views/tickets/_edit_form.html.haml b/help/app/views/tickets/_edit_form.html.haml index 3d1d879..151d6f1 100644 --- a/help/app/views/tickets/_edit_form.html.haml +++ b/help/app/views/tickets/_edit_form.html.haml @@ -20,8 +20,7 @@ - else %span.label.label-success= t(:closed) %span.label.label-clear= t(:created_by_on, :user => created_by, :time => @ticket.created_at.to_s(:short)).html_safe - = t(:subject) - %br + %div= t(:subject) = f.text_field :title, :class => 'large full-width' .row-fluid .span4 @@ -32,15 +31,14 @@ = f.text_field :email .span4 %div - = t(:regarding) + = t(:regarding_account) = regarding_user_link = f.text_field :regarding_user = f.submit t(:save), :class => 'btn' - if @ticket.is_open? = f.submit t(:close), :class => 'btn' - =# button_to t(:close), {:post => {:is_open => false}}, :method => :put, :class => 'btn' - else = f.submit t(:open), :class => 'btn' - =# button_to t(:open), {:post => {:is_open => true}}, :method => :put, :class => 'btn' - + - if admin? + = link_to t(:destroy), ticket_path, :confirm => '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 b273503..de54259 100644 --- a/help/app/views/tickets/_new_comment_form.html.haml +++ b/help/app/views/tickets/_new_comment_form.html.haml @@ -7,7 +7,6 @@ - if admin? = c.input :private, :as => :boolean, :label => false, :inline_label => true = f.button :submit, t(:post_reply), :class => 'btn-primary' - - if @ticket.is_open + - if logged_in? && @ticket.is_open = f.button :submit, t(:reply_and_close) - = link_to t(:destroy), ticket_path, :confirm => 'are you sure?', :method => :delete, :class => 'btn btn-danger' if admin? - = link_to t(:cancel), tickets_path, :class => :btn + = link_to t(:cancel), tickets_path, :class => :btn diff --git a/help/app/views/tickets/_status-nav.html.haml b/help/app/views/tickets/_status-nav.html.haml index e1dca84..c8279ed 100644 --- a/help/app/views/tickets/_status-nav.html.haml +++ b/help/app/views/tickets/_status-nav.html.haml @@ -1,9 +1,10 @@ %ul.nav.nav-tabs - %li{:class => ("active" if status == 'open')} - = link_to_status 'open' - %li{:class => ("active" if status == 'closed')} - = link_to_status 'closed' - %li{:class => ("active" if status == 'all')} - = link_to_status 'all' + - if logged_in? + %li{:class => ("active" if status == 'open')} + = link_to_status 'open' + %li{:class => ("active" if status == 'closed')} + = 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/new.html.haml b/help/app/views/tickets/new.html.haml index acb9537..7d3f76c 100644 --- a/help/app/views/tickets/new.html.haml +++ b/help/app/views/tickets/new.html.haml @@ -14,4 +14,5 @@ = c.input :private, :as => :boolean, :label => false, :inline_label => true .form-actions = f.button :submit, :class => 'btn-primary' - = link_to t(:cancel), tickets_path, :class => :btn + - if logged_in? + = link_to t(:cancel), tickets_path, :class => :btn -- cgit v1.2.3 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/tickets') 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 From adacb11c8ff6395f38c3c05bea4e6d276285118f Mon Sep 17 00:00:00 2001 From: elijah Date: Thu, 4 Jul 2013 01:35:49 -0700 Subject: help - fix ticket navigation & links (use @user, not user). --- help/app/views/tickets/_order-nav.html.haml | 5 ----- help/app/views/tickets/_status-nav.html.haml | 10 ---------- help/app/views/tickets/_table-nav.html.haml | 4 ---- help/app/views/tickets/_tabs.html.haml | 23 +++++++++++++++++++++++ help/app/views/tickets/index.html.haml | 2 +- help/app/views/tickets/new.html.haml | 15 +++++++++++---- 6 files changed, 35 insertions(+), 24 deletions(-) delete mode 100644 help/app/views/tickets/_order-nav.html.haml delete mode 100644 help/app/views/tickets/_status-nav.html.haml delete mode 100644 help/app/views/tickets/_table-nav.html.haml create mode 100644 help/app/views/tickets/_tabs.html.haml (limited to 'help/app/views/tickets') diff --git a/help/app/views/tickets/_order-nav.html.haml b/help/app/views/tickets/_order-nav.html.haml deleted file mode 100644 index b235350..0000000 --- a/help/app/views/tickets/_order-nav.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -%ul.nav.nav-pills.pull-right{:style => 'margin-bottom: 0'} - %li{:class=> ("active" if search_order.start_with? 'created_at' )} - = link_to_order('created') - %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 deleted file mode 100644 index 8e51497..0000000 --- a/help/app/views/tickets/_status-nav.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -%ul.nav.nav-tabs - - if logged_in? - %li{:class => ("active" if search_status == 'open')} - = link_to_status 'open' - %li{:class => ("active" if search_status == 'closed')} - = link_to_status 'closed' - %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), auto_new_ticket_path diff --git a/help/app/views/tickets/_table-nav.html.haml b/help/app/views/tickets/_table-nav.html.haml deleted file mode 100644 index 45ebfb2..0000000 --- a/help/app/views/tickets/_table-nav.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -- unless action?(:new) - = render 'tickets/order-nav' -= render 'tickets/status-nav' - diff --git a/help/app/views/tickets/_tabs.html.haml b/help/app/views/tickets/_tabs.html.haml new file mode 100644 index 0000000..b7b5d3a --- /dev/null +++ b/help/app/views/tickets/_tabs.html.haml @@ -0,0 +1,23 @@ +-# +-# SORT ORDER TABS +-# +- unless action?(:new) + %ul.nav.nav-pills.pull-right.slim + %li{:class=> ("active" if search_order.start_with? 'created_at')} + = link_to_order('created') + %li{:class=> ("active" if search_order.start_with? 'updated_at')} + = link_to_order('updated') + +-# +-# STATUS FILTER TABS +-# +%ul.nav.nav-tabs + - if logged_in? + %li{:class => ("active" if search_status == 'open')} + = link_to_status 'open' + %li{:class => ("active" if search_status == 'closed')} + = link_to_status 'closed' + %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), auto_new_ticket_path diff --git a/help/app/views/tickets/index.html.haml b/help/app/views/tickets/index.html.haml index 1b32dc1..c02a326 100644 --- a/help/app/views/tickets/index.html.haml +++ b/help/app/views/tickets/index.html.haml @@ -1,6 +1,6 @@ - @show_navigation = !params[:user_id].nil? -= render 'tickets/table-nav' += render 'tickets/tabs' %table.table.table-striped.table-bordered %thead diff --git a/help/app/views/tickets/new.html.haml b/help/app/views/tickets/new.html.haml index 04b091c..4d35659 100644 --- a/help/app/views/tickets/new.html.haml +++ b/help/app/views/tickets/new.html.haml @@ -1,13 +1,20 @@ - @show_navigation = !params[:user_id].nil? -= render 'tickets/table-nav' += render 'tickets/tabs' + +- if admin? && @user + - email = @user.email_address + - regarding = @user.login +- elsif logged_in? + - email = current_user.email_address + - regarding = current_user.login = 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} - = f.input :regarding_user, input_html: {value: user.login} + - if logged_in? + = f.input :email, input_html: {value: email} + = f.input :regarding_user, input_html: {value: regarding} - else = f.input :email = f.input :regarding_user -- cgit v1.2.3 From b2124020f123bf7a44b21555e6aefb5699bdcc21 Mon Sep 17 00:00:00 2001 From: elijah Date: Fri, 5 Jul 2013 15:14:50 -0700 Subject: use :ruby for ruby inside tickets/edit_form partial. --- help/app/views/tickets/_edit_form.html.haml | 30 ++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'help/app/views/tickets') diff --git a/help/app/views/tickets/_edit_form.html.haml b/help/app/views/tickets/_edit_form.html.haml index 9c981a3..9846a43 100644 --- a/help/app/views/tickets/_edit_form.html.haml +++ b/help/app/views/tickets/_edit_form.html.haml @@ -1,17 +1,21 @@ -- # created by user link -- if @ticket.created_by_user - - created_by = link_to(@ticket.created_by_user.login, user_overview_path(@ticket.created_by_user)) -- else - - created_by = t(:anonymous) +:ruby + # created by user link + if @ticket.created_by_user + created_by = link_to(@ticket.created_by_user.login, user_overview_path(@ticket.created_by_user)) + else + created_by = t(:anonymous) + end -- # regarding user link -- if admin? - - if @ticket.regarding_user_actual_user - - regarding_user_link = link_to @ticket.regarding_user_actual_user.login, user_overview_path(@ticket.regarding_user_actual_user) - - else - - regarding_user_link = "(#{t(:unknown)})" -- else - - regarding_user_link = '' + # regarding user link + if admin? + if @ticket.regarding_user_actual_user + regarding_user_link = link_to @ticket.regarding_user_actual_user.login, user_overview_path(@ticket.regarding_user_actual_user) + else + regarding_user_link = "(#{t(:unknown)})" + end + else + regarding_user_link = '' + end = form_for @ticket do |f| = hidden_ticket_fields -- cgit v1.2.3 From dc98ad8c6445182d60b3f1909e0260ace6fbfca5 Mon Sep 17 00:00:00 2001 From: elijah Date: Fri, 5 Jul 2013 18:16:24 -0700 Subject: tickets - replace input[type=submit] tags with button[type=submit] tags --- help/app/views/tickets/_edit_form.html.haml | 7 +++---- help/app/views/tickets/_new_comment_form.html.haml | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'help/app/views/tickets') diff --git a/help/app/views/tickets/_edit_form.html.haml b/help/app/views/tickets/_edit_form.html.haml index 9846a43..5252c2e 100644 --- a/help/app/views/tickets/_edit_form.html.haml +++ b/help/app/views/tickets/_edit_form.html.haml @@ -39,11 +39,10 @@ = t(:regarding_account) = regarding_user_link = f.text_field :regarding_user - = f.submit t(:save), :class => 'btn' + = f.button t(:save), :name => 'commit', :class => 'btn', :type => 'submit', :value => 'save' - if @ticket.is_open? - = f.submit t(:close), :class => 'btn' + = f.button t(:close), :name => 'commit', :class => 'btn', :type => 'submit', :value => 'close' - else - = f.submit t(:open), :class => 'btn' + = f.button t(:open), :name => 'commit', :class => 'btn', :type => 'submit', :value => 'open' - if admin? = 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 ff136f3..8418e01 100644 --- a/help/app/views/tickets/_new_comment_form.html.haml +++ b/help/app/views/tickets/_new_comment_form.html.haml @@ -7,7 +7,7 @@ = c.input :body, :label => false, :as => :text, :input_html => {:class => "full-width", :rows=> 5} - if admin? = c.input :private, :as => :boolean, :label => false, :inline_label => true - = f.button :submit, t(:post_reply), :class => 'btn-primary' + = f.button :button, t(:post_reply), :name => 'commit', :class => 'btn-primary', :type => 'submit', :value => 'post_reply' - if logged_in? && @ticket.is_open - = f.button :submit, t(:reply_and_close) + = f.button :button, t(:reply_and_close), :name => 'commit', :class => 'btn', :type => 'submit', :value => 'reply_and_close' = link_to t(:cancel), auto_tickets_path, :class => :btn -- cgit v1.2.3 From 7dd56114d8bf6749f140835358de4f8ebeaf81ba Mon Sep 17 00:00:00 2001 From: elijah Date: Sat, 6 Jul 2013 17:18:20 -0700 Subject: minor - i18n text edit --- help/app/views/tickets/new.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'help/app/views/tickets') diff --git a/help/app/views/tickets/new.html.haml b/help/app/views/tickets/new.html.haml index 4d35659..c0a343d 100644 --- a/help/app/views/tickets/new.html.haml +++ b/help/app/views/tickets/new.html.haml @@ -23,7 +23,7 @@ - if admin? = c.input :private, :as => :boolean, :label => false, :inline_label => true .form-actions - = f.button :submit, :class => 'btn-primary' + = f.button :submit, :class => 'btn-primary', :value => t(:create_thing, :thing => t(:ticket)) - if logged_in? = link_to t(:cancel), auto_tickets_path, :class => :btn - else -- cgit v1.2.3