Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

stripped trailing whitespace

  • Loading branch information...
commit 80157751343899af153e79fe1d918b0359b58991 1 parent 064fe79
@collin authored
Showing with 299 additions and 252 deletions.
  1. +1 −1  lib/alpha_simprini.coffee
  2. +1 −1  lib/alpha_simprini/client.coffee
  3. +1 −1  lib/alpha_simprini/client/application.coffee
  4. +3 −3 lib/alpha_simprini/client/binding.coffee
  5. +2 −2 lib/alpha_simprini/client/binding/file.coffee
  6. +1 −1  lib/alpha_simprini/client/binding/one.coffee
  7. +1 −1  lib/alpha_simprini/client/binding_group.coffee
  8. +3 −3 lib/alpha_simprini/client/view.coffee
  9. +11 −11 lib/alpha_simprini/client/views/dialog.coffee
  10. +2 −2 lib/alpha_simprini/core.coffee
  11. +3 −3 lib/alpha_simprini/core/callbacks.coffee
  12. +24 −24 lib/alpha_simprini/core/collection.coffee
  13. +19 −19 lib/alpha_simprini/core/filtered_collection.coffee
  14. +6 −6 lib/alpha_simprini/core/model.coffee
  15. +3 −3 lib/alpha_simprini/core/model/dendrite.coffee
  16. +8 −8 lib/alpha_simprini/core/model/rest.coffee
  17. +3 −3 lib/alpha_simprini/core/model/share.coffee
  18. +2 −2 lib/alpha_simprini/core/model/store.coffee
  19. +2 −2 lib/alpha_simprini/core/model/synapse.coffee
  20. +9 −9 lib/alpha_simprini/core/models/file.coffee
  21. +11 −11 lib/alpha_simprini/core/models/grouping.coffee
  22. +8 −8 lib/alpha_simprini/core/models/multiple_selection_model.coffee
  23. +6 −6 lib/alpha_simprini/core/models/radio_selection_model.coffee
  24. +4 −4 lib/alpha_simprini/core/properties/belongs_to.coffee
  25. +50 −3 lib/alpha_simprini/core/properties/field.coffee
  26. +30 −30 lib/alpha_simprini/core/properties/has_many.coffee
  27. +14 −14 lib/alpha_simprini/core/properties/has_one.coffee
  28. +20 −20 lib/alpha_simprini/core/properties/virtual_property.coffee
  29. +4 −4 lib/alpha_simprini/core/state_machine.coffee
  30. +12 −12 lib/alpha_simprini/packer.coffee
  31. +1 −1  lib/alpha_simprini/string.coffee
  32. +1 −1  test/client/application.coffee
  33. +2 −2 test/client/binding/one.coffee
  34. +7 −7 test/client/view.coffee
  35. +2 −2 test/core/collection.coffee
  36. +1 −1  test/core/model/rest.coffee
  37. +13 −13 test/core/model/share.coffee
  38. +2 −2 test/core/properties/field.coffee
  39. +2 −2 test/core/properties/has_many.coffee
  40. +2 −2 test/core/properties/has_one.coffee
  41. +2 −2 test/core/properties/virtual_property.coffee
View
2  lib/alpha_simprini.coffee
@@ -10,7 +10,7 @@ AS.unimplemented = (method) ->
return ->
throw new Error ["you MUST implement the method '#{method}' on: #{@toString()}"]
-AS.part = (name) ->
+AS.part = (name) ->
exports[name] = require: (libraries) -> AS.require name.toLowerCase(), libraries
# Namespaces
View
2  lib/alpha_simprini/client.coffee
@@ -7,7 +7,7 @@ Client.require """
binding
binding/container
-
+
binding/model binding/field binding/input binding/select binding/file
binding/check_box binding/edit_line binding/one binding/many
View
2  lib/alpha_simprini/client/application.coffee
@@ -41,7 +41,7 @@ AS.Application = AS.Object.extend ({def, include}) ->
each handlers, (trigger, key) =>
jwerty.key key, ( (event) => @trigger(trigger, event) ), @el
- jwerty.key "backspace", (event) =>
+ jwerty.key "backspace", (event) =>
event.preventDefault()
@trigger("delete", event)
View
6 lib/alpha_simprini/client/binding.coffee
@@ -4,8 +4,8 @@ _ = require "underscore"
AS.Binding = AS.Object.extend ({def}) ->
def initialize: (@context, @model, @field, @options={}, @fn=undefined) ->
if _.isString(@field)
- @field = @model[@field]
-
+ @field = @model[@field]
+
if _.isFunction(@options)
[@fn, @options] = [@options, {}]
@@ -26,7 +26,7 @@ AS.Binding = AS.Object.extend ({def}) ->
def willGroupBindings: ->
@constructor.willGroupBindings or _.isFunction(@fn)
- def fieldValue: ->
+ def fieldValue: ->
if _.isArray(@field)
@model.readPath(@field)
else
View
4 lib/alpha_simprini/client/binding/file.coffee
@@ -8,7 +8,7 @@ AS.Binding.File = AS.Binding.Input.extend ({delegate, include, def, defs}) ->
def fieldValue: -> # FALSE. Cannot set value of a file input.
def setContent: -> # FALSE. Cannot set value of a file input.
- def readField: ->
+ def readField: ->
AS.Models.File.new file: @content[0].files[0]
-
+
View
2  lib/alpha_simprini/client/binding/one.coffee
@@ -5,7 +5,7 @@ jQuery = require "jquery"
AS.Binding.One = AS.Binding.Field.extend ({delegate, include, def, defs}) ->
def makeContent: ->
AS.Binding.Container.new(@container[0])
-
+
def setContent: ->
@content.empty()
@bindingGroup.unbind()
View
2  lib/alpha_simprini/client/binding_group.coffee
@@ -25,7 +25,7 @@ AS.BindingGroup = AS.Object.extend ({def}) ->
else if _.isArray(event)
object.bindPath(event, _.bind(handler, context))
else
- object.bind
+ object.bind
event: event
namespace: @namespace
handler: handler
View
6 lib/alpha_simprini/client/view.coffee
@@ -15,7 +15,7 @@ AS.View = AS.DOM.extend ({delegate, include, def, defs}) ->
def attrBindings: null
- def _ensureElement: ->
+ def _ensureElement: ->
@el ?= @$(@buildElement())
baseAttributes = @baseAttributes()
baseAttributes["class"] = undefined if @el.attr("class")
@@ -73,7 +73,7 @@ AS.View = AS.DOM.extend ({delegate, include, def, defs}) ->
def binds: -> @bindingGroup.binds.apply(@bindingGroup, arguments)
- def klassString: ->
+ def klassString: ->
classes = []
for ancestor in @constructor.ancestors
continue unless ancestor.path().match(/Views?/)
@@ -129,7 +129,7 @@ AS.View = AS.DOM.extend ({delegate, include, def, defs}) ->
def bindAttrs: ->
return unless @attrBindings
- @modelBinding().attr @attrBindings
+ @modelBinding().attr @attrBindings
def delegateEvents: () ->
if @events
View
22 lib/alpha_simprini/client/views/dialog.coffee
@@ -5,16 +5,16 @@ knead = require "knead"
AS.Views.Dialog = AS.Views.Panel.extend ({delegate, include, def, defs}) ->
def initialize: ->
@constructor::events ?= {}
- _.extend @constructor::events,
+ _.extend @constructor::events,
"click .accept": "trigger_commit"
"click .cancel": "trigger_cancel"
"esc @application": "trigger_cancel"
"accept @application": "trigger_commit"
-
+
"knead:dragstart header": "dragstart"
"knead:drag header": "drag"
"knead:dragend header": "dragend"
-
+
@_super.apply(this, arguments)
def content: ->
@@ -22,34 +22,34 @@ AS.Views.Dialog = AS.Views.Panel.extend ({delegate, include, def, defs}) ->
@content = @$ @section @main_content
@foot = @$ @footer @footer_content
knead.monitor @head
-
+
def header_content: ->
def main_content: ->
- def footer_content: ->
+ def footer_content: ->
@accept = @$ @button class:"accept", -> "Accept"
@cancel = @$ @a href:"#", class:"cancel", -> "cancel"
def open: ->
@el.css width: "", height: ""
@trigger "open"
-
+
def close: ->
@el.css width: 0, height: 0, overflow: "hidden"
@trigger "close"
-
+
def trigger_commit: ->
@trigger "commit"
@close()
-
+
def trigger_cancel: ->
@trigger "cancel"
@close()
-
- def dragstart: (event) ->
+
+ def dragstart: (event) ->
@start = @el.position()
def drag: (event) ->
@el.css
top: event.deltaY + @start.top
left: event.deltaX + @start.left
- def dragend: (event) ->
+ def dragend: (event) ->
delete @start
View
4 lib/alpha_simprini/core.coffee
@@ -4,12 +4,12 @@ _ = require "underscore"
Core.require """
logging
-
+
callbacks state_machine
instance_methods
model model/dendrite model/synapse model/store
- properties/field properties/has_many properties/has_one
+ properties/field properties/has_many properties/has_one
properties/belongs_to properties/virtual_property
collection filtered_collection
View
6 lib/alpha_simprini/core/callbacks.coffee
@@ -9,13 +9,13 @@ AS.Callbacks = AS.Module.extend ({def, defs}) ->
do (callback) =>
@["#{key}#{upperCamelize callback}"] = (fn) ->
@pushInheritableItem("#{key}#{upperCamelize callback}_callbacks", fn)
-
- # @::runCallbacks.doc =
+
+ # @::runCallbacks.doc =
# params: [
# ["name", String, true]
# ]
# desc: """
- #
+ #
# """
def runCallbacks: (name) ->
for callback in @constructor["#{name}_callbacks"] || []
View
48 lib/alpha_simprini/core/collection.coffee
@@ -7,13 +7,13 @@ AS.Collection = AS.Object.extend ({def, include, delegate}) ->
include Taxi.Mixin
delegate AS.COLLECTION_DELEGATES, to: "models"
- # @::initialize.doc =
+ # @::initialize.doc =
# params: [
# ["@models", [AS.Model], false, default: []]
# ["options", Object, false, default: {}]
# ]
# desc: """
- #
+ #
# """
def initialize: (@models=[], options = {}) ->
extend this, options
@@ -23,19 +23,19 @@ AS.Collection = AS.Object.extend ({def, include, delegate}) ->
@models = _([]).chain()
@add(model) for model in @models
- # @::model.doc =
+ # @::model.doc =
# desc: """
- #
+ #
# """
def model: -> AS.Model
- # @::add.doc =
+ # @::add.doc =
# params: [
# ["model", [AS.Model, String, Object], false, default: {}]
# ["options", Object, false, default: {}]
# ]
# desc: """
- #
+ #
# """
def add: (model={}, options={}) ->
# Allow for passing both Model and ViewModels in
@@ -51,13 +51,13 @@ AS.Collection = AS.Object.extend ({def, include, delegate}) ->
model
- # @::build.doc =
+ # @::build.doc =
# private: true
# params: [
# ["model", [AS.Model, String, Object], true]
# ]
# desc: """
- #
+ #
# """
def build: (model) ->
if isString(model) and constructor = @model?()
@@ -69,18 +69,18 @@ AS.Collection = AS.Object.extend ({def, include, delegate}) ->
return AS.All.byId[model.id]
else
ctor = @model()
-
+
data = _.clone(model)
ctor.new(data)
- # @::_add.doc =
+ # @::_add.doc =
# private: true
# params: [
# ["model", AS.Model, true]
# ["options", Object, false, default: {}]
# ]
# desc: """
- #
+ #
# """
def _add: (model, options={}) ->
options.at ?= this.length
@@ -96,23 +96,23 @@ AS.Collection = AS.Object.extend ({def, include, delegate}) ->
model.trigger "add", this, options
- # @::at.doc =
+ # @::at.doc =
# params: [
# ["index", Number, true]
# ]
# desc: """
- #
+ #
# """
def at: (index) ->
@models.value()[index]
- # @::remove.doc =
+ # @::remove.doc =
# params: [
# ["model", AS.Model, true]
# ["options", Object, false, default: {}]
# ]
# desc: """
- #
+ #
# """
def remove: (model, options={}) ->
# Allow for passing both Model and ViewModels in
@@ -123,14 +123,14 @@ AS.Collection = AS.Object.extend ({def, include, delegate}) ->
result
- # @::_remove.doc =
+ # @::_remove.doc =
# private: true
# params: [
# ["model", AS.Model, true]
# ["options", {}, false, default: {}]
# ]
# desc: """
- #
+ #
# """
def _remove: (model, options={}) ->
options.at = @models.indexOf(model).value()
@@ -143,29 +143,29 @@ AS.Collection = AS.Object.extend ({def, include, delegate}) ->
event: "all"
namespace: @objectId()
- # @::filter.doc =
+ # @::filter.doc =
# params: [
# ["filterBy", {}, true]
# ]
# return: AS.FilteredCollection
# desc: """
- #
+ #
# """
def filter: (filterBy) ->
AS.FilteredCollection.new(this, filterBy)
- # @::groupBy.doc =
+ # @::groupBy.doc =
# params: [
# ["key", String, true]
# ["metaData", Object, false]
# ]
# desc: """
- #
+ #
# """
def groupBy: (key, metaData) ->
AS.Models.Grouping.new(this, key, metaData)
-
- # @::_onModelEvent.doc =
+
+ # @::_onModelEvent.doc =
# private: true
# params: [
# ["event", String, true]
@@ -174,7 +174,7 @@ AS.Collection = AS.Object.extend ({def, include, delegate}) ->
# ["options", Object, false]
# ]
# desc: """
- #
+ #
# """
# # When an event is triggered from a model, it is bubbled up through the collection.
def _onModelEvent: (event, model, collection, options) ->
View
38 lib/alpha_simprini/core/filtered_collection.coffee
@@ -1,7 +1,7 @@
# How would you implement this such that the @parent/@filter property could be changed?
#
# perhaps.. something like this?
-#
+#
# @property "parent"
# @property "filter"
@@ -18,13 +18,13 @@ Taxi = require "taxi"
AS.FilteredCollection = AS.Collection.extend ({delegate, include, def, defs}) ->
delegate 'add', 'remove', to: 'parent'
- # @::initialize.doc =
+ # @::initialize.doc =
# params: [
# ["@parent", AS.Collection, true]
# ["conditions", Object, false, default: {}]
# ]
# desc: """
- #
+ #
# """
def initialize: (@parent, conditions={}) ->
@_super()
@@ -32,7 +32,7 @@ AS.FilteredCollection = AS.Collection.extend ({delegate, include, def, defs}) ->
@conditions = Taxi.Map.new()
@conditions.set(key, value) for key, value of conditions
- @conditions.bind
+ @conditions.bind
event: 'change'
handler: @reFilter
context: this
@@ -49,7 +49,7 @@ AS.FilteredCollection = AS.Collection.extend ({delegate, include, def, defs}) ->
context: this
namespace: @objectId()
- @parent.bind
+ @parent.bind
event: 'remove'
handler: @removeFromSelf
context: this
@@ -57,12 +57,12 @@ AS.FilteredCollection = AS.Collection.extend ({delegate, include, def, defs}) ->
@reFilter()
- # @::determinePlacementInSelf.doc =
+ # @::determinePlacementInSelf.doc =
# params: [
# ["model", AS.Model, true]
# ]
# desc: """
- #
+ #
# """
def determinePlacementInSelf: (model) ->
if @filter(model) is true
@@ -70,57 +70,57 @@ AS.FilteredCollection = AS.Collection.extend ({delegate, include, def, defs}) ->
else
@removeFromSelf(model)
- # @::addToSelf.doc =
+ # @::addToSelf.doc =
# params: [
# [model, AS.Model, true]
# ]
# desc: """
- #
+ #
# """
def addToSelf: (model) ->
return if @models.include(model).value()
@_add(model)
- # @::removeFromSelf.doc =
+ # @::removeFromSelf.doc =
# params: [
# [model, AS.Modle, true]
# ]
# desc: """
- #
+ #
# """
def removeFromSelf: (model) ->
return unless @models.include(model).value()
@_remove(model)
- # @::reFilter.doc =
+ # @::reFilter.doc =
# desc: """
- #
+ #
# """
def reFilter: ->
@parent.each (model) => @determinePlacementInSelf(model)
- # @::setConditions.doc =
+ # @::setConditions.doc =
# params: [
# ["conditions", Object, true]
# ]
# desc: """
- #
+ #
# """
def setConditions: (conditions) ->
@conditions.unbind()
@conditions.set(key, value) for key, value of conditions
- @conditions.bind
+ @conditions.bind
event: 'change'
handler: @reFilter
context: this
@reFilter()
- # @::filter.doc =
+ # @::filter.doc =
# params: [
# ["model", AS.Model, true]
# ]
# desc: """
- #
+ #
# """
def filter: (model) ->
for key, value of @conditions.toObject()
@@ -132,5 +132,5 @@ AS.FilteredCollection = AS.Collection.extend ({delegate, include, def, defs}) ->
true
-
+
View
12 lib/alpha_simprini/core/model.coffee
@@ -8,13 +8,13 @@ AS.Model = AS.Object.extend ({delegate, include, def, defs}) ->
include Taxi.Mixin
include AS.Callbacks
- @defineCallbacks
+ @defineCallbacks
# before: [
# 'initialize'
# ]
after: [
'initialize'
- ]
+ ]
# @find.doc =
# params: [
@@ -33,7 +33,7 @@ AS.Model = AS.Object.extend ({delegate, include, def, defs}) ->
# ["attributes", Object, false, default: {}]
# ]
# desc: """
- #
+ #
# """
def initialize: (attributes={}) ->
attributes.id ?= AS.uniq()
@@ -56,14 +56,14 @@ AS.Model = AS.Object.extend ({delegate, include, def, defs}) ->
# ]
# desc: """
# """
- def set: (attributes) ->
+ def set: (attributes) ->
for key, value of attributes
continue if key is "_type"
if key is "id"
@setId(value)
else
property = @[key]
- @[key]?.set(value)
+ @[key]?.set(value)
# @::setId.doc =
# params: [
@@ -75,7 +75,7 @@ AS.Model = AS.Object.extend ({delegate, include, def, defs}) ->
if @id
delete AS.All.byId[@id]
delete AS.All.byIdRef["#{@id}-#{@constructor.path()}"]
-
+
@id = id
@idRef = "#{@id}-#{@constructor.path()}"
View
6 lib/alpha_simprini/core/model/dendrite.coffee
@@ -29,7 +29,7 @@ AS.Model.CollectionDendrite = AS.Model.Dendrite.extend ({delegate, include, def,
def insertCallback: (item, options) ->
return if @observer.blocking
@observer.insert(item, options)
-
+
def removeCallback: (item, options) ->
return if @observer.blocking
@observer.remove(item, options)
@@ -38,9 +38,9 @@ AS.Model.CollectionDendrite = AS.Model.Dendrite.extend ({delegate, include, def,
@notifier.binds @insertCallback, @removeCallback
if @config.syncNow
- @notifier.each (item, index) =>
+ @notifier.each (item, index) =>
@insertCallback(item, index)
def off: ->
@notifier.unbinds @insertCallback, @removeCallback
-
+
View
16 lib/alpha_simprini/core/model/rest.coffee
@@ -24,14 +24,14 @@ extractIds = (object) ->
AS.Model.REST = AS.Module.extend ({delegate, include, def, defs}) ->
defs mappings: AS.Map.new()
-
+
defs rootKey: ->
underscore @_name()
-
+
defs resourcesURL: -> "/#{pluralize @rootKey()}"
-
+
defs resourceURL: (id) -> "#{@resourcesURL()}/#{id}"
-
+
defs load: (id, callback) ->
unless model = AS.All.byId[id]
model = @new()
@@ -57,7 +57,7 @@ AS.Model.REST = AS.Module.extend ({delegate, include, def, defs}) ->
for klass in @appendedTo
mappings[pluralize(camelize(klass.rootKey()))] = klass
mappings
-
+
def loadData: (data) ->
references = AS.Map.new()
@@ -68,7 +68,7 @@ AS.Model.REST = AS.Module.extend ({delegate, include, def, defs}) ->
modelData = data[root]
modelData = convertKeys(modelData)
-
+
[modelData, ids] = extractIds(modelData)
@set(modelData)
@@ -94,13 +94,13 @@ AS.Model.REST = AS.Module.extend ({delegate, include, def, defs}) ->
def resolveReferences: (ids) ->
for key, references of ids
continue unless references
-
+
if references.length is undefined
relationKey = key.replace(/Id$/, '')
path = @[relationKey].model().path()
id = references
@[relationKey].set AS.All.byIdRef["#{id}-#{path}"]
-
+
else
relationKey = pluralize key.replace(/Ids$/, '')
path = @[relationKey].model().path()
View
6 lib/alpha_simprini/core/model/share.coffee
@@ -51,7 +51,7 @@ AS.Model.ShareJSAdapter = AS.Object.extend ({delegate, include, def, defs}) ->
modelDocument = constructorGroup.at(@model.id)
modelDocument.set(new Object) unless modelDocument.get()
modelDocument
-
+
def constructorGroup: (path) ->
constructorGroup = @share.at(path)
constructorGroup.set(new Object) unless constructorGroup.get()
@@ -82,7 +82,7 @@ AS.Model.ShareJSAdapter = AS.Object.extend ({delegate, include, def, defs}) ->
model = constructor.find(id)
if model is @model
- @sync()
+ @sync()
else
@adapterFor({model, @share}).sync()
@@ -90,7 +90,7 @@ AS.Model.ShareJSAdapter = AS.Object.extend ({delegate, include, def, defs}) ->
def adapterFor: (options) ->
@store.adapterFor(options)
-
+
# def loadIndexedData: ->
# selfReady = => @model.trigger("ready")
View
4 lib/alpha_simprini/core/model/store.coffee
@@ -8,7 +8,7 @@ AS.Model.Store = AS.Object.extend ({delegate, include, def, defs}) ->
def initialize: ({@adapterClass, @adapterConfig}) ->
@adapterConfig ?= {}
@adapterConfig.store = this
-
+
def adapterFor: (options) ->
@adapterClass.new( extend clone(@adapterConfig), options )
@@ -17,4 +17,4 @@ AS.Model.Store = AS.Object.extend ({delegate, include, def, defs}) ->
@adapterFor({model}).open()
model
-
+
View
4 lib/alpha_simprini/core/model/synapse.coffee
@@ -51,9 +51,9 @@ AS.Model.CollectionSynapse = AS.Model.AbstractSynapse.extend ({delegate, include
def binds: AS.unimplemented("binds: (insertCallback, removeCallback) ->")
def unbinds: AS.unimplemented("unbinds: (insertCallback, removeCallback) ->")
-
+
def insert: AS.unimplemented("insert: (item, options) ->")
def remove: AS.unimplemented("remove: (item) ->")
-
+
def each: AS.unimplemented("each: (fn) ->")
View
18 lib/alpha_simprini/core/models/file.coffee
@@ -5,7 +5,7 @@ camelize = require("fleck").upperCamelize
AS.Models.File = AS.Model.extend ({delegate, include, def, defs}) ->
defs familyClasses: AS.Map.new(-> this)
-
+
defs registerFamilyClass: (mimeFamily, klass) ->
@familyClasses.set(mimeFamily, klass)
@@ -52,9 +52,9 @@ AS.Models.File = AS.Model.extend ({delegate, include, def, defs}) ->
# konstructor = class_for_mime()
# # pass
- # @::initialize.doc =
+ # @::initialize.doc =
# desc: """
- #
+ #
# """
def initialize: ->
@_super.apply(this, arguments)
@@ -68,12 +68,12 @@ AS.Models.File = AS.Model.extend ({delegate, include, def, defs}) ->
# @name image.attr("title") or image.attr("alt") or $.url(image.attr("src")).attr("file") or "Untitled Image"
# @bytes 0
- # @::read.doc =
+ # @::read.doc =
# params: [
# ["callback", Function, true]
# ]
# desc: """
- #
+ #
# """
def read: (callback) ->
# return callback(@dataURL) if @dataURL
@@ -82,12 +82,12 @@ AS.Models.File = AS.Model.extend ({delegate, include, def, defs}) ->
# else if @image()
# @readCanvas(callback)
- # @::readFile.doc =
+ # @::readFile.doc =
# params: [
# ["callback", Function, true]
# ]
# desc: """
- #
+ #
# """
def readFile: (callback) ->
reader = new @FileReader
@@ -110,9 +110,9 @@ AS.Models.File = AS.Model.extend ({delegate, include, def, defs}) ->
# console.warn "FIXME: portable image proxy port"
# image.src = "http://catalogs.dev/?proxy_uri=#{@image().src}"
- # @::upload.doc =
+ # @::upload.doc =
# desc: """
- #
+ #
# """
def upload: ->
formdata = new FormData
View
22 lib/alpha_simprini/core/models/grouping.coffee
@@ -2,14 +2,14 @@ AS = require "alpha_simprini"
AS.Models.Grouping = AS.Model.extend ({delegate, include, def, defs}) ->
@hasMany 'groups'
- # @::initialize.doc =
+ # @::initialize.doc =
# params: [
# ["@backingCollection", AS.Collection, true]
# ["@groupByProperty", String, true]
# ["@metaData", Object, false, default: {}]
# ]
# desc: """
- #
+ #
# """
def initialize: (@backingCollection, @groupByProperty, @metaData={}) ->
@_super()
@@ -23,24 +23,24 @@ AS.Models.Grouping = AS.Model.extend ({delegate, include, def, defs}) ->
handler: @addToGroup
context: this
- @backingCollection.bind
+ @backingCollection.bind
event: "remove"
handler: @removeFromGroup
context: this
- @backingCollection.bind
+ @backingCollection.bind
event: "change:#{@groupByProperty}"
handler: @determineNewGroup
context: this
@backingCollection.each (item) => @addToGroup(item)
- # @::addToGroup.doc =
+ # @::addToGroup.doc =
# params: [
# ["item", AS.Model, true]
# ]
# desc: """
- #
+ #
# """
def addToGroup: (item) ->
name = item[@groupByProperty].get()
@@ -52,23 +52,23 @@ AS.Models.Grouping = AS.Model.extend ({delegate, include, def, defs}) ->
@itemMap.set item, group
group.members.add(item)
- # @::removeFromGroup.doc =
+ # @::removeFromGroup.doc =
# params: [
# ["item", AS.Model, true]
# ]
# desc: """
- #
+ #
# """
def removeFromGroup: (item) ->
return unless group = @itemMap.get(item)
group.members.remove(item)
- # @::determineNewGroup.doc =
+ # @::determineNewGroup.doc =
# params: [
# ["item", AS.Model, true]
# ]
# desc: """
- #
+ #
# """
def determineNewGroup: (item) ->
@removeFromGroup(item)
@@ -77,7 +77,7 @@ AS.Models.Grouping = AS.Model.extend ({delegate, include, def, defs}) ->
# @currentUser.labors.groupBy "endDateGroup", (group) ->
# @text group.name
# @text "(" ;@group.binding "membersCount"; @text ")"
-
+
# group.members.groupBy 'orgName', (group) ->
# group.binding "name"
# @text "("; @group.binding "membersCount"; @text ")"
View
16 lib/alpha_simprini/core/models/multiple_selection_model.coffee
@@ -2,9 +2,9 @@ AS = require "alpha_simprini"
AS.Models.MultipleSelectionModel = AS.Model.extend ({def}) ->
@hasMany "items"
- # @::initialize.doc =
+ # @::initialize.doc =
# desc: """
- #
+ #
# """
def initialize: ->
@_super()
@@ -12,29 +12,29 @@ AS.Models.MultipleSelectionModel = AS.Model.extend ({def}) ->
@items.bind "add", (item) => @trigger("add", item)
@items.bind "remove", (item) => @trigger("remove", item)
- # @::select.doc =
+ # @::select.doc =
# params: [
# ["item", AS.Model, true]
# ]
# desc: """
- #
+ #
# """
def select: (item) ->
@items.add(item)
- # @::deselect.doc =
+ # @::deselect.doc =
# params: [
# ["item", AS.Model, true]
# ]
# desc: """
- #
+ #
# """
def deselect: (item) ->
@items.remove(item)
- # @::clear.doc =
+ # @::clear.doc =
# desc: """
- #
+ #
# """
def clear: ->
@items.each @items.remove, @items
View
12 lib/alpha_simprini/core/models/radio_selection_model.coffee
@@ -1,25 +1,25 @@
AS = require "alpha_simprini"
AS.Models.RadioSelectionModel = AS.Model.extend ({def}) ->
@property 'selected'
-
- # @::initialize.doc =
+
+ # @::initialize.doc =
# params: [
# ["options", Object, false, default: {}]
# ]
# desc: """
- #
+ #
# """
def initialize: (options={}) ->
@property = options.property
@_super()
@select undefined
-
- # @::select.doc =
+
+ # @::select.doc =
# params: [
# ["item", "*", true]
# ]
# desc: """
- #
+ #
# """
def select: (item) ->
if @property
View
8 lib/alpha_simprini/core/properties/belongs_to.coffee
@@ -9,15 +9,15 @@ AS.Model.BelongsTo.Instance = AS.Model.HasOne.Instance.extend ({delegate, includ
def set: (value) ->
@raw.set(value)
-
+
@ShareSynapse = AS.Model.Field.Instance.ShareSynapse.extend ({delegate, include, def, defs}) ->
def get: ->
@raw.at(@path).get()
-
+
def set: (value) ->
@_super(value?.id) if value?.id
-
-AS.Model.defs belongsTo: (name, options) ->
+
+AS.Model.defs belongsTo: (name, options) ->
AS.Model.BelongsTo.new(name, this, options)
View
53 lib/alpha_simprini/core/properties/field.coffee
@@ -54,16 +54,47 @@ AS.Model.Field = AS.Property.extend ({delegate, include, def, defs}) ->
Casters.set AS.Enum, AS.Enum
+ # @::initialize.doc =
+ # params: [
+ # ["@name", String, true]
+ # ["@_constructor", AS.Model, true]
+ # ["@options", Object, false, default: {}]
+ # ]
+ # desc: """
+ #
+ # """
def initialize: (@name, @_constructor, @options={}) ->
@options.name = @name
@_constructor.writeInheritableValue 'properties', @name, this
+ # @::instance.doc =
+ # params: [
+ # ["object", AS.Model, true]
+ # ]
+ # desc: """
+ #
+ # """
def instance: (object) -> @constructor.Instance.new(object, @options)
@Instance = AS.Property.Instance.extend ({def}) ->
+ # @::initialize.doc =
+ # params: [
+ # ["@object", AS.Model, true]
+ # ["@options", Object, false, default: true]
+ # ]
+ # desc: """
+ #
+ # """
def initialize: (@object, @options={}) ->
@options.type ?= String
+ # @::syncWith.doc =
+ # params: [
+ # ["share", "ShareJS.Doc", true]
+ # ]
+ # desc: """
+ #
+ # """
def syncWith: (share) ->
@share = share.at(@options.name)
@share.set("") unless @share.get()?
@@ -75,16 +106,32 @@ AS.Model.Field = AS.Property.extend ({delegate, include, def, defs}) ->
@synapse.observe(@shareSynapse)
@synapse.notify(@shareSynapse)
+ # @::stopSync.doc =
+ # desc: """
+ #
+ # """
def stopSync: ->
@synapse?.stopObserving()
@synapse?.stopNotifying()
-
+
+ # @::get.doc =
+ # return: "*"
+ # desc: """
+ #
+ # """
def get: ->
if @value isnt undefined
value = Casters.get(@options.type).read(@value, @options)
else
@options.default
+ # @::set.doc =
+ # params: [
+ # ["value", "*", true]
+ # ]
+ # desc: """
+ #
+ # """
def set: (value) ->
writeValue = Casters.get(@options.type).write(value, @options)
return @value if writeValue is @value
@@ -120,7 +167,7 @@ AS.Model.Field = AS.Property.extend ({delegate, include, def, defs}) ->
raw.del(0, length)
raw.insert(0, value.toString())
else if value
- raw.insert(0, value.toString())
+ raw.insert(0, value.toString())
else if current
raw.del(0, current.toString().length)
@@ -139,6 +186,6 @@ AS.Model.Field = AS.Property.extend ({delegate, include, def, defs}) ->
-AS.Model.defs field: (name, options) ->
+AS.Model.defs field: (name, options) ->
AS.Model.Field.new(name, this, options)
View
60 lib/alpha_simprini/core/properties/has_many.coffee
@@ -9,22 +9,22 @@ AS.Model.HasMany = AS.Model.Field.extend ({delegate, include, def, defs}) ->
AS.Model.HasMany.Instance = AS.Model.Field.Instance.extend ({def, delegate}) ->
delegate AS.COLLECTION_DELEGATES, to: "backingCollection"
delegate 'groupBy', 'bind', 'trigger' 'unbind', to: "backingCollection"
-
- # @::inspect.doc =
+
+ # @::inspect.doc =
# return: String
# desc: """
- #
+ #
# """
def inspect: ->
"#{@options.name}: [#{@backingCollection.length}]}"
- # @::initialize.doc =
+ # @::initialize.doc =
# params: [
# ["@object", AS.Model, true]
# ["@options", Obect, false, default: {}]
# ]
# desc: """
- #
+ #
# """
def initialize: (@object, @options={}) ->
@model = @options.model
@@ -33,12 +33,12 @@ AS.Model.HasMany.Instance = AS.Model.Field.Instance.extend ({def, delegate}) ->
@bind('change', (=> @triggerDependants()), this)
- # @::syncWith.doc =
+ # @::syncWith.doc =
# params: [
# ["share", "ShareJS.Doc", true]
# ]
# desc: """
- #
+ #
# """
def syncWith: (share) ->
console.log "syncWith", @toString()
@@ -54,86 +54,86 @@ AS.Model.HasMany.Instance = AS.Model.Field.Instance.extend ({def, delegate}) ->
_.each alreadyThere, (item) => @shareSynapse.insert(item, {})
@synapse.notify(@shareSynapse)
- # @::objects.doc =
+ # @::objects.doc =
# return: [AS.Model]
# desc: """
- #
+ #
# """
def objects: ->
- @backingCollection.models.value()
+ @backingCollection.models.value()
- # @::bindToPathSegment.doc =
+ # @::bindToPathSegment.doc =
# params: [
# ["segment", Taxi.Segment, true]
# ]
# desc: """
- #
+ #
# """
def bindToPathSegment: (segment) ->
segment.binds this, "add", segment.insertCallback
segment.binds this, "remove", segment.removeCallback
- # @::set.doc =
+ # @::set.doc =
# params: [
# ["models", [[AS.Model, String, Object], true]
# ]
# desc: """
- #
+ #
# """
def set: (models) ->
@backingCollection.add(model) for model in models
- # @::add.doc =
+ # @::add.doc =
# params: [
# ["model", AS.Model, true]
# ["options", Object, false]
# ]
# desc: """
- #
+ #
# """
- def add: (model, options) ->
+ def add: (model, options) ->
added = @backingCollection.add(model, options)
@triggerDependants()
return added
- # @::at.doc =
+ # @::at.doc =
# params: [
# ["index", Number, true]
# ]
# return: [AS.Model, undefined]
# desc: """
- #
+ #
# """
def at: (index) -> @backingCollection.at.apply(@backingCollection, arguments)
- # @::remove.doc =
+ # @::remove.doc =
# params: [
# ["model", AS.Model, true]
# ]
# return: AS.Model
# desc: """
- #
+ #
# """
- def remove: (model) ->
+ def remove: (model) ->
removed = @backingCollection.remove.apply(@backingCollection, arguments)
@triggerDependants()
return removed
- # @::pluc.doc =
+ # @::pluc.doc =
# params: [
# ["key", String, true]
# ]
# return: ["*"]
# desc: """
- #
+ #
# """
def pluck: (key) ->
@map (item) -> item[key].get()
- # @::any.doc =
+ # @::any.doc =
# return: Boolean
# desc: """
- #
+ #
# """
def any: ->
_.any @backingCollection
@@ -144,12 +144,12 @@ AS.Model.HasMany.Instance = AS.Model.Field.Instance.extend ({def, delegate}) ->
def remove: (item, options) ->
@raw.remove @raw.at(options.at)
-
+
def binds: (insertCallback, removeCallback) ->
@raw.bind "add#{@namespace}", (model, collection, options) ->
insertCallback(model, options)
- @raw.bind "remove#{@namespace}", (model, collection, options) ->
+ @raw.bind "remove#{@namespace}", (model, collection, options) ->
removeCallback(model, options)
def each: (fn) -> @raw.each(fn)
@@ -171,7 +171,7 @@ AS.Model.HasMany.Instance = AS.Model.Field.Instance.extend ({def, delegate}) ->
def unbinds: ->
@raw.removeListener(listener) for listener in @listeners
-
+
def insert: (model, options) ->
debugger if @path[0] is "compositions"
options.at ?= @raw.at(@path).get().length
@@ -186,5 +186,5 @@ AS.Model.HasMany.Instance = AS.Model.Field.Instance.extend ({def, delegate}) ->
#FIXME: this should have worked
# AS.Model.HasMany.Instance.delegate "add", "remove", "bind", "unbind", "trigger", to: "backingCollection"
-AS.Model.defs hasMany: (name, options) ->
+AS.Model.defs hasMany: (name, options) ->
AS.Model.HasMany.new(name, this, options)
View
28 lib/alpha_simprini/core/properties/has_one.coffee
@@ -2,25 +2,25 @@ AS = require("alpha_simprini")
_ = require("underscore")
AS.Model.HasOne = AS.Model.Field.extend ({delegate, include, def, defs}) ->
- # @::couldBe.doc =
+ # @::couldBe.doc =
# params: [
# ["test", undefined, true]
# ]
# desc: """
- #
+ #
# """
def couldBe: (test) ->
return true if test in @options.model?().ancestors
@_super.apply(this, arguments)
AS.Model.HasOne.Instance = AS.Model.Field.Instance.extend ({def}) ->
- # @::initialize.doc =
+ # @::initialize.doc =
# params: [
# ["@object", AS.Model, true]
# ["@options", Object, true]
# ]
# desc: """
- #
+ #
# """
def initialize: (@object, @options) ->
@options.model ?= -> AS.Model
@@ -29,20 +29,20 @@ AS.Model.HasOne.Instance = AS.Model.Field.Instance.extend ({def}) ->
@_super.apply(this, arguments)
@bind "destroy", => @set(null)
- # @::get.doc =
+ # @::get.doc =
# return: [AS.Model, null]
# desc: """
- #
+ #
# """
def get: ->
@value
- # @::set.doc =
+ # @::set.doc =
# params: [
# ["value", AS.Model]
# ]
# desc: """
- #
+ #
# """
def set: (value) ->
value = value.model if value?.model
@@ -65,13 +65,13 @@ AS.Model.HasOne.Instance = AS.Model.Field.Instance.extend ({def}) ->
@value[@options.inverse].remove(@object) if @value[@options.inverse].include(@object).value()
@value = value
-
+
if @value and @options.inverse and @value[@options.inverse]
@value[@options.inverse].add(@object) unless @value[@options.inverse].include(@object).value()
-
+
# this looks neccessory for path bindings, but not so good for view bindings yeesh
# @value?.bind "all#{@namespace}", _.bind(@trigger, this)
-
+
@object.trigger("change")
@object.trigger("change:#{@options.name}")
@trigger("change")
@@ -84,13 +84,13 @@ AS.Model.HasOne.Instance = AS.Model.Field.Instance.extend ({def}) ->
def set: (value) ->
@raw.set(value)
-
+
@ShareSynapse = AS.Model.Field.Instance.ShareSynapse.extend ({delegate, include, def, defs}) ->
def get: ->
@raw.at(@path).get()
-
+
def set: (value) ->
@_super(value?.id) if value?.id
-AS.Model.defs hasOne: (name, options) ->
+AS.Model.defs hasOne: (name, options) ->
AS.Model.HasOne.new(name, this, options)
View
40 lib/alpha_simprini/core/properties/virtual_property.coffee
@@ -2,85 +2,85 @@ AS = require("alpha_simprini")
_ = require "underscore"
AS.Model.VirtualProperty = AS.Model.Field.extend ({def}) ->
- # @::initialize.doc =
+ # @::initialize.doc =
# params: [
# ["@name", String, true]
# ["@_constructor", AS.Object, true]
# ["@options", Object, true]
# ]
# desc: """
- #
+ #
# """
def initialize: (@name, @_constructor, @options={}) ->
@options.name = @name
@dependencies = @options.dependencies
@_constructor.writeInheritableValue 'properties', @name, this
- # @::instance.doc =
+ # @::instance.doc =
# params: [
# ["object", AS.Model, true]
# ]
# desc: """
- #
+ #
# """
def instance: (object) -> @constructor.Instance.new(object, @options)
NULL_CACHE = new Object
AS.Model.VirtualProperty.Instance = AS.Property.Instance.extend ({def}) ->
- # @::initialize.doc =
+ # @::initialize.doc =
# params: [
# ["@object", AS.Model, true]
# ["@options", Object, true]
# ]
# desc: """
- #
+ #
# """
def initialize: (@object, @options) ->
@cached = NULL_CACHE
@bindDependencies()
- # @::bindDependencies.doc =
+ # @::bindDependencies.doc =
# desc: """
- #
+ #
# """
def bindDependencies: ->
for dependency in @options.dependencies
@object[dependency].addDependant(this)
- # @::set.doc =
+ # @::set.doc =
# params: [
# [value, "*", true]
# ]
# desc: """
- #
+ #
# """
- def set: (value) ->
+ def set: (value) ->
if set = @options.getSet.set
set.call(@object, value)
else
throw "Can't set a VirtualProperty name: #{@options.name}, dependencies: #{@options.dependencies.join(',')}"
-
- # @::get.doc =
+
+ # @::get.doc =
# return: "*"
# desc: """
- #
+ #
# """
def get: -> @cached = @compute()
- # @::compute.doc =
+ # @::compute.doc =
# private: true
# params: [
# []
# ]
# desc: """
- #
+ #
# """
def compute: (args) -> @options.getSet.get.call(@object)
- # @::triggerFor.doc =
+ # @::triggerFor.doc =
# private: true
# desc: """
- #
+ #
# """
def triggerFor: () ->
# JUST LET THINGS GO TO HELL. WE NEED A RUNLOOP AND DIRTY TRACKING I GUESS ):(
@@ -90,9 +90,9 @@ AS.Model.VirtualProperty.Instance = AS.Property.Instance.extend ({def}) ->
@trigger("change")
@object.trigger("change")
@object.trigger("change:#{@options.name}")
-
-AS.Model.defs virtualProperties: (dependencies..., properties) ->
+
+AS.Model.defs virtualProperties: (dependencies..., properties) ->
for name, fn of properties
if _.isFunction(fn)
getSet = {get: fn}
View
8 lib/alpha_simprini/core/state_machine.coffee
@@ -9,12 +9,12 @@ _ = require "underscore"
# @event "stop_now"
# @event ""
AS.StateMachine = AS.Module.extend ({def}) ->
- # @::transitionState.doc =
+ # @::transitionState.doc =
# params: [
# ["options", Object, true]
# ]
# desc: """
- #
+ #
# """
def transitionState: (options) ->
if @state is options.from
@@ -22,12 +22,12 @@ AS.StateMachine = AS.Module.extend ({def}) ->
@state = options.to
@["enter_#{options.to}"]?(options)
- # @::defaultState.doc =
+ # @::defaultState.doc =
# params: [
# ["state", String, true]
# ]
# desc: """
- #
+ #
# """
def defaultState: (state) ->
@transitionState from:undefined, to:state
View
24 lib/alpha_simprini/packer.coffee
@@ -5,10 +5,10 @@ module "AS.Heap", ->
@OBJECTS = 0x14
@NAMED_OBJECTS = 0x15
@LITERALS = 0x16
-
+
class @NullClass
constructor: ->
-
+
@Classes =
PackedClass: Function
Array: Array
@@ -20,21 +20,21 @@ module "AS.Heap", ->
NilClass: null
FalseClass: false
TrueClass: true
-
+
class @Unpacker
constructor: (hash) ->
@literals = hash[AS.Heap.LITERALS]
@classes = {}
-
+
for key, value of hash[AS.Heap.CLASSES]
@classes[value] = @resolve_class(key)
-
+
@packed_objects = hash[AS.Heap.OBJECTS]
@objects = {}
- @named_objects = {}
-
+ @named_objects = {}
+
@unpack_object(key) for key, value of @packed_objects
-
+
for key, value of hash[AS.Heap.NAMED_OBJECTS]
@named_objects[@unpack_object(key)] = @unpack_object(value)
@@ -43,7 +43,7 @@ module "AS.Heap", ->
klass
else
throw new Error("Unresolved class with key #{key}")
-
+
allocate_object: (klass) ->
eval("function #{klass.name} () {this.constructor = klass; }")
@@ -84,10 +84,10 @@ module "AS.Heap", ->
# FIXME: TESTCASE
# class ThingClass
-#
+#
# constructor: (@ace, @b, @c, @t) ->
-#
+#
# AS.Heap.Classes.Thing = ThingClass
-#
+#
# window.d = {"19":{"Thing":0,"Symbol":1,"String":2,"Array":3,"NilClass":4,"Fixnum":5,"Numeric":6},"20":{"70175767968160":{"17":0,"18":{"677308":70175767963660,"677468":70175767968120,"677628":247,"677788":70175767968160}},"677308":{"17":2,"18":0},"70175767963660":{"17":3,"18":[70175767968100,70175767968060,70175767968020,70175767967980,70175767967940,70175767967900,70175767967860,70175767967820,70175767967780,70175767967740,70175767967700,70175767967660,70175767967620,70175767967580,70175767967540,70175767967500,70175767967460,70175767967420,70175767967380,70175767967340,70175767967300,70175767967260,70175767967220,70175767967180,70175767967140,70175767967100,70175767967060,70175767967020,70175767966980,70175767966940,70175767966900,70175767966860,70175767966820,70175767966780,70175767966740,70175767966700,70175767966660,70175767966620,70175767966580,70175767966540,70175767966500,70175767966460,70175767966420,70175767966380,70175767966340,70175767966300,70175767966260,70175767966220,70175767966180,70175767966140,70175767966100,70175767966060,70175767966020,70175767965980,70175767965940,70175767965900,70175767965860,70175767965820,70175767965780,70175767965740,70175767965700,70175767965660,70175767965620,70175767965580,70175767965540,70175767965500,70175767965460,70175767965420,70175767965380,70175767965340,70175767965300,70175767965260,70175767965220,70175767965180,70175767965140,70175767965100,70175767965060,70175767965020,70175767964980,70175767964940,70175767964900,70175767964860,70175767964820,70175767964780,70175767964740,70175767964700,70175767964660,70175767964620,70175767964580,70175767964540,70175767964500,70175767964460,70175767964420,70175767964380,70175767964340,70175767964300,70175767964260,70175767964220,70175767964180,70175767964140,70175767964100,70175767964060,70175767964020,70175767963980,70175767963940,70175767963900,70175767963860,70175767963820,70175767963780,70175767963740,70175767963700]},"70175767968100":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"4":{"17":4,"18":{}},"677468":{"17":2,"18":1},"677628":{"17":2,"18":2},"677788":{"17":2,"18":3},"70175767968060":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767968020":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767967980":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767967940":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767967900":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767967860":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767967820":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767967780":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767967740":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767967700":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767967660":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767967620":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767967580":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767967540":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767967500":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767967460":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767967420":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767967380":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767967340":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767967300":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767967260":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767967220":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767967180":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767967140":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767967100":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767967060":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767967020":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767966980":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767966940":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767966900":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767966860":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767966820":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767966780":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767966740":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767966700":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767966660":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767966620":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767966580":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767966540":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767966500":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767966460":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767966420":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767966380":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767966340":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767966300":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767966260":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767966220":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767966180":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767966140":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767966100":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767966060":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767966020":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767965980":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767965940":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767965900":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767965860":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767965820":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767965780":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767965740":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767965700":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767965660":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767965620":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767965580":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767965540":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767965500":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767965460":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767965420":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767965380":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767965340":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767965300":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767965260":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767965220":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767965180":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767965140":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767965100":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767965060":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767965020":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767964980":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767964940":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767964900":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767964860":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767964820":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767964780":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767964740":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767964700":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767964660":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767964620":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767964580":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767964540":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767964500":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767964460":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767964420":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767964380":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767964340":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767964300":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767964260":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767964220":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767964180":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767964140":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767964100":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767964060":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767964020":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767963980":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767963940":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767963900":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767963860":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767963820":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767963780":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767963740":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767963700":{"17":0,"18":{"677308":4,"677468":4,"677628":4,"677788":4}},"70175767968120":{"17":2,"18":4},"247":{"17":6,"18":5},"70175767963520":{"17":2,"18":6}},"21":{"70175767963520":70175767968160},"22":["@ace","@b","@c","@t","OMGt,t,t,t,t,t,t,t,t,t,t,tt,t,t,t,t,t,t,t,t,t,t,tt,t,t,t,t,t,t,t,t,t,t,tt,t,t,t,t,t,t,t,t,t,t,tt,t,t,t,t,t,t,t,t,t,t,t",123,"thing"]}
# window.up=new AS.Heap.Unpacker(d)
View
2  lib/alpha_simprini/string.coffee
@@ -5,7 +5,7 @@ _.mixin(_.str.exports())
String::blank = ->
!!@match(/^\s*?$/)
-
+
String::underscore = ->
under = @replace(/([A-Z])/g, (match) -> "_#{match}")
if under[0] is "_"
View
2  test/client/application.coffee
@@ -6,7 +6,7 @@ exports.Application =
"attaches global key handlers w/jwerty": (test) ->
events = [
- "open", "up", "down", "first", "last", "left",
+ "open", "up", "down", "first", "last", "left",
"right", "indent", "dedent", "alphanum"
"escape", "accept", "delete"
]
View
4 test/client/binding/one.coffee
@@ -7,7 +7,7 @@ exports.Binding =
setUp: (callback) ->
@model = BoundModel.new( owner: BoundModel.new() )
- content_fn = (thing) ->
+ content_fn = (thing) ->
@div id: thing.cid.replace('.', '-')
[mocks, binding] = mock_binding(AS.Binding.One, field: @model.owner, model: @model, fn: content_fn)
@@ -32,7 +32,7 @@ exports.Binding =
test.done()
"passes a model binding to the content_fn": (test) ->
- @binding.fn = (model, binding) ->
+ @binding.fn = (model, binding) ->
test.equal AS.Binding.Model, binding.constructor
test.done()
View
14 test/client/view.coffee
@@ -68,7 +68,7 @@ exports.View =
test.equal subEl, returned
test.equal subEl, view.childViews[0].el[0]
- # child view is added to the bindingGroup's children so 'unbind'
+ # child view is added to the bindingGroup's children so 'unbind'
# will be called on the view object.
test.equal view.childViews[0], view.bindingGroup.children.reverse()[0]
@@ -82,7 +82,7 @@ exports.View =
# test.equal "", view.html()
# test.done()
- "binding()":
+ "binding()":
"creates a binding for a collection": (test) ->
view = AS.View.new()
collection = AS.Collection.new()
@@ -114,7 +114,7 @@ exports.View =
test.equal 1, view.descendantViews(null, NS.SubView).length
test.done()
-exports["View Integration"] =
+exports["View Integration"] =
"property binding with two children":
setUp: (callback) ->
NS.Parent = AS.Model.extend ({delegate, include, def, defs}) ->
@@ -126,7 +126,7 @@ exports["View Integration"] =
NS.Child = AS.Model.extend ({delegate, include, def, defs}) ->
@field 'name'
-
+
@item1 = NS.Item.new()
@item2 = NS.Item.new()
@@ -159,7 +159,7 @@ exports["View Integration"] =
test.equal 0, @view.el.find("ul li").length
test.done()
- "property binding nested ina property binding":
+ "property binding nested ina property binding":
setUp: (callback) ->
NS.Model = AS.Model.extend ({delegate, include, def, defs}) ->
@property "other"
@@ -199,9 +199,9 @@ exports["View Integration"] =
test.ok @view.el.find("##{@thing2.objectId()}").is("*"), "renders second thing"
test.ok @view.el.find("##{@thing2.children.at(0).objectId()}").is("*"), "renders second thing first child"
test.ok @view.el.find("##{@thing2.children.at(1).objectId()}").is("*"), "renders second thing second child"
-
+
@model.other.set(@other2)
-
+
test.equal 1, @view.el.find(".model-other").length, "renders only one other"
test.ok @view.el.find("##{@thing2.objectId()}").is("*"), "second thing still visiible"
test.done()
View
4 test/core/collection.coffee
@@ -8,7 +8,7 @@ exports.Collection =
C.Thing = AS.Model.extend()
C.Thing.property("inverse")
C.Thing.property("name")
- C.ThingCollection = AS.Collection.extend ->
+ C.ThingCollection = AS.Collection.extend ->
@def model: -> C.Thing
@def inverse: "inverse"
@@ -22,7 +22,7 @@ exports.Collection =
"clears inverse if specified": (test) ->
C.Thing = AS.Model.extend()
C.Thing.property("inverse")
- C.ThingCollection = AS.Collection.extend ->
+ C.ThingCollection = AS.Collection.extend ->
@def model: -> C.Thing
@def inverse: "inverse"
View
2  test/core/model/rest.coffee
@@ -32,7 +32,7 @@ plain =
thing_id: 1
thing_type: "Thing"
-sideLoading =
+sideLoading =
rested:
id: 1
field: "packed"
View
26 test/core/model/share.coffee
@@ -18,7 +18,7 @@ indexedData =
things: "Shared-1"
-shareData =
+shareData =
# index:
# "Indexed-1": "NS.Shared"
@@ -40,11 +40,11 @@ exports.ShareJSAdapter =
@adapter = AS.Model.ShareJSAdapter.new({@model, @store})
@adapter.didOpen makeDoc(null, shareData)
- callback()
+ callback()
"loads embedded data": (test) ->
test.deepEqual(
- @model.things.backingCollection.models.value(),
+ @model.things.backingCollection.models.value(),
[NS.Shared.find("Shared-1"), NS.Shared.find("Shared-2")]
)
@@ -55,25 +55,25 @@ exports.ShareJSAdapter =
test.done()
# Shared = NS.Shared = AS.Model.extend ({delegate, include, def, defs}) ->
-#
+#
# @field "field"
# @hasMany "relations", model: -> SimpleShare
# # @hasOne "relation"
# @belongsTo "owner"
# SimpleShare = NS.SimpleShare = AS.Model.extend ({delegate, include, def, defs}) ->
-#
+#
# @field "field"
# @hasMany "relations", model: -> SimplerShare
# # @hasOne "relation"
# @belongsTo "owner"
# SimplerShare = NS.SimplerShare = AS.Model.extend ({delegate, include, def, defs}) ->
-#
+#
# @field "field"
# IndexShare = NS.IndexShare = AS.Model.extend ({delegate, include, def, defs}) ->
-#
+#
# @index "docs"
# @belongsTo "owner"
@@ -110,7 +110,7 @@ exports.ShareJSAdapter =
# test.deepEqual [], @model.share.at("embeds").get()
# test.done()
-# "indexes":
+# "indexes":
# setUp: (callback) ->
# (@model = IndexShare.shared()).whenIndexed callback
@@ -130,10 +130,10 @@ exports.ShareJSAdapter =
# loaded.whenIndexed ->
# test.done()
# @model.share.emit(
-# "remoteop",
+# "remoteop",
# @model.share.at("index:docs", other.id).set(SimpleShare.path())
# )
-
+
# "loads models in indexes when opened": (test) ->
# indexed = SimpleShare.new()
# indexed.owner.set(indexed)
@@ -198,7 +198,7 @@ exports.ShareJSAdapter =
# "sets defaults when opening a new model": (test) ->
# NS.DefaultShared = AS.Model.extend ({delegate, include, def, defs}) ->
-#
+#
# @field "defaulted", default: "value"
# model = NS.DefaultShared.shared("someid")
@@ -210,7 +210,7 @@ exports.ShareJSAdapter =
# AS.openSharedObject = (id, didOpen) ->
# didOpen makeDoc(id, defaulted: "REMOTE VALUE")
# NS.DefaultShared = AS.Model.extend ({delegate, include, def, defs}) ->
-#
+#
# @field "defaulted", default: "value"
# model = NS.DefaultShared.shared("some other id")
@@ -222,7 +222,7 @@ exports.ShareJSAdapter =
# "loads lists of embedded models":
# setUp: (callback) ->
# NS.Embed = AS.Model.extend ({delegate, include, def, defs}) ->
-#
+#
# @hasMany 'embeds'
View
4 test/core/properties/field.coffee
@@ -67,7 +67,7 @@ exports.Field =
test.equal 2, o.enum.value
test.done()
- "bindPath":
+ "bindPath":
"may be used in path bindings": (test) ->
o = Model.new()
o.bindPath ['boolean'], -> test.done()
@@ -87,7 +87,7 @@ exports.Field =
o.name.syncWith(share)
test.equal "from share", o.name.get()
test.done()
-
+
"propagate field value to @share on sync": (test) ->
o = Model.new(name: "from model")
share = makeDoc()
View
4 test/core/properties/has_many.coffee
@@ -71,7 +71,7 @@ exports.HasMany =
test.done()
"Sharing":
- "on load":
+ "on load":
"loads objects from share": (test) ->
shareData =
children: [
@@ -117,7 +117,7 @@ exports.HasMany =
share.at().set children: [{"NS.Child", id: child.id}]
o.children.syncWith(share)
test.equal child.id, o.children.at(0).id
-
+
test.done()
setUp: (callback) ->
View
4 test/core/properties/has_one.coffee
@@ -8,13 +8,13 @@ NS.Parent.hasOne "other", model: -> NS.Other
NS.Other = NS.Parent.extend()
NS.Other.field "name"
-exports.HasOne =
+exports.HasOne =
"property is a HasOne": (test) ->
o = NS.Parent.new()
test.ok o.other instanceof AS.Model.HasOne.Instance
test.done()
- "is set when constructing the model":
+ "is set when constructing the model":
"with a model": (test) ->
o = NS.Parent.new other: other = AS.Model.new()
test.equal other, o.other.get()
View
4 test/core/properties/virtual_property.coffee
@@ -20,7 +20,7 @@ NS.Basic = AS.Model.extend ({delegate, include, def, defs}) ->
exports.VirtualProperty =
"is a virtual": (test) ->
test.ok NS.Virtualized.properties.virtualA instanceof AS.Model.VirtualProperty
- test.ok NS.Virtualized.properties.virtualB instanceof AS.Model.VirtualProperty
+ test.ok NS.Virtualized.properties.virtualB instanceof AS.Model.VirtualProperty
test.done()
"exposes dependencies": (test) ->
@@ -63,7 +63,7 @@ exports.VirtualProperty =
o.others.at(0).name.set("NEW NAME")
test.done()
- "bindPath":
+ "bindPath":
"may be used in path bindings": (test) ->
o = NS.Virtualized.new()
o.bindPath ['virtualA'], -> test.done()
Please sign in to comment.
Something went wrong with that request. Please try again.