Skip to content

Commit 68d0042

Browse files
committed
RDQ3 - SmartIssuesSort - updated to work with Redmine 2.4. Broke when Query role visibility was introduced.
1 parent 56fdc6e commit 68d0042

File tree

1 file changed

+34
-7
lines changed

1 file changed

+34
-7
lines changed

app/views/queries/_form.html.erb

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
<div class="box">
44
<div class="tabular">
5+
<%= hidden_field_tag 'gantt', '1' if params[:gantt] %>
6+
57
<p><label for="query_name"><%=l(:field_name)%></label>
68
<%= text_field 'query', 'name', :size => 80 %></p>
79

@@ -15,43 +17,58 @@
1517
<%= javascript_tag "new Ajax.Autocompleter('query_category', 'query_categories_choices', '#{ url_for(:controller => 'smart_issues_sort', :action => 'autocomplete_for_category') }', { minChars: 1, frequency: 0.5, paramName: 'category' });" %>
1618
<%# VVK end %>
1719

18-
<% if User.current.admin? || User.current.allowed_to?(:manage_public_queries, @project) %>
19-
<p><label for="query_is_public"><%=l(:field_is_public)%></label>
20-
<%= check_box 'query', 'is_public',
21-
:onchange => (User.current.admin? ? nil : 'if (this.checked) {$("#query_is_for_all").removeAttr("checked"); $("#query_is_for_all").attr("disabled", true);} else {$("#query_is_for_all").removeAttr("disabled");}') %></p>
2220

21+
<% if User.current.admin? || User.current.allowed_to?(:manage_public_queries, @project) %>
22+
<p><label><%=l(:field_visible)%></label>
23+
<label class="block"><%= radio_button 'query', 'visibility', Query::VISIBILITY_PRIVATE %> <%= l(:label_visibility_private) %></label>
24+
<label class="block"><%= radio_button 'query', 'visibility', Query::VISIBILITY_ROLES %> <%= l(:label_visibility_roles) %>:</label>
25+
<% Role.givable.sorted.each do |role| %>
26+
<label class="block role-visibility"><%= check_box_tag 'query[role_ids][]', role.id, @query.roles.include?(role), :id => nil %> <%= role.name %></label>
27+
<% end %>
28+
<label class="block"><%= radio_button 'query', 'visibility', Query::VISIBILITY_PUBLIC %> <%= l(:label_visibility_public) %></label>
29+
<%= hidden_field_tag 'query[role_ids][]', '' %>
30+
</p>
2331
<% end %>
2432

2533
<p><label for="query_is_for_all"><%=l(:field_is_for_all)%></label>
2634
<%= check_box_tag 'query_is_for_all', 1, @query.project.nil?,
2735
:disabled => (!@query.new_record? && (@query.project.nil? || (@query.is_public? && !User.current.admin?))) %></p>
2836

37+
<fieldset><legend><%= l(:label_options) %></legend>
2938
<p><label for="query_default_columns"><%=l(:label_default_columns)%></label>
3039
<%= check_box_tag 'default_columns', 1, @query.has_default_columns?, :id => 'query_default_columns',
3140
:onclick => 'if (this.checked) {$("#columns").hide();} else {$("#columns").show();}' %></p>
3241

33-
3442
<p><label for="query_group_by"><%= l(:field_group_by) %></label>
3543
<%= select 'query', 'group_by', @query.groupable_columns.collect {|c| [c.caption, c.name.to_s]}, :include_blank => true %></p>
3644

3745
<p><label><%= l(:button_show) %></label>
3846
<%= available_block_columns_tags(@query) %></p>
47+
48+
<% if params[:gantt] %>
49+
<p><label><%= l(:label_gantt) %></label>
50+
<label class="inline"><%= check_box_tag "query[draw_relations]", "1", @query.draw_relations %> <%= l(:label_related_issues) %></label>
51+
<label class="inline"><%= check_box_tag "query[draw_progress_line]", "1", @query.draw_progress_line %> <%= l(:label_gantt_progress_line) %></label>
52+
</p>
53+
<% end %>
54+
</fieldset>
3955
</div>
4056

4157
<fieldset id="filters"><legend><%= l(:label_filter_plural) %></legend>
4258
<%= render :partial => 'queries/filters', :locals => {:query => query}%>
4359
</fieldset>
4460

4561
<fieldset><legend><%= l(:label_sort) %></legend>
46-
<%# VVK start %>
62+
<%# VVK start %>
4763
<p>
4864
&nbsp;&nbsp;
4965
<%= check_box 'query', 'sort_by_parent_first' %>
5066
<label for="query_sort_by_parent_first"><%=l(:label_qg_sort_by_parent_issue)%></label>
5167
</p>
5268
<%# VVK end %>
69+
5370
<% 3.times do |i| %>
54-
<%= i+1 %>:
71+
<%= i+1 %>:
5572
<%= label_tag "query_sort_criteria_attribute_" + i.to_s,
5673
l(:description_query_sort_criteria_attribute), :class => "hidden-for-sighted" %>
5774
<%= select_tag("query[sort_criteria][#{i}][]",
@@ -73,8 +90,18 @@
7390

7491
</div>
7592

93+
<%= javascript_tag do %>
94+
$(document).ready(function(){
95+
$("input[name='query[visibility]']").change(function(){
96+
var checked = $('#query_visibility_1').is(':checked');
97+
$("input[name='query[role_ids][]'][type=checkbox]").attr('disabled', !checked);
98+
}).trigger('change');
99+
});
100+
<% end %>
101+
76102
<%# VVK start %>
77103
<% content_for :header_tags do %>
78104
<%= stylesheet_link_tag 'stylesheet', :plugin => SIS_AssetHelpers::PLUGIN_NAME %>
79105
<% end %>
80106
<%# VVK end %>
107+

0 commit comments

Comments
 (0)