summaryrefslogtreecommitdiff
path: root/engines/support/app/views/tickets
diff options
context:
space:
mode:
Diffstat (limited to 'engines/support/app/views/tickets')
-rw-r--r--engines/support/app/views/tickets/_comment.html.haml20
-rw-r--r--engines/support/app/views/tickets/_edit_form.html.haml48
-rw-r--r--engines/support/app/views/tickets/_new_comment_form.html.haml13
-rw-r--r--engines/support/app/views/tickets/_tabs.html.haml23
-rw-r--r--engines/support/app/views/tickets/_ticket.html.haml6
-rw-r--r--engines/support/app/views/tickets/index.html.haml19
-rw-r--r--engines/support/app/views/tickets/new.html.haml30
-rw-r--r--engines/support/app/views/tickets/show.html.haml12
8 files changed, 171 insertions, 0 deletions
diff --git a/engines/support/app/views/tickets/_comment.html.haml b/engines/support/app/views/tickets/_comment.html.haml
new file mode 100644
index 0000000..778ca13
--- /dev/null
+++ b/engines/support/app/views/tickets/_comment.html.haml
@@ -0,0 +1,20 @@
+- if admin? or !comment.private # only show comment if user is admin or comment is not private
+ %tr
+ %td.user
+ %div
+ %strong
+ - if comment.posted_by_user
+ = comment.posted_by_user.login
+ - else
+ = t(:anonymous)
+ %div= comment.posted_at.to_s(:short)
+ - if comment.posted_by_user && comment.posted_by_user.is_admin?
+ %div
+ %span.label.label-inverse
+ = t(:admin)
+ - if comment.private
+ %div
+ %span.label.label-important
+ = t(:private)
+ %td.comment
+ = simple_format(comment.body) \ No newline at end of file
diff --git a/engines/support/app/views/tickets/_edit_form.html.haml b/engines/support/app/views/tickets/_edit_form.html.haml
new file mode 100644
index 0000000..714f8ff
--- /dev/null
+++ b/engines/support/app/views/tickets/_edit_form.html.haml
@@ -0,0 +1,48 @@
+:ruby
+ # created by user link
+ if @ticket.created_by_user
+ created_by = link_to @ticket.created_by_user.login, @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, @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
+ %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
+ %div= t(:subject)
+ = f.text_field :subject, :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_account)
+ = regarding_user_link
+ = f.text_field :regarding_user
+ = f.button t(:save), :name => 'commit', :class => 'btn', :type => 'submit', :value => 'save'
+ - if @ticket.is_open?
+ = f.button t(:close), :name => 'commit', :class => 'btn', :type => 'submit', :value => 'close'
+ - else
+ = 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/engines/support/app/views/tickets/_new_comment_form.html.haml b/engines/support/app/views/tickets/_new_comment_form.html.haml
new file mode 100644
index 0000000..8418e01
--- /dev/null
+++ b/engines/support/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|
+ = 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?
+ = c.input :private, :as => :boolean, :label => false, :inline_label => true
+ = f.button :button, t(:post_reply), :name => 'commit', :class => 'btn-primary', :type => 'submit', :value => 'post_reply'
+ - if logged_in? && @ticket.is_open
+ = 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
diff --git a/engines/support/app/views/tickets/_tabs.html.haml b/engines/support/app/views/tickets/_tabs.html.haml
new file mode 100644
index 0000000..b7b5d3a
--- /dev/null
+++ b/engines/support/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/engines/support/app/views/tickets/_ticket.html.haml b/engines/support/app/views/tickets/_ticket.html.haml
new file mode 100644
index 0000000..5bc33c8
--- /dev/null
+++ b/engines/support/app/views/tickets/_ticket.html.haml
@@ -0,0 +1,6 @@
+- url = auto_ticket_path(ticket)
+%tr
+ %td= link_to ticket.subject, 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/engines/support/app/views/tickets/index.html.haml b/engines/support/app/views/tickets/index.html.haml
new file mode 100644
index 0000000..c02a326
--- /dev/null
+++ b/engines/support/app/views/tickets/index.html.haml
@@ -0,0 +1,19 @@
+- @show_navigation = !params[:user_id].nil?
+
+= render 'tickets/tabs'
+
+%table.table.table-striped.table-bordered
+ %thead
+ %tr
+ %th= t(:subject)
+ %th= t(:created)
+ %th= t(:updated)
+ %th= t(:voices)
+ %tbody
+ - if @tickets.any?
+ = render @tickets.all
+ - else
+ %tr
+ %td{:colspan=>4}= t(:none)
+
+= paginate @tickets
diff --git a/engines/support/app/views/tickets/new.html.haml b/engines/support/app/views/tickets/new.html.haml
new file mode 100644
index 0000000..8f217a5
--- /dev/null
+++ b/engines/support/app/views/tickets/new.html.haml
@@ -0,0 +1,30 @@
+- @show_navigation = !params[:user_id].nil?
+
+= 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 :subject
+ - 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
+ = 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', :value => t(:create_thing, :thing => t(:ticket))
+ - if logged_in?
+ = link_to t(:cancel), auto_tickets_path, :class => :btn
+ - else
+ = link_to t(:cancel), home_path, :class => 'btn' \ No newline at end of file
diff --git a/engines/support/app/views/tickets/show.html.haml b/engines/support/app/views/tickets/show.html.haml
new file mode 100644
index 0000000..bfdb773
--- /dev/null
+++ b/engines/support/app/views/tickets/show.html.haml
@@ -0,0 +1,12 @@
+- @show_navigation = !params[:user_id].nil?
+
+.ticket
+ = render 'tickets/edit_form'
+ %table.table.table-striped.table-bordered
+ %tbody
+ = 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