Commit 513d8a6b authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch '13756-hipaa-audit-protocol-project-template' into 'master'

Resolve "Add new project template for HIPAA Audit Protocol"

See merge request gitlab-org/gitlab!28187
parents 6020d02f 67fddc30
import { s__ } from '~/locale';
export default {
rails: {
text: s__('ProjectTemplates|Ruby on Rails'),
icon: '.template-option .icon-rails',
},
express: {
text: s__('ProjectTemplates|NodeJS Express'),
icon: '.template-option .icon-express',
},
spring: {
text: s__('ProjectTemplates|Spring'),
icon: '.template-option .icon-spring',
},
iosswift: {
text: s__('ProjectTemplates|iOS (Swift)'),
icon: '.template-option .icon-iosswift',
},
dotnetcore: {
text: s__('ProjectTemplates|.NET Core'),
icon: '.template-option .icon-dotnetcore',
},
android: {
text: s__('ProjectTemplates|Android'),
icon: '.template-option .icon-android',
},
gomicro: {
text: s__('ProjectTemplates|Go Micro'),
icon: '.template-option .icon-gomicro',
},
gatsby: {
text: s__('ProjectTemplates|Pages/Gatsby'),
icon: '.template-option .icon-gatsby',
},
hugo: {
text: s__('ProjectTemplates|Pages/Hugo'),
icon: '.template-option .icon-hugo',
},
jekyll: {
text: s__('ProjectTemplates|Pages/Jekyll'),
icon: '.template-option .icon-jekyll',
},
plainhtml: {
text: s__('ProjectTemplates|Pages/Plain HTML'),
icon: '.template-option .icon-plainhtml',
},
gitbook: {
text: s__('ProjectTemplates|Pages/GitBook'),
icon: '.template-option .icon-gitbook',
},
hexo: {
text: s__('ProjectTemplates|Pages/Hexo'),
icon: '.template-option .icon-hexo',
},
nfhugo: {
text: s__('ProjectTemplates|Netlify/Hugo'),
icon: '.template-option .icon-nfhugo',
},
nfjekyll: {
text: s__('ProjectTemplates|Netlify/Jekyll'),
icon: '.template-option .icon-nfjekyll',
},
nfplainhtml: {
text: s__('ProjectTemplates|Netlify/Plain HTML'),
icon: '.template-option .icon-nfplainhtml',
},
nfgitbook: {
text: s__('ProjectTemplates|Netlify/GitBook'),
icon: '.template-option .icon-nfgitbook',
},
nfhexo: {
text: s__('ProjectTemplates|Netlify/Hexo'),
icon: '.template-option .icon-nfhexo',
},
salesforcedx: {
text: s__('ProjectTemplates|SalesforceDX'),
icon: '.template-option .icon-salesforcedx',
},
serverless_framework: {
text: s__('ProjectTemplates|Serverless Framework/JS'),
icon: '.template-option .icon-serverless_framework',
},
};
import $ from 'jquery'; import $ from 'jquery';
import { addSelectOnFocusBehaviour } from '../lib/utils/common_utils'; import { addSelectOnFocusBehaviour } from '../lib/utils/common_utils';
import { convertToTitleCase, humanize, slugify } from '../lib/utils/text_utility'; import { convertToTitleCase, humanize, slugify } from '../lib/utils/text_utility';
import { s__ } from '~/locale'; import DEFAULT_PROJECT_TEMPLATES from 'ee_else_ce/projects/default_project_templates';
let hasUserDefinedProjectPath = false; let hasUserDefinedProjectPath = false;
let hasUserDefinedProjectName = false; let hasUserDefinedProjectName = false;
...@@ -140,90 +140,8 @@ const bindEvents = () => { ...@@ -140,90 +140,8 @@ const bindEvents = () => {
$projectFieldsForm.addClass('selected'); $projectFieldsForm.addClass('selected');
$selectedIcon.empty(); $selectedIcon.empty();
const value = $(this).val(); const value = $(this).val();
const templates = {
rails: {
text: s__('ProjectTemplates|Ruby on Rails'),
icon: '.template-option .icon-rails',
},
express: {
text: s__('ProjectTemplates|NodeJS Express'),
icon: '.template-option .icon-express',
},
spring: {
text: s__('ProjectTemplates|Spring'),
icon: '.template-option .icon-spring',
},
iosswift: {
text: s__('ProjectTemplates|iOS (Swift)'),
icon: '.template-option .icon-iosswift',
},
dotnetcore: {
text: s__('ProjectTemplates|.NET Core'),
icon: '.template-option .icon-dotnetcore',
},
android: {
text: s__('ProjectTemplates|Android'),
icon: '.template-option .icon-android',
},
gomicro: {
text: s__('ProjectTemplates|Go Micro'),
icon: '.template-option .icon-gomicro',
},
gatsby: {
text: s__('ProjectTemplates|Pages/Gatsby'),
icon: '.template-option .icon-gatsby',
},
hugo: {
text: s__('ProjectTemplates|Pages/Hugo'),
icon: '.template-option .icon-hugo',
},
jekyll: {
text: s__('ProjectTemplates|Pages/Jekyll'),
icon: '.template-option .icon-jekyll',
},
plainhtml: {
text: s__('ProjectTemplates|Pages/Plain HTML'),
icon: '.template-option .icon-plainhtml',
},
gitbook: {
text: s__('ProjectTemplates|Pages/GitBook'),
icon: '.template-option .icon-gitbook',
},
hexo: {
text: s__('ProjectTemplates|Pages/Hexo'),
icon: '.template-option .icon-hexo',
},
nfhugo: {
text: s__('ProjectTemplates|Netlify/Hugo'),
icon: '.template-option .icon-nfhugo',
},
nfjekyll: {
text: s__('ProjectTemplates|Netlify/Jekyll'),
icon: '.template-option .icon-nfjekyll',
},
nfplainhtml: {
text: s__('ProjectTemplates|Netlify/Plain HTML'),
icon: '.template-option .icon-nfplainhtml',
},
nfgitbook: {
text: s__('ProjectTemplates|Netlify/GitBook'),
icon: '.template-option .icon-nfgitbook',
},
nfhexo: {
text: s__('ProjectTemplates|Netlify/Hexo'),
icon: '.template-option .icon-nfhexo',
},
salesforcedx: {
text: s__('ProjectTemplates|SalesforceDX'),
icon: '.template-option .icon-salesforcedx',
},
serverless_framework: {
text: s__('ProjectTemplates|Serverless Framework/JS'),
icon: '.template-option .icon-serverless_framework',
},
};
const selectedTemplate = templates[value]; const selectedTemplate = DEFAULT_PROJECT_TEMPLATES[value];
$selectedTemplateText.text(selectedTemplate.text); $selectedTemplateText.text(selectedTemplate.text);
$(selectedTemplate.icon) $(selectedTemplate.icon)
.clone() .clone()
......
import { s__ } from '~/locale';
import CE_TEMPLATES from '~/projects/default_project_templates';
export default {
...CE_TEMPLATES,
hipaa_audit_protocol: {
text: s__('ProjectTemplates|HIPAA Audit Protocol'),
icon: '.template-option .icon-hipaa_audit_protocol',
},
};
...@@ -111,6 +111,7 @@ class License < ApplicationRecord ...@@ -111,6 +111,7 @@ class License < ApplicationRecord
credentials_inventory credentials_inventory
dast dast
dependency_scanning dependency_scanning
enterprise_templates
group_ip_restriction group_ip_restriction
group_level_compliance_dashboard group_level_compliance_dashboard
incident_management incident_management
...@@ -202,6 +203,7 @@ class License < ApplicationRecord ...@@ -202,6 +203,7 @@ class License < ApplicationRecord
custom_project_templates custom_project_templates
db_load_balancing db_load_balancing
elastic_search elastic_search
enterprise_templates
extended_audit_events extended_audit_events
external_authorization_service_api_management external_authorization_service_api_management
geo geo
......
---
title: Add project template for HIPAA Audit Protocol
merge_request: 28187
author:
type: added
# frozen_string_literal: true
module EE
module Gitlab
module ProjectTemplate
extend ActiveSupport::Concern
ENTERPRISE_TEMPLATES_TABLE = [
::Gitlab::ProjectTemplate.new('hipaa_audit_protocol', 'HIPAA Audit Protocol', _('A project containing issues for each audit inquiry in the HIPAA Audit Protocol published by the U.S. Department of Health & Human Services'), 'https://gitlab.com/gitlab-org/project-templates/hipaa-audit-protocol')
].freeze
class_methods do
extend ::Gitlab::Utils::Override
override :all
def all
return super unless License.feature_available?(:enterprise_templates)
super + ENTERPRISE_TEMPLATES_TABLE
end
end
end
end
end
...@@ -449,4 +449,48 @@ describe 'New project' do ...@@ -449,4 +449,48 @@ describe 'New project' do
end end
end end
end end
context 'Built-in project templates' do
let(:enterprise_templates) { EE::Gitlab::ProjectTemplate::ENTERPRISE_TEMPLATES_TABLE }
context 'when `enterprise_templates` is licensed' do
before do
stub_licensed_features(enterprise_templates: true)
end
it 'shows enterprise templates' do
visit_create_from_built_in_templates_tab
enterprise_templates.each do |template|
expect(page).to have_content(template.title)
expect(page).to have_link('Preview', href: template.preview)
end
end
end
context 'when `enterprise_templates` is unlicensed' do
before do
stub_licensed_features(enterprise_templates: false)
end
it 'does not show enterprise templates' do
visit_create_from_built_in_templates_tab
enterprise_templates.each do |template|
expect(page).not_to have_content(template.title)
expect(page).not_to have_link('Preview', href: template.preview)
end
end
end
private
def visit_create_from_built_in_templates_tab
visit new_project_path
expect(page).to have_css('#create-from-template-tab')
find('#create-from-template-tab').click
end
end
end end
# frozen_string_literal: true
require 'spec_helper'
describe Gitlab::ProjectTemplate do
describe '.all' do
context 'when `enterprise_templates` feature is not licensed' do
before do
stub_licensed_features(enterprise_templates: false)
end
it 'does not contain enterprise project templates' do
expect(described_class.all).not_to include(*enterprise_templates)
end
end
context 'when `enterprise_templates` feature is licensed' do
before do
stub_licensed_features(enterprise_templates: true)
end
it 'contains enterprise project templates' do
expect(described_class.all).to include(*enterprise_templates)
end
end
end
private
def enterprise_templates
[
described_class.new('hipaa_audit_protocol', 'HIPAA Audit Protocol', _('A project containing issues for each audit inquiry in the HIPAA Audit Protocol published by the U.S. Department of Health & Human Services'), 'https://gitlab.com/gitlab-org/project-templates/hipaa-audit-protocol')
]
end
end
...@@ -74,3 +74,5 @@ module Gitlab ...@@ -74,3 +74,5 @@ module Gitlab
end end
end end
end end
Gitlab::ProjectTemplate.prepend_if_ee('EE::Gitlab::ProjectTemplate')
...@@ -862,6 +862,9 @@ msgstr "" ...@@ -862,6 +862,9 @@ msgstr ""
msgid "A project boilerplate for Salesforce App development with Salesforce Developer tools." msgid "A project boilerplate for Salesforce App development with Salesforce Developer tools."
msgstr "" msgstr ""
msgid "A project containing issues for each audit inquiry in the HIPAA Audit Protocol published by the U.S. Department of Health & Human Services"
msgstr ""
msgid "A project is where you house your files (repository), plan your work (issues), and publish your documentation (wiki), %{among_other_things_link}." msgid "A project is where you house your files (repository), plan your work (issues), and publish your documentation (wiki), %{among_other_things_link}."
msgstr "" msgstr ""
...@@ -15802,6 +15805,9 @@ msgstr "" ...@@ -15802,6 +15805,9 @@ msgstr ""
msgid "ProjectTemplates|Go Micro" msgid "ProjectTemplates|Go Micro"
msgstr "" msgstr ""
msgid "ProjectTemplates|HIPAA Audit Protocol"
msgstr ""
msgid "ProjectTemplates|Netlify/GitBook" msgid "ProjectTemplates|Netlify/GitBook"
msgstr "" msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment