Module: SolidWebUi::Cable::ApplicationHelper

Defined in:
app/helpers/solid_web_ui/cable/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#cable_nav(active) ⇒ Object



5
6
7
8
9
10
# File 'app/helpers/solid_web_ui/cable/application_helper.rb', line 5

def cable_nav(active)
  [
    { label: "Dashboard", href: root_path, active: active == :dashboard },
    { label: "Channels", href: channels_path, active: active == :channels }
  ]
end

#readable_channel(channel) ⇒ Object



12
13
14
# File 'app/helpers/solid_web_ui/cable/application_helper.rb', line 12

def readable_channel(channel)
  truncate(channel.to_s.dup.force_encoding("UTF-8").scrub("?"), length: 80)
end

#short_time(time) ⇒ Object



16
17
18
19
20
# File 'app/helpers/solid_web_ui/cable/application_helper.rb', line 16

def short_time(time)
  return "" if time.nil?

  time.in_time_zone(SolidWebUi::Cable.config.time_zone).strftime("%Y-%m-%d %H:%M:%S")
end