diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /app/helpers/blob_helper.rb | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'app/helpers/blob_helper.rb')
-rw-r--r-- | app/helpers/blob_helper.rb | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb index bca53dfb88a..28a947a6ca1 100644 --- a/app/helpers/blob_helper.rb +++ b/app/helpers/blob_helper.rb @@ -64,7 +64,7 @@ module BlobHelper def edit_blob_button(project = @project, ref = @ref, path = @path, options = {}) return unless blob = readable_blob(options, path, project, ref) - common_classes = "btn btn-primary js-edit-blob gl-mr-3 #{options[:extra_class]}" + common_classes = "btn gl-button btn-confirm js-edit-blob gl-ml-3 #{options[:extra_class]}" data = { track_event: 'click_edit', track_label: 'Edit' } if Feature.enabled?(:web_ide_primary_edit, project.group) @@ -84,7 +84,7 @@ module BlobHelper def ide_edit_button(project = @project, ref = @ref, path = @path, blob:) return unless blob - common_classes = 'btn btn-primary ide-edit-button gl-mr-3' + common_classes = 'btn gl-button btn-confirm ide-edit-button gl-ml-3' data = { track_event: 'click_edit_ide', track_label: 'Web IDE' } unless Feature.enabled?(:web_ide_primary_edit, project.group) @@ -105,7 +105,7 @@ module BlobHelper return unless current_user return unless blob - common_classes = "btn btn-#{btn_class}" + common_classes = "btn gl-button btn-default btn-#{btn_class}" base_button = button_tag(label, class: "#{common_classes} disabled", disabled: true) if !on_top_of_branch?(project, ref) @@ -194,40 +194,28 @@ module BlobHelper @ref_project ||= @target_project || @project end - def template_dropdown_names(items) - grouped = items.group_by(&:category) - categories = grouped.keys - - categories.each_with_object({}) do |category, hash| - hash[category] = grouped[category].map do |item| - { name: item.name, id: item.key } - end - end - end - private :template_dropdown_names - def licenses_for_select(project) - @licenses_for_select ||= template_dropdown_names(TemplateFinder.build(:licenses, project).execute) + @licenses_for_select ||= TemplateFinder.all_template_names(project, :licenses) end def gitignore_names(project) - @gitignore_names ||= template_dropdown_names(TemplateFinder.build(:gitignores, project).execute) + @gitignore_names ||= TemplateFinder.all_template_names(project, :gitignores) end def gitlab_ci_ymls(project) - @gitlab_ci_ymls ||= template_dropdown_names(TemplateFinder.build(:gitlab_ci_ymls, project).execute) + @gitlab_ci_ymls ||= TemplateFinder.all_template_names(project, :gitlab_ci_ymls) end def gitlab_ci_syntax_ymls(project) - @gitlab_ci_syntax_ymls ||= template_dropdown_names(TemplateFinder.build(:gitlab_ci_syntax_ymls, project).execute) + @gitlab_ci_syntax_ymls ||= TemplateFinder.all_template_names(project, :gitlab_ci_syntax_ymls) end def metrics_dashboard_ymls(project) - @metrics_dashboard_ymls ||= template_dropdown_names(TemplateFinder.build(:metrics_dashboard_ymls, project).execute) + @metrics_dashboard_ymls ||= TemplateFinder.all_template_names(project, :metrics_dashboard_ymls) end def dockerfile_names(project) - @dockerfile_names ||= template_dropdown_names(TemplateFinder.build(:dockerfiles, project).execute) + @dockerfile_names ||= TemplateFinder.all_template_names(project, :dockerfiles) end def blob_editor_paths(project) @@ -241,13 +229,13 @@ module BlobHelper end def copy_file_path_button(file_path) - clipboard_button(text: file_path, gfm: "`#{file_path}`", class: 'btn-clipboard btn-transparent', title: _('Copy file path')) + clipboard_button(text: file_path, gfm: "`#{file_path}`", class: 'gl-button btn btn-default-tertiary btn-icon btn-sm', title: _('Copy file path')) end def copy_blob_source_button(blob) return unless blob.rendered_as_text?(ignore_errors: false) - clipboard_button(target: ".blob-content[data-blob-id='#{blob.id}'] > pre", class: "btn btn-sm js-copy-blob-source-btn", title: _("Copy file contents")) + clipboard_button(target: ".blob-content[data-blob-id='#{blob.id}'] > pre", class: "btn gl-button btn-default btn-icon js-copy-blob-source-btn", title: _("Copy file contents")) end def open_raw_blob_button(blob) @@ -257,7 +245,7 @@ module BlobHelper title = _('Open raw') link_to sprite_icon('doc-code'), external_storage_url_or_path(blob_raw_path), - class: 'btn btn-sm has-tooltip', + class: 'btn gl-button btn-default btn-icon has-tooltip', target: '_blank', rel: 'noopener noreferrer', aria: { label: title }, @@ -272,7 +260,7 @@ module BlobHelper link_to sprite_icon('download'), external_storage_url_or_path(blob_raw_path(inline: false)), download: @path, - class: 'btn btn-sm has-tooltip', + class: 'btn gl-button btn-default btn-icon has-tooltip', target: '_blank', rel: 'noopener noreferrer', aria: { label: title }, @@ -373,7 +361,7 @@ module BlobHelper end def edit_link_tag(link_text, edit_path, common_classes, data) - link_to link_text, edit_path, class: "#{common_classes} btn-sm", data: data + link_to link_text, edit_path, class: "#{common_classes}", data: data end def edit_button_tag(blob, common_classes, text, edit_path, project, ref, data) |