Module: RailsDb::ApplicationHelper

Includes:
FontAwesome::Rails::IconHelper
Defined in:
app/helpers/rails_db/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#main_content_classesObject



17
18
19
20
21
22
23
# File 'app/helpers/rails_db/application_helper.rb', line 17

def main_content_classes
  if show_sidebar?
    'large-9 push-3 columns collapsed'
  else
    'large-12 push-0 columns expanded'
  end
end

#paginate_table_entries(entries) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'app/helpers/rails_db/application_helper.rb', line 36

def paginate_table_entries(entries)
  params.delete(:id)
  return if entries.total_pages == 1
  prev_page_text = "#{fa_icon('arrow-left')} Previous".html_safe
  next_page_text = "Next #{fa_icon('arrow-right')}".html_safe

  html = '<div class="pagination">'
  if entries.previous_page
    html << link_to(prev_page_text, params.merge({ action: :data, page: entries.previous_page }), { remote: true, class: 'page' })
  end
  html << "#{page_links_for_pagination(entries)}"
  if entries.next_page
    html << link_to(next_page_text, params.merge({ action: :data, page: entries.next_page }), { remote: true, class: 'page' })
  end
  html << '</div>'

  sanitize(html)
end

#rails_db_tablesObject



5
6
7
# File 'app/helpers/rails_db/application_helper.rb', line 5

def rails_db_tables
  RailsDb::Database.accessible_tables
end

#show_sidebar?Boolean

Returns:

  • (Boolean)


25
26
27
28
# File 'app/helpers/rails_db/application_helper.rb', line 25

def show_sidebar?
  return true if controller_name == 'dashboard' && action_name == 'index'
  cookies['sidebar_visible'] == 'true'
end


9
10
11
12
13
14
15
# File 'app/helpers/rails_db/application_helper.rb', line 9

def sidebar_classes
  if show_sidebar?
    'large-3 pull-9 columns'
  else
    'large-3 pull-9 columns hide'
  end
end

#title(str) ⇒ Object



30
31
32
33
34
# File 'app/helpers/rails_db/application_helper.rb', line 30

def title(str)
  content_for :title do
    raw("#{str}"[0].upcase + "#{str}"[1..-1])
  end
end