Commit d1de867d authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch 'gy-sample-data-rework' into 'master'

Merge 'Sample Data' and 'Built-in' tabs on Project Templates page

See merge request gitlab-org/gitlab!49374
parents b5d2dac3 69510a2e
import { s__ } from '~/locale';
export default {
sample: {
text: s__('ProjectTemplates|Sample GitLab Project'),
icon: '.template-option .icon-sample',
},
rails: {
text: s__('ProjectTemplates|Ruby on Rails'),
icon: '.template-option .icon-rails',
......
import { s__ } from '~/locale';
export default {
basic: {
text: s__('ProjectTemplates|Basic'),
icon: '.template-option .icon-basic',
},
serenity_valley: {
text: s__('ProjectTemplates|Serenity Valley'),
icon: '.template-option .icon-serenity_valley',
},
};
import $ from 'jquery';
import DEFAULT_PROJECT_TEMPLATES from 'ee_else_ce/projects/default_project_templates';
import DEFAULT_SAMPLE_DATA_TEMPLATES from '~/projects/default_sample_data_templates';
import { addSelectOnFocusBehaviour } from '../lib/utils/common_utils';
import {
convertToTitleCase,
......@@ -150,8 +149,7 @@ const bindEvents = () => {
$selectedIcon.empty();
const value = $(this).val();
const selectedTemplate =
DEFAULT_PROJECT_TEMPLATES[value] || DEFAULT_SAMPLE_DATA_TEMPLATES[value];
const selectedTemplate = DEFAULT_PROJECT_TEMPLATES[value];
$selectedTemplateText.text(selectedTemplate.text);
$(selectedTemplate.icon)
.clone()
......
......@@ -5,17 +5,11 @@
%li.built-in-tab
%a.nav-link.active{ href: "#built-in", data: { toggle: 'tab'} }
= _('Built-in')
%span.badge.badge-pill= Gitlab::ProjectTemplate.all.count
%li.sample-data-templates-tab
%a.nav-link{ href: "#sample-data-templates", data: { toggle: 'tab'} }
= _('Sample Data')
%span.badge.badge-pill= Gitlab::SampleDataTemplate.all.count
%span.badge.badge-pill= Gitlab::SampleDataTemplate.all.count + Gitlab::ProjectTemplate.all.count
.tab-content
.project-templates-buttons.import-buttons.tab-pane.active#built-in
= render partial: 'projects/project_templates/template', collection: Gitlab::ProjectTemplate.all
.project-templates-buttons.import-buttons.tab-pane#sample-data-templates
= render partial: 'projects/project_templates/template', collection: Gitlab::SampleDataTemplate.all
= render partial: 'projects/project_templates/template', collection: Gitlab::SampleDataTemplate.all + Gitlab::ProjectTemplate.all
.project-fields-form
= render 'projects/project_templates/project_fields_form'
......
---
title: Merge 'Sample Data' and 'Built-in' tabs on Project Templates page
merge_request: 49374
author:
type: changed
......@@ -7,7 +7,7 @@
%li.built-in-tab
%a.nav-link.active{ href: "#built-in", data: { toggle: 'tab'} }
= _('Built-in')
%span.badge.badge-pill= Gitlab::ProjectTemplate.all.count
%span.badge.badge-pill= Gitlab::SampleDataTemplate.all.count + Gitlab::ProjectTemplate.all.count
%li.custom-instance-project-templates-tab
%a.nav-link.js-custom-instance-project-templates-nav-link.qa-instance-templates-tab{ href: "#custom-instance-project-templates", data: { toggle: 'tab'} }
= _('Instance')
......@@ -17,22 +17,16 @@
= _('Group')
%span.badge.badge-pill.qa-group-template-tab-badge
= group_project_templates_count(group_id)
%li.sample-data-templates-tab
%a.nav-link{ href: "#sample-data-templates", data: { toggle: 'tab'} }
= _('Sample Data')
%span.badge.badge-pill= Gitlab::SampleDataTemplate.all.count
.tab-content
.project-templates-buttons.import-buttons.tab-pane.active#built-in
= render partial: 'projects/project_templates/template', collection: Gitlab::ProjectTemplate.all
= render partial: 'projects/project_templates/template', collection: Gitlab::SampleDataTemplate.all + Gitlab::ProjectTemplate.all
.project-templates-buttons.import-buttons.tab-pane.js-custom-instance-project-templates-tab-content#custom-instance-project-templates{ data: {initial_templates: user_available_project_templates_path(current_user)} }
.text-center.m-4
.spinner.spinner-md
.project-templates-buttons.import-buttons.tab-pane.js-custom-group-project-templates-tab-content#custom-group-project-templates{ data: {initial_templates: user_available_group_templates_path(current_user, group_id: group_id)} }
.text-center.m-4
.spinner.spinner-md
.project-templates-buttons.import-buttons.tab-pane#sample-data-templates
= render partial: 'projects/project_templates/template', collection: Gitlab::SampleDataTemplate.all
.project-fields-form
= render 'projects/project_templates/project_fields_form'
......
......@@ -40,30 +40,30 @@ module Gitlab
# TODO: Review child inheritance of this table (see: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/41699#note_430928221)
def localized_templates_table
[
ProjectTemplate.new('rails', 'Ruby on Rails', _('Includes an MVC structure, Gemfile, Rakefile, along with many others, to help you get started.'), 'https://gitlab.com/gitlab-org/project-templates/rails', 'illustrations/logos/rails.svg'),
ProjectTemplate.new('spring', 'Spring', _('Includes an MVC structure, mvnw and pom.xml to help you get started.'), 'https://gitlab.com/gitlab-org/project-templates/spring', 'illustrations/logos/spring.svg'),
ProjectTemplate.new('express', 'NodeJS Express', _('Includes an MVC structure to help you get started.'), 'https://gitlab.com/gitlab-org/project-templates/express', 'illustrations/logos/express.svg'),
ProjectTemplate.new('iosswift', 'iOS (Swift)', _('A ready-to-go template for use with iOS Swift apps.'), 'https://gitlab.com/gitlab-org/project-templates/iosswift', 'illustrations/logos/swift.svg'),
ProjectTemplate.new('rails', 'Ruby on Rails', _('Includes an MVC structure, Gemfile, Rakefile, along with many others, to help you get started'), 'https://gitlab.com/gitlab-org/project-templates/rails', 'illustrations/logos/rails.svg'),
ProjectTemplate.new('spring', 'Spring', _('Includes an MVC structure, mvnw and pom.xml to help you get started'), 'https://gitlab.com/gitlab-org/project-templates/spring', 'illustrations/logos/spring.svg'),
ProjectTemplate.new('express', 'NodeJS Express', _('Includes an MVC structure to help you get started'), 'https://gitlab.com/gitlab-org/project-templates/express', 'illustrations/logos/express.svg'),
ProjectTemplate.new('iosswift', 'iOS (Swift)', _('A ready-to-go template for use with iOS Swift apps'), 'https://gitlab.com/gitlab-org/project-templates/iosswift', 'illustrations/logos/swift.svg'),
ProjectTemplate.new('dotnetcore', '.NET Core', _('A .NET Core console application template, customizable for any .NET Core project'), 'https://gitlab.com/gitlab-org/project-templates/dotnetcore', 'illustrations/logos/dotnet.svg'),
ProjectTemplate.new('android', 'Android', _('A ready-to-go template for use with Android apps.'), 'https://gitlab.com/gitlab-org/project-templates/android', 'illustrations/logos/android.svg'),
ProjectTemplate.new('gomicro', 'Go Micro', _('Go Micro is a framework for micro service development.'), 'https://gitlab.com/gitlab-org/project-templates/go-micro', 'illustrations/logos/gomicro.svg'),
ProjectTemplate.new('gatsby', 'Pages/Gatsby', _('Everything you need to create a GitLab Pages site using Gatsby.'), 'https://gitlab.com/pages/gatsby'),
ProjectTemplate.new('hugo', 'Pages/Hugo', _('Everything you need to create a GitLab Pages site using Hugo.'), 'https://gitlab.com/pages/hugo', 'illustrations/logos/hugo.svg'),
ProjectTemplate.new('jekyll', 'Pages/Jekyll', _('Everything you need to create a GitLab Pages site using Jekyll.'), 'https://gitlab.com/pages/jekyll', 'illustrations/logos/jekyll.svg'),
ProjectTemplate.new('plainhtml', 'Pages/Plain HTML', _('Everything you need to create a GitLab Pages site using plain HTML.'), 'https://gitlab.com/pages/plain-html'),
ProjectTemplate.new('gitbook', 'Pages/GitBook', _('Everything you need to create a GitLab Pages site using GitBook.'), 'https://gitlab.com/pages/gitbook', 'illustrations/logos/gitbook.svg'),
ProjectTemplate.new('hexo', 'Pages/Hexo', _('Everything you need to create a GitLab Pages site using Hexo.'), 'https://gitlab.com/pages/hexo', 'illustrations/logos/hexo.svg'),
ProjectTemplate.new('android', 'Android', _('A ready-to-go template for use with Android apps'), 'https://gitlab.com/gitlab-org/project-templates/android', 'illustrations/logos/android.svg'),
ProjectTemplate.new('gomicro', 'Go Micro', _('Go Micro is a framework for micro service development'), 'https://gitlab.com/gitlab-org/project-templates/go-micro', 'illustrations/logos/gomicro.svg'),
ProjectTemplate.new('gatsby', 'Pages/Gatsby', _('Everything you need to create a GitLab Pages site using Gatsby'), 'https://gitlab.com/pages/gatsby'),
ProjectTemplate.new('hugo', 'Pages/Hugo', _('Everything you need to create a GitLab Pages site using Hugo'), 'https://gitlab.com/pages/hugo', 'illustrations/logos/hugo.svg'),
ProjectTemplate.new('jekyll', 'Pages/Jekyll', _('Everything you need to create a GitLab Pages site using Jekyll'), 'https://gitlab.com/pages/jekyll', 'illustrations/logos/jekyll.svg'),
ProjectTemplate.new('plainhtml', 'Pages/Plain HTML', _('Everything you need to create a GitLab Pages site using plain HTML'), 'https://gitlab.com/pages/plain-html'),
ProjectTemplate.new('gitbook', 'Pages/GitBook', _('Everything you need to create a GitLab Pages site using GitBook'), 'https://gitlab.com/pages/gitbook', 'illustrations/logos/gitbook.svg'),
ProjectTemplate.new('hexo', 'Pages/Hexo', _('Everything you need to create a GitLab Pages site using Hexo'), 'https://gitlab.com/pages/hexo', 'illustrations/logos/hexo.svg'),
ProjectTemplate.new('sse_middleman', 'Static Site Editor/Middleman', _('Middleman project with Static Site Editor support'), 'https://gitlab.com/gitlab-org/project-templates/static-site-editor-middleman', 'illustrations/logos/middleman.svg'),
ProjectTemplate.new('gitpod_spring_petclinic', 'Gitpod/Spring Petclinic', _('A Gitpod configured Webapplication in Spring and Java'), 'https://gitlab.com/gitlab-org/project-templates/gitpod-spring-petclinic', 'illustrations/logos/gitpod.svg'),
ProjectTemplate.new('nfhugo', 'Netlify/Hugo', _('A Hugo site that uses Netlify for CI/CD instead of GitLab, but still with all the other great GitLab features.'), 'https://gitlab.com/pages/nfhugo', 'illustrations/logos/netlify.svg'),
ProjectTemplate.new('nfjekyll', 'Netlify/Jekyll', _('A Jekyll site that uses Netlify for CI/CD instead of GitLab, but still with all the other great GitLab features.'), 'https://gitlab.com/pages/nfjekyll', 'illustrations/logos/netlify.svg'),
ProjectTemplate.new('nfplainhtml', 'Netlify/Plain HTML', _('A plain HTML site that uses Netlify for CI/CD instead of GitLab, but still with all the other great GitLab features.'), 'https://gitlab.com/pages/nfplain-html', 'illustrations/logos/netlify.svg'),
ProjectTemplate.new('nfgitbook', 'Netlify/GitBook', _('A GitBook site that uses Netlify for CI/CD instead of GitLab, but still with all the other great GitLab features.'), 'https://gitlab.com/pages/nfgitbook', 'illustrations/logos/netlify.svg'),
ProjectTemplate.new('nfhexo', 'Netlify/Hexo', _('A Hexo site that uses Netlify for CI/CD instead of GitLab, but still with all the other great GitLab features.'), 'https://gitlab.com/pages/nfhexo', 'illustrations/logos/netlify.svg'),
ProjectTemplate.new('salesforcedx', 'SalesforceDX', _('A project boilerplate for Salesforce App development with Salesforce Developer tools.'), 'https://gitlab.com/gitlab-org/project-templates/salesforcedx'),
ProjectTemplate.new('nfhugo', 'Netlify/Hugo', _('A Hugo site that uses Netlify for CI/CD instead of GitLab, but still with all the other great GitLab features'), 'https://gitlab.com/pages/nfhugo', 'illustrations/logos/netlify.svg'),
ProjectTemplate.new('nfjekyll', 'Netlify/Jekyll', _('A Jekyll site that uses Netlify for CI/CD instead of GitLab, but still with all the other great GitLab features'), 'https://gitlab.com/pages/nfjekyll', 'illustrations/logos/netlify.svg'),
ProjectTemplate.new('nfplainhtml', 'Netlify/Plain HTML', _('A plain HTML site that uses Netlify for CI/CD instead of GitLab, but still with all the other great GitLab features'), 'https://gitlab.com/pages/nfplain-html', 'illustrations/logos/netlify.svg'),
ProjectTemplate.new('nfgitbook', 'Netlify/GitBook', _('A GitBook site that uses Netlify for CI/CD instead of GitLab, but still with all the other great GitLab features'), 'https://gitlab.com/pages/nfgitbook', 'illustrations/logos/netlify.svg'),
ProjectTemplate.new('nfhexo', 'Netlify/Hexo', _('A Hexo site that uses Netlify for CI/CD instead of GitLab, but still with all the other great GitLab features'), 'https://gitlab.com/pages/nfhexo', 'illustrations/logos/netlify.svg'),
ProjectTemplate.new('salesforcedx', 'SalesforceDX', _('A project boilerplate for Salesforce App development with Salesforce Developer tools'), 'https://gitlab.com/gitlab-org/project-templates/salesforcedx'),
ProjectTemplate.new('serverless_framework', 'Serverless Framework/JS', _('A basic page and serverless function that uses AWS Lambda, AWS API Gateway, and GitLab Pages'), 'https://gitlab.com/gitlab-org/project-templates/serverless-framework', 'illustrations/logos/serverless_framework.svg'),
ProjectTemplate.new('jsonnet', 'Jsonnet for Dynamic Child Pipelines', _('An example showing how to use Jsonnet with GitLab dynamic child pipelines'), 'https://gitlab.com/gitlab-org/project-templates/jsonnet'),
ProjectTemplate.new('cluster_management', 'GitLab Cluster Management', _('An example project for managing Kubernetes clusters integrated with GitLab.'), 'https://gitlab.com/gitlab-org/project-templates/cluster-management')
ProjectTemplate.new('cluster_management', 'GitLab Cluster Management', _('An example project for managing Kubernetes clusters integrated with GitLab'), 'https://gitlab.com/gitlab-org/project-templates/cluster-management')
].freeze
end
......
......@@ -5,8 +5,7 @@ module Gitlab
class << self
def localized_templates_table
[
SampleDataTemplate.new('basic', 'Basic', _('Basic Sample Data template with Issues, Merge Requests and Milestones.'), 'https://gitlab.com/gitlab-org/sample-data-templates/basic'),
SampleDataTemplate.new('serenity_valley', 'Serenity Valley', _('Serenity Valley Sample Data template.'), 'https://gitlab.com/gitlab-org/sample-data-templates/serenity-valley')
SampleDataTemplate.new('sample', 'Sample GitLab Project', _('Get started with a project that follows best practices for setting up GitLab for your own organization, including sample Issues, Merge Requests, and Milestones'), 'https://gitlab.com/gitlab-org/sample-data-templates/sample-gitlab-project')
].freeze
end
......
......@@ -1196,19 +1196,19 @@ msgstr ""
msgid "A CI/CD pipeline must run and be successful before merge."
msgstr ""
msgid "A GitBook site that uses Netlify for CI/CD instead of GitLab, but still with all the other great GitLab features."
msgid "A GitBook site that uses Netlify for CI/CD instead of GitLab, but still with all the other great GitLab features"
msgstr ""
msgid "A Gitpod configured Webapplication in Spring and Java"
msgstr ""
msgid "A Hexo site that uses Netlify for CI/CD instead of GitLab, but still with all the other great GitLab features."
msgid "A Hexo site that uses Netlify for CI/CD instead of GitLab, but still with all the other great GitLab features"
msgstr ""
msgid "A Hugo site that uses Netlify for CI/CD instead of GitLab, but still with all the other great GitLab features."
msgid "A Hugo site that uses Netlify for CI/CD instead of GitLab, but still with all the other great GitLab features"
msgstr ""
msgid "A Jekyll site that uses Netlify for CI/CD instead of GitLab, but still with all the other great GitLab features."
msgid "A Jekyll site that uses Netlify for CI/CD instead of GitLab, but still with all the other great GitLab features"
msgstr ""
msgid "A Let's Encrypt SSL certificate can not be obtained until your domain is verified."
......@@ -1277,13 +1277,13 @@ msgstr ""
msgid "A non-confidential epic cannot be assigned to a confidential parent epic"
msgstr ""
msgid "A plain HTML site that uses Netlify for CI/CD instead of GitLab, but still with all the other great GitLab features."
msgid "A plain HTML site that uses Netlify for CI/CD instead of GitLab, but still with all the other great GitLab features"
msgstr ""
msgid "A platform value can be web, mob or app."
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 ""
msgid "A project containing issues for each audit inquiry in the HIPAA Audit Protocol published by the U.S. Department of Health & Human Services"
......@@ -1292,10 +1292,10 @@ msgstr ""
msgid "A project is where you house your files (repository), plan your work (issues), and publish your documentation (wiki), %{among_other_things_link}."
msgstr ""
msgid "A ready-to-go template for use with Android apps."
msgid "A ready-to-go template for use with Android apps"
msgstr ""
msgid "A ready-to-go template for use with iOS Swift apps."
msgid "A ready-to-go template for use with iOS Swift apps"
msgstr ""
msgid "A regular expression that will be used to find the test coverage output in the job log. Leave blank to disable"
......@@ -3333,7 +3333,7 @@ msgstr ""
msgid "An error ocurred while loading your content. Please try again."
msgstr ""
msgid "An example project for managing Kubernetes clusters integrated with GitLab."
msgid "An example project for managing Kubernetes clusters integrated with GitLab"
msgstr ""
msgid "An example showing how to use Jsonnet with GitLab dynamic child pipelines"
......@@ -4364,9 +4364,6 @@ msgstr ""
msgid "Based on"
msgstr ""
msgid "Basic Sample Data template with Issues, Merge Requests and Milestones."
msgstr ""
msgid "Be careful. Changing the project's namespace can have unintended side effects."
msgstr ""
......@@ -11304,22 +11301,22 @@ msgstr ""
msgid "Everything on your to-do list is marked as done."
msgstr ""
msgid "Everything you need to create a GitLab Pages site using Gatsby."
msgid "Everything you need to create a GitLab Pages site using Gatsby"
msgstr ""
msgid "Everything you need to create a GitLab Pages site using GitBook."
msgid "Everything you need to create a GitLab Pages site using GitBook"
msgstr ""
msgid "Everything you need to create a GitLab Pages site using Hexo."
msgid "Everything you need to create a GitLab Pages site using Hexo"
msgstr ""
msgid "Everything you need to create a GitLab Pages site using Hugo."
msgid "Everything you need to create a GitLab Pages site using Hugo"
msgstr ""
msgid "Everything you need to create a GitLab Pages site using Jekyll."
msgid "Everything you need to create a GitLab Pages site using Jekyll"
msgstr ""
msgid "Everything you need to create a GitLab Pages site using plain HTML."
msgid "Everything you need to create a GitLab Pages site using plain HTML"
msgstr ""
msgid "Evidence collection"
......@@ -12845,6 +12842,9 @@ msgstr ""
msgid "Get started"
msgstr ""
msgid "Get started with a project that follows best practices for setting up GitLab for your own organization, including sample Issues, Merge Requests, and Milestones"
msgstr ""
msgid "Get started with error tracking"
msgstr ""
......@@ -13142,7 +13142,7 @@ msgstr ""
msgid "Go Back"
msgstr ""
msgid "Go Micro is a framework for micro service development."
msgid "Go Micro is a framework for micro service development"
msgstr ""
msgid "Go back"
......@@ -14662,13 +14662,13 @@ msgstr ""
msgid "Includes LFS objects. It can be overridden per group, or per project. 0 for unlimited."
msgstr ""
msgid "Includes an MVC structure to help you get started."
msgid "Includes an MVC structure to help you get started"
msgstr ""
msgid "Includes an MVC structure, Gemfile, Rakefile, along with many others, to help you get started."
msgid "Includes an MVC structure, Gemfile, Rakefile, along with many others, to help you get started"
msgstr ""
msgid "Includes an MVC structure, mvnw and pom.xml to help you get started."
msgid "Includes an MVC structure, mvnw and pom.xml to help you get started"
msgstr ""
msgid "Incoming email"
......@@ -21889,9 +21889,6 @@ msgstr ""
msgid "ProjectTemplates|Android"
msgstr ""
msgid "ProjectTemplates|Basic"
msgstr ""
msgid "ProjectTemplates|GitLab Cluster Management"
msgstr ""
......@@ -21946,7 +21943,7 @@ msgstr ""
msgid "ProjectTemplates|SalesforceDX"
msgstr ""
msgid "ProjectTemplates|Serenity Valley"
msgid "ProjectTemplates|Sample GitLab Project"
msgstr ""
msgid "ProjectTemplates|Serverless Framework/JS"
......@@ -23980,9 +23977,6 @@ msgstr ""
msgid "SSL Verification:"
msgstr ""
msgid "Sample Data"
msgstr ""
msgid "Satisfied"
msgstr ""
......@@ -24919,9 +24913,6 @@ msgstr ""
msgid "September"
msgstr ""
msgid "Serenity Valley Sample Data template."
msgstr ""
msgid "SeriesFinalConjunction|and"
msgstr ""
......
......@@ -34,7 +34,7 @@ RSpec.describe 'Project' do
end
context 'create with sample data template' do
it_behaves_like 'creates from template', Gitlab::SampleDataTemplate.find(:basic), '.sample-data-templates-tab'
it_behaves_like 'creates from template', Gitlab::SampleDataTemplate.find(:sample)
end
end
......
......@@ -6,8 +6,7 @@ RSpec.describe Gitlab::SampleDataTemplate do
describe '.all' do
it 'returns all templates' do
expected = %w[
basic
serenity_valley
sample
]
expect(described_class.all).to be_an(Array)
......@@ -19,7 +18,7 @@ RSpec.describe Gitlab::SampleDataTemplate do
subject { described_class.find(query) }
context 'when there is a match' do
let(:query) { :basic }
let(:query) { :sample }
it { is_expected.to be_a(described_class) }
end
......
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