source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/struct/dns_analytics.rb | Ruby | mit | 188 | main | 315 | # frozen_string_literal: true
module Dnsimple
module Struct
class DnsAnalytics < Base
# @return [Integer] The recorded volume
attr_accessor :volume
# @return [Date] The date
attr_accessor :date
# @return [String] The zone name
attr_accessor :zone_name
end
end
end |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/vanity_name_servers.rb | Ruby | mit | 188 | main | 1,752 | # frozen_string_literal: true
module Dnsimple
class Client
module VanityNameServers
# Enable vanity name servers for the domain.
#
# @see https://developer.dnsimple.com/v2/vanity/#enableVanityNameServers
#
# @example Enable vanity name servers for example.com:
# client.vanit... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/registrar_registrant_changes.rb | Ruby | mit | 188 | main | 4,994 | # frozen_string_literal: true
module Dnsimple
class Client
module RegistrarRegistrantChanges
# Retrieves the requirements of a registrant change
#
# @example Check the requirements to change the contact for example.com to contact 1234:
# client.registrar.check_registrant_change(1010, { ... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/registrar_transfer_lock.rb | Ruby | mit | 188 | main | 2,348 | # frozen_string_literal: true
module Dnsimple
class Client
module RegistrarTransferLock
# Gets the transfer lock for the domain.
#
# @example Get the transfer lock for "example.com":
# client.registrar.get_domain_transfer_lock(1010, "example.com")
#
# @param account_id [#to... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/domains_email_forwards.rb | Ruby | mit | 188 | main | 5,246 | # frozen_string_literal: true
module Dnsimple
class Client
module DomainsEmailForwards
# Lists the email forwards for the domain.
#
# @see https://developer.dnsimple.com/v2/domains/email-forwards/#list
#
# @example List email forwards in the first page
# client.domains.email... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/clients.rb | Ruby | mit | 188 | main | 7,183 | # frozen_string_literal: true
module Dnsimple
class Client
# @return [Dnsimple::Client::AccountsService] The account-related API proxy.
def accounts
@services[:accounts] ||= Client::AccountsService.new(self)
end
# @return [Dnsimple::Client::BillingService] The billing-related API proxy.
de... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/services_domains.rb | Ruby | mit | 188 | main | 3,683 | # frozen_string_literal: true
module Dnsimple
class Client
module ServicesDomains
# Lists the one-click services applied to the domain.
#
# @see https://developer.dnsimple.com/v2/services/domains/#applied
#
# @example List applied one-click services for example.com:
# client... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/registrar_delegation.rb | Ruby | mit | 188 | main | 3,913 | # frozen_string_literal: true
module Dnsimple
class Client
module RegistrarDelegation
# Lists name servers the domain is delegating to.
#
# @see https://developer.dnsimple.com/v2/registrar/delegation/#list
#
# @example List the name servers example.com is delegating to:
# cl... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/certificates.rb | Ruby | mit | 188 | main | 13,989 | # frozen_string_literal: true
module Dnsimple
class Client
module Certificates
# List the certificates for the domain in the account.
#
# @see https://developer.dnsimple.com/v2/certificates/#listCertificates
# @see #all_certificates
#
# @example List certificates in the first ... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/webhooks.rb | Ruby | mit | 188 | main | 3,290 | # frozen_string_literal: true
module Dnsimple
class Client
module Webhooks
# Lists ALL the webhooks in the account.
#
# @see https://developer.dnsimple.com/v2/webhooks/#list
#
# @example List all webhooks
# client.webhooks.list(1010)
#
# @example List all webhook... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/zones.rb | Ruby | mit | 188 | main | 5,320 | # frozen_string_literal: true
module Dnsimple
class Client
module Zones
# Lists the zones in the account.
#
# @see https://developer.dnsimple.com/v2/zones/#list
# @see #all_zones
#
# @example List zones in the first page
# client.zones.list(1010, "example.com")
#... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/zones_records.rb | Ruby | mit | 188 | main | 9,112 | # frozen_string_literal: true
module Dnsimple
class Client
module ZonesRecords
# Lists the zone records in the account.
#
# @see https://developer.dnsimple.com/v2/zones/records/#listZoneRecords
# @see #all_records
#
# @example List records for the zone "example.com" in the fir... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/registrar_auto_renewal.rb | Ruby | mit | 188 | main | 1,460 | # frozen_string_literal: true
module Dnsimple
class Client
module RegistrarAutoRenewal
# Enable auto renewal for the domain in the account.
#
# @see https://developer.dnsimple.com/v2/registrar/auto-renewal/
#
# @param account_id [Integer] the account ID
# @param domain_name ... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/templates.rb | Ruby | mit | 188 | main | 5,954 | # frozen_string_literal: true
module Dnsimple
class Client
module Templates
# Lists the templates in the account.
#
# @see https://developer.dnsimple.com/v2/templates/#list
#
# @example List the templates for account 1010:
# client.templates.list_templates(1010)
#
... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/accounts.rb | Ruby | mit | 188 | main | 701 | # frozen_string_literal: true
module Dnsimple
class Client
module Accounts
# Lists the accounts the authenticated entity has access to.
#
# @see https://developer.dnsimple.com/v2/accounts
#
# @example List the accounts:
# client.accounts.list
#
# @param options ... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/templates_domains.rb | Ruby | mit | 188 | main | 997 | # frozen_string_literal: true
module Dnsimple
class Client
module TemplatesDomains
# Applies a template to the domain.
#
# @see https://developer.dnsimple.com/v2/templates/domains/#apply
#
# @example Apply template 5401 for example.com in account 1010:
# client.templates.app... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/domains.rb | Ruby | mit | 188 | main | 5,423 | # frozen_string_literal: true
module Dnsimple
class Client
module Domains
# Lists the domains in the account.
#
# @see https://developer.dnsimple.com/v2/domains/#listDomains
# @see #all_domains
#
# @example List domains in the first page
# client.domains.domains(1010)
... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/contacts.rb | Ruby | mit | 188 | main | 5,197 | # frozen_string_literal: true
module Dnsimple
class Client
module Contacts
# Lists the contacts in the account.
#
# @see https://developer.dnsimple.com/v2/contacts/#list
# @see #all_contacts
#
# @example List contacts in the first page
# client.contacts.list(1010)
... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/oauth.rb | Ruby | mit | 188 | main | 2,325 | # frozen_string_literal: true
module Dnsimple
class Client
module Oauth
# Exchange the short-lived authorization code for an access token
# you can use to authenticate your API calls.
#
# @see https://developer.dnsimple.com/v2/oauth/
#
# @param client_id [String] Client Id yo... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/registrar_whois_privacy.rb | Ruby | mit | 188 | main | 1,900 | # frozen_string_literal: true
module Dnsimple
class Client
module RegistrarWhoisPrivacy
# Enables whois privacy for the domain.
#
# @see https://developer.dnsimple.com/v2/registrar/whois-privacy/#enable
#
# @example Enable whois privacy for "example.com":
# client.registrar.... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/domains_pushes.rb | Ruby | mit | 188 | main | 4,130 | # frozen_string_literal: true
module Dnsimple
class Client
module DomainsPushes
# Initiate a push for the domain.
#
# @see https://developer.dnsimple.com/v2/domains/pushes/#initiate
#
# @example Initiate a domain push for example.com using a domain push identifier:
# client.... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/tlds.rb | Ruby | mit | 188 | main | 3,626 | # frozen_string_literal: true
module Dnsimple
class Client
module Tlds
# Lists the TLDs available for registration
#
# @see https://developer.dnsimple.com/v2/tlds/#listTlds
#
# @example List TLDs in the first page
# client.tlds.list_tlds
#
# @example List TLDs, p... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/dns_analytics.rb | Ruby | mit | 188 | main | 1,215 | # frozen_string_literal: true
module Dnsimple
class Client
module DnsAnalytics
# Queries DNS Analytics data for the provided account
#
# @see https://developer.dnsimple.com/v2/dns-analytics#queryDnsAnalytics
#
# @param account_id [Integer] the account ID
# @param options [Ha... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/identity.rb | Ruby | mit | 188 | main | 1,004 | # frozen_string_literal: true
module Dnsimple
class Client
module Identity
# Gets the information about the current authenticated context.
#
# @see https://developer.dnsimple.com/v2/identity/#whoami
#
# @param options [Hash]
# @return [Dnsimple::Response<Dnsimple::Struct::Who... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/domains_research.rb | Ruby | mit | 188 | main | 1,084 | # frozen_string_literal: true
module Dnsimple
class Client
module DomainsResearch
# Research a domain name for availability and registration status information.
#
# This endpoint provides information about a domain's availability status.
#
# @example Research the domain example.com:... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/services.rb | Ruby | mit | 188 | main | 3,084 | # frozen_string_literal: true
module Dnsimple
class Client
module Services
# Lists the available one-click services.
#
# @see https://developer.dnsimple.com/v2/services/#list
#
# @example List one-click services:
# client.services.list_services
#
# @example List ... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/domains_dnssec.rb | Ruby | mit | 188 | main | 2,121 | # frozen_string_literal: true
module Dnsimple
class Client
module DomainsDnssec
# Enable DNSSEC for the domain in the account.
#
# @see https://developer.dnsimple.com/v2/dnssec/#enable
#
# @param account_id [Integer] the account ID
# @param domain_name [#to_s] the domain nam... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/registrar.rb | Ruby | mit | 188 | main | 11,566 | # frozen_string_literal: true
module Dnsimple
class Client
module Registrar
# Checks whether a domain is available to be registered.
#
# @see https://developer.dnsimple.com/v2/registrar/#check
#
# @example Check whether example.com is available:
# client.registrar.check_doma... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/domains_delegation_signer_records.rb | Ruby | mit | 188 | main | 6,278 | # frozen_string_literal: true
module Dnsimple
class Client
module DomainsDelegationSignerRecords
# Lists the delegation signer records for the domain.
#
# @see https://developer.dnsimple.com/v2/domains/dnssec/#ds-record-list
#
# @example List delegation signer records in the first p... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/templates_records.rb | Ruby | mit | 188 | main | 5,856 | # frozen_string_literal: true
module Dnsimple
class Client
module TemplatesRecords
# Lists the records in the template.
#
# @see https://developer.dnsimple.com/v2/templates/records/#list
# @see #all_records
#
# @example List the first page of records for the template "alpha"
... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/zones_distributions.rb | Ruby | mit | 188 | main | 1,884 | # frozen_string_literal: true
module Dnsimple
class Client
module ZonesDistributions
# Checks if a zone change is fully distributed to all DNSimple name
# servers across the globe.
#
# @see https://developer.dnsimple.com/v2/zones/#checkZoneDistribution
#
# @param account_id [... |
github | dnsimple/dnsimple-ruby | https://github.com/dnsimple/dnsimple-ruby | lib/dnsimple/client/billing.rb | Ruby | mit | 188 | main | 1,342 | # frozen_string_literal: true
module Dnsimple
class Client
module Billing
# List the billing charges for the account.
#
# @see https://developer.dnsimple.com/v2/billing/#listCharges
#
# @example List charges in the first page
# client.charges.list(1010)
#
# @exam... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | govuk-components.gemspec | Ruby | mit | 188 | main | 2,329 | $LOAD_PATH.push File.expand_path("lib", __dir__)
require "govuk/components/version"
METADATA = {
"bug_tracker_uri" => "https://github.com/x-govuk/govuk-components/issues",
"changelog_uri" => "https://github.com/x-govuk/govuk-components/releases",
"documentation_uri" => "https://www.rubydoc.info/gems/govuk... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | Gemfile | Ruby | mit | 188 | main | 699 | source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# Declare your gem's dependencies in govuk-components.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec
# De... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | Rakefile | Ruby | mit | 188 | main | 529 | begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
require 'rdoc/task'
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'Govuk::Components'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('README.md... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/header_component.rb | Ruby | mit | 188 | main | 1,952 | class GovukComponent::HeaderComponent < GovukComponent::Base
renders_one :custom_logo
renders_one :product_name, "ProductName"
renders_one :service_navigation, "GovukComponent::ServiceNavigationComponent"
renders_one :phase_banner, "GovukComponent::PhaseBannerComponent"
attr_reader :homepage_url,
... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/table_component.rb | Ruby | mit | 188 | main | 1,623 | module GovukComponent
class TableComponent < GovukComponent::Base
renders_one :caption, "GovukComponent::TableComponent::CaptionComponent"
renders_many :cols, "GovukComponent::TableComponent::ColGroupComponent::ColComponent"
renders_many :colgroups, "GovukComponent::TableComponent::ColGroupComponent"
... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/phase_banner_component.rb | Ruby | mit | 188 | main | 561 | class GovukComponent::PhaseBannerComponent < GovukComponent::Base
attr_reader :text, :phase_tag
def initialize(
tag: { text: config.default_phase_banner_tag },
text: config.default_phase_banner_text,
classes: [],
html_attributes: {}
)
@phase_tag = tag
@text = text
super(classes:... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/start_button_component.rb | Ruby | mit | 188 | main | 1,187 | class GovukComponent::StartButtonComponent < GovukComponent::Base
attr_reader :text, :href, :as_button
def initialize(text:, href:, as_button: config.default_start_button_as_button, classes: [], html_attributes: {})
@text = text
@href = href
@as_button = as_button
super(classes:, html_attributes:)... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/cookie_banner_component.rb | Ruby | mit | 188 | main | 943 | module GovukComponent
class CookieBannerComponent < GovukComponent::Base
renders_many :messages, "GovukComponent::CookieBannerComponent::MessageComponent"
attr_accessor :aria_label, :hidden, :hide_in_print
def initialize(
aria_label: config.default_cookie_banner_aria_label,
hidden: false,
... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/details_component.rb | Ruby | mit | 188 | main | 917 | class GovukComponent::DetailsComponent < GovukComponent::Base
attr_reader :summary_text, :text, :id, :open
renders_one :summary_html
def initialize(summary_text: nil, text: nil, classes: [], id: nil, open: nil, html_attributes: {})
@summary_text = summary_text
@text = text
@id = id... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/base.rb | Ruby | mit | 188 | main | 1,169 | class GovukComponent::Base < ViewComponent::Base
using HTMLAttributesUtils
attr_reader :html_attributes
delegate :config, to: Govuk::Components
def initialize(classes:, html_attributes:)
if classes.nil?
Rails.logger.warn("classes is nil, if no custom classes are needed omit the param")
class... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/footer_component.rb | Ruby | mit | 188 | main | 3,011 | class GovukComponent::FooterComponent < GovukComponent::Base
include GovukLinkHelper
using HTMLAttributesUtils
renders_one :meta_html
renders_one :meta
renders_one :navigation
renders_one :content_before_meta_items
renders_one :content_after_meta_items
renders_one :meta_licence_html
attr_reader :me... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/task_list_component.rb | Ruby | mit | 188 | main | 873 | module GovukComponent
class TaskListComponent < GovukComponent::Base
renders_many :items, ->(title: nil, href: nil, hint: nil, status: {}, classes: [], html_attributes: {}) do
GovukComponent::TaskListComponent::ItemComponent.new(
title:,
href:,
hint:,
id_prefix: @id_prefix,
... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/section_break_component.rb | Ruby | mit | 188 | main | 919 | class GovukComponent::SectionBreakComponent < GovukComponent::Base
SIZES = %w(m l xl).freeze
def initialize(
visible: config.default_section_break_visible,
size: config.default_section_break_size,
classes: [],
html_attributes: {}
)
@visible = visible
@size = size
super(classes:, h... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/notification_banner_component.rb | Ruby | mit | 188 | main | 2,480 | class GovukComponent::NotificationBannerComponent < GovukComponent::Base
attr_reader :title_text, :title_id, :text, :success, :title_heading_level, :disable_auto_focus, :role
renders_one :title_html
renders_many :headings, "Heading"
def initialize(
title_text: nil,
text: nil,
role: nil,
succes... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/back_link_component.rb | Ruby | mit | 188 | main | 650 | class GovukComponent::BackLinkComponent < GovukComponent::Base
attr_reader :text, :href, :inverse
def initialize(href:, inverse: false, text: config.default_back_link_text, classes: [], html_attributes: {})
@text = text
@href = href
@inverse = inverse
super(classes:, html_attributes:)
end
def... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/warning_text_component.rb | Ruby | mit | 188 | main | 957 | class GovukComponent::WarningTextComponent < GovukComponent::Base
attr_reader :text, :icon, :icon_fallback_text
def initialize(text: nil, icon_fallback_text: config.default_warning_text_icon_fallback_text, icon: config.default_warning_text_icon, classes: [], html_attributes: {})
@text = text
@icon = icon
... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/tab_component.rb | Ruby | mit | 188 | main | 1,354 | class GovukComponent::TabComponent < GovukComponent::Base
using HTMLAttributesUtils
renders_many :tabs, "Tab"
attr_reader :title, :id
def initialize(title: 'Contents', id: nil, classes: [], html_attributes: {})
@title = title
@id = id
super(classes:, html_attributes:)
end
private
def de... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/summary_list_component.rb | Ruby | mit | 188 | main | 2,107 | module GovukComponent
class SummaryListComponent < GovukComponent::Base
attr_reader :borders, :actions, :card, :visually_hidden_action_suffix
renders_many :rows, ->(classes: [], html_attributes: {}, &block) do
GovukComponent::SummaryListComponent::RowComponent.new(
show_actions_column: @show_ac... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/service_navigation_component.rb | Ruby | mit | 188 | main | 2,773 | class GovukComponent::ServiceNavigationComponent < GovukComponent::Base
renders_one :start_slot
renders_one :end_slot
renders_one :service_name, "GovukComponent::ServiceNavigationComponent::ServiceNameComponent"
renders_many :navigation_items, ->(text:, href: nil, current_path: nil, active_when: nil, current: ... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/tag_component.rb | Ruby | mit | 188 | main | 940 | class GovukComponent::TagComponent < GovukComponent::Base
attr_reader :text, :colour
COLOURS = %w(grey green teal blue light-blue red purple magenta orange yellow).freeze
def initialize(text: nil, colour: config.default_tag_colour, classes: [], html_attributes: {})
@text = text
@colour = colour
s... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/inset_text_component.rb | Ruby | mit | 188 | main | 513 | class GovukComponent::InsetTextComponent < GovukComponent::Base
attr_reader :text, :id
def initialize(text: nil, id: nil, classes: [], html_attributes: {})
@text = text
@id = id
super(classes:, html_attributes:)
end
def call
tag.div(id:, **html_attributes) { inset_text_content }
end
de... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/accordion_component.rb | Ruby | mit | 188 | main | 1,051 | class GovukComponent::AccordionComponent < GovukComponent::Base
renders_many :sections, ->(heading_text: nil, summary_text: nil, expanded: false, classes: [], html_attributes: {}, &block) do
GovukComponent::AccordionComponent::SectionComponent.new(
classes:,
expanded:,
heading_level:, # set once... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/breadcrumbs_component.rb | Ruby | mit | 188 | main | 1,602 | class GovukComponent::BreadcrumbsComponent < GovukComponent::Base
attr_reader :breadcrumbs, :hide_in_print, :collapse_on_mobile, :inverse
def initialize(breadcrumbs:,
hide_in_print: config.default_breadcrumbs_hide_in_print,
collapse_on_mobile: config.default_breadcrumbs_collapse_o... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/panel_component.rb | Ruby | mit | 188 | main | 1,097 | class GovukComponent::PanelComponent < GovukComponent::Base
attr_reader :id, :title_text, :text, :heading_level
renders_one :title_html
def initialize(title_text: nil, text: nil, heading_level: 1, id: nil, classes: [], html_attributes: {})
@heading_level = heading_level
@title_text = title_text
@... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/exit_this_page_component.rb | Ruby | mit | 188 | main | 1,940 | class GovukComponent::ExitThisPageComponent < GovukComponent::Base
include GovukLinkHelper
include GovukVisuallyHiddenHelper
attr_reader :text, :redirect_url, :activated_text, :timed_out_text, :press_two_more_times_text, :press_one_more_time_text
def initialize(
redirect_url: nil,
href: nil,
text:... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/pagination_component.rb | Ruby | mit | 188 | main | 3,469 | class GovukComponent::PaginationComponent < GovukComponent::Base
include Pagy::UrlHelpers
attr_reader :pagy,
:next_text,
:previous_text,
:page_items,
:previous_content,
:next_content,
:block_mode,
:landmark_label
a... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/pagination_component/previous_page.rb | Ruby | mit | 188 | main | 748 | class GovukComponent::PaginationComponent::PreviousPage < GovukComponent::PaginationComponent::AdjacentPage
def initialize(href:, text:, label_text: nil, block_mode: true, classes: [], html_attributes: {})
super(
suffix: "prev",
text:,
href:,
label_text:,
block_mode:,
classes:,... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/pagination_component/item.rb | Ruby | mit | 188 | main | 1,979 | class GovukComponent::PaginationComponent::Item < GovukComponent::Base
attr_reader :number, :href, :visually_hidden_text, :mode
def initialize(number: nil, href: nil, current: false, ellipsis: false, from_pagy: false, visually_hidden_text: nil, classes: [], html_attributes: {})
@number = number
... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/pagination_component/adjacent_page.rb | Ruby | mit | 188 | main | 1,393 | class GovukComponent::PaginationComponent::AdjacentPage < GovukComponent::Base
attr_reader :href, :label_text, :text, :suffix, :block_mode, :visually_hidden_text
alias_method :block_mode?, :block_mode
def initialize(href:, suffix:, text:, block_mode: true, label_text: nil, classes: [], html_attributes: {})
@... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/pagination_component/next_page.rb | Ruby | mit | 188 | main | 834 | class GovukComponent::PaginationComponent::NextPage < GovukComponent::PaginationComponent::AdjacentPage
def initialize(href:, text:, label_text: nil, block_mode: true, classes: [], html_attributes: {})
super(
suffix: "next",
text:,
href:,
label_text:,
block_mode:,
classes:,
... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/summary_list_component/value_component.rb | Ruby | mit | 188 | main | 470 | class GovukComponent::SummaryListComponent::ValueComponent < GovukComponent::Base
attr_reader :text
def initialize(text: nil, classes: [], html_attributes: {})
super(classes:, html_attributes:)
@text = text
end
def call
tag.dd(value_content, **html_attributes)
end
private
def default_attrib... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/summary_list_component/key_component.rb | Ruby | mit | 188 | main | 465 | class GovukComponent::SummaryListComponent::KeyComponent < GovukComponent::Base
attr_reader :text
def initialize(text: nil, classes: [], html_attributes: {})
@text = text
super(classes:, html_attributes:)
end
def call
tag.dt(key_content, **html_attributes)
end
private
def default_attributes... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/summary_list_component/action_component.rb | Ruby | mit | 188 | main | 1,472 | class GovukComponent::SummaryListComponent::ActionComponent < GovukComponent::Base
include GovukLinkHelper
include GovukVisuallyHiddenHelper
attr_reader :href, :text, :visually_hidden_text, :visually_hidden_action_suffix, :attributes, :classes
def initialize(href: nil, text: 'Change', visually_hidden_text: fa... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/summary_list_component/row_component.rb | Ruby | mit | 188 | main | 1,880 | class GovukComponent::SummaryListComponent::RowComponent < GovukComponent::Base
attr_reader :href, :visually_hidden_text, :show_actions_column, :visually_hidden_action_suffix
renders_one :key, GovukComponent::SummaryListComponent::KeyComponent
renders_one :value, GovukComponent::SummaryListComponent::ValueCompon... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/summary_list_component/card_component.rb | Ruby | mit | 188 | main | 804 | class GovukComponent::SummaryListComponent::CardComponent < GovukComponent::Base
attr_reader :title, :heading_level
renders_many :actions
renders_one :summary_list, "GovukComponent::SummaryListComponent"
def initialize(title:, heading_level: 2, actions: [], classes: [], html_attributes: {})
@title = title... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/cookie_banner_component/message_component.rb | Ruby | mit | 188 | main | 1,536 | class GovukComponent::CookieBannerComponent::MessageComponent < GovukComponent::Base
attr_reader :heading_text, :text, :hidden, :role
renders_many :actions
renders_one :heading_html
def initialize(heading_text: nil, text: nil, hidden: false, role: nil, classes: [], html_attributes: {})
@heading_text = hea... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/accordion_component/section_component.rb | Ruby | mit | 188 | main | 1,277 | class GovukComponent::AccordionComponent::SectionComponent < GovukComponent::Base
attr_reader :heading_text, :summary_text, :expanded, :heading_level, :accordion_id
renders_one :heading_html
renders_one :summary_html
alias_method :expanded?, :expanded
def initialize(heading_text:, summary_text:, expanded:,... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/task_list_component/status_component.rb | Ruby | mit | 188 | main | 919 | module GovukComponent
class TaskListComponent::StatusComponent < GovukComponent::Base
attr_reader :id_prefix, :text, :cannot_start_yet, :count
def initialize(text: nil, id_prefix: nil, count: nil, cannot_start_yet: false, classes: [], html_attributes: {})
@text = text
@count ... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/task_list_component/item_component.rb | Ruby | mit | 188 | main | 2,305 | module GovukComponent
class TaskListComponent::ItemComponent < GovukComponent::Base
renders_one :status, ->(text: nil, cannot_start_yet: false, classes: [], html_attributes: {}, &block) do
GovukComponent::TaskListComponent::StatusComponent.new(
id_prefix: @id_prefix,
count: @count,
t... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/task_list_component/title_component.rb | Ruby | mit | 188 | main | 1,364 | module GovukComponent
class TaskListComponent::TitleComponent < GovukComponent::Base
include GovukLinkHelper
include GovukVisuallyHiddenHelper
using HTMLAttributesUtils
attr_reader :id_prefix, :text, :href, :hint, :count
def initialize(text: nil, href: nil, hint: nil, id_prefix: nil, count: nil... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/table_component/foot_component.rb | Ruby | mit | 188 | main | 995 | class GovukComponent::TableComponent::FootComponent < GovukComponent::Base
renders_many :rows, ->(cell_data: nil, first_cell_is_header: false, classes: [], html_attributes: {}, &block) do
GovukComponent::TableComponent::RowComponent.from_foot(
cell_data:,
first_cell_is_header:,
classes:,
h... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/table_component/col_group_component.rb | Ruby | mit | 188 | main | 778 | class GovukComponent::TableComponent::ColGroupComponent < GovukComponent::Base
renders_many :cols, "ColComponent"
def initialize(classes: [], cols: [], html_attributes: {})
super(classes:, html_attributes:)
return if cols.blank?
cols.each { |c| with_col(span: c) }
end
def call
tag.colgroup(*... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/table_component/body_component.rb | Ruby | mit | 188 | main | 871 | class GovukComponent::TableComponent::BodyComponent < GovukComponent::Base
renders_many :rows, ->(cell_data: nil, first_cell_is_header: false, classes: [], html_attributes: {}, &block) do
GovukComponent::TableComponent::RowComponent.from_body(
cell_data:,
first_cell_is_header:,
classes:,
h... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/table_component/cell_component.rb | Ruby | mit | 188 | main | 2,376 | class GovukComponent::TableComponent::CellComponent < GovukComponent::Base
attr_reader :text, :header, :numeric, :width, :scope, :parent, :colspan, :rowspan
alias_method :numeric?, :numeric
alias_method :header?, :header
def initialize(scope: nil, header: nil, numeric: false, text: nil, width: nil, parent: ni... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/table_component/caption_component.rb | Ruby | mit | 188 | main | 798 | class GovukComponent::TableComponent::CaptionComponent < GovukComponent::Base
attr_reader :text, :size
SIZES = %w(s m l xl).freeze
def initialize(text: nil, id: nil, size: 'm', classes: [], html_attributes: {})
@id = id
@text = text
@size = size
super(classes:, html_attributes:)
end
def ... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/table_component/row_component.rb | Ruby | mit | 188 | main | 1,809 | class GovukComponent::TableComponent::RowComponent < GovukComponent::Base
renders_many :cells, ->(scope: nil, header: nil, text: nil, numeric: false, width: nil, rowspan: nil, colspan: nil, classes: [], html_attributes: {}, &block) do
GovukComponent::TableComponent::CellComponent.new(
scope:,
header:,... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/table_component/head_component.rb | Ruby | mit | 188 | main | 742 | class GovukComponent::TableComponent::HeadComponent < GovukComponent::Base
renders_many :rows, ->(cell_data: nil, classes: [], html_attributes: {}, &block) do
GovukComponent::TableComponent::RowComponent.from_head(
cell_data:,
classes:,
html_attributes:,
&block
)
end
attr_reader :... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/service_navigation_component/navigation_item_component.rb | Ruby | mit | 188 | main | 1,850 | class GovukComponent::ServiceNavigationComponent::NavigationItemComponent < GovukComponent::Base
attr_reader :text, :href, :current_path, :active_when, :current, :active
def initialize(text:, href: nil, current_path: nil, active_when: nil, current: false, active: false, classes: [], html_attributes: {})
@curre... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/components/govuk_component/service_navigation_component/service_name_component.rb | Ruby | mit | 188 | main | 753 | class GovukComponent::ServiceNavigationComponent::ServiceNameComponent < GovukComponent::Base
attr_reader :service_name, :service_url
def initialize(service_name:, service_url: nil, classes: [], html_attributes: {})
@service_name = service_name
@service_url = service_url
super(classes:, html_attribute... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/helpers/govuk_link_helper.rb | Ruby | mit | 188 | main | 7,590 | require "html_attributes_utils"
module GovukLinkHelper
using HTMLAttributesUtils
def govuk_link_to(a, b = nil, new_tab: false, inverse: false, muted: false, no_underline: false, no_visited_state: false, text_colour: false, visually_hidden_prefix: nil, visually_hidden_suffix: nil, **kwargs, &block)
(block_give... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/helpers/govuk_rails_compatible_link_helper.rb | Ruby | mit | 188 | main | 4,721 | require "html_attributes_utils"
module GovukRailsCompatibleLinkHelper
using HTMLAttributesUtils
def govuk_link_classes(*styles, default_class: "#{brand}-link")
if (invalid_styles = (styles - link_styles.keys)) && invalid_styles.any?
fail(ArgumentError, "invalid styles #{invalid_styles.to_sentence}. Vali... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/helpers/govuk_skip_link_helper.rb | Ruby | mit | 188 | main | 589 | module GovukSkipLinkHelper
def govuk_skip_link(text: 'Skip to main content', href: '#main-content', classes: [], **html_attributes, &block)
link_classes = Array.wrap(classes).append("#{brand}-skip-link")
html_attributes_with_data_module = { data: { module: "#{brand}-skip-link" } }.deep_merge(html_attributes)... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/helpers/govuk_exit_this_page_link_helper.rb | Ruby | mit | 188 | main | 712 | module GovukExitThisPageLinkHelper
def govuk_exit_this_page_link(
text: Govuk::Components.config.default_exit_this_page_text,
href: Govuk::Components.config.default_exit_this_page_redirect_url,
classes: [],
**html_attributes,
&block
)
link_classes = Array.wrap(classes).append(["#{brand}-skip... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/helpers/govuk_visually_hidden_helper.rb | Ruby | mit | 188 | main | 325 | module GovukVisuallyHiddenHelper
def govuk_visually_hidden(text = nil, &block)
return if text.blank? && block.nil?
tag.span(text, class: "#{brand}-visually-hidden", &block)
end
private
def brand
Govuk::Components.brand
end
end
ActiveSupport.on_load(:action_view) { include GovukVisuallyHiddenHelp... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/helpers/govuk_list_helper.rb | Ruby | mit | 188 | main | 880 | module GovukListHelper
def govuk_list(array = nil, type: nil, spaced: nil, classes: nil, html_attributes: {}, &block)
type = type.to_s
fail "Unrecognised type for govuk_list - should be :bullet or :number or nil" unless type.in?(["bullet", "number", ""])
tag_type = (type == "number") ? "ol" : "ul"
... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/helpers/govuk_components_helper.rb | Ruby | mit | 188 | main | 1,757 | module GovukComponentsHelper
{
govuk_accordion: 'GovukComponent::AccordionComponent',
govuk_back_link: 'GovukComponent::BackLinkComponent',
govuk_breadcrumbs: 'GovukComponent::BreadcrumbsComponent',
govuk_cookie_banner: 'GovukComponent::CookieBannerComponent',
govuk_details: 'GovukComponent::Detai... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/helpers/govuk_back_to_top_link_helper.rb | Ruby | mit | 188 | main | 590 | module GovukBackToTopLinkHelper
def govuk_back_to_top_link(target = '#top')
link_to(target, class: "#{brand}-link #{brand}-link--no-visited-state") do
<<-HTML.squish.html_safe
<svg class="app-back-to-top__icon" xmlns="http://www.w3.org/2000/svg" width="13" height="17" viewBox="0 0 13 17">
<pat... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | app/helpers/title_with_error_prefix_helper.rb | Ruby | mit | 188 | main | 265 | module TitleWithErrorPrefixHelper
def title_with_error_prefix(title, error:, error_prefix: Govuk::Components.config.default_error_prefix)
"#{error_prefix if error}#{title}"
end
end
ActiveSupport.on_load(:action_view) { include TitleWithErrorPrefixHelper } |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | guide/lib/slim_config.rb | Ruby | mit | 188 | main | 241 | require 'govuk_markdown'
require 'slim'
# Use GOV.UK Markdown for embedded markdown
Slim::Embedded.options[:markdown] = {
fenced_code_blocks: true,
no_intra_emphasis: true,
renderer: GovukMarkdown::Renderer.new({}),
tables: true,
} |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | guide/lib/helpers.rb | Ruby | mit | 188 | main | 5,934 | require 'rails'
require 'action_view'
ActionView::Helpers::UrlHelper.button_to_generates_button_tag = true
module FakeRails
class Application < Rails::Application; end
end
require 'pry'
require 'action_controller'
require 'htmlbeautifier'
require 'slim/erb_converter'
require 'active_support/core_ext/hash/deep_merge... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | guide/lib/suppress_listen_symlink_errors.rb | Ruby | mit | 188 | main | 599 | require 'listen/record/symlink_detector'
# Taken from https://github.com/guard/listen/wiki/Duplicate-directory-errors
#
# Because we need to use a symlink to allow our Ruby Sass-c compilation to
# use sources from node_modules, Listen throws warnings and errors that
# the node_modules directory's already being watched... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | guide/lib/helpers/link_helpers.rb | Ruby | mit | 188 | main | 3,126 | module Helpers
module TitleAnchorHelpers
def anchor_id(caption)
caption.parameterize
end
end
module LinkHelpers
def navigation_links
{
"Introduction" => {
"Get started" => "/introduction/get-started/",
"About ViewComponent" => "/introduction/about-viewcomponent... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | guide/lib/helpers/service_navigation_helpers.rb | Ruby | mit | 188 | main | 263 | module Helpers
module ServiceNavigationHelpers
def service_navigation_classes(item)
if item.path == '/'
%w[govuk-service-navigation govuk-service-navigation--inverse]
else
%w[govuk-service-navigation]
end
end
end
end |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | guide/lib/helpers/content_helpers.rb | Ruby | mit | 188 | main | 4,709 | module Helpers
module ContentHelpers
def component_helper_mapping_table
head = ["Component class name", "Helper method"]
rows = component_helper_mapping.to_a.map { |v| v.map { |c| "<code>#{c}</code>".html_safe } }
GovukComponent::TableComponent.new(
head:,
rows:,
caption... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | guide/lib/helpers/formatters.rb | Ruby | mit | 188 | main | 2,501 | require 'action_view'
module Helpers
# This class exists purely to pass to render in format_slim, it doesn't appear
# to matter what's passed in so long as the first arg responds to #variants
# and the result responds to #first. Couldn't work out from Rails what the
# correct objects to pass in here are, it's ... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | guide/lib/filters/dart_sass.rb | Ruby | mit | 188 | main | 711 | require 'open3'
Nanoc::Filter.define(:dart_sass) do |_content, params|
cmd = [%(node node_modules/sass/sass.js)].tap do |c|
# Input file
c << item.raw_filename
# Load paths
if (paths = params[:load_paths])
paths.each do |path|
c << %(--load-path=#{path})
end
end
# Option... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | guide/lib/filters/govuk_markdown.rb | Ruby | mit | 188 | main | 394 | require 'govuk_markdown'
Nanoc::Filter.define(:govuk_markdown) do |content, params|
renderer = GovukMarkdown::Renderer.new(params)
markdown = Redcarpet::Markdown.new(renderer,
fenced_code_blocks: true,
no_intra_emphasis: true,
... |
github | x-govuk/govuk-components | https://github.com/x-govuk/govuk-components | guide/lib/examples/header_helpers.rb | Ruby | mit | 188 | main | 1,768 | module Examples
module HeaderHelpers
def header_normal
<<~HEADER
= govuk_header
HEADER
end
def header_with_custom_logo
<<~HEADER
= govuk_header do |header|
- header.with_custom_logo
svg focusable="false" role="img" class="app-header__logotype" xmlns... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.