Patch #3606 ยป copy_queries.patch
app/controllers/queries_controller.rb | ||
---|---|---|
40 | 40 |
render :layout => false if request.xhr? |
41 | 41 |
end |
42 | 42 |
|
43 |
def copy |
|
44 |
@query = Query.new Query.find(params[:id]).attributes |
|
45 |
@oldname = @query.name |
|
46 |
@query.name = "" |
|
47 |
@query.user = User.current |
|
48 |
@query.is_public = false unless User.current.allowed_to?(:manage_public_queries, @project) || User.current.admin? |
|
49 |
render :layout => !request.xhr?, :action => 'new' |
|
50 |
end |
|
51 |
|
|
43 | 52 |
def edit |
44 | 53 |
if request.post? |
45 | 54 |
@query.filters = {} |
app/views/issues/index.rhtml | ||
---|---|---|
34 | 34 |
<div class="contextual"> |
35 | 35 |
<% if @query.editable_by?(User.current) %> |
36 | 36 |
<%= link_to l(:button_edit), {:controller => 'queries', :action => 'edit', :id => @query}, :class => 'icon icon-edit' %> |
37 |
<%= link_to l(:button_delete), {:controller => 'queries', :action => 'destroy', :id => @query}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %> |
|
37 |
<%= link_to l(:button_copy), {:controller => 'queries', :action => 'copy', :id => @query}, :class => 'icon icon-copy' %> |
|
38 |
<%= link_to l(:button_delete), {:controller => 'queries', :action => 'destroy', :id => @query}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %> |
|
38 | 39 |
<% end %> |
39 | 40 |
</div> |
40 | 41 |
<h2><%=h @query.name %></h2> |
app/views/queries/new.rhtml | ||
---|---|---|
1 |
<%= content_tag(:div, l(:label_query_copy_from, :name => content_tag(:strong, @oldname)), :class => "contextual") unless @oldname.nil? %> |
|
1 | 2 |
<h2><%= l(:label_query_new) %></h2> |
2 | 3 | |
3 | 4 |
<% form_tag({:action => 'new', :project_id => @query.project}, :onsubmit => 'selectAllOptions("selected_columns");') do %> |
config/locales/en.yml | ||
---|---|---|
513 | 513 |
label_query: Custom query |
514 | 514 |
label_query_plural: Custom queries |
515 | 515 |
label_query_new: New query |
516 |
label_query_copy_from: "Based upon query: {{name}}" |
|
516 | 517 |
label_filter_add: Add filter |
517 | 518 |
label_filter_plural: Filters |
518 | 519 |
label_equals: is |