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
020e1a8e
Commit
020e1a8e
authored
Nov 02, 2011
by
gitlabhq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard
parent
83c1194d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
115 additions
and
22 deletions
+115
-22
app/helpers/dashboard_helper.rb
app/helpers/dashboard_helper.rb
+23
-2
app/models/project.rb
app/models/project.rb
+2
-2
app/views/dashboard/index.html.haml
app/views/dashboard/index.html.haml
+13
-11
app/views/layouts/_head_panel.html.erb
app/views/layouts/_head_panel.html.erb
+2
-2
spec/models/project_spec.rb
spec/models/project_spec.rb
+45
-0
spec/requests/dashboard_spec.rb
spec/requests/dashboard_spec.rb
+30
-0
spec/requests/issues_spec.rb
spec/requests/issues_spec.rb
+0
-5
No files found.
app/helpers/dashboard_helper.rb
View file @
020e1a8e
module
DashboardHelper
def
path_to_object
(
project
,
object
)
def
dashboard_feed_path
(
project
,
object
)
case
object
.
class
.
name
.
to_s
when
"Issue"
then
project_issues_path
(
project
,
project
.
issues
.
find
(
object
.
id
))
when
"Grit::Commit"
then
project_commit_path
(
project
,
project
.
repo
.
commits
(
object
.
id
).
first
)
else
"#"
when
"Note"
then
note
=
object
case
note
.
noteable_type
when
"Issue"
then
project_issue_path
(
project
,
note
.
noteable_id
)
when
"Snippet"
then
project_snippet_path
(
project
,
note
.
noteable_id
)
when
"Commit"
then
project_commit_path
(
project
,
:id
=>
note
.
noteable_id
)
else
wall_project_path
(
project
)
end
else
"#"
end
rescue
"#"
end
def
dashboard_feed_title
(
object
)
title
=
case
object
.
class
.
name
.
to_s
when
"Note"
then
markdown
(
object
.
note
)
when
"Issue"
then
object
.
title
when
"Grit::Commit"
then
object
.
safe_message
else
""
end
"[
#{
object
.
class
.
name
}
]
#{
truncate
(
sanitize
(
title
,
:tags
=>
[]),
:length
=>
60
)
}
"
end
end
app/models/project.rb
View file @
020e1a8e
...
...
@@ -136,7 +136,7 @@ class Project < ActiveRecord::Base
notes
.
fresh
.
limit
(
n
)
].
compact
.
flatten
.
sort
do
|
x
,
y
|
y
.
created_at
<=>
x
.
created_at
end
[
0
..
n
]
end
[
0
..
.
n
]
end
def
commit
(
commit_id
=
nil
)
...
...
@@ -160,7 +160,7 @@ class Project < ActiveRecord::Base
y
.
committed_date
<=>
x
.
committed_date
end
commits
[
0
..
n
]
commits
[
0
..
.
n
]
end
def
commits_since
(
date
)
...
...
app/views/dashboard/index.html.haml
View file @
020e1a8e
...
...
@@ -3,12 +3,13 @@
#dashboard-content
.dashboard-content.content
%aside
%h4
%a
.button-small.button-green
{
:href
=>
""
}
New Repository
-
if
current_user
.
can_create_project?
%a
.button-small.button-green
{
:href
=>
new_project_path
}
New Repository
Your Repositories
%ol
.project-list
-
@projects
.
each
do
|
project
|
%li
%a
{
:href
=>
"#"
}
%a
{
:href
=>
project_path
(
project
)
}
%span
.arrow
→
%span
.project-name
=
project
.
name
%span
.time
...
...
@@ -18,19 +19,20 @@
%h2
.icon
%span
>
Dashboard
-
@active_projects
.
each
do
|
project
|
-
@active_projects
.
first
(
3
).
each
do
|
project
|
.project-box.project-updates.ui-box.ui-box-small.ui-box-big
%h3
=
project
.
name
.data
-
project
.
updates
.
each
do
|
update
|
%a
.project-update
{
:href
=>
path_to_object
(
project
,
update
)}
%img
{
:src
=>
"http://placehold.it/40x40"
}
%span
.update-title
[
#{
update
.
class
.
name
}
] added a matcher that helps debugging matching problems
%span
.update-author
%strong
=
update
.
author
.
name
authored
=
time_ago_in_words
(
update
.
created_at
)
ago
%a
.project-update
{
:href
=>
dashboard_feed_path
(
project
,
update
)}
=
image_tag
gravatar_icon
(
update
.
author
.
email
),
:class
=>
"left"
,
:width
=>
40
%span
.update-title
=
dashboard_feed_title
(
update
)
%span
.update-author
%strong
=
update
.
author
.
name
authored
=
time_ago_in_words
(
update
.
created_at
)
ago
%br
/ .project-update
/ .project-updates
...
...
app/views/layouts/_head_panel.html.erb
View file @
020e1a8e
...
...
@@ -22,9 +22,9 @@
<%=
link_to
projects_path
,
:class
=>
current_page?
(
projects_path
)
?
"current project"
:
"project"
do
%>
<span></span>
Projects
<%
end
%>
<%=
link_to
(
admin_root_path
,
:class
=>
admin_namespace?
?
"current admin"
:
"admin"
)
do
%>
<%=
link_to
(
(
current_user
.
is_admin?
?
admin_root_path
:
"#"
),
:class
=>
(
admin_namespace?
?
"current admin"
:
"admin"
)
)
do
%>
<span></span>
Admin
<%
end
if
current_user
.
is_admin?
%>
<%
end
%>
</nav>
</header>
<!-- eo Page Header -->
...
...
spec/models/project_spec.rb
View file @
020e1a8e
...
...
@@ -62,6 +62,51 @@ describe Project do
end
end
describe
"updates"
do
let
(
:project
)
{
Factory
:project
}
before
do
@issue
=
Factory
:issue
,
:project
=>
project
,
:author
=>
Factory
(
:user
),
:assignee
=>
Factory
(
:user
)
@note
=
Factory
:note
,
:project
=>
project
,
:author
=>
Factory
(
:user
)
@commit
=
project
.
fresh_commits
(
1
).
first
end
describe
"return commit, note & issue"
do
it
{
project
.
updates
(
3
).
count
.
should
==
3
}
it
{
project
.
updates
(
3
).
last
.
id
.
should
==
@commit
.
id
}
it
{
project
.
updates
(
3
).
include?
(
@issue
).
should
be_true
}
it
{
project
.
updates
(
3
).
include?
(
@note
).
should
be_true
}
end
end
describe
"last_activity"
do
let
(
:project
)
{
Factory
:project
}
before
do
@note
=
Factory
:note
,
:project
=>
project
,
:author
=>
Factory
(
:user
)
end
it
{
project
.
last_activity
.
should
==
@note
}
it
{
project
.
last_activity_date
.
to_s
.
should
==
@note
.
created_at
.
to_s
}
end
describe
"fresh commits"
do
let
(
:project
)
{
Factory
:project
}
it
{
project
.
fresh_commits
(
3
).
count
.
should
==
3
}
it
{
project
.
fresh_commits
.
first
.
id
.
should
==
"2fb376f61875b58bceee0492e270e9c805294b1a"
}
it
{
project
.
fresh_commits
.
last
.
id
.
should
==
"0dac878dbfe0b9c6104a87d65fe999149a8d862c"
}
end
describe
"Git methods"
do
let
(
:project
)
{
Factory
:project
}
...
...
spec/requests/dashboard_spec.rb
0 → 100644
View file @
020e1a8e
require
'spec_helper'
describe
"Dashboard"
do
before
{
login_as
:user
}
describe
"GET /dashboard"
do
before
do
@project
=
Factory
:project
@project
.
add_access
(
@user
,
:read
,
:write
)
visit
dashboard_path
end
it
"should be on dashboard page"
do
current_path
.
should
==
dashboard_path
end
it
"should have projects panel"
do
within
".project-list"
do
page
.
should
have_content
(
@project
.
name
)
end
end
it
"should have news feed"
do
within
"#news-feed"
do
page
.
should
have_content
(
@project
.
commit
.
author
.
name
)
page
.
should
have_content
(
@project
.
commit
.
safe_message
)
end
end
end
end
spec/requests/issues_spec.rb
View file @
020e1a8e
...
...
@@ -105,11 +105,6 @@ describe "Issues" do
Notify
.
should_not_receive
(
:new_issue_email
)
click_button
"Save"
end
it
"should send valid email to user with email & password"
do
click_button
"Save"
ActionMailer
::
Base
.
deliveries
.
last
.
should
be_nil
end
end
describe
'assign to other'
do
...
...
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