##// END OF EJS Templates
Introduce virtual MenuNodes (#15880)....
Introduce virtual MenuNodes (#15880). They are characterized by having a blank url. they will only be rendered if the user is authorized to see at least one of its children. they render as links which do nothing when clicked. Patch by Jan Schulz-Hofen. git-svn-id: http://svn.redmine.org/redmine/trunk@15501 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r14856:cda9c63d9c21
r15119:53710d80fc88
Show More
issue_relations_controller.rb
90 lines | 2.5 KiB | text/x-ruby | RubyLexer
/ app / controllers / issue_relations_controller.rb
Jean-Philippe Lang
Adds REST API for issue relations (#7366)....
r6056 # Redmine - project management software
Jean-Philippe Lang
Updates copyright for 2016....
r14856 # Copyright (C) 2006-2016 Jean-Philippe Lang
Jean-Philippe Lang
Issue relations first commit (not thoroughly tested). 4 kinds of relation are available:...
r503 #
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/issue_relations_controller.rb....
r6769 #
Jean-Philippe Lang
Issue relations first commit (not thoroughly tested). 4 kinds of relation are available:...
r503 # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/issue_relations_controller.rb....
r6769 #
Jean-Philippe Lang
Issue relations first commit (not thoroughly tested). 4 kinds of relation are available:...
r503 # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class IssueRelationsController < ApplicationController
Jean-Philippe Lang
Use :only instead of :except option in IssueRelationsController filters....
r13324 before_filter :find_issue, :authorize, :only => [:index, :create]
before_filter :find_relation, :only => [:show, :destroy]
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/issue_relations_controller.rb....
r6769
Jean-Philippe Lang
Separation of RSS/API auth actions....
r6077 accept_api_auth :index, :show, :create, :destroy
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/issue_relations_controller.rb....
r6769
Jean-Philippe Lang
Adds support for GET on /issues/:issue_id/relations (#7366)....
r6059 def index
@relations = @issue.relations
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/issue_relations_controller.rb....
r6769
Jean-Philippe Lang
Adds support for GET on /issues/:issue_id/relations (#7366)....
r6059 respond_to do |format|
format.html { render :nothing => true }
format.api
end
end
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/issue_relations_controller.rb....
r6769
Jean-Philippe Lang
Adds REST API for issue relations (#7366)....
r6056 def show
Jean-Philippe Lang
Makes relations resource shallow (#7366)....
r6064 raise Unauthorized unless @relation.visible?
Jean-Philippe Lang
Adds REST API for issue relations (#7366)....
r6056
respond_to do |format|
format.html { render :nothing => true }
format.api
end
end
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/issue_relations_controller.rb....
r6769
Jean-Philippe Lang
Adds REST API for issue relations (#7366)....
r6056 def create
Jean-Philippe Lang
Warning "Can't mass-assign protected attributes for IssueRelation: issue_to_id" (#21695)....
r14681 @relation = IssueRelation.new
Jean-Philippe Lang
Issue relations first commit (not thoroughly tested). 4 kinds of relation are available:...
r503 @relation.issue_from = @issue
Jean-Philippe Lang
Warning "Can't mass-assign protected attributes for IssueRelation: issue_to_id" (#21695)....
r14681 @relation.safe_attributes = params[:relation]
Jean-Philippe Lang
Fixed that IssueRelation should not be responsible for calling Issue#init_journal (#18237)....
r13152 @relation.init_journals(User.current)
Jean-Philippe Lang
Adds REST API for issue relations (#7366)....
r6056 saved = @relation.save
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/issue_relations_controller.rb....
r6769
Jean-Philippe Lang
Issue relations first commit (not thoroughly tested). 4 kinds of relation are available:...
r503 respond_to do |format|
Jean-Philippe Lang
Use named routes in controllers....
r10752 format.html { redirect_to issue_path(@issue) }
Jean-Philippe Lang
Removes RJS from IssueRelationsController....
r9862 format.js {
Jean-Philippe Lang
Fixed that relations may not be refreshed when adding a follows relation (#13251)....
r11231 @relations = @issue.reload.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? }
Jean-Philippe Lang
Removes RJS from IssueRelationsController....
r9862 }
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/issue_relations_controller.rb....
r6769 format.api {
Jean-Philippe Lang
Adds REST API for issue relations (#7366)....
r6056 if saved
Jean-Philippe Lang
Makes relations resource shallow (#7366)....
r6064 render :action => 'show', :status => :created, :location => relation_url(@relation)
Jean-Philippe Lang
Adds REST API for issue relations (#7366)....
r6056 else
render_validation_errors(@relation)
end
}
Jean-Philippe Lang
Issue relations first commit (not thoroughly tested). 4 kinds of relation are available:...
r503 end
end
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/issue_relations_controller.rb....
r6769
Jean-Philippe Lang
Issue relations first commit (not thoroughly tested). 4 kinds of relation are available:...
r503 def destroy
Jean-Philippe Lang
Makes relations resource shallow (#7366)....
r6064 raise Unauthorized unless @relation.deletable?
Jean-Philippe Lang
Fixed that IssueRelation should not be responsible for calling Issue#init_journal (#18237)....
r13152 @relation.init_journals(User.current)
Jean-Philippe Lang
Makes relations resource shallow (#7366)....
r6064 @relation.destroy
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/issue_relations_controller.rb....
r6769
Jean-Philippe Lang
Issue relations first commit (not thoroughly tested). 4 kinds of relation are available:...
r503 respond_to do |format|
Jean-Philippe Lang
Use named routes in controllers....
r10752 format.html { redirect_to issue_path(@relation.issue_from) }
Jean-Philippe Lang
Removes RJS from IssueRelationsController....
r9862 format.js
Jean-Philippe Lang
Fixed that 200 API responses have a body containing one space (#11388)....
r9792 format.api { render_api_ok }
Jean-Philippe Lang
Issue relations first commit (not thoroughly tested). 4 kinds of relation are available:...
r503 end
end
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/issue_relations_controller.rb....
r6769
Jean-Philippe Lang
Use :only instead of :except option in IssueRelationsController filters....
r13324 private
Eric Davis
Refactor: Split the find_object methods to prep for a larger refactoring....
r3477 def find_issue
Jean-Philippe Lang
Use :only instead of :except option in IssueRelationsController filters....
r13324 @issue = Issue.find(params[:issue_id])
@project = @issue.project
Jean-Philippe Lang
Issue relations first commit (not thoroughly tested). 4 kinds of relation are available:...
r503 rescue ActiveRecord::RecordNotFound
render_404
end
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/issue_relations_controller.rb....
r6769
Jean-Philippe Lang
Makes relations resource shallow (#7366)....
r6064 def find_relation
@relation = IssueRelation.find(params[:id])
rescue ActiveRecord::RecordNotFound
render_404
end
Jean-Philippe Lang
Issue relations first commit (not thoroughly tested). 4 kinds of relation are available:...
r503 end