<p>
<label><%=l(:label_role)%>:
<%= options_for_workflow_select 'role_id[]', Role.sorted.select(&:consider_workflow?), @roles, :id => 'role_id', :class => 'expandable' %>
+ <span class="toggle-multiselect icon-only"></span>
</label>
- <a href="#" data-expands="#role_id"><span class="toggle-multiselect icon-only icon-toggle-plus"></span></a>
<label><%=l(:label_tracker)%>:
<%= options_for_workflow_select 'tracker_id[]', Tracker.sorted, @trackers, :id => 'tracker_id', :class => 'expandable' %>
+ <span class="toggle-multiselect icon-only"></span>
</label>
- <a href="#" data-expands="#tracker_id"><span class="toggle-multiselect icon-only icon-toggle-plus"></span></a>
<%= submit_tag l(:button_edit), :name => nil %>
</div>
<%= submit_tag l(:button_save) %>
<% end %>
-<% end %>
-
-<%= javascript_tag do %>
-$("a[data-expands]").click(function(e){
- e.preventDefault();
- var target = $($(this).attr("data-expands"));
- if (target.attr("multiple")) {
- $(this).find('span').switchClass('icon-toggle-minus', 'icon-toggle-plus');
- target.attr("multiple", false);
- target.find("option[value=all]").show();
- } else {
- $(this).find('span').switchClass('icon-toggle-plus', 'icon-toggle-minus');
- target.attr("multiple", true);
- target.find("option[value=all]").attr("selected", false).hide();
- }
-});
-
-<% end %>
+<% end %>
\ No newline at end of file
<p>
<label><%=l(:label_role)%>:
<%= options_for_workflow_select 'role_id[]', Role.sorted.select(&:consider_workflow?), @roles, :id => 'role_id', :class => 'expandable' %>
+ <span class="toggle-multiselect icon-only"></span>
</label>
- <a href="#" data-expands="#role_id"><span class="toggle-multiselect icon-only icon-toggle-plus"></span></a>
<label><%=l(:label_tracker)%>:
<%= options_for_workflow_select 'tracker_id[]', Tracker.sorted, @trackers, :id => 'tracker_id', :class => 'expandable' %>
+ <span class="toggle-multiselect icon-only"></span>
</label>
- <a href="#" data-expands="#tracker_id"><span class="toggle-multiselect icon-only icon-toggle-plus"></span></a>
-
<%= submit_tag l(:button_edit), :name => nil %>
<%= hidden_field_tag 'used_statuses_only', '0', :id => nil %>
var selected = td.find("select").find(":selected").val();
td.nextAll('td').find("select").val(selected);
});
-
-$("a[data-expands]").click(function(e){
- e.preventDefault();
- var target = $($(this).attr("data-expands"));
- if (target.attr("multiple")) {
- $(this).find('span').switchClass('icon-toggle-minus', 'icon-toggle-plus');
- target.attr("multiple", false);
- target.find("option[value=all]").show();
- } else {
- $(this).find('span').switchClass('icon-toggle-plus', 'icon-toggle-minus');
- target.attr("multiple", true);
- target.find("option[value=all]").attr("selected", false).hide();
- }
-});
-
<% end %>
$('#filters-table').on('click', 'td.field input[type=checkbox]', function() {
toggleFilter($(this).val());
});
- $('#filters-table').on('click', '.toggle-multiselect', function() {
- toggleMultiSelect($(this).siblings('select'))
- $(this).toggleClass('icon-toggle-plus icon-toggle-minus')
- });
$('#filters-table').on('keypress', 'input[type=text]', function(e) {
if (e.keyCode == 13) $(this).closest('form').submit();
});
}
$('#cb_'+fieldId).prop('checked', true);
toggleFilter(field);
+ toggleMultiSelectIconInit();
$('#add_filter_select').val('').find('option').each(function() {
if ($(this).attr('value') == field) {
$(this).attr('disabled', true);
case "list_subprojects":
tr.find('td.values').append(
'<span style="display:none;"><select class="value" id="values_'+fieldId+'_1" name="v['+field+'][]"></select>' +
- ' <span class="toggle-multiselect icon-only icon-toggle-plus"> </span></span>'
+ ' <span class="toggle-multiselect icon-only '+(values.length > 1 ? 'icon-toggle-minus' : 'icon-toggle-plus')+'"> </span></span>'
);
select = tr.find('td.values select');
if (values.length > 1) { select.attr('multiple', true); }
}
function toggleMultiSelect(el) {
+ var isWorkflow = el.closest('.controller-workflows');
if (el.attr('multiple')) {
el.removeAttr('multiple');
+ if (isWorkflow) { el.find("option[value=all]").show(); }
el.attr('size', 1);
} else {
el.attr('multiple', true);
+ if (isWorkflow) { el.find("option[value=all]").attr("selected", false).hide(); }
if (el.children().length > 10)
el.attr('size', 10);
else
function toggleDisabledInit() {
$('input[data-disables], input[data-enables], input[data-shows]').each(toggleDisabledOnChange);
}
+function toggleMultiSelectIconInit() {
+ $('.toggle-multiselect:not(.icon-toggle-minus), .toggle-multiselect:not(.icon-toggle-plus)').each(function(){
+ if ($(this).siblings('select').find('option:selected').size() > 1){
+ $(this).addClass('icon-toggle-minus');
+ } else {
+ $(this).addClass('icon-toggle-plus');
+ }
+ });
+}
function toggleNewObjectDropdown() {
var dropdown = $('#new-object + ul.menu-children');
$('#content').on('change', 'input[data-disables], input[data-enables], input[data-shows]', toggleDisabledOnChange);
toggleDisabledInit();
+ $('#content').on('click', '.toggle-multiselect', function() {
+ toggleMultiSelect($(this).siblings('select'));
+ $(this).toggleClass('icon-toggle-plus icon-toggle-minus');
+ });
+ toggleMultiSelectIconInit();
+
$('#history .tabs').on('click', 'a', function(e){
var tab = $(e.target).attr('id').replace('tab-','');
document.cookie = 'history_last_tab=' + tab