dashing-hotness 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
@@ -0,0 +1,3 @@
1
+ ## 1.0.0
2
+
3
+ * First stable version
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in dashing-hotness.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Pierre-Louis Gottfrois
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,71 @@
1
+ # Dashing::Hotness
2
+
3
+ [Dashing-Rails](https://github.com/gottfrois/dashing-rails) widget that changes the widget's color depending on the value displayed.
4
+
5
+ <img src="http://dashboarddude.com/images/posts/dashing-hotness-widget/cool.png" width="200">
6
+
7
+ ## Installation
8
+
9
+ Add this line to your [Dashing-Rails](https://github.com/gottfrois/dashing-rails) application's Gemfile:
10
+
11
+ gem 'dashing-hotness'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ ## Getting Started
18
+
19
+ Follow the following steps in order to make it work on your dashing-rails project:
20
+
21
+ 1. Add the following line to your `app/assets/javascripts/dashing/widgets/index.js` file:
22
+
23
+ //= require hotness
24
+
25
+ 2. Add the following line to your `app/assets/stylesheets/dashing/widgets/index.css` file:
26
+
27
+ *= require hotness
28
+
29
+ 3. Add the following html to your dashboard:
30
+
31
+ <li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
32
+ <div data-id="your_id" data-view="Hotness" data-title="Hotness Widget Title" data-cool="0" data-warm="100"></div>
33
+ </li>
34
+
35
+ *Note: the paths to index files may have changed depending on your Dashing-Rails configuration.*
36
+
37
+ ### Fields
38
+
39
+ #### Required
40
+
41
+ * `data-id`: Like all widgets, you must include an identifier so that your jobs can update the value.
42
+ * `data-cool`: Anything below this value will show the 'cold' colour. It should be set high enough to include all the 'good' range of value for this metric.
43
+ * `data-warm`: Anything above this value will show the 'hot' colour. It should be set just below the 'bad' range of value for this metric - ie. those that need attention!
44
+
45
+ ##### Not Required
46
+
47
+ * `data-title`: Optional title to show in the widget box (above the value).
48
+ * `data-prefix`: Optional prefix to the value.
49
+ * `data-suffix`: Optional suffix to the value.
50
+
51
+ ### Colors
52
+
53
+ The default colour scheme is [Sweet Lolly](http://www.colourlovers.com/palette/56122/Sweet_Lolly) by [nekyo](http://www.colourlovers.com/lover/nekoyo).
54
+
55
+ ## Contributing
56
+
57
+ 1. Fork it
58
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
59
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
60
+ 4. Push to the branch (`git push origin my-new-feature`)
61
+ 5. Create new Pull Request
62
+
63
+ ## Author
64
+
65
+ Full credits for this widget should go to [Rowan](http://dashboarddude.com/). Please read his [blog post](http://dashboarddude.com/blog/2013/08/16/dashing-dashboard-widget-challenge-the-hotness/) for more informations about the widget.
66
+
67
+ ## License
68
+
69
+ The colour schemes and this widget are licensed under a [Creative Commons Attribution-NonCommercial-ShareAlike 3.0](http://creativecommons.org/licenses/by-nc-sa/3.0/) license.
70
+
71
+ <img src="http://mirrors.creativecommons.org/presskit/buttons/88x31/png/by-nc-sa.png" width="100">
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,3 @@
1
+ <h1 class="title" data-bind="title"></h1>
2
+ <h2 class="value" data-bind="value | shortenedNumber | prepend prefix | append suffix"></h2>
3
+ <p class="updated-at" data-bind="updatedAtMessage"></p>
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'dashing/hotness/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "dashing-hotness"
8
+ spec.version = Dashing::Hotness::VERSION
9
+ spec.authors = ["Pierre-Louis Gottfrois"]
10
+ spec.email = ["pierrelouis.gottfrois@gmail.com"]
11
+ spec.description = %q{Dashing widget that changes the widget's color depending on the value displayed}
12
+ spec.summary = %q{Dashing widget that changes the widget's color depending on the value displayed}
13
+ spec.homepage = "https://github.com/gottfrois/dashing-hotness"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ end
@@ -0,0 +1,8 @@
1
+ require 'dashing/hotness/version'
2
+
3
+ module Dashing
4
+ module Hotness
5
+ end
6
+ end
7
+
8
+ require 'dashing/hotness/engine'
@@ -0,0 +1,11 @@
1
+ module Dashing
2
+ module Hotness
3
+ class Engine < ::Rails::Engine
4
+
5
+ config.assets.paths.unshift Dashing::Hotness::Engine.root.join('vendor', 'assets', 'javascripts', 'dashing')
6
+ config.assets.paths.unshift Dashing::Hotness::Engine.root.join('vendor', 'assets', 'stylesheets', 'dashing')
7
+ config.paths['app/views'].unshift Dashing::Hotness::Engine.root.join('app', 'views', 'dashing', 'hotness')
8
+
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ module Dashing
2
+ module Hotness
3
+ VERSION = '1.0.0'
4
+ end
5
+ end
@@ -0,0 +1,23 @@
1
+ class Dashing.Hotness extends Dashing.Widget
2
+
3
+ @accessor 'value', Dashing.AnimatedValue
4
+
5
+ constructor: ->
6
+ super
7
+
8
+ onData: (data) ->
9
+ node = $(@node)
10
+ value = parseInt data.value
11
+ cool = parseInt node.data "cool"
12
+ warm = parseInt node.data "warm"
13
+ level = switch
14
+ when value <= cool then 0
15
+ when value >= warm then 4
16
+ else
17
+ bucketSize = (warm - cool) / 3 # Total # of colours in middle
18
+ Math.ceil (value - cool) / bucketSize
19
+
20
+ backgroundClass = "hotness#{level}"
21
+ lastClass = @get "lastClass"
22
+ node.toggleClass "#{lastClass} #{backgroundClass}"
23
+ @set "lastClass", backgroundClass
@@ -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,52 @@
1
+ // ----------------------------------------------------------------------------
2
+ // Mixins
3
+ // ----------------------------------------------------------------------------
4
+ @mixin transition($transition-property, $transition-time, $method) {
5
+ -webkit-transition: $transition-property $transition-time $method;
6
+ -moz-transition: $transition-property $transition-time $method;
7
+ -o-transition: $transition-property $transition-time $method;
8
+ transition: $transition-property $transition-time $method;
9
+ }
10
+
11
+ // ----------------------------------------------------------------------------
12
+ // Sass declarations
13
+ // ----------------------------------------------------------------------------
14
+ $background-color: #000000;
15
+ $value-color: #FFFFFF;
16
+ $title-color: rgba(255, 255, 255, 0.7);
17
+ $updated-at-color: rgba(0, 0, 0, 0.3);
18
+
19
+ // ----------------------------------------------------------------------------
20
+ // Widget-hotness styles
21
+ // ----------------------------------------------------------------------------
22
+ .widget-hotness {
23
+
24
+ background-color: $background-color;
25
+ @include transition(background-color, 1s, linear);
26
+
27
+ .title {
28
+ color: $title-color;
29
+ }
30
+
31
+ .value {
32
+ color: $value-color;
33
+ }
34
+
35
+ .updated-at {
36
+ color: $updated-at-color;
37
+ }
38
+
39
+ }
40
+
41
+ .hotness0 { background-color: #00C176; }
42
+ .hotness1 { background-color: #88C100; }
43
+ .hotness2 { background-color: #FABE28; }
44
+ .hotness3 { background-color: #FF8A00; }
45
+ .hotness4 { background-color: #FF003C; }
46
+
47
+ // // More colour-blind friendly palette
48
+ // .hotness0 { background-color: #046D8B; }
49
+ // .hotness1 { background-color: #309292; }
50
+ // .hotness2 { background-color: #2FB8AC; }
51
+ // .hotness3 { background-color: #93A42A; }
52
+ // .hotness4 { background-color: #ECBE13; }
@@ -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
+ */
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dashing-hotness
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Pierre-Louis Gottfrois
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-11-01 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.3'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: Dashing widget that changes the widget's color depending on the value
47
+ displayed
48
+ email:
49
+ - pierrelouis.gottfrois@gmail.com
50
+ executables: []
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - .gitignore
55
+ - CHANGELOG.md
56
+ - Gemfile
57
+ - LICENSE.txt
58
+ - README.md
59
+ - Rakefile
60
+ - app/views/dashing/hotness/hotness.html
61
+ - dashing-hotness.gemspec
62
+ - lib/dashing/hotness.rb
63
+ - lib/dashing/hotness/engine.rb
64
+ - lib/dashing/hotness/version.rb
65
+ - vendor/assets/javascripts/dashing/hotness/hotness.coffee
66
+ - vendor/assets/javascripts/dashing/hotness/index.js
67
+ - vendor/assets/stylesheets/dashing/hotness/hotness.scss
68
+ - vendor/assets/stylesheets/dashing/hotness/index.css
69
+ homepage: https://github.com/gottfrois/dashing-hotness
70
+ licenses:
71
+ - MIT
72
+ post_install_message:
73
+ rdoc_options: []
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ! '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ segments:
83
+ - 0
84
+ hash: -4308211690312547730
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ! '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ segments:
92
+ - 0
93
+ hash: -4308211690312547730
94
+ requirements: []
95
+ rubyforge_project:
96
+ rubygems_version: 1.8.25
97
+ signing_key:
98
+ specification_version: 3
99
+ summary: Dashing widget that changes the widget's color depending on the value displayed
100
+ test_files: []