ende 0.0.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.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/WTFP-LICENSE +13 -0
- data/component.json +31 -0
- data/ende.gemspec +23 -0
- data/lib/assets/.gitkeep +0 -0
- data/lib/assets/javascripts/aura/extensions/devise.js.coffee +110 -0
- data/lib/assets/javascripts/aura/extensions/loader.js.coffee +48 -0
- data/lib/assets/javascripts/aura/extensions/mediator.js +98 -0
- data/lib/assets/javascripts/aura/extensions/models.js.coffee.erb +56 -0
- data/lib/assets/javascripts/aura/extensions/rivets.js.coffee +251 -0
- data/lib/assets/javascripts/aura/extensions/states.js.coffee +62 -0
- data/lib/assets/javascripts/aura/extensions/widget/eventable.js.coffee +66 -0
- data/lib/assets/javascripts/aura/extensions/widget/lifecycleable.js.coffee +75 -0
- data/lib/assets/javascripts/config/initializers/jquery.js.coffee +6 -0
- data/lib/assets/javascripts/config/initializers/load_components.js.coffee +73 -0
- data/lib/assets/javascripts/config/initializers/requirejs.js.coffee +3 -0
- data/lib/assets/javascripts/ende.js.coffee +1 -0
- data/lib/assets/javascripts/widgets/authenticator/main.js.coffee +95 -0
- data/lib/assets/javascripts/widgets/authenticator/presenter.js.coffee +35 -0
- data/lib/assets/javascripts/widgets/authenticator/states/default.html +7 -0
- data/lib/assets/javascripts/widgets/authenticator/states/index.js.coffee +3 -0
- data/lib/assets/javascripts/widgets/authenticator/states/passwords.html +6 -0
- data/lib/assets/javascripts/widgets/list/main.js.coffee +82 -0
- data/lib/assets/javascripts/widgets/list/presenter.js.coffee +34 -0
- data/lib/assets/javascripts/widgets/list/states/default.html +4 -0
- data/lib/assets/javascripts/widgets/list/states/index.js.coffee +2 -0
- data/lib/assets/javascripts/widgets/viewer/main.js.coffee +139 -0
- data/lib/assets/javascripts/widgets/viewer/presenter.js.coffee +54 -0
- data/lib/assets/javascripts/widgets/viewer/states/default.html +6 -0
- data/lib/assets/javascripts/widgets/viewer/states/index.js.coffee +2 -0
- data/lib/assets/stylesheets/application/modules/authenticator.css.styl +7 -0
- data/lib/assets/stylesheets/application/modules/widgets/structure/list.css.styl +9 -0
- data/lib/assets/stylesheets/application/modules/widgets/structure/viewer.css.styl +21 -0
- data/lib/assets/stylesheets/application/modules/widgets/structure/widget.css.styl +5 -0
- data/lib/assets/stylesheets/filter.styl +10 -0
- data/lib/assets/stylesheets/helpers/button.styl +61 -0
- data/lib/assets/stylesheets/helpers/general.styl +36 -0
- data/lib/assets/stylesheets/helpers/index.styl +4 -0
- data/lib/assets/stylesheets/helpers/link.styl +6 -0
- data/lib/assets/stylesheets/helpers/url.styl +5 -0
- data/lib/assets/stylesheets/modules/button.styl +42 -0
- data/lib/assets/stylesheets/sprite.styl +40 -0
- data/lib/assets/stylesheets/ssprites.styl +1 -0
- data/lib/ende/version.rb +3 -0
- data/lib/ende.rb +21 -0
- data/lib/tasks/.gitkeep +0 -0
- data/lib/tasks/component.thor +63 -0
- data/lib/tasks/sprite.thor +62 -0
- data/vendor/assets/javascripts/stampit/stampit.js +392 -0
- metadata +126 -0
@@ -0,0 +1,6 @@
|
|
1
|
+
<div class="message" data-html="recoverer.message"> </div>
|
2
|
+
<input type="email" data-value="recoverer.email" placeholder="Login">
|
3
|
+
<button data-on-click="recoverer.recover">
|
4
|
+
Send me reset password instructions
|
5
|
+
</button>
|
6
|
+
<a data-on-click="base.toggle_state">Efetuar login</a>
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# = require lunr/lunr
|
2
|
+
|
3
|
+
define ['./states/index', './presenter'], (templates, presenter) ->
|
4
|
+
|
5
|
+
# TODO move lunar and lunr to an extension
|
6
|
+
luna =
|
7
|
+
index : null
|
8
|
+
store : Map()
|
9
|
+
fields: ['name', 'description']
|
10
|
+
sandbox:
|
11
|
+
search:
|
12
|
+
index: lunr
|
13
|
+
initialize: (models) ->
|
14
|
+
throw 'no models provided' unless models?
|
15
|
+
|
16
|
+
@sample = models[0]
|
17
|
+
@index = @sandbox.search.index(@indexate)
|
18
|
+
|
19
|
+
for model in models
|
20
|
+
@index.add model
|
21
|
+
@store.set model._id, model
|
22
|
+
|
23
|
+
@store.all = models
|
24
|
+
|
25
|
+
# TODO put bold face on matched texts
|
26
|
+
search: (params...) ->
|
27
|
+
findings = @index.search params...
|
28
|
+
|
29
|
+
results = []
|
30
|
+
results.push @store.get finding.ref for finding in findings
|
31
|
+
|
32
|
+
@index.eventEmitter.emit 'searched', results
|
33
|
+
results
|
34
|
+
|
35
|
+
indexate: () ->
|
36
|
+
sample = luna.sample
|
37
|
+
fields = luna.fields
|
38
|
+
|
39
|
+
sample[name] and @field name for name in fields
|
40
|
+
@ref '_id'
|
41
|
+
true
|
42
|
+
|
43
|
+
|
44
|
+
# If some extension provides you can use the type defineda in there
|
45
|
+
# to extend your widget. Defaults to Base constructor.
|
46
|
+
#
|
47
|
+
# type: 'Base'
|
48
|
+
|
49
|
+
# Default values for the options passed to this widget
|
50
|
+
#
|
51
|
+
# Note: the options are passed thorught the html element data
|
52
|
+
# attributes for this widget: <div data-aura-amount="3"></div>
|
53
|
+
#
|
54
|
+
# options: {}
|
55
|
+
|
56
|
+
|
57
|
+
# Widget initialization method, will be called upon loading, options
|
58
|
+
# are already filled with defaults
|
59
|
+
initialize: (options) ->
|
60
|
+
widget = @
|
61
|
+
sandbox = @sandbox
|
62
|
+
sandbox.logger.log "initialized!"
|
63
|
+
|
64
|
+
model = sandbox.models[options.model]
|
65
|
+
|
66
|
+
# Will also initialize sandbox!
|
67
|
+
@html templates.default
|
68
|
+
@$el.addClass 'list widget'
|
69
|
+
|
70
|
+
# Forward the models to the presenter
|
71
|
+
|
72
|
+
model.all (records) ->
|
73
|
+
|
74
|
+
# Bind presenter to template
|
75
|
+
presentation = presenter records, luna
|
76
|
+
|
77
|
+
luna.initialize presentation.list.items
|
78
|
+
luna.index.on 'searched', (results) ->
|
79
|
+
sandbox.emit 'list.searched', results
|
80
|
+
|
81
|
+
|
82
|
+
sandbox.view.bind widget.$el.children(), presentation
|
@@ -0,0 +1,34 @@
|
|
1
|
+
'use strict'
|
2
|
+
observable = require('indefinido-observable').mixin
|
3
|
+
|
4
|
+
define (model) ->
|
5
|
+
|
6
|
+
(items, luna) ->
|
7
|
+
|
8
|
+
resource = items[0].resource
|
9
|
+
|
10
|
+
searcher: observable
|
11
|
+
query: ''
|
12
|
+
search: (event, models) ->
|
13
|
+
|
14
|
+
{list, searcher} = models
|
15
|
+
|
16
|
+
searcher.query = $(event.target).val()
|
17
|
+
|
18
|
+
if searcher.query != ''
|
19
|
+
list.items = luna.search searcher.query
|
20
|
+
else
|
21
|
+
list.items = luna.store.all
|
22
|
+
|
23
|
+
false
|
24
|
+
|
25
|
+
# TODO create view_model
|
26
|
+
list: observable Object.create null,
|
27
|
+
resource:
|
28
|
+
set: (resource) -> null
|
29
|
+
get: -> resource
|
30
|
+
configurable: true
|
31
|
+
items:
|
32
|
+
set: (new_items) -> items = new_items
|
33
|
+
get: -> items
|
34
|
+
configurable: true
|
@@ -0,0 +1,139 @@
|
|
1
|
+
define ['./states/index', './presenter'], (templates, presenter) ->
|
2
|
+
|
3
|
+
observable = require('observable').mixin
|
4
|
+
|
5
|
+
presentation = null
|
6
|
+
sandbox = null
|
7
|
+
|
8
|
+
handlers =
|
9
|
+
item:
|
10
|
+
clicked: (event, models) ->
|
11
|
+
models.item.selected = true
|
12
|
+
|
13
|
+
list:
|
14
|
+
stabilized: (selected) =>
|
15
|
+
viewer = presentation.viewer
|
16
|
+
viewer.items = []
|
17
|
+
presented_ids = []
|
18
|
+
|
19
|
+
# TODO generalise this filtering option
|
20
|
+
presented = for item in selected
|
21
|
+
item.models.all (records) =>
|
22
|
+
for record in records
|
23
|
+
viewer.items.push record if presented_ids.indexOf(record._id) == -1
|
24
|
+
|
25
|
+
presented_ids = _.union presented_ids, _.pluck(records, '_id')
|
26
|
+
|
27
|
+
$.when(presented...).then -> presented_ids = []
|
28
|
+
|
29
|
+
# If some extension provides you can use the type defined in there
|
30
|
+
# to extend your widget. Defaults to Base constructor.
|
31
|
+
#
|
32
|
+
# type: 'Base'
|
33
|
+
|
34
|
+
# Default values for the options passed to this widget
|
35
|
+
#
|
36
|
+
# Note: the options are passed thorught the html element data
|
37
|
+
# attributes for this widget: <div data-aura-widget="viewer" data-aura-amount="3"></div>
|
38
|
+
#
|
39
|
+
# options: {}
|
40
|
+
|
41
|
+
|
42
|
+
# Widget initialization method, will be called upon loading, options
|
43
|
+
# are already filled with defaults
|
44
|
+
initialize: (options) ->
|
45
|
+
model = @sandbox.models[options.model]
|
46
|
+
presentation = null
|
47
|
+
|
48
|
+
# Extend presentation
|
49
|
+
presenter._ = _ = @sandbox.util._
|
50
|
+
presenter.handlers = handlers
|
51
|
+
presenter.drawing = @sandbox.modacad.drawing
|
52
|
+
|
53
|
+
@sandbox.logger.log "initialized!"
|
54
|
+
|
55
|
+
# Initialize dependencies
|
56
|
+
list = ''
|
57
|
+
if options.listModel
|
58
|
+
list = "<div data-aura-widget=\"list\" data-model=\"#{options.listModel}\"></div>"
|
59
|
+
@sandbox.on 'list.stabilized' , handlers.list.stabilized
|
60
|
+
|
61
|
+
|
62
|
+
# Will also initialize sandbox!
|
63
|
+
@$el.addClass 'viewer widget'
|
64
|
+
@html list + templates.default
|
65
|
+
|
66
|
+
# Fetch default data
|
67
|
+
model.all (records) =>
|
68
|
+
presentation = presenter records
|
69
|
+
@bind presentation
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
true
|
74
|
+
|
75
|
+
# You can now update the presentation to update the widget
|
76
|
+
# presentation.title = 'Hello World!'
|
77
|
+
|
78
|
+
# Remember to access functionality and to provide your
|
79
|
+
# events throught the sandbox!
|
80
|
+
#
|
81
|
+
# Built-in properties of sandbox
|
82
|
+
#
|
83
|
+
# emit '{entity.name}.{event.name}.{entity.id}', handler_parameters...
|
84
|
+
# off name, listener
|
85
|
+
# on name, listener, context
|
86
|
+
# stopListening() # Remove all event handlers for this widget
|
87
|
+
#
|
88
|
+
# start ['calendar', 'payments'] # widgets_list
|
89
|
+
# stop() # Stop this widget and destroy its sandbox
|
90
|
+
#
|
91
|
+
# data.deferred() # Create a new deferred object
|
92
|
+
# data.when promises..., callback # Execute callback upon deferred resolution
|
93
|
+
# dom.data selector, [attribute] # Return object for selected element
|
94
|
+
# dom.find selector, context # Return framework maped dom element for
|
95
|
+
# # the selector (usually jQuery Object)
|
96
|
+
# events.bindAll context, functions... # Bind all functions to the same context
|
97
|
+
# events.listen context, events, selector, callback # Listen to dom events, all parameters are string, except callback
|
98
|
+
# template.parse
|
99
|
+
# util._ # UnderscoreJS like object
|
100
|
+
# util.decamelize camelCase, delimiter
|
101
|
+
# util.each object, callback, arguments
|
102
|
+
# util.extend objects...
|
103
|
+
# util.uniq array, isSorted, iterator, context
|
104
|
+
#
|
105
|
+
#
|
106
|
+
# e.g.: @sandbox.events.listen 'click', '.menu', (e) -> alert 'selected'
|
107
|
+
#
|
108
|
+
#
|
109
|
+
# Extensions properties of sandbox
|
110
|
+
#
|
111
|
+
# view.bind element, models # Bind DOM element to models (rivets extension)
|
112
|
+
#
|
113
|
+
#
|
114
|
+
# The sandbox should contain all extensions features, if the extension
|
115
|
+
# feature does not suite you and it's only needed by this widget,
|
116
|
+
# require it as dependency on the define call:
|
117
|
+
#
|
118
|
+
# define [ 'three' ], (three) ->
|
119
|
+
|
120
|
+
|
121
|
+
# Models access if needed, is also provided through the sandbox
|
122
|
+
# person = @sandbox.domain.person
|
123
|
+
#
|
124
|
+
# arthur = person({
|
125
|
+
# name: "Arthur Philip Dent",
|
126
|
+
# species : "Humam"
|
127
|
+
# });
|
128
|
+
#
|
129
|
+
|
130
|
+
# For the 'Base' type widget you can access some useful
|
131
|
+
# properties:
|
132
|
+
#
|
133
|
+
# @$el # Widgets HTML DOM Element
|
134
|
+
# @options # All options passed to this widget thorugh dom and merged defaults
|
135
|
+
# @html markup # Helper function to update widget template
|
136
|
+
#
|
137
|
+
# Also some extensions extend the Base widget:
|
138
|
+
#
|
139
|
+
# @bind models # Equivalent to @sandbox.view.bind @$el, models
|
@@ -0,0 +1,54 @@
|
|
1
|
+
'use strict'
|
2
|
+
define () ->
|
3
|
+
|
4
|
+
observable = require('observable').mixin
|
5
|
+
extend = require 'segmentio-extend'
|
6
|
+
self = null
|
7
|
+
view = null
|
8
|
+
|
9
|
+
|
10
|
+
normalizer =
|
11
|
+
normalize: (model) ->
|
12
|
+
observable extend
|
13
|
+
name : model.code
|
14
|
+
image : null
|
15
|
+
selected : false
|
16
|
+
model : model
|
17
|
+
normalized : true
|
18
|
+
, self.handlers.item
|
19
|
+
|
20
|
+
drawings: ->
|
21
|
+
selection = view.select (binding) ->
|
22
|
+
binding.keypath == 'items'
|
23
|
+
|
24
|
+
items_binding = selection[0]
|
25
|
+
|
26
|
+
for item_view in items_binding.iterated
|
27
|
+
selection = item_view.select (binding) ->
|
28
|
+
binding.keypath == 'image'
|
29
|
+
|
30
|
+
image_binding = selection[0]
|
31
|
+
drawing = self.drawing $(image_binding.el), image_binding.model.model
|
32
|
+
drawing.width = (parseInt(drawing.width ) / 4) + 'px'
|
33
|
+
drawing.height = (parseInt(drawing.height) / 4) + 'px'
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
self = (items) ->
|
38
|
+
|
39
|
+
# TODO create view_model
|
40
|
+
presentation =
|
41
|
+
presented: (v) -> view = v
|
42
|
+
viewer: observable
|
43
|
+
items: self._.map items, normalizer.normalize
|
44
|
+
|
45
|
+
presentation.viewer.subscribe 'items', (items) ->
|
46
|
+
for item in items
|
47
|
+
unless item.normalized
|
48
|
+
index = @items.indexOf item
|
49
|
+
console.debug item, item.code, item.name, index
|
50
|
+
@observed.items[index] = normalizer.normalize item
|
51
|
+
|
52
|
+
normalizer.drawings()
|
53
|
+
|
54
|
+
presentation
|
@@ -0,0 +1,21 @@
|
|
1
|
+
@import 'application/theme'
|
2
|
+
|
3
|
+
.viewer
|
4
|
+
.items
|
5
|
+
float left
|
6
|
+
|
7
|
+
padding 2%
|
8
|
+
margin 1%
|
9
|
+
border 1px solid primary-color
|
10
|
+
width 62%
|
11
|
+
|
12
|
+
.item
|
13
|
+
display inline-block
|
14
|
+
float left
|
15
|
+
|
16
|
+
&.selected
|
17
|
+
border 1px solid black
|
18
|
+
|
19
|
+
.list
|
20
|
+
float left
|
21
|
+
width 25%
|
@@ -0,0 +1,61 @@
|
|
1
|
+
@import 'nib'
|
2
|
+
|
3
|
+
primary-color ?= purple
|
4
|
+
success-color ?= green
|
5
|
+
danger-color ?= red
|
6
|
+
|
7
|
+
button-default-color ?= primary-color
|
8
|
+
button-success-color ?= success-color
|
9
|
+
button-danger-color ?= danger-color
|
10
|
+
button-disabled-color ?= grey
|
11
|
+
|
12
|
+
|
13
|
+
button-gradient-background(color, reverse = false)
|
14
|
+
if reverse
|
15
|
+
background-image linear-gradient(top, lighten(color,10%) 100%, darken(color,10%) 0%)
|
16
|
+
up-light = 0 2px 6px 0px rgba(#FFF,0.15) inset
|
17
|
+
else
|
18
|
+
background-image linear-gradient(top, lighten(color,10%) 0%, darken(color,10%) 100%)
|
19
|
+
up-light = 0 2px 6px 0px rgba(#FFF,0.25) inset
|
20
|
+
|
21
|
+
bevel = 0 3px 0px 0px darken(color,50%)
|
22
|
+
soft-drop-shadow = 0 4px 2px 0px rgba(#000,1)
|
23
|
+
engrave-light = 0 4px 0px 2px rgba(#FFF,0.25)
|
24
|
+
hard-drop-shadow = 0 3px 0px 2px rgba(#000,1)
|
25
|
+
|
26
|
+
box-shadow up-light, bevel, soft-drop-shadow, engrave-light, hard-drop-shadow
|
27
|
+
|
28
|
+
|
29
|
+
button-is-light(color)
|
30
|
+
return (lightness(color) > 30%)
|
31
|
+
|
32
|
+
button-text(button-color)
|
33
|
+
if button-is-light(button-color)
|
34
|
+
color darken(button-color,60%)
|
35
|
+
text-shadow 0 1px 1px rgba(#FFF,0.3)
|
36
|
+
else
|
37
|
+
color lighten(button-color,70%)
|
38
|
+
text-shadow 0 -1px 1px rgba(#000,0.9)
|
39
|
+
|
40
|
+
default-button-hover-state(background-color)
|
41
|
+
button-gradient-background(lighten(background-color,10%))
|
42
|
+
button-text(background-color)
|
43
|
+
|
44
|
+
default-button-active-state(background-color)
|
45
|
+
button-gradient-background(darken(background-color,10%), true)
|
46
|
+
button-text(background-color)
|
47
|
+
|
48
|
+
default-button-disabled-state(background-color)
|
49
|
+
button-gradient-background(darken(background-color,10%))
|
50
|
+
button-text(background-color)
|
51
|
+
|
52
|
+
|
53
|
+
default-button-states(background-color)
|
54
|
+
button-gradient-background(background-color)
|
55
|
+
button-text(background-color)
|
56
|
+
&:hover
|
57
|
+
default-button-hover-state(background-color)
|
58
|
+
&:active
|
59
|
+
default-button-active-state(background-color)
|
60
|
+
&[disabled]
|
61
|
+
default-button-disabled-state(background-color)
|
@@ -0,0 +1,36 @@
|
|
1
|
+
old-display = display
|
2
|
+
|
3
|
+
display(type)
|
4
|
+
if type is inline-block
|
5
|
+
display -moz-inline-stack
|
6
|
+
display inline-block
|
7
|
+
vertical-align middle
|
8
|
+
*vertical-align auto
|
9
|
+
zoom: 1
|
10
|
+
*display inline
|
11
|
+
else
|
12
|
+
old-display(type)
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
// Genericar mais:
|
17
|
+
// - suporte a fallback automatico
|
18
|
+
// - suporte a propriedades sem sufixo -color
|
19
|
+
transparent-fallback(property, color, fallback = null)
|
20
|
+
if color is a "color"
|
21
|
+
acolor = rgb(color)
|
22
|
+
{property} fallback || acolor
|
23
|
+
if acolor != color
|
24
|
+
{property} color
|
25
|
+
else
|
26
|
+
{property} color
|
27
|
+
|
28
|
+
background-color(color, fallback = null)
|
29
|
+
transparent-fallback(background-color, color, fallback)
|
30
|
+
|
31
|
+
border-color(color, fallback = null)
|
32
|
+
transparent-fallback(border-color, color, fallback)
|
33
|
+
|
34
|
+
color(c, fallback = null)
|
35
|
+
transparent-fallback(color, c, fallback)
|
36
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
@import 'application/theme'
|
2
|
+
@import 'helpers/button'
|
3
|
+
@import 'nib'
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
button, .button
|
8
|
+
border none
|
9
|
+
border-radius 10px
|
10
|
+
button-gradient-background(button-default-color)
|
11
|
+
cursor pointer
|
12
|
+
font-family button-font-family
|
13
|
+
font-size 1em
|
14
|
+
font-weight bold
|
15
|
+
padding 0.6em
|
16
|
+
text-align center
|
17
|
+
text-decoration none
|
18
|
+
// text-shadow 0 1px 1px rgba(255,255,255,0.3)
|
19
|
+
|
20
|
+
default-button-states button-default-color
|
21
|
+
|
22
|
+
&:active
|
23
|
+
// padding-bottom 0.55em
|
24
|
+
// padding-top 0.65em
|
25
|
+
|
26
|
+
&[disabled], &.disabled
|
27
|
+
cursor default
|
28
|
+
default-button-states button-disabled-color
|
29
|
+
|
30
|
+
&.success
|
31
|
+
default-button-states button-success-color
|
32
|
+
|
33
|
+
&.danger
|
34
|
+
default-button-states button-danger-color
|
35
|
+
|
36
|
+
&.cancel
|
37
|
+
default-button-states #222
|
38
|
+
|
39
|
+
|
40
|
+
small
|
41
|
+
font-size 0.8em
|
42
|
+
font-weight normal
|
@@ -0,0 +1,40 @@
|
|
1
|
+
@import "sprites"
|
2
|
+
|
3
|
+
get(hash, key)
|
4
|
+
for pair in hash
|
5
|
+
return pair[1] if pair[0] == key
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
sprites ?= ()
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
sprite(image, widget = 'default', hash = sprites)
|
14
|
+
|
15
|
+
// test widget
|
16
|
+
error("Widget '" + widget + "' does not exist!") unless get(hash,widget)
|
17
|
+
|
18
|
+
|
19
|
+
// get default properties
|
20
|
+
props = get(get(hash,widget), default)
|
21
|
+
|
22
|
+
for pair in props
|
23
|
+
add-property pair[0], unquote(pair[1]) unless pair[0] is null
|
24
|
+
|
25
|
+
|
26
|
+
// get widget properties
|
27
|
+
props = get(get(get(hash,widget),images),image)
|
28
|
+
|
29
|
+
// test widget image
|
30
|
+
error("Image '" + image + "' does not exist for '" + widget + "' widget!") unless props
|
31
|
+
|
32
|
+
for pair in props
|
33
|
+
|
34
|
+
value = pair[1]
|
35
|
+
property = pair[0]
|
36
|
+
value = unquote(value) if typeof(value) is 'string'
|
37
|
+
add-property property, value unless value is null
|
38
|
+
|
39
|
+
// add some other properties
|
40
|
+
add-property display, block
|
@@ -0,0 +1 @@
|
|
1
|
+
error("You must create a file named 'sprites.styl' with your sprites.\nTo generate a new sprite for a widget, run the command `thor sprite:build WIDGET`")
|
data/lib/ende/version.rb
ADDED
data/lib/ende.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require "ende/version"
|
2
|
+
|
3
|
+
module Ende
|
4
|
+
class Railtie < Rails::Railtie
|
5
|
+
config.to_prepare do
|
6
|
+
current_dir = Pathname.new(__FILE__).parent.parent
|
7
|
+
assets = Ende.assets
|
8
|
+
|
9
|
+
assets.paths << current_dir.join('lib', 'assets', 'javascripts').to_s
|
10
|
+
# assets.paths << current_dir.join('lib', 'assets', 'stylesheets').to_s uncomment if you use
|
11
|
+
assets.paths << current_dir.join('vendor', 'assets', 'javascripts').to_s
|
12
|
+
# assets.paths << current_dir.join('vendor', 'assets', 'stylesheets').to_s uncomment if you use
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
def Ende.assets
|
18
|
+
assets = Railtie.config.assets rescue nil
|
19
|
+
assets or Rails.application.config.assets
|
20
|
+
end
|
21
|
+
end
|
data/lib/tasks/.gitkeep
ADDED
File without changes
|