Class: CKEditor5::Rails::Cdn::CKBoxBundle

Inherits:
Assets::AssetsBundle show all
Includes:
UrlGenerator
Defined in:
lib/ckeditor5/rails/cdn/ckbox_bundle.rb

Constant Summary

Constants included from UrlGenerator

UrlGenerator::CDN_COMMERCIAL_GENERATORS, UrlGenerator::CDN_THIRD_PARTY_GENERATORS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from UrlGenerator

#create_cdn_url

Methods inherited from Assets::AssetsBundle

#<<, #empty?, #preloads, #to_json, #translations_scripts

Constructor Details

#initialize(version, theme: :lark, cdn: Engine.default_preset.cdn, translations: []) ⇒ CKBoxBundle

Returns a new instance of CKBoxBundle.



10
11
12
13
14
15
16
17
18
19
# File 'lib/ckeditor5/rails/cdn/ckbox_bundle.rb', line 10

def initialize(version, theme: :lark, cdn: Engine.default_preset.cdn, translations: [])
  super()

  @cdn = cdn
  @version = version
  @theme = theme
  @translations = translations

  validate!
end

Instance Attribute Details

#cdnObject (readonly)

Returns the value of attribute cdn.



8
9
10
# File 'lib/ckeditor5/rails/cdn/ckbox_bundle.rb', line 8

def cdn
  @cdn
end

#themeObject (readonly)

Returns the value of attribute theme.



8
9
10
# File 'lib/ckeditor5/rails/cdn/ckbox_bundle.rb', line 8

def theme
  @theme
end

#translationsObject (readonly)

Returns the value of attribute translations.



8
9
10
# File 'lib/ckeditor5/rails/cdn/ckbox_bundle.rb', line 8

def translations
  @translations
end

#versionObject (readonly)

Returns the value of attribute version.



8
9
10
# File 'lib/ckeditor5/rails/cdn/ckbox_bundle.rb', line 8

def version
  @version
end

Instance Method Details

#scriptsObject



21
22
23
24
25
26
27
28
29
# File 'lib/ckeditor5/rails/cdn/ckbox_bundle.rb', line 21

def scripts
  @scripts ||= [
    Assets::JSUrlImportMeta.new(
      create_cdn_url('ckbox', version, 'ckbox.js'),
      window_name: 'CKBox'
    ),
    *translations_js_url_imports
  ]
end

#stylesheetsObject



31
32
33
34
35
# File 'lib/ckeditor5/rails/cdn/ckbox_bundle.rb', line 31

def stylesheets
  @stylesheets ||= [
    create_cdn_url('ckbox', version, "styles/themes/#{theme}.css")
  ]
end