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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
e2c8a223
Commit
e2c8a223
authored
Jan 30, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove usage of VariablePresenter in controller
parent
04263b9f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
16 deletions
+4
-16
app/controllers/groups/variables_controller.rb
app/controllers/groups/variables_controller.rb
+2
-8
app/controllers/projects/variables_controller.rb
app/controllers/projects/variables_controller.rb
+2
-8
No files found.
app/controllers/groups/variables_controller.rb
View file @
e2c8a223
...
...
@@ -5,10 +5,7 @@ module Groups
def
show
respond_to
do
|
format
|
format
.
json
do
variables
=
@group
.
variables
.
map
{
|
variable
|
variable
.
present
(
current_user:
current_user
)
}
render
status: :ok
,
json:
{
variables:
GroupVariableSerializer
.
new
.
represent
(
variables
)
}
render
status: :ok
,
json:
{
variables:
GroupVariableSerializer
.
new
.
represent
(
@group
.
variables
)
}
end
end
end
...
...
@@ -17,10 +14,7 @@ module Groups
respond_to
do
|
format
|
format
.
json
do
if
@group
.
update
(
variables_params
)
variables
=
@group
.
variables
.
map
{
|
variable
|
variable
.
present
(
current_user:
current_user
)
}
return
render
status: :ok
,
json:
{
variables:
GroupVariableSerializer
.
new
.
represent
(
variables
)
}
return
render
status: :ok
,
json:
{
variables:
GroupVariableSerializer
.
new
.
represent
(
@group
.
variables
)
}
end
render
status: :bad_request
,
json:
@group
.
errors
.
full_messages
...
...
app/controllers/projects/variables_controller.rb
View file @
e2c8a223
...
...
@@ -4,10 +4,7 @@ class Projects::VariablesController < Projects::ApplicationController
def
show
respond_to
do
|
format
|
format
.
json
do
variables
=
@project
.
variables
.
map
{
|
variable
|
variable
.
present
(
current_user:
current_user
)
}
render
status: :ok
,
json:
{
variables:
VariableSerializer
.
new
.
represent
(
variables
)
}
render
status: :ok
,
json:
{
variables:
VariableSerializer
.
new
.
represent
(
@project
.
variables
)
}
end
end
end
...
...
@@ -16,10 +13,7 @@ class Projects::VariablesController < Projects::ApplicationController
respond_to
do
|
format
|
format
.
json
do
if
@project
.
update
(
variables_params
)
variables
=
@project
.
variables
.
map
{
|
variable
|
variable
.
present
(
current_user:
current_user
)
}
return
render
status: :ok
,
json:
{
variables:
VariableSerializer
.
new
.
represent
(
variables
)
}
return
render
status: :ok
,
json:
{
variables:
VariableSerializer
.
new
.
represent
(
@project
.
variables
)
}
end
render
status: :bad_request
,
json:
@project
.
errors
.
full_messages
...
...
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