lol_framework 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +19 -0
- data/.rspec +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +30 -0
- data/Rakefile +1 -0
- data/lib/generators/lol_framework/setup/lol_framework.rb +27 -0
- data/lib/generators/lol_framework/setup/setup_generator.rb +17 -0
- data/lib/lol_framework.rb +8 -0
- data/lib/lol_framework/common.rb +20 -0
- data/lib/lol_framework/config.rb +17 -0
- data/lib/lol_framework/config/components.rb +16 -0
- data/lib/lol_framework/config/components/css.rb +44 -0
- data/lib/lol_framework/config/components/js.rb +75 -0
- data/lib/lol_framework/railtie.rb +14 -0
- data/lib/lol_framework/version.rb +3 -0
- data/lol_framework.gemspec +28 -0
- data/spec/lol_framework/config/components/css_spec.rb +5 -0
- data/spec/lol_framework/config/components/js_spec.rb +11 -0
- data/spec/lol_framework/config/components_spec.rb +24 -0
- data/spec/lol_framework/config_spec.rb +19 -0
- data/spec/lol_framework/lol_framework_spec.rb +13 -0
- data/spec/spec_helper.rb +20 -0
- data/vendor/assets/images/lol_framework/datatable/sorting_bg.png +0 -0
- data/vendor/assets/images/lol_framework/glyphicons-lol-origin-white.png +0 -0
- data/vendor/assets/images/lol_framework/glyphicons-lol-origin.png +0 -0
- data/vendor/assets/images/lol_framework/glyphicons-lol.png +0 -0
- data/vendor/assets/javascripts/.gitkeep +0 -0
- data/vendor/assets/javascripts/Jasmine/jasmine-html.js +616 -0
- data/vendor/assets/javascripts/Jasmine/jasmine.js +2529 -0
- data/vendor/assets/javascripts/lol.js +18 -0
- data/vendor/assets/javascripts/lol_framework/Ajax.coffee +183 -0
- data/vendor/assets/javascripts/lol_framework/Alert.coffee +113 -0
- data/vendor/assets/javascripts/lol_framework/Button.coffee +268 -0
- data/vendor/assets/javascripts/lol_framework/Core.coffee +85 -0
- data/vendor/assets/javascripts/lol_framework/Datatable.coffee +340 -0
- data/vendor/assets/javascripts/lol_framework/Date.coffee +0 -0
- data/vendor/assets/javascripts/lol_framework/Debug.coffee +45 -0
- data/vendor/assets/javascripts/lol_framework/I18n.coffee +81 -0
- data/vendor/assets/javascripts/lol_framework/Lang/en-us.coffee +54 -0
- data/vendor/assets/javascripts/lol_framework/Lang/pt-br.coffee +57 -0
- data/vendor/assets/javascripts/lol_framework/Library/date-functions.js +409 -0
- data/vendor/assets/javascripts/lol_framework/Library/jquery.dataTables.min.js +157 -0
- data/vendor/assets/javascripts/lol_framework/Library/jquery.mobile.js +14 -0
- data/vendor/assets/javascripts/lol_framework/Loader.coffee +83 -0
- data/vendor/assets/javascripts/lol_framework/Lol.coffee +4 -0
- data/vendor/assets/javascripts/lol_framework/Modal.coffee +221 -0
- data/vendor/assets/javascripts/lol_framework/Model.coffee +71 -0
- data/vendor/assets/javascripts/lol_framework/Model/Rest.coffee +15 -0
- data/vendor/assets/javascripts/lol_framework/Tests/Alert.coffee +83 -0
- data/vendor/assets/javascripts/lol_framework/Tests/Core.coffee +35 -0
- data/vendor/assets/javascripts/lol_framework/Tests/Debug.coffee +14 -0
- data/vendor/assets/javascripts/lol_framework/Tests/I18n.coffee +7 -0
- data/vendor/assets/javascripts/lol_framework/Tests/Lang.coffee +130 -0
- data/vendor/assets/javascripts/lol_framework/Tests/Library.coffee +13 -0
- data/vendor/assets/javascripts/lol_framework/Tests/Lol.coffee +4 -0
- data/vendor/assets/javascripts/lol_framework/Tests/Utils.coffee +22 -0
- data/vendor/assets/javascripts/lol_framework/Utils.coffee +42 -0
- data/vendor/assets/javascripts/lol_main_tests.js +43 -0
- data/vendor/assets/stylesheets/.gitkeep +0 -0
- data/vendor/assets/stylesheets/jasmine.css +81 -0
- data/vendor/assets/stylesheets/lol_framework/_mixin.scss +650 -0
- data/vendor/assets/stylesheets/lol_framework/_variable.scss +107 -0
- data/vendor/assets/stylesheets/lol_framework/components/_alert.scss +46 -0
- data/vendor/assets/stylesheets/lol_framework/components/_datatable.scss +172 -0
- data/vendor/assets/stylesheets/lol_framework/components/_loader.scss +15 -0
- data/vendor/assets/stylesheets/lol_framework/components/_modal.scss +68 -0
- metadata +222 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
//= require ./lol_framework/Library/date-functions
|
2
|
+
//= require ./lol_framework/Library/jquery.dataTables.min
|
3
|
+
//= require ./lol_framework/Library/jquery.mobile
|
4
|
+
//= require ./lol_framework/Lol
|
5
|
+
//= require ./lol_framework/Lang/en-us
|
6
|
+
//= require ./lol_framework/Lang/pt-br
|
7
|
+
//= require ./lol_framework/I18n
|
8
|
+
//= require ./lol_framework/Debug
|
9
|
+
//= require ./lol_framework/Utils
|
10
|
+
//= require ./lol_framework/Core
|
11
|
+
//= require ./lol_framework/Alert
|
12
|
+
//= require ./lol_framework/Button
|
13
|
+
//= require ./lol_framework/Loader
|
14
|
+
//= require ./lol_framework/Ajax
|
15
|
+
//= require ./lol_framework/Modal
|
16
|
+
//= require ./lol_framework/Model
|
17
|
+
//= require ./lol_framework/Model/Rest
|
18
|
+
//= require ./lol_framework/Datatable
|
@@ -0,0 +1,183 @@
|
|
1
|
+
###
|
2
|
+
@summary Lol Framework
|
3
|
+
@description Framework of RIAs applications
|
4
|
+
@version 1.0.0
|
5
|
+
@file Ajax.js
|
6
|
+
@author Welington Sampaio (http://welington.zaez.net/)
|
7
|
+
@contact http://welington.zaez.net/site/contato
|
8
|
+
|
9
|
+
@copyright Copyright 2012 Welington Sampaio, all rights reserved.
|
10
|
+
|
11
|
+
This source file is free software, under the license MIT, available at:
|
12
|
+
http://lolframework.zaez.net/license
|
13
|
+
|
14
|
+
This source file is distributed in the hope that it will be useful, but
|
15
|
+
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
16
|
+
or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
|
17
|
+
|
18
|
+
For details please refer to: http://welington.zaez.net
|
19
|
+
###
|
20
|
+
|
21
|
+
###
|
22
|
+
Create a new instance of Ajax.
|
23
|
+
|
24
|
+
@classDescription This class creates a new Ajax.
|
25
|
+
@param {Object} Receives configuration to create the Ajax, @see Lol.ajax.defaults
|
26
|
+
@return {Ajax} Returns a new Ajax.
|
27
|
+
@type {Object}
|
28
|
+
@example
|
29
|
+
*-* Manual Configuration *-*
|
30
|
+
var lol_ajax = new Lol.Ajax({
|
31
|
+
autoExecute: true,
|
32
|
+
useLoader : true,
|
33
|
+
contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
|
34
|
+
url : 'http://www.google.com/',
|
35
|
+
method : 'GET',
|
36
|
+
data : {},
|
37
|
+
dataType : 'html',
|
38
|
+
callbacks: {
|
39
|
+
beforeSend: function(jqXHR, settings){},
|
40
|
+
complete: function(jqXHR, textStatus){},
|
41
|
+
error: function(jqXHR, textStatus, errorThrown){},
|
42
|
+
success: function(data, textStatus, jqXHR){}
|
43
|
+
}
|
44
|
+
});
|
45
|
+
###
|
46
|
+
class Lol.Ajax extends Lol.Core
|
47
|
+
# declaration of variables
|
48
|
+
debugPrefix : 'Lol_Ajax'
|
49
|
+
namespace : '.ajax'
|
50
|
+
# the methods
|
51
|
+
constructor: (args={})->
|
52
|
+
return false unless @verifyJQuery()
|
53
|
+
@settings = jQuery.extend true, {}, Lol.ajax.defaults, args
|
54
|
+
@generateId()
|
55
|
+
@execute() if @settings.autoExecute
|
56
|
+
###
|
57
|
+
Get all the configuration data
|
58
|
+
sent and configures sending
|
59
|
+
@see http://api.jquery.com/jQuery.ajax/
|
60
|
+
###
|
61
|
+
execute: ->
|
62
|
+
@debug 'Executing the ajax requisition', @
|
63
|
+
if not @settings.url or not @settings.callbacks.error or not @settings.callbacks.success
|
64
|
+
throw 'Fields requireds not setting'
|
65
|
+
_this = @
|
66
|
+
Lol.Loader.show() if @settings.userLoader
|
67
|
+
jQuery.ajax
|
68
|
+
contentType: @settings.contentType
|
69
|
+
url : @settings.url
|
70
|
+
type : @settings.method
|
71
|
+
data : jQuery.param @settings.data
|
72
|
+
dataType : @settings.dataType
|
73
|
+
beforeSend : _this.settings.callbacks.beforeSend
|
74
|
+
complete : _this.settings.callbacks.complete
|
75
|
+
error : (jqXHR, textStatus, errorThrown)->
|
76
|
+
Lol.Loader.remove()
|
77
|
+
_this.settings.callbacks.error(jqXHR, textStatus, errorThrown)
|
78
|
+
success : (data, textStatus, jqXHR)->
|
79
|
+
Lol.Loader.remove()
|
80
|
+
_this.settings.callbacks.success(data, textStatus, jqXHR)
|
81
|
+
###
|
82
|
+
Set a new ContentType
|
83
|
+
@see http://api.jquery.com/jQuery.ajax/
|
84
|
+
@param {String}
|
85
|
+
@return {String}
|
86
|
+
###
|
87
|
+
setContentType: (value)-> @settings.contentType = value
|
88
|
+
###
|
89
|
+
Indicates whether to lock the screen with a loader
|
90
|
+
@param {Boolean}
|
91
|
+
@return {Boolean}
|
92
|
+
###
|
93
|
+
setUseLoader: (value)-> @settings.useLoader = value
|
94
|
+
###
|
95
|
+
Set a new Url
|
96
|
+
@see http://api.jquery.com/jQuery.ajax/
|
97
|
+
@param {String}
|
98
|
+
@return {String}
|
99
|
+
###
|
100
|
+
setUrl: (value)-> @settings.url = value
|
101
|
+
###
|
102
|
+
Set a new Method
|
103
|
+
@see http://api.jquery.com/jQuery.ajax/
|
104
|
+
@param {String}
|
105
|
+
@return {String}
|
106
|
+
###
|
107
|
+
setMethod: (value)-> @settings.method = value
|
108
|
+
###
|
109
|
+
Set a new Data content
|
110
|
+
@see http://api.jquery.com/jQuery.ajax/
|
111
|
+
@param {Object}
|
112
|
+
@return {Object}
|
113
|
+
###
|
114
|
+
setData: (value)-> @settings.data = value
|
115
|
+
###
|
116
|
+
Set a new DataType
|
117
|
+
@see http://api.jquery.com/jQuery.ajax/
|
118
|
+
@param {String}
|
119
|
+
@return {String}
|
120
|
+
###
|
121
|
+
setDataType: (value)-> @settings.dataType = value
|
122
|
+
|
123
|
+
###
|
124
|
+
Contains the definitions of standards Lol.Ajax
|
125
|
+
@type {Object}
|
126
|
+
###
|
127
|
+
Lol.ajax =
|
128
|
+
defaults:
|
129
|
+
###
|
130
|
+
Indicates whether the object should
|
131
|
+
be executed at the end of its creation
|
132
|
+
@type {Boolean}
|
133
|
+
###
|
134
|
+
autoExecute: true
|
135
|
+
###
|
136
|
+
Indicates whether the object should use
|
137
|
+
a loader to stop, until the completion
|
138
|
+
of the request
|
139
|
+
@type {Boolean}
|
140
|
+
###
|
141
|
+
useLoader : true
|
142
|
+
###
|
143
|
+
Indicates the content type of the request
|
144
|
+
@type {String}
|
145
|
+
###
|
146
|
+
contentType: 'application/x-www-form-urlencoded; charset=UTF-8'
|
147
|
+
###
|
148
|
+
Indicates the url of the request
|
149
|
+
@type {String}
|
150
|
+
###
|
151
|
+
url : null
|
152
|
+
###
|
153
|
+
Indicates the method of the request
|
154
|
+
options : GET | POST | PUT | DELETE
|
155
|
+
@type {String}
|
156
|
+
###
|
157
|
+
method : 'GET'
|
158
|
+
###
|
159
|
+
Indicates the content of the request
|
160
|
+
@type {Object}
|
161
|
+
###
|
162
|
+
data : {}
|
163
|
+
###
|
164
|
+
Indicates the type of expected return
|
165
|
+
after the completion of request
|
166
|
+
@type {String}
|
167
|
+
###
|
168
|
+
dataType : 'json'
|
169
|
+
###
|
170
|
+
Callbacks run through the requisition
|
171
|
+
@see http://api.jquery.com/jQuery.ajax/
|
172
|
+
###
|
173
|
+
callbacks:
|
174
|
+
beforeSend: (jqXHR, settings)->
|
175
|
+
complete: (jqXHR, textStatus)->
|
176
|
+
error: (jqXHR, textStatus, errorThrown)->
|
177
|
+
success: (data, textStatus, jqXHR)->
|
178
|
+
|
179
|
+
# if is rails application and using csrf-token
|
180
|
+
jQuery ->
|
181
|
+
jQuery(document).ajaxSend (e, xhr, options)->
|
182
|
+
token = $("meta[name='csrf-token']").attr "content"
|
183
|
+
xhr.setRequestHeader("X-CSRF-Token", token)
|
@@ -0,0 +1,113 @@
|
|
1
|
+
###
|
2
|
+
@summary Lol Framework
|
3
|
+
@description Framework of RIAs applications
|
4
|
+
@version 1.0.0
|
5
|
+
@file Alert.js
|
6
|
+
@author Welington Sampaio (http://welington.zaez.net/)
|
7
|
+
@contact http://welington.zaez.net/site/contato
|
8
|
+
|
9
|
+
@copyright Copyright 2012 Welington Sampaio, all rights reserved.
|
10
|
+
|
11
|
+
This source file is free software, under the license MIT, available at:
|
12
|
+
http://lolframework.zaez.net/license
|
13
|
+
|
14
|
+
This source file is distributed in the hope that it will be useful, but
|
15
|
+
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
16
|
+
or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
|
17
|
+
|
18
|
+
For details please refer to: http://welington.zaez.net
|
19
|
+
###
|
20
|
+
|
21
|
+
###
|
22
|
+
Create a new instance of Alert.
|
23
|
+
|
24
|
+
@classDescription This class creates a new Alert.
|
25
|
+
@param {Object} Receives configuration to create the Alert, @see Lol.alert.defaults
|
26
|
+
@return {Alert} Returns a new Alert.
|
27
|
+
@type {Object}
|
28
|
+
@example
|
29
|
+
*-* Create manual alert *-*
|
30
|
+
var lol_alert = new Lol.Alert({
|
31
|
+
autoRemove : true,
|
32
|
+
type : 'success',
|
33
|
+
message : 'Success to create a new object LolAlert',
|
34
|
+
delayRemove: 7000,
|
35
|
+
objects : {
|
36
|
+
containerID: '#alerts',
|
37
|
+
classes: {
|
38
|
+
container: 'alerts',
|
39
|
+
success : 'alert-success',
|
40
|
+
error : 'alert-error',
|
41
|
+
warning : 'alert-warning',
|
42
|
+
info : 'alert-info'
|
43
|
+
}
|
44
|
+
}
|
45
|
+
});
|
46
|
+
###
|
47
|
+
class Lol.Alert extends Lol.Core
|
48
|
+
# declaration of variables
|
49
|
+
debugPrefix : 'Lol_Alert'
|
50
|
+
namespace : '.alert'
|
51
|
+
# the methods
|
52
|
+
constructor: (args={})->
|
53
|
+
return false unless @verifyJQuery()
|
54
|
+
@settings = jQuery.extend true, {}, Lol.alert.defaults, args
|
55
|
+
@generateId()
|
56
|
+
return false unless @setContainer()
|
57
|
+
@createAlert()
|
58
|
+
@setEvents()
|
59
|
+
@setInterval()
|
60
|
+
appendClose: ->
|
61
|
+
@debug 'Create and append close button to alert'
|
62
|
+
@close = jQuery "<span></span>"
|
63
|
+
@close.append "x"
|
64
|
+
@close.appendTo @alert
|
65
|
+
createAlert: ->
|
66
|
+
@debug 'Create an object Alert'
|
67
|
+
@alert = jQuery '<div></div>'
|
68
|
+
@alert.addClass "alert #{@settings.objects.classes[@settings.type]}"
|
69
|
+
@alert.append @settings.message
|
70
|
+
@appendClose()
|
71
|
+
@alert.appendTo @container
|
72
|
+
destroy: ->
|
73
|
+
@debug 'Initializing the destroy method'
|
74
|
+
@alert.slideUp ->
|
75
|
+
jQuery(@).remove()
|
76
|
+
clearInterval(@interval) if @settings.autoRemove
|
77
|
+
super
|
78
|
+
setContainer: ->
|
79
|
+
@debug 'Setting a container object'
|
80
|
+
if not jQuery( @settings.objects.containerID )
|
81
|
+
throw "Required container Alert: #{@settings.objects.containerID}"
|
82
|
+
return false
|
83
|
+
@container = jQuery @settings.objects.containerID
|
84
|
+
setInterval: ->
|
85
|
+
@debug 'Setting interval?',@settings.autoRemove, 'With delay:',@settings.delayRemove
|
86
|
+
_this = @
|
87
|
+
@interval = setInterval(->
|
88
|
+
_this.destroy()
|
89
|
+
, @settings.delayRemove) if @settings.autoRemove
|
90
|
+
setEvents: ->
|
91
|
+
@debug 'Setting all events'
|
92
|
+
_this = @
|
93
|
+
@close.bind "click#{@namespace}", ->
|
94
|
+
_this.debug 'Dispatch event clickon close button'
|
95
|
+
_this.destroy()
|
96
|
+
|
97
|
+
Lol.alert =
|
98
|
+
# private:
|
99
|
+
# dataset:
|
100
|
+
|
101
|
+
defaults:
|
102
|
+
autoRemove : true
|
103
|
+
type : 'success' # Options success | error | warning | info
|
104
|
+
message : null
|
105
|
+
delayRemove: 7000
|
106
|
+
objects :
|
107
|
+
containerID: '#alerts'
|
108
|
+
classes:
|
109
|
+
container: 'alerts'
|
110
|
+
success : 'alert-success'
|
111
|
+
error : 'alert-error'
|
112
|
+
warning : 'alert-warning'
|
113
|
+
info : 'alert-info'
|
@@ -0,0 +1,268 @@
|
|
1
|
+
###
|
2
|
+
@summary Lol Framework
|
3
|
+
@description Framework of RIAs applications
|
4
|
+
@version 1.0.0
|
5
|
+
@file Button.js
|
6
|
+
@author Welington Sampaio (http://welington.zaez.net/)
|
7
|
+
@contact http://welington.zaez.net/site/contato
|
8
|
+
|
9
|
+
@copyright Copyright 2012 Welington Sampaio, all rights reserved.
|
10
|
+
|
11
|
+
This source file is free software, under the license MIT, available at:
|
12
|
+
http://lolframework.zaez.net/license
|
13
|
+
|
14
|
+
This source file is distributed in the hope that it will be useful, but
|
15
|
+
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
16
|
+
or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
|
17
|
+
|
18
|
+
For details please refer to: http://welington.zaez.net
|
19
|
+
###
|
20
|
+
|
21
|
+
###
|
22
|
+
Create a new instance of Button.
|
23
|
+
|
24
|
+
@classDescription This class creates a new Button.
|
25
|
+
@param {Object} Receives configuration to create the Button, @see Lol.button.defaults
|
26
|
+
@return {Button} Returns a new Button.
|
27
|
+
@type {Object}
|
28
|
+
###
|
29
|
+
class Lol.Button extends Lol.Core
|
30
|
+
# Variables declaration
|
31
|
+
debugPrefix : 'Lol_Button'
|
32
|
+
namespace : '.button'
|
33
|
+
# The methods
|
34
|
+
constructor: (args={})->
|
35
|
+
return false unless @verifyJQuery()
|
36
|
+
@settings = jQuery.extend true, {}, Lol.button.defaults, args
|
37
|
+
@generateId()
|
38
|
+
@buttons = []
|
39
|
+
@createButtons()
|
40
|
+
return @buttons if @buttons.length
|
41
|
+
@createButton()
|
42
|
+
@addAttributes()
|
43
|
+
@setEvents()
|
44
|
+
@addToContainer()
|
45
|
+
###
|
46
|
+
Adds attributes to the button
|
47
|
+
###
|
48
|
+
addAttributes: ->
|
49
|
+
@debug "Add attributes to button: ", @settings.atribute
|
50
|
+
for key,value of @settings.atribute
|
51
|
+
@button.attr key, value
|
52
|
+
###
|
53
|
+
Adds attributes to the button
|
54
|
+
###
|
55
|
+
addToContainer: ->
|
56
|
+
@container = $ @settings.container
|
57
|
+
if @buttons.length
|
58
|
+
for btn in @buttons
|
59
|
+
@container.append btn
|
60
|
+
else
|
61
|
+
@container.append @button
|
62
|
+
###
|
63
|
+
Creates the buttons on block
|
64
|
+
options: OK | CANCEL | YES | NO
|
65
|
+
###
|
66
|
+
createButtons: ->
|
67
|
+
throw 'Invalid button' if not @settings.buttons and not @settings.text
|
68
|
+
if @settings.buttons
|
69
|
+
@debug 'Creating buttons:', @settings.buttons
|
70
|
+
text = new String @settings.buttons
|
71
|
+
if text.indexOf('YES') isnt -1
|
72
|
+
@buttons.push new Lol.Button
|
73
|
+
text : 'YES'
|
74
|
+
attribute: @settings.attributes.YES
|
75
|
+
container: @settings.container
|
76
|
+
class: @settings.classes.YES
|
77
|
+
debug: @settings.debug
|
78
|
+
callback:
|
79
|
+
click: @settings.fn.YES_CLICK
|
80
|
+
if text.indexOf('NO') isnt -1
|
81
|
+
@buttons.push new Lol.Button
|
82
|
+
text : 'NO'
|
83
|
+
attribute: @settings.attributes.NO
|
84
|
+
container: @settings.container
|
85
|
+
class: @settings.classes.NO
|
86
|
+
debug: @settings.debug
|
87
|
+
callback:
|
88
|
+
click: @settings.fn.NO_CLICK
|
89
|
+
if text.indexOf('OK') isnt -1
|
90
|
+
@buttons.push new Lol.Button
|
91
|
+
text : 'OK'
|
92
|
+
attribute: @settings.attributes.OK
|
93
|
+
container: @settings.container
|
94
|
+
class: @settings.classes.OK
|
95
|
+
debug: @settings.debug
|
96
|
+
callback:
|
97
|
+
click: @settings.fn.OK_CLICK
|
98
|
+
if text.indexOf('CANCEL') isnt -1
|
99
|
+
@buttons.push new Lol.Button
|
100
|
+
text : 'CANCEL'
|
101
|
+
attribute: @settings.attributes.CANCEL
|
102
|
+
container: @settings.container
|
103
|
+
class: @settings.classes.CANCEL
|
104
|
+
debug: @settings.debug
|
105
|
+
callback:
|
106
|
+
click: @settings.fn.CANCEL_CLICK
|
107
|
+
###
|
108
|
+
Creates the button specified in the settings
|
109
|
+
###
|
110
|
+
createButton: (text)->
|
111
|
+
@debug 'Creating button: ', @settings.text
|
112
|
+
@debug "Add class '#{@settings.class}' to current button"
|
113
|
+
@button = $ '<a></a>'
|
114
|
+
@button.html Lol.t(@settings.text)
|
115
|
+
@button.addClass @settings.class
|
116
|
+
###
|
117
|
+
Creates the button specified in the settings
|
118
|
+
###
|
119
|
+
unsetEvents: ->
|
120
|
+
@debug "Remove all events with namespace: '#{@namespace}'"
|
121
|
+
@button.unbind @namespace
|
122
|
+
###
|
123
|
+
Adds all events related to this button
|
124
|
+
###
|
125
|
+
setEvents: ->
|
126
|
+
@unsetEvents()
|
127
|
+
@debug "Add click event with namespace: '#{@namespace}'"
|
128
|
+
_this = @
|
129
|
+
@button.bind("click#{@namespace}", (event)->
|
130
|
+
_this.debug "Dispath click event, with return: ", _this.settings.return_handler
|
131
|
+
r_callback = _this.settings.callback.click(event, _this)
|
132
|
+
return r_callback if _this.settings.return_handler
|
133
|
+
_this.settings.return_handler
|
134
|
+
)
|
135
|
+
|
136
|
+
###
|
137
|
+
Contains the definitions of standards Lol.Button
|
138
|
+
@type {Object}
|
139
|
+
###
|
140
|
+
Lol.button =
|
141
|
+
defaults:
|
142
|
+
###
|
143
|
+
It contains attributes related
|
144
|
+
to the button in question
|
145
|
+
@type {Object}
|
146
|
+
###
|
147
|
+
attribute : {}
|
148
|
+
###
|
149
|
+
String with the text referring to
|
150
|
+
the block to create buttons
|
151
|
+
@options YES | NO | OK | CANCEL
|
152
|
+
@type {String}
|
153
|
+
###
|
154
|
+
buttons : null
|
155
|
+
###
|
156
|
+
Contains CSS classes to add to the button
|
157
|
+
@type {String}
|
158
|
+
###
|
159
|
+
class : ''
|
160
|
+
###
|
161
|
+
Object or container where the button
|
162
|
+
should be added
|
163
|
+
@type {String or DOMObject}
|
164
|
+
###
|
165
|
+
container : 'body'
|
166
|
+
###
|
167
|
+
Specifies whether the object should
|
168
|
+
print debug messages
|
169
|
+
@type {Boolean}
|
170
|
+
###
|
171
|
+
debug : false
|
172
|
+
###
|
173
|
+
Specifies what should be the return of
|
174
|
+
the event after shooting
|
175
|
+
@type {Boolean}
|
176
|
+
###
|
177
|
+
return_handler: false
|
178
|
+
###
|
179
|
+
Enter the text within the button
|
180
|
+
@type {String}
|
181
|
+
###
|
182
|
+
text : null
|
183
|
+
###
|
184
|
+
Object that contains the attributes
|
185
|
+
of the buttons on the block
|
186
|
+
@type {Object}
|
187
|
+
###
|
188
|
+
attributes:
|
189
|
+
###
|
190
|
+
Attributes for the CANCEL button
|
191
|
+
@type {Object}
|
192
|
+
###
|
193
|
+
CANCEL : {}
|
194
|
+
###
|
195
|
+
Attributes for the NO button
|
196
|
+
@type {Object}
|
197
|
+
###
|
198
|
+
NO : {}
|
199
|
+
###
|
200
|
+
Attributes for the OK button
|
201
|
+
@type {Object}
|
202
|
+
###
|
203
|
+
OK : {}
|
204
|
+
###
|
205
|
+
Attributes for the YES button
|
206
|
+
@type {Object}
|
207
|
+
###
|
208
|
+
YES : {}
|
209
|
+
###
|
210
|
+
Specifies the events for the button
|
211
|
+
@type {Object}
|
212
|
+
###
|
213
|
+
callback:
|
214
|
+
###
|
215
|
+
Click event to the button
|
216
|
+
@type {Function}
|
217
|
+
###
|
218
|
+
click: ->
|
219
|
+
###
|
220
|
+
Contains classes to add buttons on the block
|
221
|
+
@type {Object}
|
222
|
+
###
|
223
|
+
classes:
|
224
|
+
###
|
225
|
+
Contains CSS classes to add to the OK button
|
226
|
+
@type {String}
|
227
|
+
###
|
228
|
+
OK : 'btn'
|
229
|
+
###
|
230
|
+
Contains CSS classes to add to the CANCEL button
|
231
|
+
@type {String}
|
232
|
+
###
|
233
|
+
CANCEL: 'btn'
|
234
|
+
###
|
235
|
+
Contains CSS classes to add to the YES button
|
236
|
+
@type {String}
|
237
|
+
###
|
238
|
+
YES : 'btn'
|
239
|
+
###
|
240
|
+
Contains CSS classes to add to the NO button
|
241
|
+
@type {String}
|
242
|
+
###
|
243
|
+
NO : 'btn'
|
244
|
+
###
|
245
|
+
Contains events to add buttons on the block
|
246
|
+
@type {String}
|
247
|
+
###
|
248
|
+
fn:
|
249
|
+
###
|
250
|
+
Click event to the OK button
|
251
|
+
@type {Function}
|
252
|
+
###
|
253
|
+
OK_CLICK: ->
|
254
|
+
###
|
255
|
+
Click event to the CANCEL button
|
256
|
+
@type {Function}
|
257
|
+
###
|
258
|
+
CANCEL_CLICK: ->
|
259
|
+
###
|
260
|
+
Click event to the YES button
|
261
|
+
@type {Function}
|
262
|
+
###
|
263
|
+
YES_CLICK: ->
|
264
|
+
###
|
265
|
+
Click event to the NO button
|
266
|
+
@type {Function}
|
267
|
+
###
|
268
|
+
NO_CLICK: ->
|