2015-09-28 11:19:20 -04:00
|
|
|
class Projects::VariablesController < Projects::ApplicationController
|
2016-02-01 17:58:04 -05:00
|
|
|
before_action :authorize_admin_build!
|
2015-09-28 11:19:20 -04:00
|
|
|
|
|
|
|
layout 'project_settings'
|
|
|
|
|
|
|
|
def show
|
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
2015-12-04 06:55:23 -05:00
|
|
|
if project.update_attributes(project_params)
|
2015-09-28 11:19:20 -04:00
|
|
|
redirect_to namespace_project_variables_path(project.namespace, project), notice: 'Variables were successfully updated.'
|
|
|
|
else
|
|
|
|
render action: 'show'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def project_params
|
2015-12-10 11:44:06 -05:00
|
|
|
params.require(:project).permit({ variables_attributes: [:id, :key, :value, :_destroy] })
|
2015-09-28 11:19:20 -04:00
|
|
|
end
|
|
|
|
end
|