summaryrefslogtreecommitdiff
path: root/help
diff options
context:
space:
mode:
Diffstat (limited to 'help')
-rw-r--r--help/app/controllers/tickets_controller.rb12
-rw-r--r--help/app/views/tickets/index.html.haml6
-rw-r--r--help/app/views/tickets/show.html.haml4
3 files changed, 15 insertions, 7 deletions
diff --git a/help/app/controllers/tickets_controller.rb b/help/app/controllers/tickets_controller.rb
index 6011232..b76b051 100644
--- a/help/app/controllers/tickets_controller.rb
+++ b/help/app/controllers/tickets_controller.rb
@@ -19,8 +19,10 @@ class TicketsController < ApplicationController
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
-
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
respond_with(@ticket)
end
@@ -62,7 +64,11 @@ class TicketsController < ApplicationController
end
if @ticket.changed? and @ticket.save
flash[:notice] = 'Ticket was successfully updated.'
- respond_with @ticket
+ if @ticket.is_open
+ respond_with @ticket
+ else #for closed tickets, redirect to index.
+ redirect_to tickets_path
+ end
else
#redirect_to [:show, @ticket] #
flash[:alert] = 'Ticket has not been changed'
@@ -77,6 +83,8 @@ class TicketsController < ApplicationController
#we'll want only tickets that this user can access
# @tickets = Ticket.by_is_open.key(params[:status])
+ #TODO: we will need pagination
+
#below is obviously too messy and not what we want, but wanted to get basic functionality there
if admin?
# todo: for admins, might want option to see tickets they have already posted to. want to use something like tickets_by_admin
diff --git a/help/app/views/tickets/index.html.haml b/help/app/views/tickets/index.html.haml
index 8fe4055..5e35b12 100644
--- a/help/app/views/tickets/index.html.haml
+++ b/help/app/views/tickets/index.html.haml
@@ -3,12 +3,12 @@ Create a
= link_to "new ticket", new_ticket_path
= # below shouldn't be unless logged in
%h2 Tickets
-= form_tag (tickets_path, :method => :get) do # want to redo as ajax, and make sure it displays the selected option
- - options = ["open", "closed", "all"]
+= form_tag(tickets_path, :method => :get) do # want to redo as ajax, and make sure it displays the selected option
+ - options = ["all", "open", "closed"]
- if admin?
- options << "open tickets I admin" # obviously not what we will want
- options << "all tickets I admin" # obviously not what we will want
- = select_tag :status, options_for_select(options) # TODO
+ = select_tag :status, options_for_select(options, :selected => params[:status]|| "all")
= submit_tag "filter"
- @tickets.each do |ticket|
%p
diff --git a/help/app/views/tickets/show.html.haml b/help/app/views/tickets/show.html.haml
index 77d168a..9b12f34 100644
--- a/help/app/views/tickets/show.html.haml
+++ b/help/app/views/tickets/show.html.haml
@@ -1,5 +1,5 @@
-%h1 tickets show (just as space)
-%h1 tickets show (just as space)
+%h1 tickets show (just as space for firefox)
+%h1 tickets show (just as space for firefox)
%h2= @ticket.title
- if @ticket.email
email: