queries wip
git-svn-id: http://redmine.rubyforge.org/svn/branches/work@86 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
1 parent
638ce18d4a
commit
ded14f7c38
20 files changed
+250
-168
No files matched your search
@@ -208,15 +208,27 @@ class ProjectsController < ApplicationController
|
|||||||
sort_init 'issues.id', 'desc'
|
sort_init 'issues.id', 'desc'
|
||||||
sort_update
|
sort_update
|
||||||
|
|
||||||
session[:query] = nil if params[:set_filter]
|
if params[:query_id]
|
||||||
@query = session[:query] || Query.new
|
@query = @project.queries.find(params[:query_id])
|
||||||
if params[:fields] and params[:fields].is_a? Array
|
else
|
||||||
@query.filters = {}
|
if params[:set_filter] or !session[:query] or session[:query].project_id != @project.id
|
||||||
params[:fields].each do |field|
|
# Give it a name, required to be valid
|
||||||
@query.add_filter(field, params[:operators][field], params[:values][field])
|
@query = Query.new(:name => "_")
|
||||||
|
@query.project = @project
|
||||||
|
if params[:fields] and params[:fields].is_a? Array
|
||||||
|
params[:fields].each do |field|
|
||||||
|
@query.add_filter(field, params[:operators][field], params[:values][field])
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@query.available_filters.keys.each do |field|
|
||||||
|
@query.add_short_filter(field, params[field]) if params[field]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
session[:query] = @query
|
||||||
|
else
|
||||||
|
@query = session[:query]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
session[:query] = @query
|
|
||||||
|
|
||||||
@results_per_page_options = [ 15, 25, 50, 100 ]
|
@results_per_page_options = [ 15, 25, 50, 100 ]
|
||||||
if params[:per_page] and @results_per_page_options.include? params[:per_page].to_i
|
if params[:per_page] and @results_per_page_options.include? params[:per_page].to_i
|
||||||
@@ -226,14 +238,15 @@ class ProjectsController < ApplicationController
|
|||||||
@results_per_page = session[:results_per_page] || 25
|
@results_per_page = session[:results_per_page] || 25
|
||||||
end
|
end
|
||||||
|
|
||||||
@issue_count = Issue.count(:include => [:status, :project], :conditions => @query.statement)
|
if @query.valid?
|
||||||
@issue_pages = Paginator.new self, @issue_count, @results_per_page, @params['page']
|
@issue_count = Issue.count(:include => [:status, :project], :conditions => @query.statement)
|
||||||
@issues = Issue.find :all, :order => sort_clause,
|
@issue_pages = Paginator.new self, @issue_count, @results_per_page, @params['page']
|
||||||
:include => [ :author, :status, :tracker, :project ],
|
@issues = Issue.find :all, :order => sort_clause,
|
||||||
:conditions => @query.statement,
|
:include => [ :author, :status, :tracker, :project ],
|
||||||
:limit => @issue_pages.items_per_page,
|
:conditions => @query.statement,
|
||||||
:offset => @issue_pages.current.offset
|
:limit => @issue_pages.items_per_page,
|
||||||
|
:offset => @issue_pages.current.offset
|
||||||
|
end
|
||||||
render :layout => false if request.xhr?
|
render :layout => false if request.xhr?
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -309,6 +322,22 @@ class ProjectsController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def add_query
|
||||||
|
@query = Query.new(params[:query])
|
||||||
|
@query.project = @project
|
||||||
|
@query.user = logged_in_user
|
||||||
|
|
||||||
|
params[:fields].each do |field|
|
||||||
|
@query.add_filter(field, params[:operators][field], params[:values][field])
|
||||||
|
end if params[:fields]
|
||||||
|
|
||||||
|
if request.post? and @query.save
|
||||||
|
flash[:notice] = l(:notice_successful_create)
|
||||||
|
redirect_to :controller => 'reports', :action => 'issue_report', :id => @project
|
||||||
|
end
|
||||||
|
render :layout => false if request.xhr?
|
||||||
|
end
|
||||||
|
|
||||||
# Add a news to @project
|
# Add a news to @project
|
||||||
def add_news
|
def add_news
|
||||||
@news = News.new(:project => @project)
|
@news = News.new(:project => @project)
|
||||||
|
|||||||
@@ -1,55 +1,47 @@
|
|||||||
|
# redMine - project management software
|
||||||
|
# Copyright (C) 2006 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
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# 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 QueriesController < ApplicationController
|
class QueriesController < ApplicationController
|
||||||
layout 'base'
|
layout 'base'
|
||||||
|
before_filter :require_login, :find_query
|
||||||
def index
|
|
||||||
list
|
|
||||||
render :action => 'list'
|
|
||||||
end
|
|
||||||
|
|
||||||
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
|
|
||||||
verify :method => :post, :only => [ :destroy, :create, :update ],
|
|
||||||
:redirect_to => { :action => :list }
|
|
||||||
|
|
||||||
def list
|
|
||||||
@query_pages, @queries = paginate :queries, :per_page => 10
|
|
||||||
end
|
|
||||||
|
|
||||||
def show
|
|
||||||
@query = Query.find(params[:id])
|
|
||||||
end
|
|
||||||
|
|
||||||
def new
|
|
||||||
@query = Query.new(params[:query])
|
|
||||||
|
|
||||||
params[:fields].each do |field|
|
|
||||||
@query.add_filter(field, params[:operators][field], params[:values][field])
|
|
||||||
end if params[:fields]
|
|
||||||
|
|
||||||
if request.post? and @query.save
|
|
||||||
flash[:notice] = 'Query was successfully created.'
|
|
||||||
redirect_to :action => 'list'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@query = Query.find(params[:id])
|
|
||||||
|
|
||||||
if request.post?
|
if request.post?
|
||||||
@query.filters = {}
|
@query.filters = {}
|
||||||
params[:fields].each do |field|
|
params[:fields].each do |field|
|
||||||
@query.add_filter(field, params[:operators][field], params[:values][field])
|
@query.add_filter(field, params[:operators][field], params[:values][field])
|
||||||
end if params[:fields]
|
end if params[:fields]
|
||||||
@query.attributes = params[:query]
|
@query.attributes = params[:query]
|
||||||
|
|
||||||
if @query.save
|
if @query.save
|
||||||
flash[:notice] = 'Query was successfully updated.'
|
flash[:notice] = l(:notice_successful_update)
|
||||||
redirect_to :action => 'show', :id => @query
|
redirect_to :controller => 'projects', :action => 'list_issues', :id => @project, :query_id => @query
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
Query.find(params[:id]).destroy
|
@query.destroy if request.post?
|
||||||
redirect_to :action => 'list'
|
redirect_to :controller => 'reports', :action => 'issue_report', :id => @project
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def find_query
|
||||||
|
@query = Query.find(params[:id])
|
||||||
|
@project = @query.project
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -48,6 +48,7 @@ class ReportsController < ApplicationController
|
|||||||
@report_title = l(:field_author)
|
@report_title = l(:field_author)
|
||||||
render :template => "reports/issue_report_details"
|
render :template => "reports/issue_report_details"
|
||||||
else
|
else
|
||||||
|
@queries = @project.queries.find :all, :conditions => ["is_public=? or user_id=?", true, (logged_in_user ? logged_in_user.id : 0)]
|
||||||
@trackers = Tracker.find(:all)
|
@trackers = Tracker.find(:all)
|
||||||
@priorities = Enumeration::get_values('IPRI')
|
@priorities = Enumeration::get_values('IPRI')
|
||||||
@categories = @project.issue_categories
|
@categories = @project.issue_categories
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ class Project < ActiveRecord::Base
|
|||||||
has_many :users, :through => :members
|
has_many :users, :through => :members
|
||||||
has_many :custom_values, :dependent => true, :as => :customized
|
has_many :custom_values, :dependent => true, :as => :customized
|
||||||
has_many :issues, :dependent => true, :order => "issues.created_on DESC", :include => :status
|
has_many :issues, :dependent => true, :order => "issues.created_on DESC", :include => :status
|
||||||
|
has_many :queries, :dependent => true
|
||||||
has_many :documents, :dependent => true
|
has_many :documents, :dependent => true
|
||||||
has_many :news, :dependent => true, :include => :author
|
has_many :news, :dependent => true, :include => :author
|
||||||
has_many :issue_categories, :dependent => true, :order => "issue_categories.name"
|
has_many :issue_categories, :dependent => true, :order => "issue_categories.name"
|
||||||
|
|||||||
@@ -1,6 +1,27 @@
|
|||||||
|
# redMine - project management software
|
||||||
|
# Copyright (C) 2006 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
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# 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 Query < ActiveRecord::Base
|
class Query < ActiveRecord::Base
|
||||||
|
belongs_to :project
|
||||||
|
belongs_to :user
|
||||||
serialize :filters
|
serialize :filters
|
||||||
|
|
||||||
|
attr_protected :project, :user
|
||||||
|
|
||||||
validates_presence_of :name, :on => :save
|
validates_presence_of :name, :on => :save
|
||||||
|
|
||||||
@@operators = { "=" => "Egal",
|
@@operators = { "=" => "Egal",
|
||||||
@@ -15,58 +36,75 @@ class Query < ActiveRecord::Base
|
|||||||
"t" => "Aujourd'hui",
|
"t" => "Aujourd'hui",
|
||||||
">t-" => "Il y a moins de",
|
">t-" => "Il y a moins de",
|
||||||
"<t-" => "Il y a plus de",
|
"<t-" => "Il y a plus de",
|
||||||
"t-" => "Il y a exactement" }
|
"t-" => "Il y a exactement",
|
||||||
|
"~" => "Contient",
|
||||||
|
"!~" => "Ne contient pas" }
|
||||||
|
|
||||||
@@operators_by_filter_type = { :list => [ "=", "!" ],
|
@@operators_by_filter_type = { :list => [ "=", "!" ],
|
||||||
:list_status => [ "o", "=", "!", "c" ],
|
:list_status => [ "o", "=", "!", "c", "*" ],
|
||||||
:list_optional => [ "=", "!", "!*", "*" ],
|
:list_optional => [ "=", "!", "!*", "*" ],
|
||||||
:date => [ "<t+", ">t+", "t+", "t", ">t-", "<t-", "t-" ],
|
:date => [ "<t+", ">t+", "t+", "t", ">t-", "<t-", "t-" ],
|
||||||
:date_past => [ ">t-", "<t-", "t-", "t" ] }
|
:date_past => [ ">t-", "<t-", "t-", "t" ],
|
||||||
|
:text => [ "~", "!~" ] }
|
||||||
|
|
||||||
@@available_filters = { "status_id" => { :type => :list_status, :order => 1,
|
|
||||||
:values => IssueStatus.find(:all).collect{|s| [s.name, s.id.to_s] } },
|
|
||||||
"tracker_id" => { :type => :list, :order => 2,
|
|
||||||
:values => Tracker.find(:all).collect{|s| [s.name, s.id.to_s] } },
|
|
||||||
"assigned_to_id" => { :type => :list_optional, :order => 3,
|
|
||||||
:values => User.find(:all).collect{|s| [s.display_name, s.id.to_s] } },
|
|
||||||
"priority_id" => { :type => :list, :order => 4,
|
|
||||||
:values => Enumeration.find(:all, :conditions => ['opt=?','IPRI']).collect{|s| [s.name, s.id.to_s] } },
|
|
||||||
"created_on" => { :type => :date_past, :order => 5 },
|
|
||||||
"updated_on" => { :type => :date_past, :order => 6 },
|
|
||||||
"start_date" => { :type => :date, :order => 7 },
|
|
||||||
"due_date" => { :type => :date, :order => 8 } }
|
|
||||||
|
|
||||||
cattr_accessor :available_filters
|
|
||||||
|
|
||||||
def initialize(attributes = nil)
|
def initialize(attributes = nil)
|
||||||
super
|
super attributes
|
||||||
self.filters ||= { 'status_id' => {:operator => "o"} }
|
self.filters ||= { 'status_id' => {:operator => "o", :values => [""]} }
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate
|
def validate
|
||||||
errors.add_to_base "Au moins un critere doit etre selectionne" unless filters && !filters.empty?
|
errors.add_to_base "Au moins un critere doit etre selectionne" unless filters && !filters.empty?
|
||||||
filters.each_key do |field|
|
filters.each_key do |field|
|
||||||
errors.add field.gsub(/\_id$/, ""), "doit etre renseigne" unless
|
errors.add field.gsub(/\_id$/, ""), :activerecord_error_blank unless
|
||||||
# filter requires one or more values
|
# filter requires one or more values
|
||||||
(values_for(field) and !values_for(field).first.empty?) or
|
(values_for(field) and !values_for(field).first.empty?) or
|
||||||
# filter doesn't require any value
|
# filter doesn't require any value
|
||||||
["o", "c", "!*", "*", "t"].include? operator_for(field)
|
["o", "c", "!*", "*", "t"].include? operator_for(field)
|
||||||
end if filters
|
end if filters
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def available_filters
|
||||||
|
return @available_filters if @available_filters
|
||||||
|
@available_filters = { "status_id" => { :type => :list_status, :order => 1, :values => IssueStatus.find(:all).collect{|s| [s.name, s.id.to_s] } },
|
||||||
|
"tracker_id" => { :type => :list, :order => 2, :values => Tracker.find(:all).collect{|s| [s.name, s.id.to_s] } },
|
||||||
|
"priority_id" => { :type => :list, :order => 3, :values => Enumeration.find(:all, :conditions => ['opt=?','IPRI']).collect{|s| [s.name, s.id.to_s] } },
|
||||||
|
"subject" => { :type => :text, :order => 7 },
|
||||||
|
"created_on" => { :type => :date_past, :order => 8 },
|
||||||
|
"updated_on" => { :type => :date_past, :order => 9 },
|
||||||
|
"start_date" => { :type => :date, :order => 10 },
|
||||||
|
"due_date" => { :type => :date, :order => 11 } }
|
||||||
|
unless project.nil?
|
||||||
|
# project specific filters
|
||||||
|
@available_filters["assigned_to_id"] = { :type => :list_optional, :order => 4, :values => @project.users.collect{|s| [s.name, s.id.to_s] } }
|
||||||
|
@available_filters["author_id"] = { :type => :list, :order => 5, :values => @project.users.collect{|s| [s.name, s.id.to_s] } }
|
||||||
|
@available_filters["category_id"] = { :type => :list_optional, :order => 6, :values => @project.issue_categories.collect{|s| [s.name, s.id.to_s] } }
|
||||||
|
# remove category filter if no category defined
|
||||||
|
@available_filters.delete "category_id" if @available_filters["category_id"][:values].empty?
|
||||||
|
end
|
||||||
|
@available_filters
|
||||||
|
end
|
||||||
|
|
||||||
def add_filter(field, operator, values)
|
def add_filter(field, operator, values)
|
||||||
# values must be an array
|
# values must be an array
|
||||||
return unless values and values.is_a? Array # and !values.first.empty?
|
return unless values and values.is_a? Array # and !values.first.empty?
|
||||||
# check if field is defined as an available filter
|
# check if field is defined as an available filter
|
||||||
if @@available_filters.has_key? field
|
if available_filters.has_key? field
|
||||||
filter_options = @@available_filters[field]
|
filter_options = available_filters[field]
|
||||||
# check if operator is allowed for that filter
|
# check if operator is allowed for that filter
|
||||||
if @@operators_by_filter_type[filter_options[:type]].include? operator
|
#if @@operators_by_filter_type[filter_options[:type]].include? operator
|
||||||
filters[field] = {:operator => operator, :values => values }
|
# allowed_values = values & ([""] + (filter_options[:values] || []).collect {|val| val[1]})
|
||||||
end
|
# filters[field] = {:operator => operator, :values => allowed_values } if (allowed_values.first and !allowed_values.first.empty?) or ["o", "c", "!*", "*", "t"].include? operator
|
||||||
|
#end
|
||||||
|
filters[field] = {:operator => operator, :values => values }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def add_short_filter(field, expression)
|
||||||
|
return unless expression
|
||||||
|
parms = expression.scan(/^(o|c|\!|\*)?(.*)$/).first
|
||||||
|
add_filter field, (parms[0] || "="), [parms[1] || ""]
|
||||||
|
end
|
||||||
|
|
||||||
def has_filter?(field)
|
def has_filter?(field)
|
||||||
filters and filters[field]
|
filters and filters[field]
|
||||||
end
|
end
|
||||||
@@ -82,8 +120,9 @@ class Query < ActiveRecord::Base
|
|||||||
def statement
|
def statement
|
||||||
sql = "1=1"
|
sql = "1=1"
|
||||||
filters.each_key do |field|
|
filters.each_key do |field|
|
||||||
|
v = values_for field
|
||||||
|
next unless v and !v.empty?
|
||||||
sql = sql + " AND " unless sql.empty?
|
sql = sql + " AND " unless sql.empty?
|
||||||
v = values_for field
|
|
||||||
case operator_for field
|
case operator_for field
|
||||||
when "="
|
when "="
|
||||||
sql = sql + "issues.#{field} IN (" + v.each(&:to_i).join(",") + ")"
|
sql = sql + "issues.#{field} IN (" + v.each(&:to_i).join(",") + ")"
|
||||||
@@ -111,6 +150,10 @@ class Query < ActiveRecord::Base
|
|||||||
sql = sql + "issues.#{field} = '" + (Date.today + v.first.to_i).strftime("%Y-%m-%d") + "'"
|
sql = sql + "issues.#{field} = '" + (Date.today + v.first.to_i).strftime("%Y-%m-%d") + "'"
|
||||||
when "t"
|
when "t"
|
||||||
sql = sql + "issues.#{field} = '%s'" % connection.quoted_date(Date.today)
|
sql = sql + "issues.#{field} = '%s'" % connection.quoted_date(Date.today)
|
||||||
|
when "~"
|
||||||
|
sql = sql + "issues.#{field} LIKE '%#{connection.quote_string(v.first)}%'"
|
||||||
|
when "!~"
|
||||||
|
sql = sql + "issues.#{field} NOT LIKE '%#{connection.quote_string(v.first)}%'"
|
||||||
end
|
end
|
||||||
end if filters
|
end if filters
|
||||||
sql
|
sql
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<h2><%= l(:label_query_new) %></h2>
|
||||||
|
|
||||||
|
<%= start_form_tag :action => 'add_query', :id => @project %>
|
||||||
|
<%= render :partial => 'queries/form', :locals => {:query => @query} %>
|
||||||
|
<%= submit_tag l(:button_create) %>
|
||||||
|
<%= end_form_tag %>
|
||||||
@@ -1,25 +1,46 @@
|
|||||||
<h2><%=l(:label_issue_plural)%></h2>
|
<% if @query.new_record? %>
|
||||||
<div class="topright">
|
<div style="float:right;">
|
||||||
<small>
|
<small>
|
||||||
<%= l(:label_export_to) %>
|
<%= l(:label_export_to) %>
|
||||||
<%= link_to 'CSV', :action => 'export_issues_csv', :id => @project %>,
|
<%= link_to 'CSV', :action => 'export_issues_csv', :id => @project %>,
|
||||||
<%= link_to 'PDF', :action => 'export_issues_pdf', :id => @project %>
|
<%= link_to 'PDF', :action => 'export_issues_pdf', :id => @project %>
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
|
<h2><%=l(:label_issue_plural)%></h2>
|
||||||
<%= start_form_tag :action => 'list_issues' %>
|
|
||||||
<%= render :partial => 'queries/filters', :locals => {:query => @query} %>
|
<%= start_form_tag({:action => 'list_issues'}, :id => 'query_form') %>
|
||||||
<table width="100%">
|
<%= render :partial => 'queries/filters', :locals => {:query => @query} %>
|
||||||
<tr>
|
<%= end_form_tag %>
|
||||||
<td align="right">
|
<table width="100%">
|
||||||
<%= submit_tag l(:button_apply), :class => "button-small" %>
|
<tr>
|
||||||
<%= end_form_tag %>
|
<td align="right"><small>
|
||||||
<%= start_form_tag :action => 'list_issues', :set_filter => 1 %>
|
<%= link_to_remote l(:button_apply),
|
||||||
<%= submit_tag l(:button_clear), :class => "button-small" %>
|
:url => { :controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1 },
|
||||||
<%= end_form_tag %>
|
:update => "content",
|
||||||
</td>
|
:with => "Form.serialize('query_form')" %>
|
||||||
</tr>
|
|
|
||||||
</table>
|
<%= link_to l(:button_clear), :controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1 %>
|
||||||
|
<% if loggedin? %>
|
||||||
|
|
|
||||||
|
<%= link_to_remote l(:button_save),
|
||||||
|
:url => { :controller => 'projects', :action => "add_query", :id => @project },
|
||||||
|
:method => 'get',
|
||||||
|
:update => "content",
|
||||||
|
:with => "Form.serialize('query_form')" %>
|
||||||
|
<% end %>
|
||||||
|
</small></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<% else %>
|
||||||
|
<div style="float:right;">
|
||||||
|
<%= link_to l(:button_edit), :controller => 'queries', :action => 'edit', :id => @query %>
|
||||||
|
<%= link_to l(:button_delete), {:controller => 'queries', :action => 'destroy', :id => @query}, :confirm => l(:text_are_you_sure), :post => true %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h2><%= @query.name %></h2>
|
||||||
|
<% end %>
|
||||||
|
<%= error_messages_for 'query' %>
|
||||||
|
<% if @query.valid? %>
|
||||||
|
|
||||||
|
|
||||||
<table class="listTableContent">
|
<table class="listTableContent">
|
||||||
@@ -65,4 +86,5 @@
|
|||||||
[ <%= @issue_pages.current.first_item %> - <%= @issue_pages.current.last_item %> / <%= @issue_count %> ]
|
[ <%= @issue_pages.current.first_item %> - <%= @issue_pages.current.last_item %> / <%= @issue_count %> ]
|
||||||
</p>
|
</p>
|
||||||
<%= submit_tag l(:button_move) %>
|
<%= submit_tag l(:button_move) %>
|
||||||
<%= end_form_tag %>
|
<%= end_form_tag %>
|
||||||
|
<% end %>
|
||||||
@@ -55,12 +55,12 @@ function toggle_multi_select(field) {
|
|||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<fieldset style="margin:0;"><legend>Filtres</legend>
|
<fieldset style="margin:0;"><legend><%= l(:label_filter_plural) %></legend>
|
||||||
<table width="100%" cellpadding=0 cellspacing=0>
|
<table width="100%" cellpadding=0 cellspacing=0>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<table>
|
<table>
|
||||||
<% Query.available_filters.sort{|a,b| a[1][:order]<=>b[1][:order]}.each do |filter| %>
|
<% query.available_filters.sort{|a,b| a[1][:order]<=>b[1][:order]}.each do |filter| %>
|
||||||
<% field = filter[0]
|
<% field = filter[0]
|
||||||
options = filter[1] %>
|
options = filter[1] %>
|
||||||
<tr <%= 'style="display:none;"' unless query.has_filter?(field) %> id="tr_<%= field %>">
|
<tr <%= 'style="display:none;"' unless query.has_filter?(field) %> id="tr_<%= field %>">
|
||||||
@@ -81,6 +81,8 @@ function toggle_multi_select(field) {
|
|||||||
<%= link_to_function image_tag('expand'), "toggle_multi_select('#{field}');" %>
|
<%= link_to_function image_tag('expand'), "toggle_multi_select('#{field}');" %>
|
||||||
<% when :date, :date_past %>
|
<% when :date, :date_past %>
|
||||||
<%= text_field_tag "values[#{field}][]", query.values_for(field), :size => 3, :class => "select-small" %> jours
|
<%= text_field_tag "values[#{field}][]", query.values_for(field), :size => 3, :class => "select-small" %> jours
|
||||||
|
<% when :text %>
|
||||||
|
<%= text_field_tag "values[#{field}][]", query.values_for(field), :size => 30, :class => "select-small" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -90,8 +92,8 @@ function toggle_multi_select(field) {
|
|||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
<td align="right" valign="top">
|
<td align="right" valign="top">
|
||||||
Add filter:
|
<%= l(:label_filter_add) %>:
|
||||||
<%= select_tag 'add_filter_select', options_for_select([["",""]] + Query.available_filters.sort{|a,b| a[1][:order]<=>b[1][:order]}.collect{|field| [l(("field_"+field[0].to_s.gsub(/\_id$/, "")).to_sym), field[0]] unless query.has_filter?(field[0])}.compact), :onchange => "add_filter();", :class => "select-small" %>
|
<%= select_tag 'add_filter_select', options_for_select([["",""]] + query.available_filters.sort{|a,b| a[1][:order]<=>b[1][:order]}.collect{|field| [l(("field_"+field[0].to_s.gsub(/\_id$/, "")).to_sym), field[0]] unless query.has_filter?(field[0])}.compact), :onchange => "add_filter();", :class => "select-small" %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<%= check_box 'query', 'is_public' %></p>
|
<%= check_box 'query', 'is_public' %></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= render :partial => 'filters', :locals => {:query => query}%>
|
<%= render :partial => 'queries/filters', :locals => {:query => query}%>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!--[eoform:query]-->
|
<!--[eoform:query]-->
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
<h1>Editing query</h1>
|
<h2><%= l(:label_query) %></h2>
|
||||||
|
|
||||||
<%= start_form_tag :action => 'edit', :id => @query %>
|
<%= start_form_tag :action => 'edit', :id => @query %>
|
||||||
<%= render :partial => 'form', :locals => {:query => @query} %>
|
<%= render :partial => 'form', :locals => {:query => @query} %>
|
||||||
<%= submit_tag 'Edit' %>
|
<%= submit_tag l(:button_save) %>
|
||||||
<%= end_form_tag %>
|
<%= end_form_tag %>
|
||||||
|
|
||||||
<%= debug @query.statement %>
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
<h1>Listing queries</h1>
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<% for column in Query.content_columns %>
|
|
||||||
<th><%= column.human_name %></th>
|
|
||||||
<% end %>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<% for query in @queries %>
|
|
||||||
<tr>
|
|
||||||
<% for column in Query.content_columns %>
|
|
||||||
<td><%=h query.send(column.name) %></td>
|
|
||||||
<% end %>
|
|
||||||
<td><%= link_to 'Show', :action => 'show', :id => query %></td>
|
|
||||||
<td><%= link_to 'Edit', :action => 'edit', :id => query %></td>
|
|
||||||
<td><%= link_to 'Destroy', { :action => 'destroy', :id => query }, :confirm => 'Are you sure?', :post => true %></td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<%= link_to 'Previous page', { :page => @query_pages.current.previous } if @query_pages.current.previous %>
|
|
||||||
<%= link_to 'Next page', { :page => @query_pages.current.next } if @query_pages.current.next %>
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<%= link_to 'New query', :action => 'new' %>
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<h1>New query</h1>
|
|
||||||
|
|
||||||
<%= start_form_tag :action => 'new' %>
|
|
||||||
<%= render :partial => 'form', :locals => {:query => @query} %>
|
|
||||||
<%= submit_tag "Create" %>
|
|
||||||
<%= end_form_tag %>
|
|
||||||
|
|
||||||
<%= debug @query %>
|
|
||||||
<%= debug params %>
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
<% for column in Query.content_columns %>
|
|
||||||
<p>
|
|
||||||
<b><%= column.human_name %>:</b> <%=h @query.send(column.name) %>
|
|
||||||
</p>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= link_to 'Edit', :action => 'edit', :id => @query %> |
|
|
||||||
<%= link_to 'Back', :action => 'list' %>
|
|
||||||
@@ -29,17 +29,17 @@
|
|||||||
:controller => 'projects', :action => 'list_issues', :id => @project,
|
:controller => 'projects', :action => 'list_issues', :id => @project,
|
||||||
:set_filter => 1,
|
:set_filter => 1,
|
||||||
"#{field_name}" => row.id,
|
"#{field_name}" => row.id,
|
||||||
"status_id" => "O" %></td>
|
"status_id" => "o" %></td>
|
||||||
<td align="center"><%= link_to (aggregate data, { field_name => row.id, "closed" => 1 }),
|
<td align="center"><%= link_to (aggregate data, { field_name => row.id, "closed" => 1 }),
|
||||||
:controller => 'projects', :action => 'list_issues', :id => @project,
|
:controller => 'projects', :action => 'list_issues', :id => @project,
|
||||||
:set_filter => 1,
|
:set_filter => 1,
|
||||||
"#{field_name}" => row.id,
|
"#{field_name}" => row.id,
|
||||||
"status_id" => "C" %></td>
|
"status_id" => "c" %></td>
|
||||||
<td align="center"><%= link_to (aggregate data, { field_name => row.id }),
|
<td align="center"><%= link_to (aggregate data, { field_name => row.id }),
|
||||||
:controller => 'projects', :action => 'list_issues', :id => @project,
|
:controller => 'projects', :action => 'list_issues', :id => @project,
|
||||||
:set_filter => 1,
|
:set_filter => 1,
|
||||||
"#{field_name}" => row.id,
|
"#{field_name}" => row.id,
|
||||||
"status_id" => "A" %></td>
|
"status_id" => "*" %></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -18,17 +18,17 @@
|
|||||||
:controller => 'projects', :action => 'list_issues', :id => @project,
|
:controller => 'projects', :action => 'list_issues', :id => @project,
|
||||||
:set_filter => 1,
|
:set_filter => 1,
|
||||||
"#{field_name}" => row.id,
|
"#{field_name}" => row.id,
|
||||||
"status_id" => "O" %></td>
|
"status_id" => "o" %></td>
|
||||||
<td align="center"><%= link_to (aggregate data, { field_name => row.id, "closed" => 1 }),
|
<td align="center"><%= link_to (aggregate data, { field_name => row.id, "closed" => 1 }),
|
||||||
:controller => 'projects', :action => 'list_issues', :id => @project,
|
:controller => 'projects', :action => 'list_issues', :id => @project,
|
||||||
:set_filter => 1,
|
:set_filter => 1,
|
||||||
"#{field_name}" => row.id,
|
"#{field_name}" => row.id,
|
||||||
"status_id" => "C" %></td>
|
"status_id" => "c" %></td>
|
||||||
<td align="center"><%= link_to (aggregate data, { field_name => row.id }),
|
<td align="center"><%= link_to (aggregate data, { field_name => row.id }),
|
||||||
:controller => 'projects', :action => 'list_issues', :id => @project,
|
:controller => 'projects', :action => 'list_issues', :id => @project,
|
||||||
:set_filter => 1,
|
:set_filter => 1,
|
||||||
"#{field_name}" => row.id,
|
"#{field_name}" => row.id,
|
||||||
"status_id" => "A" %></td>
|
"status_id" => "*" %></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -1,18 +1,30 @@
|
|||||||
<h2><%=l(:label_report_plural)%></h2>
|
<h2><%=l(:label_report_plural)%></h2>
|
||||||
|
|
||||||
|
<h3><%= l(:label_query_plural) %></h3>
|
||||||
|
<div style="float:right;">
|
||||||
|
<%= link_to_if_authorized l(:label_query_new), :controller => 'projects', :action => 'add_query', :id => @project %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% if @queries.empty? %><p><i><%=l(:label_no_data)%></i></p><% end %>
|
||||||
|
<ul>
|
||||||
|
<% @queries.each do |query| %>
|
||||||
|
<li><%= link_to query.name, :controller => 'projects', :action => 'list_issues', :id => @project, :query_id => query %></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<div class="splitcontentleft">
|
<div class="splitcontentleft">
|
||||||
<h3><%=l(:field_tracker)%> <%= link_to image_tag('details'), :detail => 'author' %></h3>
|
<h3><%=l(:field_tracker)%> <%= link_to image_tag('details'), :detail => 'tracker' %></h3>
|
||||||
<%= render :partial => 'simple', :locals => { :data => @issues_by_tracker, :field_name => "tracker_id", :rows => @trackers } %>
|
<%= render :partial => 'simple', :locals => { :data => @issues_by_tracker, :field_name => "tracker_id", :rows => @trackers } %>
|
||||||
<br />
|
<br />
|
||||||
<h3><%=l(:field_priority)%> <%= link_to image_tag('details'), :detail => 'priority' %></h3>
|
|
||||||
<%= render :partial => 'simple', :locals => { :data => @issues_by_priority, :field_name => "priority_id", :rows => @priorities } %>
|
|
||||||
<br />
|
|
||||||
<h3><%=l(:field_author)%> <%= link_to image_tag('details'), :detail => 'author' %></h3>
|
<h3><%=l(:field_author)%> <%= link_to image_tag('details'), :detail => 'author' %></h3>
|
||||||
<%= render :partial => 'simple', :locals => { :data => @issues_by_author, :field_name => "author_id", :rows => @authors } %>
|
<%= render :partial => 'simple', :locals => { :data => @issues_by_author, :field_name => "author_id", :rows => @authors } %>
|
||||||
<br />
|
<br />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="splitcontentright">
|
<div class="splitcontentright">
|
||||||
|
<h3><%=l(:field_priority)%> <%= link_to image_tag('details'), :detail => 'priority' %></h3>
|
||||||
|
<%= render :partial => 'simple', :locals => { :data => @issues_by_priority, :field_name => "priority_id", :rows => @priorities } %>
|
||||||
|
<br />
|
||||||
<h3><%=l(:field_category)%> <%= link_to image_tag('details'), :detail => 'category' %></h3>
|
<h3><%=l(:field_category)%> <%= link_to image_tag('details'), :detail => 'category' %></h3>
|
||||||
<%= render :partial => 'simple', :locals => { :data => @issues_by_category, :field_name => "category_id", :rows => @categories } %>
|
<%= render :partial => 'simple', :locals => { :data => @issues_by_category, :field_name => "category_id", :rows => @categories } %>
|
||||||
<br />
|
<br />
|
||||||
|
|||||||
@@ -259,6 +259,11 @@ label_internal: Intern
|
|||||||
label_last_changes: %d änderungen des Letzten
|
label_last_changes: %d änderungen des Letzten
|
||||||
label_change_view_all: Alle änderungen ansehen
|
label_change_view_all: Alle änderungen ansehen
|
||||||
label_personalize_page: Diese Seite personifizieren
|
label_personalize_page: Diese Seite personifizieren
|
||||||
|
label_query: Benutzerdefiniertes Frage
|
||||||
|
label_query_plural: Benutzerdefinierte Fragen
|
||||||
|
label_query_new: Neue Frage
|
||||||
|
label_filter_add: Filter addieren
|
||||||
|
label_filter_plural: Filter
|
||||||
|
|
||||||
button_login: Einloggen
|
button_login: Einloggen
|
||||||
button_submit: Einreichen
|
button_submit: Einreichen
|
||||||
|
|||||||
@@ -259,6 +259,11 @@ label_internal: Internal
|
|||||||
label_last_changes: last %d changes
|
label_last_changes: last %d changes
|
||||||
label_change_view_all: View all changes
|
label_change_view_all: View all changes
|
||||||
label_personalize_page: Personalize this page
|
label_personalize_page: Personalize this page
|
||||||
|
label_query: Custom query
|
||||||
|
label_query_plural: Custom queries
|
||||||
|
label_query_new: New query
|
||||||
|
label_filter_add: Add filter
|
||||||
|
label_filter_plural: Filters
|
||||||
|
|
||||||
button_login: Login
|
button_login: Login
|
||||||
button_submit: Submit
|
button_submit: Submit
|
||||||
|
|||||||
@@ -259,6 +259,11 @@ label_internal: Interno
|
|||||||
label_last_changes: %d cambios del último
|
label_last_changes: %d cambios del último
|
||||||
label_change_view_all: Ver todos los cambios
|
label_change_view_all: Ver todos los cambios
|
||||||
label_personalize_page: Personalizar esta página
|
label_personalize_page: Personalizar esta página
|
||||||
|
label_query: Pregunta personalizada
|
||||||
|
label_query_plural: Preguntas personalizadas
|
||||||
|
label_query_new: Nueva preguntas
|
||||||
|
label_filter_add: Agregar el filtro
|
||||||
|
label_filter_plural: Filtros
|
||||||
|
|
||||||
button_login: Conexión
|
button_login: Conexión
|
||||||
button_submit: Someter
|
button_submit: Someter
|
||||||
|
|||||||
@@ -260,6 +260,11 @@ label_internal: Interne
|
|||||||
label_last_changes: %d derniers changements
|
label_last_changes: %d derniers changements
|
||||||
label_change_view_all: Voir tous les changements
|
label_change_view_all: Voir tous les changements
|
||||||
label_personalize_page: Personnaliser cette page
|
label_personalize_page: Personnaliser cette page
|
||||||
|
label_query: Rapport personnalisé
|
||||||
|
label_query_plural: Rapports personnalisés
|
||||||
|
label_query_new: Nouveau rapport
|
||||||
|
label_filter_add: Ajouter le filtre
|
||||||
|
label_filter_plural: Filtres
|
||||||
|
|
||||||
button_login: Connexion
|
button_login: Connexion
|
||||||
button_submit: Soumettre
|
button_submit: Soumettre
|
||||||
|
|||||||
Reference in new issue
Block a user