From d0791253d9f56c532a3d970f43cf3fd722a9ca2c Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 17 Jun 2016 11:29:49 +0800 Subject: [PATCH] quality --- app/assets/javascripts/quality_analyses.js.coffee | 3 +++ app/assets/stylesheets/quality_analyses.css.scss | 3 +++ app/controllers/projects_controller.rb | 2 +- app/controllers/quality_analyses_controller.rb | 15 +++++++++++++++ app/helpers/quality_analyses_helper.rb | 2 ++ app/views/quality_analyses/index.html.erb | 0 config/routes.rb | 7 +++++++ .../quality_analyses_controller_spec.rb | 5 +++++ 8 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 app/assets/javascripts/quality_analyses.js.coffee create mode 100644 app/assets/stylesheets/quality_analyses.css.scss create mode 100644 app/controllers/quality_analyses_controller.rb create mode 100644 app/helpers/quality_analyses_helper.rb create mode 100644 app/views/quality_analyses/index.html.erb create mode 100644 spec/controllers/quality_analyses_controller_spec.rb diff --git a/app/assets/javascripts/quality_analyses.js.coffee b/app/assets/javascripts/quality_analyses.js.coffee new file mode 100644 index 000000000..761567942 --- /dev/null +++ b/app/assets/javascripts/quality_analyses.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/stylesheets/quality_analyses.css.scss b/app/assets/stylesheets/quality_analyses.css.scss new file mode 100644 index 000000000..9404eb70f --- /dev/null +++ b/app/assets/stylesheets/quality_analyses.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the QualityAnalyses controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index c8b272480..7e1738842 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -645,7 +645,7 @@ class ProjectsController < ApplicationController params[:project][:is_public] ? @project.is_public = 1 : @project.is_public = 0 params[:project][:hidden_repo] ? @project.hidden_repo = 1 : @project.hidden_repo = 0 # 更新公开私有时同步gitlab公开私有 - unless @project.gpid.nil? + if !@project.gpid.nil? && @project.is_public != (params[:project][:is_public] == "on" ? true : false) g = Gitlab.client params[:project][:is_public] ? g.edit_project(@project.gpid, 20, params[:branch]) : g.edit_project(@project.gpid, 0, params[:branch]) end diff --git a/app/controllers/quality_analyses_controller.rb b/app/controllers/quality_analyses_controller.rb new file mode 100644 index 000000000..0ea288a91 --- /dev/null +++ b/app/controllers/quality_analyses_controller.rb @@ -0,0 +1,15 @@ +class QualityAnalysesController < ApplicationController + before_filter :find_project_by_project_id#, :except => [:getattachtype] + layout "base_projects" + + def index + + end + + # Find project of id params[:project_id] + def find_project_by_project_id + @project = Project.find(params[:project_id]) + rescue ActiveRecord::RecordNotFound + render_404 + end +end diff --git a/app/helpers/quality_analyses_helper.rb b/app/helpers/quality_analyses_helper.rb new file mode 100644 index 000000000..a47f571bb --- /dev/null +++ b/app/helpers/quality_analyses_helper.rb @@ -0,0 +1,2 @@ +module QualityAnalysesHelper +end diff --git a/app/views/quality_analyses/index.html.erb b/app/views/quality_analyses/index.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/config/routes.rb b/config/routes.rb index 33a59b46b..17614f4b6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -782,6 +782,13 @@ RedmineApp::Application.routes.draw do end end + resources :quality_analyses, :only => [:index] do + collection do + end + member do + + end + end # resources :files, :only => [:index, :new, :create] do # member do # match "quote_resource_show_project",:via => [:get] diff --git a/spec/controllers/quality_analyses_controller_spec.rb b/spec/controllers/quality_analyses_controller_spec.rb new file mode 100644 index 000000000..c5076c53f --- /dev/null +++ b/spec/controllers/quality_analyses_controller_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe QualityAnalysesController, :type => :controller do + +end