diff options
author | Valery Sizov <vsv2711@gmail.com> | 2015-06-03 15:39:01 +0300 |
---|---|---|
committer | Valery Sizov <vsv2711@gmail.com> | 2015-06-03 15:41:37 +0300 |
commit | fef6b468dccda6e4b3cf0fd8e3144b097729fd2f (patch) | |
tree | cce7b6aded247f298bb725a785fd1846172cee11 /app | |
parent | 54bd76399ddf5fb925df01d9f86ed020c475b3ba (diff) | |
download | gitlab-ci-fef6b468dccda6e4b3cf0fd8e3144b097729fd2f.tar.gz |
replace YAML with JOSN on dashboard
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects_controller.rb | 6 | ||||
-rw-r--r-- | app/models/project.rb | 8 | ||||
-rw-r--r-- | app/views/projects/_gl_projects.html.haml | 2 |
3 files changed, 6 insertions, 10 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index ad5b120..a21dbc2 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -49,11 +49,13 @@ class ProjectsController < ApplicationController end def create - unless current_user.can_manage_project?(YAML.load(params["project"])[:id]) + project_data = OpenStruct.new(JSON.parse(params["project"])) + + unless current_user.can_manage_project?(project_data.id) return redirect_to root_path, alert: 'You have to have at least master role to enable CI for this project' end - @project = CreateProjectService.new.execute(current_user, params[:project], project_url(":project_id")) + @project = CreateProjectService.new.execute(current_user, project_data, project_url(":project_id")) if @project.persisted? redirect_to project_path(@project, show_guide: true), notice: 'Project was successfully created.' diff --git a/app/models/project.rb b/app/models/project.rb index 9b015d2..a1e1999 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -69,13 +69,7 @@ ls -la eos end - def parse(project_params) - project = if project_params.is_a?(String) - YAML.load(project_params) - else - project_params - end - + def parse(project) params = { name: project.name_with_namespace, gitlab_id: project.id, diff --git a/app/views/projects/_gl_projects.html.haml b/app/views/projects/_gl_projects.html.haml index 15cd3f0..479ffb4 100644 --- a/app/views/projects/_gl_projects.html.haml +++ b/app/views/projects/_gl_projects.html.haml @@ -11,5 +11,5 @@ Added - else = form_tag projects_path do - = hidden_field_tag :project, project.to_yaml + = hidden_field_tag :project, project.to_h.to_json = submit_tag 'Add project to CI', class: 'btn btn-default btn-small'
\ No newline at end of file |