From 313000fec18d56fba8f720ac32ae3ca8a92e4e36 Mon Sep 17 00:00:00 2001 From: jessib Date: Mon, 24 Dec 2012 16:22:39 -0800 Subject: Rough functionality for unauthenticated tickets. --- help/app/models/ticket.rb | 2 +- help/app/views/tickets/_ticket_data.html.haml | 7 +++++++ help/app/views/tickets/new.html.haml | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) (limited to 'help/app') diff --git a/help/app/models/ticket.rb b/help/app/models/ticket.rb index fa056b4..fed2b8b 100644 --- a/help/app/models/ticket.rb +++ b/help/app/models/ticket.rb @@ -16,7 +16,7 @@ class Ticket < CouchRest::Model::Base #belongs_to :user #from leap_web_users. doesn't necessarily belong to a user though property :created_by, String, :protected => true #Integer #nil unless user was authenticated for ticket creation, #THIS should not be changed after being set - #property :regarding_user, String#Integer # form cannot be submitted if they type in a username w/out corresponding ID. this field can be nil. for authenticated ticket creation by non-admins, should this just automatically be set to be same as created_by? or maybe we don't use this field unless created_by is nil? + property :regarding_user, String#Integer # form cannot be submitted if they type in a username w/out corresponding ID. this field can be nil. for authenticated ticket creation by non-admins, should this just automatically be set to be same as created_by? or maybe we don't use this field unless created_by is nil? #also, both created_by and regarding_user could be nil---say user forgets username, or has general question property :title, String property :email, String #verify diff --git a/help/app/views/tickets/_ticket_data.html.haml b/help/app/views/tickets/_ticket_data.html.haml index 3d301be..80c0d74 100644 --- a/help/app/views/tickets/_ticket_data.html.haml +++ b/help/app/views/tickets/_ticket_data.html.haml @@ -5,6 +5,13 @@ = User.find(@ticket.created_by).login - else Unauthenticated ticket creator + - if @ticket.regarding_user + %b + Regarding user: + - if regarding_user = User.find_by_login(@ticket.regarding_user) + = link_to @ticket.regarding_user, edit_user_path(regarding_user) + - else + = @ticket.regarding_user + '(no such user)' - if @ticket.email %b email: diff --git a/help/app/views/tickets/new.html.haml b/help/app/views/tickets/new.html.haml index 750b990..255be65 100644 --- a/help/app/views/tickets/new.html.haml +++ b/help/app/views/tickets/new.html.haml @@ -3,6 +3,7 @@ = simple_form_for(@ticket, :html => {:novalidate => true}) do |f| #turn off html5 validations to test = f.input :title = f.input :email if !current_user #hmm--might authenticated users want to submit an alternate email? + = f.input :regarding_user if !current_user = render :partial => 'new_comment', :locals => {:f => f} = # regarding_user if not logged in = # email if not logged in -- cgit v1.2.3