From a6de1561461cc719fddd8175c93588a47513a4b8 Mon Sep 17 00:00:00 2001 From: jessib Date: Fri, 5 Oct 2012 15:41:03 -0700 Subject: Rough code to add & comment on tickets. --- help/app/views/tickets/_comment.html.haml | 10 ++++++++++ help/app/views/tickets/_new_comment.html.haml | 2 ++ help/app/views/tickets/index.html.haml | 5 +++++ help/app/views/tickets/new.html.haml | 14 ++++++++++++++ help/app/views/tickets/show.html.haml | 10 ++++++++++ 5 files changed, 41 insertions(+) create mode 100644 help/app/views/tickets/_comment.html.haml create mode 100644 help/app/views/tickets/_new_comment.html.haml create mode 100644 help/app/views/tickets/index.html.haml create mode 100644 help/app/views/tickets/new.html.haml create mode 100644 help/app/views/tickets/show.html.haml (limited to 'help/app/views') diff --git a/help/app/views/tickets/_comment.html.haml b/help/app/views/tickets/_comment.html.haml new file mode 100644 index 0000000..77e29b8 --- /dev/null +++ b/help/app/views/tickets/_comment.html.haml @@ -0,0 +1,10 @@ +%div + - if User.find(comment.posted_by) + Posted by + = User.find(comment.posted_by).login + %p + Posted at + = comment.posted_at + %p + = comment.body + %p \ No newline at end of file diff --git a/help/app/views/tickets/_new_comment.html.haml b/help/app/views/tickets/_new_comment.html.haml new file mode 100644 index 0000000..bf88da6 --- /dev/null +++ b/help/app/views/tickets/_new_comment.html.haml @@ -0,0 +1,2 @@ += simple_fields_for :comment do |c| + = c.input :body, :label => 'Comment', :as => :text diff --git a/help/app/views/tickets/index.html.haml b/help/app/views/tickets/index.html.haml new file mode 100644 index 0000000..55bfa79 --- /dev/null +++ b/help/app/views/tickets/index.html.haml @@ -0,0 +1,5 @@ +%h2 Tickets +- @tickets.each do |ticket| + %p + = link_to ticket.title, ticket += #render(:partial => "ticket", :collection => @tickets) \ No newline at end of file diff --git a/help/app/views/tickets/new.html.haml b/help/app/views/tickets/new.html.haml new file mode 100644 index 0000000..fd1bcd4 --- /dev/null +++ b/help/app/views/tickets/new.html.haml @@ -0,0 +1,14 @@ +%h2=t :new_ticket += simple_form_for @ticket do |f| + = f.input :title + = #f.input :email #if there is no current_user + = f.input :email if !User.current_test + = #simple_fields_for :comment do |c| + = #c.input :body, :label => 'Comment', :as => :text + = #f.input :comment + = render :partial => 'new_comment' + = # regarding_user if not logged in + = # email if not logged in + = #f.button :submit, :value => t(:submit), :class => 'btn-primary' + = f.button :submit + = link_to t(:cancel), root_url, :class => :btn diff --git a/help/app/views/tickets/show.html.haml b/help/app/views/tickets/show.html.haml new file mode 100644 index 0000000..a37f5c8 --- /dev/null +++ b/help/app/views/tickets/show.html.haml @@ -0,0 +1,10 @@ +%h2= @ticket.title +is open? += @ticket.is_open +code: += @ticket.code += render(:partial => "comment", :collection => @ticket.comments) + += simple_form_for @ticket do |f| + = render :partial => 'new_comment' + = f.button :submit \ No newline at end of file -- cgit v1.2.3 From c27f2a0686db0705553eda88c799d4c486c20bac Mon Sep 17 00:00:00 2001 From: jessib Date: Wed, 10 Oct 2012 10:55:25 -0700 Subject: Pushing some tweaks as I try to get server-side validation working. --- help/app/views/tickets/index.html.haml | 5 ++++- help/app/views/tickets/new.html.haml | 15 +++++++++++---- help/app/views/tickets/show.html.haml | 5 +++-- 3 files changed, 18 insertions(+), 7 deletions(-) (limited to 'help/app/views') diff --git a/help/app/views/tickets/index.html.haml b/help/app/views/tickets/index.html.haml index 55bfa79..d2e0ea0 100644 --- a/help/app/views/tickets/index.html.haml +++ b/help/app/views/tickets/index.html.haml @@ -2,4 +2,7 @@ - @tickets.each do |ticket| %p = link_to ticket.title, ticket -= #render(:partial => "ticket", :collection => @tickets) \ No newline at end of file +%p +Create a += link_to "new ticket", new_ticket_path += #render(:partial => "ticket", :collection => @tickets) diff --git a/help/app/views/tickets/new.html.haml b/help/app/views/tickets/new.html.haml index fd1bcd4..d0e6939 100644 --- a/help/app/views/tickets/new.html.haml +++ b/help/app/views/tickets/new.html.haml @@ -1,12 +1,19 @@ %h2=t :new_ticket -= simple_form_for @ticket do |f| += simple_form_for (@ticket, :html => {:novalidate => true}) do |f| #turn off html5 validations to test + = @ticket.errors.messages = f.input :title = #f.input :email #if there is no current_user - = f.input :email if !User.current_test - = #simple_fields_for :comment do |c| + = f.input :email if !User.current_test #hmm--might authenticated users want to submit an alternate email? + = #f.simple_fields_for :comment do |c| = #c.input :body, :label => 'Comment', :as => :text + = #f.input :comments, :label => 'Comment', :as => :text + + = f.fields_for :comment do |c| + = c.input :body, :label => 'Comment', :as => :text + + = #f.input :comment - = render :partial => 'new_comment' + = #render :partial => 'new_comment' #what we were using = # regarding_user if not logged in = # email if not logged in = #f.button :submit, :value => t(:submit), :class => 'btn-primary' diff --git a/help/app/views/tickets/show.html.haml b/help/app/views/tickets/show.html.haml index a37f5c8..1e1fab3 100644 --- a/help/app/views/tickets/show.html.haml +++ b/help/app/views/tickets/show.html.haml @@ -5,6 +5,7 @@ code: = @ticket.code = render(:partial => "comment", :collection => @ticket.comments) -= simple_form_for @ticket do |f| += simple_form_for (@ticket, :html => {:novalidate => true}) do |f| #turn off html5 validations to test = render :partial => 'new_comment' - = f.button :submit \ No newline at end of file + = f.button :submit + = link_to t(:cancel), root_url, :class => :btn \ No newline at end of file -- cgit v1.2.3 From cf9ed38ab1840092352efdbb71bfeb5bc3b9f9d5 Mon Sep 17 00:00:00 2001 From: jessib Date: Wed, 10 Oct 2012 15:52:08 -0700 Subject: Some tweaks to get server-side validation working when adding the embedded ticket comment to a new ticket. --- help/app/views/tickets/new.html.haml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'help/app/views') diff --git a/help/app/views/tickets/new.html.haml b/help/app/views/tickets/new.html.haml index d0e6939..0a6b25b 100644 --- a/help/app/views/tickets/new.html.haml +++ b/help/app/views/tickets/new.html.haml @@ -1,18 +1,13 @@ %h2=t :new_ticket = simple_form_for (@ticket, :html => {:novalidate => true}) do |f| #turn off html5 validations to test - = @ticket.errors.messages + = #@ticket.errors.messages = f.input :title = #f.input :email #if there is no current_user = f.input :email if !User.current_test #hmm--might authenticated users want to submit an alternate email? - = #f.simple_fields_for :comment do |c| - = #c.input :body, :label => 'Comment', :as => :text - = #f.input :comments, :label => 'Comment', :as => :text - = f.fields_for :comment do |c| + = f.simple_fields_for :comments do |c| = c.input :body, :label => 'Comment', :as => :text - - = #f.input :comment = #render :partial => 'new_comment' #what we were using = # regarding_user if not logged in = # email if not logged in -- cgit v1.2.3 From 56273c13f54a872d02db286c90a8d5103cf7a663 Mon Sep 17 00:00:00 2001 From: jessib Date: Fri, 12 Oct 2012 14:42:57 -0700 Subject: more work on ticket creation/updating functionality --- help/app/views/tickets/_comment.html.haml | 3 ++- help/app/views/tickets/_new_comment.html.haml | 1 + help/app/views/tickets/new.html.haml | 2 +- help/app/views/tickets/show.html.haml | 10 ++++++++-- 4 files changed, 12 insertions(+), 4 deletions(-) (limited to 'help/app/views') diff --git a/help/app/views/tickets/_comment.html.haml b/help/app/views/tickets/_comment.html.haml index 77e29b8..19e1ddf 100644 --- a/help/app/views/tickets/_comment.html.haml +++ b/help/app/views/tickets/_comment.html.haml @@ -1,4 +1,5 @@ -%div +- # style is super ugly but just for now +%div{:style => "border: solid 1px"} - if User.find(comment.posted_by) Posted by = User.find(comment.posted_by).login diff --git a/help/app/views/tickets/_new_comment.html.haml b/help/app/views/tickets/_new_comment.html.haml index bf88da6..a924dfd 100644 --- a/help/app/views/tickets/_new_comment.html.haml +++ b/help/app/views/tickets/_new_comment.html.haml @@ -1,2 +1,3 @@ += #do we want this partial? not using it now = simple_fields_for :comment do |c| = c.input :body, :label => 'Comment', :as => :text diff --git a/help/app/views/tickets/new.html.haml b/help/app/views/tickets/new.html.haml index 0a6b25b..d784720 100644 --- a/help/app/views/tickets/new.html.haml +++ b/help/app/views/tickets/new.html.haml @@ -13,4 +13,4 @@ = # email if not logged in = #f.button :submit, :value => t(:submit), :class => 'btn-primary' = f.button :submit - = link_to t(:cancel), root_url, :class => :btn + = link_to t(:cancel), tickets_path, :class => :btn diff --git a/help/app/views/tickets/show.html.haml b/help/app/views/tickets/show.html.haml index 1e1fab3..04dd676 100644 --- a/help/app/views/tickets/show.html.haml +++ b/help/app/views/tickets/show.html.haml @@ -1,3 +1,7 @@ +- if flash[:notice] + =flash[:notice] +- if flash[:alert] + =flash[:alert] %h2= @ticket.title is open? = @ticket.is_open @@ -6,6 +10,8 @@ code: = render(:partial => "comment", :collection => @ticket.comments) = simple_form_for (@ticket, :html => {:novalidate => true}) do |f| #turn off html5 validations to test - = render :partial => 'new_comment' + = f.simple_fields_for :comments, TicketComment.new do |c| + = c.input :body, :label => 'Comment', :as => :text + = #render :partial => 'new_comment' = f.button :submit - = link_to t(:cancel), root_url, :class => :btn \ No newline at end of file + = link_to t(:cancel), tickets_path, :class => :btn \ No newline at end of file -- cgit v1.2.3 From 48d6c2aac9ae2bf1c140e734a576e45289c99150 Mon Sep 17 00:00:00 2001 From: jessib Date: Tue, 16 Oct 2012 15:51:35 -0700 Subject: Some functional tests and other tweaks. --- help/app/views/tickets/_comment.html.haml | 2 ++ help/app/views/tickets/index.html.haml | 5 ++--- help/app/views/tickets/new.html.haml | 2 +- help/app/views/tickets/show.html.haml | 13 +++++++++++-- 4 files changed, 16 insertions(+), 6 deletions(-) (limited to 'help/app/views') diff --git a/help/app/views/tickets/_comment.html.haml b/help/app/views/tickets/_comment.html.haml index 19e1ddf..1ba3bd1 100644 --- a/help/app/views/tickets/_comment.html.haml +++ b/help/app/views/tickets/_comment.html.haml @@ -3,6 +3,8 @@ - if User.find(comment.posted_by) Posted by = User.find(comment.posted_by).login + - else + Unauthenticated post %p Posted at = comment.posted_at diff --git a/help/app/views/tickets/index.html.haml b/help/app/views/tickets/index.html.haml index d2e0ea0..f328ca2 100644 --- a/help/app/views/tickets/index.html.haml +++ b/help/app/views/tickets/index.html.haml @@ -1,8 +1,7 @@ +Create a += link_to "new ticket", new_ticket_path %h2 Tickets - @tickets.each do |ticket| %p = link_to ticket.title, ticket -%p -Create a -= link_to "new ticket", new_ticket_path = #render(:partial => "ticket", :collection => @tickets) diff --git a/help/app/views/tickets/new.html.haml b/help/app/views/tickets/new.html.haml index d784720..8c660c9 100644 --- a/help/app/views/tickets/new.html.haml +++ b/help/app/views/tickets/new.html.haml @@ -1,5 +1,5 @@ %h2=t :new_ticket -= simple_form_for (@ticket, :html => {:novalidate => true}) do |f| #turn off html5 validations to test += simple_form_for(@ticket, :html => {:novalidate => true}) do |f| #turn off html5 validations to test = #@ticket.errors.messages = f.input :title = #f.input :email #if there is no current_user diff --git a/help/app/views/tickets/show.html.haml b/help/app/views/tickets/show.html.haml index 04dd676..a9b994e 100644 --- a/help/app/views/tickets/show.html.haml +++ b/help/app/views/tickets/show.html.haml @@ -5,8 +5,17 @@ %h2= @ticket.title is open? = @ticket.is_open -code: -= @ticket.code +- if @ticket.code + code: + = @ticket.code +- if @ticket.email + email: + = @ticket.email +- if User.find(@ticket.created_by) + Created by + = User.find(@ticket.created_by).login +- else + Unauthenticated ticket creator = render(:partial => "comment", :collection => @ticket.comments) = simple_form_for (@ticket, :html => {:novalidate => true}) do |f| #turn off html5 validations to test -- cgit v1.2.3 From 8b9d5235faed6c15e8ef2e2dc76aec7f24d0bb50 Mon Sep 17 00:00:00 2001 From: jessib Date: Thu, 18 Oct 2012 13:42:37 -0700 Subject: Uses the working authentication code. --- help/app/views/tickets/index.html.haml | 3 +++ help/app/views/tickets/new.html.haml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'help/app/views') diff --git a/help/app/views/tickets/index.html.haml b/help/app/views/tickets/index.html.haml index f328ca2..6db2140 100644 --- a/help/app/views/tickets/index.html.haml +++ b/help/app/views/tickets/index.html.haml @@ -1,6 +1,9 @@ +%h2 tickets index (just as space) Create a = link_to "new ticket", new_ticket_path += # below shouldn't be unless logged in %h2 Tickets += # want to have selection option to see tickets, that are open, closed or all - @tickets.each do |ticket| %p = link_to ticket.title, ticket diff --git a/help/app/views/tickets/new.html.haml b/help/app/views/tickets/new.html.haml index 8c660c9..537b97f 100644 --- a/help/app/views/tickets/new.html.haml +++ b/help/app/views/tickets/new.html.haml @@ -3,7 +3,7 @@ = #@ticket.errors.messages = f.input :title = #f.input :email #if there is no current_user - = f.input :email if !User.current_test #hmm--might authenticated users want to submit an alternate email? + = f.input :email if !current_user #hmm--might authenticated users want to submit an alternate email? = f.simple_fields_for :comments do |c| = c.input :body, :label => 'Comment', :as => :text -- cgit v1.2.3