Project

General

Profile

Defect #42130 » 0001-Fix-toggle-multipleselect-icons-by-using-square-roun.patch

Mizuki ISHIKAWA, 2025-01-21 06:52

View differences:

app/assets/images/icons.svg
455 455
      <path d="M19 16v6"/>
456 456
      <path d="M12 7v5l3 3"/>
457 457
    </symbol>
458
    <symbol viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" id="icon--toggle-minus">
459
      <path d="M9 12h6"/>
460
      <path d="M12 3c7.2 0 9 1.8 9 9s-1.8 9 -9 9s-9 -1.8 -9 -9s1.8 -9 9 -9z"/>
461
    </symbol>
462
    <symbol viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" id="icon--toggle-plus">
463
      <path d="M12 3c7.2 0 9 1.8 9 9s-1.8 9 -9 9s-9 -1.8 -9 -9s1.8 -9 9 -9z"/>
464
      <path d="M15 12h-6"/>
465
      <path d="M12 9v6"/>
466
    </symbol>
458 467
    <symbol viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" id="icon--unlock">
459 468
      <path d="M5 11m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z"/>
460 469
      <path d="M12 16m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"/>
app/assets/javascripts/application.js
209 209
  case "list_optional_with_history":
210 210
  case "list_status":
211 211
  case "list_subprojects":
212
    const iconType = values.length > 1 ? 'toggle-minus' : 'toggle-plus';
213
    const clonedIcon = document.querySelector('#icon-copy-source svg').cloneNode(true);
214
    updateSVGIcon(clonedIcon, iconType);
215

  
212 216
    tr.find('.values').append(
213
      '<span style="display:none;"><select class="value" id="values_'+fieldId+'_1" name="v['+field+'][]"></select>' +
214
      ' <span class="toggle-multiselect icon-only '+(values.length > 1 ? 'icon-toggle-minus' : 'icon-toggle-plus')+'">&nbsp;</span></span>'
217
      $('<span>', { style: 'display:none;' }).append(
218
        $('<select>', {
219
          class: 'value',
220
          id: `values_${fieldId}_1`,
221
          name: `v[${field}][]`,
222
        }),
223
        $('<span>', { class: `toggle-multiselect icon-only icon-${iconType}` }).append(clonedIcon)
224
      )
215 225
    );
216 226
    select = tr.find('.values select');
217 227
    if (values.length > 1) { select.attr('multiple', true); }
......
1010 1020
  $('input[data-disables], input[data-enables], input[data-shows]').each(toggleDisabledOnChange);
1011 1021
}
1012 1022
function toggleMultiSelectIconInit() {
1013
  $('.toggle-multiselect:not(.icon-toggle-minus), .toggle-multiselect:not(.icon-toggle-plus)').each(function(){
1014
    if ($(this).siblings('select').find('option:selected').length > 1){
1015
      $(this).addClass('icon-toggle-minus');
1023
  $('.toggle-multiselect:not(.icon-toggle-minus):not(.icon-toggle-plus)').each(function(){
1024
    let iconType;
1025
    if ($(this).siblings('select').find('option:selected').length > 1) {
1026
      iconType = 'toggle-minus';
1016 1027
    } else {
1017
      $(this).addClass('icon-toggle-plus');
1028
      iconType = 'toggle-plus';
1018 1029
    }
1030

  
1031
    $(this).addClass(`icon-${iconType}`);
1032
    updateSVGIcon($(this).find('svg')[0], iconType);
1019 1033
  });
1020 1034
}
1021 1035

  
......
1061 1075
  $('#content').on('click', '.toggle-multiselect', function() {
1062 1076
    toggleMultiSelect($(this).siblings('select'));
1063 1077
    $(this).toggleClass('icon-toggle-plus icon-toggle-minus');
1078
    updateSVGIcon($(this).find('svg')[0], $(this).hasClass('icon-toggle-plus') ? 'toggle-plus' : 'toggle-minus');
1064 1079
  });
1065 1080
  toggleMultiSelectIconInit();
1066 1081

  
app/assets/stylesheets/application.css
1910 1910
.icon-bookmarked-project:not(:has(svg)) { background-image: url(/tag_blue.png); }
1911 1911
.icon-sorted-asc:not(:has(svg)) { background-image: url(/arrow_down.png); }
1912 1912
.icon-sorted-desc:not(:has(svg)) { background-image: url(/arrow_up.png); }
1913
.icon-toggle-plus { background-image: url(/bullet_toggle_plus.png) }
1914
.icon-toggle-minus { background-image: url(/bullet_toggle_minus.png) }
1913
.icon-toggle-plus:not(:has(svg)) { background-image: url(/bullet_toggle_plus.png) }
1914
.icon-toggle-minus:not(:has(svg)) { background-image: url(/bullet_toggle_minus.png) }
1915 1915
.icon-clear-query:not(:has(svg)) { background-image: url(/close_hl.png); }
1916 1916
.icon-import:not(:has(svg)) { background-image: url(/database_go.png); }
1917 1917

  
app/assets/stylesheets/rtl.css
142 142

  
143 143
fieldset#filters td.add-filter {text-align:left; }
144 144

  
145
.toggle-multiselect {background: url(/bullet_toggle_plus.png) no-repeat right 40%; padding-left:0px; padding-right:8px; margin-right:0;}
146

  
147 145
div#issue-changesets {float:left;  margin-left:0em; margin-right:1em; padding-left:0em; padding-right:1em;}
148 146

  
149 147
.journal ul.details img {margin:0 4px -3px 0;}
app/views/queries/_filters.html.erb
22 22
<%= select_tag 'add_filter_select', filters_options_for_select(query), :name => nil %>
23 23
</div>
24 24

  
25
<div id="icon-copy-source" style="display: none;"><%= sprite_icon('') %></div>
25 26
<%= hidden_field_tag 'f[]', '' %>
26 27
<% include_calendar_headers_tags %>
app/views/workflows/edit.html.erb
15 15
<p>
16 16
  <label><%=l(:label_role)%>:
17 17
  <%= options_for_workflow_select 'role_id[]', Role.sorted.select(&:consider_workflow?), @roles, :id => 'role_id', :class => 'expandable' %>
18
  <span class="toggle-multiselect icon-only"></span>
18
  <span class="toggle-multiselect icon-only"><%= sprite_icon('') %></span>
19 19
  </label>
20 20

  
21 21
  <label><%=l(:label_tracker)%>:
22 22
  <%= options_for_workflow_select 'tracker_id[]', Tracker.sorted, @trackers, :id => 'tracker_id', :class => 'expandable' %>
23
  <span class="toggle-multiselect icon-only"></span>
23
  <span class="toggle-multiselect icon-only"><%= sprite_icon('') %></span>
24 24
  </label>
25 25

  
26 26
  <%= submit_tag l(:button_edit), :name => nil %>
app/views/workflows/permissions.html.erb
15 15
<p>
16 16
  <label><%=l(:label_role)%>:
17 17
  <%= options_for_workflow_select 'role_id[]', Role.sorted.select(&:consider_workflow?), @roles, :id => 'role_id', :class => 'expandable' %>
18
  <span class="toggle-multiselect icon-only"></span>
18
  <span class="toggle-multiselect icon-only"><%= sprite_icon('') %></span>
19 19
  </label>
20 20

  
21 21
  <label><%=l(:label_tracker)%>:
22 22
  <%= options_for_workflow_select 'tracker_id[]', Tracker.sorted, @trackers, :id => 'tracker_id', :class => 'expandable' %>
23
  <span class="toggle-multiselect icon-only"></span>
23
  <span class="toggle-multiselect icon-only"><%= sprite_icon('') %></span>
24 24
  </label>
25 25
  <%= submit_tag l(:button_edit), :name => nil %>
26 26

  
config/icon_source.yml
205 205
  svg: key
206 206
- name: search
207 207
  svg: search
208
- name: toggle-plus
209
  svg: square-rounded-plus
210
- name: toggle-minus
211
  svg: square-rounded-minus
(6-6/8)