Module: ActiveScaffold::Bridges

Defined in:
lib/active_scaffold/bridges.rb,
lib/active_scaffold/bridges/date_picker.rb,
lib/active_scaffold/bridges/bitfields/list_ui.rb,
lib/active_scaffold/bridges/date_picker/helper.rb,
lib/active_scaffold/bridges/paper_trail/helper.rb,
lib/active_scaffold/bridges/cancan/cancan_bridge.rb,
lib/active_scaffold/bridges/ancestry/ancestry_bridge.rb,
lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb,
lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb,
lib/active_scaffold/bridges/paperclip/paperclip_bridge.rb,
lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb,
lib/active_scaffold/bridges/paper_trail/paper_trail_bridge.rb,
lib/active_scaffold/bridges/file_column/file_column_helpers.rb,
lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb,
lib/active_scaffold/bridges/dragonfly/dragonfly_bridge_helpers.rb,
lib/active_scaffold/bridges/paperclip/paperclip_bridge_helpers.rb,
lib/active_scaffold/bridges/active_storage/active_storage_bridge.rb,
lib/active_scaffold/bridges/active_storage/active_storage_helpers.rb,
lib/active_scaffold/bridges/carrierwave/carrierwave_bridge_helpers.rb,
lib/active_scaffold/bridges/usa_state_select/usa_state_select_helper.rb,
lib/active_scaffold/bridges/country_select/country_select_bridge_helper.rb

Defined Under Namespace

Classes: ActiveStorage, Ancestry, Bitfields, CalendarDateSelect, Cancan, Carrierwave, Chosen, CountrySelect, DatePicker, Dragonfly, FileColumn, PaperTrail, Paperclip, RecordSelect, SemanticAttributes, TinyMce, UsaStateSelect

Class Method Summary collapse

Class Method Details

.all_javascriptsObject



57
58
59
60
61
62
# File 'lib/active_scaffold/bridges.rb', line 57

def self.all_javascripts
  bridges.keys.collect do |bridge_name|
    bridge = self[bridge_name]
    bridge.javascripts if bridge&.install?
  end.compact.flatten
end

.all_stylesheetsObject



50
51
52
53
54
55
# File 'lib/active_scaffold/bridges.rb', line 50

def self.all_stylesheets
  bridges.keys.collect do |bridge_name|
    bridge = self[bridge_name]
    bridge.stylesheets if bridge&.install?
  end.compact.flatten
end

.load(bridge_name) ⇒ Object Also known as: []



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/active_scaffold/bridges.rb', line 15

def self.load(bridge_name)
  bridge = bridges[bridge_name.to_sym]
  if bridge.is_a? String
    if ActiveScaffold.exclude_bridges.exclude? bridge_name.to_sym
      bridge = bridge.camelize.constantize
      bridges[bridge_name.to_sym] = bridge
    else
      bridges.delete bridge_name
      bridge = nil
    end
  end
  bridge
end

.prepare_allObject



41
42
43
44
45
46
47
48
# File 'lib/active_scaffold/bridges.rb', line 41

def self.prepare_all
  return false if bridges_prepared
  bridges.each_key do |bridge_name|
    bridge = self[bridge_name]
    bridge.prepare if bridge&.install?
  end
  self.bridges_prepared = true
end

.register(file) ⇒ Object



10
11
12
13
# File 'lib/active_scaffold/bridges.rb', line 10

def self.register(file)
  match = file.match(%r{(active_scaffold/bridges/(.*))\.rb\Z})
  bridges[match[2].to_sym] = match[1] if match
end

.run_allObject



32
33
34
35
36
37
38
39
# File 'lib/active_scaffold/bridges.rb', line 32

def self.run_all
  return false if bridges_run
  bridges.each_key do |bridge_name|
    self[bridge_name]&.run
  end
  ActiveScaffold::Config::Core.freeze if ActiveScaffold.threadsafe
  self.bridges_run = true
end