From 2d4556c5d208e9ae805b0467c1c7281ae6a36ebe Mon Sep 17 00:00:00 2001 From: James Lopez Date: Fri, 17 Jun 2016 15:47:00 +0200 Subject: [PATCH] a few changes based on MR feedback --- app/controllers/projects_controller.rb | 18 ++++++++++++------ app/models/application_setting.rb | 2 +- app/views/projects/edit.html.haml | 2 +- app/views/projects/new.html.haml | 2 +- config/routes.rb | 1 + lib/gitlab/current_settings.rb | 2 +- 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index af357ae9a71..673adca6ade 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -7,7 +7,7 @@ class ProjectsController < Projects::ApplicationController before_action :assign_ref_vars, :tree, only: [:show], if: :repo_exists? # Authorize - before_action :authorize_admin_project!, only: [:edit, :update, :housekeeping, :download_export, :export, :remove_export] + before_action :authorize_admin_project!, only: [:edit, :update, :housekeeping, :download_export, :export, :remove_export, :generate_new_export] before_action :event_filter, only: [:show, :activity] layout :determine_layout @@ -190,7 +190,7 @@ class ProjectsController < Projects::ApplicationController redirect_to( edit_project_path(@project), - notice: "Project export started. A download link will be sent by e-mail." + notice: "Project export started. A download link will be sent by email." ) end @@ -209,10 +209,16 @@ class ProjectsController < Projects::ApplicationController def remove_export if @project.remove_exports - redirect_to( - edit_project_path(@project), - notice: "Project export has been deleted." - ) + flash[:notice] = "Project export has been deleted." + else + flash[:alert] = "Project export could not be deleted." + end + redirect_to(edit_project_path(@project)) + end + + def generate_new_export + if @project.remove_exports + export else redirect_to( edit_project_path(@project), diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index b2fb54ba5e7..d914b0b26eb 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -123,7 +123,7 @@ class ApplicationSetting < ActiveRecord::Base default_project_visibility: Settings.gitlab.default_projects_features['visibility_level'], default_snippet_visibility: Settings.gitlab.default_projects_features['visibility_level'], restricted_signup_domains: Settings.gitlab['restricted_signup_domains'], - import_sources: ['github','bitbucket','gitlab','gitorious','google_code','fogbugz','git', 'gitlab_project'], + import_sources: %w[github bitbucket gitlab gitorious google_code fogbugz git gitlab_project], shared_runners_enabled: Settings.gitlab_ci['shared_runners_enabled'], max_artifacts_size: Settings.artifacts['max_size'], require_two_factor_authentication: false, diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml index a6f982b1d79..27a94fe02dc 100644 --- a/app/views/projects/edit.html.haml +++ b/app/views/projects/edit.html.haml @@ -135,7 +135,7 @@ - if @project.export_project_path = link_to 'Download export', download_export_namespace_project_path(@project.namespace, @project), method: :get, class: "btn btn-default" - = link_to 'Delete export', remove_export_namespace_project_path(@project.namespace, @project), + = link_to 'Generate new export', generate_new_export_namespace_project_path(@project.namespace, @project), method: :post, class: "btn btn-default" - else = link_to 'Export project', export_namespace_project_path(@project.namespace, @project), diff --git a/app/views/projects/new.html.haml b/app/views/projects/new.html.haml index d73ba7908d8..3c1c6060504 100644 --- a/app/views/projects/new.html.haml +++ b/app/views/projects/new.html.haml @@ -136,7 +136,7 @@ $('.import_gitlab_project').click(function( event ) { if($('.import_gitlab_project').attr('disabled')) { event.preventDefault(); - new Flash("Project path required.", "alert"); + new Flash("Please enter a path for the project to be imported to."); } }); diff --git a/config/routes.rb b/config/routes.rb index 94ce8fb29d9..09bd9ac55a9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -461,6 +461,7 @@ Rails.application.routes.draw do post :markdown_preview post :export post :remove_export + post :generate_new_export get :download_export get :autocomplete_sources get :activity diff --git a/lib/gitlab/current_settings.rb b/lib/gitlab/current_settings.rb index 38c0f1aba47..28c34429c1f 100644 --- a/lib/gitlab/current_settings.rb +++ b/lib/gitlab/current_settings.rb @@ -36,7 +36,7 @@ module Gitlab default_project_visibility: Settings.gitlab.default_projects_features['visibility_level'], default_snippet_visibility: Settings.gitlab.default_projects_features['visibility_level'], restricted_signup_domains: Settings.gitlab['restricted_signup_domains'], - import_sources: ['github','bitbucket','gitlab','gitorious','google_code','fogbugz','git', 'gitlab_project'], + import_sources: %w[github bitbucket gitlab gitorious google_code fogbugz git gitlab_project], shared_runners_enabled: Settings.gitlab_ci['shared_runners_enabled'], max_artifacts_size: Settings.artifacts['max_size'], require_two_factor_authentication: false,