dev_panel 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,7 @@ module DevPanel
6
6
 
7
7
  def call(env)
8
8
  if env["REQUEST_URI"] =~ /__DevPanel\/main/
9
- [200, { "Content-Type" => "text/plain; charset=utf-8" }, [dev_panel_output]]
9
+ [200, { "Content-Type" => "text/html; charset=utf-8" }, [dev_panel_output]]
10
10
  elsif env["REQUEST_URI"] =~ /__DevPanel\/set_options/
11
11
  params = Rack::Utils.parse_query(env['QUERY_STRING'], "&")
12
12
  Stats.set_by_params(params)
@@ -16,9 +16,9 @@ module DevPanel
16
16
  end
17
17
  end
18
18
 
19
- def dev_panel_output
20
- css + html_containers + html_table
21
- end
19
+ def dev_panel_output
20
+ (css + html_containers + html_table).html_safe
21
+ end
22
22
 
23
23
  def css
24
24
  <<-css_code
@@ -60,7 +60,7 @@ module DevPanel
60
60
  }
61
61
 
62
62
  #devPanelContainer tr {
63
- background-color: #FACC9B;;
63
+ background-color: #FACC9B;
64
64
  }
65
65
 
66
66
  #devPanelContainer td.firstColumn {
@@ -126,7 +126,7 @@ module DevPanel
126
126
  first_td("Log:") + td(Stats.data[:log])
127
127
  ])
128
128
 
129
- "<table style='width: 300px; table-layout: fixed'>#{table_rows}</table></div></div>"
129
+ "<table style='width: 290px; margin: auto; table-layout: fixed'>#{table_rows}</table></div></div>"
130
130
  end
131
131
 
132
132
  def partial_count
@@ -135,7 +135,8 @@ module DevPanel
135
135
 
136
136
  def partial_list
137
137
  str = ""
138
- Stats.data[:partials].each_pair {|k,v| str << "#{k}: #{Stats.data[:partials][k]}<br>" }
138
+ Stats.data[:partials].each_pair {|k,v| str << "#{k}: #{Stats.data[:partials][k]}<br>" } if Stats.data[:partials].present?
139
+
139
140
  str
140
141
  end
141
142
 
@@ -155,7 +156,7 @@ module DevPanel
155
156
  result = ""
156
157
  arr.each_with_index do |data, index|
157
158
  result += tr(data, index.even? ? "alt" : "")
158
- puts tr(data, index.even? ? "alt" : "")
159
+ tr(data, index.even? ? "alt" : "")
159
160
  end
160
161
  result
161
162
  end
@@ -2,6 +2,7 @@ module DevPanel
2
2
  class Railtie < Rails::Railtie
3
3
  initializer "dev_panel.configure_rails_initialization" do
4
4
  unless Rails.env.production?
5
+
5
6
  Rails.application.middleware.use DevPanel::Middleware
6
7
 
7
8
  ActiveSupport::Notifications.subscribe('start_processing.action_controller') do |*args|
@@ -24,6 +25,23 @@ module DevPanel
24
25
  Stats.data[:partials][partial_name] += 1
25
26
  end
26
27
 
28
+
29
+ top = nil
30
+ begin
31
+ top = Rails.application.config.dev_panel_initial_top
32
+ rescue
33
+ top = 0
34
+ end
35
+ DevPanel::Stats.top(top)
36
+
37
+ left = nil
38
+ begin
39
+ left = Rails.application.config.dev_panel_initial_left
40
+ rescue
41
+ left = 0
42
+ end
43
+ DevPanel::Stats.top(top)
44
+ DevPanel::Stats.left(left)
27
45
  end
28
46
  end
29
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dev_panel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-14 00:00:00.000000000 Z
12
+ date: 2013-02-04 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A panel that appears in the browser to provide stats on page load times
15
15
  and other debugging information for Rails 3