Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
redmine_v2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VeNtura
redmine_v2
Commits
67d8154e
Commit
67d8154e
authored
Sep 30, 2019
by
Van Hau Le
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enhence/filter_activies_by_tracker
parent
5c60cbfe
Pipeline
#72
canceled with stages
in 0 seconds
Changes
10
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
54 additions
and
8 deletions
+54
-8
app/controllers/context_menus_controller.rb
+1
-1
app/helpers/timelog_helper.rb
+17
-3
app/models/issue.rb
+8
-0
app/models/time_entry_activity.rb
+20
-0
app/models/tracker.rb
+4
-0
app/views/issues/_action_menu.html.erb
+1
-1
app/views/issues/_edit.html.erb
+1
-1
app/views/timelog/index.html.erb
+1
-1
app/views/timelog/report.html.erb
+1
-1
config/initializers/10-patches.rb
+0
-0
No files found.
app/controllers/context_menus_controller.rb
View file @
67d8154e
...
@@ -30,7 +30,7 @@ class ContextMenusController < ApplicationController
...
@@ -30,7 +30,7 @@ class ContextMenusController < ApplicationController
@allowed_statuses
=
@issues
.
map
(
&
:new_statuses_allowed_to
).
reduce
(
:&
)
@allowed_statuses
=
@issues
.
map
(
&
:new_statuses_allowed_to
).
reduce
(
:&
)
@can
=
{
:edit
=>
@issues
.
all?
(
&
:attributes_editable?
),
@can
=
{
:edit
=>
@issues
.
all?
(
&
:attributes_editable?
),
:log_time
=>
(
@project
&&
User
.
current
.
allowed_to?
(
:log_time
,
@project
)),
:log_time
=>
(
@project
&&
User
.
current
.
allowed_to?
(
:log_time
,
@project
)
&&
!
@issue
.
is_user_story?
),
:copy
=>
User
.
current
.
allowed_to?
(
:copy_issues
,
@projects
)
&&
Issue
.
allowed_target_projects
.
any?
,
:copy
=>
User
.
current
.
allowed_to?
(
:copy_issues
,
@projects
)
&&
Issue
.
allowed_target_projects
.
any?
,
:add_watchers
=>
User
.
current
.
allowed_to?
(
:add_issue_watchers
,
@projects
),
:add_watchers
=>
User
.
current
.
allowed_to?
(
:add_issue_watchers
,
@projects
),
:delete
=>
@issues
.
all?
(
&
:deletable?
)
:delete
=>
@issues
.
all?
(
&
:deletable?
)
...
...
app/helpers/timelog_helper.rb
View file @
67d8154e
...
@@ -19,7 +19,6 @@
...
@@ -19,7 +19,6 @@
module
TimelogHelper
module
TimelogHelper
include
ApplicationHelper
include
ApplicationHelper
# Returns a collection of activities for a select field. time_entry
# Returns a collection of activities for a select field. time_entry
# is optional and will be used to check if the selected TimeEntryActivity
# is optional and will be used to check if the selected TimeEntryActivity
# is active.
# is active.
...
@@ -38,8 +37,23 @@ module TimelogHelper
...
@@ -38,8 +37,23 @@ module TimelogHelper
else
else
collection
<<
[
"---
#{
l
(
:actionview_instancetag_blank_option
)
}
---"
,
''
]
unless
activities
.
detect
(
&
:is_default
)
collection
<<
[
"---
#{
l
(
:actionview_instancetag_blank_option
)
}
---"
,
''
]
unless
activities
.
detect
(
&
:is_default
)
end
end
activities
.
each
{
|
a
|
collection
<<
[
a
.
name
,
a
.
id
]
}
collection
+=
case
@issue
&
.
tracker
&
.
name
collection
when
'Task'
@issue
.
is_task_with_target?
?
TimeEntryActivity
::
TASK_WITH_TARGET_ACTIVITIES
:
activities
.
collect
{
|
a
|
[
a
.
name
,
a
.
id
]
if
a
.
is_activity_for_task?
}
when
'Bug'
activities
.
collect
{
|
a
|
[
a
.
name
,
a
.
id
]
if
a
.
is_activity_for_task?
}
when
'User story'
[]
when
'Support'
TimeEntryActivity
::
SUPPORT_ACTIVITIES
else
activities
.
map
{
|
a
|
[
a
.
name
,
a
.
id
]
}
end
# activities.each { |a| collection << [a.name, a.id] }
collection
.
compact
end
end
def
select_hours
(
data
,
criteria
,
value
)
def
select_hours
(
data
,
criteria
,
value
)
...
...
app/models/issue.rb
View file @
67d8154e
...
@@ -117,6 +117,14 @@ class Issue < ActiveRecord::Base
...
@@ -117,6 +117,14 @@ class Issue < ActiveRecord::Base
after_destroy
:update_parent_attributes
after_destroy
:update_parent_attributes
after_create
:send_notification
after_create
:send_notification
def
is_user_story?
tracker
&
.
user_story
end
def
is_task_with_target?
fixed_version
&
.
name
==
'Backlog(Internal)'
end
# Returns a SQL conditions string used to find all issues visible by the specified user
# Returns a SQL conditions string used to find all issues visible by the specified user
def
self
.
visible_condition
(
user
,
options
=
{})
def
self
.
visible_condition
(
user
,
options
=
{})
Project
.
allowed_to_condition
(
user
,
:view_issues
,
options
)
do
|
role
,
user
|
Project
.
allowed_to_condition
(
user
,
:view_issues
,
options
)
do
|
role
,
user
|
...
...
app/models/time_entry_activity.rb
View file @
67d8154e
...
@@ -20,6 +20,22 @@ class TimeEntryActivity < Enumeration
...
@@ -20,6 +20,22 @@ class TimeEntryActivity < Enumeration
OptionName
=
:enumeration_activities
OptionName
=
:enumeration_activities
TASK_BUGS_ACTIVITIES
=
[
"Estimation"
,
"Communication"
,
"Coding"
,
"Code Review"
,
"Requirement"
,
"Design"
,
"Release"
,
"Reworking"
,
"Create Test-case"
,
"Testing"
,
"Research - Investigate "
].
freeze
TASK_WITH_TARGET_ACTIVITIES
=
[
'Training'
,
'Internal Tasks'
].
freeze
SUPPORT_ACTIVITIES
=
[
"Communication"
,
"Project Management"
,
"Leave Off"
,
"Idle"
,
"Company Meeting"
,
"Support"
,
"Others"
].
freeze
def
option_name
def
option_name
OptionName
OptionName
end
end
...
@@ -35,4 +51,8 @@ class TimeEntryActivity < Enumeration
...
@@ -35,4 +51,8 @@ class TimeEntryActivity < Enumeration
def
transfer_relations
(
to
)
def
transfer_relations
(
to
)
objects
.
update_all
(
:activity_id
=>
to
.
id
)
objects
.
update_all
(
:activity_id
=>
to
.
id
)
end
end
def
is_activity_for_task?
TASK_BUGS_ACTIVITIES
.
include?
name
end
end
end
app/models/tracker.rb
View file @
67d8154e
...
@@ -84,6 +84,10 @@ class Tracker < ActiveRecord::Base
...
@@ -84,6 +84,10 @@ class Tracker < ActiveRecord::Base
position
<=>
tracker
.
position
position
<=>
tracker
.
position
end
end
def
user_story
name
==
"User story"
end
# Returns an array of IssueStatus that are used
# Returns an array of IssueStatus that are used
# in the tracker's workflows
# in the tracker's workflows
def
issue_statuses
def
issue_statuses
...
...
app/views/issues/_action_menu.html.erb
View file @
67d8154e
<div
class=
"contextual"
>
<div
class=
"contextual"
>
<%=
link_to
l
(
:button_edit
),
edit_issue_path
(
@issue
),
:onclick
=>
'showAndScrollTo("update", "issue_notes"); return false;'
,
:class
=>
'icon icon-edit'
,
:accesskey
=>
accesskey
(
:edit
)
if
@issue
.
editable?
%>
<%=
link_to
l
(
:button_edit
),
edit_issue_path
(
@issue
),
:onclick
=>
'showAndScrollTo("update", "issue_notes"); return false;'
,
:class
=>
'icon icon-edit'
,
:accesskey
=>
accesskey
(
:edit
)
if
@issue
.
editable?
%>
<%=
link_to
l
(
:button_log_time
),
new_issue_time_entry_path
(
@issue
),
:class
=>
'icon icon-time-add'
if
User
.
current
.
allowed_to?
(
:log_time
,
@project
)
%>
<%=
link_to
l
(
:button_log_time
),
new_issue_time_entry_path
(
@issue
),
:class
=>
'icon icon-time-add'
if
User
.
current
.
allowed_to?
(
:log_time
,
@project
)
&&
!
@issue
.
is_user_story?
%>
<%=
watcher_link
(
@issue
,
User
.
current
)
%>
<%=
watcher_link
(
@issue
,
User
.
current
)
%>
<%=
link_to
l
(
:button_copy
),
project_copy_issue_path
(
@project
,
@issue
),
:class
=>
'icon icon-copy'
if
User
.
current
.
allowed_to?
(
:copy_issues
,
@project
)
&&
Issue
.
allowed_target_projects
.
any?
%>
<%=
link_to
l
(
:button_copy
),
project_copy_issue_path
(
@project
,
@issue
),
:class
=>
'icon icon-copy'
if
User
.
current
.
allowed_to?
(
:copy_issues
,
@project
)
&&
Issue
.
allowed_target_projects
.
any?
%>
<%=
link_to
l
(
:button_delete
),
issue_path
(
@issue
),
:data
=>
{
:confirm
=>
issues_destroy_confirmation_message
(
@issue
)},
:method
=>
:delete
,
:class
=>
'icon icon-del'
if
@issue
.
deletable?
%>
<%=
link_to
l
(
:button_delete
),
issue_path
(
@issue
),
:data
=>
{
:confirm
=>
issues_destroy_confirmation_message
(
@issue
)},
:method
=>
:delete
,
:class
=>
'icon icon-del'
if
@issue
.
deletable?
%>
...
...
app/views/issues/_edit.html.erb
View file @
67d8154e
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
</div>
</div>
</fieldset>
</fieldset>
<%
end
%>
<%
end
%>
<%
if
User
.
current
.
allowed_to?
(
:log_time
,
@project
)
%>
<%
if
User
.
current
.
allowed_to?
(
:log_time
,
@project
)
&&
!
@issue
.
is_user_story?
%>
<fieldset
class=
"tabular"
><legend>
<%=
l
(
:button_log_time
)
%>
</legend>
<fieldset
class=
"tabular"
><legend>
<%=
l
(
:button_log_time
)
%>
</legend>
<%=
labelled_fields_for
:time_entry
,
@time_entry
do
|
time_entry
|
%>
<%=
labelled_fields_for
:time_entry
,
@time_entry
do
|
time_entry
|
%>
<div
class=
"splitcontent"
>
<div
class=
"splitcontent"
>
...
...
app/views/timelog/index.html.erb
View file @
67d8154e
<div
class=
"contextual"
>
<div
class=
"contextual"
>
<%=
link_to
l
(
:button_log_time
),
<%=
link_to
l
(
:button_log_time
),
_new_time_entry_path
(
@project
,
@query
.
filtered_issue_id
),
_new_time_entry_path
(
@project
,
@query
.
filtered_issue_id
),
:class
=>
'icon icon-time-add'
if
User
.
current
.
allowed_to?
(
:log_time
,
@project
,
:global
=>
true
)
%>
:class
=>
'icon icon-time-add'
if
User
.
current
.
allowed_to?
(
:log_time
,
@project
,
:global
=>
true
)
&&
!
@issue
.
is_user_story?
%>
</div>
</div>
<h2>
<%=
@query
.
new_record?
?
l
(:
label_spent_time
)
:
@query
.
name
%>
</h2>
<h2>
<%=
@query
.
new_record?
?
l
(:
label_spent_time
)
:
@query
.
name
%>
</h2>
...
...
app/views/timelog/report.html.erb
View file @
67d8154e
<div
class=
"contextual"
>
<div
class=
"contextual"
>
<%=
link_to
l
(
:button_log_time
),
<%=
link_to
l
(
:button_log_time
),
_new_time_entry_path
(
@project
,
@issue
),
_new_time_entry_path
(
@project
,
@issue
),
:class
=>
'icon icon-time-add'
if
User
.
current
.
allowed_to?
(
:log_time
,
@project
,
:global
=>
true
)
%>
:class
=>
'icon icon-time-add'
if
User
.
current
.
allowed_to?
(
:log_time
,
@project
,
:global
=>
true
)
&&
!
@issue
.
is_user_story?
%>
</div>
</div>
<h2>
<%=
@query
.
new_record?
?
l
(:
label_spent_time
)
:
@query
.
name
%>
</h2>
<h2>
<%=
@query
.
new_record?
?
l
(:
label_spent_time
)
:
@query
.
name
%>
</h2>
...
...
config/initializers/10-patches.rb
View file @
67d8154e
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