Permalink
Browse files

refactor all the things

  • Loading branch information...
1 parent 1b5cb4f commit 18133c6832269d1ffc80a60ac27f46d14c25c9f6 @maccman committed Mar 29, 2012
View
@@ -10,7 +10,7 @@ gem 'coffee-script'
gem 'eco'
gem 'uglifier'
gem 'sprockets'
-gem 'sprockets-commonjs'
+gem 'sprockets-commonjs', :git => 'git://github.com/maccman/sprockets-commonjs.git'
gem 'stylus'
group :test, :development do
View
@@ -6,6 +6,13 @@ GIT
guard
sprockets (~> 2.0)
+GIT
+ remote: git://github.com/maccman/sprockets-commonjs.git
+ revision: 76520f2bdf805d308220f7fd56cab78afbe01892
+ specs:
+ sprockets-commonjs (0.0.2)
+ sprockets (~> 2.4.0)
+
GEM
remote: http://rubygems.org/
specs:
@@ -67,8 +74,6 @@ GEM
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
- sprockets-commonjs (0.0.2)
- sprockets (~> 2.4.0)
stylus (0.5.0)
execjs
stylus-source
@@ -98,7 +103,7 @@ DEPENDENCIES
sinatra
sinatra-contrib
sprockets
- sprockets-commonjs
+ sprockets-commonjs!
stylus
thin
uglifier
@@ -4,7 +4,6 @@ Opacity = require('./inspector/opacity')
BoxShadow = require('./inspector/box_shadow')
TextShadow = require('./inspector/text_shadow')
-
class Inspector extends Spine.Controller
className: 'inspector'
@@ -18,7 +17,7 @@ class Inspector extends Spine.Controller
# @append(new Background(stage: @stage))
# @append(new Border(stage: @stage))
@append(new Opacity(stage: @stage))
- # @append(new BoxShadow(stage: @stage))
+ @append(new BoxShadow(stage: @stage))
# @append(new TextShadow(stage: @stage))
module.exports = Inspector
@@ -1,30 +1,35 @@
-ColorPicker = require('lib/color_picker')
+Collection = require('lib/collection')
+Color = require('app/models/properties/color')
+BackgroundImage = require('app/models/properties/background_image')
class List
class Background extends Spine.Controller
className: 'background'
- styles: [
- 'background',
- 'backgroundColor',
- 'backgroundImage',
- 'backgroundRepeat',
- 'backgroundSize'
- ]
+ # styles: [
+ # 'background',
+ # 'backgroundColor',
+ # 'backgroundImage',
+ # 'backgroundRepeat',
+ # 'backgroundSize'
+ # ]
+ #
constructor: ->
super
@render()
render: =>
- @values = {}
+ @backgroundImage = @stage.selection.get('backgroundImage')
+ @backgroundImage = new Collection(@backgroundImage)
- for style in @styles
- @values[style] = @stage.selection.get(style)
+ @backgroundColor = @stage.selection.get('backgroundColor')
@el.empty()
@el.append('<h3>Background</h3>')
+ set: =>
+ @stage.selection.set('backgroundImage', @backgroundImage.valueOf())
module.exports = Background
@@ -117,7 +117,6 @@ class BoxShadow extends Spine.Controller
@disabled = not @stage.selection.isAny()
shadows = @stage.selection.get('boxShadow')
- shadows = Shadow.fromString(shadows)
@shadows = new Collection(shadows)
@current = @shadows.first()
@@ -148,6 +147,6 @@ class BoxShadow extends Spine.Controller
if shadow
@shadows.push(shadow) unless @shadows.include(shadow)
- @stage.selection.set('boxShadow', @shadows.join(', '))
+ @stage.selection.set('boxShadow', @shadows.valueOf())
module.exports = BoxShadow
@@ -32,7 +32,6 @@ class TextShadow extends Spine.Controller
@disabled = not @stage.selection.isAny()
@shadow = @stage.selection.get('textShadow')
- @shadow = Shadow.fromString(@shadow)[0] if @shadow
@shadow or= new Shadow
@html JST['app/views/inspector/text_shadow'](@)
@@ -77,6 +76,6 @@ class TextShadow extends Spine.Controller
@shadow.y = parseFloat(@$y.val())
@shadow.blur = parseFloat(@$blur.val())
- @stage.selection.set('textShadow', @shadow.toString())
+ @stage.selection.set('textShadow', @shadow)
module.exports = TextShadow
@@ -44,4 +44,7 @@ class Collection extends Array
last: ->
@[@length - 1]
+ valueOf: ->
+ @slice(0)
+
module.exports = Collection
@@ -88,7 +88,10 @@ this.require.define({"app/controllers/inspector":function(exports, require, modu
Inspector.prototype.render = function() {
this.el.empty();
- return this.append(new Opacity({
+ this.append(new Opacity({
+ stage: this.stage
+ }));
+ return this.append(new BoxShadow({
stage: this.stage
}));
};
@@ -59,12 +59,16 @@
return this.require;
}).call(this);
this.require.define({"app/controllers/inspector/background":function(exports, require, module){(function() {
- var Background, ColorPicker, List,
+ var Background, BackgroundImage, Collection, Color, List,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = Object.prototype.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
- ColorPicker = require('lib/color_picker');
+ Collection = require('lib/collection');
+
+ Color = require('app/models/properties/color');
+
+ BackgroundImage = require('app/models/properties/background_image');
List = (function() {
@@ -80,25 +84,24 @@ this.require.define({"app/controllers/inspector/background":function(exports, re
Background.prototype.className = 'background';
- Background.prototype.styles = ['background', 'backgroundColor', 'backgroundImage', 'backgroundRepeat', 'backgroundSize'];
-
function Background() {
+ this.set = __bind(this.set, this);
this.render = __bind(this.render, this); Background.__super__.constructor.apply(this, arguments);
this.render();
}
Background.prototype.render = function() {
- var style, _i, _len, _ref;
- this.values = {};
- _ref = this.styles;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- style = _ref[_i];
- this.values[style] = this.stage.selection.get(style);
- }
+ this.backgroundImage = this.stage.selection.get('backgroundImage');
+ this.backgroundImage = new Collection(this.backgroundImage);
+ this.backgroundColor = this.stage.selection.get('backgroundColor');
this.el.empty();
return this.el.append('<h3>Background</h3>');
};
+ Background.prototype.set = function() {
+ return this.stage.selection.set('backgroundImage', this.backgroundImage.valueOf());
+ };
+
return Background;
})(Spine.Controller);
@@ -215,7 +215,6 @@ this.require.define({"app/controllers/inspector/box_shadow":function(exports, re
_this = this;
this.disabled = !this.stage.selection.isAny();
shadows = this.stage.selection.get('boxShadow');
- shadows = Shadow.fromString(shadows);
this.shadows = new Collection(shadows);
this.current = this.shadows.first();
this.shadows.change(this.set);
@@ -239,7 +238,7 @@ this.require.define({"app/controllers/inspector/box_shadow":function(exports, re
BoxShadow.prototype.set = function(shadow) {
if (shadow) if (!this.shadows.include(shadow)) this.shadows.push(shadow);
- return this.stage.selection.set('boxShadow', this.shadows.join(', '));
+ return this.stage.selection.set('boxShadow', this.shadows.valueOf());
};
return BoxShadow;
@@ -104,7 +104,6 @@ this.require.define({"app/controllers/inspector/text_shadow":function(exports, r
var _ref;
this.disabled = !this.stage.selection.isAny();
this.shadow = this.stage.selection.get('textShadow');
- if (this.shadow) this.shadow = Shadow.fromString(this.shadow)[0];
this.shadow || (this.shadow = new Shadow);
this.html(JST['app/views/inspector/text_shadow'](this));
this.$('input').attr('disabled', this.disabled);
@@ -151,7 +150,7 @@ this.require.define({"app/controllers/inspector/text_shadow":function(exports, r
this.shadow.x = parseFloat(this.$x.val());
this.shadow.y = parseFloat(this.$y.val());
this.shadow.blur = parseFloat(this.$blur.val());
- return this.stage.selection.set('textShadow', this.shadow.toString());
+ return this.stage.selection.set('textShadow', this.shadow);
};
return TextShadow;
@@ -11199,6 +11199,10 @@ this.require.define({"lib/collection":function(exports, require, module){(functi
return this[this.length - 1];
};
+ Collection.prototype.valueOf = function() {
+ return this.slice(0);
+ };
+
return Collection;
})(Array);
@@ -12646,7 +12650,10 @@ this.require.define({"app/controllers/inspector":function(exports, require, modu
Inspector.prototype.render = function() {
this.el.empty();
- return this.append(new Opacity({
+ this.append(new Opacity({
+ stage: this.stage
+ }));
+ return this.append(new BoxShadow({
stage: this.stage
}));
};
@@ -12660,12 +12667,16 @@ this.require.define({"app/controllers/inspector":function(exports, require, modu
}).call(this);
;}});
this.require.define({"app/controllers/inspector/background":function(exports, require, module){(function() {
- var Background, ColorPicker, List,
+ var Background, BackgroundImage, Collection, Color, List,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = Object.prototype.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
- ColorPicker = require('lib/color_picker');
+ Collection = require('lib/collection');
+
+ Color = require('app/models/properties/color');
+
+ BackgroundImage = require('app/models/properties/background_image');
List = (function() {
@@ -12681,25 +12692,24 @@ this.require.define({"app/controllers/inspector/background":function(exports, re
Background.prototype.className = 'background';
- Background.prototype.styles = ['background', 'backgroundColor', 'backgroundImage', 'backgroundRepeat', 'backgroundSize'];
-
function Background() {
+ this.set = __bind(this.set, this);
this.render = __bind(this.render, this); Background.__super__.constructor.apply(this, arguments);
this.render();
}
Background.prototype.render = function() {
- var style, _i, _len, _ref;
- this.values = {};
- _ref = this.styles;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- style = _ref[_i];
- this.values[style] = this.stage.selection.get(style);
- }
+ this.backgroundImage = this.stage.selection.get('backgroundImage');
+ this.backgroundImage = new Collection(this.backgroundImage);
+ this.backgroundColor = this.stage.selection.get('backgroundColor');
this.el.empty();
return this.el.append('<h3>Background</h3>');
};
+ Background.prototype.set = function() {
+ return this.stage.selection.set('backgroundImage', this.backgroundImage.valueOf());
+ };
+
return Background;
})(Spine.Controller);
@@ -12903,7 +12913,6 @@ this.require.define({"app/controllers/inspector/box_shadow":function(exports, re
_this = this;
this.disabled = !this.stage.selection.isAny();
shadows = this.stage.selection.get('boxShadow');
- shadows = Shadow.fromString(shadows);
this.shadows = new Collection(shadows);
this.current = this.shadows.first();
this.shadows.change(this.set);
@@ -12927,7 +12936,7 @@ this.require.define({"app/controllers/inspector/box_shadow":function(exports, re
BoxShadow.prototype.set = function(shadow) {
if (shadow) if (!this.shadows.include(shadow)) this.shadows.push(shadow);
- return this.stage.selection.set('boxShadow', this.shadows.join(', '));
+ return this.stage.selection.set('boxShadow', this.shadows.valueOf());
};
return BoxShadow;
@@ -13028,7 +13037,6 @@ this.require.define({"app/controllers/inspector/text_shadow":function(exports, r
var _ref;
this.disabled = !this.stage.selection.isAny();
this.shadow = this.stage.selection.get('textShadow');
- if (this.shadow) this.shadow = Shadow.fromString(this.shadow)[0];
this.shadow || (this.shadow = new Shadow);
this.html(JST['app/views/inspector/text_shadow'](this));
this.$('input').attr('disabled', this.disabled);
@@ -13075,7 +13083,7 @@ this.require.define({"app/controllers/inspector/text_shadow":function(exports, r
this.shadow.x = parseFloat(this.$x.val());
this.shadow.y = parseFloat(this.$y.val());
this.shadow.blur = parseFloat(this.$blur.val());
- return this.stage.selection.set('textShadow', this.shadow.toString());
+ return this.stage.selection.set('textShadow', this.shadow);
};
return TextShadow;
@@ -132,6 +132,10 @@ this.require.define({"lib/collection":function(exports, require, module){(functi
return this[this.length - 1];
};
+ Collection.prototype.valueOf = function() {
+ return this.slice(0);
+ };
+
return Collection;
})(Array);
@@ -17,9 +17,7 @@ def prepare
def evaluate(scope, locals, &block)
if File.extname(scope.logical_path) == '.module'
- path = scope.logical_path
- path = File.join(File.dirname(path), File.basename(path, '.module'))
- path = path.inspect
+ path = scope.logical_path.chomp('.module').inspect
scope.require_asset 'sprockets/commonjs'

0 comments on commit 18133c6

Please sign in to comment.