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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
c0f02aad
Commit
c0f02aad
authored
May 02, 2016
by
Long Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add snippet tab under user profile
parent
df8fda60
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
3 deletions
+39
-3
app/assets/javascripts/user_tabs.js.coffee
app/assets/javascripts/user_tabs.js.coffee
+8
-1
app/controllers/users_controller.rb
app/controllers/users_controller.rb
+22
-0
app/views/users/show.html.haml
app/views/users/show.html.haml
+6
-0
config/routes.rb
config/routes.rb
+3
-2
No files found.
app/assets/javascripts/user_tabs.js.coffee
View file @
c0f02aad
...
...
@@ -26,6 +26,10 @@
# Personal projects
# </a>
# </li>
# <li class="snippets-tab">
# <a data-action="snippets" data-target="#snippets" data-toggle="tab" href="/u/username/snippets">
# </a>
# </li>
# </ul>
#
# <div class="tab-content">
...
...
@@ -41,6 +45,9 @@
# <div class="tab-pane" id="projects">
# Projects content
# </div>
# <div class="tab-pane" id="snippets">
# Snippets content
# </div>
# </div>
#
# <div class="loading-status">
...
...
@@ -100,7 +107,7 @@ class @UserTabs
if
action
is
'activity'
@
loadActivities
(
source
)
if
action
in
[
'groups'
,
'contributed'
,
'projects'
]
if
action
in
[
'groups'
,
'contributed'
,
'projects'
,
'snippets'
]
@
loadTab
(
source
,
action
)
loadTab
:
(
source
,
action
)
->
...
...
app/controllers/users_controller.rb
View file @
c0f02aad
...
...
@@ -58,6 +58,19 @@ class UsersController < ApplicationController
end
end
def
snippets
load_snippets
respond_to
do
|
format
|
format
.
html
{
render
'show'
}
format
.
json
do
render
json:
{
html:
view_to_html_string
(
"snippets/_snippets"
,
collection:
@snippets
)
}
end
end
end
def
calendar
calendar
=
contributions_calendar
@timestamps
=
calendar
.
timestamps
...
...
@@ -116,6 +129,15 @@ class UsersController < ApplicationController
@groups
=
JoinedGroupsFinder
.
new
(
user
).
execute
(
current_user
)
end
def
load_snippets
@snippets
=
SnippetsFinder
.
new
.
execute
(
current_user
,
filter: :by_user
,
user:
user
,
scope:
params
[
:scope
]
).
page
(
params
[
:page
])
end
def
projects_for_current_user
ProjectsFinder
.
new
.
execute
(
current_user
)
end
...
...
app/views/users/show.html.haml
View file @
c0f02aad
...
...
@@ -81,6 +81,9 @@
%li
.projects-tab
=
link_to
user_projects_path
,
data:
{
target:
'div#projects'
,
action:
'projects'
,
toggle:
'tab'
}
do
Personal projects
%li
.snippets-tab
=
link_to
user_snippets_path
,
data:
{
target:
'div#snippets'
,
action:
'snippets'
,
toggle:
'tab'
}
do
Snippets
%div
{
class:
container_class
}
.tab-content
...
...
@@ -104,6 +107,9 @@
#projects
.tab-pane
-
# This tab is always loaded via AJAX
#snippets
.tab-pane
-
# This tab is always loaded via AJAX
.loading-status
=
spinner
...
...
config/routes.rb
View file @
c0f02aad
...
...
@@ -89,8 +89,6 @@ Rails.application.routes.draw do
end
end
get
'/s/:username'
=>
'snippets#index'
,
as: :user_snippets
,
constraints:
{
username:
/.*/
}
#
# Invites
#
...
...
@@ -355,6 +353,9 @@ Rails.application.routes.draw do
get
'u/:username/contributed'
=>
'users#contributed'
,
as: :user_contributed_projects
,
constraints:
{
username:
/.*/
}
get
'u/:username/snippets'
=>
'users#snippets'
,
as: :user_snippets
,
constraints:
{
username:
/.*/
}
get
'/u/:username'
=>
'users#show'
,
as: :user
,
constraints:
{
username:
/[a-zA-Z.0-9_\-]+(?<!\.atom)/
}
...
...
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