Skip to content

Commit

Permalink
stripped trailing whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
collin committed Apr 25, 2012
1 parent 064fe79 commit 8015775
Show file tree
Hide file tree
Showing 41 changed files with 299 additions and 252 deletions.
2 changes: 1 addition & 1 deletion lib/alpha_simprini.coffee
Expand Up @@ -10,7 +10,7 @@ AS.unimplemented = (method) ->
return -> return ->
throw new Error ["you MUST implement the method '#{method}' on: #{@toString()}"] 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 exports[name] = require: (libraries) -> AS.require name.toLowerCase(), libraries


# Namespaces # Namespaces
Expand Down
2 changes: 1 addition & 1 deletion lib/alpha_simprini/client.coffee
Expand Up @@ -7,7 +7,7 @@ Client.require """
binding binding
binding/container binding/container
binding/model binding/field binding/input binding/select binding/file binding/model binding/field binding/input binding/select binding/file
binding/check_box binding/edit_line binding/one binding/many binding/check_box binding/edit_line binding/one binding/many
Expand Down
2 changes: 1 addition & 1 deletion lib/alpha_simprini/client/application.coffee
Expand Up @@ -41,7 +41,7 @@ AS.Application = AS.Object.extend ({def, include}) ->
each handlers, (trigger, key) => each handlers, (trigger, key) =>
jwerty.key key, ( (event) => @trigger(trigger, event) ), @el jwerty.key key, ( (event) => @trigger(trigger, event) ), @el


jwerty.key "backspace", (event) => jwerty.key "backspace", (event) =>
event.preventDefault() event.preventDefault()
@trigger("delete", event) @trigger("delete", event)


Expand Down
6 changes: 3 additions & 3 deletions lib/alpha_simprini/client/binding.coffee
Expand Up @@ -4,8 +4,8 @@ _ = require "underscore"
AS.Binding = AS.Object.extend ({def}) -> AS.Binding = AS.Object.extend ({def}) ->
def initialize: (@context, @model, @field, @options={}, @fn=undefined) -> def initialize: (@context, @model, @field, @options={}, @fn=undefined) ->
if _.isString(@field) if _.isString(@field)
@field = @model[@field] @field = @model[@field]

if _.isFunction(@options) if _.isFunction(@options)
[@fn, @options] = [@options, {}] [@fn, @options] = [@options, {}]


Expand All @@ -26,7 +26,7 @@ AS.Binding = AS.Object.extend ({def}) ->
def willGroupBindings: -> def willGroupBindings: ->
@constructor.willGroupBindings or _.isFunction(@fn) @constructor.willGroupBindings or _.isFunction(@fn)


def fieldValue: -> def fieldValue: ->
if _.isArray(@field) if _.isArray(@field)
@model.readPath(@field) @model.readPath(@field)
else else
Expand Down
4 changes: 2 additions & 2 deletions lib/alpha_simprini/client/binding/file.coffee
Expand Up @@ -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 fieldValue: -> # FALSE. Cannot set value of a file input.
def setContent: -> # 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] AS.Models.File.new file: @content[0].files[0]



2 changes: 1 addition & 1 deletion lib/alpha_simprini/client/binding/one.coffee
Expand Up @@ -5,7 +5,7 @@ jQuery = require "jquery"
AS.Binding.One = AS.Binding.Field.extend ({delegate, include, def, defs}) -> AS.Binding.One = AS.Binding.Field.extend ({delegate, include, def, defs}) ->
def makeContent: -> def makeContent: ->
AS.Binding.Container.new(@container[0]) AS.Binding.Container.new(@container[0])

def setContent: -> def setContent: ->
@content.empty() @content.empty()
@bindingGroup.unbind() @bindingGroup.unbind()
Expand Down
2 changes: 1 addition & 1 deletion lib/alpha_simprini/client/binding_group.coffee
Expand Up @@ -25,7 +25,7 @@ AS.BindingGroup = AS.Object.extend ({def}) ->
else if _.isArray(event) else if _.isArray(event)
object.bindPath(event, _.bind(handler, context)) object.bindPath(event, _.bind(handler, context))
else else
object.bind object.bind
event: event event: event
namespace: @namespace namespace: @namespace
handler: handler handler: handler
Expand Down
6 changes: 3 additions & 3 deletions lib/alpha_simprini/client/view.coffee
Expand Up @@ -15,7 +15,7 @@ AS.View = AS.DOM.extend ({delegate, include, def, defs}) ->


def attrBindings: null def attrBindings: null


def _ensureElement: -> def _ensureElement: ->
@el ?= @$(@buildElement()) @el ?= @$(@buildElement())
baseAttributes = @baseAttributes() baseAttributes = @baseAttributes()
baseAttributes["class"] = undefined if @el.attr("class") baseAttributes["class"] = undefined if @el.attr("class")
Expand Down Expand Up @@ -73,7 +73,7 @@ AS.View = AS.DOM.extend ({delegate, include, def, defs}) ->


def binds: -> @bindingGroup.binds.apply(@bindingGroup, arguments) def binds: -> @bindingGroup.binds.apply(@bindingGroup, arguments)


def klassString: -> def klassString: ->
classes = [] classes = []
for ancestor in @constructor.ancestors for ancestor in @constructor.ancestors
continue unless ancestor.path().match(/Views?/) continue unless ancestor.path().match(/Views?/)
Expand Down Expand Up @@ -129,7 +129,7 @@ AS.View = AS.DOM.extend ({delegate, include, def, defs}) ->


def bindAttrs: -> def bindAttrs: ->
return unless @attrBindings return unless @attrBindings
@modelBinding().attr @attrBindings @modelBinding().attr @attrBindings


def delegateEvents: () -> def delegateEvents: () ->
if @events if @events
Expand Down
22 changes: 11 additions & 11 deletions lib/alpha_simprini/client/views/dialog.coffee
Expand Up @@ -5,51 +5,51 @@ knead = require "knead"
AS.Views.Dialog = AS.Views.Panel.extend ({delegate, include, def, defs}) -> AS.Views.Dialog = AS.Views.Panel.extend ({delegate, include, def, defs}) ->
def initialize: -> def initialize: ->
@constructor::events ?= {} @constructor::events ?= {}
_.extend @constructor::events, _.extend @constructor::events,
"click .accept": "trigger_commit" "click .accept": "trigger_commit"
"click .cancel": "trigger_cancel" "click .cancel": "trigger_cancel"
"esc @application": "trigger_cancel" "esc @application": "trigger_cancel"
"accept @application": "trigger_commit" "accept @application": "trigger_commit"

"knead:dragstart header": "dragstart" "knead:dragstart header": "dragstart"
"knead:drag header": "drag" "knead:drag header": "drag"
"knead:dragend header": "dragend" "knead:dragend header": "dragend"

@_super.apply(this, arguments) @_super.apply(this, arguments)


def content: -> def content: ->
@head = @$ @header @header_content @head = @$ @header @header_content
@content = @$ @section @main_content @content = @$ @section @main_content
@foot = @$ @footer @footer_content @foot = @$ @footer @footer_content
knead.monitor @head knead.monitor @head

def header_content: -> def header_content: ->
def main_content: -> def main_content: ->
def footer_content: -> def footer_content: ->
@accept = @$ @button class:"accept", -> "Accept" @accept = @$ @button class:"accept", -> "Accept"
@cancel = @$ @a href:"#", class:"cancel", -> "cancel" @cancel = @$ @a href:"#", class:"cancel", -> "cancel"


def open: -> def open: ->
@el.css width: "", height: "" @el.css width: "", height: ""
@trigger "open" @trigger "open"

def close: -> def close: ->
@el.css width: 0, height: 0, overflow: "hidden" @el.css width: 0, height: 0, overflow: "hidden"
@trigger "close" @trigger "close"

def trigger_commit: -> def trigger_commit: ->
@trigger "commit" @trigger "commit"
@close() @close()

def trigger_cancel: -> def trigger_cancel: ->
@trigger "cancel" @trigger "cancel"
@close() @close()

def dragstart: (event) -> def dragstart: (event) ->
@start = @el.position() @start = @el.position()
def drag: (event) -> def drag: (event) ->
@el.css @el.css
top: event.deltaY + @start.top top: event.deltaY + @start.top
left: event.deltaX + @start.left left: event.deltaX + @start.left
def dragend: (event) -> def dragend: (event) ->
delete @start delete @start
4 changes: 2 additions & 2 deletions lib/alpha_simprini/core.coffee
Expand Up @@ -4,12 +4,12 @@ _ = require "underscore"


Core.require """ Core.require """
logging logging
callbacks state_machine callbacks state_machine
instance_methods instance_methods
model model/dendrite model/synapse model/store 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 properties/belongs_to properties/virtual_property
collection filtered_collection collection filtered_collection
Expand Down
6 changes: 3 additions & 3 deletions lib/alpha_simprini/core/callbacks.coffee
Expand Up @@ -9,13 +9,13 @@ AS.Callbacks = AS.Module.extend ({def, defs}) ->
do (callback) => do (callback) =>
@["#{key}#{upperCamelize callback}"] = (fn) -> @["#{key}#{upperCamelize callback}"] = (fn) ->
@pushInheritableItem("#{key}#{upperCamelize callback}_callbacks", fn) @pushInheritableItem("#{key}#{upperCamelize callback}_callbacks", fn)

# @::runCallbacks.doc = # @::runCallbacks.doc =
# params: [ # params: [
# ["name", String, true] # ["name", String, true]
# ] # ]
# desc: """ # desc: """
# #
# """ # """
def runCallbacks: (name) -> def runCallbacks: (name) ->
for callback in @constructor["#{name}_callbacks"] || [] for callback in @constructor["#{name}_callbacks"] || []
Expand Down
48 changes: 24 additions & 24 deletions lib/alpha_simprini/core/collection.coffee
Expand Up @@ -7,13 +7,13 @@ AS.Collection = AS.Object.extend ({def, include, delegate}) ->
include Taxi.Mixin include Taxi.Mixin
delegate AS.COLLECTION_DELEGATES, to: "models" delegate AS.COLLECTION_DELEGATES, to: "models"


# @::initialize.doc = # @::initialize.doc =
# params: [ # params: [
# ["@models", [AS.Model], false, default: []] # ["@models", [AS.Model], false, default: []]
# ["options", Object, false, default: {}] # ["options", Object, false, default: {}]
# ] # ]
# desc: """ # desc: """
# #
# """ # """
def initialize: (@models=[], options = {}) -> def initialize: (@models=[], options = {}) ->
extend this, options extend this, options
Expand All @@ -23,19 +23,19 @@ AS.Collection = AS.Object.extend ({def, include, delegate}) ->
@models = _([]).chain() @models = _([]).chain()
@add(model) for model in @models @add(model) for model in @models


# @::model.doc = # @::model.doc =
# desc: """ # desc: """
# #
# """ # """
def model: -> AS.Model def model: -> AS.Model


# @::add.doc = # @::add.doc =
# params: [ # params: [
# ["model", [AS.Model, String, Object], false, default: {}] # ["model", [AS.Model, String, Object], false, default: {}]
# ["options", Object, false, default: {}] # ["options", Object, false, default: {}]
# ] # ]
# desc: """ # desc: """
# #
# """ # """
def add: (model={}, options={}) -> def add: (model={}, options={}) ->
# Allow for passing both Model and ViewModels in # Allow for passing both Model and ViewModels in
Expand All @@ -51,13 +51,13 @@ AS.Collection = AS.Object.extend ({def, include, delegate}) ->


model model


# @::build.doc = # @::build.doc =
# private: true # private: true
# params: [ # params: [
# ["model", [AS.Model, String, Object], true] # ["model", [AS.Model, String, Object], true]
# ] # ]
# desc: """ # desc: """
# #
# """ # """
def build: (model) -> def build: (model) ->
if isString(model) and constructor = @model?() if isString(model) and constructor = @model?()
Expand All @@ -69,18 +69,18 @@ AS.Collection = AS.Object.extend ({def, include, delegate}) ->
return AS.All.byId[model.id] return AS.All.byId[model.id]
else else
ctor = @model() ctor = @model()

data = _.clone(model) data = _.clone(model)
ctor.new(data) ctor.new(data)


# @::_add.doc = # @::_add.doc =
# private: true # private: true
# params: [ # params: [
# ["model", AS.Model, true] # ["model", AS.Model, true]
# ["options", Object, false, default: {}] # ["options", Object, false, default: {}]
# ] # ]
# desc: """ # desc: """
# #
# """ # """
def _add: (model, options={}) -> def _add: (model, options={}) ->
options.at ?= this.length options.at ?= this.length
Expand All @@ -96,23 +96,23 @@ AS.Collection = AS.Object.extend ({def, include, delegate}) ->


model.trigger "add", this, options model.trigger "add", this, options


# @::at.doc = # @::at.doc =
# params: [ # params: [
# ["index", Number, true] # ["index", Number, true]
# ] # ]
# desc: """ # desc: """
# #
# """ # """
def at: (index) -> def at: (index) ->
@models.value()[index] @models.value()[index]


# @::remove.doc = # @::remove.doc =
# params: [ # params: [
# ["model", AS.Model, true] # ["model", AS.Model, true]
# ["options", Object, false, default: {}] # ["options", Object, false, default: {}]
# ] # ]
# desc: """ # desc: """
# #
# """ # """
def remove: (model, options={}) -> def remove: (model, options={}) ->
# Allow for passing both Model and ViewModels in # Allow for passing both Model and ViewModels in
Expand All @@ -123,14 +123,14 @@ AS.Collection = AS.Object.extend ({def, include, delegate}) ->


result result


# @::_remove.doc = # @::_remove.doc =
# private: true # private: true
# params: [ # params: [
# ["model", AS.Model, true] # ["model", AS.Model, true]
# ["options", {}, false, default: {}] # ["options", {}, false, default: {}]
# ] # ]
# desc: """ # desc: """
# #
# """ # """
def _remove: (model, options={}) -> def _remove: (model, options={}) ->
options.at = @models.indexOf(model).value() options.at = @models.indexOf(model).value()
Expand All @@ -143,29 +143,29 @@ AS.Collection = AS.Object.extend ({def, include, delegate}) ->
event: "all" event: "all"
namespace: @objectId() namespace: @objectId()


# @::filter.doc = # @::filter.doc =
# params: [ # params: [
# ["filterBy", {}, true] # ["filterBy", {}, true]
# ] # ]
# return: AS.FilteredCollection # return: AS.FilteredCollection
# desc: """ # desc: """
# #
# """ # """
def filter: (filterBy) -> def filter: (filterBy) ->
AS.FilteredCollection.new(this, filterBy) AS.FilteredCollection.new(this, filterBy)


# @::groupBy.doc = # @::groupBy.doc =
# params: [ # params: [
# ["key", String, true] # ["key", String, true]
# ["metaData", Object, false] # ["metaData", Object, false]
# ] # ]
# desc: """ # desc: """
# #
# """ # """
def groupBy: (key, metaData) -> def groupBy: (key, metaData) ->
AS.Models.Grouping.new(this, key, metaData) AS.Models.Grouping.new(this, key, metaData)

# @::_onModelEvent.doc = # @::_onModelEvent.doc =
# private: true # private: true
# params: [ # params: [
# ["event", String, true] # ["event", String, true]
Expand All @@ -174,7 +174,7 @@ AS.Collection = AS.Object.extend ({def, include, delegate}) ->
# ["options", Object, false] # ["options", Object, false]
# ] # ]
# desc: """ # desc: """
# #
# """ # """
# # When an event is triggered from a model, it is bubbled up through the collection. # # When an event is triggered from a model, it is bubbled up through the collection.
def _onModelEvent: (event, model, collection, options) -> def _onModelEvent: (event, model, collection, options) ->
Expand Down

0 comments on commit 8015775

Please sign in to comment.