From 7e7a0458d6397d25ec393df0fef5bf190ff489a8 Mon Sep 17 00:00:00 2001 From: Daniel Ritz Date: Mon, 16 Nov 2015 18:30:49 +0100 Subject: [PATCH 2/5] Replace uses of image_tag() with CSS, part 2 --- app/helpers/issues_helper.rb | 9 +++---- app/helpers/journals_helper.rb | 12 ++++++--- app/helpers/watchers_helper.rb | 6 +++-- app/views/attachments/_links.html.erb | 26 ++++++++++-------- app/views/issues/_attributes.html.erb | 12 ++++++--- app/views/issues/_relations.html.erb | 6 +++-- app/views/messages/show.html.erb | 16 ++++++----- app/views/my/blocks/_timelog.html.erb | 13 ++++----- app/views/news/show.html.erb | 6 +++-- app/views/reports/issue_report.html.erb | 35 ++++++++++++++++++++----- app/views/repositories/_related_issues.html.erb | 6 +++-- app/views/timelog/_list.html.erb | 14 +++++----- public/stylesheets/application.css | 11 +++++--- test/functional/issues_controller_test.rb | 4 +-- 14 files changed, 114 insertions(+), 62 deletions(-) diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 497bea3..9d123ca 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -442,11 +442,10 @@ module IssuesHelper # Link to the attachment if it has not been removed value = link_to_attachment(atta, :download => true, :only_path => options[:only_path]) if options[:only_path] != false && atta.is_text? - value += link_to( - image_tag('magnifier.png'), - :controller => 'attachments', :action => 'show', - :id => atta, :filename => atta.filename - ) + value += link_to('', + { :controller => 'attachments', :action => 'show', + :id => atta, :filename => atta.filename }, + :class => 'icon icon-magnifier') end else value = content_tag("i", h(value)) if value diff --git a/app/helpers/journals_helper.rb b/app/helpers/journals_helper.rb index d6d6ec4..4e9fd38 100644 --- a/app/helpers/journals_helper.rb +++ b/app/helpers/journals_helper.rb @@ -30,14 +30,18 @@ module JournalsHelper editable = User.current.logged? && (User.current.allowed_to?(:edit_issue_notes, issue.project) || (journal.user == User.current && User.current.allowed_to?(:edit_own_issue_notes, issue.project))) links = [] if !journal.notes.blank? - links << link_to(image_tag('comment.png'), + links << link_to('', {:controller => 'journals', :action => 'new', :id => issue, :journal_id => journal}, :remote => true, :method => 'post', - :title => l(:button_quote)) if options[:reply_links] - links << link_to_in_place_notes_editor(image_tag('edit.png'), "journal-#{journal.id}-notes", + :title => l(:button_quote), + :class => 'icon-only icon-comment' + ) if options[:reply_links] + links << link_to_in_place_notes_editor('', "journal-#{journal.id}-notes", { :controller => 'journals', :action => 'edit', :id => journal, :format => 'js' }, - :title => l(:button_edit)) if editable + :title => l(:button_edit), + :class => 'icon-only icon-edit' + ) if editable end content << content_tag('div', links.join(' ').html_safe, :class => 'contextual') unless links.empty? content << textilizable(journal, :notes) diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index 4bf6424..9a5de74 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -58,8 +58,10 @@ module WatchersHelper :object_id => object.id, :user_id => user} s << ' ' - s << link_to(image_tag('delete.png'), url, - :remote => true, :method => 'delete', :class => "delete") + s << link_to('', url, + :remote => true, :method => 'delete', + :class => "delete icon-only icon-del", + :title => l(:button_delete)) end content << content_tag('li', s, :class => "user-#{user.id}") end diff --git a/app/views/attachments/_links.html.erb b/app/views/attachments/_links.html.erb index 0804b80..53324c2 100644 --- a/app/views/attachments/_links.html.erb +++ b/app/views/attachments/_links.html.erb @@ -1,24 +1,28 @@
- <%= link_to image_tag('edit.png'), - container_attachments_edit_path(container), - :title => l(:label_edit_attachments) if options[:editable] %> + <%= link_to('', + container_attachments_edit_path(container), + :title => l(:label_edit_attachments), + :class => 'icon-only icon-edit' + ) if options[:editable] %>
<% for attachment in attachments %>

<%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%> <% if attachment.is_text? %> - <%= link_to image_tag('magnifier.png'), - :controller => 'attachments', :action => 'show', - :id => attachment, :filename => attachment.filename %> + <%= link_to '', + { :controller => 'attachments', :action => 'show', + :id => attachment, :filename => attachment.filename }, + :class => 'icon icon-magnifier', + :title => l(:button_view) %> <% end %> <%= " - #{attachment.description}" unless attachment.description.blank? %> (<%= number_to_human_size attachment.filesize %>) <% if options[:deletable] %> - <%= link_to image_tag('delete.png'), attachment_path(attachment), - :data => {:confirm => l(:text_are_you_sure)}, - :method => :delete, - :class => 'delete', - :title => l(:button_delete) %> + <%= link_to '', attachment_path(attachment), + :data => {:confirm => l(:text_are_you_sure)}, + :method => :delete, + :class => 'delete icon-only icon-del', + :title => l(:button_delete) %> <% end %> <% if options[:author] %> <%= attachment.author %>, <%= format_time(attachment.created_on) %> diff --git a/app/views/issues/_attributes.html.erb b/app/views/issues/_attributes.html.erb index 4ec2f81..2a54ed9 100644 --- a/app/views/issues/_attributes.html.erb +++ b/app/views/issues/_attributes.html.erb @@ -20,22 +20,26 @@ <% if @issue.safe_attribute?('category_id') && @issue.project.issue_categories.any? %>

<%= f.select :category_id, (@issue.project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true, :required => @issue.required_attribute?('category_id') %> -<%= link_to(image_tag('add.png', :style => 'vertical-align: middle;'), +<%= link_to('', new_project_issue_category_path(@issue.project), :remote => true, :method => 'get', :title => l(:label_issue_category_new), - :tabindex => 200) if User.current.allowed_to?(:manage_categories, @issue.project) %>

+ :tabindex => 200, + :class => 'icon-only icon-add' + ) if User.current.allowed_to?(:manage_categories, @issue.project) %>

<% end %> <% if @issue.safe_attribute?('fixed_version_id') && @issue.assignable_versions.any? %>

<%= f.select :fixed_version_id, version_options_for_select(@issue.assignable_versions, @issue.fixed_version), :include_blank => true, :required => @issue.required_attribute?('fixed_version_id') %> -<%= link_to(image_tag('add.png', :style => 'vertical-align: middle;'), +<%= link_to('', new_project_version_path(@issue.project), :remote => true, :method => 'get', :title => l(:label_version_new), - :tabindex => 200) if User.current.allowed_to?(:manage_versions, @issue.project) %> + :tabindex => 200, + :class => 'icon-only icon-add' + ) if User.current.allowed_to?(:manage_versions, @issue.project) %>

<% end %>
diff --git a/app/views/issues/_relations.html.erb b/app/views/issues/_relations.html.erb index d3e7f4d..e57669c 100644 --- a/app/views/issues/_relations.html.erb +++ b/app/views/issues/_relations.html.erb @@ -19,12 +19,14 @@ <%= other_issue.status.name %> <%= format_date(other_issue.start_date) %> <%= format_date(other_issue.due_date) %> - <%= link_to image_tag('link_break.png'), + <%= link_to('', relation_path(relation), :remote => true, :method => :delete, :data => {:confirm => l(:text_are_you_sure)}, - :title => l(:label_relation_delete) if User.current.allowed_to?(:manage_issue_relations, @project) %> + :title => l(:label_relation_delete), + :class => 'icon-only icon-link-break' + ) if User.current.allowed_to?(:manage_issue_relations, @project) %> <% end %> diff --git a/app/views/messages/show.html.erb b/app/views/messages/show.html.erb index 533be20..af59845 100644 --- a/app/views/messages/show.html.erb +++ b/app/views/messages/show.html.erb @@ -39,22 +39,26 @@
">
<%= link_to( - image_tag('comment.png'), + '', {:action => 'quote', :id => message}, :remote => true, :method => 'get', - :title => l(:button_quote)) if !@topic.locked? && authorize_for('messages', 'reply') %> + :title => l(:button_quote), + :class => 'icon icon-comment' + ) if !@topic.locked? && authorize_for('messages', 'reply') %> <%= link_to( - image_tag('edit.png'), + '', {:action => 'edit', :id => message}, - :title => l(:button_edit) + :title => l(:button_edit), + :class => 'icon icon-edit' ) if message.editable_by?(User.current) %> <%= link_to( - image_tag('delete.png'), + '', {:action => 'destroy', :id => message}, :method => :post, :data => {:confirm => l(:text_are_you_sure)}, - :title => l(:button_delete) + :title => l(:button_delete), + :class => 'icon icon-del' ) if message.destroyable_by?(User.current) %>

diff --git a/app/views/my/blocks/_timelog.html.erb b/app/views/my/blocks/_timelog.html.erb index 747039c..76b974e 100644 --- a/app/views/my/blocks/_timelog.html.erb +++ b/app/views/my/blocks/_timelog.html.erb @@ -42,12 +42,13 @@ entries_by_day = entries.group_by(&:spent_on) <%= html_hours("%.2f" % entry.hours) %> <% if entry.editable_by?(@user) -%> - <%= link_to image_tag('edit.png'), {:controller => 'timelog', :action => 'edit', :id => entry}, - :title => l(:button_edit) %> - <%= link_to image_tag('delete.png'), {:controller => 'timelog', :action => 'destroy', :id => entry}, - :data => {:confirm => l(:text_are_you_sure)}, - :method => :delete, - :title => l(:button_delete) %> + <%= link_to '', {:controller => 'timelog', :action => 'edit', :id => entry}, + :title => l(:button_edit), + :class => 'icon-only icon-edit' %> + <%= link_to '', {:controller => 'timelog', :action => 'destroy', :id => entry}, + :data => {:confirm => l(:text_are_you_sure)}, :method => :delete, + :title => l(:button_delete), + :class => 'icon-only icon-del' %> <% end -%> diff --git a/app/views/news/show.html.erb b/app/views/news/show.html.erb index c188d2e..008a075 100644 --- a/app/views/news/show.html.erb +++ b/app/views/news/show.html.erb @@ -36,8 +36,10 @@ <% @comments.each do |comment| %> <% next if comment.new_record? %>
- <%= link_to_if_authorized image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment}, - :data => {:confirm => l(:text_are_you_sure)}, :method => :delete, :title => l(:button_delete) %> + <%= link_to_if_authorized '', {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment}, + :data => {:confirm => l(:text_are_you_sure)}, :method => :delete, + :title => l(:button_delete), + :class => 'icon-only icon-del' %>

<%= avatar(comment.author, :size => "24") %><%= authoring comment.created_on, comment.author %>

<%= textilizable(comment.comments) %> diff --git a/app/views/reports/issue_report.html.erb b/app/views/reports/issue_report.html.erb index d40841d..1cb3ccd 100644 --- a/app/views/reports/issue_report.html.erb +++ b/app/views/reports/issue_report.html.erb @@ -1,31 +1,52 @@

<%=l(:label_report_plural)%>

-

<%=l(:field_tracker)%>  <%= link_to image_tag('zoom_in.png'), project_issues_report_details_path(@project, :detail => 'tracker') %>

+

+ <%=l(:field_tracker)%>  + <%= link_to '', project_issues_report_details_path(@project, :detail => 'tracker'), :class => 'icon-only icon-zoom-in' %> +

<%= render :partial => 'simple', :locals => { :data => @issues_by_tracker, :field_name => "tracker_id", :rows => @trackers } %>
-

<%=l(:field_priority)%>  <%= link_to image_tag('zoom_in.png'), project_issues_report_details_path(@project, :detail => 'priority') %>

+

+ <%=l(:field_priority)%>  + <%= link_to '', project_issues_report_details_path(@project, :detail => 'priority'), :class => 'icon-only icon-zoom-in' %> +

<%= render :partial => 'simple', :locals => { :data => @issues_by_priority, :field_name => "priority_id", :rows => @priorities } %>
-

<%=l(:field_assigned_to)%>  <%= link_to image_tag('zoom_in.png'), project_issues_report_details_path(@project, :detail => 'assigned_to') %>

+

+ <%=l(:field_assigned_to)%>  + <%= link_to '', project_issues_report_details_path(@project, :detail => 'assigned_to'), :class => 'icon-only icon-zoom-in' %> +

<%= render :partial => 'simple', :locals => { :data => @issues_by_assigned_to, :field_name => "assigned_to_id", :rows => @assignees } %>
-

<%=l(:field_author)%>  <%= link_to image_tag('zoom_in.png'), project_issues_report_details_path(@project, :detail => 'author') %>

+

+ <%=l(:field_author)%>  + <%= link_to '', project_issues_report_details_path(@project, :detail => 'author'), :class => 'icon-only icon-zoom-in' %> +

<%= render :partial => 'simple', :locals => { :data => @issues_by_author, :field_name => "author_id", :rows => @authors } %>
<%= call_hook(:view_reports_issue_report_split_content_left, :project => @project) %>
-

<%=l(:field_version)%>  <%= link_to image_tag('zoom_in.png'), project_issues_report_details_path(@project, :detail => 'version') %>

+

+ <%=l(:field_version)%>  + <%= link_to '', project_issues_report_details_path(@project, :detail => 'version'), :class => 'icon-only icon-zoom-in' %> +

<%= render :partial => 'simple', :locals => { :data => @issues_by_version, :field_name => "fixed_version_id", :rows => @versions } %>
<% if @project.children.any? %> -

<%=l(:field_subproject)%>  <%= link_to image_tag('zoom_in.png'), project_issues_report_details_path(@project, :detail => 'subproject') %>

+

+ <%=l(:field_subproject)%>  + <%= link_to '', project_issues_report_details_path(@project, :detail => 'subproject'), :class => 'icon-only icon-zoom-in' %> +

<%= render :partial => 'simple', :locals => { :data => @issues_by_subproject, :field_name => "project_id", :rows => @subprojects } %>
<% end %> -

<%=l(:field_category)%>  <%= link_to image_tag('zoom_in.png'), project_issues_report_details_path(@project, :detail => 'category') %>

+

+ <%=l(:field_category)%>  + <%= link_to '', project_issues_report_details_path(@project, :detail => 'category'), :class => 'icon-only icon-zoom-in' %> +

<%= render :partial => 'simple', :locals => { :data => @issues_by_category, :field_name => "category_id", :rows => @categories } %>
<%= call_hook(:view_reports_issue_report_split_content_right, :project => @project) %> diff --git a/app/views/repositories/_related_issues.html.erb b/app/views/repositories/_related_issues.html.erb index 649cc70..ea45391 100644 --- a/app/views/repositories/_related_issues.html.erb +++ b/app/views/repositories/_related_issues.html.erb @@ -11,14 +11,16 @@
    <% @changeset.issues.visible.each do |issue| %>
  • "><%= link_to_issue issue %> - <%= link_to(image_tag('link_break.png'), + <%= link_to('', {:controller => 'repositories', :action => 'remove_related_issue', :id => @project, :repository_id => @repository.identifier_param, :rev => @changeset.identifier, :issue_id => issue}, :remote => true, :method => :delete, :data => {:confirm => l(:text_are_you_sure)}, - :title => l(:label_relation_delete)) if manage_allowed %> + :title => l(:label_relation_delete), + :class => 'icon-only icon-link-break' + ) if manage_allowed %>
  • <% end %>
diff --git a/app/views/timelog/_list.html.erb b/app/views/timelog/_list.html.erb index 7ec60cd..df497d4 100644 --- a/app/views/timelog/_list.html.erb +++ b/app/views/timelog/_list.html.erb @@ -21,12 +21,14 @@ <%= raw @query.inline_columns.map {|column| "#{column_content(column, entry)}"}.join %> <% if entry.editable_by?(User.current) -%> - <%= link_to image_tag('edit.png'), edit_time_entry_path(entry), - :title => l(:button_edit) %> - <%= link_to image_tag('delete.png'), time_entry_path(entry), - :data => {:confirm => l(:text_are_you_sure)}, - :method => :delete, - :title => l(:button_delete) %> + <%= link_to '', edit_time_entry_path(entry), + :title => l(:button_edit), + :class => 'icon icon-edit' %> + <%= link_to '', time_entry_path(entry), + :data => {:confirm => l(:text_are_you_sure)}, + :method => :delete, + :title => l(:button_delete), + :class => 'icon-only icon-del' %> <% end -%> diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 47c0853..3e1b6f1 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -294,7 +294,7 @@ div.news h3 { background: url(../images/news.png) no-repeat 0% 50%; padding-left div.projects h3 { background: url(../images/projects.png) no-repeat 0% 50%; padding-left: 20px; } #watchers select {width: 95%; display: block;} -#watchers a.delete {opacity: 0.4; vertical-align: middle;} +#watchers a.delete {opacity: 0.4; margin-left: 5px;} #watchers a.delete:hover {opacity: 1;} #watchers img.gravatar {margin: 0 4px 2px 0;} @@ -455,6 +455,7 @@ div.wiki-page .contextual a {opacity: 0.4} div.wiki-page .contextual a:hover {opacity: 1} form .attributes select { width: 60%; } +form .attributes select + a.icon-only { vertical-align: middle; margin-left: 4px; } input#issue_subject, input#document_title { width: 99%; } select#issue_done_ratio { width: 95px; } @@ -1092,8 +1093,12 @@ a.close-icon:hover {background-image:url('../images/close_hl.png');} .icon-move-top { background-image: url(../images/2uparrow.png); } .icon-move-down { background-image: url(../images/1downarrow.png); } .icon-move-bottom { background-image: url(../images/2downarrow.png); } -.icon-ok { background-image: url(../images/true.png); } -.icon-not-ok { background-image: url(../images/false.png); } +.icon-ok { background-image: url(../images/true.png); } +.icon-not-ok { background-image: url(../images/false.png); } +.icon-magnifier { background-image: url(../images/magnifier.png); } +.icon-zoom-in { background-image: url(../images/zoom_in.png); } +.icon-zoom-out { background-image: url(../images/zoom_out.png); } +.icon-link-break { background-image: url(../images/link_break.png); } .icon-file { background-image: url(../images/files/default.png); } .icon-file.text-plain { background-image: url(../images/files/text.png); } diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index b52648f..108892b 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -1424,7 +1424,7 @@ class IssuesControllerTest < ActionController::TestCase assert_select 'div#watchers ul' do assert_select 'li' do assert_select 'a[href="/users/2"]' - assert_select 'a img[alt=Delete]' + assert_select 'a[class*=delete]' end end end @@ -1441,7 +1441,7 @@ class IssuesControllerTest < ActionController::TestCase assert_select 'li' do assert_select 'img.gravatar' assert_select 'a[href="/users/2"]' - assert_select 'a img[alt=Delete]' + assert_select 'a[class*=delete]' end end end -- 2.6.2