From e1c0b7f23d7be1d8f3139aa255bd121969ece97a Mon Sep 17 00:00:00 2001 From: jessib Date: Tue, 22 Jan 2013 11:12:37 -0800 Subject: Translate text rather than having it in code directly. --- help/app/controllers/tickets_controller.rb | 3 ++- help/config/locales/en.yml | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 help/config/locales/en.yml diff --git a/help/app/controllers/tickets_controller.rb b/help/app/controllers/tickets_controller.rb index b613088..372ff6e 100644 --- a/help/app/controllers/tickets_controller.rb +++ b/help/app/controllers/tickets_controller.rb @@ -24,7 +24,8 @@ class TicketsController < ApplicationController end 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 + # cannot set this until ticket has been saved, as @ticket.id will not be set + flash[:notice] += " " + t(:access_ticket_text, :full_url => request.protocol + request.host_with_port + ticket_path(@ticket.id)) end respond_with(@ticket) 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" -- cgit v1.2.3 From dea7680b7260224beb2d2b8b901310f27d7337b0 Mon Sep 17 00:00:00 2001 From: jessib Date: Tue, 22 Jan 2013 11:17:10 -0800 Subject: Makes tickets_controller a bit less complex. --- help/app/controllers/tickets_controller.rb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/help/app/controllers/tickets_controller.rb b/help/app/controllers/tickets_controller.rb index 372ff6e..3ccebb3 100644 --- a/help/app/controllers/tickets_controller.rb +++ b/help/app/controllers/tickets_controller.rb @@ -15,13 +15,11 @@ 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? # cannot set this until ticket has been saved, as @ticket.id will not be set -- cgit v1.2.3 From d0bf43794c6385a6b746ce6ed4a3ba54fc891a30 Mon Sep 17 00:00:00 2001 From: jessib Date: Tue, 22 Jan 2013 11:22:11 -0800 Subject: Users now have an email_address, not an email. --- users/app/views/users/show.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/users/app/views/users/show.html.haml b/users/app/views/users/show.html.haml index a1eeccb..056ed57 100644 --- a/users/app/views/users/show.html.haml +++ b/users/app/views/users/show.html.haml @@ -3,7 +3,7 @@ .small = link_to 'edit', edit_user_path(@user) %dl.offset1 - - fields = ['login', 'email', 'created_at', 'updated_at', 'email_forward'] + - fields = ['login', 'email_address', 'created_at', 'updated_at', 'email_forward'] - fields.each do |field| %dt = field.titleize -- cgit v1.2.3 From 7cdb14e2a6584eb838945b00fe2840b3e8c211e3 Mon Sep 17 00:00:00 2001 From: jessib Date: Tue, 22 Jan 2013 11:26:15 -0800 Subject: More minor cleanup of tickets controller --- help/app/controllers/tickets_controller.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/help/app/controllers/tickets_controller.rb b/help/app/controllers/tickets_controller.rb index 3ccebb3..bab795a 100644 --- a/help/app/controllers/tickets_controller.rb +++ b/help/app/controllers/tickets_controller.rb @@ -21,10 +21,9 @@ class TicketsController < ApplicationController @ticket.email = current_user.email if logged_in? and current_user.email flash[:notice] = 'Ticket was successfully created.' if @ticket.save - if !logged_in? - # cannot set this until ticket has been saved, as @ticket.id will not be set - flash[:notice] += " " + t(:access_ticket_text, :full_url => request.protocol + request.host_with_port + ticket_path(@ticket.id)) - end + + # cannot set this until ticket has been saved, as @ticket.id will not be set + flash[:notice] += " " + t(:access_ticket_text, :full_url => request.protocol + request.host_with_port + ticket_path(@ticket.id)) if !logged_in? respond_with(@ticket) end -- cgit v1.2.3 From 9fa4afd9b3fa1210dd467656e5a014ab99c136e1 Mon Sep 17 00:00:00 2001 From: jessib Date: Tue, 22 Jan 2013 11:38:05 -0800 Subject: Link to users show page rather than edit, now that we have a show view for users. --- help/app/views/tickets/_ticket_data.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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. -- cgit v1.2.3 From c3165f4ff3bafda23d17d96a7148c05e5701e488 Mon Sep 17 00:00:00 2001 From: jessib Date: Tue, 22 Jan 2013 14:43:47 -0800 Subject: Edit form should show email address for the currently displayed user. --- users/app/views/users/edit.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/users/app/views/users/edit.html.haml b/users/app/views/users/edit.html.haml index 03088d8..238c0eb 100644 --- a/users/app/views/users/edit.html.haml +++ b/users/app/views/users/edit.html.haml @@ -6,8 +6,8 @@ = render 'cancel_account' if @user == current_user - content_for :email do %legend=t :email_address - Your email address is - = render user.email_address, :as => :span + The associated email address is + = render @user.email_address, :as => :span = user_form_with 'email_forward_field', :legend => :forward_email = user_form_with 'email_aliases', :legend => :add_email_alias = render 'tabs/tabs', :tabs => [:account, :email] -- cgit v1.2.3 From 4057fba83719687284a4fc5542d1d0cb6f1f86e9 Mon Sep 17 00:00:00 2001 From: jessib Date: Thu, 24 Jan 2013 09:51:01 -0800 Subject: Use ticket_url to get URL for unauthenticated ticket creation, and only flash that message if the ticket already has a flash[:message] (and thus was saved successfully) --- help/app/controllers/tickets_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/help/app/controllers/tickets_controller.rb b/help/app/controllers/tickets_controller.rb index bab795a..d5a3da7 100644 --- a/help/app/controllers/tickets_controller.rb +++ b/help/app/controllers/tickets_controller.rb @@ -23,7 +23,7 @@ class TicketsController < ApplicationController flash[:notice] = 'Ticket was successfully created.' if @ticket.save # cannot set this until ticket has been saved, as @ticket.id will not be set - flash[:notice] += " " + t(:access_ticket_text, :full_url => request.protocol + request.host_with_port + ticket_path(@ticket.id)) if !logged_in? + flash[:notice] += " " + t(:access_ticket_text, :full_url => ticket_url(@ticket.id)) if !logged_in? and flash[:notice] respond_with(@ticket) end -- cgit v1.2.3