class IssuesController

Public Instance Methods

bulk_update() click to toggle source
# File app/controllers/issues_controller.rb, line 111
def bulk_update
  result = IssuesBulkUpdateContext.new(project, current_user, params).execute
  redirect_to :back, notice: "#{result[:count]} issues updated"
end
create() click to toggle source
# File app/controllers/issues_controller.rb, line 48
def create
  @issue = @project.issues.new(params[:issue])
  @issue.author = current_user
  @issue.save

  respond_to do |format|
    format.html do
      if @issue.valid?
        redirect_to project_issue_path(@project, @issue)
      else
        render :new
      end
    end
    format.js
  end
end
destroy() click to toggle source
# File app/controllers/issues_controller.rb, line 80
def destroy
  @issue.destroy

  respond_to do |format|
    format.html { redirect_to project_issues_path }
    format.js { render nothing: true }
  end
end
edit() click to toggle source
# File app/controllers/issues_controller.rb, line 35
def edit
  respond_with(@issue)
end
index() click to toggle source
# File app/controllers/issues_controller.rb, line 19
def index
  @issues = issues_filtered
  @issues = @issues.page(params[:page]).per(20)

  respond_to do |format|
    format.html # index.html.erb
    format.js
    format.atom { render layout: false }
  end
end
new() click to toggle source
# File app/controllers/issues_controller.rb, line 30
def new
  @issue = @project.issues.new(params[:issue])
  respond_with(@issue)
end
show() click to toggle source
# File app/controllers/issues_controller.rb, line 39
def show
  @note = @project.notes.new(noteable: @issue)

  respond_to do |format|
    format.html
    format.js
  end
end
sort() click to toggle source
# File app/controllers/issues_controller.rb, line 89
def sort
  return render_404 unless can?(current_user, :admin_issue, @project)

  @issues = @project.issues.where(id: params['issue'])
  @issues.each do |issue|
    issue.position = params['issue'].index(issue.id.to_s) + 1
    issue.save
  end

  render nothing: true
end
update() click to toggle source
# File app/controllers/issues_controller.rb, line 65
def update
  @issue.update_attributes(params[:issue].merge(author_id_of_changes: current_user.id))

  respond_to do |format|
    format.js
    format.html do
      if @issue.valid?
        redirect_to [@project, @issue]
      else
        render :edit
      end
    end
  end
end

Protected Instance Methods

authorize_admin_issue!() click to toggle source
# File app/controllers/issues_controller.rb, line 126
def authorize_admin_issue!
  return render_404 unless can?(current_user, :admin_issue, @issue)
end
authorize_modify_issue!() click to toggle source
# File app/controllers/issues_controller.rb, line 122
def authorize_modify_issue!
  return render_404 unless can?(current_user, :modify_issue, @issue)
end
issue() click to toggle source
# File app/controllers/issues_controller.rb, line 118
def issue
  @issue ||= @project.issues.find(params[:id])
end
issues_filtered() click to toggle source
# File app/controllers/issues_controller.rb, line 134
def issues_filtered
  @issues = IssuesListContext.new(project, current_user, params).execute
end
module_enabled() click to toggle source
# File app/controllers/issues_controller.rb, line 130
def module_enabled
  return render_404 unless @project.issues_enabled
end