summaryrefslogtreecommitdiff
path: root/help
diff options
context:
space:
mode:
Diffstat (limited to 'help')
-rw-r--r--help/app/controllers/tickets_controller.rb8
-rw-r--r--help/app/views/tickets/_new_comment.html.haml2
-rw-r--r--help/app/views/tickets/new.html.haml2
-rw-r--r--help/app/views/tickets/show.html.haml2
-rw-r--r--help/test/functional/tickets_controller_test.rb4
5 files changed, 8 insertions, 10 deletions
diff --git a/help/app/controllers/tickets_controller.rb b/help/app/controllers/tickets_controller.rb
index db9bc82..297de30 100644
--- a/help/app/controllers/tickets_controller.rb
+++ b/help/app/controllers/tickets_controller.rb
@@ -39,6 +39,7 @@ class TicketsController < ApplicationController
def show
@ticket = Ticket.find(params[:id])
+ @comment = TicketComment.new
if !@ticket
redirect_to tickets_path, :alert => "No such ticket"
return
@@ -53,9 +54,7 @@ class TicketsController < ApplicationController
if !ticket_access_denied?
if params[:post] #currently changes to title or is_open status
- if @ticket.update_attributes(params[:post]) #this saves ticket, so @ticket.changed? will be false
- tick_updated = true
- end
+ @ticket.attributes = params[:post]
# TODO: do we want to keep the history of title changes? one possibility was adding a comment that said something like 'user changed the title from a to b'
else
@@ -64,9 +63,8 @@ class TicketsController < ApplicationController
@ticket.close if params[:commit] == @reply_close_str #this overrides is_open selection
# what if there is an update and no new comment? Confirm that there is a new comment to update posted_by:
@ticket.comments.last.posted_by = (current_user ? current_user.id : nil) if @ticket.comments_changed? #protecting posted_by isn't working, so this should protect it.
- tick_updated = true if @ticket.changed? and @ticket.save
end
- if tick_updated
+ if @ticket.changed? and @ticket.save
flash[:notice] = 'Ticket was successfully updated.'
if @ticket.is_open
respond_with @ticket
diff --git a/help/app/views/tickets/_new_comment.html.haml b/help/app/views/tickets/_new_comment.html.haml
index b216311..5697854 100644
--- a/help/app/views/tickets/_new_comment.html.haml
+++ b/help/app/views/tickets/_new_comment.html.haml
@@ -1,2 +1,2 @@
-= f.simple_fields_for :comments, comment_object do |c|
+= f.simple_fields_for :comments, @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 0ee47ff..ca036a5 100644
--- a/help/app/views/tickets/new.html.haml
+++ b/help/app/views/tickets/new.html.haml
@@ -2,7 +2,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?
- = render :partial => 'new_comment', :locals => {:f => f, :comment_object => nil}
+ = render :partial => 'new_comment', :locals => {:f => f}
= # regarding_user if not logged in
= # email if not logged in
= f.button :submit
diff --git a/help/app/views/tickets/show.html.haml b/help/app/views/tickets/show.html.haml
index b9f2ce6..a4f3b5f 100644
--- a/help/app/views/tickets/show.html.haml
+++ b/help/app/views/tickets/show.html.haml
@@ -25,7 +25,7 @@
= #render @ticket.comments should work if view is in /app/views/comments/_comment
= simple_form_for(@ticket, :html => {:novalidate => true}) do |f| #turn off html5 validations to test
- = render :partial => 'new_comment', :locals => {:f => f, :comment_object => TicketComment.new}
+ = render :partial => 'new_comment', :locals => {:f => f}
= f.button :submit, @post_reply_str
- if @ticket.is_open
= f.button :submit, @reply_close_str
diff --git a/help/test/functional/tickets_controller_test.rb b/help/test/functional/tickets_controller_test.rb
index b29fa17..7060936 100644
--- a/help/test/functional/tickets_controller_test.rb
+++ b/help/test/functional/tickets_controller_test.rb
@@ -177,9 +177,9 @@ class TicketsControllerTest < ActionController::TestCase
login :is_admin? => true, :email => nil
get :index, {:admin_status => "all", :open_status => "open"}
- assert assigns(:all_tickets).count > 1 # at least 2 tickets
+ assert assigns(:all_tickets).count > 1
- # if we close one ticket, the admin should have 1 less open ticket they admin
+ # if we close one ticket, the admin should have 1 less open ticket
assert_difference('assigns[:all_tickets].count', -1) do
assigns(:tickets).first.close
assigns(:tickets).first.save