Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
16559bf21828
Commit
16559bf2
authored
Oct 11, 2011
by
gitlabhq
Browse files
project tile view
parent
70401b990691
Changes
13
Hide whitespace changes
Inline
Side-by-side
app/assets/images/list_view_icon.jpg
0 → 100644
View file @
16559bf2
357 Bytes
app/assets/javascripts/jquery.cookie.js
0 → 100644
View file @
16559bf2
/**
* 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 @
16559bf2
...
...
@@ -525,3 +525,17 @@
#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 @
16559bf2
class
DashboardController
<
ApplicationController
def
index
@projects
=
current_user
.
projects
.
all
end
end
app/helpers/projects_helper.rb
View file @
16559bf2
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 @
16559bf2
...
...
@@ -33,6 +33,10 @@
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 @
16559bf2
timeline
app/views/layouts/application.html.haml
View file @
16559bf2
...
...
@@ -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 @
16559bf2
-#- 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 @
16559bf2
%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 @
16559bf2
-
@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 @
16559bf2
-
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 @
16559bf2
-
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
Supports
Markdown
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