Class: Help::IssuesController

Inherits:
InsightController
  • Object
show all
Defined in:
app/controllers/help/issues_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



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

#editObject



40
41
42
# File 'app/controllers/help/issues_controller.rb', line 40

def edit
  @issue = Issue.find(params[:id])
end

#indexObject



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

#myObject



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

#newObject



25
26
27
# File 'app/controllers/help/issues_controller.rb', line 25

def new
  @issue = Issue.new
end

#showObject



21
22
23
# File 'app/controllers/help/issues_controller.rb', line 21

def show
  @issue = Issue.find(params[:id])
end

#updateObject



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