diff options
| author | jessib <jessib@leap.se> | 2012-12-11 16:18:37 -0800 | 
|---|---|---|
| committer | jessib <jessib@leap.se> | 2012-12-11 16:18:37 -0800 | 
| commit | 524bb47fa5782ca1e0aaf16a4a0836defadfbe48 (patch) | |
| tree | fca69fdd24858e2b565d19ef1c55d7af25bd25c1 /help/app/controllers/tickets_controller.rb | |
| parent | 4259cad450fee703dc34ebe5322de994d06a5448 (diff) | |
Start to using x-editable to have title editable.
Diffstat (limited to 'help/app/controllers/tickets_controller.rb')
| -rw-r--r-- | help/app/controllers/tickets_controller.rb | 21 | 
1 files changed, 19 insertions, 2 deletions
| diff --git a/help/app/controllers/tickets_controller.rb b/help/app/controllers/tickets_controller.rb index 3ff19b8..b79dc0f 100644 --- a/help/app/controllers/tickets_controller.rb +++ b/help/app/controllers/tickets_controller.rb @@ -1,6 +1,6 @@  class TicketsController < ApplicationController -  respond_to :html #, :json +  respond_to :html, :json    #has_scope :open, :type => boolean    before_filter :set_strings @@ -52,7 +52,24 @@ class TicketsController < ApplicationController      @ticket = Ticket.find(params[:id])      if !ticket_access_denied? -      if status = params[:change_status] #close or open button was pressed + +      if params[:post][:title] #title was changed with x-editable form + +        respond_to do |format| +          if @ticket.update_attributes(params[:post]) +            format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' } +            format.json { head :no_content } # 204 No Content +          else +            format.html { render action: "show" } +            format.json { render json: @ticket.errors, status: :unprocessable_entity } +          end +          return +        end +        # 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' + +        # TODO: this is throwing a missing template error +        return +      elsif status = params[:change_status] #close or open button was pressed          @ticket.close if params[:change_status] == 'close'          @ticket.reopen if params[:change_status] == 'open'        else | 
