summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2019-10-19 12:14:21 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2019-10-19 12:14:21 +0000
commit49b96a935b3fb34a8cea07b723d9af55a415e13b (patch)
treea42962b4d3efbbe51f4a347d0d720f5b529b359f
parent95188f26c3f47f110c6d928e5df0b108802032b3 (diff)
downloadredmine-49b96a935b3fb34a8cea07b723d9af55a415e13b.tar.gz
redmine-49b96a935b3fb34a8cea07b723d9af55a415e13b.zip
Use radio buttons to choose display type (#29482).
git-svn-id: http://svn.redmine.org/redmine/trunk@18767 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/helpers/queries_helper.rb7
-rw-r--r--app/views/queries/_query_form.html.erb11
2 files changed, 9 insertions, 9 deletions
diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb
index 9ed2dd21d..88fe08b50 100644
--- a/app/helpers/queries_helper.rb
+++ b/app/helpers/queries_helper.rb
@@ -121,11 +121,12 @@ module QueriesHelper
end
def available_display_types_tags(query)
- available_display_types = []
+ tags = ''.html_safe
query.available_display_types.each do |t|
- available_display_types << [l(:"label_display_type_#{t}"), t]
+ tags << radio_button_tag('display_type', t, @query.display_type == t, :id => "display_type_#{t}") +
+ content_tag('label', l(:"label_display_type_#{t}"), :for => "display_type_#{t}")
end
- select_tag('display_type', options_for_select(available_display_types, @query.display_type), :id => 'display_type')
+ tags
end
def grouped_query_results(items, query, &block)
diff --git a/app/views/queries/_query_form.html.erb b/app/views/queries/_query_form.html.erb
index 62d156684..bb29827f8 100644
--- a/app/views/queries/_query_form.html.erb
+++ b/app/views/queries/_query_form.html.erb
@@ -21,7 +21,7 @@
<%= available_display_types_tags(@query) %>
</div>
<% end %>
- <table id="list" class="<%= 'hidden' if (@query.display_type == 'board') %>">
+ <table id="list-definition" class="<%= 'hidden' if (@query.display_type != 'list') %>">
<% if @query.available_columns.any? %>
<tr>
<td class="field"><%= l(:field_column_names) %></td>
@@ -74,12 +74,11 @@
<%= javascript_tag do %>
$(function ($) {
- $('#display_type').change(function (e) {
- var option = $(e.target).val()
- if (option == 'board') {
- $('table#list').hide();
+ $('input[name=display_type]').change(function (e) {
+ if ($("#display_type_list").is(':checked')) {
+ $('table#list-definition').show();
} else {
- $('table#list').show();
+ $('table#list-definition').hide();
}
})