summaryrefslogtreecommitdiff
path: root/templates/project/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'templates/project/widgets')
-rw-r--r--templates/project/widgets/clock/clock.coffee18
-rw-r--r--templates/project/widgets/clock/clock.html2
-rw-r--r--templates/project/widgets/clock/clock.scss13
-rw-r--r--templates/project/widgets/comments/comments.coffee24
-rw-r--r--templates/project/widgets/comments/comments.html7
-rw-r--r--templates/project/widgets/comments/comments.scss33
-rw-r--r--templates/project/widgets/graph/graph.coffee37
-rw-r--r--templates/project/widgets/graph/graph.html5
-rw-r--r--templates/project/widgets/graph/graph.scss65
-rw-r--r--templates/project/widgets/iframe/iframe.coffee9
-rw-r--r--templates/project/widgets/iframe/iframe.html1
-rw-r--r--templates/project/widgets/iframe/iframe.scss8
-rw-r--r--templates/project/widgets/image/image.coffee9
-rw-r--r--templates/project/widgets/image/image.html1
-rw-r--r--templates/project/widgets/image/image.scss13
-rw-r--r--templates/project/widgets/list/list.coffee6
-rw-r--r--templates/project/widgets/list/list.html18
-rw-r--r--templates/project/widgets/list/list.scss60
-rw-r--r--templates/project/widgets/meter/meter.coffee14
-rw-r--r--templates/project/widgets/meter/meter.html7
-rw-r--r--templates/project/widgets/meter/meter.scss35
-rw-r--r--templates/project/widgets/number/number.coffee24
-rw-r--r--templates/project/widgets/number/number.html11
-rw-r--r--templates/project/widgets/number/number.scss39
-rw-r--r--templates/project/widgets/text/text.coffee1
-rw-r--r--templates/project/widgets/text/text.html7
-rw-r--r--templates/project/widgets/text/text.scss32
27 files changed, 499 insertions, 0 deletions
diff --git a/templates/project/widgets/clock/clock.coffee b/templates/project/widgets/clock/clock.coffee
new file mode 100644
index 0000000..cd6b116
--- /dev/null
+++ b/templates/project/widgets/clock/clock.coffee
@@ -0,0 +1,18 @@
+class Dashing.Clock extends Dashing.Widget
+
+ ready: ->
+ setInterval(@startTime, 500)
+
+ startTime: =>
+ today = new Date()
+
+ h = today.getHours()
+ m = today.getMinutes()
+ s = today.getSeconds()
+ m = @formatTime(m)
+ s = @formatTime(s)
+ @set('time', h + ":" + m + ":" + s)
+ @set('date', today.toDateString())
+
+ formatTime: (i) ->
+ if i < 10 then "0" + i else i \ No newline at end of file
diff --git a/templates/project/widgets/clock/clock.html b/templates/project/widgets/clock/clock.html
new file mode 100644
index 0000000..06759d4
--- /dev/null
+++ b/templates/project/widgets/clock/clock.html
@@ -0,0 +1,2 @@
+<h1 data-bind="date"></h1>
+<h2 data-bind="time"></h2> \ No newline at end of file
diff --git a/templates/project/widgets/clock/clock.scss b/templates/project/widgets/clock/clock.scss
new file mode 100644
index 0000000..19e91bf
--- /dev/null
+++ b/templates/project/widgets/clock/clock.scss
@@ -0,0 +1,13 @@
+// ----------------------------------------------------------------------------
+// Sass declarations
+// ----------------------------------------------------------------------------
+$background-color: #dc5945;
+
+// ----------------------------------------------------------------------------
+// Widget-clock styles
+// ----------------------------------------------------------------------------
+.widget-clock {
+
+ background-color: $background-color;
+
+}
diff --git a/templates/project/widgets/comments/comments.coffee b/templates/project/widgets/comments/comments.coffee
new file mode 100644
index 0000000..ff659ec
--- /dev/null
+++ b/templates/project/widgets/comments/comments.coffee
@@ -0,0 +1,24 @@
+class Dashing.Comments extends Dashing.Widget
+
+ @accessor 'quote', ->
+ "“#{@get('current_comment')?.body}”"
+
+ ready: ->
+ @currentIndex = 0
+ @commentElem = $(@node).find('.comment-container')
+ @nextComment()
+ @startCarousel()
+
+ onData: (data) ->
+ @currentIndex = 0
+
+ startCarousel: ->
+ setInterval(@nextComment, 8000)
+
+ nextComment: =>
+ comments = @get('comments')
+ if comments
+ @commentElem.fadeOut =>
+ @currentIndex = (@currentIndex + 1) % comments.length
+ @set 'current_comment', comments[@currentIndex]
+ @commentElem.fadeIn()
diff --git a/templates/project/widgets/comments/comments.html b/templates/project/widgets/comments/comments.html
new file mode 100644
index 0000000..7c580be
--- /dev/null
+++ b/templates/project/widgets/comments/comments.html
@@ -0,0 +1,7 @@
+<h1 class="title" data-bind="title"></h1>
+<div class="comment-container">
+ <h3><img data-bind-src='current_comment.avatar'/><span data-bind='current_comment.name' class="name"></span></h3>
+ <p class="comment" data-bind='quote'></p>
+</div>
+
+<p class="more-info" data-bind="moreinfo"></p>
diff --git a/templates/project/widgets/comments/comments.scss b/templates/project/widgets/comments/comments.scss
new file mode 100644
index 0000000..2ace30e
--- /dev/null
+++ b/templates/project/widgets/comments/comments.scss
@@ -0,0 +1,33 @@
+// ----------------------------------------------------------------------------
+// Sass declarations
+// ----------------------------------------------------------------------------
+$background-color: #eb9c3c;
+
+$title-color: rgba(255, 255, 255, 0.7);
+$moreinfo-color: rgba(255, 255, 255, 0.7);
+
+// ----------------------------------------------------------------------------
+// Widget-comment styles
+// ----------------------------------------------------------------------------
+.widget-comments {
+
+ background-color: $background-color;
+
+ .title {
+ color: $title-color;
+ margin-bottom: 15px;
+ }
+
+ .name {
+ padding-left: 5px;
+ }
+
+ .comment-container {
+ display: none;
+ }
+
+ .more-info {
+ color: $moreinfo-color;
+ }
+
+}
diff --git a/templates/project/widgets/graph/graph.coffee b/templates/project/widgets/graph/graph.coffee
new file mode 100644
index 0000000..5d6b9ab
--- /dev/null
+++ b/templates/project/widgets/graph/graph.coffee
@@ -0,0 +1,37 @@
+class Dashing.Graph extends Dashing.Widget
+
+ @accessor 'current', ->
+ return @get('displayedValue') if @get('displayedValue')
+ points = @get('points')
+ if points
+ points[points.length - 1].y
+
+ ready: ->
+ container = $(@node).parent()
+ # Gross hacks. Let's fix this.
+ width = (Dashing.widget_base_dimensions[0] * container.data("sizex")) + Dashing.widget_margins[0] * 2 * (container.data("sizex") - 1)
+ height = (Dashing.widget_base_dimensions[1] * container.data("sizey"))
+ @graph = new Rickshaw.Graph(
+ element: @node
+ width: width
+ height: height
+ renderer: @get("graphtype")
+ series: [
+ {
+ color: "#fff",
+ data: [{x:0, y:0}]
+ }
+ ]
+ padding: {top: 0.02, left: 0.02, right: 0.02, bottom: 0.02}
+ )
+
+ @graph.series[0].data = @get('points') if @get('points')
+
+ x_axis = new Rickshaw.Graph.Axis.Time(graph: @graph)
+ y_axis = new Rickshaw.Graph.Axis.Y(graph: @graph, tickFormat: Rickshaw.Fixtures.Number.formatKMBT)
+ @graph.render()
+
+ onData: (data) ->
+ if @graph
+ @graph.series[0].data = data.points
+ @graph.render()
diff --git a/templates/project/widgets/graph/graph.html b/templates/project/widgets/graph/graph.html
new file mode 100644
index 0000000..786bbb7
--- /dev/null
+++ b/templates/project/widgets/graph/graph.html
@@ -0,0 +1,5 @@
+<h1 class="title" data-bind="title"></h1>
+
+<h2 class="value" data-bind="current | prettyNumber | prepend prefix | append suffix"></h2>
+
+<p class="more-info" data-bind="moreinfo"></p>
diff --git a/templates/project/widgets/graph/graph.scss b/templates/project/widgets/graph/graph.scss
new file mode 100644
index 0000000..1000b6f
--- /dev/null
+++ b/templates/project/widgets/graph/graph.scss
@@ -0,0 +1,65 @@
+// ----------------------------------------------------------------------------
+// Sass declarations
+// ----------------------------------------------------------------------------
+$background-color: #dc5945;
+
+$title-color: rgba(255, 255, 255, 0.7);
+$moreinfo-color: rgba(255, 255, 255, 0.3);
+$tick-color: rgba(0, 0, 0, 0.4);
+
+
+// ----------------------------------------------------------------------------
+// Widget-graph styles
+// ----------------------------------------------------------------------------
+.widget-graph {
+
+ background-color: $background-color;
+ position: relative;
+
+
+ svg {
+ position: absolute;
+ opacity: 0.4;
+ fill-opacity: 0.4;
+ left: 0px;
+ top: 0px;
+ }
+
+ .title, .value {
+ position: relative;
+ z-index: 99;
+ }
+
+ .title {
+ color: $title-color;
+ }
+
+ .more-info {
+ color: $moreinfo-color;
+ font-weight: 600;
+ font-size: 20px;
+ margin-top: 0;
+ }
+
+ .x_tick {
+ position: absolute;
+ bottom: 0;
+ .title {
+ font-size: 20px;
+ color: $tick-color;
+ opacity: 0.5;
+ padding-bottom: 3px;
+ }
+ }
+
+ .y_ticks {
+ font-size: 20px;
+ fill: $tick-color;
+ fill-opacity: 1;
+ }
+
+ .domain {
+ display: none;
+ }
+
+}
diff --git a/templates/project/widgets/iframe/iframe.coffee b/templates/project/widgets/iframe/iframe.coffee
new file mode 100644
index 0000000..e3ee947
--- /dev/null
+++ b/templates/project/widgets/iframe/iframe.coffee
@@ -0,0 +1,9 @@
+class Dashing.Iframe extends Dashing.Widget
+
+ ready: ->
+ # This is fired when the widget is done being rendered
+
+ onData: (data) ->
+ # Handle incoming data
+ # You can access the html node of this widget with `@node`
+ # Example: $(@node).fadeOut().fadeIn() will make the node flash each time data comes in.
diff --git a/templates/project/widgets/iframe/iframe.html b/templates/project/widgets/iframe/iframe.html
new file mode 100644
index 0000000..385f6da
--- /dev/null
+++ b/templates/project/widgets/iframe/iframe.html
@@ -0,0 +1 @@
+<iframe data-bind-src="url" frameborder=0></iframe>
diff --git a/templates/project/widgets/iframe/iframe.scss b/templates/project/widgets/iframe/iframe.scss
new file mode 100644
index 0000000..6827a1b
--- /dev/null
+++ b/templates/project/widgets/iframe/iframe.scss
@@ -0,0 +1,8 @@
+.widget-iframe {
+ padding: 3px 0px 0px 0px !important;
+
+ iframe {
+ width: 100%;
+ height: 100%;
+ }
+}
diff --git a/templates/project/widgets/image/image.coffee b/templates/project/widgets/image/image.coffee
new file mode 100644
index 0000000..c3892c0
--- /dev/null
+++ b/templates/project/widgets/image/image.coffee
@@ -0,0 +1,9 @@
+class Dashing.Image extends Dashing.Widget
+
+ ready: ->
+ # This is fired when the widget is done being rendered
+
+ onData: (data) ->
+ # Handle incoming data
+ # You can access the html node of this widget with `@node`
+ # Example: $(@node).fadeOut().fadeIn() will make the node flash each time data comes in.
diff --git a/templates/project/widgets/image/image.html b/templates/project/widgets/image/image.html
new file mode 100644
index 0000000..41a88eb
--- /dev/null
+++ b/templates/project/widgets/image/image.html
@@ -0,0 +1 @@
+<img data-bind-src="image | prepend '/assets'" data-bind-width="width"/>
diff --git a/templates/project/widgets/image/image.scss b/templates/project/widgets/image/image.scss
new file mode 100644
index 0000000..0b1a316
--- /dev/null
+++ b/templates/project/widgets/image/image.scss
@@ -0,0 +1,13 @@
+// ----------------------------------------------------------------------------
+// Sass declarations
+// ----------------------------------------------------------------------------
+$background-color: #4b4b4b;
+
+// ----------------------------------------------------------------------------
+// Widget-image styles
+// ----------------------------------------------------------------------------
+.widget-image {
+
+ background-color: $background-color;
+
+}
diff --git a/templates/project/widgets/list/list.coffee b/templates/project/widgets/list/list.coffee
new file mode 100644
index 0000000..0028073
--- /dev/null
+++ b/templates/project/widgets/list/list.coffee
@@ -0,0 +1,6 @@
+class Dashing.List extends Dashing.Widget
+ ready: ->
+ if @get('unordered')
+ $(@node).find('ol').remove()
+ else
+ $(@node).find('ul').remove()
diff --git a/templates/project/widgets/list/list.html b/templates/project/widgets/list/list.html
new file mode 100644
index 0000000..07e0471
--- /dev/null
+++ b/templates/project/widgets/list/list.html
@@ -0,0 +1,18 @@
+<h1 class="title" data-bind="title"></h1>
+
+<ol>
+ <li data-foreach-item="items">
+ <span class="label" data-bind="item.label"></span>
+ <span class="value" data-bind="item.value"></span>
+ </li>
+</ol>
+
+<ul class="list-nostyle">
+ <li data-foreach-item="items">
+ <span class="label" data-bind="item.label"></span>
+ <span class="value" data-bind="item.value"></span>
+ </li>
+</ul>
+
+<p class="more-info" data-bind="moreinfo"></p>
+<p class="updated-at" data-bind="updatedAtMessage"></p>
diff --git a/templates/project/widgets/list/list.scss b/templates/project/widgets/list/list.scss
new file mode 100644
index 0000000..bce7010
--- /dev/null
+++ b/templates/project/widgets/list/list.scss
@@ -0,0 +1,60 @@
+// ----------------------------------------------------------------------------
+// Sass declarations
+// ----------------------------------------------------------------------------
+$background-color: #12b0c5;
+$value-color: #fff;
+
+$title-color: rgba(255, 255, 255, 0.7);
+$label-color: rgba(255, 255, 255, 0.7);
+$moreinfo-color: rgba(255, 255, 255, 0.7);
+
+// ----------------------------------------------------------------------------
+// Widget-list styles
+// ----------------------------------------------------------------------------
+.widget-list {
+
+ background-color: $background-color;
+ vertical-align: top;
+
+ .title {
+ color: $title-color;
+ }
+
+ ol, ul {
+ margin: 0 15px;
+ text-align: left;
+ color: $label-color;
+ }
+
+ ol {
+ list-style-position: inside;
+ }
+
+ li {
+ margin-bottom: 5px;
+ }
+
+ .list-nostyle {
+ list-style: none;
+ }
+
+ .label {
+ color: $label-color;
+ }
+
+ .value {
+ float: right;
+ margin-left: 12px;
+ font-weight: 600;
+ color: $value-color;
+ }
+
+ .updated-at {
+ color: rgba(0, 0, 0, 0.3);
+ }
+
+ .more-info {
+ color: $moreinfo-color;
+ }
+
+}
diff --git a/templates/project/widgets/meter/meter.coffee b/templates/project/widgets/meter/meter.coffee
new file mode 100644
index 0000000..b823ec7
--- /dev/null
+++ b/templates/project/widgets/meter/meter.coffee
@@ -0,0 +1,14 @@
+class Dashing.Meter extends Dashing.Widget
+
+ @accessor 'value', Dashing.AnimatedValue
+
+ constructor: ->
+ super
+ @observe 'value', (value) ->
+ $(@node).find(".meter").val(value).trigger('change')
+
+ ready: ->
+ meter = $(@node).find(".meter")
+ meter.attr("data-bgcolor", meter.css("background-color"))
+ meter.attr("data-fgcolor", meter.css("color"))
+ meter.knob()
diff --git a/templates/project/widgets/meter/meter.html b/templates/project/widgets/meter/meter.html
new file mode 100644
index 0000000..72592fb
--- /dev/null
+++ b/templates/project/widgets/meter/meter.html
@@ -0,0 +1,7 @@
+<h1 class="title" data-bind="title"></h1>
+
+<input class="meter" data-angleOffset=-125 data-angleArc=250 data-bind-data-height="height | default 200" data-bind-data-width="width | default 200" data-readOnly=true data-bind-value="value | shortenedNumber | prepend prefix | append suffix" data-bind-data-min="min" data-bind-data-max="max">
+
+<p class="more-info" data-bind="moreinfo"></p>
+
+<p class="updated-at" data-bind="updatedAtMessage"></p>
diff --git a/templates/project/widgets/meter/meter.scss b/templates/project/widgets/meter/meter.scss
new file mode 100644
index 0000000..da9ff0b
--- /dev/null
+++ b/templates/project/widgets/meter/meter.scss
@@ -0,0 +1,35 @@
+// ----------------------------------------------------------------------------
+// Sass declarations
+// ----------------------------------------------------------------------------
+$background-color: #9c4274;
+
+$title-color: rgba(255, 255, 255, 0.7);
+$moreinfo-color: rgba(255, 255, 255, 0.3);
+
+$meter-background: darken($background-color, 15%);
+
+// ----------------------------------------------------------------------------
+// Widget-meter styles
+// ----------------------------------------------------------------------------
+.widget-meter {
+
+ background-color: $background-color;
+
+ input.meter {
+ background-color: $meter-background;
+ color: #fff;
+ }
+
+ .title {
+ color: $title-color;
+ }
+
+ .more-info {
+ color: $moreinfo-color;
+ }
+
+ .updated-at {
+ color: rgba(0, 0, 0, 0.3);
+ }
+
+}
diff --git a/templates/project/widgets/number/number.coffee b/templates/project/widgets/number/number.coffee
new file mode 100644
index 0000000..0e5950c
--- /dev/null
+++ b/templates/project/widgets/number/number.coffee
@@ -0,0 +1,24 @@
+class Dashing.Number extends Dashing.Widget
+ @accessor 'current', Dashing.AnimatedValue
+
+ @accessor 'difference', ->
+ if @get('last')
+ last = parseInt(@get('last'))
+ current = parseInt(@get('current'))
+ if last != 0
+ diff = Math.abs(Math.round((current - last) / last * 100))
+ "#{diff}%"
+ else
+ ""
+
+ @accessor 'arrow', ->
+ if @get('last')
+ if parseInt(@get('current')) > parseInt(@get('last')) then 'fa fa-arrow-up' else 'fa fa-arrow-down'
+
+ onData: (data) ->
+ if data.status
+ # clear existing "status-*" classes
+ $(@get('node')).attr 'class', (i,c) ->
+ c.replace /\bstatus-\S+/g, ''
+ # add new class
+ $(@get('node')).addClass "status-#{data.status}"
diff --git a/templates/project/widgets/number/number.html b/templates/project/widgets/number/number.html
new file mode 100644
index 0000000..c82e5f4
--- /dev/null
+++ b/templates/project/widgets/number/number.html
@@ -0,0 +1,11 @@
+<h1 class="title" data-bind="title"></h1>
+
+<h2 class="value" data-bind="current | shortenedNumber | prepend prefix | append suffix"></h2>
+
+<p class="change-rate">
+ <i data-bind-class="arrow"></i><span data-bind="difference"></span>
+</p>
+
+<p class="more-info" data-bind="moreinfo"></p>
+
+<p class="updated-at" data-bind="updatedAtMessage"></p>
diff --git a/templates/project/widgets/number/number.scss b/templates/project/widgets/number/number.scss
new file mode 100644
index 0000000..8875794
--- /dev/null
+++ b/templates/project/widgets/number/number.scss
@@ -0,0 +1,39 @@
+// ----------------------------------------------------------------------------
+// Sass declarations
+// ----------------------------------------------------------------------------
+$background-color: #47bbb3;
+$value-color: #fff;
+
+$title-color: rgba(255, 255, 255, 0.7);
+$moreinfo-color: rgba(255, 255, 255, 0.7);
+
+// ----------------------------------------------------------------------------
+// Widget-number styles
+// ----------------------------------------------------------------------------
+.widget-number {
+
+ background-color: $background-color;
+
+ .title {
+ color: $title-color;
+ }
+
+ .value {
+ color: $value-color;
+ }
+
+ .change-rate {
+ font-weight: 500;
+ font-size: 30px;
+ color: $value-color;
+ }
+
+ .more-info {
+ color: $moreinfo-color;
+ }
+
+ .updated-at {
+ color: rgba(0, 0, 0, 0.3);
+ }
+
+}
diff --git a/templates/project/widgets/text/text.coffee b/templates/project/widgets/text/text.coffee
new file mode 100644
index 0000000..1741d8b
--- /dev/null
+++ b/templates/project/widgets/text/text.coffee
@@ -0,0 +1 @@
+class Dashing.Text extends Dashing.Widget
diff --git a/templates/project/widgets/text/text.html b/templates/project/widgets/text/text.html
new file mode 100644
index 0000000..decd109
--- /dev/null
+++ b/templates/project/widgets/text/text.html
@@ -0,0 +1,7 @@
+<h1 class="title" data-bind="title"></h1>
+
+<h3 data-bind="text"></h3>
+
+<p class="more-info" data-bind="moreinfo"></p>
+
+<p class="updated-at" data-bind="updatedAtMessage"></p>
diff --git a/templates/project/widgets/text/text.scss b/templates/project/widgets/text/text.scss
new file mode 100644
index 0000000..45d790e
--- /dev/null
+++ b/templates/project/widgets/text/text.scss
@@ -0,0 +1,32 @@
+// ----------------------------------------------------------------------------
+// Sass declarations
+// ----------------------------------------------------------------------------
+$background-color: #ec663c;
+
+$title-color: rgba(255, 255, 255, 0.7);
+$moreinfo-color: rgba(255, 255, 255, 0.7);
+
+// ----------------------------------------------------------------------------
+// Widget-text styles
+// ----------------------------------------------------------------------------
+.widget-text {
+
+ background-color: $background-color;
+
+ .title {
+ color: $title-color;
+ }
+
+ .more-info {
+ color: $moreinfo-color;
+ }
+
+ .updated-at {
+ color: rgba(255, 255, 255, 0.7);
+ }
+
+
+ &.large h3 {
+ font-size: 65px;
+ }
+}