my_dashboard 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +13 -0
  3. data/.travis.yml +9 -0
  4. data/CHANGELOG.md +23 -0
  5. data/Gemfile +20 -0
  6. data/MIT-LICENSE +20 -0
  7. data/README.md +223 -0
  8. data/Rakefile +7 -0
  9. data/app/assets/javascripts/my_dashboard/application.js +17 -0
  10. data/app/assets/javascripts/my_dashboard/my_dashboard.coffee +0 -0
  11. data/app/assets/stylesheets/my_dashboard/application.css +13 -0
  12. data/app/controllers/my_dashboard/application_controller.rb +23 -0
  13. data/app/controllers/my_dashboard/dashboards_controller.rb +31 -0
  14. data/app/controllers/my_dashboard/events_controller.rb +28 -0
  15. data/app/controllers/my_dashboard/widgets_controller.rb +45 -0
  16. data/app/helpers/my_dashboard/application_helper.rb +4 -0
  17. data/app/views/layouts/my_dashboard/dashboard.html.erb +30 -0
  18. data/app/views/my_dashboard/widgets/clock.html +2 -0
  19. data/app/views/my_dashboard/widgets/comments.html +7 -0
  20. data/app/views/my_dashboard/widgets/graph.html +5 -0
  21. data/app/views/my_dashboard/widgets/iframe.html +1 -0
  22. data/app/views/my_dashboard/widgets/image.html +1 -0
  23. data/app/views/my_dashboard/widgets/list.html +18 -0
  24. data/app/views/my_dashboard/widgets/meter.html +7 -0
  25. data/app/views/my_dashboard/widgets/number.html +11 -0
  26. data/app/views/my_dashboard/widgets/text.html +7 -0
  27. data/bin/rails +8 -0
  28. data/config/routes.rb +15 -0
  29. data/lib/assets/javascripts/my_dashboard.gridster.coffee +0 -0
  30. data/lib/generators/my_dashboard/install_generator.rb +36 -0
  31. data/lib/generators/my_dashboard/job_generator.rb +15 -0
  32. data/lib/generators/my_dashboard/widget_generator.rb +17 -0
  33. data/lib/generators/templates/dashboards/sample.html.erb +28 -0
  34. data/lib/generators/templates/initializer.rb +58 -0
  35. data/lib/generators/templates/jobs/new.rb +3 -0
  36. data/lib/generators/templates/jobs/sample.rb +9 -0
  37. data/lib/generators/templates/layouts/dashboard.html.erb +30 -0
  38. data/lib/generators/templates/widgets/index.css +12 -0
  39. data/lib/generators/templates/widgets/index.js +13 -0
  40. data/lib/generators/templates/widgets/new.coffee +9 -0
  41. data/lib/generators/templates/widgets/new.html +1 -0
  42. data/lib/generators/templates/widgets/new.scss +10 -0
  43. data/lib/my_dashboard.rb +50 -0
  44. data/lib/my_dashboard/configuration.rb +63 -0
  45. data/lib/my_dashboard/engine.rb +7 -0
  46. data/lib/my_dashboard/railtie.rb +31 -0
  47. data/lib/my_dashboard/version.rb +3 -0
  48. data/lib/tasks/my_dashboard_tasks.rake +4 -0
  49. data/my_dashboard.gemspec +31 -0
  50. data/spec/controllers/my_dashboard/application_controller_spec.rb +21 -0
  51. data/spec/controllers/my_dashboard/dashboards_controller_spec.rb +46 -0
  52. data/spec/controllers/my_dashboard/events_controller_spec.rb +11 -0
  53. data/spec/controllers/my_dashboard/widgets_controller_spec.rb +72 -0
  54. data/spec/dummy/README.rdoc +28 -0
  55. data/spec/dummy/Rakefile +6 -0
  56. data/spec/dummy/app/assets/images/.keep +0 -0
  57. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  58. data/spec/dummy/app/assets/javascripts/my_dashboard/widgets/foo.coffee +0 -0
  59. data/spec/dummy/app/assets/javascripts/my_dashboard/widgets/index.js +13 -0
  60. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  61. data/spec/dummy/app/assets/stylesheets/my_dashboard/widgets/foo.scss +0 -0
  62. data/spec/dummy/app/assets/stylesheets/my_dashboard/widgets/index.css +12 -0
  63. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  64. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  65. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  66. data/spec/dummy/app/jobs/sample.rb +9 -0
  67. data/spec/dummy/app/mailers/.keep +0 -0
  68. data/spec/dummy/app/models/.keep +0 -0
  69. data/spec/dummy/app/models/concerns/.keep +0 -0
  70. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  71. data/spec/dummy/app/views/layouts/my_dashboard/dashboard.html.erb +30 -0
  72. data/spec/dummy/app/views/my_dashboard/dashboards/foo.erb +0 -0
  73. data/spec/dummy/app/views/my_dashboard/dashboards/sample.html.erb +28 -0
  74. data/spec/dummy/app/views/my_dashboard/widgets/foo.html +0 -0
  75. data/spec/dummy/bin/bundle +3 -0
  76. data/spec/dummy/bin/rails +4 -0
  77. data/spec/dummy/bin/rake +4 -0
  78. data/spec/dummy/config.ru +4 -0
  79. data/spec/dummy/config/application.rb +23 -0
  80. data/spec/dummy/config/boot.rb +5 -0
  81. data/spec/dummy/config/database.yml +25 -0
  82. data/spec/dummy/config/environment.rb +5 -0
  83. data/spec/dummy/config/environments/development.rb +29 -0
  84. data/spec/dummy/config/environments/production.rb +80 -0
  85. data/spec/dummy/config/environments/test.rb +36 -0
  86. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  87. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  88. data/spec/dummy/config/initializers/inflections.rb +16 -0
  89. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  90. data/spec/dummy/config/initializers/my_dashboard.rb +58 -0
  91. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  92. data/spec/dummy/config/initializers/session_store.rb +3 -0
  93. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  94. data/spec/dummy/config/locales/en.yml +23 -0
  95. data/spec/dummy/config/routes.rb +3 -0
  96. data/spec/dummy/lib/assets/.keep +0 -0
  97. data/spec/dummy/log/.keep +0 -0
  98. data/spec/dummy/public/404.html +58 -0
  99. data/spec/dummy/public/422.html +58 -0
  100. data/spec/dummy/public/500.html +57 -0
  101. data/spec/dummy/public/favicon.ico +0 -0
  102. data/spec/lib/generators/widget_generator_spec.rb +26 -0
  103. data/spec/lib/my_dashboard/configuration_spec.rb +66 -0
  104. data/spec/lib/my_dashboard_spec.rb +55 -0
  105. data/spec/spec_helper.rb +52 -0
  106. data/spec/support/controller_spec_helpers.rb +9 -0
  107. data/vendor/assets/fonts/my_dashboard/fontawesome-webfont.eot +0 -0
  108. data/vendor/assets/fonts/my_dashboard/fontawesome-webfont.svg +414 -0
  109. data/vendor/assets/fonts/my_dashboard/fontawesome-webfont.ttf +0 -0
  110. data/vendor/assets/fonts/my_dashboard/fontawesome-webfont.woff +0 -0
  111. data/vendor/assets/javascripts/my_dashboard/batman.jquery.js +163 -0
  112. data/vendor/assets/javascripts/my_dashboard/batman.js +13680 -0
  113. data/vendor/assets/javascripts/my_dashboard/d3-3.2.8.min.js +5 -0
  114. data/vendor/assets/javascripts/my_dashboard/default_widgets/clock.coffee +18 -0
  115. data/vendor/assets/javascripts/my_dashboard/default_widgets/comments.coffee +24 -0
  116. data/vendor/assets/javascripts/my_dashboard/default_widgets/graph.coffee +37 -0
  117. data/vendor/assets/javascripts/my_dashboard/default_widgets/iframe.coffee +9 -0
  118. data/vendor/assets/javascripts/my_dashboard/default_widgets/image.coffee +9 -0
  119. data/vendor/assets/javascripts/my_dashboard/default_widgets/index.js +13 -0
  120. data/vendor/assets/javascripts/my_dashboard/default_widgets/list.coffee +6 -0
  121. data/vendor/assets/javascripts/my_dashboard/default_widgets/meter.coffee +14 -0
  122. data/vendor/assets/javascripts/my_dashboard/default_widgets/number.coffee +25 -0
  123. data/vendor/assets/javascripts/my_dashboard/default_widgets/text.coffee +1 -0
  124. data/vendor/assets/javascripts/my_dashboard/es5-shim.js +1021 -0
  125. data/vendor/assets/javascripts/my_dashboard/index.js +21 -0
  126. data/vendor/assets/javascripts/my_dashboard/jquery.gridster.js +3987 -0
  127. data/vendor/assets/javascripts/my_dashboard/jquery.js +4 -0
  128. data/vendor/assets/javascripts/my_dashboard/jquery.knob.js +646 -0
  129. data/vendor/assets/javascripts/my_dashboard/jquery.leanModal.min.js +5 -0
  130. data/vendor/assets/javascripts/my_dashboard/jquery.timeago.js +184 -0
  131. data/vendor/assets/javascripts/my_dashboard/moment.min.js +6 -0
  132. data/vendor/assets/javascripts/my_dashboard/my_dashboard.coffee +0 -0
  133. data/vendor/assets/javascripts/my_dashboard/rickshaw-1.5.1.min.js +3 -0
  134. data/vendor/assets/stylesheets/my_dashboard/font-awesome.scss +1338 -0
  135. data/vendor/assets/stylesheets/my_dashboard/index.css +15 -0
  136. data/vendor/assets/stylesheets/my_dashboard/jquery.gridster.css +121 -0
  137. data/vendor/assets/stylesheets/my_dashboard/my_dashboard.scss +302 -0
  138. data/vendor/assets/stylesheets/my_dashboard/widgets/clock.scss +13 -0
  139. data/vendor/assets/stylesheets/my_dashboard/widgets/comments.scss +33 -0
  140. data/vendor/assets/stylesheets/my_dashboard/widgets/graph.scss +65 -0
  141. data/vendor/assets/stylesheets/my_dashboard/widgets/iframe.scss +8 -0
  142. data/vendor/assets/stylesheets/my_dashboard/widgets/image.scss +13 -0
  143. data/vendor/assets/stylesheets/my_dashboard/widgets/index.css +12 -0
  144. data/vendor/assets/stylesheets/my_dashboard/widgets/list.scss +60 -0
  145. data/vendor/assets/stylesheets/my_dashboard/widgets/meter.scss +35 -0
  146. data/vendor/assets/stylesheets/my_dashboard/widgets/number.scss +39 -0
  147. data/vendor/assets/stylesheets/my_dashboard/widgets/text.scss +32 -0
  148. metadata +373 -0
@@ -0,0 +1,45 @@
1
+ module MyDashboard
2
+ class WidgetsController < ApplicationController
3
+
4
+ before_filter :check_accessibility, only: :update
5
+ before_filter :check_widget_name, only: [:show, :update]
6
+ before_filter :prepend_view_paths, only: :show
7
+
8
+ rescue_from ActionView::MissingTemplate, with: :template_not_found
9
+
10
+ def show
11
+ render file: widget_path, layout: false
12
+ end
13
+
14
+ def update
15
+ data = params[:widget] || {}
16
+ hash = data.merge(id: params[:name], updatedAt: Time.now.utc.to_i)
17
+ MyDashboard.redis.publish("#{MyDashboard.config.redis_namespace}.create", hash.to_json)
18
+
19
+ render nothing: true
20
+ end
21
+
22
+ private
23
+
24
+ def check_widget_name
25
+ raise 'bad widget name' unless params[:name] =~ /\A[a-zA-z0-9_\-]+\z/
26
+ end
27
+
28
+ def widget_path
29
+ params[:name]
30
+ end
31
+
32
+ def prepend_view_paths
33
+ prepend_view_path main_app_view_path
34
+ end
35
+
36
+ def main_app_view_path
37
+ MyDashboard.config.widgets_views_path
38
+ end
39
+
40
+ def template_not_found
41
+ raise "Count not find template for widget #{params[:name]}. Define your widget in #{main_app_view_path}"
42
+ end
43
+
44
+ end
45
+ end
@@ -0,0 +1,4 @@
1
+ module MyDashboard
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,30 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8"/>
5
+ <meta name="description" content="">
6
+ <meta name="viewport" content="width=device-width">
7
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
8
+
9
+ <title><%= yield :title %></title>
10
+
11
+ <%= javascript_include_tag 'my_dashboard/application' %>
12
+ <%= stylesheet_link_tag 'my_dashboard/application' %>
13
+
14
+ <link href='//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700' rel='stylesheet' type='text/css'>
15
+ <link rel="icon" href="/favicon.ico">
16
+ </head>
17
+ <body>
18
+ <div id="container">
19
+ <%= yield %>
20
+ </div>
21
+
22
+ <% if Rails.env.development? %>
23
+ <div id="saving-instructions">
24
+ <p>Paste the following at the top of <i><%= params[:dashboard] %>.erb</i></p>
25
+ <textarea id="gridster-code"></textarea>
26
+ </div>
27
+ <a href="#saving-instructions" id="save-gridster">Save this layout</a>
28
+ <% end %>
29
+ </body>
30
+ </html>
@@ -0,0 +1,2 @@
1
+ <h1 data-bind="date"></h1>
2
+ <h2 data-bind="time"></h2>
@@ -0,0 +1,7 @@
1
+ <h1 class="title" data-bind="title"></h1>
2
+ <div class="comment-container">
3
+ <h3><img data-bind-src='current_comment.avatar'/><span data-bind='current_comment.name' class="name"></span></h3>
4
+ <p class="comment" data-bind='quote'></p>
5
+ </div>
6
+
7
+ <p class="more-info" data-bind="moreinfo"></p>
@@ -0,0 +1,5 @@
1
+ <h1 class="title" data-bind="title"></h1>
2
+
3
+ <h2 class="value" data-bind="current | prettyNumber | prepend prefix | append suffix"></h2>
4
+
5
+ <p class="more-info" data-bind="moreinfo"></p>
@@ -0,0 +1 @@
1
+ <iframe data-bind-src="url" frameborder=0></iframe>
@@ -0,0 +1 @@
1
+ <img data-bind-src="image | prepend '/assets'" data-bind-width="width"/>
@@ -0,0 +1,18 @@
1
+ <h1 class="title" data-bind="title"></h1>
2
+
3
+ <ol>
4
+ <li data-foreach-item="items">
5
+ <span class="label" data-bind="item.label"></span>
6
+ <span class="value" data-bind="item.value"></span>
7
+ </li>
8
+ </ol>
9
+
10
+ <ul class="list-nostyle">
11
+ <li data-foreach-item="items">
12
+ <span class="label" data-bind="item.label"></span>
13
+ <span class="value" data-bind="item.value"></span>
14
+ </li>
15
+ </ul>
16
+
17
+ <p class="more-info" data-bind="moreinfo"></p>
18
+ <p class="updated-at" data-bind="updatedAtMessage"></p>
@@ -0,0 +1,7 @@
1
+ <h1 class="title" data-bind="title"></h1>
2
+
3
+ <input class="meter" data-angleOffset=-125 data-angleArc=250 data-width=200 data-readOnly=true data-bind-value="value | shortenedNumber" data-bind-data-min="min" data-bind-data-max="max">
4
+
5
+ <p class="more-info" data-bind="moreinfo"></p>
6
+
7
+ <p class="updated-at" data-bind="updatedAtMessage"></p>
@@ -0,0 +1,11 @@
1
+ <h1 class="title" data-bind="title"></h1>
2
+
3
+ <h2 class="value" data-bind="current | shortenedNumber | prepend prefix | append suffix"></h2>
4
+
5
+ <p class="change-rate">
6
+ <i data-bind-class="arrow"></i><span data-bind="difference"></span>
7
+ </p>
8
+
9
+ <p class="more-info" data-bind="moreinfo"></p>
10
+
11
+ <p class="updated-at" data-bind="updatedAtMessage"></p>
@@ -0,0 +1,7 @@
1
+ <h1 class="title" data-bind="title"></h1>
2
+
3
+ <h3 data-bind="text"></h3>
4
+
5
+ <p class="more-info" data-bind="moreinfo"></p>
6
+
7
+ <p class="updated-at" data-bind="updatedAtMessage"></p>
data/bin/rails ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
3
+
4
+ ENGINE_ROOT = File.expand_path('../..', __FILE__)
5
+ ENGINE_PATH = File.expand_path('../../lib/my_dashboard/engine', __FILE__)
6
+
7
+ require 'rails/all'
8
+ require 'rails/engine/commands'
data/config/routes.rb ADDED
@@ -0,0 +1,15 @@
1
+ MyDashboard::Engine.routes.draw do
2
+
3
+ resources :events, only: :index
4
+
5
+ resources :dashboards, only: :index do
6
+ get '/:name', action: :show, on: :collection
7
+ end
8
+
9
+ resources :widgets, only: [] do
10
+ get '/:name', action: :show, on: :collection
11
+ put '/:name', action: :update, on: :collection
12
+ end
13
+
14
+ root to: 'dashboards#index'
15
+ end
@@ -0,0 +1,36 @@
1
+ module MyDashboard
2
+ module Generators
3
+ class InstallGenerator < ::Rails::Generators::Base
4
+
5
+ source_root File.expand_path('../../templates', __FILE__)
6
+
7
+ desc 'Creates a MyDashboard initializer for your application.'
8
+
9
+ def install
10
+ route 'mount MyDashboard::Engine, at: MyDashboard.config.engine_path'
11
+ end
12
+
13
+ def copy_initializer
14
+ template 'initializer.rb', 'config/initializers/my_dashboard.rb'
15
+ end
16
+
17
+ def copy_layout
18
+ template 'layouts/dashboard.html.erb', 'app/views/layouts/my_dashboard/dashboard.html.erb'
19
+ end
20
+
21
+ def copy_dashboard
22
+ template 'dashboards/sample.html.erb', 'app/views/my_dashboard/dashboards/sample.html.erb'
23
+ end
24
+
25
+ def copy_widget_manifests
26
+ template 'widgets/index.css', 'app/assets/stylesheets/my_dashboard/widgets/index.css'
27
+ template 'widgets/index.js', 'app/assets/javascripts/my_dashboard/widgets/index.js'
28
+ end
29
+
30
+ def copy_job
31
+ template 'jobs/sample.rb', 'app/jobs/sample.rb'
32
+ end
33
+
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,15 @@
1
+ module MyDashboard
2
+ module Generators
3
+ class JobGenerator < ::Rails::Generators::NamedBase
4
+
5
+ source_root File.expand_path('../../templates', __FILE__)
6
+
7
+ desc 'Creates a new MyDashboard job.'
8
+
9
+ def job
10
+ template 'jobs/new.rb', "app/jobs/#{file_name}.rb"
11
+ end
12
+
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,17 @@
1
+ module MyDashboard
2
+ module Generators
3
+ class WidgetGenerator < ::Rails::Generators::NamedBase
4
+
5
+ source_root File.expand_path('../../templates', __FILE__)
6
+
7
+ desc 'Creates a new MyDashboard widget.'
8
+
9
+ def widget
10
+ template 'widgets/new.html', MyDashboard.config.widgets_views_path.join("#{file_name}.html")
11
+ template 'widgets/new.scss', MyDashboard.config.widgets_css_path.join('widgets', "#{file_name}.scss")
12
+ template 'widgets/new.coffee', MyDashboard.config.widgets_js_path.join('widgets', "#{file_name}.coffee")
13
+ end
14
+
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,28 @@
1
+ <% content_for :title do %>
2
+ My dashboard, so cool!
3
+ <% end %>
4
+
5
+ <div class="gridster">
6
+ <ul>
7
+ <li data-row="1" data-col="1" data-sizex="2" data-sizey="1">
8
+ <div data-id="welcome" data-view="Text" data-title="HUEHUE" data-text="MyDashboard is awesome!." data-moreinfo="Protip: You can drag the widgets around!"></div>
9
+ </li>
10
+
11
+ <li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
12
+ <div data-id="synergy" data-view="Meter" data-title="Synergy" data-min="0" data-max="100"></div>
13
+ </li>
14
+
15
+ <li data-row="1" data-col="1" data-sizex="1" data-sizey="2">
16
+ <div data-id="buzzwords" data-view="List" data-unordered="true" data-title="Buzzwords" data-moreinfo="# of times said around the office"></div>
17
+ </li>
18
+
19
+ <li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
20
+ <div data-id="valuation" data-view="Number" data-title="Current Valuation" data-moreinfo="In billions" data-prefix="$"></div>
21
+ </li>
22
+
23
+ <li data-row="1" data-col="1" data-sizex="2" data-sizey="1">
24
+ <div data-id="convergence" data-view="Graph" data-title="Convergence" style="background-color:#ff9618"></div>
25
+ </li>
26
+ </ul>
27
+ <center><div style="font-size: 12px">Try this: curl -X PUT 'http://<%= request.host %>:<%= request.port %>/my_dashboard/widgets/welcome' --data "widget%5Btext%5D=MyDashboard+is+awesomecurl"</div></center>
28
+ </div>
@@ -0,0 +1,58 @@
1
+ # Use this hook to configure MyDashboard bahaviors.
2
+ MyDashboard.configure do |config|
3
+ # Scheduler instance.
4
+ # config.scheduler = ::Rufus::Scheduler.new
5
+
6
+ # Redis credentials.
7
+ # See https://devcenter.heroku.com/articles/redistogo to configure redis for heroku.
8
+ # config.redis_host = '127.0.0.1'
9
+ # config.redis_port = '6379'
10
+ # config.redis_password = nil
11
+ # config.redis_timeout = 3
12
+
13
+ # Redis namespace when pushing new data.
14
+ # config.redis_namespace = 'my_dashboard_events'
15
+
16
+ # MyDashboard come with default widgets using css and coffeescript.
17
+ # You can create your own widgets by adding the following files:
18
+ #
19
+ # A widget is composed of:
20
+ # - an HTML file used for layout and bindings - app/views/my_dashboard/widgets/foo.html
21
+ # - a SCSS file for styles - app/assets/stylesheets/my_dashboard/widgets/foo.scss
22
+ # - a coffeescript file which allows you to handle incoming data & functionality - app/assets/javascripts/my_dashboard/widgets/foo.coffee
23
+ #
24
+ # CSS and JS file will be added to the asset path and the asset pipeline automatically.
25
+ #
26
+ # More information at http://shopify.github.io/dashing/
27
+ #
28
+ # You can change default views and assets paths with the following config:
29
+ #
30
+ # config.widgets_views_path = Rails.root.join('app', 'views', 'my_dashboard', 'widgets')
31
+ # config.widgets_js_path = Rails.root.join('app', 'assets', 'javascripts', 'my_dashboard')
32
+ # config.widgets_css_path = Rails.root.join('app', 'assets', 'stylesheets', 'my_dashboard')
33
+
34
+ # rufus-scheduler worker path
35
+ # config.jobs_path = Rails.root.join('app', 'jobs')
36
+
37
+ # Engine path to use for accessing engine's routes.
38
+ # Ex: http://your_app/my_dashboard/dashboard/my_dashboard_name
39
+ # config.engine_path = '/my_dashboard'
40
+
41
+ # The dashboards views path used to find dashboards.
42
+ # config.dashboards_views_path = Rails.root.join('app', 'views', 'my_dashboard', 'dashboards')
43
+
44
+ # The MyDashboard layout used to display metrics.
45
+ # config.dashboard_layout_path = 'my_dashboard/dashboard'
46
+
47
+ # Default dashboard name to load when going to /my_dashboard/dashboards
48
+ # config.default_dashboard = nil
49
+
50
+ # A secure random string to authenticate with for curl requests.
51
+ # Put nil if you don't want to use authentication.
52
+ # You can use SecureRandom.hex to generate a hex.
53
+ # config.auth_token = nil
54
+
55
+ # List of Devise models that should access the whole dashboard.
56
+ # List the models. E.g: '[:user, :admin]'
57
+ # config.devise_allowed_models = []
58
+ end
@@ -0,0 +1,3 @@
1
+ MyDashboard.scheduler.every '1s' do
2
+ MyDashboard.send_event('widget_id', { value: rand(100) })
3
+ end
@@ -0,0 +1,9 @@
1
+ current_valuation = 0
2
+
3
+ MyDashboard.scheduler.every '2s' do
4
+ last_valuation = current_valuation
5
+ current_valuation = rand(100)
6
+
7
+ MyDashboard.send_event('valuation', { current: current_valuation, last: last_valuation })
8
+ MyDashboard.send_event('synergy', { value: rand(100) })
9
+ end
@@ -0,0 +1,30 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8"/>
5
+ <meta name="description" content="">
6
+ <meta name="viewport" content="width=device-width">
7
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
8
+
9
+ <title><%%= yield :title %></title>
10
+
11
+ <%%= javascript_include_tag 'my_dashboard/application' %>
12
+ <%%= stylesheet_link_tag 'my_dashboard/application' %>
13
+
14
+ <link href='http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700' rel='stylesheet' type='text/css'>
15
+ <link rel="icon" href="/favicon.ico">
16
+ </head>
17
+ <body>
18
+ <div id="container">
19
+ <%%= yield %>
20
+ </div>
21
+
22
+ <%% if Rails.env.development? %>
23
+ <div id="saving-instructions">
24
+ <p>Paste the following at the top of <i><%%= params[:dashboard] %>.erb</i></p>
25
+ <textarea id="gridster-code"></textarea>
26
+ </div>
27
+ <a href="#saving-instructions" id="save-gridster">Save this layout</a>
28
+ <%% end %>
29
+ </body>
30
+ </html>
@@ -0,0 +1,12 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_tree .
12
+ */
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,9 @@
1
+ class MyDashboard.<%= class_name.capitalize %> extends MyDashboard.Widget
2
+
3
+ ready: ->
4
+ # This is fired when the widget is done being rendered
5
+
6
+ onData: (data) ->
7
+ # Handle incoming data
8
+ # You can access the html node of this widget with `@node`
9
+ # Example: $(@node).fadeOut().fadeIn() will make the node flash each time data comes in.