| ... | @@ -2,7 +2,7 @@ class IssuesController < ApplicationController |
... | @@ -2,7 +2,7 @@ class IssuesController < ApplicationController |
|
|
before_filter :authenticate_user!
|
|
before_filter :authenticate_user!
|
|
|
before_filter :project
|
|
before_filter :project
|
|
|
before_filter :module_enabled
|
|
before_filter :module_enabled
|
|
|
before_filter :issue, :only => [:edit, :update, :destroy, :show]
|
|
before_filter :issue, only: [:edit, :update, :destroy, :show]
|
|
|
helper_method :issues_filter
|
|
helper_method :issues_filter
|
|
|
|
|
|
|
|
layout "project"
|
|
layout "project"
|
| ... | @@ -14,13 +14,13 @@ class IssuesController < ApplicationController |
... | @@ -14,13 +14,13 @@ class IssuesController < ApplicationController |
|
|
before_filter :authorize_read_issue!
|
|
before_filter :authorize_read_issue!
|
|
|
|
|
|
|
|
# Allow write(create) issue
|
|
# Allow write(create) issue
|
|
|
before_filter :authorize_write_issue!, :only => [:new, :create]
|
|
before_filter :authorize_write_issue!, only: [:new, :create]
|
|
|
|
|
|
|
|
# Allow modify issue
|
|
# Allow modify issue
|
|
|
before_filter :authorize_modify_issue!, :only => [:close, :edit, :update]
|
|
before_filter :authorize_modify_issue!, only: [:close, :edit, :update]
|
|
|
|
|
|
|
|
# Allow destroy issue
|
|
# Allow destroy issue
|
|
|
before_filter :authorize_admin_issue!, :only => [:destroy]
|
|
before_filter :authorize_admin_issue!, only: [:destroy]
|
|
|
|
|
|
|
|
respond_to :js, :html
|
|
respond_to :js, :html
|
|
|
|
|
|
| ... | @@ -32,7 +32,7 @@ class IssuesController < ApplicationController |
... | @@ -32,7 +32,7 @@ class IssuesController < ApplicationController |
|
|
respond_to do |format|
|
|
respond_to do |format|
|
|
|
format.html # index.html.erb
|
|
format.html # index.html.erb
|
|
|
format.js
|
|
format.js
|
|
|
format.atom { render :layout => false }
|
|
format.atom { render layout: false }
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
| ... | @@ -46,7 +46,7 @@ class IssuesController < ApplicationController |
... | @@ -46,7 +46,7 @@ class IssuesController < ApplicationController |
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def show
|
|
def show
|
|
|
@note = @project.notes.new(:noteable => @issue)
|
|
@note = @project.notes.new(noteable: @issue)
|
|
|
|
|
|
|
|
respond_to do |format|
|
|
respond_to do |format|
|
|
|
format.html
|
|
format.html
|
| ... | @@ -66,7 +66,7 @@ class IssuesController < ApplicationController |
... | @@ -66,7 +66,7 @@ class IssuesController < ApplicationController |
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def update
|
|
def update
|
|
|
@issue.update_attributes(params[:issue].merge(:author_id_of_changes => current_user.id))
|
|
@issue.update_attributes(params[:issue].merge(author_id_of_changes: current_user.id))
|
|
|
|
|
|
|
|
respond_to do |format|
|
|
respond_to do |format|
|
|
|
format.js
|
|
format.js
|
| ... | @@ -87,20 +87,20 @@ class IssuesController < ApplicationController |
... | @@ -87,20 +87,20 @@ class IssuesController < ApplicationController |
|
|
|
|
|
|
|
respond_to do |format|
|
|
respond_to do |format|
|
|
|
format.html { redirect_to project_issues_path }
|
|
format.html { redirect_to project_issues_path }
|
|
|
format.js { render :nothing => true }
|
|
format.js { render nothing: true }
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def sort
|
|
def sort
|
|
|
return render_404 unless can?(current_user, :admin_issue, @project)
|
|
return render_404 unless can?(current_user, :admin_issue, @project)
|
|
|
|
|
|
|
|
@issues = @project.issues.where(:id => params['issue'])
|
|
@issues = @project.issues.where(id: params['issue'])
|
|
|
@issues.each do |issue|
|
|
@issues.each do |issue|
|
|
|
issue.position = params['issue'].index(issue.id.to_s) + 1
|
|
issue.position = params['issue'].index(issue.id.to_s) + 1
|
|
|
issue.save
|
|
issue.save
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
render :nothing => true
|
|
render nothing: true
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def search
|
|
def search
|
| ... | @@ -110,12 +110,12 @@ class IssuesController < ApplicationController |
... | @@ -110,12 +110,12 @@ class IssuesController < ApplicationController |
|
|
@issues = @issues.where("title LIKE ?", "%#{terms}%") unless terms.blank?
|
|
@issues = @issues.where("title LIKE ?", "%#{terms}%") unless terms.blank?
|
|
|
@issues = @issues.page(params[:page]).per(100)
|
|
@issues = @issues.page(params[:page]).per(100)
|
|
|
|
|
|
|
|
render :partial => 'issues'
|
|
render partial: 'issues'
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def bulk_update
|
|
def bulk_update
|
|
|
result = IssuesBulkUpdateContext.new(project, current_user, params).execute
|
|
result = IssuesBulkUpdateContext.new(project, current_user, params).execute
|
|
|
redirect_to :back, :notice => "#{result[:count]} issues updated"
|
|
redirect_to :back, notice: "#{result[:count]} issues updated"
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
protected
|
|
protected
|
| ... | @@ -144,8 +144,8 @@ class IssuesController < ApplicationController |
... | @@ -144,8 +144,8 @@ class IssuesController < ApplicationController |
|
|
else @project.issues.opened
|
|
else @project.issues.opened
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
@issues = @issues.where(:assignee_id => params[:assignee_id]) if params[:assignee_id].present?
|
|
@issues = @issues.where(assignee_id: params[:assignee_id]) if params[:assignee_id].present?
|
|
|
@issues = @issues.where(:milestone_id => params[:milestone_id]) if params[:milestone_id].present?
|
|
@issues = @issues.where(milestone_id: params[:milestone_id]) if params[:milestone_id].present?
|
|
|
@issues = @issues.tagged_with(params[:label_name]) if params[:label_name].present?
|
|
@issues = @issues.tagged_with(params[:label_name]) if params[:label_name].present?
|
|
|
@issues = @issues.includes(:author, :project).order("updated_at")
|
|
@issues = @issues.includes(:author, :project).order("updated_at")
|
|
|
@issues
|
|
@issues
|
| ... | |
... | |
| ... | | ... | |