summaryrefslogtreecommitdiff
path: root/engines/support/app/views/tickets
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2014-04-17 19:27:47 +0200
committerAzul <azul@leap.se>2014-04-17 19:27:47 +0200
commit7a9ece43bd61246b450471ed6bb1089570321e38 (patch)
treea20362ee5512e160498902ef7c0a094b3135201d /engines/support/app/views/tickets
parent614745c84cab37dd03f2bd8f06160fd01c7fabdb (diff)
make use of the UnauthorizedUser
Null Pattern for current_user - use it to get rid of some conditionals
Diffstat (limited to 'engines/support/app/views/tickets')
-rw-r--r--engines/support/app/views/tickets/new.html.haml18
-rw-r--r--engines/support/app/views/tickets/show.html.haml4
2 files changed, 7 insertions, 15 deletions
diff --git a/engines/support/app/views/tickets/new.html.haml b/engines/support/app/views/tickets/new.html.haml
index 8f217a5..e391499 100644
--- a/engines/support/app/views/tickets/new.html.haml
+++ b/engines/support/app/views/tickets/new.html.haml
@@ -2,22 +2,14 @@
= 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
+- 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
- - 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.input :email, input_html: {value: user.email}
+ = f.input :regarding_user, input_html: {value: user.login}
= 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?
@@ -27,4 +19,4 @@
- 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
+ = link_to t(:cancel), home_path, :class => 'btn'
diff --git a/engines/support/app/views/tickets/show.html.haml b/engines/support/app/views/tickets/show.html.haml
index bfdb773..edb6e6f 100644
--- a/engines/support/app/views/tickets/show.html.haml
+++ b/engines/support/app/views/tickets/show.html.haml
@@ -7,6 +7,6 @@
= render :partial => 'tickets/comment', :collection => @ticket.comments
%tr
%td.user
- = logged_in? ? current_user.login : t(:anonymous)
+ = current_user.login || t(:anonymous)
%td.comment
- = render 'tickets/new_comment_form' \ No newline at end of file
+ = render 'tickets/new_comment_form'