0001-Replace-uses-of-image_tag-with-CSS-part-1-admin.patch

Daniel Ritz, 2015-11-16 21:31

Download (22.7 KB)

View differences:

app/helpers/application_helper.rb
454 454
  end
455 455

  
456 456
  def reorder_links(name, url, method = :post)
457
    link_to(image_tag('2uparrow.png', :alt => l(:label_sort_highest)),
458
            url.merge({"#{name}[move_to]" => 'highest'}),
459
            :method => method, :title => l(:label_sort_highest)) +
460
    link_to(image_tag('1uparrow.png',   :alt => l(:label_sort_higher)),
461
            url.merge({"#{name}[move_to]" => 'higher'}),
462
           :method => method, :title => l(:label_sort_higher)) +
463
    link_to(image_tag('1downarrow.png', :alt => l(:label_sort_lower)),
464
            url.merge({"#{name}[move_to]" => 'lower'}),
465
            :method => method, :title => l(:label_sort_lower)) +
466
    link_to(image_tag('2downarrow.png', :alt => l(:label_sort_lowest)),
467
            url.merge({"#{name}[move_to]" => 'lowest'}),
468
           :method => method, :title => l(:label_sort_lowest))
457
    link_to('',
458
            url.merge({"#{name}[move_to]" => 'highest'}), :method => method,
459
            :title => l(:label_sort_highest), :class => 'icon-only icon-move-top') +
460
    link_to('',
461
            url.merge({"#{name}[move_to]" => 'higher'}), :method => method,
462
            :title => l(:label_sort_higher), :class => 'icon-only icon-move-up') +
463
    link_to('',
464
            url.merge({"#{name}[move_to]" => 'lower'}), :method => method,
465
            :title => l(:label_sort_lower), :class => 'icon-only icon-move-down') +
466
    link_to('',
467
            url.merge({"#{name}[move_to]" => 'lowest'}), :method => method,
468
            :title => l(:label_sort_lowest), :class => 'icon-only icon-move-bottom')
469 469
  end
470 470

  
471 471
  def breadcrumb(*args)
......
887 887
      @current_section += 1
888 888
      if @current_section > 1
889 889
        content_tag('div',
890
          link_to(image_tag('edit.png'), options[:edit_section_links].merge(:section => @current_section)),
890
          link_to('', options[:edit_section_links].merge(:section => @current_section),
891
                  :class => 'icon-only icon-edit'),
891 892
          :class => 'contextual',
892 893
          :title => l(:button_edit_section),
893 894
          :id => "section-#{@current_section}") + heading.html_safe
......
1098 1099
  end
1099 1100

  
1100 1101
  def toggle_checkboxes_link(selector)
1101
    link_to_function image_tag('toggle_check.png'),
1102
    link_to_function '',
1102 1103
      "toggleCheckboxesBySelector('#{selector}')",
1103
      :title => "#{l(:button_check_all)} / #{l(:button_uncheck_all)}"
1104
      :title => "#{l(:button_check_all)} / #{l(:button_uncheck_all)}",
1105
      :class => 'toggle-checkboxes'
1104 1106
  end
1105 1107

  
1106 1108
  def progress_bar(pcts, options={})
......
1120 1122

  
1121 1123
  def checked_image(checked=true)
1122 1124
    if checked
1123
      @checked_image_tag ||= image_tag('toggle_check.png')
1125
      @checked_image_tag ||= content_tag(:span, nil, :class => 'icon-only icon-checked')
1124 1126
    end
1125 1127
  end
1126 1128

  
app/helpers/email_addresses_helper.rb
22 22
  # Returns a link to enable or disable notifications for the address
23 23
  def toggle_email_address_notify_link(address)
24 24
    if address.notify?
25
      link_to image_tag('email.png'),
25
      link_to '',
26 26
        user_email_address_path(address.user, address, :notify => '0'),
27
        :method => :put,
27
        :method => :put, :remote => true,
28 28
        :title => l(:label_disable_notifications),
29
        :remote => true
29
        :class => 'icon icon-email'
30 30
    else
31
      link_to image_tag('email_disabled.png'),
31
      link_to '',
32 32
        user_email_address_path(address.user, address, :notify => '1'),
33
        :method => :put,
33
        :method => :put, :remote => true,
34 34
        :title => l(:label_enable_notifications),
35
        :remote => true
35
        :class => 'icon icon-email-disabled'
36 36
    end
37 37
  end
38 38
end
app/views/admin/info.html.erb
6 6
<% @checklist.each do |label, result| %>
7 7
  <tr class="<%= cycle 'odd', 'even' %>">
8 8
    <td class="name"><%= label.is_a?(Symbol) ? l(label) : label %></td>
9
    <td class="tick"><%= image_tag((result ? 'true.png' : 'exclamation.png'),
10
                                    :style => "vertical-align:bottom;") %></td>
9
    <td class="tick"><span class="icon-only <%= (result ? 'icon-ok' : 'icon-error') %>"></span></td>
11 10
  </tr>
12 11
<% end %>
13 12
</table>
app/views/admin/plugins.html.erb
36 36
        $("table.plugins td.version span").addClass("unknown");
37 37
        $.each(data, function(plugin_id, plugin_data){
38 38
          var s = $("tr#plugin-"+plugin_id+" td.version span");
39
          s.removeClass("icon-checked icon-warning unknown");
39
          s.removeClass("icon-ok icon-warning unknown");
40 40
          if (plugin_data.url) {
41 41
            if (s.parent("a").length>0) {
42 42
              s.unwrap();
......
45 45
            s.wrap($("<a></a>").attr("href", plugin_data.url).attr("target", "_blank"));
46 46
          }
47 47
          if (plugin_data.c == s.text()) {
48
            s.addClass("icon-checked");
48
            s.addClass("icon-ok");
49 49
          } else if (plugin_data.c) {
50 50
            s.addClass("icon-warning");
51 51
            s.attr("title", "<%= escape_javascript l(:label_latest_compatible_version) %>: "+plugin_data.c);
app/views/roles/permissions.html.erb
9 9
    <th><%=l(:label_permissions)%></th>
10 10
    <% @roles.each do |role| %>
11 11
    <th>
12
        <%= link_to_function('',
13
                             "toggleCheckboxesBySelector('input.role-#{role.id}')",
14
                             :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
15
                             :class => 'icon-only icon-checked') %>
12 16
        <%= content_tag(role.builtin? ? 'em' : 'span', role.name) %>
13
        <%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('input.role-#{role.id}')",
14
                                                            :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
15 17
    </th>
16 18
    <% end %>
17 19
    </tr>
......
33 35
    <% perms_by_module[mod].each do |permission| %>
34 36
        <tr class="<%= cycle('odd', 'even') %> permission-<%= permission.name %>">
35 37
        <td class="name">
36
            <%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('.permission-#{permission.name} input')",
37
                                                                :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
38
            <%= link_to_function('',
39
                                 "toggleCheckboxesBySelector('.permission-#{permission.name} input')",
40
                                 :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
41
                                 :class => 'icon-only icon-checked') %>
38 42
            <%= l_or_humanize(permission.name, :prefix => 'permission_') %>
39 43
        </td>
40 44
        <% @roles.each do |role| %>
app/views/settings/_repositories.html.erb
23 23
      </td>
24 24
      <td>
25 25
        <% if enabled %>
26
          <%=
27
            image_tag(
28
              (scm_class.scm_available ? 'true.png' : 'exclamation.png'),
29
              :style => "vertical-align:bottom;"
30
            )
31
           %>
26
          <span class="icon <%= (scm_class.scm_available ? 'icon-ok' : 'icon-error') %>"></span>
32 27
          <%= scm_class.scm_command %>
33 28
        <% end %>
34 29
      </td>
......
124 119
                    ) %>
125 120
      </td>
126 121
      <td class="buttons">
127
        <%= link_to(image_tag('delete.png'), '#', :class => 'delete-commit-keywords') %>
122
        <%= link_to('', '#',
123
                    :class => 'delete-commit-keywords icon-only icon-del') %>
128 124
      </td>
129 125
    </tr>
130 126
    <% end %>
......
133 129
      <td><em class="info"><%= l(:text_comma_separated) %></em></td>
134 130
      <td></td>
135 131
      <td></td>
136
      <td class="buttons"><%= link_to(image_tag('add.png'), '#', :class => 'add-commit-keywords') %></td>
132
      <td class="buttons">
133
        <%= link_to('', '#',
134
                    :class => 'add-commit-keywords icon-only icon-add') %>
135
      </td>
137 136
    </tr>
138 137
  </tbody>
139 138
</table>
app/views/trackers/fields.html.erb
9 9
        <th></th>
10 10
        <% @trackers.each do |tracker| %>
11 11
        <th>
12
          <%= link_to_function('', "toggleCheckboxesBySelector('input.tracker-#{tracker.id}')",
13
                               :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
14
                               :class => 'icon-only icon-checked') %>
12 15
          <%= tracker.name %>
13
          <%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('input.tracker-#{tracker.id}')",
14
                                                              :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
15 16
        </th>
16 17
        <% end %>
17 18
      </tr>
......
26 27
      <% Tracker::CORE_FIELDS.each do |field| %>
27 28
      <tr class="<%= cycle("odd", "even") %>">
28 29
        <td class="name">
29
          <%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('input.core-field-#{field}')",
30
                                                              :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
30
          <%= link_to_function('', "toggleCheckboxesBySelector('input.core-field-#{field}')",
31
                               :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
32
                               :class => 'icon-only icon-checked') %>
31 33
          <%= l("field_#{field}".sub(/_id$/, '')) %>
32 34
        </td>
33 35
        <% @trackers.each do |tracker| %>
......
48 50
        <% @custom_fields.each do |field| %>
49 51
        <tr class="<%= cycle("odd", "even") %>">
50 52
          <td class="name">
51
            <%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('input.custom-field-#{field.id}')",
52
                                                                :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
53
            <%= link_to_function('', "toggleCheckboxesBySelector('input.custom-field-#{field.id}')",
54
                                 :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
55
                                 :class => 'icon-only icon-checked') %>
53 56
            <%= field.name %>
54 57
          </td>
55 58
          <% @trackers.each do |tracker| %>
app/views/workflows/_form.html.erb
2 2
<thead>
3 3
  <tr>
4 4
    <th>
5
      <%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('table.transitions-#{name} input')",
6
                                                          :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
5
      <%= link_to_function('', "toggleCheckboxesBySelector('table.transitions-#{name} input')",
6
                           :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
7
                           :class => 'icon-only icon-checked') %>
7 8
      <%=l(:label_current_status)%>
8 9
    </th>
9 10
    <th colspan="<%= @statuses.length %>"><%=l(:label_new_statuses_allowed)%></th>
......
12 13
    <td></td>
13 14
    <% for new_status in @statuses %>
14 15
    <td style="width:<%= 75 / @statuses.size %>%;">
15
      <%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('table.transitions-#{name} input.new-status-#{new_status.id}')",
16
                                                      :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
16
      <%= link_to_function('', "toggleCheckboxesBySelector('table.transitions-#{name} input.new-status-#{new_status.id}')",
17
                           :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
18
                           :class => 'icon-only icon-checked') %>
17 19
      <%= new_status.name %>
18 20
    </td>
19 21
    <% end %>
......
24 26
  <% next if old_status.nil? && name != 'always' %>
25 27
  <tr class="<%= cycle("odd", "even") %>">
26 28
    <td class="name">
27
      <%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('table.transitions-#{name} input.old-status-#{old_status.try(:id) || 0}')",
28
                                                          :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
29
      <%= link_to_function('', "toggleCheckboxesBySelector('table.transitions-#{name} input.old-status-#{old_status.try(:id) || 0}')",
30
                           :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}",
31
                           :class => 'icon-only icon-checked') %>
29 32

  
30 33
      <%= old_status ? old_status.name : content_tag('em', l(:label_issue_new)) %>
31 34
    </td>
app/views/workflows/edit.html.erb
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 18
  </label>
19
  <a href="#" data-expands="#role_id"><%= image_tag 'bullet_toggle_plus.png' %></a>
19
  <a href="#" data-expands="#role_id"><span class="toggle-multiselect"></span></a>
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 23
  </label>
24
  <a href="#" data-expands="#tracker_id"><%= image_tag 'bullet_toggle_plus.png' %></a>
24
  <a href="#" data-expands="#tracker_id"><span class="toggle-multiselect"></span></a>
25 25

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

  
app/views/workflows/index.html.erb
22 22
  <% @roles.each do |role| -%>
23 23
  <% count = @workflow_counts[[tracker.id, role.id]] || 0 %>
24 24
    <td>
25
      <%= link_to((count > 0 ? count : image_tag('false.png')), {:action => 'edit', :role_id => role, :tracker_id => tracker}, :title => l(:button_edit)) %>
25
      <%= link_to((count > 0 ? count : content_tag(:span, nil, :class => 'icon-only icon-not-ok')),
26
                  {:action => 'edit', :role_id => role, :tracker_id => tracker},
27
                  :title => l(:button_edit)) %>
26 28
    </td>
27 29
  <% end -%>
28 30
</tr>
app/views/workflows/permissions.html.erb
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 18
  </label>
19
  <a href="#" data-expands="#role_id"><%= image_tag 'bullet_toggle_plus.png' %></a>
19
  <a href="#" data-expands="#role_id"><span class="toggle-multiselect"></a>
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 23
  </label>
24
  <a href="#" data-expands="#tracker_id"><%= image_tag 'bullet_toggle_plus.png' %></a>
24
  <a href="#" data-expands="#tracker_id"><span class="toggle-multiselect"></a>
25 25

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

  
public/stylesheets/application.css
124 124
a.collapsible.collapsed {background: url(../images/arrow_collapsed.png) no-repeat -5px 40%;}
125 125

  
126 126
a#toggle-completed-versions {color:#999;}
127

  
128
a.toggle-checkboxes { margin-left: 5px; padding-left: 12px; background: url(../images/toggle_check.png) no-repeat 0% 50%; }
129

  
127 130
/***** Tables *****/
128 131
table.list { border: 1px solid #e4e4e4;  border-collapse: collapse; width: 100%; margin-bottom: 4px; }
129 132
table.list th {  background-color:#EEEEEE; padding: 4px; white-space:nowrap; }
......
382 385
.add-filter {width:35%; float:right; text-align: right; vertical-align: top;}
383 386

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

  
388 391
div#issue-changesets {float:right; width:45%; margin-left: 1em; margin-bottom: 1em; background: #fff; padding-left: 1em; font-size: 90%;}
......
1038 1041
  padding-top: 2px;
1039 1042
  padding-bottom: 3px;
1040 1043
}
1044
.icon-only {
1045
  background-position: 0% 50%;
1046
  background-repeat: no-repeat;
1047
  padding-left: 16px;
1048
}
1041 1049

  
1042 1050
.icon-add { background-image: url(../images/add.png); }
1043 1051
.icon-edit { background-image: url(../images/edit.png); }
......
1060 1068
.icon-time-add  { background-image: url(../images/time_add.png); }
1061 1069
.icon-stats  { background-image: url(../images/stats.png); }
1062 1070
.icon-warning  { background-image: url(../images/warning.png); }
1071
.icon-error { background-image: url(../images/exclamation.png); }
1063 1072
.icon-fav  { background-image: url(../images/fav.png); }
1064 1073
.icon-fav-off  { background-image: url(../images/fav_off.png); }
1065 1074
.icon-reload  { background-image: url(../images/reload.png); }
1066 1075
.icon-lock  { background-image: url(../images/locked.png); }
1067 1076
.icon-unlock  { background-image: url(../images/unlock.png); }
1068
.icon-checked  { background-image: url(../images/true.png); }
1077
.icon-checked  { background-image: url(../images/toggle_check.png); }
1069 1078
.icon-details  { background-image: url(../images/zoom_in.png); }
1070 1079
.icon-report  { background-image: url(../images/report.png); }
1071 1080
.icon-comment  { background-image: url(../images/comment.png); }
......
1076 1085
.icon-zoom-out { background-image: url(../images/zoom_out.png); }
1077 1086
.icon-passwd { background-image: url(../images/textfield_key.png); }
1078 1087
.icon-test { background-image: url(../images/bullet_go.png); }
1088
.icon-email { background-image: url(../images/email.png); }
1089
.icon-email-disabled { background-image: url(../images/email_disabled.png); }
1079 1090
.icon-email-add { background-image: url(../images/email_add.png); }
1091
.icon-move-up { background-image: url(../images/1uparrow.png); }
1092
.icon-move-top { background-image: url(../images/2uparrow.png); }
1093
.icon-move-down { background-image: url(../images/1downarrow.png); }
1094
.icon-move-bottom { background-image: url(../images/2downarrow.png); }
1095
.icon-ok  { background-image: url(../images/true.png); }
1096
.icon-not-ok  { background-image: url(../images/false.png); }
1080 1097

  
1081 1098
.icon-file { background-image: url(../images/files/default.png); }
1082 1099
.icon-file.text-plain { background-image: url(../images/files/text.png); }
test/unit/helpers/application_helper_test.rb
1243 1243

  
1244 1244
    # heading that contains inline code
1245 1245
    assert_match Regexp.new('<div class="contextual" title="Edit this section" id="section-4">' +
1246
      '<a href="/projects/1/wiki/Test/edit\?section=4"><img src="/images/edit.png(\?\d+)?" alt="Edit" /></a></div>' +
1246
      '<a class="icon-only icon-edit" href="/projects/1/wiki/Test/edit\?section=4"></a></div>' +
1247 1247
      '<a name="Subtitle-with-inline-code"></a>' +
1248 1248
      '<h2 >Subtitle with <code>inline code</code><a href="#Subtitle-with-inline-code" class="wiki-anchor">&para;</a></h2>'),
1249 1249
      result
1250 1250

  
1251 1251
    # last heading
1252 1252
    assert_match Regexp.new('<div class="contextual" title="Edit this section" id="section-5">' +
1253
      '<a href="/projects/1/wiki/Test/edit\?section=5"><img src="/images/edit.png(\?\d+)?" alt="Edit" /></a></div>' +
1253
      '<a class="icon-only icon-edit" href="/projects/1/wiki/Test/edit\?section=5"></a></div>' +
1254 1254
      '<a name="Subtitle-after-pre-tag"></a>' +
1255 1255
      '<h2 >Subtitle after pre tag<a href="#Subtitle-after-pre-tag" class="wiki-anchor">&para;</a></h2>'),
1256 1256
      result
1257
-