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/shared/date_bridge.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

Modules: Shared 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



60
61
62
63
64
65
# File 'lib/active_scaffold/bridges.rb', line 60

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



53
54
55
56
57
58
# File 'lib/active_scaffold/bridges.rb', line 53

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: []



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/active_scaffold/bridges.rb', line 18

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



44
45
46
47
48
49
50
51
# File 'lib/active_scaffold/bridges.rb', line 44

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



13
14
15
16
# File 'lib/active_scaffold/bridges.rb', line 13

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



35
36
37
38
39
40
41
42
# File 'lib/active_scaffold/bridges.rb', line 35

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