Module: KafkaCommand::ApplicationHelper

Defined in:
app/helpers/kafka_command/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#consumer_groups_path(group) ⇒ Object



20
21
22
# File 'app/helpers/kafka_command/application_helper.rb', line 20

def consumer_groups_path(group)
  "#{cluster_path(@cluster)}/consumer_groups/#{CGI.escape(group.group_id)}"
end

#format_flash_errorsObject



5
6
7
8
9
10
11
12
13
14
# File 'app/helpers/kafka_command/application_helper.rb', line 5

def format_flash_errors
  return '' if flash[:error].blank?
  return flash[:error] if flash[:error].is_a?(String)

  '<ul>'.tap do |str|
    flash[:error].each do |k, v|
      str << "<li><span class='has-text-weight-bold'>#{k.humanize}:</span> #{v.join('. ')}</li>"
    end
  end.html_safe
end

#topic_path(topic) ⇒ Object



16
17
18
# File 'app/helpers/kafka_command/application_helper.rb', line 16

def topic_path(topic)
  "#{cluster_path(@cluster)}/topics/#{CGI.escape(topic.name)}"
end

#trim_name(name) ⇒ Object



24
25
26
27
# File 'app/helpers/kafka_command/application_helper.rb', line 24

def trim_name(name)
  return name if name.length < 25
  name[0..22] + '...'
end