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
ac7fab73
Commit
ac7fab73
authored
Oct 08, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7938 from cirosantilli/factor-dashboard-helper
Factor dashboard helper methods.
parents
cf1aa36a
da99560e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
21 deletions
+12
-21
app/helpers/dashboard_helper.rb
app/helpers/dashboard_helper.rb
+12
-21
No files found.
app/helpers/dashboard_helper.rb
View file @
ac7fab73
...
@@ -37,40 +37,31 @@ module DashboardHelper
...
@@ -37,40 +37,31 @@ module DashboardHelper
end
end
def
assigned_entities_count
(
current_user
,
entity
,
scope
=
nil
)
def
assigned_entities_count
(
current_user
,
entity
,
scope
=
nil
)
items
=
current_user
.
send
(
"assigned_"
+
entity
.
pluralize
).
opened
items
=
current_user
.
send
(
'assigned_'
+
entity
.
pluralize
)
get_count
(
items
,
scope
)
if
scope
.
kind_of?
(
Group
)
items
=
items
.
of_group
(
scope
)
elsif
scope
.
kind_of?
(
Project
)
items
=
items
.
of_projects
(
scope
)
end
items
.
count
end
end
def
authored_entities_count
(
current_user
,
entity
,
scope
=
nil
)
def
authored_entities_count
(
current_user
,
entity
,
scope
=
nil
)
items
=
current_user
.
send
(
entity
.
pluralize
).
opened
items
=
current_user
.
send
(
entity
.
pluralize
)
get_count
(
items
,
scope
)
if
scope
.
kind_of?
(
Group
)
items
=
items
.
of_group
(
scope
)
elsif
scope
.
kind_of?
(
Project
)
items
=
items
.
of_projects
(
scope
)
end
end
items
.
count
def
authorized_entities_count
(
current_user
,
entity
,
scope
=
nil
)
items
=
entity
.
classify
.
constantize
get_count
(
items
,
scope
,
true
,
current_user
)
end
end
def
authorized_entities_count
(
current_user
,
entity
,
scope
=
nil
)
protected
items
=
entity
.
classify
.
constantize
.
opened
def
get_count
(
items
,
scope
,
get_authorized
=
false
,
current_user
=
nil
)
items
=
items
.
opened
if
scope
.
kind_of?
(
Group
)
if
scope
.
kind_of?
(
Group
)
items
=
items
.
of_group
(
scope
)
items
=
items
.
of_group
(
scope
)
elsif
scope
.
kind_of?
(
Project
)
elsif
scope
.
kind_of?
(
Project
)
items
=
items
.
of_projects
(
scope
)
items
=
items
.
of_projects
(
scope
)
els
e
els
if
get_authorized
items
=
items
.
of_projects
(
current_user
.
authorized_projects
)
items
=
items
.
of_projects
(
current_user
.
authorized_projects
)
end
end
items
.
count
items
.
count
end
end
end
end
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