diff options
author | elijah <elijah@riseup.net> | 2013-06-19 00:33:19 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2013-07-04 04:00:47 -0700 |
commit | 8393058ac15d72be702a6de481d6129aed4bbef3 (patch) | |
tree | 79af217151c3622058b79b2511c55c1b2babb3da /help/app/views | |
parent | e58fd0550b4a29fac9d52dc8a78d04333ccc8c06 (diff) |
new ui for tickets
Diffstat (limited to 'help/app/views')
-rw-r--r-- | help/app/views/tickets/_admin-nav.html.haml | 10 | ||||
-rw-r--r-- | help/app/views/tickets/_comment.html.haml | 34 | ||||
-rw-r--r-- | help/app/views/tickets/_edit_form.html.haml | 46 | ||||
-rw-r--r-- | help/app/views/tickets/_new_comment.html.haml | 4 | ||||
-rw-r--r-- | help/app/views/tickets/_new_comment_form.html.haml | 13 | ||||
-rw-r--r-- | help/app/views/tickets/_table-nav.html.haml | 3 | ||||
-rw-r--r-- | help/app/views/tickets/_ticket.html.haml | 20 | ||||
-rw-r--r-- | help/app/views/tickets/_ticket_data.html.haml | 35 | ||||
-rw-r--r-- | help/app/views/tickets/index.html.haml | 21 | ||||
-rw-r--r-- | help/app/views/tickets/new.html.haml | 10 | ||||
-rw-r--r-- | help/app/views/tickets/show.html.haml | 26 |
11 files changed, 115 insertions, 107 deletions
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 |