diff options
author | Igor <idrozdov@gitlab.com> | 2019-08-05 15:06:02 +0000 |
---|---|---|
committer | Igor <idrozdov@gitlab.com> | 2019-08-05 15:06:02 +0000 |
commit | 7efb062c3c3c7b44113d0dc0fe78fc9b8e95bd7c (patch) | |
tree | a12bde9bbeffcc0c365d3a29339d0389dcefdd8f /app/helpers | |
parent | 2bd1320f86b8cfd5d60199c5f7f0caa1cc2aa66b (diff) | |
parent | 3dfc89ade452ad7f0185653b30ed1d4bb2544fb0 (diff) | |
download | gitlab-ce-id-test-codeowners.tar.gz |
Merge branch 'master' into 'id-test-codeowners'id-test-codeowners
# Conflicts:
# .gitlab/CODEOWNERS
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/application_settings_helper.rb | 3 | ||||
-rw-r--r-- | app/helpers/avatars_helper.rb | 2 | ||||
-rw-r--r-- | app/helpers/dashboard_helper.rb | 15 | ||||
-rw-r--r-- | app/helpers/dropdowns_helper.rb | 2 | ||||
-rw-r--r-- | app/helpers/groups_helper.rb | 4 | ||||
-rw-r--r-- | app/helpers/issuables_helper.rb | 4 | ||||
-rw-r--r-- | app/helpers/labels_helper.rb | 5 | ||||
-rw-r--r-- | app/helpers/sorting_helper.rb | 2 | ||||
-rw-r--r-- | app/helpers/submodule_helper.rb | 24 | ||||
-rw-r--r-- | app/helpers/system_note_helper.rb | 1 | ||||
-rw-r--r-- | app/helpers/tree_helper.rb | 32 | ||||
-rw-r--r-- | app/helpers/wiki_helper.rb | 2 |
12 files changed, 78 insertions, 18 deletions
diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb index 4bf9b708401..acbcf0ded17 100644 --- a/app/helpers/application_settings_helper.rb +++ b/app/helpers/application_settings_helper.rb @@ -160,6 +160,8 @@ module ApplicationSettingsHelper :akismet_api_key, :akismet_enabled, :allow_local_requests_from_hooks_and_services, + :allow_local_requests_from_web_hooks_and_services, + :allow_local_requests_from_system_hooks, :dns_rebinding_protection_enabled, :archive_builds_in_human_readable, :authorized_keys_enabled, @@ -177,6 +179,7 @@ module ApplicationSettingsHelper :domain_blacklist_enabled, :domain_blacklist_raw, :domain_whitelist_raw, + :outbound_local_requests_whitelist_raw, :dsa_key_restriction, :ecdsa_key_restriction, :ed25519_key_restriction, diff --git a/app/helpers/avatars_helper.rb b/app/helpers/avatars_helper.rb index 5906ddabee4..81ff359556d 100644 --- a/app/helpers/avatars_helper.rb +++ b/app/helpers/avatars_helper.rb @@ -52,7 +52,7 @@ module AvatarsHelper user: commit_or_event.author, user_name: commit_or_event.author_name, user_email: commit_or_event.author_email, - css_class: 'd-none d-sm-inline' + css_class: 'd-none d-sm-inline-block' })) end diff --git a/app/helpers/dashboard_helper.rb b/app/helpers/dashboard_helper.rb index 42732eb93dd..d71af08a656 100644 --- a/app/helpers/dashboard_helper.rb +++ b/app/helpers/dashboard_helper.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true module DashboardHelper + include IconsHelper + def assigned_issues_dashboard_path issues_dashboard_path(assignee_username: current_user.username) end @@ -25,6 +27,19 @@ module DashboardHelper false end + def feature_entry(title, href: nil, enabled: true) + enabled_text = enabled ? 'on' : 'off' + label = "#{title}: status #{enabled_text}" + link_or_title = href && enabled ? tag.a(title, href: href) : title + + tag.p(aria: { label: label }) do + concat(link_or_title) + concat(tag.span(class: ['light', 'float-right']) do + concat(boolean_to_icon(enabled)) + end) + end + end + private def get_dashboard_nav_links diff --git a/app/helpers/dropdowns_helper.rb b/app/helpers/dropdowns_helper.rb index fd94f07cc2c..64c5fae7d96 100644 --- a/app/helpers/dropdowns_helper.rb +++ b/app/helpers/dropdowns_helper.rb @@ -46,7 +46,7 @@ module DropdownsHelper def dropdown_toggle(toggle_text, data_attr, options = {}) default_label = data_attr[:default_label] - content_tag(:button, disabled: options[:disabled], class: "dropdown-menu-toggle btn #{options[:toggle_class] if options.key?(:toggle_class)}", id: (options[:id] if options.key?(:id)), type: "button", data: data_attr) do + content_tag(:button, disabled: options[:disabled], class: "dropdown-menu-toggle #{options[:toggle_class] if options.key?(:toggle_class)}", id: (options[:id] if options.key?(:id)), type: "button", data: data_attr) do output = content_tag(:span, toggle_text, class: "dropdown-toggle-text #{'is-default' if toggle_text == default_label}") output << icon('chevron-down') output.html_safe diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb index 5aed7e313e6..160f9ac4793 100644 --- a/app/helpers/groups_helper.rb +++ b/app/helpers/groups_helper.rb @@ -127,10 +127,6 @@ module GroupsHelper groups.to_json end - def supports_nested_groups? - Group.supports_nested_objects? - end - private def get_group_sidebar_links diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb index 67685ba4e1d..e2e007eee50 100644 --- a/app/helpers/issuables_helper.rb +++ b/app/helpers/issuables_helper.rb @@ -282,6 +282,10 @@ module IssuablesHelper data[:hasClosingMergeRequest] = issuable.merge_requests_count(current_user) != 0 if issuable.is_a?(Issue) + zoom_links = Gitlab::ZoomLinkExtractor.new(issuable.description).links + + data[:zoomMeetingUrl] = zoom_links.last if zoom_links.any? + if parent.is_a?(Group) data[:groupPath] = parent.path else diff --git a/app/helpers/labels_helper.rb b/app/helpers/labels_helper.rb index db4f29cd996..2ed016beea4 100644 --- a/app/helpers/labels_helper.rb +++ b/app/helpers/labels_helper.rb @@ -4,11 +4,10 @@ module LabelsHelper extend self include ActionView::Helpers::TagHelper - def show_label_issuables_link?(label, issuables_type, current_user: nil, project: nil) + def show_label_issuables_link?(label, issuables_type, current_user: nil) return true unless label.project_label? - return true unless project - project.feature_available?(issuables_type, current_user) + label.project.feature_available?(issuables_type, current_user) end # Link to a Label diff --git a/app/helpers/sorting_helper.rb b/app/helpers/sorting_helper.rb index d5e5b472115..15f35645c78 100644 --- a/app/helpers/sorting_helper.rb +++ b/app/helpers/sorting_helper.rb @@ -210,7 +210,7 @@ module SortingHelper end def sort_direction_button(reverse_url, reverse_sort, sort_value) - link_class = 'btn btn-default has-tooltip reverse-sort-btn qa-reverse-sort' + link_class = 'btn btn-default has-tooltip reverse-sort-btn qa-reverse-sort rspec-reverse-sort' icon = sort_direction_icon(sort_value) url = reverse_url diff --git a/app/helpers/submodule_helper.rb b/app/helpers/submodule_helper.rb index 164c69ca50b..e683e2959d1 100644 --- a/app/helpers/submodule_helper.rb +++ b/app/helpers/submodule_helper.rb @@ -9,6 +9,12 @@ module SubmoduleHelper def submodule_links(submodule_item, ref = nil, repository = @repository) url = repository.submodule_url_for(ref, submodule_item.path) + submodule_links_for_url(submodule_item.id, url, repository) + end + + def submodule_links_for_url(submodule_item_id, url, repository) + return [nil, nil] unless url + if url == '.' || url == './' url = File.join(Gitlab.config.gitlab.url, repository.project.full_path) end @@ -30,14 +36,14 @@ module SubmoduleHelper project.sub!(/\.git\z/, '') if self_url?(url, namespace, project) - [namespace_project_path(namespace, project), - namespace_project_tree_path(namespace, project, submodule_item.id)] + [url_helpers.namespace_project_path(namespace, project), + url_helpers.namespace_project_tree_path(namespace, project, submodule_item_id)] elsif relative_self_url?(url) - relative_self_links(url, submodule_item.id, repository.project) + relative_self_links(url, submodule_item_id, repository.project) elsif github_dot_com_url?(url) - standard_links('github.com', namespace, project, submodule_item.id) + standard_links('github.com', namespace, project, submodule_item_id) elsif gitlab_dot_com_url?(url) - standard_links('gitlab.com', namespace, project, submodule_item.id) + standard_links('gitlab.com', namespace, project, submodule_item_id) else [sanitize_submodule_url(url), nil] end @@ -95,8 +101,8 @@ module SubmoduleHelper begin [ - namespace_project_path(target_namespace_path, submodule_base), - namespace_project_tree_path(target_namespace_path, submodule_base, commit) + url_helpers.namespace_project_path(target_namespace_path, submodule_base), + url_helpers.namespace_project_tree_path(target_namespace_path, submodule_base, commit) ] rescue ActionController::UrlGenerationError [nil, nil] @@ -114,4 +120,8 @@ module SubmoduleHelper rescue URI::InvalidURIError nil end + + def url_helpers + Gitlab::Routing.url_helpers + end end diff --git a/app/helpers/system_note_helper.rb b/app/helpers/system_note_helper.rb index ac4e8f54260..3efae0a653c 100644 --- a/app/helpers/system_note_helper.rb +++ b/app/helpers/system_note_helper.rb @@ -21,6 +21,7 @@ module SystemNoteHelper 'discussion' => 'comment', 'moved' => 'arrow-right', 'outdated' => 'pencil-square', + 'pinned_embed' => 'thumbtack', 'duplicate' => 'issue-duplicate', 'locked' => 'lock', 'unlocked' => 'lock-open', diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb index a3575462de0..bb1cdcb1b31 100644 --- a/app/helpers/tree_helper.rb +++ b/app/helpers/tree_helper.rb @@ -154,4 +154,36 @@ module TreeHelper "logs-path" => logs_path } end + + def breadcrumb_data_attributes + attrs = { + can_collaborate: can_collaborate_with_project?(@project).to_s, + new_blob_path: project_new_blob_path(@project, @id), + new_branch_path: new_project_branch_path(@project), + new_tag_path: new_project_tag_path(@project), + can_edit_tree: can_edit_tree?.to_s + } + + if can?(current_user, :fork_project, @project) && can?(current_user, :create_merge_request_in, @project) + continue_param = { + to: project_new_blob_path(@project, @id), + notice: edit_in_new_fork_notice, + notice_now: edit_in_new_fork_notice_now + } + + attrs.merge!( + fork_new_blob_path: project_forks_path(@project, namespace_key: current_user.namespace.id, continue: continue_param), + fork_new_directory_path: project_forks_path(@project, namespace_key: current_user.namespace.id, continue: continue_param.merge({ + to: request.fullpath, + notice: _("%{edit_in_new_fork_notice} Try to create a new directory again.") % { edit_in_new_fork_notice: edit_in_new_fork_notice } + })), + fork_upload_blob_path: project_forks_path(@project, namespace_key: current_user.namespace.id, continue: continue_param.merge({ + to: request.fullpath, + notice: _("%{edit_in_new_fork_notice} Try to upload a file again.") % { edit_in_new_fork_notice: edit_in_new_fork_notice } + })) + ) + end + + attrs + end end diff --git a/app/helpers/wiki_helper.rb b/app/helpers/wiki_helper.rb index edd48f82729..dd8fde2a697 100644 --- a/app/helpers/wiki_helper.rb +++ b/app/helpers/wiki_helper.rb @@ -50,7 +50,7 @@ module WikiHelper def wiki_sort_controls(project, sort, direction) sort ||= ProjectWiki::TITLE_ORDER - link_class = 'btn btn-default has-tooltip reverse-sort-btn qa-reverse-sort' + link_class = 'btn btn-default has-tooltip reverse-sort-btn qa-reverse-sort rspec-reverse-sort' reversed_direction = direction == 'desc' ? 'asc' : 'desc' icon_class = direction == 'desc' ? 'highest' : 'lowest' |