acts_as_dashboard 0.4.0 → 0.4.1
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.
- data/README.rdoc +3 -1
- data/VERSION +1 -1
- data/acts_as_dashboard.gemspec +2 -2
- data/generators/dashboard/dashboard_generator.rb +4 -2
- data/generators/dashboard/templates/controller.erb +1 -1
- data/lib/acts_as_dashboard/app/views/dashboards/show.html.erb +70 -70
- data/lib/acts_as_dashboard/line_graph_widget.rb +6 -0
- data/spec/acts_as_dashboard/line_graph_widget_spec.rb +16 -0
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -24,13 +24,15 @@ acts_as_dashboard makes it easy to create dashboards in Rails apps.
|
|
24
24
|
|
25
25
|
== To Do
|
26
26
|
|
27
|
-
* Make LineGraphWidget#line_colours accept a string or array.
|
28
27
|
* Decide if routes should added to config/routes.rb , or loaded by acts_as_dashboard using ActionController::Routing::Routes#add_route . If the latter figure out how to make it work.
|
29
28
|
* Make the "show" view template sexy.
|
30
29
|
* Add more widget types.
|
31
30
|
* If getting a new value for a widget fails, keep the last value, and mark the widget as failing.
|
32
31
|
* Set a default value for the Widget class' "update_interval" attribute.
|
33
32
|
* Generate the value for the Widget class' "name" attribute automatically so that the user needn't specify it.
|
33
|
+
* Figure out how to get the call to includeJavaScriptFile() in LineGraphWidget to use the correct sub-directory (dashboard.js:285).
|
34
|
+
* Fix the failing specs.
|
35
|
+
* Fix the JavaScript problems in IE. Bloody IE...
|
34
36
|
|
35
37
|
|
36
38
|
== Bugs
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
data/acts_as_dashboard.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{acts_as_dashboard}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Nick Hoffman"]
|
12
|
-
s.date = %q{2010-08-
|
12
|
+
s.date = %q{2010-08-08}
|
13
13
|
s.description = %q{acts_as_dashboard makes it easy to create dashboards in Rails apps. Very little configuration is required. Read the docs to get started.}
|
14
14
|
s.email = %q{nick@deadorange.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -87,9 +87,11 @@ class DashboardGenerator < Rails::Generator::Base
|
|
87
87
|
logger.route @widgets_route
|
88
88
|
|
89
89
|
return if options[:pretend]
|
90
|
+
|
91
|
+
sentinel = Regexp.escape 'ActionController::Routing::Routes.draw do |map|'
|
90
92
|
|
91
|
-
gsub_file 'config/routes.rb',
|
92
|
-
"\n #{@singleton_resource}\n #{@widgets_route}\n
|
93
|
+
gsub_file 'config/routes.rb', /(#{sentinel})/mi do |match|
|
94
|
+
"#{match}\n #{@singleton_resource}\n #{@widgets_route}\n"
|
93
95
|
end
|
94
96
|
end # }}}
|
95
97
|
|
@@ -22,7 +22,7 @@ class <%= controller_name -%> < ApplicationController
|
|
22
22
|
d.name = :random_dates_and_numbers
|
23
23
|
d.title = 'Random Dates and Numbers'
|
24
24
|
d.update_interval = '15s'
|
25
|
-
d.line_colours =
|
25
|
+
d.line_colours = 'blue'
|
26
26
|
d.x_axis = :dates
|
27
27
|
d.data do
|
28
28
|
(0..10).map do
|
@@ -1,70 +1,70 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2
|
-
|
3
|
-
<html>
|
4
|
-
|
5
|
-
<head>
|
6
|
-
<style type="text/css">
|
7
|
-
<%# @dashboard_css %>
|
8
|
-
</style>
|
9
|
-
|
10
|
-
<%= javascript_include_tag 'http://code.jquery.com/jquery-1.4.2.min.js' %>
|
11
|
-
<%= javascript_include_tag 'jquery-ui/js/jquery-ui-1.8.2.custom.min.js' %>
|
12
|
-
<%= javascript_include_tag 'http://plugins.jquery.com/files/jquery.timers-1.2.js.txt' %>
|
13
|
-
<%= javascript_include_tag 'js.class-2.1.4/min/core.js' %>
|
14
|
-
<%= javascript_include_tag 'jqplot-0.9.7/jquery.jqplot.min.js' %>
|
15
|
-
<%= javascript_include_tag 'dashboard' %>
|
16
|
-
|
17
|
-
<%= stylesheet_link_tag 'jquery-ui/css/ui-darkness/jquery-ui-1.8.2.custom.css' %>
|
18
|
-
<%= stylesheet_link_tag 'dashboard' %>
|
19
|
-
<%= stylesheet_link_tag 'jquery.jqplot.min.css' %>
|
20
|
-
|
21
|
-
<script type='text/javascript'>
|
22
|
-
jQuery(document).ready(function() {
|
23
|
-
dashboard = new Dashboard({basePath: '<%= @dashboard_path -%>'});
|
24
|
-
json_widgets = '<%= @json_widgets -%>';
|
25
|
-
|
26
|
-
buildTheDashboard();
|
27
|
-
});
|
28
|
-
</script>
|
29
|
-
|
30
|
-
<script type='text/javascript'>
|
31
|
-
<%# @dashboard_js %>
|
32
|
-
</script>
|
33
|
-
</head>
|
34
|
-
|
35
|
-
<body>
|
36
|
-
<div id='dashboard'>
|
37
|
-
<div class='dashboard-numbers'>
|
38
|
-
<div class='ui-widget widget-template' style='display: none;'>
|
39
|
-
<div class="ui-widget-header ui-corner-tl ui-corner-tr widget-title"></div>
|
40
|
-
<div class="ui-widget-content ui-corner-bl ui-corner-br"><div class="widget-data"></div></div>
|
41
|
-
</div>
|
42
|
-
</div>
|
43
|
-
|
44
|
-
<div class='dashboard-clear'></div>
|
45
|
-
|
46
|
-
<div class='dashboard-short-messages'>
|
47
|
-
<div class='ui-widget widget-template' style='display: none;'>
|
48
|
-
<div class="ui-widget-header ui-corner-all widget-title"></div>
|
49
|
-
<div class="widget-data">
|
50
|
-
<ul>
|
51
|
-
<li class='ui-widget-content ui-corner-all widget-data widget-data-template' style='display: none;'></li>
|
52
|
-
</ul>
|
53
|
-
</div>
|
54
|
-
</div>
|
55
|
-
</div>
|
56
|
-
|
57
|
-
<div class='dashboard-clear'></div>
|
58
|
-
|
59
|
-
<div class='dashboard-line-graphs'>
|
60
|
-
<div class='ui-widget widget-template' style='display: none;'>
|
61
|
-
<div class='ui-widget-header ui-corner-tl ui-corner-tr widget-title'></div>
|
62
|
-
<div class='ui-widget-content ui-corner-bl ui-corner-br widget-data'></div>
|
63
|
-
</div>
|
64
|
-
</div>
|
65
|
-
|
66
|
-
<div class='dashboard-clear'></div>
|
67
|
-
</div>
|
68
|
-
</body>
|
69
|
-
|
70
|
-
</html>
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2
|
+
|
3
|
+
<html>
|
4
|
+
|
5
|
+
<head>
|
6
|
+
<style type="text/css">
|
7
|
+
<%# @dashboard_css %>
|
8
|
+
</style>
|
9
|
+
|
10
|
+
<%= javascript_include_tag 'http://code.jquery.com/jquery-1.4.2.min.js' %>
|
11
|
+
<%= javascript_include_tag 'jquery-ui/js/jquery-ui-1.8.2.custom.min.js' %>
|
12
|
+
<%= javascript_include_tag 'http://plugins.jquery.com/files/jquery.timers-1.2.js.txt' %>
|
13
|
+
<%= javascript_include_tag 'js.class-2.1.4/min/core.js' %>
|
14
|
+
<%= javascript_include_tag 'jqplot-0.9.7/jquery.jqplot.min.js' %>
|
15
|
+
<%= javascript_include_tag 'dashboard' %>
|
16
|
+
|
17
|
+
<%= stylesheet_link_tag 'jquery-ui/css/ui-darkness/jquery-ui-1.8.2.custom.css' %>
|
18
|
+
<%= stylesheet_link_tag 'dashboard' %>
|
19
|
+
<%= stylesheet_link_tag 'jquery.jqplot.min.css' %>
|
20
|
+
|
21
|
+
<script type='text/javascript'>
|
22
|
+
jQuery(document).ready(function() {
|
23
|
+
dashboard = new Dashboard({basePath: '<%= @dashboard_path -%>'});
|
24
|
+
json_widgets = '<%= @json_widgets -%>';
|
25
|
+
|
26
|
+
buildTheDashboard();
|
27
|
+
});
|
28
|
+
</script>
|
29
|
+
|
30
|
+
<script type='text/javascript'>
|
31
|
+
<%# @dashboard_js %>
|
32
|
+
</script>
|
33
|
+
</head>
|
34
|
+
|
35
|
+
<body>
|
36
|
+
<div id='dashboard'>
|
37
|
+
<div class='dashboard-numbers'>
|
38
|
+
<div class='ui-widget widget-template' style='display: none;'>
|
39
|
+
<div class="ui-widget-header ui-corner-tl ui-corner-tr widget-title"></div>
|
40
|
+
<div class="ui-widget-content ui-corner-bl ui-corner-br"><div class="widget-data"></div></div>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div class='dashboard-clear'></div>
|
45
|
+
|
46
|
+
<div class='dashboard-short-messages'>
|
47
|
+
<div class='ui-widget widget-template' style='display: none;'>
|
48
|
+
<div class="ui-widget-header ui-corner-all widget-title"></div>
|
49
|
+
<div class="widget-data">
|
50
|
+
<ul>
|
51
|
+
<li class='ui-widget-content ui-corner-all widget-data widget-data-template' style='display: none;'></li>
|
52
|
+
</ul>
|
53
|
+
</div>
|
54
|
+
</div>
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<div class='dashboard-clear'></div>
|
58
|
+
|
59
|
+
<div class='dashboard-line-graphs'>
|
60
|
+
<div class='ui-widget widget-template' style='display: none;'>
|
61
|
+
<div class='ui-widget-header ui-corner-tl ui-corner-tr widget-title'></div>
|
62
|
+
<div class='ui-widget-content ui-corner-bl ui-corner-br widget-data'></div>
|
63
|
+
</div>
|
64
|
+
</div>
|
65
|
+
|
66
|
+
<div class='dashboard-clear'></div>
|
67
|
+
</div>
|
68
|
+
</body>
|
69
|
+
|
70
|
+
</html>
|
@@ -37,6 +37,12 @@ module ActsAsDashboard
|
|
37
37
|
@width = width
|
38
38
|
end
|
39
39
|
|
40
|
+
def line_colour=(line_colour)
|
41
|
+
raise ArgumentError, 'The "line_colour" argument must be a String.' unless line_colour.is_a? String
|
42
|
+
|
43
|
+
self.line_colours = [line_colour]
|
44
|
+
end
|
45
|
+
|
40
46
|
def line_colours=(line_colours)
|
41
47
|
raise ArgumentError, 'The "line_colours" argument must be an Array of Strings.' unless line_colours.is_a? Array
|
42
48
|
line_colours.each {|c| raise ArgumentError, 'The "line_colours" argument must be an Array of Strings.' unless c.is_a? String}
|
@@ -98,6 +98,22 @@ describe ActsAsDashboard::LineGraphWidget do
|
|
98
98
|
end
|
99
99
|
end # }}}
|
100
100
|
|
101
|
+
describe 'settings its "line_colours" attribute via #line_colour' do # {{{
|
102
|
+
it 'raises an error when not given a String' do
|
103
|
+
Proc.new {ActsAsDashboard::LineGraphWidget.new.line_colour = [1]}.should raise_error ArgumentError,
|
104
|
+
'The "line_colour" argument must be a String.'
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'passes the String in an Array to #line_colours=' do
|
108
|
+
line_colour = 'green'
|
109
|
+
w = ActsAsDashboard::LineGraphWidget.new
|
110
|
+
|
111
|
+
w.should_receive(:'line_colours=').with [line_colour]
|
112
|
+
|
113
|
+
w.line_colour = line_colour
|
114
|
+
end
|
115
|
+
end # }}}
|
116
|
+
|
101
117
|
describe 'setting its "line_colours" attribute' do # {{{
|
102
118
|
it 'raises an error when not given an Array' do
|
103
119
|
Proc.new {ActsAsDashboard::LineGraphWidget.new.line_colours = 'fail'}.should raise_error ArgumentError,
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_dashboard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 1
|
10
|
+
version: 0.4.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Nick Hoffman
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-08-
|
18
|
+
date: 2010-08-08 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|