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
961eceda
Commit
961eceda
authored
Oct 18, 2011
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
project dashboard
parent
65608b6a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
69 additions
and
13 deletions
+69
-13
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+7
-9
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+12
-0
app/models/note.rb
app/models/note.rb
+2
-0
app/views/projects/_top_menu.html.haml
app/views/projects/_top_menu.html.haml
+2
-1
app/views/projects/show.html.haml
app/views/projects/show.html.haml
+46
-3
No files found.
app/controllers/projects_controller.rb
View file @
961eceda
...
...
@@ -6,7 +6,7 @@ class ProjectsController < ApplicationController
before_filter
:authorize_read_project!
,
:except
=>
[
:index
,
:new
,
:create
]
before_filter
:authorize_admin_project!
,
:only
=>
[
:edit
,
:update
,
:destroy
]
before_filter
:require_non_empty_project
,
:only
=>
[
:blob
,
:tree
]
before_filter
:require_non_empty_project
,
:only
=>
[
:blob
,
:tree
,
:show
]
def
index
@projects
=
current_user
.
projects
.
all
...
...
@@ -60,15 +60,13 @@ class ProjectsController < ApplicationController
end
def
show
@repo
=
project
.
repo
@commit
=
@repo
.
commits
.
first
@tree
=
@commit
.
tree
@tree
=
@tree
/
params
[
:path
]
if
params
[
:path
]
@date
=
Date
.
today
-
7
.
days
@heads
=
@project
.
repo
.
heads
@commits
=
@heads
.
map
do
|
h
|
@project
.
repo
.
log
(
h
.
name
,
nil
,
:since
=>
@date
)
end
.
flatten
.
uniq
{
|
c
|
c
.
id
}
rescue
Grit
::
NoSuchPathError
=>
ex
respond_to
do
|
format
|
format
.
html
{
render
"projects/empty"
}
end
@messages
=
project
.
notes
.
last_week
.
limit
(
40
).
order
(
"created_at DESC"
)
end
#
...
...
app/helpers/projects_helper.rb
View file @
961eceda
...
...
@@ -3,4 +3,16 @@ module ProjectsHelper
cookies
[
"project_view"
]
||=
"tile"
cookies
[
"project_view"
]
==
type
?
nil
:
"display:none"
end
def
noteable_link
(
id
,
type
,
project
)
case
type
when
"Issue"
link_to
"Issue #
#{
id
}
"
,
project_issue_path
(
project
,
id
)
when
"Commit"
commit
=
project
.
repo
.
commits
(
id
).
first
link_to
truncate
(
commit
.
id
,
:length
=>
10
),
project_commit_path
(
project
,
id
)
else
link_to
"Wall"
,
wall_project_path
(
project
)
end
end
end
app/models/note.rb
View file @
961eceda
...
...
@@ -22,6 +22,8 @@ class Note < ActiveRecord::Base
scope
:common
,
where
(
:noteable_id
=>
nil
)
scope
:last_week
,
where
(
"created_at >= :date"
,
:date
=>
(
Date
.
today
-
7
.
days
))
mount_uploader
:attachment
,
AttachmentUploader
end
# == Schema Information
...
...
app/views/projects/_top_menu.html.haml
View file @
961eceda
%div
.top_project_menu
-#%span= link_to @project.code.capitalize, @project, :class => current_page?(:controller => "projects", :action => "show", :id => @project) ? "current" : nil
-
if
@project
.
repo_exists?
%span
=
link_to
"Tree"
,
tree_project_path
(
@project
),
:class
=>
current_page?
(
:controller
=>
"projects"
,
:action
=>
"show"
,
:id
=>
@project
)
||
current_page?
(
:controller
=>
"projects"
,
:action
=>
"tree"
,
:id
=>
@project
)
?
"current"
:
nil
%span
=
link_to
image_tag
(
"home.png"
,
:width
=>
20
),
project_path
(
@project
),
:class
=>
current_page?
(
:controller
=>
"projects"
,
:action
=>
"show"
,
:id
=>
@project
)
?
"current"
:
nil
%span
=
link_to
"Tree"
,
tree_project_path
(
@project
),
:class
=>
current_page?
(
:controller
=>
"projects"
,
:action
=>
"tree"
,
:id
=>
@project
)
?
"current"
:
nil
%span
=
link_to
"Commits"
,
project_commits_path
(
@project
),
:class
=>
current_page?
(
:controller
=>
"commits"
,
:action
=>
"index"
,
:project_id
=>
@project
)
?
"current"
:
nil
%span
=
link_to
team_project_path
(
@project
),
:class
=>
current_page?
(
:controller
=>
"projects"
,
:action
=>
"team"
,
:id
=>
@project
)
?
"current"
:
nil
do
...
...
app/views/projects/show.html.haml
View file @
961eceda
%div
%div
#tree-holder
=
render
:partial
=>
"tree"
,
:locals
=>
{
:repo
=>
@repo
,
:commit
=>
@commit
,
:tree
=>
@commit
.
tree
}
.span-12
%h2
Recent commits
%hr
-
@commits
.
each
do
|
commit
|
%div
.commit
-
if
commit
.
author
.
email
=
image_tag
gravatar_icon
(
commit
.
author
.
email
),
:class
=>
"left"
,
:width
=>
40
,
:style
=>
"padding-right:5px;"
-
else
=
image_tag
"no_avatar.png"
,
:class
=>
"left"
,
:width
=>
40
,
:style
=>
"padding-right:5px;"
%p
{
:style
=>
"margin-bottom: 3px;"
}
%strong
=
link_to
truncate_commit_message
(
commit
,
60
),
project_commit_path
(
@project
,
:id
=>
commit
.
id
)
%span
%span
[
#{
commit
.
author
}
]
%cite
=
time_ago_in_words
(
commit
.
committed_date
)
ago
%br
.span-11
%h2
Recent Messages
%hr
-
@messages
.
group_by
{
|
x
|
[
x
.
noteable_id
,
x
.
noteable_type
]}.
each
do
|
item
,
notes
|
%h3
=
noteable_link
(
item
[
0
],
item
[
1
],
@project
)
-
notes
.
each
do
|
note
|
%div
.message
.span-2
=
image_tag
gravatar_icon
(
note
.
author
.
email
),
:class
=>
"left"
,
:width
=>
40
,
:style
=>
"padding-right:5px;"
%p
{
:style
=>
"margin-bottom: 3px;"
}
=
link_to
truncate
(
note
.
note
,
:length
=>
50
),
"#"
-
if
note
.
attachment
.
url
%br
Attachment:
=
link_to
note
.
attachment_identifier
,
note
.
attachment
.
url
%br
%span
%span
[
#{
note
.
author
.
name
}
]
%cite
=
time_ago_in_words
(
note
.
created_at
)
ago
%br
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