Module: RailsAdmin::MainHelper

Defined in:
app/helpers/rails_admin/main_helper.rb

Instance Method Summary collapse

Instance Method Details

#get_column_set(properties) ⇒ Object

Raises:

  • (NotFound)


13
14
15
16
17
18
19
20
21
22
23
# File 'app/helpers/rails_admin/main_helper.rb', line 13

def get_column_set(properties)
  sets = calculate_width(properties)
  current_set ||= params[:set].to_i

  raise NotFound if sets.size <= current_set

  selected_set = sets[current_set][:p]
  style, other = justify_properties(sets, current_set)

  return style, other, selected_set
end

#get_indicator(percent) ⇒ Object



5
6
7
8
9
10
11
# File 'app/helpers/rails_admin/main_helper.rb', line 5

def get_indicator(percent)
  return "" if percent < 0          # none
  return "notice" if percent < 34   # < 1/100 of max
  return "success" if percent < 67  # < 1/10 of max
  return "warning" if percent < 84  # < 1/3 of max
  return "important"                # > 1/3 of max
end