diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-17 12:07:30 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-17 12:07:30 +0300 |
commit | 5498125b82c1bad4c613cc4b90c7920d47d949d4 (patch) | |
tree | 03f35817fea072376372c2f280e62e08e9f8f145 /app | |
parent | 2fff82c54ce215aceabe5b5236fafeea005d4eee (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/admin/topics/components/remove_avatar.vue | 67 | ||||
-rw-r--r-- | app/assets/javascripts/admin/topics/index.js | 22 | ||||
-rw-r--r-- | app/assets/javascripts/pages/admin/topics/edit/index.js | 3 | ||||
-rw-r--r-- | app/controllers/projects/issues_controller.rb | 9 | ||||
-rw-r--r-- | app/helpers/issues_helper.rb | 4 | ||||
-rw-r--r-- | app/models/concerns/pg_full_text_searchable.rb | 2 | ||||
-rw-r--r-- | app/views/admin/topics/_form.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/issues/index.html.haml | 2 |
8 files changed, 103 insertions, 8 deletions
diff --git a/app/assets/javascripts/admin/topics/components/remove_avatar.vue b/app/assets/javascripts/admin/topics/components/remove_avatar.vue new file mode 100644 index 00000000000..5e94d6185e0 --- /dev/null +++ b/app/assets/javascripts/admin/topics/components/remove_avatar.vue @@ -0,0 +1,67 @@ +<script> +import { uniqueId } from 'lodash'; +import { GlButton, GlModal, GlModalDirective } from '@gitlab/ui'; +import { __ } from '~/locale'; +import csrf from '~/lib/utils/csrf'; + +export default { + components: { + GlButton, + GlModal, + }, + directives: { + GlModal: GlModalDirective, + }, + inject: ['path'], + data() { + return { + modalId: uniqueId('remove-topic-avatar-'), + }; + }, + methods: { + deleteApplication() { + this.$refs.deleteForm.submit(); + }, + }, + i18n: { + remove: __('Remove avatar'), + title: __('Confirm remove avatar'), + body: __('Avatar will be removed. Are you sure?'), + }, + modal: { + actionPrimary: { + text: __('Remove'), + attributes: { + variant: 'danger', + }, + }, + actionSecondary: { + text: __('Cancel'), + attributes: { + variant: 'default', + }, + }, + }, + csrf, +}; +</script> +<template> + <div> + <gl-button v-gl-modal="modalId" variant="danger" category="secondary" class="gl-mt-2">{{ + $options.i18n.remove + }}</gl-button> + <gl-modal + :title="$options.i18n.title" + :action-primary="$options.modal.actionPrimary" + :action-secondary="$options.modal.actionSecondary" + :modal-id="modalId" + size="sm" + @primary="deleteApplication" + >{{ $options.i18n.body }} + <form ref="deleteForm" method="post" :action="path"> + <input type="hidden" name="_method" value="delete" /> + <input type="hidden" name="authenticity_token" :value="$options.csrf.token" /> + </form> + </gl-modal> + </div> +</template> diff --git a/app/assets/javascripts/admin/topics/index.js b/app/assets/javascripts/admin/topics/index.js new file mode 100644 index 00000000000..8fbcadf3369 --- /dev/null +++ b/app/assets/javascripts/admin/topics/index.js @@ -0,0 +1,22 @@ +import Vue from 'vue'; +import RemoveAvatar from './components/remove_avatar.vue'; + +export default () => { + const el = document.querySelector('.js-remove-topic-avatar'); + + if (!el) { + return false; + } + + const { path } = el.dataset; + + return new Vue({ + el, + provide: { + path, + }, + render(h) { + return h(RemoveAvatar); + }, + }); +}; diff --git a/app/assets/javascripts/pages/admin/topics/edit/index.js b/app/assets/javascripts/pages/admin/topics/edit/index.js index c4e05bbd092..f5e6d044865 100644 --- a/app/assets/javascripts/pages/admin/topics/edit/index.js +++ b/app/assets/javascripts/pages/admin/topics/edit/index.js @@ -2,7 +2,10 @@ import $ from 'jquery'; import GLForm from '~/gl_form'; import initFilePickers from '~/file_pickers'; import ZenMode from '~/zen_mode'; +import initRemoveAvatar from '~/admin/topics'; new GLForm($('.js-project-topic-form')); // eslint-disable-line no-new initFilePickers(); new ZenMode(); // eslint-disable-line no-new + +initRemoveAvatar(); diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index 2504bfea218..8ff8857ca44 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -72,9 +72,12 @@ class Projects::IssuesController < Projects::ApplicationController attr_accessor :vulnerability_id def index - set_issuables_index if !html_request? || Feature.disabled?(:vue_issues_list, project&.group, default_enabled: :yaml) - - @issues = @issuables + if html_request? && Feature.enabled?(:vue_issues_list, project&.group, default_enabled: :yaml) + set_sort_order + else + set_issuables_index + @issues = @issuables + end respond_to do |format| format.html diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 9187a3eda0a..298162fe970 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -209,7 +209,7 @@ module IssuesHelper } end - def project_issues_list_data(project, current_user, finder) + def project_issues_list_data(project, current_user) common_issues_list_data(project, current_user).merge( can_bulk_update: can?(current_user, :admin_issue, project).to_s, can_edit: can?(current_user, :admin_project, project).to_s, @@ -223,7 +223,7 @@ module IssuesHelper is_project: true.to_s, markdown_help_path: help_page_path('user/markdown'), max_attachment_size: number_to_human_size(Gitlab::CurrentSettings.max_attachment_size.megabytes), - new_issue_path: new_project_issue_path(project, issue: { milestone_id: finder.milestones.first.try(:id) }), + new_issue_path: new_project_issue_path(project), project_import_jira_path: project_import_jira_path(project), quick_actions_help_path: help_page_path('user/project/quick_actions'), releases_path: project_releases_path(project, format: :json), diff --git a/app/models/concerns/pg_full_text_searchable.rb b/app/models/concerns/pg_full_text_searchable.rb index 612a9c5908b..68357c44300 100644 --- a/app/models/concerns/pg_full_text_searchable.rb +++ b/app/models/concerns/pg_full_text_searchable.rb @@ -21,7 +21,7 @@ module PgFullTextSearchable extend ActiveSupport::Concern - LONG_WORDS_REGEX = %r([A-Za-z0-9+/]{50,}).freeze + LONG_WORDS_REGEX = %r([A-Za-z0-9+/@]{50,}).freeze TSVECTOR_MAX_LENGTH = 1.megabyte.freeze TEXT_SEARCH_DICTIONARY = 'english' diff --git a/app/views/admin/topics/_form.html.haml b/app/views/admin/topics/_form.html.haml index 21a1d74a8c6..c40484ea494 100644 --- a/app/views/admin/topics/_form.html.haml +++ b/app/views/admin/topics/_form.html.haml @@ -27,7 +27,7 @@ = topic_icon(@topic, alt: _('Topic avatar'), class: 'avatar topic-avatar s90') = render 'shared/choose_avatar_button', f: f - if @topic.avatar? - = link_to _('Remove avatar'), admin_topic_avatar_path(@topic), data: { confirm: _('Avatar will be removed. Are you sure?')}, method: :delete, class: 'gl-button btn btn-danger-secondary gl-mt-2' + .js-remove-topic-avatar{ data: { path: admin_topic_avatar_path(@topic) } } - if @topic.new_record? .form-actions diff --git a/app/views/projects/issues/index.html.haml b/app/views/projects/issues/index.html.haml index 10c48177ae4..d74b6c0639c 100644 --- a/app/views/projects/issues/index.html.haml +++ b/app/views/projects/issues/index.html.haml @@ -14,7 +14,7 @@ project_path: @project.full_path } } - if Feature.enabled?(:vue_issues_list, @project&.group, default_enabled: :yaml) - .js-issues-list{ data: project_issues_list_data(@project, current_user, finder) } + .js-issues-list{ data: project_issues_list_data(@project, current_user) } - if @can_bulk_update = render 'shared/issuable/bulk_update_sidebar', type: :issues - elsif project_issues(@project).exists? |