Skip to content
Snippets Groups Projects
Commit 1993a444 authored by gfyoung's avatar gfyoung
Browse files

Enable frozen string for app/helpers/**/*.rb

Partially addresses #47424.
parent 07d5ee36
No related branches found
No related tags found
1 merge request!10495Merge Requests - Assignee
Showing
with 55 additions and 16 deletions
# frozen_string_literal: true
module AccountsHelper
def incoming_email_token_enabled?
current_user.incoming_email_token && Gitlab::IncomingEmail.supports_issue_creation?
Loading
Loading
# frozen_string_literal: true
module ActiveSessionsHelper
# Maps a device type as defined in `ActiveSession` to an svg icon name and
# outputs the icon html.
Loading
Loading
# frozen_string_literal: true
module AppearancesHelper
def brand_title
current_appearance&.title.presence || 'GitLab Community Edition'
Loading
Loading
# frozen_string_literal: true
require 'digest/md5'
require 'uri'
 
Loading
Loading
@@ -106,11 +108,11 @@ module ApplicationHelper
#
# Returns an HTML-safe String
def time_ago_with_tooltip(time, placement: 'top', html_class: '', short_format: false)
css_classes = short_format ? 'js-short-timeago' : 'js-timeago'
css_classes << " #{html_class}" unless html_class.blank?
css_classes = [short_format ? 'js-short-timeago' : 'js-timeago']
css_classes << html_class unless html_class.blank?
 
element = content_tag :time, l(time, format: "%b %d, %Y"),
class: css_classes,
class: css_classes.join(' '),
title: l(time.to_time.in_time_zone, format: :timeago_tooltip),
datetime: time.to_time.getutc.iso8601,
data: {
Loading
Loading
# frozen_string_literal: true
module ApplicationSettingsHelper
extend self
 
Loading
Loading
@@ -73,12 +75,12 @@ module ApplicationSettingsHelper
def oauth_providers_checkboxes
button_based_providers.map do |source|
disabled = Gitlab::CurrentSettings.disabled_oauth_sign_in_sources.include?(source.to_s)
css_class = 'btn'
css_class << ' active' unless disabled
css_class = ['btn']
css_class << 'active' unless disabled
checkbox_name = 'application_setting[enabled_oauth_sign_in_sources][]'
name = Gitlab::Auth::OAuth::Provider.label_for(source)
 
label_tag(checkbox_name, class: css_class) do
label_tag(checkbox_name, class: css_class.join(' ')) do
check_box_tag(checkbox_name, source, !disabled,
autocomplete: 'off',
id: name.tr(' ', '_')) + name
Loading
Loading
# frozen_string_literal: true
module AuthHelper
PROVIDERS_WITH_ICONS = %w(twitter github gitlab bitbucket google_oauth2 facebook azure_oauth2 authentiq).freeze
LDAP_PROVIDER = /\Aldap/
Loading
Loading
# frozen_string_literal: true
module AutoDevopsHelper
def show_auto_devops_callout?(project)
Feature.get(:auto_devops_banner_disabled).off? &&
Loading
Loading
# frozen_string_literal: true
module AvatarsHelper
def project_icon(project_id, options = {})
source_icon(Project, project_id, options)
Loading
Loading
@@ -125,9 +127,9 @@ module AvatarsHelper
 
def source_identicon(source, options = {})
bg_key = (source.id % 7) + 1
options[:class] ||= ''
options[:class] << ' identicon'
options[:class] << " bg#{bg_key}"
options[:class] =
[*options[:class], "identicon bg#{bg_key}"].join(' ')
 
content_tag(:div, class: options[:class].strip) do
source.name[0, 1].upcase
Loading
Loading
# frozen_string_literal: true
module AwardEmojiHelper
def toggle_award_url(awardable)
return url_for([:toggle_award_emoji, awardable]) unless @project || awardable.is_a?(Note)
Loading
Loading
# frozen_string_literal: true
module BlameHelper
def age_map_duration(blame_groups, project)
now = Time.zone.now
Loading
Loading
# frozen_string_literal: true
module BlobHelper
def highlight(blob_name, blob_content, repository: nil, plain: false)
plain ||= blob_content.length > Blob::MAXIMUM_TEXT_HIGHLIGHT_SIZE
Loading
Loading
# frozen_string_literal: true
module BoardsHelper
def board
@board ||= @board || @boards.first
Loading
Loading
# frozen_string_literal: true
module BranchesHelper
def project_branches
options_for_select(@project.repository.branch_names, @project.default_branch)
Loading
Loading
# frozen_string_literal: true
module BreadcrumbsHelper
def add_to_breadcrumbs(text, link)
@breadcrumbs_extra_links ||= []
Loading
Loading
# frozen_string_literal: true
module BroadcastMessagesHelper
def broadcast_message(message)
return unless message.present?
Loading
Loading
@@ -8,18 +10,17 @@ module BroadcastMessagesHelper
end
 
def broadcast_message_style(broadcast_message)
style = ''
style = []
 
if broadcast_message.color.present?
style << "background-color: #{broadcast_message.color}"
style << '; ' if broadcast_message.font.present?
end
 
if broadcast_message.font.present?
style << "color: #{broadcast_message.font}"
end
 
style
style.join('; ')
end
 
def broadcast_message_status(broadcast_message)
Loading
Loading
# frozen_string_literal: true
module BuildsHelper
def build_summary(build, skip: false)
if build.has_trace?
Loading
Loading
@@ -12,10 +14,10 @@ module BuildsHelper
end
 
def sidebar_build_class(build, current_build)
build_class = ''
build_class += ' active' if build.id === current_build.id
build_class += ' retried' if build.retried?
build_class
build_class = []
build_class << 'active' if build.id === current_build.id
build_class << 'retried' if build.retried?
build_class.join(' ')
end
 
def javascript_build_options
Loading
Loading
# frozen_string_literal: true
module ButtonHelper
# Output a "Copy to Clipboard" button
#
Loading
Loading
# frozen_string_literal: true
module CalendarHelper
def calendar_url_options
{ format: :ics,
Loading
Loading
# frozen_string_literal: true
##
# DEPRECATED
#
Loading
Loading
# frozen_string_literal: true
module ClustersHelper
def has_multiple_clusters?(project)
false
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment