From 4ac7f5c949c664523e9a6e474d522f7d093249a2 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 27 Aug 2015 00:00:06 +0200 Subject: Restyle snippets rendering Signed-off-by: Dmitriy Zaporozhets --- app/assets/stylesheets/pages/snippets.scss | 24 ++++++++++++++++++++++++ app/views/projects/snippets/_snippet.html.haml | 15 --------------- app/views/projects/snippets/index.html.haml | 3 +-- app/views/shared/snippets/_snippet.html.haml | 21 +++++++++++++++++++++ app/views/snippets/_snippet.html.haml | 23 ----------------------- app/views/snippets/_snippets.html.haml | 2 +- 6 files changed, 47 insertions(+), 41 deletions(-) delete mode 100644 app/views/projects/snippets/_snippet.html.haml create mode 100644 app/views/shared/snippets/_snippet.html.haml delete mode 100644 app/views/snippets/_snippet.html.haml diff --git a/app/assets/stylesheets/pages/snippets.scss b/app/assets/stylesheets/pages/snippets.scss index d79591d9915..a3d7aba054d 100644 --- a/app/assets/stylesheets/pages/snippets.scss +++ b/app/assets/stylesheets/pages/snippets.scss @@ -6,3 +6,27 @@ .snippet-form-holder .file-holder .file-title { padding: 2px; } + + +.snippet-row { + .snippet-title { + font-size: 15px; + font-weight: bold; + line-height: 20px; + margin-bottom: 2px; + + .monospace { + font-weight: normal; + } + } + + .snippet-info { + color: #888; + font-size: 13px; + line-height: 24px; + + a { + color: #888; + } + } +} diff --git a/app/views/projects/snippets/_snippet.html.haml b/app/views/projects/snippets/_snippet.html.haml deleted file mode 100644 index b2c35edc44c..00000000000 --- a/app/views/projects/snippets/_snippet.html.haml +++ /dev/null @@ -1,15 +0,0 @@ -%li - %h4.snippet-title - = link_to reliable_snippet_path(snippet) do - = truncate(snippet.title, length: 60) - %span.cgray.monospace.tiny.pull-right - = snippet.file_name - - .snippet-info - = "##{snippet.id}" - %span - by - = image_tag avatar_icon(snippet.author_email), class: "avatar avatar-inline s16" - = snippet.author_name - %span.light - #{time_ago_with_tooltip(snippet.created_at)} diff --git a/app/views/projects/snippets/index.html.haml b/app/views/projects/snippets/index.html.haml index 30081673ffc..45d4de6a385 100644 --- a/app/views/projects/snippets/index.html.haml +++ b/app/views/projects/snippets/index.html.haml @@ -8,9 +8,8 @@ %p.light Share code pastes with others out of git repository -%hr %ul.bordered-list - = render partial: "projects/snippets/snippet", collection: @snippets + = render partial: "shared/snippets/snippet", collection: @snippets - if @snippets.empty? %li .nothing-here-block Nothing here. diff --git a/app/views/shared/snippets/_snippet.html.haml b/app/views/shared/snippets/_snippet.html.haml new file mode 100644 index 00000000000..69a713ad9aa --- /dev/null +++ b/app/views/shared/snippets/_snippet.html.haml @@ -0,0 +1,21 @@ +%li.snippet-row + .snippet-title + = link_to reliable_snippet_path(snippet) do + = truncate(snippet.title, length: 60) + - if snippet.private? + %span.label.label-gray + %i.fa.fa-lock + private + %span.monospace.pull-right + = snippet.file_name + + %small.pull-right.cgray + - if snippet.project_id? + = link_to snippet.project.name_with_namespace, namespace_project_path(snippet.project.namespace, snippet.project) + + .snippet-info + = link_to user_snippets_path(snippet.author) do + = image_tag avatar_icon(snippet.author_email), class: "avatar s24", alt: '' + = snippet.author_name + authored #{time_ago_with_tooltip(snippet.created_at)} + diff --git a/app/views/snippets/_snippet.html.haml b/app/views/snippets/_snippet.html.haml deleted file mode 100644 index 5bb28664349..00000000000 --- a/app/views/snippets/_snippet.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -%li - %h4.snippet-title - = link_to reliable_snippet_path(snippet) do - = truncate(snippet.title, length: 60) - - if snippet.private? - %span.label.label-gray - %i.fa.fa-lock - private - %span.cgray.monospace.tiny.pull-right - = snippet.file_name - - %small.pull-right.cgray - - if snippet.project_id? - = link_to snippet.project.name_with_namespace, namespace_project_path(snippet.project.namespace, snippet.project) - - .snippet-info - = "##{snippet.id}" - %span - by - = link_to user_snippets_path(snippet.author) do - = image_tag avatar_icon(snippet.author_email), class: "avatar avatar-inline s16", alt: '' - = snippet.author_name - %span.light #{time_ago_with_tooltip(snippet.created_at)} diff --git a/app/views/snippets/_snippets.html.haml b/app/views/snippets/_snippets.html.haml index 40df42b6cf5..d9aa4dd1d2e 100644 --- a/app/views/snippets/_snippets.html.haml +++ b/app/views/snippets/_snippets.html.haml @@ -1,5 +1,5 @@ %ul.bordered-list - = render partial: 'snippet', collection: @snippets + = render partial: 'shared/snippets/snippet', collection: @snippets - if @snippets.empty? %li .nothing-here-block Nothing here. -- cgit v1.2.1