Module: Promethee::Rails::Helper

Defined in:
lib/promethee/rails/helper.rb

Instance Method Summary collapse

Instance Method Details

#promethee(data, options = {}) ⇒ Object



2
3
4
# File 'lib/promethee/rails/helper.rb', line 2

def promethee(data, options = {})
  ApplicationController.renderer.render partial: 'promethee/show', locals: { master_data: data, localization_data: options[:l] }
end

#promethee_bem_classes(*args) ⇒ Object

promethee_bem_classes ‘promethee-edit__move__droppable’, ‘–{type}’, ‘–first’ -> promethee-edit__move__droppable promethee-edit__move__droppable–{type} promethee-edit__move__droppable–{type}–first“



35
36
37
38
39
40
41
42
43
# File 'lib/promethee/rails/helper.rb', line 35

def promethee_bem_classes(*args)
  classes = ''
  current_class = ''
  args.each do |arg|
    current_class << arg
    classes << "#{current_class} "
  end
  classes
end

#promethee_class_for(component, *modifiers) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/promethee/rails/helper.rb', line 6

def promethee_class_for component, *modifiers
  base = "promethee__component"
  component_base = "#{base}__#{component[:type]}"

  [
    base,
    component_base,
    modifiers.map { |modifier| "#{component_base}--#{modifier}" }
  ].flatten.select(&:present?).join ' '
end

#promethee_component_partialsObject



17
18
19
# File 'lib/promethee/rails/helper.rb', line 17

def promethee_component_partials
  promethee_partials_for 'components/*/_edit.*.html.erb'
end

#promethee_preset_partialsObject



29
30
31
# File 'lib/promethee/rails/helper.rb', line 29

def promethee_preset_partials
  promethee_partials_for 'presets/_*.html.erb'
end

#promethee_template_partialsObject



25
26
27
# File 'lib/promethee/rails/helper.rb', line 25

def promethee_template_partials
  promethee_partials_for 'templates/_*.html.erb'
end

#promethee_util_partialsObject



21
22
23
# File 'lib/promethee/rails/helper.rb', line 21

def promethee_util_partials
  promethee_partials_for 'utils/_*.html.erb'
end