mirror of
https://github.com/redmine/redmine.git
synced 2025-11-02 11:25:55 +01:00
Makes custom queries available through the REST API (#5737).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6186 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# redMine - project management software
|
||||
# Copyright (C) 2006-2007 Jean-Philippe Lang
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -17,9 +17,29 @@
|
||||
|
||||
class QueriesController < ApplicationController
|
||||
menu_item :issues
|
||||
before_filter :find_query, :except => :new
|
||||
before_filter :find_query, :except => [:new, :index]
|
||||
before_filter :find_optional_project, :only => :new
|
||||
|
||||
accept_key_auth :index
|
||||
|
||||
def index
|
||||
case params[:format]
|
||||
when 'xml', 'json'
|
||||
@offset, @limit = api_offset_and_limit
|
||||
else
|
||||
@limit = per_page_option
|
||||
end
|
||||
|
||||
@query_count = Query.visible.count
|
||||
@query_pages = Paginator.new self, @query_count, @limit, params['page']
|
||||
@queries = Query.visible.all(:limit => @limit, :offset => @offset, :order => "#{Query.table_name}.name")
|
||||
|
||||
respond_to do |format|
|
||||
format.html { render :nothing => true }
|
||||
format.api
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
@query = Query.new(params[:query])
|
||||
@query.project = params[:query_is_for_all] ? nil : @project
|
||||
|
||||
Reference in New Issue
Block a user