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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
bd34ca3c
Commit
bd34ca3c
authored
Oct 11, 2011
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
project tile view
parent
495d29da
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
131 additions
and
27 deletions
+131
-27
app/assets/images/list_view_icon.jpg
app/assets/images/list_view_icon.jpg
+0
-0
app/assets/javascripts/jquery.cookie.js
app/assets/javascripts/jquery.cookie.js
+41
-0
app/assets/stylesheets/projects.css.scss
app/assets/stylesheets/projects.css.scss
+14
-0
app/controllers/dashboard_controller.rb
app/controllers/dashboard_controller.rb
+3
-0
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+4
-0
app/models/user.rb
app/models/user.rb
+4
-0
app/views/dashboard/index.html.haml
app/views/dashboard/index.html.haml
+1
-0
app/views/layouts/application.html.haml
app/views/layouts/application.html.haml
+1
-0
app/views/projects/_list.html.haml
app/views/projects/_list.html.haml
+26
-0
app/views/projects/_projects_top_menu.html.haml
app/views/projects/_projects_top_menu.html.haml
+16
-0
app/views/projects/_tile.html.haml
app/views/projects/_tile.html.haml
+16
-0
app/views/projects/_tree_item.html.haml
app/views/projects/_tree_item.html.haml
+1
-1
app/views/projects/index.html.haml
app/views/projects/index.html.haml
+4
-26
No files found.
app/assets/images/list_view_icon.jpg
0 → 100644
View file @
bd34ca3c
357 Bytes
app/assets/javascripts/jquery.cookie.js
0 → 100644
View file @
bd34ca3c
/**
* jQuery Cookie plugin
*
* Copyright (c) 2010 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
jQuery
.
cookie
=
function
(
key
,
value
,
options
)
{
// key and at least value given, set cookie...
if
(
arguments
.
length
>
1
&&
String
(
value
)
!==
"
[object Object]
"
)
{
options
=
jQuery
.
extend
({},
options
);
if
(
value
===
null
||
value
===
undefined
)
{
options
.
expires
=
-
1
;
}
if
(
typeof
options
.
expires
===
'
number
'
)
{
var
days
=
options
.
expires
,
t
=
options
.
expires
=
new
Date
();
t
.
setDate
(
t
.
getDate
()
+
days
);
}
value
=
String
(
value
);
return
(
document
.
cookie
=
[
encodeURIComponent
(
key
),
'
=
'
,
options
.
raw
?
value
:
encodeURIComponent
(
value
),
options
.
expires
?
'
; expires=
'
+
options
.
expires
.
toUTCString
()
:
''
,
// use expires attribute, max-age is not supported by IE
options
.
path
?
'
; path=
'
+
options
.
path
:
''
,
options
.
domain
?
'
; domain=
'
+
options
.
domain
:
''
,
options
.
secure
?
'
; secure
'
:
''
].
join
(
''
));
}
// key and possibly options given, get cookie...
options
=
value
||
{};
var
result
,
decode
=
options
.
raw
?
function
(
s
)
{
return
s
;
}
:
decodeURIComponent
;
return
(
result
=
new
RegExp
(
'
(?:^|; )
'
+
encodeURIComponent
(
key
)
+
'
=([^;]*)
'
).
exec
(
document
.
cookie
))
?
decode
(
result
[
1
])
:
null
;
};
app/assets/stylesheets/projects.css.scss
View file @
bd34ca3c
...
...
@@ -525,3 +525,17 @@ tbody tr:nth-child(2n) td, tbody tr.even td {
#user_projects_limit
{
width
:
60px
;
}
.project_thumb
{
margin
:
20px
0
;
width
:
250px
;
float
:left
;
padding
:
20px
;
text-align
:center
;
p
,
h4
{
text-align
:left
;
}
.lbutton
{
float
:left
;
}
}
app/controllers/dashboard_controller.rb
View file @
bd34ca3c
class
DashboardController
<
ApplicationController
def
index
@projects
=
current_user
.
projects
.
all
end
end
app/helpers/projects_helper.rb
View file @
bd34ca3c
module
ProjectsHelper
def
view_mode_style
(
type
)
cookies
[
"project_view"
]
||=
"tile"
cookies
[
"project_view"
]
==
type
?
nil
:
"display:none"
end
end
app/models/user.rb
View file @
bd34ca3c
...
...
@@ -33,6 +33,10 @@ class User < ActiveRecord::Base
def
can_create_project?
projects_limit
>=
my_own_projects
.
count
end
def
last_activity_project
projects
.
first
end
end
# == Schema Information
#
...
...
app/views/dashboard/index.html.haml
View file @
bd34ca3c
timeline
app/views/layouts/application.html.haml
View file @
bd34ca3c
...
...
@@ -21,6 +21,7 @@
=
render
:partial
=>
"layouts/head_panel"
.top_bar.container
=
render
:partial
=>
"projects/top_menu"
if
@project
&&
!
@project
.
new_record?
=
render
:partial
=>
"projects/projects_top_menu"
if
(
controller
.
controller_name
==
"projects"
&&
[
"index"
,
"new"
,
"create"
].
include?
(
controller
.
action_name
))
&&
!
admin_namespace?
=
render
:partial
=>
"profile/top_menu"
if
[
"keys"
,
"profile"
].
include?
(
controller
.
controller_name
)
=
render
:partial
=>
"admin/top_menu"
if
admin_namespace?
#content-container
.container
...
...
app/views/projects/_list.html.haml
0 → 100644
View file @
bd34ca3c
-#- if current_user.can_create_project?
= link_to 'New Project', new_project_path, :class => "lbutton vm"
%table
.round-borders
#projects-list
%tr
%th
Name
%th
Path
%th
Code
%th
Web
%th
Git
%th
Admin
%th
Actions
-
@projects
.
each
do
|
project
|
%tr
{
:class
=>
"project"
,
:url
=>
project_path
(
project
)
}
%td
=
project
.
name
%td
=
truncate
project
.
url_to_repo
%td
=
project
.
code
%td
=
check_box_tag
"read"
,
1
,
project
.
readers
.
include?
(
current_user
),
:disabled
=>
:disabled
%td
=
check_box_tag
"commit"
,
1
,
project
.
writers
.
include?
(
current_user
),
:disabled
=>
:disabled
%td
=
check_box_tag
"admin"
,
1
,
project
.
admins
.
include?
(
current_user
),
:disabled
=>
:disabled
%td
-
if
can?
current_user
,
:admin_project
,
project
=
link_to
'Edit'
,
edit_project_path
(
project
),
:class
=>
"lbutton positive"
%br
app/views/projects/_projects_top_menu.html.haml
0 → 100644
View file @
bd34ca3c
%div
.top_project_menu
%span
=
link_to
'All'
,
projects_path
,
:class
=>
current_page?
(
projects_path
)
?
"current"
:
nil
%span
=
link_to
"New Project"
,
new_project_path
,
:class
=>
current_page?
(
:controller
=>
"projects"
,
:action
=>
"new"
)
?
"current"
:
nil
%span
.right
=
link_to_function
(
image_tag
(
"list_view_icon.jpg"
),
"switchProjectView()"
,
:style
=>
"border:none;box-shadow:none;"
)
:javascript
function
switchProjectView
(){
$
(
"
.tile
"
).
toggle
();
$
(
"
.list
"
).
toggle
();
if
(
$
(
"
.tile
"
).
is
(
"
:visible
"
)){
$
.
cookie
(
'
project_view
'
,
'
tile
'
,
{
expires
:
14
});
}
else
{
$
.
cookie
(
'
project_view
'
,
'
list
'
,
{
expires
:
14
});
}
}
app/views/projects/_tile.html.haml
0 → 100644
View file @
bd34ca3c
-
@projects
.
in_groups_of
(
3
,
false
)
do
|
projects
|
-
projects
.
each_with_index
do
|
project
,
i
|
%div
{
:class
=>
"project_thumb round-borders"
,
:style
=>
i
==
2
?
""
:
"margin-right:30px;"
}
%div
{
:class
=>
"project"
,
:url
=>
project_path
(
project
)
}
%h2
=
image_tag
gravatar_icon
(
project
.
name
),
:class
=>
"left"
,
:width
=>
40
,
:style
=>
"padding-right:5px;"
=
"/"
+
project
.
code
%p
=
project
.
name
%p
=
project
.
url_to_repo
-#%p
Commit –
= last_commit(project)
%hr
=
link_to
"Browse Code"
,
tree_project_path
(
project
),
:class
=>
"lbutton"
=
link_to
"Commits"
,
project_commits_path
(
project
),
:class
=>
"lbutton"
,
:style
=>
"float:right;width:80px;"
.clear
app/views/projects/_tree_item.html.haml
View file @
bd34ca3c
-
file
=
params
[
:path
]
?
File
.
join
(
params
[
:path
],
content
.
name
)
:
content
.
name
-
content_commit
=
@repo
.
log
(
@branch
,
file
,
:max_count
=>
1
).
last
-
content_commit
=
@
project
.
repo
.
log
(
@branch
,
file
,
:max_count
=>
1
).
last
-
return
unless
content_commit
%tr
{
:class
=>
"tree-item"
,
:url
=>
tree_file_project_path
(
@project
,
@commit
.
id
,
file
)
}
%td
.tree-item-file-name
...
...
app/views/projects/index.html.haml
View file @
bd34ca3c
-
if
current_user
.
can_create_project?
=
link_to
'New Project'
,
new_project_path
,
:class
=>
"lbutton vm"
%table
.round-borders
#projects-list
%tr
%th
Name
%th
Path
%th
Code
%th
Web
%th
Git
%th
Admin
%th
Actions
-
@projects
.
each
do
|
project
|
%tr
{
:class
=>
"project"
,
:url
=>
project_path
(
project
)
}
%td
=
project
.
name
%td
=
truncate
project
.
url_to_repo
%td
=
project
.
code
%td
=
check_box_tag
"read"
,
1
,
project
.
readers
.
include?
(
current_user
),
:disabled
=>
:disabled
%td
=
check_box_tag
"commit"
,
1
,
project
.
writers
.
include?
(
current_user
),
:disabled
=>
:disabled
%td
=
check_box_tag
"admin"
,
1
,
project
.
admins
.
include?
(
current_user
),
:disabled
=>
:disabled
%td
-
if
can?
current_user
,
:admin_project
,
project
=
link_to
'Edit'
,
edit_project_path
(
project
),
:class
=>
"lbutton positive"
%br
%div
{
:class
=>
"tile"
,
:style
=>
view_mode_style
(
"tile"
)}
=
render
"tile"
%div
{
:class
=>
"list"
,
:style
=>
view_mode_style
(
"list"
)}
=
render
"list"
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