mxm-boilerplate 0.0.2 → 0.0.3

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.
data/Readme.md CHANGED
@@ -14,7 +14,7 @@ Run ``rails generate mxm:setup``
14
14
 
15
15
  1. SMACSS folder conventions
16
16
  2. Normalize
17
- 3. A simple 12 / 16 column grid
17
+ 3. A simple, fluid 12 column grid
18
18
  4. Typography defaults
19
19
  5. Boilerplate helpers
20
20
 
@@ -29,6 +29,20 @@ Run ``rails generate mxm:setup``
29
29
  1. HTML5 Boilerplate layout
30
30
  2. Partials for headers / footers / tracking
31
31
 
32
- # Licence
32
+ # Changelog
33
+
34
+ *0.0.3*
35
+ - Upgrade BigBird to latest
36
+ - Remove 16x columns from Flynn grid
37
+ - Drop `controllers` & `views` folders, use `modules` instead
38
+
39
+ *0.0.2*
40
+ - Fix imports in CSS
41
+
42
+ *0.0.1*
43
+ - Initial release
44
+
45
+ # License
46
+
47
+ http://www.opensource.org/licenses/MIT
33
48
 
34
- http://www.opensource.org/licenses/MIT
@@ -1,2 +1,2 @@
1
1
  // Any variables should be placed in here
2
- // $white-colour = #fff
2
+ // $white-colour: #fff;
@@ -10,11 +10,11 @@
10
10
  // Base
11
11
  //-----------------------------------------
12
12
 
13
- @import "base/default"
14
- @import "base/grid"
15
- @import "base/typography"
16
- @import "base/lists"
17
- @import "base/helpers"
13
+ @import "base/default";
14
+ @import "base/grid";
15
+ @import "base/typography";
16
+ @import "base/lists";
17
+ @import "base/helpers";
18
18
 
19
19
  //-----------------------------------------
20
20
  // Layout
@@ -3,8 +3,7 @@
3
3
  // https://github.com/callum-/flynn
4
4
  //-----------------------------------------
5
5
 
6
- .l-sixteen-columns,
7
- .l-twelve-columns,
6
+ .l-columns,
8
7
  .l-column {
9
8
  margin: 0;
10
9
  padding: 0;
@@ -13,8 +12,7 @@
13
12
  box-sizing: border-box;
14
13
  }
15
14
 
16
- .l-sixteen-columns:after,
17
- .l-twelve-columns:after,
15
+ .l-columns:after,
18
16
  .l-column:after {
19
17
  content: "";
20
18
  display: table;
@@ -30,63 +28,6 @@
30
28
  padding: 0 !important;
31
29
  }
32
30
 
33
-
34
- /*
35
- 16x column sizes
36
- ================
37
- 1. 6.25%
38
- 2. 12.5%
39
- 3. 18.75%
40
- 4. 25%
41
- 5. 31.25%
42
- 6. 37.5%
43
- 7. 43.75%
44
- 8. 50%
45
- 9. 56.25%
46
- 10. 62.5%
47
- 11. 68.75%
48
- 12. 75%
49
- 13. 81.25%
50
- 14. 87.5%
51
- 15. 93.75%
52
- 16. 100%
53
- */
54
-
55
- .l-sixteen-columns .l-column {
56
- width: 6.25%;}
57
-
58
- .l-sixteen-columns .l-span-two {
59
- width: 12.5%;}
60
- .l-sixteen-columns .l-span-three {
61
- width: 18.75%;}
62
- .l-sixteen-columns .l-span-four {
63
- width: 25%;}
64
- .l-sixteen-columns .l-span-five {
65
- width: 31.25%;}
66
- .l-sixteen-columns .l-span-six {
67
- width: 37.5%;}
68
- .l-sixteen-columns .l-span-seven {
69
- width: 43.75%;}
70
- .l-sixteen-columns .l-span-eight {
71
- width: 50%;}
72
- .l-sixteen-columns .l-span-nine {
73
- width: 56.25%;}
74
- .l-sixteen-columns .l-span-ten {
75
- width: 62.5%;}
76
- .l-sixteen-columns .l-span-eleven {
77
- width: 68.75%;}
78
- .l-sixteen-columns .l-span-twelve {
79
- width: 75%;}
80
- .l-sixteen-columns .l-span-thirteen {
81
- width: 81.25%;}
82
- .l-sixteen-columns .l-span-fourteen {
83
- width: 87.5%;}
84
- .l-sixteen-columns .l-span-fifteen {
85
- width: 93.75%;}
86
- .l-sixteen-columns .l-span-sixteen {
87
- width: 100%;}
88
-
89
-
90
31
  /*
91
32
  12x column sizes
92
33
  ================
@@ -104,28 +45,28 @@
104
45
  12. 100%
105
46
  */
106
47
 
107
- .l-twelve-columns .l-column {
48
+ .l-column {
108
49
  width: 8.333333333333334%;}
109
50
 
110
- .l-twelve-columns .l-span-two {
51
+ .l-span-two {
111
52
  width: 16.666666666666668%;}
112
- .l-twelve-columns .l-span-three {
53
+ .l-span-three {
113
54
  width: 25%;}
114
- .l-twelve-columns .l-span-four {
55
+ .l-span-four {
115
56
  width: 33.333333333333336%;}
116
- .l-twelve-columns .l-span-five {
57
+ .l-span-five {
117
58
  width: 41.66666666666667%;}
118
- .l-twelve-columns .l-span-six {
59
+ .l-span-six {
119
60
  width: 50%;}
120
- .l-twelve-columns .l-span-seven {
61
+ .l-span-seven {
121
62
  width: 58.333333333333336%;}
122
- .l-twelve-columns .l-span-eight {
63
+ .l-span-eight {
123
64
  width: 66.66666666666667%;}
124
- .l-twelve-columns .l-span-nine {
65
+ .l-span-nine {
125
66
  width: 75%;}
126
- .l-twelve-columns .l-span-ten {
67
+ .l-span-ten {
127
68
  width: 83.33333333333334%;}
128
- .l-twelve-columns .l-span-eleven {
69
+ .l-span-eleven {
129
70
  width: 91.66666666666667%;}
130
- .l-twelve-columns .l-span-twelve {
71
+ .l-span-twelve {
131
72
  width: 100%;}
@@ -1,5 +1,5 @@
1
1
  module Mxm
2
2
  module Rails
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -1,26 +1,35 @@
1
1
  // Big Bird
2
- // v0.1.0
3
- // by @cjbell88, @ninjabiscuit & @callumj_
2
+ // v0.1.1
3
+ // by @cjbell88, @ninjabiscuit & @callumj_ all from @madebymany
4
4
  (function() {
5
+
6
+ // Initial setup
7
+ // -------------
8
+
5
9
  var BigBird = window.BigBird = {};
6
10
 
11
+ // Current version of BigBird
12
+ BigBird.VERSION = '0.1.1';
13
+
14
+ // Use jQuery (our only dependency)
15
+ // If it's not included and require is included then require it.
7
16
  var $ = jQuery;
8
17
  if (!$ && (typeof require !== 'undefined')) { $ = require('jquery'); }
9
18
 
10
- /* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011
11
- * http://benalman.com/
12
- * Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */
13
-
19
+ // Tiny Pub / Sub
20
+ // Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL
14
21
  var o = $({});
15
22
  $.subscribe = function() { o.on.apply(o, arguments); };
16
23
  $.unsubscribe = function() { o.off.apply(o, arguments); };
17
24
  $.publish = function() { o.trigger.apply(o, arguments); };
18
25
 
19
- /*
20
- BigBird Initializer
21
- -
22
- Used for DOM ready execution of the application passed to it.
23
- */
26
+
27
+ // BigBird Initializer
28
+ // -------------------
29
+
30
+ // Some basic defaults for the initializer. Using the body
31
+ // and the data-module and data-action to select which module
32
+ // and action to load.
24
33
 
25
34
  var InitializerDefaults = {
26
35
  base: $(document.body),
@@ -36,6 +45,7 @@
36
45
  };
37
46
 
38
47
  $.extend(Initializer.prototype, {
48
+
39
49
  initialize: function(){
40
50
  this.base = this.options.base;
41
51
  this.module = this.base.attr(this.options.module);
@@ -89,70 +99,9 @@
89
99
 
90
100
  });
91
101
 
92
- /*
93
- BigBird Base
94
- -
95
- Controller and View inherit from this
96
- */
97
-
98
- var Base = {
99
- publish : $.publish,
100
- subscribe : $.subscribe,
101
-
102
- initialize: function() {},
103
-
104
- subscribeToEvents: function() {
105
- for (var key in this.subscriptions) {
106
- var methodName = this.subscriptions[key];
107
- this.subscribe(key, $.proxy(this[methodName], this));
108
- }
109
- },
110
-
111
- eventSplitter: /^(\S+)\s*(.*)$/,
112
-
113
- _setOptions: function(options) {
114
- this.options = options;
115
-
116
- for (var key in this.options) {
117
- this[key] = this.options[key];
118
- }
119
- }
120
- };
121
-
122
- /*
123
- BigBird Controller
124
- -
125
- Rewrite of Andy Walker's (@ninjabiscuit) controller into more of a backbone / underscore style
126
- */
127
-
128
- var Controller = BigBird.Controller = function(options){
129
- this._setOptions(options || {});
130
-
131
- if (this.subscriptions) { this.subscribeToEvents(); }
132
- if (this.proxied) { this.proxyFunctions(); }
133
-
134
- this.initialize.apply(this, arguments);
135
- };
136
-
137
- $.extend(Controller.prototype, Base, {
138
- stateful: function(collection, state_machine){
139
- return state_machine ? state_machine.addCollection(collection) : new BigBird.StateMachine(collection);
140
- },
141
-
142
- proxyFunctions: function() {
143
- var len = this.proxied.length;
144
- for (len; len--;) {
145
- var methodName = this.proxied[len];
146
- if (typeof this[methodName] === "function") {
147
- this[methodName] = $.proxy(this[methodName], this);
148
- }
149
- }
150
- }
151
- });
152
-
153
- /*
154
- BigBird Simple State Machine
155
- */
102
+
103
+ // BigBird Simple State Machine
104
+ // ----------------------------
156
105
 
157
106
  BigBird.StateMachine = function(collection){
158
107
  this.o = $({});
@@ -163,6 +112,7 @@
163
112
  };
164
113
 
165
114
  BigBird.StateMachine.prototype = {
115
+
166
116
  publish : function(){
167
117
  this.o.trigger.apply( this.o, arguments );
168
118
  },
@@ -186,27 +136,82 @@
186
136
  }
187
137
  };
188
138
 
189
- /*
190
- BigBird View
191
- -
192
- */
139
+
140
+ // BigBird Module
141
+ // --------------
193
142
 
194
- var View = BigBird.View = function(options){
195
- this.setElement();
143
+ var Module = BigBird.Module = function(options) {
196
144
  this._setOptions(options || {});
197
145
 
146
+ if (this.el) { this.setElement(this.el); }
198
147
  if (this.subscriptions) { this.subscribeToEvents(); }
199
148
  if (this.events) { this.delegateEvents(); }
149
+ if (this.proxied) { this.proxyFunctions(); }
200
150
 
201
151
  this.initialize.apply(this, arguments);
202
152
  };
203
153
 
204
- $.extend(View.prototype, Base, {
154
+ $.extend(Module.prototype, {
155
+
156
+ // Establish references to the pub /sub methods for convienience
157
+ publish : $.publish,
158
+ subscribe : $.subscribe,
159
+
160
+ $el: null,
161
+
162
+ // Initialize is an empty function by default. Override it with your own
163
+ // initialization logic.
164
+ initialize: function() {},
165
+
166
+ // Scoped jQuery dom finds to the `$el`.
167
+ // Allows for short hand selectors like `this.$('a')`
205
168
  $: function(selector) {
169
+ if (this.$el === null) { return; }
170
+
206
171
  return this.$el.find(selector);
207
172
  },
208
173
 
174
+
175
+ // Takes an array of functions `['foo', 'bar']`
176
+ // and uses `$.proxy` to retain lexical scope for each.
177
+ // this means you can call these later without fear of losing scope
178
+ // especially useful in callbacks from events like `.bind(event, this.function)`
179
+ proxyFunctions: function() {
180
+ var len = this.proxied.length;
181
+ for (len; len--;) {
182
+ var methodName = this.proxied[len];
183
+ if (typeof this[methodName] === "function") {
184
+ this[methodName] = $.proxy(this[methodName], this);
185
+ }
186
+ }
187
+ },
188
+
189
+ // Set subscriptions with event and function pairs. `{ "/test": "testMethod" }`
190
+ // methods are bound to the Module, so should correspond
191
+ // to methods that you have defined.
192
+ subscribeToEvents: function() {
193
+ for (var key in this.subscriptions) {
194
+ var methodName = this.subscriptions[key];
195
+ this.subscribe(key, $.proxy(this[methodName], this));
196
+ }
197
+ },
198
+
199
+ // Set callbacks, where `this.events` is a hash of
200
+ //
201
+ // *{"event selector": "callback"}*
202
+ //
203
+ // {
204
+ // 'mousedown .title': 'edit',
205
+ // 'click .button': 'save'
206
+ // 'click .open': function(e) { ... }
207
+ // }
208
+ //
209
+ // pairs. Callbacks will be bound to the view, with `this` set properly.
210
+ // Uses event delegation for efficiency.
211
+ // Omitting the selector binds the event to `this.el`.
209
212
  delegateEvents: function() {
213
+ if (this.$el === null) { return; }
214
+
210
215
  for (var key in this.events) {
211
216
  var methodName = this.events[key];
212
217
  var method = $.proxy(this[methodName], this);
@@ -222,6 +227,8 @@
222
227
  }
223
228
  },
224
229
 
230
+ eventSplitter: /^(\S+)\s*(.*)$/,
231
+
225
232
  activate: function(){
226
233
  this.$el.addClass("active");
227
234
  },
@@ -236,9 +243,36 @@
236
243
  this.$el = this.el instanceof $ ? this.el : $(this.el);
237
244
  this.el = this.$el[0];
238
245
  this.data = this.$el.data();
246
+ },
247
+
248
+ destroy: function() {
249
+ if (this.$el === null) { return; }
250
+
251
+ for (var key in this.events) {
252
+ var match = key.match(this.eventSplitter);
253
+ var eventName = match[1], selector = match[2];
254
+
255
+ var target = (selector === '') ? this.$el : this.$el.find(selector);
256
+ target.unbind(eventName);
257
+ }
258
+ },
259
+
260
+ _setOptions: function(options) {
261
+ this.options = options;
262
+ for (var key in this.options) {
263
+ this[key] = this.options[key];
264
+ }
239
265
  }
240
266
  });
241
267
 
268
+ // Helpers
269
+ // -------
270
+
271
+ // Helper function to correctly set up the prototype chain, for subclasses.
272
+ // Similar to `goog.inherits`, but uses a hash of prototype properties and
273
+ // class properties to be extended.
274
+ // From Backbone JS: https://github.com/documentcloud/backbone/blob/master/backbone.js
275
+
242
276
  var extend = function(protoProps, staticProps) {
243
277
  var parent = this;
244
278
  var child;
@@ -272,13 +306,16 @@
272
306
  return child;
273
307
  };
274
308
 
275
- function capitaliseFirstLetter(string)
276
- {
277
- return string.charAt(0).toUpperCase() + string.slice(1);
309
+ // Capitilises the first letter of a string
310
+ // Used within the Initialiser to make it case insensitive.
311
+ function capitaliseFirstLetter(string) {
312
+ return string.charAt(0).toUpperCase() + string.slice(1);
278
313
  }
279
314
 
280
- View.extend = Controller.extend = extend;
315
+ // Setup inheritence for the Module, so we can do BigBird.Module.extend({})
316
+ Module.extend = extend;
281
317
 
318
+ // Setup BigBird as a module, if require is available
282
319
  if (typeof define !== "undefined" && typeof define === "function" && define.amd) {
283
320
  define( "bigbird", [], function () { return BigBird; } );
284
321
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mxm-boilerplate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-22 00:00:00.000000000 Z
12
+ date: 2013-02-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -56,8 +56,7 @@ files:
56
56
  - Readme.md
57
57
  - lib/generators/mxm/assets/assets_generator.rb
58
58
  - lib/generators/mxm/assets/templates/javascripts/application.js
59
- - lib/generators/mxm/assets/templates/javascripts/controllers/.empty_directory
60
- - lib/generators/mxm/assets/templates/javascripts/views/.empty_directory
59
+ - lib/generators/mxm/assets/templates/javascripts/modules/.empty_directory
61
60
  - lib/generators/mxm/assets/templates/stylesheets/_helpers/.empty_directory
62
61
  - lib/generators/mxm/assets/templates/stylesheets/_variables.css.scss
63
62
  - lib/generators/mxm/assets/templates/stylesheets/application.css.scss