dev_panel 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,29 +10,33 @@ module DevPanel
10
10
  end
11
11
 
12
12
  def dev_panel_ajax
13
+ puts "#{jquery_cdn.nil?} + #{jquery_ui_cdn.nil?} + #{ajax_call}"
13
14
  jquery_cdn + jquery_ui_cdn + ajax_call
14
15
  end
15
16
 
16
17
  def ajax_call
17
18
  <<-html_code
18
19
  <div id="DevPanel"></div><script type="text/javascript">
19
- $.ajax({
20
+ var $jq = jQuery.noConflict();
21
+ $jq.ajax({
20
22
  url: "/__DevPanel/main",
21
23
  success: function(response) {
22
- $("#DevPanel").html(response);
24
+ $jq("#DevPanel").html(response);
23
25
  #{hide_container};
24
- $("#viewTime").click(function(e) {
25
- $("#partialList").css('top', e.pageY + 10 + 'px');
26
- $("#partialList").css('left', e.pageX + 10 + 'px');
27
- $("#partialList").toggle();
26
+ $jq("#viewTime").click(function(e) {
27
+ $jq("#partialList").css('top', e.pageY + 10 + 'px');
28
+ $jq("#partialList").css('left', e.pageX + 10 + 'px');
29
+ $jq("#partialList").toggle();
28
30
  });
29
- $("#devPanelHider").on("click", function(s) {
30
- $("#devPanelContainer").toggle();
31
- $("#partialList").hide();
32
- $.get("/__DevPanel/set_options?visible=" + $("#devPanelContainer").is(":visible"));
31
+ $jq("#devPanelHider").on("click", function(s) {
32
+ $jq("#devPanelContainer").toggle();
33
+ $jq("#partialList").hide();
34
+ $jq.get("/__DevPanel/set_options?visible=" + $jq("#devPanelContainer").is(":visible"));
33
35
  });
34
- $("#devPanelWindow").draggable({stop: function() {
35
- $.get("/__DevPanel/set_options?top=" + $("#devPanelWindow").position().top + "&left=" + $("#devPanelWindow").position().left);
36
+ $jq("#devPanelWindow").draggable({stop: function() {
37
+ $jq.get("/__DevPanel/set_options?top=" + $jq("#devPanelWindow").position().top + "&left="
38
+ + $jq("#devPanelWindow").position().left + "&zindex="
39
+ + $jq("#devPanelWindow").zIndex() )
36
40
  }});
37
41
  }
38
42
  });
@@ -41,23 +45,23 @@ module DevPanel
41
45
  end
42
46
 
43
47
  def hide_container
44
- (Stats.show?) ? '' : '$("#devPanelContainer").toggle()'
48
+ (Stats.show?) ? '' : '$jq("#devPanelContainer").toggle()'
45
49
  end
46
50
 
47
- def jquery_cdn
51
+ def config_key(value)
48
52
  begin
49
- return '' if Rails.application.config.dev_panel_exclude_jquery == true
53
+ return Rails.application.config.send(value)
50
54
  rescue
51
- '<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>'
55
+ return nil
52
56
  end
53
57
  end
54
58
 
59
+ def jquery_cdn
60
+ '<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>'
61
+ end
62
+
55
63
  def jquery_ui_cdn
56
- begin
57
- return '' if Rails.application.config.dev_panel_exclude_jquery_ui == true
58
- rescue
59
- '<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>'
60
- end
64
+ '<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>'
61
65
  end
62
66
  end
63
67
  end
@@ -29,6 +29,12 @@ module DevPanel
29
29
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.03), 1px 1px 0 rgba(0, 0, 0, 0.05), -1px 1px 0 rgba(0, 0, 0, 0.05), 0 0 0 4px rgba(0, 0, 0, 0.04);
30
30
  font-family: menlo, lucida console, monospace;
31
31
  border: 2px solid #000;
32
+ z-index: 500000000;
33
+ padding: 3px;
34
+ color: #000;
35
+ background-color: #F0F0F5;
36
+ position: absolute;
37
+ float: left;
32
38
  }
33
39
 
34
40
  #devPanelHider {
@@ -42,12 +48,16 @@ module DevPanel
42
48
  border-bottom: 0;
43
49
  border-top-left-radius: 2px;
44
50
  border-top-right-radius: 2px;
51
+ width: 150px;
52
+ text-align:center;
53
+ border: solid 1px #fff;
45
54
  }
46
55
 
47
56
  #devPanelContainer {
48
57
  font-family: menlo, lucida console, monospace;
49
58
  background-color: #fff;
50
59
  box-shadow: inset 3px 3px 3px rgba(0, 0, 0, 0.1), inset 0 0 0 1px rgba(0, 0, 0, 0.1);
60
+ width: 300px; padding-top: 20px;
51
61
  }
52
62
 
53
63
  #devPanelContainer td {
@@ -92,7 +102,7 @@ module DevPanel
92
102
  border-top-left-radius: 2px;
93
103
  border-top-right-radius: 2px;
94
104
  display: none;
95
- z-index: 1;
105
+ z-index: 500000001;
96
106
  }
97
107
  </style>
98
108
  css_code
@@ -101,9 +111,9 @@ module DevPanel
101
111
  def html_containers
102
112
  <<-html_code
103
113
  <div id='partialList'>#{partial_list}</div>
104
- <div id="devPanelWindow" style="padding: 3px; color: #000; background-color: #F0F0F5; position: absolute; float: left; top: #{Stats.top.to_s}px; left: #{Stats.left.to_s}px;" >
105
- <div id="devPanelHider" style="width: 150px; text-align:center; border: solid 1px #fff"><a href="#">Show/Hide Stats</a> / <span style="font-size: 10px">#{Stats.data[:action_controller].duration.round(0).to_s}ms</span></div>
106
- <div id="devPanelContainer" style="width: 300px; padding-top: 20px">
114
+ <div id="devPanelWindow" style="top: #{Stats.top.to_s}px; left: #{Stats.left.to_s}px;" >
115
+ <div id="devPanelHider"><a href="#">Show/Hide Stats</a> / <span style="font-size: 10px">#{Stats.data[:action_controller].duration.round(0).to_s}ms</span></div>
116
+ <div id="devPanelContainer">
107
117
  html_code
108
118
  end
109
119
 
@@ -136,7 +146,6 @@ module DevPanel
136
146
  def partial_list
137
147
  str = ""
138
148
  Stats.data[:partials].each_pair {|k,v| str << "#{k}: #{Stats.data[:partials][k]}<br>" } if Stats.data[:partials].present?
139
-
140
149
  str
141
150
  end
142
151
 
@@ -156,7 +165,6 @@ module DevPanel
156
165
  result = ""
157
166
  arr.each_with_index do |data, index|
158
167
  result += tr(data, index.even? ? "alt" : "")
159
- tr(data, index.even? ? "alt" : "")
160
168
  end
161
169
  result
162
170
  end
@@ -32,7 +32,7 @@ module DevPanel
32
32
  rescue
33
33
  top = 0
34
34
  end
35
- DevPanel::Stats.top(top)
35
+
36
36
 
37
37
  left = nil
38
38
  begin
@@ -40,8 +40,17 @@ module DevPanel
40
40
  rescue
41
41
  left = 0
42
42
  end
43
+
44
+ zindex = nil
45
+ begin
46
+ zindex = Rails.application.config.dev_panel_initial_zindex
47
+ rescue
48
+ zindex = 1000
49
+ end
50
+
43
51
  DevPanel::Stats.top(top)
44
52
  DevPanel::Stats.left(left)
53
+ DevPanel::Stats.zindex(zindex)
45
54
  end
46
55
  end
47
56
  end
@@ -1,13 +1,13 @@
1
1
  module DevPanel
2
2
  class Stats
3
3
 
4
- @@data ||= { log: "" }
5
- @@visible = "false"
6
- @@left = 0
7
- @@top = 0
4
+ @@data ||= { log: "" }
5
+ @@visible = "false"
6
+ @@left = 0
7
+ @@top = 0
8
8
 
9
9
  def self.set_by_params(params)
10
- ['visible', 'left', 'top'].each do |str|
10
+ ['visible', 'left', 'top', 'zindex'].each do |str|
11
11
  Stats.send(str, params[str]) if params[str].present?
12
12
  end
13
13
  Stats.log(" ")
@@ -30,6 +30,11 @@ module DevPanel
30
30
  return @@top if val.class != Fixnum && val.empty?
31
31
  @@top = val
32
32
  end
33
+
34
+ def self.zindex(val = @@zindex)
35
+ return @@zindex if val.class != Fixnum && val.empty?
36
+ @@zindex = val || 1000
37
+ end
33
38
 
34
39
  def self.visible(val = @@visible)
35
40
  @@visible = val
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.4
4
+ version: 0.2.5
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-02-04 00:00:00.000000000 Z
12
+ date: 2013-08-26 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
@@ -43,7 +43,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
43
43
  version: '0'
44
44
  requirements: []
45
45
  rubyforge_project:
46
- rubygems_version: 1.8.24
46
+ rubygems_version: 1.8.25
47
47
  signing_key:
48
48
  specification_version: 3
49
49
  summary: DevPanel, a gem for performance stats and debugging information