stormfront-rails 0.10.3 → 0.10.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4b73e7b3e4fd4b68c98e4573cb5240ba1e7ebbfa
4
- data.tar.gz: 84b85e17d6880fc66afaaf84434a3d424fc5218e
3
+ metadata.gz: 49183b44cda1e773bc1a333c02d32821256b5575
4
+ data.tar.gz: ff9b74f5e784034429267c63e9b83fbd22ffbff7
5
5
  SHA512:
6
- metadata.gz: bc5ec05778baeace7a1d200b2d4aa75900c29e57fc6f7cac4073a35b6314a9859f524d49714df8338dee95368f8fbcb10829792b8a2196ad66be71caf6df1450
7
- data.tar.gz: bc58bcdf532db396360514ebd77cbc33bfb39727709a5aac8ff71932e7495c3e873d49033c63f061904459d30dd550bb4596828e044e684a2460a9551b5b192b
6
+ metadata.gz: 3678282aef3a4cb779012a683189e272ab852f9c91d7ae495fd7be6931f965767f2b7e0035681a907aecf011fd6efb6ba4126f239dddc6732eda46370390d80a
7
+ data.tar.gz: e0d8cc1d01b99386c860fd499ea9345af59b9b5fd66118729ea083c5a4c0616dd713731a620d90001ee7fa7673cd1e03ff94590d6bceadff866dc24b6a537aee
@@ -1,5 +1,5 @@
1
1
  module Stormfront
2
2
  module Rails
3
- VERSION = '0.10.3'
3
+ VERSION = '0.10.4'
4
4
  end
5
5
  end
@@ -266,16 +266,20 @@ Stormfront.Time = Stormfront.Class.extend({
266
266
 
267
267
 
268
268
 
269
- stormfront.type = function(name){
270
- return (new Stormfront.Type(name)).get();
269
+ stormfront.type = function(type){
270
+ return (new Stormfront.Type(type)).get();
271
271
  };
272
272
  Stormfront.Type = Stormfront.Class.extend({
273
273
  initialize: function (name) {
274
274
  this.name = name;
275
275
  },
276
276
  get: function () {
277
- var name = this.name.split('.');
278
- return stormfront.hash(window).findNestedValue(name);
277
+ if (_.isString(this.name)) {
278
+ var name = this.name.split('.');
279
+ return stormfront.hash(window).findNestedValue(name);
280
+ } else {
281
+ return this.name;
282
+ }
279
283
  }
280
284
  });
281
285
 
@@ -293,6 +297,7 @@ Stormfront.Patterns = {
293
297
  Events: function (subject) {
294
298
  if (!subject.listenTo)
295
299
  $.extend(subject, Backbone.Events);
300
+
296
301
  $.extend(subject, {
297
302
  forward: function (other, type) {
298
303
  function propagate(){
@@ -463,14 +468,14 @@ Stormfront.Store = Stormfront.Class.extend({
463
468
  this._state = new Stormfront.Store.State();
464
469
  this._reducers = new Stormfront.Store.Reducers(options);
465
470
  },
466
- executeAction: function (action) {
471
+ executeReducer: function (action) {
467
472
  var reducer = this._reducers.find(action);
468
473
  if (reducer)
469
- this.executeDispatch(action, reducer);
474
+ this.tryExecuteReducer(action, reducer);
470
475
  else
471
476
  this.trigger(Stormfront.Dispatches.MISSING, action, reducer);
472
477
  },
473
- executeDispatch: function (action, reducer) {
478
+ tryExecuteReducer: function (action, reducer) {
474
479
  try {
475
480
  this.executeExternalCode(action, reducer);
476
481
  } catch (e) {
@@ -594,7 +599,7 @@ Stormfront.Container = Stormfront.Class.extend({
594
599
  });
595
600
 
596
601
  function executeAction(action){
597
- store.executeAction(action);
602
+ store.executeReducer(action);
598
603
  }
599
604
  function updateView(action, reducer, newProperties, oldProperties){
600
605
  page.updateProperties(newProperties, oldProperties, action, reducer);
@@ -1302,7 +1307,7 @@ Homefront.Chaperone = Homefront.View.extend({
1302
1307
  updating: function (properties) {
1303
1308
  this.updateChildren(this._children, properties);
1304
1309
  },
1305
- attached: function(){
1310
+ attached: function () {
1306
1311
  var previous = this._children;
1307
1312
  this._children = [];
1308
1313
  this.createChildren();
@@ -1315,15 +1320,14 @@ Homefront.Chaperone = Homefront.View.extend({
1315
1320
  this._children = [];
1316
1321
  },
1317
1322
  chaperone: {
1318
- create: function (type, properties) {
1319
- type = _.isString(type) ? stormfront.type(type) : type;
1323
+ create: function (child, properties) {
1324
+ var type = stormfront.type(child);
1320
1325
  properties = _.isObject(properties) ? properties : this.properties;
1321
- if (type) {
1322
- var child = new type(this.getDispatcher());
1323
- this.transition('chaperone:add', child, properties);
1324
- } else {
1325
- console.error('Child type does not exist: ', type);
1326
- }
1326
+
1327
+ if (type)
1328
+ this.transition('chaperone:add', new type(this.getDispatcher()), properties);
1329
+ else
1330
+ console.error('Child type does not exist: ', child);
1327
1331
  },
1328
1332
  add: function (child, properties) {
1329
1333
  this._children.push(child);
@@ -1362,6 +1366,7 @@ Homefront.Chaperone = Homefront.View.extend({
1362
1366
  else
1363
1367
  this.attachChild(child, this.$el, 'append');
1364
1368
  }
1369
+
1365
1370
  _.each(children, attachChild, this);
1366
1371
  },
1367
1372
  updateChildren: function (children, properties) {
@@ -1371,6 +1376,7 @@ Homefront.Chaperone = Homefront.View.extend({
1371
1376
  function stop(child) {
1372
1377
  this.stopListening(child);
1373
1378
  }
1379
+
1374
1380
  //TODO: This bit is odd...
1375
1381
  _.each(children, stop, this);
1376
1382
  _.invoke(children, 'close');
@@ -1461,27 +1467,29 @@ Homefront.Enumerator = Homefront.Chaperone.extend({
1461
1467
  item: null,
1462
1468
  when: {
1463
1469
  chaperone: {
1464
- add: function(child){
1470
+ add: function (child) {
1465
1471
  child.location = this.item.location;
1466
1472
  }
1467
1473
  }
1468
1474
  },
1469
1475
  createChildren: function () {
1470
- var items = this.selectItems(this.properties);
1471
1476
  function createChild(item) {
1472
1477
  this.createChild(this.item.view, item);
1473
1478
  }
1474
- _.each(items, createChild, this);
1479
+
1480
+ _.each(this.selectItems(this.properties), createChild, this);
1475
1481
  },
1476
- updateChildren: function(children, properties){
1477
- var items = this.selectItems(properties);
1478
- function updateChild(child, index) {
1479
- var item = items[index];
1480
- child.updateProperties(item);
1482
+ updateChildren: function (children, properties) {
1483
+ function updateWith(items) {
1484
+ return function(child, index) {
1485
+ var item = items[index];
1486
+ child.updateProperties(item);
1487
+ }
1481
1488
  }
1482
- _.each(children, updateChild);
1489
+
1490
+ _.each(children, updateWith(this.selectItems(properties)));
1483
1491
  },
1484
- composeChild: function(item){
1492
+ composeChild: function (item) {
1485
1493
  return this.createChild(this.item, item);
1486
1494
  },
1487
1495
  selectItems: function (properties) {
@@ -1760,10 +1768,10 @@ Homefront.Select = Homefront.Input.extend({
1760
1768
  return properties.options;
1761
1769
  },
1762
1770
  getValue: function(properties) {
1763
- return properties.selected;
1771
+ return this.selected || properties.selected;
1764
1772
  },
1765
1773
  select: function(){
1766
- this.transition('change', this.$el.val());
1774
+ this.transition('change', this.readValue());
1767
1775
  }
1768
1776
  });
1769
1777
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stormfront-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.3
4
+ version: 0.10.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Gee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-24 00:00:00.000000000 Z
11
+ date: 2016-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simple-jquery-rails