Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
4a63573b
Commit
4a63573b
authored
Apr 02, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start applying new layout to snippets pages
parent
27919e25
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
60 additions
and
50 deletions
+60
-50
app/controllers/snippets_controller.rb
app/controllers/snippets_controller.rb
+18
-22
app/views/layouts/nav/_snippets.html.haml
app/views/layouts/nav/_snippets.html.haml
+11
-0
app/views/layouts/snippets.html.haml
app/views/layouts/snippets.html.haml
+6
-0
app/views/snippets/current_user_index.html.haml
app/views/snippets/current_user_index.html.haml
+23
-26
app/views/snippets/index.html.haml
app/views/snippets/index.html.haml
+0
-1
config/routes.rb
config/routes.rb
+2
-1
No files found.
app/controllers/snippets_controller.rb
View file @
4a63573b
class
SnippetsController
<
ApplicationController
class
SnippetsController
<
ApplicationController
before_filter
:snippet
,
only:
[
:show
,
:edit
,
:destroy
,
:update
,
:raw
]
before_filter
:snippet
,
only:
[
:show
,
:edit
,
:destroy
,
:update
,
:raw
]
# Allow modify snippet
before_filter
:authorize_modify_snippet!
,
only:
[
:edit
,
:update
]
before_filter
:authorize_modify_snippet!
,
only:
[
:edit
,
:update
]
# Allow destroy snippet
before_filter
:authorize_admin_snippet!
,
only:
[
:destroy
]
before_filter
:authorize_admin_snippet!
,
only:
[
:destroy
]
before_filter
:set_title
before_filter
:set_title
...
@@ -16,10 +12,7 @@ class SnippetsController < ApplicationController
...
@@ -16,10 +12,7 @@ class SnippetsController < ApplicationController
layout
:determine_layout
layout
:determine_layout
def
index
def
index
@snippets
=
SnippetsFinder
.
new
.
execute
(
current_user
,
filter: :all
).
page
(
params
[
:page
]).
per
(
PER_PAGE
)
if
params
[
:username
].
present?
end
def
user_index
@user
=
User
.
find_by
(
username:
params
[
:username
])
@user
=
User
.
find_by
(
username:
params
[
:username
])
render_404
and
return
unless
@user
render_404
and
return
unless
@user
...
@@ -35,6 +28,9 @@ class SnippetsController < ApplicationController
...
@@ -35,6 +28,9 @@ class SnippetsController < ApplicationController
else
else
render
'user_index'
render
'user_index'
end
end
else
@snippets
=
SnippetsFinder
.
new
.
execute
(
current_user
,
filter: :all
).
page
(
params
[
:page
]).
per
(
PER_PAGE
)
end
end
end
def
new
def
new
...
@@ -108,6 +104,6 @@ class SnippetsController < ApplicationController
...
@@ -108,6 +104,6 @@ class SnippetsController < ApplicationController
end
end
def
determine_layout
def
determine_layout
current_user
?
'
navles
s'
:
'public_users'
current_user
?
'
snippet
s'
:
'public_users'
end
end
end
end
app/views/layouts/nav/_snippets.html.haml
0 → 100644
View file @
4a63573b
%ul
.nav.nav-sidebar
=
nav_link
(
path:
user_snippets_path
(
current_user
),
html_options:
{
class:
'home'
})
do
=
link_to
user_snippets_path
(
current_user
)
do
%i
.fa.fa-dashboard
%span
My Snippets
=
nav_link
(
path:
snippets_path
)
do
=
link_to
snippets_path
,
title:
'Discover snippets'
do
%i
.fa.fa-globe
%span
Discover Snippets
app/views/layouts/snippets.html.haml
0 → 100644
View file @
4a63573b
!!! 5
%html
{
lang:
"en"
}
=
render
"layouts/head"
,
title:
"Dashboard"
%body
{
class:
"#{app_theme} application"
,
:'data-page'
=>
body_data_page
}
=
render
"layouts/head_panel"
,
title:
link_to
(
"Snippets"
,
snippets_path
)
=
render
'layouts/page'
,
sidebar:
'layouts/nav/snippets'
app/views/snippets/current_user_index.html.haml
View file @
4a63573b
...
@@ -8,32 +8,29 @@
...
@@ -8,32 +8,29 @@
%p
.light
%p
.light
Share code pastes with others out of git repository
Share code pastes with others out of git repository
%hr
.row
%ul
.nav.nav-tabs
.col-md-3
%ul
.nav.nav-pills.nav-stacked
=
nav_tab
:scope
,
nil
do
=
nav_tab
:scope
,
nil
do
=
link_to
user_snippets_path
(
@user
)
do
=
link_to
user_snippets_path
(
@user
)
do
All
All
%span
.pull-right
%span
.badge
=
@user
.
snippets
.
count
=
@user
.
snippets
.
count
=
nav_tab
:scope
,
'are_private'
do
=
nav_tab
:scope
,
'are_private'
do
=
link_to
user_snippets_path
(
@user
,
scope:
'are_private'
)
do
=
link_to
user_snippets_path
(
@user
,
scope:
'are_private'
)
do
Private
Private
%span
.pull-right
%span
.badge
=
@user
.
snippets
.
are_private
.
count
=
@user
.
snippets
.
are_private
.
count
=
nav_tab
:scope
,
'are_internal'
do
=
nav_tab
:scope
,
'are_internal'
do
=
link_to
user_snippets_path
(
@user
,
scope:
'are_internal'
)
do
=
link_to
user_snippets_path
(
@user
,
scope:
'are_internal'
)
do
Internal
Internal
%span
.pull-right
%span
.badge
=
@user
.
snippets
.
are_internal
.
count
=
@user
.
snippets
.
are_internal
.
count
=
nav_tab
:scope
,
'are_public'
do
=
nav_tab
:scope
,
'are_public'
do
=
link_to
user_snippets_path
(
@user
,
scope:
'are_public'
)
do
=
link_to
user_snippets_path
(
@user
,
scope:
'are_public'
)
do
Public
Public
%span
.pull-right
%span
.badge
=
@user
.
snippets
.
are_public
.
count
=
@user
.
snippets
.
are_public
.
count
.col-md-9
.my-snippets
.my-snippets
=
render
'snippets'
=
render
'snippets'
app/views/snippets/index.html.haml
View file @
4a63573b
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
Public snippets
Public snippets
.pull-right
.pull-right
-
if
current_user
-
if
current_user
=
link_to
new_snippet_path
,
class:
"btn btn-new btn-grouped"
,
title:
"New Snippet"
do
=
link_to
new_snippet_path
,
class:
"btn btn-new btn-grouped"
,
title:
"New Snippet"
do
Add new snippet
Add new snippet
...
...
config/routes.rb
View file @
4a63573b
...
@@ -51,7 +51,8 @@ Gitlab::Application.routes.draw do
...
@@ -51,7 +51,8 @@ Gitlab::Application.routes.draw do
get
'raw'
get
'raw'
end
end
end
end
get
'/s/:username'
=>
'snippets#user_index'
,
as: :user_snippets
,
constraints:
{
username:
/.*/
}
get
'/s/:username'
=>
'snippets#index'
,
as: :user_snippets
,
constraints:
{
username:
/.*/
}
#
#
# Invites
# Invites
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment