Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
openproject
Service Pack
Commits
95ab447d
Verified
Commit
95ab447d
authored
5 years ago
by
Tam Le
Browse files
Options
Download
Email Patches
Plain Diff
Stop using @project in SP report
@project is reserved for OpenProject layout
parent
f5b79bb4
master
fix_run_out_mail_sent_3_times
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/controllers/sp_report_controller.rb
+7
-7
app/controllers/sp_report_controller.rb
app/views/sp_report/show.html.erb
+2
-2
app/views/sp_report/show.html.erb
with
9 additions
and
9 deletions
+9
-9
app/controllers/sp_report_controller.rb
+
7
-
7
View file @
95ab447d
class
SpReportController
<
ApplicationController
before_action
:find_project_by_project_id
,
only: :
proj_available
before_action
:find_project_by_project_id
,
only: :
report
include
ServicePacksReportHelper
NUMBER_OF_FILLED_COLUMN
=
9
...
...
@@ -9,11 +9,11 @@ class SpReportController < ApplicationController
set_by_filter_proj_id
=
params
[
:proj_id
]
unless
set_by_filter_proj_id
==
-
'all'
if
set_by_filter_proj_id
.
present?
@project
=
Project
.
find_by!
(
id:
set_by_filter_proj_id
)
@project
_to_report
=
Project
.
find_by!
(
id:
set_by_filter_proj_id
)
else
@project
=
P
roject
.
find
(
params
[
:project_id
])
# find by slug
@project
_to_report
=
@p
roject
# used by OpenProject for layout
end
unless
User
.
current
.
admin?
||
User
.
current
.
allowed_to?
(
:see_assigned_service_packs
,
@project
)
unless
User
.
current
.
admin?
||
User
.
current
.
allowed_to?
(
:see_assigned_service_packs
,
@project
_to_report
)
render
status:
404
and
return
end
end
...
...
@@ -26,19 +26,19 @@ class SpReportController < ApplicationController
respond_to
do
|
format
|
# @project will be nil if "all" choice is on bypassing the "unless set_by_filter_proj_id" block
format
.
html
{
query
(
service_pack:
sp
,
project:
@project
,
query
(
service_pack:
sp
,
project:
@project
_to_report
,
lite:
true
)
get_projects_available
get_available_service_packs
render
-
'show'
and
return
}
format
.
json
{
query
(
service_pack:
sp
,
project:
@project
,
query
(
service_pack:
sp
,
project:
@project
_to_report
,
lite:
true
)
render
json:
@entries
}
format
.
csv
{
query
(
service_pack:
sp
,
project:
@project
)
query
(
service_pack:
sp
,
project:
@project
_to_report
)
render
csv:
csv_extractor
,
filename:
"sp-report-
#{
Date
.
today
}
.csv"
and
return
}
end
...
...
This diff is collapsed.
Click to expand it.
app/views/sp_report/show.html.erb
+
2
-
2
View file @
95ab447d
...
...
@@ -19,11 +19,11 @@
<%
if
params
[
:proj_id
]
==
-
'all'
%>
<option
value=
'all'
selected
>
--- All Projects ---
</option>
<%
@projects
.
pluck
(
:id
,
:name
).
each
do
|
project
|
%>
<%=
content_tag
:option
,
project
s
[
1
],
value:
project
[
0
],
selected:
false
%>
<%=
content_tag
:option
,
project
[
1
],
value:
project
[
0
],
selected:
false
%>
<%
end
%>
<%
else
%>
<option
value=
'all'
>
--- All Projects ---
</option>
<%
project_default_id
=
params
[
:proj_id
].
present?
?
params
[
:proj_id
].
to_i
:
@project
&
.
id
%>
<%
project_default_id
=
params
[
:proj_id
].
present?
?
params
[
:proj_id
].
to_i
:
@project
_to_report
&
.
id
%>
<%
@projects
.
pluck
(
:id
,
:name
).
each
do
|
project
|
%>
<%=
content_tag
:option
,
project
[
1
],
value:
project
[
0
],
selected:
project
[
0
]
==
project_default_id
%>
<%
end
%>
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help