diff options
author | jessib <jessib@riseup.net> | 2013-01-24 09:51:50 -0800 |
---|---|---|
committer | jessib <jessib@riseup.net> | 2013-01-24 09:51:50 -0800 |
commit | 75442ad26f3d30519f747bc98bc83cdc76aff750 (patch) | |
tree | 7c5dfc371c7d596a3a3676bad6b24c4d6c5ab43a /help | |
parent | ed1caa740f0e58cfd5f2d908946461154db68174 (diff) | |
parent | 4057fba83719687284a4fc5542d1d0cb6f1f86e9 (diff) |
Merge pull request #21 from leapcode/feature/misc_cleanup
Feature/misc cleanup
Diffstat (limited to 'help')
-rw-r--r-- | help/app/controllers/tickets_controller.rb | 18 | ||||
-rw-r--r-- | help/app/views/tickets/_ticket_data.html.haml | 4 | ||||
-rw-r--r-- | help/config/locales/en.yml | 2 |
3 files changed, 12 insertions, 12 deletions
diff --git a/help/app/controllers/tickets_controller.rb b/help/app/controllers/tickets_controller.rb index b613088..d5a3da7 100644 --- a/help/app/controllers/tickets_controller.rb +++ b/help/app/controllers/tickets_controller.rb @@ -15,17 +15,15 @@ class TicketsController < ApplicationController def create @ticket = Ticket.new(params[:ticket]) - if logged_in? - @ticket.created_by = current_user.id - @ticket.email = current_user.email if current_user.email - @ticket.comments.last.posted_by = current_user.id - else - @ticket.comments.last.posted_by = nil #hacky, but protecting this attribute doesn't work right, so this should make sure it isn't set. - end + + @ticket.comments.last.posted_by = (logged_in? ? current_user.id : nil) #protecting posted_by isn't working, so this should protect it. + @ticket.created_by = current_user.id if logged_in? + @ticket.email = current_user.email if logged_in? and current_user.email + flash[:notice] = 'Ticket was successfully created.' if @ticket.save - if !logged_in? - flash[:notice] = flash[:notice] + ' You can later access this ticket at the url ' + request.protocol + request.host_with_port + ticket_path(@ticket.id) + '. You might want to bookmark this page to find it again. Anybody with this URL will be able to access this ticket, so if you are on a shared computer you might want to remove it from the browser history' #todo - end + + # cannot set this until ticket has been saved, as @ticket.id will not be set + flash[:notice] += " " + t(:access_ticket_text, :full_url => ticket_url(@ticket.id)) if !logged_in? and flash[:notice] respond_with(@ticket) end diff --git a/help/app/views/tickets/_ticket_data.html.haml b/help/app/views/tickets/_ticket_data.html.haml index d68d3e9..6a1a896 100644 --- a/help/app/views/tickets/_ticket_data.html.haml +++ b/help/app/views/tickets/_ticket_data.html.haml @@ -2,7 +2,7 @@ %b Created by: - if @ticket.created_by_user - = link_to @ticket.created_by_user.login, edit_user_path(@ticket.created_by_user) #todo: won't want edit path + = link_to @ticket.created_by_user.login, user_path(@ticket.created_by_user) - else Unauthenticated ticket creator - if @ticket.regarding_user @@ -10,7 +10,7 @@ Regarding user: - if admin? - if @ticket.regarding_user_actual_user - = link_to @ticket.regarding_user_actual_user.login, edit_user_path(@ticket.regarding_user_actual_user) #todo: won't want edit path + = 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. diff --git a/help/config/locales/en.yml b/help/config/locales/en.yml new file mode 100644 index 0000000..4ea662a --- /dev/null +++ b/help/config/locales/en.yml @@ -0,0 +1,2 @@ +en: + access_ticket_text: "You can later access this ticket at the url %{full_url}. You might want to bookmark this page to find it again. Anybody with this URL will be able to access this ticket, so if you are on a shared computer you might want to remove it from the browser history" |