summaryrefslogtreecommitdiff
path: root/engines/support/app/views/tickets
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2014-05-16 08:42:36 +0200
committerAzul <azul@leap.se>2014-05-16 08:42:36 +0200
commit8fbbb8717f0578536b97c2dc0883c632f120e976 (patch)
tree17aeb2b48ada703ac916a9a65fbf3c75a5dadb86 /engines/support/app/views/tickets
parent81555ec6244ed76f92e3629880f68104b8705817 (diff)
parenta4f7a410c536d88c91c834cab6ee950c71005ddd (diff)
Merge remote-tracking branch 'origin/develop'
Conflicts: app/assets/javascripts/srp test/nagios/soledad_sync.py test/nagios/webapp_login.py
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.haml50
-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.haml17
-rw-r--r--engines/support/app/views/tickets/show.html.haml12
8 files changed, 160 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..b8da779
--- /dev/null
+++ b/engines/support/app/views/tickets/_edit_form.html.haml
@@ -0,0 +1,50 @@
+:ruby
+ # created by user link
+ if @ticket.is_creator_validated?
+ 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
+
+= simple_form_for @ticket do |f|
+ = hidden_ticket_fields
+ %p.first
+ - if @ticket.is_open?
+ %span.label.label-info
+ %b{style: 'padding:10px'}= t(:open)
+ = f.button :loading, t(:close), value: 'close', class: 'btn-mini'
+ - else
+ %span.label.label-success
+ %b{style: 'padding:10px'}= t(:closed)
+ = f.button :loading, t(:open), value: 'open', class: 'btn-mini'
+ %span.label.label-clear= t(:created_by_on, :user => created_by, :time => @ticket.created_at.to_s(:short)).html_safe
+= simple_form_for @ticket do |f|
+ = hidden_ticket_fields
+ %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 :loading, t(:save), :value => 'save'
+ - 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..40c737f
--- /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 :loading, t(:post_reply), class: 'btn-primary', value: 'post_reply'
+ - if logged_in? && @ticket.is_open
+ = f.button :loading, t(:reply_and_close), 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..445a909
--- /dev/null
+++ b/engines/support/app/views/tickets/_tabs.html.haml
@@ -0,0 +1,23 @@
+-#
+-# SORT ORDER TABS
+-#
+- unless action?(:new) or action?(:create)
+ %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) || action?(:create))}
+ = 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..a4df6e3
--- /dev/null
+++ b/engines/support/app/views/tickets/index.html.haml
@@ -0,0 +1,19 @@
+- @show_navigation = params[:user_id].present?
+
+= 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..3de5fe9
--- /dev/null
+++ b/engines/support/app/views/tickets/new.html.haml
@@ -0,0 +1,17 @@
+- @show_navigation = params[:user_id].present?
+
+= render 'tickets/tabs'
+
+- user = @user if admin?
+- user ||= current_user
+
+= simple_form_for @ticket, :validate => true, :html => {:class => 'form-horizontal'} do |f|
+ = hidden_ticket_fields
+ = f.input :subject
+ = 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
+ = f.button :wrapped, cancel: (logged_in? ? auto_tickets_path : home_path)
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..4f3c127
--- /dev/null
+++ b/engines/support/app/views/tickets/show.html.haml
@@ -0,0 +1,12 @@
+- @show_navigation = params[:user_id].present?
+
+.ticket
+ = render 'tickets/edit_form'
+ %table.table.table-striped.table-bordered
+ %tbody
+ = render :partial => 'tickets/comment', :collection => @ticket.comments
+ %tr
+ %td.user
+ = current_user.login || t(:anonymous)
+ %td.comment
+ = render 'tickets/new_comment_form'