- #
- A
- B
- C
- D
- E
- F
- H
- I
- M
- N
- O
- P
- R
- S
- T
- U
- V
- W
Constants
| STATUSES | = | active_statuses + inactive_statuses |
Class Public methods
active_statuses() Link
Source: show
# File app/models/db/site.rb, line 15 def self.active_statuses %w[agency_mode free unknown] + DB::Subscription.active_statuses end
cms_values() Link
Source: show
# File app/models/db/site.rb, line 11 def self.cms_values Admin::IntegrationProviderManager.cms_values.map(&:to_s) end
inactive_statuses() Link
Source: show
# File app/models/db/site.rb, line 19 def self.inactive_statuses %w[expired] + DB::Subscription.inactive_statuses end
memberspace() Link
Source: show
# File app/models/db/site.rb, line 276 def self.memberspace find_by(subdomain: memberspace_subdomain) end
memberspace_subdomain() Link
Source: show
# File app/models/db/site.rb, line 272 def self.memberspace_subdomain "admin" end
reserved_subdomains() Link
Source: show
# File app/models/db/site.rb, line 280 def self.reserved_subdomains %w[ www ftp mail pop smtp ssl sftp api my app scripts cdn widgets mymemberspace memberspace current custom plugins assets widget ] end
Instance Public methods
<<(admin) Link
Source: show
# File app/models/db/site.rb, line 105 def <<(admin) super(admin.becomes(SiteAdmin)) end
active?() Link
Source: show
# File app/models/db/site.rb, line 521 def active? !archived? && self.class.active_statuses.include?(status) end
after_logout_url() Link
Source: show
# File app/models/db/site.rb, line 227 def after_logout_url Util::Url.fully_qualified_url(settings.after_logout_url, self) end
agency_mode!() Link
Source: show
# File app/models/db/site.rb, line 342 def agency_mode! update!(built_by_agency: true, billing_enabled: false) end
agency_mode?() Link
Source: show
# File app/models/db/site.rb, line 351 def agency_mode? built_by_agency? && !billing_enabled? end
agency_mode_off!() Link
Source: show
# File app/models/db/site.rb, line 346 def agency_mode_off! update!(built_by_agency: false, billing_enabled: true) sync_owner_subscription_status end
all_onboarding_steps_completed?() Link
Source: show
# File app/models/db/site.rb, line 387 def all_onboarding_steps_completed? created_plan? && installed_code? end
archived!() Link
Source: show
# File app/models/db/site.rb, line 565 def archived! update_columns(archived: true, website: website_with_archive) end
billing_disabled!() Link
Source: show
# File app/models/db/site.rb, line 549 def billing_disabled! update!(billing_enabled: false) end
billing_disabled?() Link
Source: show
# File app/models/db/site.rb, line 553 def billing_disabled? !billing_enabled? end
billing_enabled!() Link
Source: show
# File app/models/db/site.rb, line 535 def billing_enabled! update!(billing_enabled: true) end
billing_enabled_with_new_owner!(new_owner) Link
Source: show
# File app/models/db/site.rb, line 539 def billing_enabled_with_new_owner!(new_owner) update!( owner: new_owner, billing_enabled: true, ownership_transferred_at: Time.current ) add_creator_to_administrators! end
billing_invite_recipient?(site_owner) Link
Source: show
# File app/models/db/site.rb, line 561 def billing_invite_recipient?(site_owner) billing_invite.present? && billing_invite.is_recipient?(site_owner) end
block_reserved_subdomains() Link
Source: show
# File app/models/db/site.rb, line 411 def block_reserved_subdomains if self.class.reserved_subdomains.include?(subdomain) errors.add(:subdomain, "Subdomain is not allowed") end end
cms=(value) Link
Source: show
# File app/models/db/site.rb, line 295 def cms=(value) super(value.to_s) end
cms_title() Link
Source: show
# File app/models/db/site.rb, line 318 def cms_title if cms == "html" "Custom HTML Website" else cms.titleize end end
created_plan!() Link
Source: show
# File app/models/db/site.rb, line 359 def created_plan! track_onboarded(:created_plan) end
created_plan?() Link
Source: show
# File app/models/db/site.rb, line 391 def created_plan? onboarding_step_complete?(:created_plan) end
custom_domain_host() Link
Source: show
# File app/models/db/site.rb, line 484 def custom_domain_host custom_domain&.ssl_setup? ? custom_domain.host : false end
default_from_address?() Link
Source: show
# File app/models/db/site.rb, line 326 def default_from_address? email_settings.from_address == DB::SiteSettings.default_from_address end
email_settings() Link
Source: show
# File app/models/db/site.rb, line 434 def email_settings super || build_email_settings end
email_white_label() Link
Source: show
# File app/models/db/site.rb, line 439 def email_white_label @email_white_label ||= Admin::EmailWhiteLabel.find(site: self) end
features_and_limits() Link
Source: show
# File app/models/db/site.rb, line 573 def features_and_limits { broadcast_emails_per_month: owner_broadcast_emails_per_month_limit, can_create_free_plans:, can_create_organization:, can_invite_site_admins:, can_remove_branding:, can_send_broadcasts:, can_setup_integrations: } end
has_member_with_email?(email) Link
Source: show
# File app/models/db/site.rb, line 447 def has_member_with_email?(email) members.where(email:).exists? end
has_payment_gateway?() Link
Source: show
# File app/models/db/site.rb, line 314 def has_payment_gateway? has_stripe_config? && payment_gateway_id.present? end
has_transaction_fee?() Link
Source: show
# File app/models/db/site.rb, line 475 def has_transaction_fee? transaction_fee_percent > 0 end
host() Link
Source: show
# File app/models/db/site.rb, line 463 def host custom_domain_host || platform_host end
installed_code!() Link
Source: show
# File app/models/db/site.rb, line 363 def installed_code! track_onboarded(:installed_code) end
installed_code?() Link
Source: show
# File app/models/db/site.rb, line 395 def installed_code? onboarding_step_complete?(:installed_code) end
member?(member) Link
Source: show
# File app/models/db/site.rb, line 443 def member?(member) member&.site_id == id end
members_require_approval?() Link
Source: show
# File app/models/db/site.rb, line 417 def members_require_approval? settings.require_approval? end
memberspace?() Link
Source: show
# File app/models/db/site.rb, line 330 def memberspace? subdomain == self.class.memberspace_subdomain end
onboarded!(value: true) Link
Source: show
# File app/models/db/site.rb, line 367 def onboarded!(value: true) update(welcome: welcome.merge(complete: value)) end
onboarded?() Link
Source: show
# File app/models/db/site.rb, line 399 def onboarded? onboarding_step_complete?(:complete) end
onboarding_step_complete?(step) Link
Source: show
# File app/models/db/site.rb, line 383 def onboarding_step_complete?(step) !!welcome.with_indifferent_access[step] end
owner=(owner) Link
Source: show
# File app/models/db/site.rb, line 291 def owner=(owner) super(owner&.becomes(SiteOwner)) end
payment_gateway_connected?() Link
Source: show
# File app/models/db/site.rb, line 310 def payment_gateway_connected? has_payment_gateway? && stripe_access_token.present? end
platform_host() Link
Source: show
# File app/models/db/site.rb, line 467 def platform_host [subdomain, Rails.application.config.host].join(".") end
platform_host_with_scheme() Link
Source: show
# File app/models/db/site.rb, line 455 def platform_host_with_scheme construct_uri(platform_host).to_s end
remote_account_id() Link
Source: show
# File app/models/db/site.rb, line 299 def remote_account_id return unless has_stripe_config? stripe["stripe_user_id"] end
requires_postal_code() Link
Source: show
# File app/models/db/site.rb, line 231 def requires_postal_code unless Flipper.enabled?(:automatic_payment_methods) settings.requires_postal_code end end
requires_postal_code=(value) Link
Source: show
# File app/models/db/site.rb, line 237 def requires_postal_code=(value) unless Flipper.enabled?(:automatic_payment_methods) settings.requires_postal_code = value end end
restore!() Link
Source: show
# File app/models/db/site.rb, line 569 def restore! update_columns(archived: false, website: website_without_archive) end
settings() Link
Source: show
# File app/models/db/site.rb, line 426 def settings super || build_settings end
settings_custom_style() Link
Source: show
# File app/models/db/site.rb, line 500 def settings_custom_style settings.custom_style end
settings_notify_when!(notification_event, set_to_value = true) Link
Source: show
# File app/models/db/site.rb, line 508 def settings_notify_when!(notification_event, set_to_value = true) settings.notify_when!(notification_event, set_to_value) end
settings_notify_when?(notification_event) Link
Source: show
# File app/models/db/site.rb, line 504 def settings_notify_when?(notification_event) settings.notify_when?(notification_event) end
should_connect_billing?() Link
Source: show
# File app/models/db/site.rb, line 557 def should_connect_billing? persisted? && !memberspace? && billing_disabled? end
sso_integration?() Link
Source: show
# File app/models/db/site.rb, line 421 def sso_integration? # Circle is our only SSO integration currently integrations.circle.present? end
stripe_access_token() Link
Source: show
# File app/models/db/site.rb, line 305 def stripe_access_token return unless has_stripe_config? stripe["access_token"] end
stripe_account_params() Link
Source: show
# File app/models/db/site.rb, line 471 def stripe_account_params {stripe_account: payment_gateway_id} end
sync_owner_subscription_status() Link
Source: show
# File app/models/db/site.rb, line 517 def sync_owner_subscription_status SiteStatusSyncJob.perform_now(member_id:) end
to_liquid() Link
Source: show
# File app/models/db/site.rb, line 488 def to_liquid EmailDrops::SiteDrop.new(self) end
track_features(*features) Link
Source: show
# File app/models/db/site.rb, line 512 def track_features(*features) tracking = features.map { |f| [f, Time.current] }.to_h update(tracked_features: tracked_features.deep_merge(tracking)) end
track_onboarded(step, value: true, force: false) Link
Source: show
# File app/models/db/site.rb, line 371 def track_onboarded(step, value: true, force: false) return if !force && onboarding_step_complete?(step) welcome[step] = value if all_onboarding_steps_completed? onboarded!(value: value) else save end end
tracker() Link
Source: show
# File app/models/db/site.rb, line 430 def tracker super || build_tracker end
transaction_fee_percent() Link
Source: show
# File app/models/db/site.rb, line 479 def transaction_fee_percent return 0 unless owner.present? && active_plan.present? active_plan.transaction_fee_percent end
transfer_billing(new_owner:) Link
Source: show
# File app/models/db/site.rb, line 529 def transfer_billing(new_owner:) validate_transfer!(new_owner) && transfer_billing!(new_owner) rescue ActiveRecord::RecordInvalid false end
transferred_to_client?() Link
Source: show
# File app/models/db/site.rb, line 355 def transferred_to_client? built_by_agency? && ownership_transferred_at? && billing_enabled? end
use_design_custom_styles?() Link
Source: show
# File app/models/db/site.rb, line 492 def use_design_custom_styles? design_theme_custom_styles.present? end
use_settings_custom_style?() Link
Source: show
# File app/models/db/site.rb, line 496 def use_settings_custom_style? settings_custom_style.present? end
valid_origins() Link
Source: show
# File app/models/db/site.rb, line 525 def valid_origins @valid_origins ||= base_valid_origins_alternated end
widget_url(path_or_pathname, *args, query: {}) Link
Source: show
# File app/models/db/site.rb, line 459 def widget_url(path_or_pathname, *args, query: {}) WidgetUrl.for(path_or_pathname, *args, query:, site: self) end
widget_v1?() Link
Source: show
# File app/models/db/site.rb, line 338 def widget_v1? widget_version == 1 end