Browse Source

Switch between toggle plus and minus icons for toggle multi select (#31496).

Patch by Marius BALTEANU.


git-svn-id: http://svn.redmine.org/redmine/trunk@18214 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/4.1.0
Go MAEDA 5 years ago
parent
commit
bbb755e95d

+ 4
- 2
app/views/workflows/edit.html.erb View File

<label><%=l(:label_role)%>: <label><%=l(:label_role)%>:
<%= options_for_workflow_select 'role_id[]', Role.sorted.select(&:consider_workflow?), @roles, :id => 'role_id', :class => 'expandable' %> <%= options_for_workflow_select 'role_id[]', Role.sorted.select(&:consider_workflow?), @roles, :id => 'role_id', :class => 'expandable' %>
</label> </label>
<a href="#" data-expands="#role_id"><span class="toggle-multiselect"></span></a>
<a href="#" data-expands="#role_id"><span class="toggle-multiselect icon-only icon-toggle-plus"></span></a>


<label><%=l(:label_tracker)%>: <label><%=l(:label_tracker)%>:
<%= options_for_workflow_select 'tracker_id[]', Tracker.sorted, @trackers, :id => 'tracker_id', :class => 'expandable' %> <%= options_for_workflow_select 'tracker_id[]', Tracker.sorted, @trackers, :id => 'tracker_id', :class => 'expandable' %>
</label> </label>
<a href="#" data-expands="#tracker_id"><span class="toggle-multiselect"></span></a>
<a href="#" data-expands="#tracker_id"><span class="toggle-multiselect icon-only icon-toggle-plus"></span></a>


<%= submit_tag l(:button_edit), :name => nil %> <%= submit_tag l(:button_edit), :name => nil %>


e.preventDefault(); e.preventDefault();
var target = $($(this).attr("data-expands")); var target = $($(this).attr("data-expands"));
if (target.attr("multiple")) { if (target.attr("multiple")) {
$(event.target).switchClass('icon-toggle-minus', 'icon-toggle-plus');
target.attr("multiple", false); target.attr("multiple", false);
target.find("option[value=all]").show(); target.find("option[value=all]").show();
} else { } else {
$(event.target).switchClass('icon-toggle-plus', 'icon-toggle-minus');
target.attr("multiple", true); target.attr("multiple", true);
target.find("option[value=all]").attr("selected", false).hide(); target.find("option[value=all]").attr("selected", false).hide();
} }

+ 2
- 2
app/views/workflows/permissions.html.erb View File

<label><%=l(:label_role)%>: <label><%=l(:label_role)%>:
<%= options_for_workflow_select 'role_id[]', Role.sorted.select(&:consider_workflow?), @roles, :id => 'role_id', :class => 'expandable' %> <%= options_for_workflow_select 'role_id[]', Role.sorted.select(&:consider_workflow?), @roles, :id => 'role_id', :class => 'expandable' %>
</label> </label>
<a href="#" data-expands="#role_id"><span class="toggle-multiselect"></a>
<a href="#" data-expands="#role_id"><span class="toggle-multiselect icon-only icon-toggle-plus"></a>


<label><%=l(:label_tracker)%>: <label><%=l(:label_tracker)%>:
<%= options_for_workflow_select 'tracker_id[]', Tracker.sorted, @trackers, :id => 'tracker_id', :class => 'expandable' %> <%= options_for_workflow_select 'tracker_id[]', Tracker.sorted, @trackers, :id => 'tracker_id', :class => 'expandable' %>
</label> </label>
<a href="#" data-expands="#tracker_id"><span class="toggle-multiselect"></a>
<a href="#" data-expands="#tracker_id"><span class="toggle-multiselect icon-only icon-toggle-plus"></a>


<%= submit_tag l(:button_edit), :name => nil %> <%= submit_tag l(:button_edit), :name => nil %>



+ 3
- 2
public/javascripts/application.js View File

toggleFilter($(this).val()); toggleFilter($(this).val());
}); });
$('#filters-table').on('click', '.toggle-multiselect', function() { $('#filters-table').on('click', '.toggle-multiselect', function() {
toggleMultiSelect($(this).siblings('select'));
toggleMultiSelect($(this).siblings('select'))
$(this).toggleClass('icon-toggle-plus icon-toggle-minus')
}); });
$('#filters-table').on('keypress', 'input[type=text]', function(e) { $('#filters-table').on('keypress', 'input[type=text]', function(e) {
if (e.keyCode == 13) $(this).closest('form').submit(); if (e.keyCode == 13) $(this).closest('form').submit();
case "list_subprojects": case "list_subprojects":
tr.find('td.values').append( tr.find('td.values').append(
'<span style="display:none;"><select class="value" id="values_'+fieldId+'_1" name="v['+field+'][]"></select>' + '<span style="display:none;"><select class="value" id="values_'+fieldId+'_1" name="v['+field+'][]"></select>' +
' <span class="toggle-multiselect">&nbsp;</span></span>'
' <span class="toggle-multiselect icon-only icon-toggle-plus">&nbsp;</span></span>'
); );
select = tr.find('td.values select'); select = tr.find('td.values select');
if (values.length > 1) { select.attr('multiple', true); } if (values.length > 1) { select.attr('multiple', true); }

+ 3
- 1
public/stylesheets/application.css View File

.add-filter {width:35%; float:right; text-align: right; vertical-align: top;} .add-filter {width:35%; float:right; text-align: right; vertical-align: top;}


#issue_is_private_wrap {float:right; margin-right:1em;} #issue_is_private_wrap {float:right; margin-right:1em;}
.toggle-multiselect {background: url(../images/bullet_toggle_plus.png) no-repeat 0% 40%; padding-left:16px; margin-left:0; margin-right:5px; cursor:pointer;}
.toggle-multiselect { no-repeat 0% 40%; padding-left:16px; margin-left:0; margin-right:5px; cursor:pointer;}
.buttons { font-size: 0.9em; margin-bottom: 1.4em; margin-top: 1em; } .buttons { font-size: 0.9em; margin-bottom: 1.4em; margin-top: 1em; }


div#issue-changesets {float:right; width:45%; margin-left: 1em; margin-bottom: 1em; background: #fff; padding-left: 1em; font-size: 90%;} div#issue-changesets {float:right; width:45%; margin-left: 1em; margin-bottom: 1em; background: #fff; padding-left: 1em; font-size: 90%;}
.icon-bookmark-off { background-image: url(../images/tag_blue_add.png); } .icon-bookmark-off { background-image: url(../images/tag_blue_add.png); }
.icon-sorted-asc { background-image: url(../images/arrow_down.png); } .icon-sorted-asc { background-image: url(../images/arrow_down.png); }
.icon-sorted-desc { background-image: url(../images/arrow_up.png); } .icon-sorted-desc { background-image: url(../images/arrow_up.png); }
.icon-toggle-plus { background: url(../images/bullet_toggle_plus.png) }
.icon-toggle-minus { background: url(../images/bullet_toggle_minus.png) }


.icon-file { background-image: url(../images/files/default.png); } .icon-file { background-image: url(../images/files/default.png); }
.icon-file.text-plain { background-image: url(../images/files/text.png); } .icon-file.text-plain { background-image: url(../images/files/text.png); }

Loading…
Cancel
Save