From b76659c5378fbcb61ecefa0db55830465e152d30 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 30 Jun 2015 15:34:16 +0200 Subject: [PATCH 1/5] Re-use event cache with other users unless its personal Signed-off-by: Dmitriy Zaporozhets --- app/views/events/_event.html.haml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/app/views/events/_event.html.haml b/app/views/events/_event.html.haml index 02b1dec753..b2e5d11279 100644 --- a/app/views/events/_event.html.haml +++ b/app/views/events/_event.html.haml @@ -3,14 +3,15 @@ .event-item-timestamp #{time_ago_with_tooltip(event.created_at)} - = cache [event, current_user] do - = image_tag avatar_icon(event.author_email, 24), class: "avatar s24", alt:'' - - - if event.push? - = render "events/event/push", event: event - - elsif event.commented? - = render "events/event/note", event: event - - elsif event.created_project? + - if event.created_project? + = cache [event, current_user] do = render "events/event/created_project", event: event - - else - = render "events/event/common", event: event \ No newline at end of file + - else + = cache event do + = image_tag avatar_icon(event.author_email, 24), class: "avatar s24", alt:'' + - if event.push? + = render "events/event/push", event: event + - elsif event.commented? + = render "events/event/note", event: event + - else + = render "events/event/common", event: event From 496f94de4afacb483561fce929e18a96da7d2c2b Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 30 Jun 2015 15:41:25 +0200 Subject: [PATCH 2/5] Cache commits list Signed-off-by: Dmitriy Zaporozhets --- app/views/projects/commits/_commit.html.haml | 57 ++++++++++---------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/app/views/projects/commits/_commit.html.haml b/app/views/projects/commits/_commit.html.haml index f9106564a2..74f8d8b15c 100644 --- a/app/views/projects/commits/_commit.html.haml +++ b/app/views/projects/commits/_commit.html.haml @@ -1,33 +1,34 @@ -%li.commit.js-toggle-container - .commit-row-title - %strong.str-truncated - = link_to_gfm commit.title, namespace_project_commit_path(project.namespace, project, commit.id), class: "commit-row-message" - - if commit.description? - %a.text-expander.js-toggle-button ... +- if @note_counts + - note_count = @note_counts.fetch(commit.id, 0) +- else + - notes = commit.notes + - note_count = notes.user.count - .pull-right - = link_to commit.short_id, namespace_project_commit_path(project.namespace, project, commit), class: "commit_short_id" += cache [project.id, commit.id, note_count] do + %li.commit.js-toggle-container + .commit-row-title + %strong.str-truncated + = link_to_gfm commit.title, namespace_project_commit_path(project.namespace, project, commit.id), class: "commit-row-message" + - if commit.description? + %a.text-expander.js-toggle-button ... - .notes_count - - if @note_counts - - note_count = @note_counts.fetch(commit.id, 0) - - else - - notes = commit.notes - - note_count = notes.user.count + .pull-right + = link_to commit.short_id, namespace_project_commit_path(project.namespace, project, commit), class: "commit_short_id" - - if note_count > 0 - %span.light - %i.fa.fa-comments - = note_count + .notes_count + - if note_count > 0 + %span.light + %i.fa.fa-comments + = note_count - - if commit.description? - .commit-row-description.js-toggle-content - %pre - = preserve(gfm(escape_once(commit.description))) + - if commit.description? + .commit-row-description.js-toggle-content + %pre + = preserve(gfm(escape_once(commit.description))) - .commit-row-info - = commit_author_link(commit, avatar: true, size: 24) - authored - .committed_ago - #{time_ago_with_tooltip(commit.committed_date, skip_js: true)}   - = link_to_browse_code(project, commit) + .commit-row-info + = commit_author_link(commit, avatar: true, size: 24) + authored + .committed_ago + #{time_ago_with_tooltip(commit.committed_date, skip_js: true)}   + = link_to_browse_code(project, commit) From 40e31e1db31e6ba9a1cd6255afc2f09df61f4060 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 30 Jun 2015 15:43:45 +0200 Subject: [PATCH 3/5] Cache issue in the list Signed-off-by: Dmitriy Zaporozhets --- app/views/projects/issues/_issue.html.haml | 73 +++++++++++----------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/app/views/projects/issues/_issue.html.haml b/app/views/projects/issues/_issue.html.haml index cdb3839d13..821ed8dddf 100644 --- a/app/views/projects/issues/_issue.html.haml +++ b/app/views/projects/issues/_issue.html.haml @@ -3,42 +3,43 @@ .issue-check = check_box_tag dom_id(issue,"selected"), nil, false, 'data-id' => issue.id, class: "selected_issue" - .issue-title - %span.issue-title-text - = link_to_gfm issue.title, issue_path(issue), class: "row_title" - .issue-labels - - issue.labels.each do |label| - = link_to_label(label, project: issue.project) - .pull-right.light - - if issue.closed? - %span - CLOSED - - if issue.assignee - = link_to_member(@project, issue.assignee, name: false) - - note_count = issue.notes.user.count - - if note_count > 0 + = cache issue do + .issue-title + %span.issue-title-text + = link_to_gfm issue.title, issue_path(issue), class: "row_title" + .issue-labels + - issue.labels.each do |label| + = link_to_label(label, project: issue.project) + .pull-right.light + - if issue.closed? + %span + CLOSED + - if issue.assignee + = link_to_member(@project, issue.assignee, name: false) + - note_count = issue.notes.user.count + - if note_count > 0 +   + %span + %i.fa.fa-comments + = note_count + - else +   + %span.issue-no-comments + %i.fa.fa-comments + = 0 + + .issue-info + = "##{issue.iid} opened #{time_ago_with_tooltip(issue.created_at, placement: 'bottom')} by #{link_to_member(@project, issue.author, avatar: false)}".html_safe + - if issue.votes_count > 0 + = render 'votes/votes_inline', votable: issue + - if issue.milestone   %span - %i.fa.fa-comments - = note_count - - else -   - %span.issue-no-comments - %i.fa.fa-comments - = 0 + %i.fa.fa-clock-o + = issue.milestone.title + - if issue.tasks? + %span.task-status + = issue.task_status - .issue-info - = "##{issue.iid} opened #{time_ago_with_tooltip(issue.created_at, placement: 'bottom')} by #{link_to_member(@project, issue.author, avatar: false)}".html_safe - - if issue.votes_count > 0 - = render 'votes/votes_inline', votable: issue - - if issue.milestone -   - %span - %i.fa.fa-clock-o - = issue.milestone.title - - if issue.tasks? - %span.task-status - = issue.task_status - - .pull-right.issue-updated-at - %small updated #{time_ago_with_tooltip(issue.updated_at, placement: 'bottom', html_class: 'issue_update_ago')} + .pull-right.issue-updated-at + %small updated #{time_ago_with_tooltip(issue.updated_at, placement: 'bottom', html_class: 'issue_update_ago')} From 4d80360bedafe69d205634d5e0699fb31d019622 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 30 Jun 2015 15:54:20 +0200 Subject: [PATCH 4/5] Cache markdown of comments Signed-off-by: Dmitriy Zaporozhets --- app/views/projects/notes/_note.html.haml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/views/projects/notes/_note.html.haml b/app/views/projects/notes/_note.html.haml index 0a77f200f5..5478a887f9 100644 --- a/app/views/projects/notes/_note.html.haml +++ b/app/views/projects/notes/_note.html.haml @@ -21,7 +21,7 @@ - if member %span.note-role.label = member.human_access - + - if note.system = link_to user_path(note.author) do = image_tag avatar_icon(note.author_email), class: 'avatar s16', alt: '' @@ -56,9 +56,10 @@ .note-body{class: note_editable?(note) ? 'js-task-list-container' : ''} - .note-text - = preserve do - = markdown(note.note, {no_header_anchors: true}) + = cache [note, 'markdown'] do + .note-text + = preserve do + = markdown(note.note, {no_header_anchors: true}) = render 'projects/notes/edit_form', note: note - if note.attachment.url From 70666a52b45cdab55b843c4a60e2ed40e431a6de Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 1 Jul 2015 09:46:37 +0200 Subject: [PATCH 5/5] Use to_reference menthod when render issue id in list Signed-off-by: Dmitriy Zaporozhets --- app/views/projects/issues/_issue.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/issues/_issue.html.haml b/app/views/projects/issues/_issue.html.haml index 821ed8dddf..1b45bb1af0 100644 --- a/app/views/projects/issues/_issue.html.haml +++ b/app/views/projects/issues/_issue.html.haml @@ -29,7 +29,7 @@ = 0 .issue-info - = "##{issue.iid} opened #{time_ago_with_tooltip(issue.created_at, placement: 'bottom')} by #{link_to_member(@project, issue.author, avatar: false)}".html_safe + = "#{issue.to_reference} opened #{time_ago_with_tooltip(issue.created_at, placement: 'bottom')} by #{link_to_member(@project, issue.author, avatar: false)}".html_safe - if issue.votes_count > 0 = render 'votes/votes_inline', votable: issue - if issue.milestone