Commit 01315cfe authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'hanloong/gitlab-ce-add-dates-snippets-show' into 'master'

Update style of snippets pages

![Screen_Shot_2015-10-18_at_13.04.13](/uploads/95d58b64fa81aa4e75568d2d7b4a6b08/Screen_Shot_2015-10-18_at_13.04.13.png)

![Screen_Shot_2015-10-21_at_11.11.10](/uploads/106371d718a07a9ccdad9148812211fd/Screen_Shot_2015-10-21_at_11.11.10.png)

Replaces !1567.

Fixes #1767 and #2538.


See merge request !1637
parents 7924dd5c c7c5bd48
...@@ -78,6 +78,7 @@ v 8.1.0 ...@@ -78,6 +78,7 @@ v 8.1.0
- Fix position of hamburger in header for smaller screens (Han Loong Liauw) - Fix position of hamburger in header for smaller screens (Han Loong Liauw)
- Fix bug where Emojis in Markdown would truncate remaining text (Sakata Sinji) - Fix bug where Emojis in Markdown would truncate remaining text (Sakata Sinji)
- Persist filters when sorting on admin user page (Jerry Lukins) - Persist filters when sorting on admin user page (Jerry Lukins)
- Update style of snippets pages (Han Loong Liauw)
- Allow dashboard and group issues/MRs to be filtered by label - Allow dashboard and group issues/MRs to be filtered by label
- Add spellcheck=false to certain input fields - Add spellcheck=false to certain input fields
- Invalidate stored service password if the endpoint URL is changed - Invalidate stored service password if the endpoint URL is changed
......
...@@ -162,10 +162,21 @@ ...@@ -162,10 +162,21 @@
border-color: #e7e9ed; border-color: #e7e9ed;
width: 140px; width: 140px;
.badge {
font-weight: normal;
background-color: #eee;
color: #78a;
}
&.active { &.active {
border-color: $gl-info; border-color: $gl-info;
background: $gl-info; background: $gl-info;
color: #fff; color: #fff;
.badge {
color: $gl-info;
background-color: white;
}
} }
} }
} }
...@@ -147,7 +147,6 @@ ...@@ -147,7 +147,6 @@
.badge { .badge {
font-weight: normal; font-weight: normal;
background-color: #fff;
background-color: #eee; background-color: #eee;
color: #78a; color: #78a;
} }
......
.my-snippets li:first-child {
h4 { margin-top: 0; }
padding-top: 0;
}
.snippet-form-holder .file-holder .file-title { .snippet-form-holder .file-holder .file-title {
padding: 2px; padding: 2px;
} }
...@@ -30,3 +25,58 @@ ...@@ -30,3 +25,58 @@
} }
} }
} }
.snippet-holder {
.snippet-details {
.page-title {
margin-top: -15px;
padding: 10px 0;
margin-bottom: 0;
color: #5c5d5e;
font-size: 16px;
.author {
color: #5c5d5e;
}
.snippet-id {
color: #5c5d5e;
}
}
.snippet-title {
margin: 0;
font-size: 23px;
color: #313236;
}
@media (max-width: $screen-md-max) {
.new-snippet-link {
display: none;
}
}
@media (max-width: $screen-sm-max) {
.creator,
.page-title .btn-close {
display: none;
}
}
}
.file-holder {
border-top: 0;
}
}
.snippet-box {
@include border-radius(2px);
display: inline-block;
padding: 10px $gl-padding;
font-weight: normal;
margin-right: 10px;
font-size: $gl-font-size;
border: 1px solid;
}
...@@ -21,6 +21,7 @@ class Projects::SnippetsController < Projects::ApplicationController ...@@ -21,6 +21,7 @@ class Projects::SnippetsController < Projects::ApplicationController
filter: :by_project, filter: :by_project,
project: @project project: @project
}) })
@snippets = @snippets.page(params[:page]).per(PER_PAGE)
end end
def new def new
......
...@@ -110,22 +110,4 @@ module TabHelper ...@@ -110,22 +110,4 @@ module TabHelper
'active' 'active'
end end
end end
# Use nav_tab for save controller/action but different params
def nav_tab(key, value, &block)
o = {}
o[:class] = ""
if value.nil?
o[:class] << " active" if params[key].blank?
else
o[:class] << " active" if params[key] == value
end
if block_given?
content_tag(:li, capture(&block), o)
else
content_tag(:li, nil, o)
end
end
end end
...@@ -6,33 +6,29 @@ ...@@ -6,33 +6,29 @@
.gray-content-block .gray-content-block
.pull-right .pull-right
= link_to new_snippet_path, class: "btn btn-new", title: "New Snippet" do = link_to new_snippet_path, class: "btn btn-new", title: "New Snippet" do
Add new snippet = icon('plus')
New Snippet
.oneline .btn-group.btn-group-next.snippet-scope-menu
Share code pastes with others out of git repository = link_to dashboard_snippets_path, class: "btn btn-default #{"active" unless params[:scope]}" do
%ul.nav.nav-tabs.prepend-top-20
= nav_tab :scope, nil do
= link_to dashboard_snippets_path do
All All
%span.badge %span.badge
= current_user.snippets.count = current_user.snippets.count
= nav_tab :scope, 'are_private' do
= link_to dashboard_snippets_path(scope: 'are_private') do = link_to dashboard_snippets_path(scope: 'are_private'), class: "btn btn-default #{"active" if params[:scope] == "are_private"}" do
Private Private
%span.badge %span.badge
= current_user.snippets.are_private.count = current_user.snippets.are_private.count
= nav_tab :scope, 'are_internal' do
= link_to dashboard_snippets_path(scope: 'are_internal') do = link_to dashboard_snippets_path(scope: 'are_internal'), class: "btn btn-default #{"active" if params[:scope] == "are_internal"}" do
Internal Internal
%span.badge %span.badge
= current_user.snippets.are_internal.count = current_user.snippets.are_internal.count
= nav_tab :scope, 'are_public' do
= link_to dashboard_snippets_path(scope: 'are_public') do = link_to dashboard_snippets_path(scope: 'are_public'), class: "btn btn-default #{"active" if params[:scope] == "are_public"}" do
Public Public
%span.badge %span.badge
= current_user.snippets.are_public.count = current_user.snippets.are_public.count
.my-snippets = render 'snippets/snippets'
= render 'snippets/snippets'
...@@ -10,7 +10,8 @@ ...@@ -10,7 +10,8 @@
- if current_user - if current_user
.pull-right .pull-right
= link_to new_snippet_path, class: "btn btn-new", title: "New Snippet" do = link_to new_snippet_path, class: "btn btn-new", title: "New Snippet" do
Add new snippet = icon('plus')
New Snippet
.oneline .oneline
Public snippets created by you and other users are listed here Public snippets created by you and other users are listed here
......
= 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 namespace_project_snippet_path(@project.namespace, @project, @snippet), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-grouped btn-remove", title: 'Delete Snippet' do
= icon('trash-o')
Delete
- 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 "Snippets" - page_title "Snippets"
= render "header_title" = render "header_title"
%h3.page-title .gray-content-block.top-block
Snippets .pull-right
- if can? current_user, :create_project_snippet, @project = link_to new_namespace_project_snippet_path(@project.namespace, @project), class: "btn btn-new", title: "New Snippet" do
= link_to new_namespace_project_snippet_path(@project.namespace, @project), class: "btn btn-new pull-right", title: "New Snippet" do = icon('plus')
Add new snippet New Snippet
%p.light .oneline
Share code pastes with others out of git repository Share code pastes with others out of git repository
%ul.bordered-list = render 'snippets/snippets'
= render partial: "shared/snippets/snippet", collection: @snippets
- if @snippets.empty?
%li
.nothing-here-block Nothing here.
- page_title @snippet.title, "Snippets" - page_title @snippet.title, "Snippets"
= render "header_title" = render "header_title"
%h3.page-title .snippet-holder
= @snippet.title = render 'shared/snippets/header'
.pull-right %article.file-holder
= link_to new_namespace_project_snippet_path(@project.namespace, @project), class: "btn btn-new", title: "New Snippet" do .file-title
Add new snippet = blob_icon 0, @snippet.file_name
%strong
= @snippet.file_name
.file-actions.hidden-xs
.btn-group.tree-btn-group
= link_to 'Raw', raw_namespace_project_snippet_path(@project.namespace, @project, @snippet), class: "btn btn-sm", target: "_blank"
%hr = render 'shared/snippets/blob'
.append-bottom-20 %div#notes= render "projects/notes/notes_with_form"
.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
&larr; project snippets
.file-holder
.file-title
%i.fa.fa-file
%strong
= @snippet.file_name
.file-actions
.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"
- 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"
.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
&middot; created by #{link_to_member(@project, @snippet.author, size: 24)}
&middot;
= time_ago_with_tooltip(@snippet.created_at, placement: 'bottom', html_class: 'snippet_updated_ago')
- if @snippet.updated_at != @snippet.created_at
%span
&middot;
= 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)
...@@ -18,4 +18,3 @@ ...@@ -18,4 +18,3 @@
= 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.created_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
- if can?(current_user, :admin_personal_snippet, @snippet)
= link_to snippet_path(@snippet), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-grouped btn-remove", title: 'Delete Snippet' do
= icon('trash-o')
Delete
- 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"
%h4.page-title
= @snippet.title
- if @snippet.private? .snippet-holder
%span.label.label-success = render 'shared/snippets/header'
%i.fa.fa-lock
private %article.file-holder
.file-title
.pull-right = blob_icon 0, @snippet.file_name
= link_to new_snippet_path, class: "btn btn-new btn-sm", title: "New Snippet" do %strong
Add new snippet = @snippet.file_name
.file-actions.hidden-xs
.append-bottom-10.prepend-top-10 .btn-group.tree-btn-group
.pull-right = link_to 'Raw', raw_snippet_path(@snippet), class: "btn btn-sm", target: "_blank"
%span.light = render 'shared/snippets/blob'
created by
= link_to user_snippets_path(@snippet.author) do
= @snippet.author_name
.back-link
- if @snippet.author == current_user
= link_to dashboard_snippets_path do
&larr; your snippets
- else
= link_to explore_snippets_path do
&larr; explore snippets
.file-holder
.file-title
%i.fa.fa-file
%strong
= @snippet.file_name
.file-actions
.btn-group
- if can?(current_user, :update_personal_snippet, @snippet)
= link_to "edit", edit_snippet_path(@snippet), class: "btn btn-sm", title: 'Edit Snippet'
= link_to "raw", raw_snippet_path(@snippet), class: "btn btn-sm", target: "_blank"
- if can?(current_user, :admin_personal_snippet, @snippet)
= link_to "remove", snippet_path(@snippet), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-sm btn-remove", title: 'Delete Snippet'
= render 'shared/snippets/blob'
...@@ -30,5 +30,5 @@ Feature: Project Snippets ...@@ -30,5 +30,5 @@ Feature: Project Snippets
Scenario: I destroy "Snippet one" Scenario: I destroy "Snippet one"
Given I visit snippet page "Snippet one" Given I visit snippet page "Snippet one"
And I click link "Remove Snippet" And I click link "Delete"
Then I should not see "Snippet one" in snippets Then I should not see "Snippet one" in snippets
...@@ -24,7 +24,7 @@ Feature: Snippets ...@@ -24,7 +24,7 @@ Feature: Snippets
Scenario: I destroy "Personal snippet one" Scenario: I destroy "Personal snippet one"
Given I visit snippet page "Personal snippet one" Given I visit snippet page "Personal snippet one"
And I click link "Destroy" And I click link "Delete"
Then I should not see "Personal snippet one" in snippets Then I should not see "Personal snippet one" in snippets
Scenario: I create new internal snippet Scenario: I create new internal snippet
......
...@@ -22,7 +22,7 @@ class Spinach::Features::ProjectSnippets < Spinach::FeatureSteps ...@@ -22,7 +22,7 @@ class Spinach::Features::ProjectSnippets < Spinach::FeatureSteps
end end
step 'I click link "New Snippet"' do step 'I click link "New Snippet"' do
click_link "Add new snippet" click_link "New Snippet"
end end
step 'I click link "Snippet one"' do step 'I click link "Snippet one"' do
...@@ -42,13 +42,13 @@ class Spinach::Features::ProjectSnippets < Spinach::FeatureSteps ...@@ -42,13 +42,13 @@ class Spinach::Features::ProjectSnippets < Spinach::FeatureSteps
end end
step 'I click link "Edit"' do step 'I click link "Edit"' do
page.within ".file-title" do page.within ".page-title" do
click_link "Edit" click_link "Edit"
end end
end end
step 'I click link "Remove Snippet"' do step 'I click link "Delete"' do
click_link "remove" click_link "Delete"
end end
step 'I submit new snippet "Snippet three"' do step 'I submit new snippet "Snippet three"' do
......
...@@ -13,13 +13,13 @@ class Spinach::Features::Snippets < Spinach::FeatureSteps ...@@ -13,13 +13,13 @@ class Spinach::Features::Snippets < Spinach::FeatureSteps
end end
step 'I click link "Edit"' do step 'I click link "Edit"' do
page.within ".file-title" do page.within ".page-title" do
click_link "Edit" click_link "Edit"
end end
end end
step 'I click link "Destroy"' do step 'I click link "Delete"' do
click_link "remove" click_link "Delete"
end end
step 'I submit new snippet "Personal snippet three"' do step 'I submit new snippet "Personal snippet three"' do
......
...@@ -32,19 +32,19 @@ class Spinach::Features::SnippetsUser < Spinach::FeatureSteps ...@@ -32,19 +32,19 @@ class Spinach::Features::SnippetsUser < Spinach::FeatureSteps
end end
step 'I click "Internal" filter' do step 'I click "Internal" filter' do
page.within('.nav-tabs') do page.within('.snippet-scope-menu') do
click_link "Internal" click_link "Internal"
end end
end end
step 'I click "Private" filter' do step 'I click "Private" filter' do
page.within('.nav-tabs') do page.within('.snippet-scope-menu') do
click_link "Private" click_link "Private"
end end
end end
step 'I click "Public" filter' do step 'I click "Public" filter' do
page.within('.nav-tabs') do page.within('.snippet-scope-menu') do
click_link "Public" click_link "Public"
end end
end end
......
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