spina 0.11.0 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of spina might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4904a52feebc062d65abf07b33db08856cc67756
4
- data.tar.gz: fff012b908479d92ce35c0c0dd14635dae39e525
3
+ metadata.gz: 046211e519bf447988ae325988cbc82be0be058f
4
+ data.tar.gz: 540be8a7eed78c94b681008de0bbacc36b6ee827
5
5
  SHA512:
6
- metadata.gz: 6f8c1e26d66ea610d6288848a6a2617c2ef007ee15c8311a68c4d522c627e032e9a1a9c3187e6705b315abe56d9516071e4e79f4155fc20e122ed8d321ab7536
7
- data.tar.gz: fde4f1b9538a642ec49f6cbf25b279b345a822eb712c316b84c37e1e224b86a5a3b91dbe6f52d4ec9c3b93d2986b48a59dfc9c273d6bd3ba2b1e388e66585dab
6
+ metadata.gz: 32e00372ee066b491faa67c99104caf0c2092a54fa8e88c2db777ef9e4805e104f390d25581e388db01cbe856e591802651941dc6b0eee66f789d0c0283ac14d
7
+ data.tar.gz: 67fbfb563f796ea36f57c7507c16f7e4dba7d5c9c354645a670ea1a8afb72efc3d894d3423b972e004dd51f9513e712e4232fc6e0bf1ca33076ae5b27438a0ed
data/README.md CHANGED
@@ -14,7 +14,7 @@ Spina is a CMS built upon the Rails framework. This guide is designed for develo
14
14
  To start using Spina CMS add the following line to your Gemfile:
15
15
 
16
16
  ```ruby
17
- gem 'spina', git: 'https://github.com/denkGroot/Spina'
17
+ gem 'spina'
18
18
  ```
19
19
 
20
20
  Make sure you run the installer to get started.
data/lib/spina/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Spina
2
- VERSION = "0.11.0"
2
+ VERSION = "0.11.1"
3
3
  end
@@ -0,0 +1,85 @@
1
+ /**
2
+ * --------------------------------------------------------------------
3
+ * jQuery customfileinput plugin
4
+ * Author: Scott Jehl, scott@filamentgroup.com
5
+ * Copyright (c) 2009 Filament Group
6
+ * licensed under MIT (filamentgroup.com/examples/mit-license.txt)
7
+ * --------------------------------------------------------------------
8
+ */
9
+ $.fn.customFileInput = function(){
10
+ //apply events and styles for file input element
11
+ var fileInput = $(this)
12
+ .addClass('customfile-input') //add class for CSS
13
+ .mouseover(function(){ upload.addClass('customfile-hover'); })
14
+ .mouseout(function(){ upload.removeClass('customfile-hover'); })
15
+ .focus(function(){
16
+ upload.addClass('customfile-focus');
17
+ fileInput.data('val', fileInput.val());
18
+ })
19
+ .blur(function(){
20
+ upload.removeClass('customfile-focus');
21
+ $(this).trigger('checkChange');
22
+ })
23
+ .bind('disable',function(){
24
+ fileInput.attr('disabled',true);
25
+ upload.addClass('customfile-disabled');
26
+ })
27
+ .bind('enable',function(){
28
+ fileInput.removeAttr('disabled');
29
+ upload.removeClass('customfile-disabled');
30
+ })
31
+ .bind('checkChange', function(){
32
+ if(fileInput.val() && fileInput.val() != fileInput.data('val')){
33
+ fileInput.trigger('change');
34
+ }
35
+ })
36
+ .bind('change',function(){
37
+ //get file name
38
+ var fileName = $(this).val().split(/\\/).pop();
39
+ //get file extension
40
+ var fileExt = 'customfile-ext-' + fileName.split('.').pop().toLowerCase();
41
+ //update the feedback
42
+ uploadFeedback
43
+ .text(fileName) //set feedback text to filename
44
+ .removeClass(uploadFeedback.data('fileExt') || '') //remove any existing file extension class
45
+ .addClass(fileExt) //add file extension class
46
+ .data('fileExt', fileExt) //store file extension for class removal on next change
47
+ .addClass('customfile-feedback-populated'); //add class to show populated state
48
+ //change text of button
49
+ uploadButton.text('Kies een bestand');
50
+ })
51
+ .click(function(){ //for IE and Opera, make sure change fires after choosing a file, using an async callback
52
+ fileInput.data('val', fileInput.val());
53
+ setTimeout(function(){
54
+ fileInput.trigger('checkChange');
55
+ },100);
56
+ });
57
+
58
+ //create custom control container
59
+ var upload = $('<div class="customfile"></div>');
60
+ //create custom control button
61
+ var uploadButton = $('<span class="customfile-button" aria-hidden="true">voeg foto toe</span>').appendTo(upload);
62
+ //create custom control feedback
63
+ var uploadFeedback = $('<span class="customfile-feedback" aria-hidden="true">Geen bestand geselecteerd...</span>').appendTo(upload);
64
+
65
+ //match disabled state
66
+ if(fileInput.is('[disabled]')){
67
+ fileInput.trigger('disable');
68
+ }
69
+
70
+
71
+ //on mousemove, keep file input under the cursor to steal click
72
+ upload
73
+ .mousemove(function(e){
74
+ fileInput.css({
75
+ 'left': e.pageX - upload.offset().left - fileInput.outerWidth() + 20, //position right side 20px right of cursor X)
76
+ 'top': e.pageY - upload.offset().top - $(window).scrollTop() - 3
77
+ });
78
+ })
79
+ .insertAfter(fileInput); //insert after the input
80
+
81
+ fileInput.appendTo(upload);
82
+
83
+ //return jQuery
84
+ return $(this);
85
+ };
@@ -0,0 +1,345 @@
1
+ /**
2
+ * Farbtastic Color Picker 1.2
3
+ * © 2008 Steven Wittens
4
+ *
5
+ * This program is free software; you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation; either version 2 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU General Public License
16
+ * along with this program; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+ */
19
+
20
+ jQuery.fn.farbtastic = function (callback) {
21
+ $.farbtastic(this, callback);
22
+ return this;
23
+ };
24
+
25
+ jQuery.farbtastic = function (container, callback) {
26
+ var container = $(container).get(0);
27
+ return container.farbtastic || (container.farbtastic = new jQuery._farbtastic(container, callback));
28
+ }
29
+
30
+ jQuery._farbtastic = function (container, callback) {
31
+ // Store farbtastic object
32
+ var fb = this;
33
+
34
+ // Insert markup
35
+ $(container).html('<div class="farbtastic"><div class="color"></div><div class="wheel"></div><div class="overlay"></div><div class="h-marker marker"></div><div class="sl-marker marker"></div></div>');
36
+ var e = $('.farbtastic', container);
37
+ fb.wheel = $('.wheel', container).get(0);
38
+ // Dimensions
39
+ fb.radius = 84;
40
+ fb.square = 100;
41
+ fb.width = 194;
42
+
43
+ // Fix background PNGs in IE6
44
+ if (navigator.appVersion.match(/MSIE [0-6]\./)) {
45
+ $('*', e).each(function () {
46
+ if (this.currentStyle.backgroundImage != 'none') {
47
+ var image = this.currentStyle.backgroundImage;
48
+ image = this.currentStyle.backgroundImage.substring(5, image.length - 2);
49
+ $(this).css({
50
+ 'backgroundImage': 'none',
51
+ 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')"
52
+ });
53
+ }
54
+ });
55
+ }
56
+
57
+ /**
58
+ * Link to the given element(s) or callback.
59
+ */
60
+ fb.linkTo = function (callback) {
61
+ // Unbind previous nodes
62
+ if (typeof fb.callback == 'object') {
63
+ $(fb.callback).unbind('keyup', fb.updateValue);
64
+ }
65
+
66
+ // Reset color
67
+ fb.color = null;
68
+
69
+ // Bind callback or elements
70
+ if (typeof callback == 'function') {
71
+ fb.callback = callback;
72
+ }
73
+ else if (typeof callback == 'object' || typeof callback == 'string') {
74
+ fb.callback = $(callback);
75
+ fb.callback.bind('keyup', fb.updateValue);
76
+ if (fb.callback.get(0).value) {
77
+ fb.setColor(fb.callback.get(0).value);
78
+ }
79
+ }
80
+ return this;
81
+ }
82
+ fb.updateValue = function (event) {
83
+ if (this.value && this.value != fb.color) {
84
+ fb.setColor(this.value);
85
+ }
86
+ }
87
+
88
+ /**
89
+ * Change color with HTML syntax #123456
90
+ */
91
+ fb.setColor = function (color) {
92
+ var unpack = fb.unpack(color);
93
+ if (fb.color != color && unpack) {
94
+ fb.color = color;
95
+ fb.rgb = unpack;
96
+ fb.hsl = fb.RGBToHSL(fb.rgb);
97
+ fb.updateDisplay();
98
+ }
99
+ return this;
100
+ }
101
+
102
+ /**
103
+ * Change color with HSL triplet [0..1, 0..1, 0..1]
104
+ */
105
+ fb.setHSL = function (hsl) {
106
+ fb.hsl = hsl;
107
+ fb.rgb = fb.HSLToRGB(hsl);
108
+ fb.color = fb.pack(fb.rgb);
109
+ fb.updateDisplay();
110
+ return this;
111
+ }
112
+
113
+ /////////////////////////////////////////////////////
114
+
115
+ /**
116
+ * Retrieve the coordinates of the given event relative to the center
117
+ * of the widget.
118
+ */
119
+ fb.widgetCoords = function (event) {
120
+ var x, y;
121
+ var el = event.target || event.srcElement;
122
+ var reference = fb.wheel;
123
+
124
+ if (typeof event.offsetX != 'undefined') {
125
+ // Use offset coordinates and find common offsetParent
126
+ var pos = { x: event.offsetX, y: event.offsetY };
127
+
128
+ // Send the coordinates upwards through the offsetParent chain.
129
+ var e = el;
130
+ while (e) {
131
+ e.mouseX = pos.x;
132
+ e.mouseY = pos.y;
133
+ pos.x += e.offsetLeft;
134
+ pos.y += e.offsetTop;
135
+ e = e.offsetParent;
136
+ }
137
+
138
+ // Look for the coordinates starting from the wheel widget.
139
+ var e = reference;
140
+ var offset = { x: 0, y: 0 }
141
+ while (e) {
142
+ if (typeof e.mouseX != 'undefined') {
143
+ x = e.mouseX - offset.x;
144
+ y = e.mouseY - offset.y;
145
+ break;
146
+ }
147
+ offset.x += e.offsetLeft;
148
+ offset.y += e.offsetTop;
149
+ e = e.offsetParent;
150
+ }
151
+
152
+ // Reset stored coordinates
153
+ e = el;
154
+ while (e) {
155
+ e.mouseX = undefined;
156
+ e.mouseY = undefined;
157
+ e = e.offsetParent;
158
+ }
159
+ }
160
+ else {
161
+ // Use absolute coordinates
162
+ var pos = fb.absolutePosition(reference);
163
+ x = (event.pageX || 0*(event.clientX + $('html').get(0).scrollLeft)) - pos.x;
164
+ y = (event.pageY || 0*(event.clientY + $('html').get(0).scrollTop)) - pos.y;
165
+ }
166
+ // Subtract distance to middle
167
+ return { x: x - fb.width / 2, y: y - fb.width / 2 };
168
+ }
169
+
170
+ /**
171
+ * Mousedown handler
172
+ */
173
+ fb.mousedown = function (event) {
174
+ // Capture mouse
175
+ if (!document.dragging) {
176
+ $(document).bind('mousemove', fb.mousemove).bind('mouseup', fb.mouseup);
177
+ document.dragging = true;
178
+ }
179
+
180
+ // Check which area is being dragged
181
+ var pos = fb.widgetCoords(event);
182
+ fb.circleDrag = Math.max(Math.abs(pos.x), Math.abs(pos.y)) * 2 > fb.square;
183
+
184
+ // Process
185
+ fb.mousemove(event);
186
+ return false;
187
+ }
188
+
189
+ /**
190
+ * Mousemove handler
191
+ */
192
+ fb.mousemove = function (event) {
193
+ // Get coordinates relative to color picker center
194
+ var pos = fb.widgetCoords(event);
195
+
196
+ // Set new HSL parameters
197
+ if (fb.circleDrag) {
198
+ var hue = Math.atan2(pos.x, -pos.y) / 6.28;
199
+ if (hue < 0) hue += 1;
200
+ fb.setHSL([hue, fb.hsl[1], fb.hsl[2]]);
201
+ }
202
+ else {
203
+ var sat = Math.max(0, Math.min(1, -(pos.x / fb.square) + .5));
204
+ var lum = Math.max(0, Math.min(1, -(pos.y / fb.square) + .5));
205
+ fb.setHSL([fb.hsl[0], sat, lum]);
206
+ }
207
+ return false;
208
+ }
209
+
210
+ /**
211
+ * Mouseup handler
212
+ */
213
+ fb.mouseup = function () {
214
+ // Uncapture mouse
215
+ $(document).unbind('mousemove', fb.mousemove);
216
+ $(document).unbind('mouseup', fb.mouseup);
217
+ document.dragging = false;
218
+ }
219
+
220
+ /**
221
+ * Update the markers and styles
222
+ */
223
+ fb.updateDisplay = function () {
224
+ // Markers
225
+ var angle = fb.hsl[0] * 6.28;
226
+ $('.h-marker', e).css({
227
+ left: Math.round(Math.sin(angle) * fb.radius + fb.width / 2) + 'px',
228
+ top: Math.round(-Math.cos(angle) * fb.radius + fb.width / 2) + 'px'
229
+ });
230
+
231
+ $('.sl-marker', e).css({
232
+ left: Math.round(fb.square * (.5 - fb.hsl[1]) + fb.width / 2) + 'px',
233
+ top: Math.round(fb.square * (.5 - fb.hsl[2]) + fb.width / 2) + 'px'
234
+ });
235
+
236
+ // Saturation/Luminance gradient
237
+ $('.color', e).css('backgroundColor', fb.pack(fb.HSLToRGB([fb.hsl[0], 1, 0.5])));
238
+
239
+ // Linked elements or callback
240
+ if (typeof fb.callback == 'object') {
241
+ // Set background/foreground color
242
+ $(fb.callback).css({
243
+ backgroundColor: fb.color,
244
+ color: fb.hsl[2] > 0.5 ? '#000' : '#fff'
245
+ });
246
+
247
+ // Change linked value
248
+ $(fb.callback).each(function() {
249
+ if (this.value && this.value != fb.color) {
250
+ this.value = fb.color;
251
+ }
252
+ });
253
+ }
254
+ else if (typeof fb.callback == 'function') {
255
+ fb.callback.call(fb, fb.color);
256
+ }
257
+ }
258
+
259
+ /**
260
+ * Get absolute position of element
261
+ */
262
+ fb.absolutePosition = function (el) {
263
+ var r = { x: el.offsetLeft, y: el.offsetTop };
264
+ // Resolve relative to offsetParent
265
+ if (el.offsetParent) {
266
+ var tmp = fb.absolutePosition(el.offsetParent);
267
+ r.x += tmp.x;
268
+ r.y += tmp.y;
269
+ }
270
+ return r;
271
+ };
272
+
273
+ /* Various color utility functions */
274
+ fb.pack = function (rgb) {
275
+ var r = Math.round(rgb[0] * 255);
276
+ var g = Math.round(rgb[1] * 255);
277
+ var b = Math.round(rgb[2] * 255);
278
+ return '#' + (r < 16 ? '0' : '') + r.toString(16) +
279
+ (g < 16 ? '0' : '') + g.toString(16) +
280
+ (b < 16 ? '0' : '') + b.toString(16);
281
+ }
282
+
283
+ fb.unpack = function (color) {
284
+ if (color.length == 7) {
285
+ return [parseInt('0x' + color.substring(1, 3)) / 255,
286
+ parseInt('0x' + color.substring(3, 5)) / 255,
287
+ parseInt('0x' + color.substring(5, 7)) / 255];
288
+ }
289
+ else if (color.length == 4) {
290
+ return [parseInt('0x' + color.substring(1, 2)) / 15,
291
+ parseInt('0x' + color.substring(2, 3)) / 15,
292
+ parseInt('0x' + color.substring(3, 4)) / 15];
293
+ }
294
+ }
295
+
296
+ fb.HSLToRGB = function (hsl) {
297
+ var m1, m2, r, g, b;
298
+ var h = hsl[0], s = hsl[1], l = hsl[2];
299
+ m2 = (l <= 0.5) ? l * (s + 1) : l + s - l*s;
300
+ m1 = l * 2 - m2;
301
+ return [this.hueToRGB(m1, m2, h+0.33333),
302
+ this.hueToRGB(m1, m2, h),
303
+ this.hueToRGB(m1, m2, h-0.33333)];
304
+ }
305
+
306
+ fb.hueToRGB = function (m1, m2, h) {
307
+ h = (h < 0) ? h + 1 : ((h > 1) ? h - 1 : h);
308
+ if (h * 6 < 1) return m1 + (m2 - m1) * h * 6;
309
+ if (h * 2 < 1) return m2;
310
+ if (h * 3 < 2) return m1 + (m2 - m1) * (0.66666 - h) * 6;
311
+ return m1;
312
+ }
313
+
314
+ fb.RGBToHSL = function (rgb) {
315
+ var min, max, delta, h, s, l;
316
+ var r = rgb[0], g = rgb[1], b = rgb[2];
317
+ min = Math.min(r, Math.min(g, b));
318
+ max = Math.max(r, Math.max(g, b));
319
+ delta = max - min;
320
+ l = (min + max) / 2;
321
+ s = 0;
322
+ if (l > 0 && l < 1) {
323
+ s = delta / (l < 0.5 ? (2 * l) : (2 - 2 * l));
324
+ }
325
+ h = 0;
326
+ if (delta > 0) {
327
+ if (max == r && max != g) h += (g - b) / delta;
328
+ if (max == g && max != b) h += (2 + (b - r) / delta);
329
+ if (max == b && max != r) h += (4 + (r - g) / delta);
330
+ h /= 6;
331
+ }
332
+ return [h, s, l];
333
+ }
334
+
335
+ // Install mousedown handler (the others are set on the document on-demand)
336
+ $('*', e).mousedown(fb.mousedown);
337
+
338
+ // Init color
339
+ fb.setColor('#000000');
340
+
341
+ // Set linked elements/callback
342
+ if (callback) {
343
+ fb.linkTo(callback);
344
+ }
345
+ }