diff --git a/app/views/queries/_query_form.html.erb b/app/views/queries/_query_form.html.erb new file mode 100644 index 0000000..10753e8 --- /dev/null +++ b/app/views/queries/_query_form.html.erb @@ -0,0 +1,88 @@ +<%= hidden_field_tag 'set_filter', '1' %> +<%= hidden_field_tag 'type', @query.type, :disabled => true, :id => 'query_type' %> +<%= query_hidden_sort_tag(@query) %> + +
+
+
"> + "><%= l(:label_filter_plural) %> +
"> + <%= render :partial => 'queries/filters', :locals => {:query => @query} %> +
+
+ + <% if @query.available_columns.any? %> + + <% end %> +
+ +

+ <%= link_to_function l(:button_apply), '$("#query_form").submit()', :class => 'icon icon-checked' %> + <%= link_to l(:button_clear), { :set_filter => 1, :sort => '', :project_id => @project }, :class => 'icon icon-reload' %> + <% if @query.new_record? %> + <% if User.current.allowed_to?(:save_queries, @project, :global => true) %> + <%= link_to_function l(:button_save_object, object_name: l(:label_query)), + "$('#query_type').prop('disabled',false);$('#query_form').attr('action', '#{ @project ? new_project_query_path(@project) : new_query_path }').submit()", + :class => 'icon icon-save' %> + <% end %> + <% else %> + <% if @query.editable_by?(User.current) %> + <% redirect_params = (controller_name == 'admin' && action_name == 'projects') ? {:admin_projects => 1} : {} %> + <%= link_to l(:button_edit_object, object_name: l(:label_query)), edit_query_path(@query, redirect_params), :class => 'icon icon-edit' %> + <%= delete_link query_path(@query, redirect_params), {}, l(:button_delete_object, object_name: l(:label_query)) %> + <% end %> + <% end %> +

+
+ +<%= error_messages_for @query %> + +<%= javascript_tag do %> +$(function ($) { + $('input[name=display_type]').change(function (e) { + if ($("#display_type_list").is(':checked')) { + $('table#list-definition').show(); + } else { + $('table#list-definition').hide(); + } + + }) +}); + +<% end %>