Class: RailsInfo::Logs::ServerPresenter
- Inherits:
-
Presenter
- Object
- Presenter
- RailsInfo::Logs::ServerPresenter
show all
- Defined in:
- app/presenters/rails_info/logs/server_presenter.rb
Instance Method Summary
collapse
Methods inherited from Presenter
#subject=
Constructor Details
#initialize(subject, options = {}) ⇒ ServerPresenter
Returns a new instance of ServerPresenter.
2
3
4
5
6
|
# File 'app/presenters/rails_info/logs/server_presenter.rb', line 2
def initialize(subject, options = {})
super(subject, options)
@rails_info_log = ::RailsInfo::Logs::Server.new(log: params[:log], debug: params[:debug])
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class RailsInfo::Presenter
Instance Method Details
#accordion ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'app/presenters/rails_info/logs/server_presenter.rb', line 8
def accordion
@action_index = 0
content_tag :div, id: 'actions', class: 'accordions' do
html = ''
@rails_info_log.hash.keys.reverse.each do |action|
tabs = @rails_info_log.hash[action]
action_presenter = ::RailsInfo::Logs::Server::ActionPresenter.new(
@subject, name: action, tabs_data: tabs, index: @action_index
)
@action_index += 1
html += raw action_presenter.tabs
end
raw html
end
end
|
#write_body ⇒ Object
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'app/presenters/rails_info/logs/server_presenter.rb', line 49
def write_body
tab_index = 0
html = ''
@rails_info_log.writes.each do |table_name,data|
html += content_tag :div, id: "writes-#{tab_index}" do
raw render partial: 'rails_info/logs/server/table', locals: { sub_content: data }
end
tab_index += 1
end
@rails_info_log = nil
html
end
|
#write_navigation ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'app/presenters/rails_info/logs/server_presenter.rb', line 33
def write_navigation
tab_index = 0
content_tag :ul do
elements = ''
@rails_info_log.writes.each do |table_name,data|
elements += content_tag :li, link_to(table_name, "#writes-#{tab_index}")
tab_index += 1
end
raw elements
end
end
|
#write_tabs ⇒ Object
27
28
29
30
31
|
# File 'app/presenters/rails_info/logs/server_presenter.rb', line 27
def write_tabs
content_tag :div, class: 'tabs', id: 'writes' do
raw(write_navigation) + raw(write_body)
end
end
|