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
b54358b4
Commit
b54358b4
authored
Aug 26, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor project list rendering
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
c27c8133
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
119 additions
and
77 deletions
+119
-77
app/assets/javascripts/dispatcher.js.coffee
app/assets/javascripts/dispatcher.js.coffee
+0
-4
app/assets/stylesheets/base/mixins.scss
app/assets/stylesheets/base/mixins.scss
+37
-0
app/assets/stylesheets/generic/lists.scss
app/assets/stylesheets/generic/lists.scss
+2
-18
app/assets/stylesheets/pages/projects.scss
app/assets/stylesheets/pages/projects.scss
+22
-13
app/views/dashboard/_projects.html.haml
app/views/dashboard/_projects.html.haml
+1
-4
app/views/dashboard/projects/starred.html.haml
app/views/dashboard/projects/starred.html.haml
+1
-2
app/views/explore/projects/_projects.html.haml
app/views/explore/projects/_projects.html.haml
+6
-6
app/views/groups/_projects.html.haml
app/views/groups/_projects.html.haml
+1
-1
app/views/search/_results.html.haml
app/views/search/_results.html.haml
+5
-1
app/views/search/results/_project.html.haml
app/views/search/results/_project.html.haml
+0
-6
app/views/shared/_project.html.haml
app/views/shared/_project.html.haml
+0
-20
app/views/shared/projects/_list.html.haml
app/views/shared/projects/_list.html.haml
+19
-0
app/views/shared/projects/_project.html.haml
app/views/shared/projects/_project.html.haml
+23
-0
app/views/users/_projects.html.haml
app/views/users/_projects.html.haml
+2
-2
No files found.
app/assets/javascripts/dispatcher.js.coffee
View file @
b54358b4
...
@@ -55,7 +55,6 @@ class Dispatcher
...
@@ -55,7 +55,6 @@ class Dispatcher
new
Activities
()
new
Activities
()
when
'dashboard:projects:starred'
when
'dashboard:projects:starred'
new
Activities
()
new
Activities
()
new
ProjectsList
()
when
'projects:commit:show'
when
'projects:commit:show'
new
Commit
()
new
Commit
()
new
Diff
()
new
Diff
()
...
@@ -70,7 +69,6 @@ class Dispatcher
...
@@ -70,7 +69,6 @@ class Dispatcher
when
'groups:show'
when
'groups:show'
new
Activities
()
new
Activities
()
shortcut_handler
=
new
ShortcutsNavigation
()
shortcut_handler
=
new
ShortcutsNavigation
()
new
ProjectsList
()
when
'groups:group_members:index'
when
'groups:group_members:index'
new
GroupMembers
()
new
GroupMembers
()
new
UsersSelect
()
new
UsersSelect
()
...
@@ -96,8 +94,6 @@ class Dispatcher
...
@@ -96,8 +94,6 @@ class Dispatcher
when
'users:show'
when
'users:show'
new
User
()
new
User
()
new
Activities
()
new
Activities
()
when
'admin:users:show'
new
ProjectsList
()
switch
path
.
first
()
switch
path
.
first
()
when
'admin'
when
'admin'
...
...
app/assets/stylesheets/base/mixins.scss
View file @
b54358b4
...
@@ -157,3 +157,40 @@
...
@@ -157,3 +157,40 @@
white-space
:
nowrap
;
white-space
:
nowrap
;
max-width
:
$max_width
;
max-width
:
$max_width
;
}
}
/*
* Base mixin for lists in GitLab
*/
@mixin
basic-list
{
margin
:
5px
0px
;
padding
:
0px
;
li
{
padding
:
10px
0
;
border-bottom
:
1px
solid
#EEE
;
overflow
:
hidden
;
display
:
block
;
margin
:
0px
;
&
:last-child
{
border
:none
}
&
.active
{
background
:
#f9f9f9
;
a
{
font-weight
:
bold
;
}
}
&
.hide
{
display
:
none
;
}
&
.light
{
a
{
color
:
#777
;
}
}
}
}
app/assets/stylesheets/generic/lists.scss
View file @
b54358b4
...
@@ -93,28 +93,12 @@ ol, ul {
...
@@ -93,28 +93,12 @@ ol, ul {
/** light list with border-bottom between li **/
/** light list with border-bottom between li **/
ul
.bordered-list
{
ul
.bordered-list
{
margin
:
5px
0px
;
@include
basic-list
;
padding
:
0px
;
li
{
padding
:
5px
0
;
border-bottom
:
1px
solid
#EEE
;
overflow
:
hidden
;
display
:
block
;
margin
:
0px
;
&
:last-child
{
border
:none
}
&
.active
{
background
:
#f9f9f9
;
a
{
font-weight
:
bold
;
}
}
&
.light
{
a
{
color
:
#777
;
}
}
}
&
.top-list
{
&
.top-list
{
li
:first-child
{
li
:first-child
{
padding-top
:
0
;
padding-top
:
0
;
h4
,
h5
{
h4
,
h5
{
margin-top
:
0
;
margin-top
:
0
;
}
}
...
...
app/assets/stylesheets/pages/projects.scss
View file @
b54358b4
...
@@ -334,8 +334,15 @@ pre.light-well {
...
@@ -334,8 +334,15 @@ pre.light-well {
}
}
}
}
.project-row
{
/*
* Projects list rendered on dashboard and user page
*/
.projects-list
{
@include
basic-list
;
.project-row
{
.project-full-name
{
.project-full-name
{
@include
str-truncated
;
font-weight
:
bold
;
font-weight
:
bold
;
font-size
:
15px
;
font-size
:
15px
;
}
}
...
@@ -345,12 +352,14 @@ pre.light-well {
...
@@ -345,12 +352,14 @@ pre.light-well {
font-size
:
13px
;
font-size
:
13px
;
p
{
p
{
@include
str-truncated
;
margin-bottom
:
0
;
margin-bottom
:
0
;
color
:
#888
;
color
:
#888
;
}
}
}
}
}
}
}
.
my-projects
.project-row
{
.
panel
.projects-list
li
{
padding
:
10px
0
;
padding
:
10px
15px
;
}
}
app/views/dashboard/_projects.html.haml
View file @
b54358b4
...
@@ -7,7 +7,4 @@
...
@@ -7,7 +7,4 @@
=
link_to
new_project_path
,
class:
'btn btn-success'
do
=
link_to
new_project_path
,
class:
'btn btn-success'
do
New project
New project
%ul
.projects-list.bordered-list.my-projects
=
render
'shared/projects/list'
,
projects:
@projects
-
@projects
.
each
do
|
project
|
%li
.project-row
=
render
partial:
'shared/project'
,
locals:
{
project:
project
,
avatar:
true
,
stars:
true
}
app/views/dashboard/projects/starred.html.haml
View file @
b54358b4
...
@@ -17,8 +17,7 @@
...
@@ -17,8 +17,7 @@
=
link_to
new_project_path
,
class:
'btn btn-success'
do
=
link_to
new_project_path
,
class:
'btn btn-success'
do
New project
New project
=
render
'shared/projects_list'
,
projects:
@projects
,
=
render
'shared/projects/list'
,
projects:
@projects
,
projects_limit:
20
projects_limit:
20
,
stars:
true
,
avatar:
false
-
else
-
else
%h3
You don't have starred projects yet
%h3
You don't have starred projects yet
...
...
app/views/explore/projects/_projects.html.haml
View file @
b54358b4
%ul
.projects-list.bordered-list.my-projects.public-projects
-
if
projects
.
any?
-
projects
.
each
do
|
project
|
.public-projects
%li
.project-row
=
render
'shared/projects/list'
,
projects:
projects
=
render
partial:
'shared/project'
,
locals:
{
project:
project
,
avatar:
true
,
stars:
true
}
-
else
-
unless
projects
.
present?
.nothing-here-block
.nothing-here-block
No such projects
No such projects
app/views/groups/_projects.html.haml
View file @
b54358b4
...
@@ -7,4 +7,4 @@
...
@@ -7,4 +7,4 @@
=
link_to
new_project_path
(
namespace_id:
@group
.
id
),
class:
'btn btn-success'
do
=
link_to
new_project_path
(
namespace_id:
@group
.
id
),
class:
'btn btn-success'
do
New project
New project
=
render
'shared/projects
_
list'
,
projects:
@projects
,
projects_limit:
20
=
render
'shared/projects
/
list'
,
projects:
@projects
,
projects_limit:
20
app/views/search/_results.html.haml
View file @
b54358b4
...
@@ -14,6 +14,10 @@
...
@@ -14,6 +14,10 @@
%br
%br
.results.prepend-top-10
.results.prepend-top-10
.search-results
.search-results
-
if
@scope
==
'projects'
.term
=
render
'shared/projects/list'
,
projects:
@objects
-
else
=
render
partial:
"search/results/
#{
@scope
.
singularize
}
"
,
collection:
@objects
=
render
partial:
"search/results/
#{
@scope
.
singularize
}
"
,
collection:
@objects
=
paginate
@objects
,
theme:
'gitlab'
=
paginate
@objects
,
theme:
'gitlab'
...
...
app/views/search/results/_project.html.haml
deleted
100644 → 0
View file @
c27c8133
.search-result-row
%h4
=
link_to
[
project
.
namespace
.
becomes
(
Namespace
),
project
]
do
%span
.term
=
project
.
name_with_namespace
-
if
project
.
description
.
present?
%span
.light.term
=
project
.
description
app/views/shared/_project.html.haml
deleted
100644 → 0
View file @
c27c8133
=
cache
[
project
.
namespace
,
project
,
controller
.
controller_name
,
controller
.
action_name
]
do
=
link_to
project_path
(
project
),
class:
dom_class
(
project
)
do
-
if
avatar
.dash-project-avatar
=
project_icon
(
project
,
alt:
''
,
class:
'avatar project-avatar s40'
)
%span
.str-truncated.project-full-name
%span
.namespace-name
-
if
project
.
namespace
=
project
.
namespace
.
human_name
\/
%span
.project-name.filter-title
=
project
.
name
-
if
stars
%span
.pull-right.light
%i
.fa.fa-star
=
project
.
star_count
-
if
project
.
description
.
present?
.project-description
.str-truncated
=
markdown
(
project
.
description
,
pipeline: :description
)
app/views/shared/
_projects
_list.html.haml
→
app/views/shared/
projects/
_list.html.haml
View file @
b54358b4
-
projects_limit
=
20
unless
local_assigns
[
:projects_limit
]
-
projects_limit
=
20
unless
local_assigns
[
:projects_limit
]
-
avatar
=
true
unless
local_assigns
[
:avatar
]
==
false
-
avatar
=
true
unless
local_assigns
[
:avatar
]
==
false
-
stars
=
false
unless
local_assigns
[
:stars
]
==
true
-
stars
=
true
unless
local_assigns
[
:stars
]
==
false
%ul
.well-list.projects-list
%ul
.projects-list
-
projects
.
each_with_index
do
|
project
,
i
|
-
projects
.
each_with_index
do
|
project
,
i
|
%li
{
class:
(
i
>=
projects_limit
)
?
'project-row hide'
:
'project-row'
}
-
css_class
=
(
i
>=
projects_limit
)
?
'hide'
:
nil
=
render
"shared/project"
,
project:
project
,
avatar:
avatar
,
stars:
stars
=
render
"shared/projects/project"
,
project:
project
,
-
if
projects
.
blank?
avatar:
avatar
,
stars:
stars
,
css_class:
css_class
%li
.nothing-here-block
There are no projects here.
-
if
projects
.
count
>
projects_limit
-
if
projects
.
count
>
projects_limit
%li
.bottom
%li
.bottom
.center
%span
.light
.light
#{
projects_limit
}
of
#{
pluralize
(
projects
.
count
,
'project'
)
}
displayed.
#{
projects_limit
}
of
#{
pluralize
(
projects
.
count
,
'project'
)
}
displayed.
%span
=
link_to
'#'
,
class:
'js-expand'
do
=
link_to
'#'
,
class:
'js-expand'
do
Show all
Show all
:coffeescript
new ProjectsList()
app/views/shared/projects/_project.html.haml
0 → 100644
View file @
b54358b4
-
avatar
=
true
unless
local_assigns
[
:avatar
]
==
false
-
stars
=
true
unless
local_assigns
[
:stars
]
==
false
-
css_class
=
nil
unless
local_assigns
[
:css_class
]
%li
.project-row
{
class:
css_class
}
=
cache
[
project
.
namespace
,
project
,
controller
.
controller_name
,
controller
.
action_name
,
'v2'
]
do
=
link_to
project_path
(
project
),
class:
dom_class
(
project
)
do
-
if
avatar
.dash-project-avatar
=
project_icon
(
project
,
alt:
''
,
class:
'avatar project-avatar s40'
)
%span
.project-full-name
%span
.namespace-name
-
if
project
.
namespace
=
project
.
namespace
.
human_name
\/
%span
.project-name.filter-title
=
project
.
name
-
if
stars
%span
.pull-right.light
%i
.fa.fa-star
=
project
.
star_count
-
if
project
.
description
.
present?
.project-description
=
markdown
(
project
.
description
,
pipeline: :description
)
app/views/users/_projects.html.haml
View file @
b54358b4
-
if
local_assigns
.
has_key?
(
:contributed_projects
)
&&
contributed_projects
.
present?
-
if
local_assigns
.
has_key?
(
:contributed_projects
)
&&
contributed_projects
.
present?
.panel.panel-default.contributed-projects
.panel.panel-default.contributed-projects
.panel-heading
Projects contributed to
.panel-heading
Projects contributed to
=
render
'shared/projects
_
list'
,
=
render
'shared/projects
/
list'
,
projects:
contributed_projects
.
sort_by
(
&
:star_count
).
reverse
,
projects:
contributed_projects
.
sort_by
(
&
:star_count
).
reverse
,
projects_limit:
5
,
stars:
true
,
avatar:
false
projects_limit:
5
,
stars:
true
,
avatar:
false
-
if
local_assigns
.
has_key?
(
:projects
)
&&
projects
.
present?
-
if
local_assigns
.
has_key?
(
:projects
)
&&
projects
.
present?
.panel.panel-default
.panel.panel-default
.panel-heading
Personal projects
.panel-heading
Personal projects
=
render
'shared/projects
_
list'
,
=
render
'shared/projects
/
list'
,
projects:
projects
.
sort_by
(
&
:star_count
).
reverse
,
projects:
projects
.
sort_by
(
&
:star_count
).
reverse
,
projects_limit:
10
,
stars:
true
,
avatar:
false
projects_limit:
10
,
stars:
true
,
avatar:
false
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