Project

General

Profile

Patch #21245 » 0002-Replace-uses-of-image_tag-with-CSS-part-2.patch

Daniel Ritz, 2015-11-16 21:31

View differences:

app/helpers/issues_helper.rb
# 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
app/helpers/journals_helper.rb
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)
app/helpers/watchers_helper.rb
: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
app/views/attachments/_links.html.erb
<div class="attachments">
<div class="contextual">
<%= 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] %>
</div>
<% for attachment in attachments %>
<p><%= 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? %>
<span class="size">(<%= number_to_human_size attachment.filesize %>)</span>
<% 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] %>
<span class="author"><%= attachment.author %>, <%= format_time(attachment.created_on) %></span>
app/views/issues/_attributes.html.erb
<% if @issue.safe_attribute?('category_id') && @issue.project.issue_categories.any? %>
<p><%= 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) %></p>
:tabindex => 200,
:class => 'icon-only icon-add'
) if User.current.allowed_to?(:manage_categories, @issue.project) %></p>
<% end %>
<% if @issue.safe_attribute?('fixed_version_id') && @issue.assignable_versions.any? %>
<p><%= 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) %>
</p>
<% end %>
</div>
app/views/issues/_relations.html.erb
<td class="status"><%= other_issue.status.name %></td>
<td class="start_date"><%= format_date(other_issue.start_date) %></td>
<td class="due_date"><%= format_date(other_issue.due_date) %></td>
<td class="buttons"><%= link_to image_tag('link_break.png'),
<td class="buttons"><%= 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) %></td>
:title => l(:label_relation_delete),
:class => 'icon-only icon-link-break'
) if User.current.allowed_to?(:manage_issue_relations, @project) %></td>
</tr>
<% end %>
</table>
app/views/messages/show.html.erb
<div class="message reply" id="<%= "message-#{message.id}" %>">
<div class="contextual">
<%= 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) %>
</div>
<h4>
app/views/my/blocks/_timelog.html.erb
<td class="hours"><%= html_hours("%.2f" % entry.hours) %></td>
<td class="buttons">
<% 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 -%>
</td>
</tr>
app/views/news/show.html.erb
<% @comments.each do |comment| %>
<% next if comment.new_record? %>
<div class="contextual">
<%= 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' %>
</div>
<h4><%= avatar(comment.author, :size => "24") %><%= authoring comment.created_on, comment.author %></h4>
<%= textilizable(comment.comments) %>
app/views/reports/issue_report.html.erb
<h2><%=l(:label_report_plural)%></h2>
<div class="splitcontentleft">
<h3><%=l(:field_tracker)%>&nbsp;&nbsp;<%= link_to image_tag('zoom_in.png'), project_issues_report_details_path(@project, :detail => 'tracker') %></h3>
<h3>
<%=l(:field_tracker)%>&nbsp;
<%= link_to '', project_issues_report_details_path(@project, :detail => 'tracker'), :class => 'icon-only icon-zoom-in' %>
</h3>
<%= render :partial => 'simple', :locals => { :data => @issues_by_tracker, :field_name => "tracker_id", :rows => @trackers } %>
<br />
<h3><%=l(:field_priority)%>&nbsp;&nbsp;<%= link_to image_tag('zoom_in.png'), project_issues_report_details_path(@project, :detail => 'priority') %></h3>
<h3>
<%=l(:field_priority)%>&nbsp;
<%= link_to '', project_issues_report_details_path(@project, :detail => 'priority'), :class => 'icon-only icon-zoom-in' %>
</h3>
<%= render :partial => 'simple', :locals => { :data => @issues_by_priority, :field_name => "priority_id", :rows => @priorities } %>
<br />
<h3><%=l(:field_assigned_to)%>&nbsp;&nbsp;<%= link_to image_tag('zoom_in.png'), project_issues_report_details_path(@project, :detail => 'assigned_to') %></h3>
<h3>
<%=l(:field_assigned_to)%>&nbsp;
<%= link_to '', project_issues_report_details_path(@project, :detail => 'assigned_to'), :class => 'icon-only icon-zoom-in' %>
</h3>
<%= render :partial => 'simple', :locals => { :data => @issues_by_assigned_to, :field_name => "assigned_to_id", :rows => @assignees } %>
<br />
<h3><%=l(:field_author)%>&nbsp;&nbsp;<%= link_to image_tag('zoom_in.png'), project_issues_report_details_path(@project, :detail => 'author') %></h3>
<h3>
<%=l(:field_author)%>&nbsp;
<%= link_to '', project_issues_report_details_path(@project, :detail => 'author'), :class => 'icon-only icon-zoom-in' %>
</h3>
<%= render :partial => 'simple', :locals => { :data => @issues_by_author, :field_name => "author_id", :rows => @authors } %>
<br />
<%= call_hook(:view_reports_issue_report_split_content_left, :project => @project) %>
</div>
<div class="splitcontentright">
<h3><%=l(:field_version)%>&nbsp;&nbsp;<%= link_to image_tag('zoom_in.png'), project_issues_report_details_path(@project, :detail => 'version') %></h3>
<h3>
<%=l(:field_version)%>&nbsp;
<%= link_to '', project_issues_report_details_path(@project, :detail => 'version'), :class => 'icon-only icon-zoom-in' %>
</h3>
<%= render :partial => 'simple', :locals => { :data => @issues_by_version, :field_name => "fixed_version_id", :rows => @versions } %>
<br />
<% if @project.children.any? %>
<h3><%=l(:field_subproject)%>&nbsp;&nbsp;<%= link_to image_tag('zoom_in.png'), project_issues_report_details_path(@project, :detail => 'subproject') %></h3>
<h3>
<%=l(:field_subproject)%>&nbsp;
<%= link_to '', project_issues_report_details_path(@project, :detail => 'subproject'), :class => 'icon-only icon-zoom-in' %>
</h3>
<%= render :partial => 'simple', :locals => { :data => @issues_by_subproject, :field_name => "project_id", :rows => @subprojects } %>
<br />
<% end %>
<h3><%=l(:field_category)%>&nbsp;&nbsp;<%= link_to image_tag('zoom_in.png'), project_issues_report_details_path(@project, :detail => 'category') %></h3>
<h3>
<%=l(:field_category)%>&nbsp;
<%= link_to '', project_issues_report_details_path(@project, :detail => 'category'), :class => 'icon-only icon-zoom-in' %>
</h3>
<%= render :partial => 'simple', :locals => { :data => @issues_by_category, :field_name => "category_id", :rows => @categories } %>
<br />
<%= call_hook(:view_reports_issue_report_split_content_right, :project => @project) %>
app/views/repositories/_related_issues.html.erb
<ul>
<% @changeset.issues.visible.each do |issue| %>
<li id="<%= "related-issue-#{issue.id}" %>"><%= 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 %>
</li>
<% end %>
</ul>
app/views/timelog/_list.html.erb
<%= raw @query.inline_columns.map {|column| "<td class=\"#{column.css_classes}\">#{column_content(column, entry)}</td>"}.join %>
<td class="buttons">
<% 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 -%>
</td>
</tr>
public/stylesheets/application.css
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;}
......
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; }
......
.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); }
test/functional/issues_controller_test.rb
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
......
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-2/5)