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 .md-header.clearfix
%ul.center-top-menu %ul.center-top-menu
%li.active %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 Write
%li %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 Preview
- if defined?(referenced_users) && referenced_users - if defined?(referenced_users) && referenced_users

View file

@ -1,10 +1,10 @@
.zennable .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 .zen-backdrop
- classes << ' js-gfm-input markdown-area' - classes << ' js-gfm-input markdown-area'
= f.text_area attr, class: classes, placeholder: '' = 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 %i.fa.fa-expand
Edit in fullscreen Edit in fullscreen
= link_to nil, class: 'zen-leave-link' do %a.zen-leave-link(href="#")
%i.fa.fa-compress %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 } } %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-entry-inner
.timeline-icon .timeline-icon
= link_to user_path(note.author) do %a{href: user_path(note.author)}
= image_tag avatar_icon(note.author), class: 'avatar s40', alt: '' %img.avatar.s40{src: avatar_icon(note.author), alt: ''}
.timeline-content .timeline-content
.note-header .note-header
- if note_editable?(note) - if note_editable?(note)
@ -25,7 +25,7 @@
= '@' + note.author.username = '@' + note.author.username
%span.note-last-update %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') = time_ago_with_tooltip(note.created_at, placement: 'bottom', html_class: 'note_created_ago')
- if note.updated_at != note.created_at - if note.updated_at != note.created_at
%span %span