Commit 1f92c22f authored by Han Loong Liauw's avatar Han Loong Liauw

New snippet design for projects

Split out header into shared partial
Used action partials to have unique actions for shared and personal
snippets
changed back to created date in list view
Switched to using existing color classes
parent a60853fd
...@@ -37,10 +37,14 @@ ...@@ -37,10 +37,14 @@
padding: 10px 0; padding: 10px 0;
margin-bottom: 0; margin-bottom: 0;
color: #5c5d5e; color: #5c5d5e;
font-size: 16px; font-size: 13px;
@include clearfix();
.author { .creator {
color: #5c5d5e; color: $gl-gray;
a {
color: $gl-gray;
}
} }
.snippet-id { .snippet-id {
...@@ -79,9 +83,5 @@ ...@@ -79,9 +83,5 @@
font-weight: normal; font-weight: normal;
margin-right: 10px; margin-right: 10px;
font-size: $gl-font-size; font-size: $gl-font-size;
border: 1px solid;
&.snippet-box-locked {
background: $gl-gray;
color: #FFF;
}
} }
= link_to new_namespace_project_snippet_path(@project.namespace, @project), class: 'btn btn-grouped new-snippet-link', title: "New Snippet" do
= icon('plus')
new snippet
- if can?(current_user, :admin_project_snippet, @snippet)
= link_to "remove", namespace_project_snippet_path(@project.namespace, @project, @snippet), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-grouped btn-remove", title: 'Delete Snippet'
- if can?(current_user, :update_project_snippet, @snippet)
= link_to edit_namespace_project_snippet_path(@project.namespace, @project, @snippet), class: "btn btn-grouped snippable-edit" do
= icon('pencil-square-o')
Edit
- page_title @snippet.title, "Snippets" - page_title @snippet.title, "Snippets"
= render "header_title" = render "header_title"
= render 'shared/snippets/header'
%h3.page-title
= @snippet.title
.pull-right
= link_to new_namespace_project_snippet_path(@project.namespace, @project), class: "btn btn-new", title: "New Snippet" do
Add new snippet
%hr
.append-bottom-20
.pull-right
= "##{@snippet.id}"
%span.light
by
= link_to user_path(@snippet.author) do
= image_tag avatar_icon(@snippet.author_email), class: "avatar avatar-inline s16"
= @snippet.author_name
.back-link
= link_to namespace_project_snippets_path(@project.namespace, @project) do
← project snippets
.file-holder .file-holder
.file-title .file-title
...@@ -30,11 +9,6 @@ ...@@ -30,11 +9,6 @@
= @snippet.file_name = @snippet.file_name
.file-actions .file-actions
.btn-group .btn-group
- if can?(current_user, :update_project_snippet, @snippet)
= link_to "edit", edit_namespace_project_snippet_path(@project.namespace, @project, @snippet), class: "btn btn-sm", title: 'Edit Snippet'
= link_to "raw", raw_namespace_project_snippet_path(@project.namespace, @project, @snippet), class: "btn btn-sm", target: "_blank" = link_to "raw", raw_namespace_project_snippet_path(@project.namespace, @project, @snippet), class: "btn btn-sm", target: "_blank"
- if can?(current_user, :admin_project_snippet, @snippet)
= link_to "remove", namespace_project_snippet_path(@project.namespace, @project, @snippet), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-sm btn-remove", title: 'Delete Snippet'
= render 'shared/snippets/blob'
%div#notes= render "projects/notes/notes_with_form" %div#notes= render "projects/notes/notes_with_form"
.snippet
.snippet-details
.page-title
.snippet-box{class: visibility_level_color(@snippet.visibility_level)}
= visibility_level_icon(@snippet.visibility_level)
= visibility_level_label(@snippet.visibility_level)
%span.snippet-id Snippet ##{@snippet.id}
%span.creator
· created by #{link_to_member(@project, @snippet.author, size: 24)}
·
= time_ago_with_tooltip(@snippet.created_at, placement: 'bottom', html_class: 'snippet_updated_ago')
- if @snippet.updated_at != @snippet.created_at
%span
·
= icon('edit', title: 'edited')
= time_ago_with_tooltip(@snippet.updated_at, placement: 'bottom', html_class: 'snippet_edited_ago')
.pull-right
- if @snippet.project_id?
= render "projects/snippets/actions"
- else
= render "snippets/actions"
.gray-content-block.middle-block
%h2.snippet-title
= gfm escape_once(@snippet.title)
...@@ -17,4 +17,4 @@ ...@@ -17,4 +17,4 @@
= link_to user_snippets_path(snippet.author) do = link_to user_snippets_path(snippet.author) do
= image_tag avatar_icon(snippet.author_email), class: "avatar s24", alt: '' = image_tag avatar_icon(snippet.author_email), class: "avatar s24", alt: ''
= snippet.author_name = snippet.author_name
authored #{time_ago_with_tooltip(snippet.updated_at)} authored #{time_ago_with_tooltip(snippet.created_at)}
= link_to new_snippet_path, class: 'btn btn-grouped new-snippet-link', title: "New Snippet" do
= icon('plus')
new snippet
= link_to "remove", snippet_path(@snippet), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-grouped btn-remove", title: 'Delete Snippet'
- if can?(current_user, :update_personal_snippet, @snippet)
= link_to edit_snippet_path(@snippet), class: "btn btn-grouped snippable-edit" do
= icon('pencil-square-o')
Edit
- page_title @snippet.title, "Snippets" - page_title @snippet.title, "Snippets"
= render 'shared/snippets/header'
.snippet
.snippet-details
.page-title
- if @snippet.private?
.snippet-box.snippet-box-locked
%i.fa.fa-lock
Private
%span.snippet-id Snippet ##{@snippet.id}
%span.creator
· created by #{link_to_member(@project, @snippet.author, size: 24)}
·
= time_ago_with_tooltip(@snippet.created_at, placement: 'bottom', html_class: 'snippet_updated_ago')
- if @snippet.updated_at != @snippet.created_at
%span
·
= icon('edit', title: 'edited')
= time_ago_with_tooltip(@snippet.updated_at, placement: 'bottom', html_class: 'snippet_edited_ago')
.pull-right
= link_to new_snippet_path, class: 'btn btn-grouped new-snippet-link', title: "New Snippet" do
= icon('plus')
new snippet
= link_to "remove", snippet_path(@snippet), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-grouped btn-remove", title: 'Delete Snippet'
- if can?(current_user, :update_personal_snippet, @snippet)
= link_to edit_snippet_path(@snippet), class: "btn btn-grouped issuabled-edit" do
= icon('pencil-square-o')
Edit
.gray-content-block.middle-block
%h2.snippet-title
= gfm escape_once(@snippet.title)
.file-holder .file-holder
.file-title .file-title
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment