Sha256: 37d2b065eac51089e9477591d1f95a5fc9449a64716f2f1405831534c605dfb9

Contents?: true

Size: 1.38 KB

Versions: 25

Compression:

Stored size: 1.38 KB

Contents

module Mumuki::Domain::Helpers::Organization
  extend ActiveSupport::Concern
  include Mumukit::Platform::Notifiable

  included do
    delegate *Mumuki::Domain::Organization::Theme.accessors, to: :theme
    delegate *Mumuki::Domain::Organization::Settings.accessors, :private?, :login_settings, to: :settings
    delegate *Mumuki::Domain::Organization::Profile.accessors, :locale_json, to: :profile
  end

  def platform_class_name
    :Organization
  end

  def slug
    Mumukit::Auth::Slug.join_s name
  end

  def central?
    name == 'central'
  end

  def test?
    name == 'test'
  end

  def base?
    name == 'base'
  end

  def switch!
    Mumukit::Platform::Organization.switch! self
  end

  def to_s
    name
  end

  def url_for(path)
    Mumukit::Platform.application.organic_url_for(name, path)
  end

  def url
    url_for '/'
  end

  def domain
    Mumukit::Platform.application.organic_domain(name)
  end

  ## API Exposure

  def to_param
    name
  end

  ## Resource Hash

  module ClassMethods
    def current
      Mumukit::Platform::Organization.current
    end

    def parse(json)
      json
        .slice(:name)
        .merge(theme: Mumuki::Domain::Organization::Theme.parse(json[:theme]))
        .merge(settings: Mumuki::Domain::Organization::Settings.parse(json[:settings]))
        .merge(profile: Mumuki::Domain::Organization::Profile.parse(json[:profile]))
    end
  end
end

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
mumuki-laboratory-7.5.2 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-ad16a5930cec/lib/mumuki/domain/helpers/organization.rb
mumuki-laboratory-7.5.1 vendor/bundle/ruby/2.3.0/bundler/gems/mumuki-domain-a059418e5fd8/lib/mumuki/domain/helpers/organization.rb
mumuki-domain-7.5.1 lib/mumuki/domain/helpers/organization.rb
mumuki-laboratory-7.5.0 vendor/bundle/ruby/2.6.0/bundler/gems/mumuki-domain-acb12583b793/lib/mumuki/domain/helpers/organization.rb
mumuki-domain-7.5.0 lib/mumuki/domain/helpers/organization.rb
mumuki-domain-7.4.1 lib/mumuki/domain/helpers/organization.rb
mumuki-domain-7.4.0 lib/mumuki/domain/helpers/organization.rb
mumuki-domain-7.3.2 lib/mumuki/domain/helpers/organization.rb
mumuki-domain-7.3.1 lib/mumuki/domain/helpers/organization.rb
mumuki-domain-7.2.3 lib/mumuki/domain/helpers/organization.rb
mumuki-domain-7.3.0 lib/mumuki/domain/helpers/organization.rb
mumuki-domain-7.2.2 lib/mumuki/domain/helpers/organization.rb
mumuki-domain-7.2.1 lib/mumuki/domain/helpers/organization.rb
mumuki-domain-7.2.0 lib/mumuki/domain/helpers/organization.rb
mumuki-laboratory-7.1.0 vendor/bundle/ruby/2.3.0/bundler/gems/mumuki-domain-925adf85cca8/lib/mumuki/domain/helpers/organization.rb
mumuki-domain-7.1.0 lib/mumuki/domain/helpers/organization.rb
mumuki-laboratory-7.0.12 vendor/bundle/ruby/2.3.0/bundler/gems/mumuki-domain-74da3d4af98c/lib/mumuki/domain/helpers/organization.rb
mumuki-domain-7.0.6 lib/mumuki/domain/helpers/organization.rb
mumuki-domain-7.0.5 lib/mumuki/domain/helpers/organization.rb
mumuki-domain-7.0.4 lib/mumuki/domain/helpers/organization.rb