Class | ReviewController
In: | app/controllers/review_controller.rb
Parent: | ApplicationController

Copyright (c) 2006 Logica

### Methods

assign note toggle_done

### Public Instance methods

assign()

Action review assigns current User as the reviewer

[Source]

        # File app/controllers/review_controller.rb, line 35
    35:   def assign
    36:     html = "<%= link_to_reviewer(@record) %>"
    37:     if @record.reviewer.nil?
    38:         @record.update_attributes(:reviewer => session['user'])
    39:     elsif @record.reviewer == session['user']
    40:         @record.update_attributes(:reviewer => nil)
    41:     elsif cadmin?
    42:         @record.update_attributes(:reviewer => session['user'])
    43:     elsif !@record.reviewer.nil? && !cadmin?
    44:         html = "<script language=\"JavaScript\">alert('Only the central administrator (#{User.find_central_admin.name}) can change or clear the reviewer!')</script><%= link_to_reviewer(@record) %>"
    45:     end
    46:     render :inline => html
    47:   end

note()

Action review_note updates the review note

[Source]

        # File app/controllers/review_controller.rb, line 50
    50:   def note
    51:     @record.review_note = params[:value]
    52:     @record.save! if @record.reviewer.nil? || @record.reviewer == session['user'] || cadmin?
    53:     # html = "<script language=\"JavaScript\">alert('Only the central administrator (#{User.find_central_admin.name}) or the reviewer can update the review note!')</script>#{html}"
    54:     # It is not possible to display a alert when using in-place edit?
    55:     @record.reload
    56:     @record.review_note = '_______' if @record.review_note.blank?
    57:     render :text => @record.review_note
    58:   end

toggle_done()

Action toggle_done toggles the `done` column.

[Source]

        # File app/controllers/review_controller.rb, line 21
    21:   def toggle_done
    22:     if @record.reviewer.nil? || @record.reviewer == session['user'] || cadmin?
    23:       if @record.done == 'Y'
    24:         @record.update_attributes(:done => 'N')
    25:       else
    26:         @record.update_attributes(:done => 'Y')
    27:       end
    28:       render :inline => "<%= link_to_done_toggle(@record) %>"
    29:     else
    30:       render :inline => "<script language=\"JavaScript\">alert('To change the done flag you need to be the reviewer or the central administrator (#{User.find_central_admin.name})!')</script><%= link_to_done_toggle(@record) %>"
    31:     end
    32:   end

[Validate]