@query.user = logged_in_user
@query.executed_by = logged_in_user
@query.is_public = false unless current_role.allowed_to?(:manage_public_queries)
+ @query.column_names = nil if params[:default_columns]
params[:fields].each do |field|
@query.add_filter(field, params[:operators][field], params[:values][field])
end if params[:fields]
@query.attributes = params[:query]
@query.is_public = false unless current_role.allowed_to?(:manage_public_queries)
-
+ @query.column_names = nil if params[:default_columns]
+
if @query.save
flash[:notice] = l(:notice_successful_update)
redirect_to :controller => 'projects', :action => 'list_issues', :id => @project, :query_id => @query
end
def columns
- if column_names && !column_names.empty?
- available_columns.select {|c| column_names.include?(c.name) }
- else
- # default columns
+ if has_default_columns?
available_columns.select {|c| c.default? }
+ else
+ available_columns.select {|c| column_names.include?(c.name) }
end
end
def has_column?(column)
column_names && column_names.include?(column.name)
end
+
+ def has_default_columns?
+ column_names.nil? || column_names.empty?
+ end
def statement
# project/subprojects clause
--- /dev/null
+<% content_tag 'fieldset', :id => 'columns', :style => (query.has_default_columns? ? 'display:none;' : nil) do %>
+<legend><%= l(:field_column_names) %></legend>
+<% query.available_columns.each do |column| %>
+<label><%= check_box_tag 'query[column_names][]', column.name, query.has_column?(column) %> <%= l("field_#{column.name}") %></label><br />
+<% end %>
+<%= hidden_field_tag 'query[column_names][]', '' %>
+<% end %>
<%= check_box 'query', 'is_public' %></p>
<% end %>
-<p><label for="query_column_names"><%=l(:field_column_names)%></label>
-<% @query.available_columns.each do |column| %>
-<%= check_box_tag 'query[column_names][]', column.name, @query.has_column?(column) %> <%= l("field_#{column.name}") %><br />
-<% end %>
-<%= hidden_field_tag 'query[column_names][]', '' %>
-</p>
+<p><label for="query_default_columns"><%=l(:label_default_columns)%></label>
+<%= check_box_tag 'default_columns', 1, @query.has_default_columns?, :id => 'query_default_columns',
+ :onchange => 'if (this.checked) {Element.hide("columns")} else {Element.show("columns")}' %></p>
</div>
+<%= render :partial => 'queries/columns', :locals => {:query => query}%>
<%= render :partial => 'queries/filters', :locals => {:query => query}%>
</div>
label_file_plural: Files
label_changeset_plural: Changesets
field_column_names: Columns
+label_default_columns: Default columns
field_estimated_hours: Estimated time
label_changeset_plural: Changesets
field_column_names: Columns
+label_default_columns: Default columns
label_file_plural: Files
label_changeset_plural: Changesets
field_column_names: Columns
+label_default_columns: Default columns
label_jump_to_a_project: Jump to a project...
label_file_plural: Files
label_changeset_plural: Changesets
+label_default_columns: Default columns
button_login: Login
button_submit: Submit
label_file_plural: Files
label_changeset_plural: Changesets
field_column_names: Columns
+label_default_columns: Default columns
label_jump_to_a_project: Aller à un projet...
label_file_plural: Fichiers
label_changeset_plural: Révisions
+label_default_columns: Colonnes par défaut
button_login: Connexion
button_submit: Soumettre
label_file_plural: Files
label_changeset_plural: Changesets
field_column_names: Columns
+label_default_columns: Default columns
label_file_plural: Files
label_changeset_plural: Changesets
field_column_names: Columns
+label_default_columns: Default columns
label_file_plural: Files
label_changeset_plural: Changesets
field_column_names: Columns
+label_default_columns: Default columns
label_file_plural: Pliki
label_changeset_plural: Zestawienia zmian
field_column_names: Columns
+label_default_columns: Default columns
label_file_plural: Files\r
label_changeset_plural: Changesets\r
field_column_names: Columns\r
+label_default_columns: Default columns\r
label_file_plural: Files
label_changeset_plural: Changesets
field_column_names: Columns
+label_default_columns: Default columns
label_file_plural: Files
label_changeset_plural: Changesets
field_column_names: Columns
+label_default_columns: Default columns
label_file_plural: Files
label_changeset_plural: Changesets
field_column_names: Columns
+label_default_columns: Default columns
label_file_plural: Files
label_changeset_plural: Changesets
field_column_names: Columns
+label_default_columns: Default columns