Don't use link_to/image_tag where not needed

In these particular instances we can just use HAML tags directly. This
can shave off some time spent loading issue pages, though this depends
on the amount of comments being displayed.

When viewing https://gitlab.com/gitlab-org/gitlab-ce/issues/2164 locally
these changes reduce loading time by about 400 ms in total.
This commit is contained in:
Yorick Peterse 2015-10-14 16:03:22 +02:00
parent 3025b71141
commit f3980e230f
3 changed files with 8 additions and 8 deletions

View file

@ -2,10 +2,10 @@
.md-header.clearfix
%ul.center-top-menu
%li.active
= link_to '#md-write-holder', class: 'js-md-write-button', tabindex: '-1' do
%a.js-md-write-button(href="#md-write-holder" tabindex="-1")
Write
%li
= link_to '#md-preview-holder', class: 'js-md-preview-button', tabindex: '-1' do
%a.js-md-preview-button(href="md-preview-holder" tabindex="-1")
Preview
- if defined?(referenced_users) && referenced_users

View file

@ -1,10 +1,10 @@
.zennable
%input#zen-toggle-comment.zen-toggle-comment{ tabindex: '-1', type: 'checkbox' }
%input#zen-toggle-comment.zen-toggle-comment(tabindex="-1" type="checkbox")
.zen-backdrop
- classes << ' js-gfm-input markdown-area'
= f.text_area attr, class: classes, placeholder: ''
= link_to nil, class: 'zen-enter-link', tabindex: '-1' do
%a.zen-enter-link(tabindex="-1" href="#")
%i.fa.fa-expand
Edit in fullscreen
= link_to nil, class: 'zen-leave-link' do
%a.zen-leave-link(href="#")
%i.fa.fa-compress

View file

@ -1,8 +1,8 @@
%li.timeline-entry{ id: dom_id(note), class: [dom_class(note), "note-row-#{note.id}", ('system-note' if note.system)], data: { discussion: note.discussion_id } }
.timeline-entry-inner
.timeline-icon
= link_to user_path(note.author) do
= image_tag avatar_icon(note.author), class: 'avatar s40', alt: ''
%a{href: user_path(note.author)}
%img.avatar.s40{src: avatar_icon(note.author), alt: ''}
.timeline-content
.note-header
- if note_editable?(note)
@ -25,7 +25,7 @@
= '@' + note.author.username
%span.note-last-update
= link_to "##{dom_id(note)}", name: dom_id(note), title: "Link here" do
%a{name: dom_id(note), href: "##{dom_id(note)}", title: 'Link here'}
= time_ago_with_tooltip(note.created_at, placement: 'bottom', html_class: 'note_created_ago')
- if note.updated_at != note.created_at
%span