Class: Help::IssuesController
- Inherits:
-
InsightController
- Object
- InsightController
- Help::IssuesController
- Defined in:
- app/controllers/help/issues_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #my ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/help/issues_controller.rb', line 29 def create @issue = Issue.new(params[:issue]) @issue.contact_id = current_user.crm_id if logged_in? && !current_user.crm_id.nil? if verify_recaptcha(:model => @issue, :private_key => Insight.configuration.recaptcha_private_key) && @issue.save redirect_to(help_issue_path(@issue)) else render :action => "new" end end |
#edit ⇒ Object
40 41 42 |
# File 'app/controllers/help/issues_controller.rb', line 40 def edit @issue = Issue.find(params[:id]) end |
#index ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'app/controllers/help/issues_controller.rb', line 12 def index if params[:category_id] @category = Category.find(params[:category_id]) @issues = @category.issues else @issues = Issue.find(:all) end end |
#my ⇒ Object
7 8 9 10 |
# File 'app/controllers/help/issues_controller.rb', line 7 def my @issues = Issue.get(:my, :crm_id => current_user.crm_id) render :action => "index" end |
#new ⇒ Object
25 26 27 |
# File 'app/controllers/help/issues_controller.rb', line 25 def new @issue = Issue.new end |
#show ⇒ Object
21 22 23 |
# File 'app/controllers/help/issues_controller.rb', line 21 def show @issue = Issue.find(params[:id]) end |
#update ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'app/controllers/help/issues_controller.rb', line 44 def update @issue = Issue.find(params[:id]) if verify_recaptcha(:model => @issue, :private_key => Insight.configuration.recaptcha_private_key) && @issue.update_attributes(params[:issue].merge(:contact_id => current_user.crm_id)) redirect_to(help_issues_path) else render :action => "edit" end end |