tjadmin 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tjadmin/version.rb +1 -1
  3. data/vendor/assets/font/DXI1ORHCpsQm3Vp6mXoaTXhCUOGz7vYGh680lGh-uXM.woff +0 -0
  4. data/vendor/assets/font/FontAwesome.otf +0 -0
  5. data/vendor/assets/font/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff +0 -0
  6. data/vendor/assets/font/fontawesome-webfont.eot +0 -0
  7. data/vendor/assets/font/fontawesome-webfont.svg +399 -0
  8. data/vendor/assets/font/fontawesome-webfont.ttf +0 -0
  9. data/vendor/assets/font/fontawesome-webfont.woff +0 -0
  10. data/vendor/assets/javascripts/tjadmin/ace-elements.js +866 -0
  11. data/vendor/assets/javascripts/tjadmin/ace-extra.js +374 -0
  12. data/vendor/assets/javascripts/tjadmin/ace.js +310 -0
  13. data/vendor/assets/javascripts/tjadmin/additional-methods.js +617 -0
  14. data/vendor/assets/javascripts/tjadmin/bootbox.js +660 -0
  15. data/vendor/assets/javascripts/tjadmin/bootstrap-colorpicker.js +540 -0
  16. data/vendor/assets/javascripts/tjadmin/bootstrap-tag.js +206 -0
  17. data/vendor/assets/javascripts/tjadmin/bootstrap-wysiwyg.js +206 -0
  18. data/vendor/assets/javascripts/tjadmin/bootstrap.js +2280 -0
  19. data/vendor/assets/javascripts/tjadmin/chosen.jquery.js +1166 -0
  20. data/vendor/assets/javascripts/tjadmin/date-time/bootstrap-datepicker.js +1016 -0
  21. data/vendor/assets/javascripts/tjadmin/date-time/bootstrap-timepicker.js +888 -0
  22. data/vendor/assets/javascripts/tjadmin/date-time/daterangepicker.js +854 -0
  23. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.bg.js +14 -0
  24. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.ca.js +14 -0
  25. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.cs.js +15 -0
  26. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.da.js +14 -0
  27. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.de.js +16 -0
  28. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.el.js +13 -0
  29. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.es.js +14 -0
  30. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.fi.js +14 -0
  31. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.fr.js +16 -0
  32. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.he.js +15 -0
  33. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.hr.js +13 -0
  34. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.hu.js +16 -0
  35. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.id.js +13 -0
  36. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.is.js +14 -0
  37. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.it.js +16 -0
  38. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.ja.js +15 -0
  39. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.kr.js +13 -0
  40. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.lt.js +16 -0
  41. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.lv.js +16 -0
  42. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.ms.js +14 -0
  43. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.nb.js +14 -0
  44. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.nl.js +14 -0
  45. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.pl.js +15 -0
  46. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.pt-BR.js +14 -0
  47. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.pt.js +14 -0
  48. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.ro.js +15 -0
  49. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.rs-latin.js +14 -0
  50. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.rs.js +14 -0
  51. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.ru.js +14 -0
  52. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.sk.js +15 -0
  53. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.sl.js +14 -0
  54. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.sv.js +14 -0
  55. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.sw.js +15 -0
  56. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.th.js +14 -0
  57. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.tr.js +15 -0
  58. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.uk.js +14 -0
  59. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.zh-CN.js +14 -0
  60. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.zh-TW.js +13 -0
  61. data/vendor/assets/javascripts/tjadmin/date-time/moment.js +1400 -0
  62. data/vendor/assets/javascripts/tjadmin/excanvas.js +1428 -0
  63. data/vendor/assets/javascripts/tjadmin/flot/jquery.flot.js +3061 -0
  64. data/vendor/assets/javascripts/tjadmin/flot/jquery.flot.pie.js +817 -0
  65. data/vendor/assets/javascripts/tjadmin/flot/jquery.flot.resize.js +60 -0
  66. data/vendor/assets/javascripts/tjadmin/fuelux/data/fuelux.tree-sampledata.js +174 -0
  67. data/vendor/assets/javascripts/tjadmin/fuelux/fuelux.spinner.js +201 -0
  68. data/vendor/assets/javascripts/tjadmin/fuelux/fuelux.tree.js +173 -0
  69. data/vendor/assets/javascripts/tjadmin/fuelux/fuelux.wizard.js +172 -0
  70. data/vendor/assets/javascripts/tjadmin/fullcalendar.js +5973 -0
  71. data/vendor/assets/javascripts/tjadmin/jquery-1.10.2.js +9789 -0
  72. data/vendor/assets/javascripts/tjadmin/jquery-2.0.3.js +8829 -0
  73. data/vendor/assets/javascripts/tjadmin/jquery-ui-1.10.3.custom.js +5423 -0
  74. data/vendor/assets/javascripts/tjadmin/jquery.autosize.js +242 -0
  75. data/vendor/assets/javascripts/tjadmin/jquery.colorbox.js +1063 -0
  76. data/vendor/assets/javascripts/tjadmin/jquery.dataTables.js +12099 -0
  77. data/vendor/assets/javascripts/tjadmin/jquery.easy-pie-chart.js +200 -0
  78. data/vendor/assets/javascripts/tjadmin/jquery.gritter.js +418 -0
  79. data/vendor/assets/javascripts/tjadmin/jquery.hotkeys.js +113 -0
  80. data/vendor/assets/javascripts/tjadmin/jquery.inputlimiter.1.3.1.js +172 -0
  81. data/vendor/assets/javascripts/tjadmin/jquery.knob.js +656 -0
  82. data/vendor/assets/javascripts/tjadmin/jquery.maskedinput.js +338 -0
  83. data/vendor/assets/javascripts/tjadmin/jquery.mobile.custom.js +1081 -0
  84. data/vendor/assets/javascripts/tjadmin/jquery.slimscroll.js +448 -0
  85. data/vendor/assets/javascripts/tjadmin/jquery.sparkline.js +3054 -0
  86. data/vendor/assets/javascripts/tjadmin/jquery.ui.touch-punch.js +160 -0
  87. data/vendor/assets/javascripts/tjadmin/jquery.validate.js +1231 -0
  88. data/vendor/assets/javascripts/tjadmin/markdown/bootstrap-markdown.js +993 -0
  89. data/vendor/assets/javascripts/tjadmin/markdown/markdown.js +1616 -0
  90. data/vendor/assets/javascripts/tjadmin/markdown/to-markdown.js +184 -0
  91. data/vendor/assets/javascripts/tjadmin/select2.js +3168 -0
  92. data/vendor/assets/javascripts/tjadmin/spin.js +349 -0
  93. data/vendor/assets/javascripts/tjadmin/x-editable/ace-editable.js +368 -0
  94. data/vendor/assets/javascripts/tjadmin/x-editable/bootstrap-editable.js +6827 -0
  95. data/vendor/assets/javascripts/tjadmin.js +5 -0
  96. data/vendor/assets/stylesheets/tjadmin/ace-fonts.css.scss +13 -0
  97. data/vendor/assets/stylesheets/tjadmin/ace-ie.css +293 -0
  98. data/vendor/assets/stylesheets/tjadmin/ace-responsive.css +1113 -0
  99. data/vendor/assets/stylesheets/tjadmin/ace-skins.css +1301 -0
  100. data/vendor/assets/stylesheets/tjadmin/ace.css +14701 -0
  101. data/vendor/assets/stylesheets/tjadmin/bootstrap-responsive.css +1109 -0
  102. data/vendor/assets/stylesheets/tjadmin/bootstrap.css +6167 -0
  103. data/vendor/assets/stylesheets/tjadmin/chosen.css +430 -0
  104. data/vendor/assets/stylesheets/tjadmin/font-awesome-ie7.css +1203 -0
  105. data/vendor/assets/stylesheets/tjadmin/font-awesome.css +1479 -0
  106. data/vendor/assets/stylesheets/tjadmin/jquery-ui-1.10.3.custom.css +223 -0
  107. data/vendor/assets/stylesheets/tjadmin.css +9 -0
  108. metadata +106 -1
@@ -0,0 +1,349 @@
1
+ //fgnass.github.com/spin.js#v1.3
2
+
3
+ /**
4
+ * Copyright (c) 2011-2013 Felix Gnass
5
+ * Licensed under the MIT license
6
+ */
7
+ (function(root, factory) {
8
+
9
+ /* CommonJS */
10
+ if (typeof exports == 'object') module.exports = factory()
11
+
12
+ /* AMD module */
13
+ else if (typeof define == 'function' && define.amd) define(factory)
14
+
15
+ /* Browser global */
16
+ else root.Spinner = factory()
17
+ }
18
+ (this, function() {
19
+ "use strict";
20
+
21
+ var prefixes = ['webkit', 'Moz', 'ms', 'O'] /* Vendor prefixes */
22
+ , animations = {} /* Animation rules keyed by their name */
23
+ , useCssAnimations /* Whether to use CSS animations or setTimeout */
24
+
25
+ /**
26
+ * Utility function to create elements. If no tag name is given,
27
+ * a DIV is created. Optionally properties can be passed.
28
+ */
29
+ function createEl(tag, prop) {
30
+ var el = document.createElement(tag || 'div')
31
+ , n
32
+
33
+ for(n in prop) el[n] = prop[n]
34
+ return el
35
+ }
36
+
37
+ /**
38
+ * Appends children and returns the parent.
39
+ */
40
+ function ins(parent /* child1, child2, ...*/) {
41
+ for (var i=1, n=arguments.length; i<n; i++)
42
+ parent.appendChild(arguments[i])
43
+
44
+ return parent
45
+ }
46
+
47
+ /**
48
+ * Insert a new stylesheet to hold the @keyframe or VML rules.
49
+ */
50
+ var sheet = (function() {
51
+ var el = createEl('style', {type : 'text/css'})
52
+ ins(document.getElementsByTagName('head')[0], el)
53
+ return el.sheet || el.styleSheet
54
+ }())
55
+
56
+ /**
57
+ * Creates an opacity keyframe animation rule and returns its name.
58
+ * Since most mobile Webkits have timing issues with animation-delay,
59
+ * we create separate rules for each line/segment.
60
+ */
61
+ function addAnimation(alpha, trail, i, lines) {
62
+ var name = ['opacity', trail, ~~(alpha*100), i, lines].join('-')
63
+ , start = 0.01 + i/lines * 100
64
+ , z = Math.max(1 - (1-alpha) / trail * (100-start), alpha)
65
+ , prefix = useCssAnimations.substring(0, useCssAnimations.indexOf('Animation')).toLowerCase()
66
+ , pre = prefix && '-' + prefix + '-' || ''
67
+
68
+ if (!animations[name]) {
69
+ sheet.insertRule(
70
+ '@' + pre + 'keyframes ' + name + '{' +
71
+ '0%{opacity:' + z + '}' +
72
+ start + '%{opacity:' + alpha + '}' +
73
+ (start+0.01) + '%{opacity:1}' +
74
+ (start+trail) % 100 + '%{opacity:' + alpha + '}' +
75
+ '100%{opacity:' + z + '}' +
76
+ '}', sheet.cssRules.length)
77
+
78
+ animations[name] = 1
79
+ }
80
+
81
+ return name
82
+ }
83
+
84
+ /**
85
+ * Tries various vendor prefixes and returns the first supported property.
86
+ */
87
+ function vendor(el, prop) {
88
+ var s = el.style
89
+ , pp
90
+ , i
91
+
92
+ if(s[prop] !== undefined) return prop
93
+ prop = prop.charAt(0).toUpperCase() + prop.slice(1)
94
+ for(i=0; i<prefixes.length; i++) {
95
+ pp = prefixes[i]+prop
96
+ if(s[pp] !== undefined) return pp
97
+ }
98
+ }
99
+
100
+ /**
101
+ * Sets multiple style properties at once.
102
+ */
103
+ function css(el, prop) {
104
+ for (var n in prop)
105
+ el.style[vendor(el, n)||n] = prop[n]
106
+
107
+ return el
108
+ }
109
+
110
+ /**
111
+ * Fills in default values.
112
+ */
113
+ function merge(obj) {
114
+ for (var i=1; i < arguments.length; i++) {
115
+ var def = arguments[i]
116
+ for (var n in def)
117
+ if (obj[n] === undefined) obj[n] = def[n]
118
+ }
119
+ return obj
120
+ }
121
+
122
+ /**
123
+ * Returns the absolute page-offset of the given element.
124
+ */
125
+ function pos(el) {
126
+ var o = { x:el.offsetLeft, y:el.offsetTop }
127
+ while((el = el.offsetParent))
128
+ o.x+=el.offsetLeft, o.y+=el.offsetTop
129
+
130
+ return o
131
+ }
132
+
133
+ // Built-in defaults
134
+
135
+ var defaults = {
136
+ lines: 12, // The number of lines to draw
137
+ length: 7, // The length of each line
138
+ width: 5, // The line thickness
139
+ radius: 10, // The radius of the inner circle
140
+ rotate: 0, // Rotation offset
141
+ corners: 1, // Roundness (0..1)
142
+ color: '#000', // #rgb or #rrggbb
143
+ direction: 1, // 1: clockwise, -1: counterclockwise
144
+ speed: 1, // Rounds per second
145
+ trail: 100, // Afterglow percentage
146
+ opacity: 1/4, // Opacity of the lines
147
+ fps: 20, // Frames per second when using setTimeout()
148
+ zIndex: 2e9, // Use a high z-index by default
149
+ className: 'spinner', // CSS class to assign to the element
150
+ top: 'auto', // center vertically
151
+ left: 'auto', // center horizontally
152
+ position: 'relative' // element position
153
+ }
154
+
155
+ /** The constructor */
156
+ function Spinner(o) {
157
+ if (typeof this == 'undefined') return new Spinner(o)
158
+ this.opts = merge(o || {}, Spinner.defaults, defaults)
159
+ }
160
+
161
+ // Global defaults that override the built-ins:
162
+ Spinner.defaults = {}
163
+
164
+ merge(Spinner.prototype, {
165
+
166
+ /**
167
+ * Adds the spinner to the given target element. If this instance is already
168
+ * spinning, it is automatically removed from its previous target b calling
169
+ * stop() internally.
170
+ */
171
+ spin: function(target) {
172
+ this.stop()
173
+
174
+ var self = this
175
+ , o = self.opts
176
+ , el = self.el = css(createEl(0, {className: o.className}), {position: o.position, width: 0, zIndex: o.zIndex})
177
+ , mid = o.radius+o.length+o.width
178
+ , ep // element position
179
+ , tp // target position
180
+
181
+ if (target) {
182
+ target.insertBefore(el, target.firstChild||null)
183
+ tp = pos(target)
184
+ ep = pos(el)
185
+ css(el, {
186
+ left: (o.left == 'auto' ? tp.x-ep.x + (target.offsetWidth >> 1) : parseInt(o.left, 10) + mid) + 'px',
187
+ top: (o.top == 'auto' ? tp.y-ep.y + (target.offsetHeight >> 1) : parseInt(o.top, 10) + mid) + 'px'
188
+ })
189
+ }
190
+
191
+ el.setAttribute('role', 'progressbar')
192
+ self.lines(el, self.opts)
193
+
194
+ if (!useCssAnimations) {
195
+ // No CSS animation support, use setTimeout() instead
196
+ var i = 0
197
+ , start = (o.lines - 1) * (1 - o.direction) / 2
198
+ , alpha
199
+ , fps = o.fps
200
+ , f = fps/o.speed
201
+ , ostep = (1-o.opacity) / (f*o.trail / 100)
202
+ , astep = f/o.lines
203
+
204
+ ;(function anim() {
205
+ i++;
206
+ for (var j = 0; j < o.lines; j++) {
207
+ alpha = Math.max(1 - (i + (o.lines - j) * astep) % f * ostep, o.opacity)
208
+
209
+ self.opacity(el, j * o.direction + start, alpha, o)
210
+ }
211
+ self.timeout = self.el && setTimeout(anim, ~~(1000/fps))
212
+ })()
213
+ }
214
+ return self
215
+ },
216
+
217
+ /**
218
+ * Stops and removes the Spinner.
219
+ */
220
+ stop: function() {
221
+ var el = this.el
222
+ if (el) {
223
+ clearTimeout(this.timeout)
224
+ if (el.parentNode) el.parentNode.removeChild(el)
225
+ this.el = undefined
226
+ }
227
+ return this
228
+ },
229
+
230
+ /**
231
+ * Internal method that draws the individual lines. Will be overwritten
232
+ * in VML fallback mode below.
233
+ */
234
+ lines: function(el, o) {
235
+ var i = 0
236
+ , start = (o.lines - 1) * (1 - o.direction) / 2
237
+ , seg
238
+
239
+ function fill(color, shadow) {
240
+ return css(createEl(), {
241
+ position: 'absolute',
242
+ width: (o.length+o.width) + 'px',
243
+ height: o.width + 'px',
244
+ background: color,
245
+ boxShadow: shadow,
246
+ transformOrigin: 'left',
247
+ transform: 'rotate(' + ~~(360/o.lines*i+o.rotate) + 'deg) translate(' + o.radius+'px' +',0)',
248
+ borderRadius: (o.corners * o.width>>1) + 'px'
249
+ })
250
+ }
251
+
252
+ for (; i < o.lines; i++) {
253
+ seg = css(createEl(), {
254
+ position: 'absolute',
255
+ top: 1+~(o.width/2) + 'px',
256
+ transform: o.hwaccel ? 'translate3d(0,0,0)' : '',
257
+ opacity: o.opacity,
258
+ animation: useCssAnimations && addAnimation(o.opacity, o.trail, start + i * o.direction, o.lines) + ' ' + 1/o.speed + 's linear infinite'
259
+ })
260
+
261
+ if (o.shadow) ins(seg, css(fill('#000', '0 0 4px ' + '#000'), {top: 2+'px'}))
262
+
263
+ ins(el, ins(seg, fill(o.color, '0 0 1px rgba(0,0,0,.1)')))
264
+ }
265
+ return el
266
+ },
267
+
268
+ /**
269
+ * Internal method that adjusts the opacity of a single line.
270
+ * Will be overwritten in VML fallback mode below.
271
+ */
272
+ opacity: function(el, i, val) {
273
+ if (i < el.childNodes.length) el.childNodes[i].style.opacity = val
274
+ }
275
+
276
+ })
277
+
278
+
279
+ function initVML() {
280
+
281
+ /* Utility function to create a VML tag */
282
+ function vml(tag, attr) {
283
+ return createEl('<' + tag + ' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">', attr)
284
+ }
285
+
286
+ // No CSS transforms but VML support, add a CSS rule for VML elements:
287
+ sheet.addRule('.spin-vml', 'behavior:url(#default#VML)')
288
+
289
+ Spinner.prototype.lines = function(el, o) {
290
+ var r = o.length+o.width
291
+ , s = 2*r
292
+
293
+ function grp() {
294
+ return css(
295
+ vml('group', {
296
+ coordsize: s + ' ' + s,
297
+ coordorigin: -r + ' ' + -r
298
+ }),
299
+ { width: s, height: s }
300
+ )
301
+ }
302
+
303
+ var margin = -(o.width+o.length)*2 + 'px'
304
+ , g = css(grp(), {position: 'absolute', top: margin, left: margin})
305
+ , i
306
+
307
+ function seg(i, dx, filter) {
308
+ ins(g,
309
+ ins(css(grp(), {rotation: 360 / o.lines * i + 'deg', left: ~~dx}),
310
+ ins(css(vml('roundrect', {arcsize: o.corners}), {
311
+ width: r,
312
+ height: o.width,
313
+ left: o.radius,
314
+ top: -o.width>>1,
315
+ filter: filter
316
+ }),
317
+ vml('fill', {color: o.color, opacity: o.opacity}),
318
+ vml('stroke', {opacity: 0}) // transparent stroke to fix color bleeding upon opacity change
319
+ )
320
+ )
321
+ )
322
+ }
323
+
324
+ if (o.shadow)
325
+ for (i = 1; i <= o.lines; i++)
326
+ seg(i, -2, 'progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)')
327
+
328
+ for (i = 1; i <= o.lines; i++) seg(i)
329
+ return ins(el, g)
330
+ }
331
+
332
+ Spinner.prototype.opacity = function(el, i, val, o) {
333
+ var c = el.firstChild
334
+ o = o.shadow && o.lines || 0
335
+ if (c && i+o < c.childNodes.length) {
336
+ c = c.childNodes[i+o]; c = c && c.firstChild; c = c && c.firstChild
337
+ if (c) c.opacity = val
338
+ }
339
+ }
340
+ }
341
+
342
+ var probe = css(createEl('group'), {behavior: 'url(#default#VML)'})
343
+
344
+ if (!vendor(probe, 'transform') && probe.adj) initVML()
345
+ else useCssAnimations = vendor(probe, 'animation')
346
+
347
+ return Spinner
348
+
349
+ }));
@@ -0,0 +1,368 @@
1
+ /**
2
+ Image editable input.
3
+ **/
4
+ (function ($) {
5
+ "use strict";
6
+
7
+ var Image = function (options) {
8
+ this.init('image', options, Image.defaults);
9
+
10
+ if('on_error' in options.image) {
11
+ this.on_error = options.image['on_error'];
12
+ delete options.image['on_error']
13
+ }
14
+ if('on_success' in options.image) {
15
+ this.on_success = options.image['on_success'];
16
+ delete options.image['on_success']
17
+ }
18
+ if('max_size' in options.image) {
19
+ this.max_size = options.image['max_size'];
20
+ delete options.image['max_size']
21
+ }
22
+
23
+ this.initImage(options, Image.defaults);
24
+ };
25
+
26
+ //inherit from Abstract input
27
+ $.fn.editableutils.inherit(Image, $.fn.editabletypes.abstractinput);
28
+
29
+ $.extend(Image.prototype, {
30
+ initImage: function(options, defaults) {
31
+ this.options.image = $.extend({}, defaults.image, options.image);
32
+ this.name = this.options.image.name || 'editable-image-input';
33
+ },
34
+
35
+ /**
36
+ Renders input from tpl
37
+
38
+ @method render()
39
+ **/
40
+ render: function() {
41
+ var self = this;
42
+ this.$input = this.$tpl.find('input[type=hidden]:eq(0)');
43
+ this.$file = this.$tpl.find('input[type=file]:eq(0)');
44
+
45
+ this.$file.attr({'name':this.name});
46
+ this.$input.attr({'name':this.name+'-hidden'});
47
+
48
+
49
+ this.options.image.before_change = this.options.image.before_change || function(files, dropped) {
50
+ var file = files[0];
51
+ if(typeof file === "string") {
52
+ //files is just a file name here (in browsers that don't support FileReader API)
53
+ if(! (/\.(jpe?g|png|gif)$/i).test(file) ) {
54
+ if(self.on_error) self.on_error(1);
55
+ return false;
56
+ }
57
+ }
58
+ else {//file is a File object
59
+ var type = $.trim(file.type);
60
+ if( ( type.length > 0 && ! (/^image\/(jpe?g|png|gif)$/i).test(type) )
61
+ || ( type.length == 0 && ! (/\.(jpe?g|png|gif)$/i).test(file.name) )//for android default browser!
62
+ )
63
+ {
64
+ if(self.on_error) self.on_error(1);
65
+ return false;
66
+ }
67
+ if( self.max_size && file.size > self.max_size ) {
68
+ if(self.on_error) self.on_error(2);
69
+ return false;
70
+ }
71
+ }
72
+
73
+ if(self.on_success) self.on_success();
74
+ return true;
75
+ }
76
+ this.options.image.before_remove = this.options.image.before_remove || function() {
77
+ self.$input.val(null);
78
+ return true;
79
+ }
80
+
81
+ this.$file.ace_file_input(this.options.image).on('change', function(){
82
+ var $rand = (self.$file.val() || self.$file.data('ace_input_files')) ? Math.random() + "" + (new Date()).getTime() : null;
83
+ self.$input.val($rand)//set a random value, so that selected file is uploaded each time, even if it's the same file, because inline editable plugin does not update if the value is not changed!
84
+ }).closest('.ace-file-input').css({'width':'150px'}).closest('.editable-input').addClass('editable-image');
85
+ }
86
+
87
+ });
88
+
89
+
90
+ Image.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
91
+ tpl: '<span><input type="hidden" /></span><span><input type="file" /></span>',
92
+ inputclass: '',
93
+ image:
94
+ {
95
+ style: 'well',
96
+ btn_choose: 'Change Image',
97
+ btn_change: null,
98
+ no_icon: 'icon-picture',
99
+ thumbnail: 'large'
100
+ }
101
+ });
102
+
103
+ $.fn.editabletypes.image = Image;
104
+
105
+ }(window.jQuery));
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+ //Wysiwyg
117
+ (function ($) {
118
+ "use strict";
119
+
120
+ var Wysiwyg = function (options) {
121
+ this.init('wysiwyg', options, Wysiwyg.defaults);
122
+
123
+ //extend wysiwyg manually as $.extend not recursive
124
+ this.options.wysiwyg = $.extend({}, Wysiwyg.defaults.wysiwyg, options.wysiwyg);
125
+ };
126
+
127
+ $.fn.editableutils.inherit(Wysiwyg, $.fn.editabletypes.abstractinput);
128
+
129
+ $.extend(Wysiwyg.prototype, {
130
+ render: function () {
131
+ this.$editor = this.$input.nextAll('.wysiwyg-editor:eq(0)');
132
+
133
+ this.$tpl.parent().find('.wysiwyg-editor').show().ace_wysiwyg(
134
+ {
135
+ toolbar:
136
+ [
137
+ 'bold',
138
+ 'italic',
139
+ 'strikethrough',
140
+ 'underline',
141
+ null,
142
+ 'foreColor',
143
+ null,
144
+ 'insertImage'
145
+ ]
146
+ }
147
+ )
148
+ .prev().addClass('wysiwyg-style2')
149
+ .closest('.editable-input').addClass('editable-wysiwyg')
150
+ .closest('.editable-container').css({'display':'block'});//if display is inline-block, putting large images inside the editor will expand it out of bounding box!
151
+
152
+ if(this.options.wysiwyg && this.options.wysiwyg.css)
153
+ this.$tpl.closest('.editable-wysiwyg').css(this.options.wysiwyg.css);
154
+ },
155
+
156
+
157
+ value2html: function(value, element) {
158
+ $(element).html(value);
159
+ return false;
160
+ },
161
+
162
+ html2value: function(html) {
163
+ return html;
164
+ },
165
+
166
+ value2input: function(value) {
167
+ this.$editor.html(value);
168
+ },
169
+ input2value: function() {
170
+ return this.$editor.html();
171
+ },
172
+
173
+ activate: function() {
174
+ //this.$editor.focus().get(0).setSelectionRange(200,200);
175
+ }
176
+ });
177
+
178
+
179
+
180
+ Wysiwyg.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
181
+ tpl: '<input type="hidden" /><div class="wysiwyg-editor"></div>',
182
+ inputclass: 'editable-wysiwyg',
183
+ wysiwyg: {
184
+
185
+ }
186
+ });
187
+
188
+ $.fn.editabletypes.wysiwyg = Wysiwyg;
189
+
190
+ }(window.jQuery));
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+ /**
200
+ Spinner editable input.
201
+ **/
202
+ (function ($) {
203
+ "use strict";
204
+
205
+ var Spinner = function (options) {
206
+ this.init('spinner', options, Spinner.defaults);
207
+ this.initSpinner(options, Spinner.defaults);
208
+ };
209
+
210
+ //inherit from Abstract input
211
+ $.fn.editableutils.inherit(Spinner, $.fn.editabletypes.abstractinput);
212
+
213
+ $.extend(Spinner.prototype, {
214
+ initSpinner: function(options, defaults) {
215
+ this.options.spinner = $.extend({}, defaults.spinner, options.spinner);
216
+ },
217
+
218
+ /**
219
+ Renders input from tpl
220
+
221
+ @method render()
222
+ **/
223
+ render: function() {
224
+ },
225
+
226
+ /**
227
+ Activates input: sets focus on the first field.
228
+
229
+ @method activate()
230
+ **/
231
+ activate: function() {
232
+ if(this.$input.is(':visible')) {
233
+ this.$input.focus();
234
+ $.fn.editableutils.setCursorPosition(this.$input.get(0), this.$input.val().length);
235
+
236
+ var val = parseInt(this.$input.val());
237
+ var options = $.extend({value:val}, this.options.spinner);
238
+ this.$input.ace_spinner(options);
239
+ }
240
+ },
241
+
242
+ /**
243
+ Attaches handler to submit form in case of 'showbuttons=false' mode
244
+
245
+ @method autosubmit()
246
+ **/
247
+ autosubmit: function() {
248
+ this.$input.keydown(function (e) {
249
+ if (e.which === 13) {
250
+ $(this).closest('form').submit();
251
+ }
252
+ });
253
+ }
254
+ });
255
+
256
+ Spinner.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
257
+ tpl: '<input type="text" />',
258
+ inputclass: '',
259
+ spinner:{
260
+ min:0,
261
+ max:100,
262
+ step:1,
263
+ icon_up:'icon-plus',
264
+ icon_down:'icon-minus',
265
+ btn_up_class:'btn-success',
266
+ btn_down_class:'btn-danger'
267
+ }
268
+ });
269
+
270
+ $.fn.editabletypes.spinner = Spinner;
271
+
272
+ }(window.jQuery));
273
+
274
+
275
+
276
+
277
+
278
+
279
+
280
+
281
+ /**
282
+ Slider editable input.
283
+ **/
284
+ (function ($) {
285
+ "use strict";
286
+
287
+ var Slider = function (options) {
288
+ this.init('slider', options, Slider.defaults);
289
+ this.initSlider(options, Slider.defaults);
290
+ };
291
+
292
+ //inherit from Abstract input
293
+ $.fn.editableutils.inherit(Slider, $.fn.editabletypes.abstractinput);
294
+
295
+ $.extend(Slider.prototype, {
296
+ initSlider: function(options, defaults) {
297
+ this.options.slider = $.extend({}, defaults.slider, options.slider);
298
+ },
299
+
300
+ /**
301
+ Renders input from tpl
302
+
303
+ @method render()
304
+ **/
305
+ render: function() {
306
+ },
307
+ /**
308
+ Activates input: sets focus on the first field.
309
+
310
+ @method activate()
311
+ **/
312
+ activate: function() {
313
+ if(this.$input.is(':visible')) {
314
+ this.$input.focus();
315
+ $.fn.editableutils.setCursorPosition(this.$input.get(0), this.$input.val().length);
316
+
317
+ var self = this;
318
+ var val = parseInt(this.$input.val());
319
+ var width = this.options.slider.width || 200;
320
+ var options = $.extend(this.options.slider , {
321
+ value:val,
322
+ slide: function( event, ui ) {
323
+ var val = parseInt(ui.value);
324
+ self.$input.val(val);
325
+
326
+ if(ui.handle.firstChild == null) {/* no tooltips attached to it */
327
+ $(ui.handle).append("<div class='tooltip top in' style='display:none;top:-42px;left:-4px;'><div class='tooltip-arrow'></div><div class='tooltip-inner'></div></div>");
328
+ }
329
+ $(ui.handle.firstChild).show().children().eq(1).text(val);
330
+ }
331
+ });
332
+
333
+ this.$input.parent().addClass('editable-slider').css('width', width+'px').slider(options);
334
+ }
335
+ },
336
+
337
+ value2html: function(value, element) {
338
+ },
339
+
340
+ /**
341
+ Attaches handler to submit form in case of 'showbuttons=false' mode
342
+
343
+ @method autosubmit()
344
+ **/
345
+ autosubmit: function() {
346
+ this.$input.keydown(function (e) {
347
+ if (e.which === 13) {
348
+ $(this).closest('form').submit();
349
+ }
350
+ });
351
+ }
352
+ });
353
+
354
+ Slider.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
355
+ tpl: '<input type="text" /><span class="inline ui-slider-green"><span class="slider-display"></span></span>',
356
+ inputclass: '',
357
+ slider:{
358
+ min:1,
359
+ max:100,
360
+ step:1,
361
+ range: "min"
362
+ }
363
+ });
364
+
365
+ $.fn.editabletypes.slider = Slider;
366
+
367
+ }(window.jQuery));
368
+