Skip to content

Commit

Permalink
added documentation stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
collin committed May 8, 2012
1 parent f7ce1ec commit 271d37a
Show file tree
Hide file tree
Showing 31 changed files with 1,134 additions and 117 deletions.
15 changes: 1 addition & 14 deletions Assetfile
Expand Up @@ -4,7 +4,7 @@ require "json"


output "dist" output "dist"
input "lib" do input "lib" do
match "/**/*.js" do match "**/*.js" do
minispade rewrite_requires: true, string: true, module_id_generator: proc { |input| minispade rewrite_requires: true, string: true, module_id_generator: proc { |input|
id = input.path.dup id = input.path.dup
id.sub!('/lib/', '/') id.sub!('/lib/', '/')
Expand All @@ -17,22 +17,9 @@ input "lib" do
end end
end end


# TODO: include a raw distribution
# input "lib", "**/*.js" do
# neuter { "alpha_simprini.js" }
# end

input "./", "alpha_simprini.erb" do input "./", "alpha_simprini.erb" do
require "./version" require "./version"
filter(Rake::Pipeline::Web::Filters::TiltFilter, {}, Object) do |input| filter(Rake::Pipeline::Web::Filters::TiltFilter, {}, Object) do |input|
"alpha_simprini.html" "alpha_simprini.html"
end end
end end


# output "dist/test"
# input "tmp/test" do
# match "**/*.js" do
# neuter
# end
# end
6 changes: 3 additions & 3 deletions Rakefile
Expand Up @@ -55,11 +55,11 @@ task :upload => :test do
uploader = GithubUploader.setup_uploader uploader = GithubUploader.setup_uploader
# TODO: release a raw distribution # TODO: release a raw distribution
# GithubUploader.upload_file uploader, "Alpha Simprini-#{AS_VERSION}.js", "Alpha Simprini #{AS_VERSION}", "dist/alpha_simprini.js" # GithubUploader.upload_file uploader, "Alpha Simprini-#{AS_VERSION}.js", "Alpha Simprini #{AS_VERSION}", "dist/alpha_simprini.js"
GithubUploader.upload_file uploader, "Alpha Simprini-#{AS_VERSION}-spade.js", "Alpha Simprini #{AS_VERSION} (minispade)", "dist/alpha_simprini-spade.js" GithubUploader.upload_file uploader, "alpha_simprini-#{AS_VERSION}-spade.js", "Alpha Simprini #{AS_VERSION} (minispade)", "dist/alpha_simprini-spade.js"
GithubUploader.upload_file uploader, "Alpha Simprini-#{AS_VERSION}.html", "Alpha Simprini #{AS_VERSION} (html_package)", "dist/alpha_simprini.html" GithubUploader.upload_file uploader, "alpha_simprini-#{AS_VERSION}.html", "Alpha Simprini #{AS_VERSION} (html_package)", "dist/alpha_simprini.html"


# GithubUploader.upload_file uploader, 'Alpha Simprini-latest.js', "Current Alpha Simprini", "dist/alpha_simprini.js" # GithubUploader.upload_file uploader, 'Alpha Simprini-latest.js', "Current Alpha Simprini", "dist/alpha_simprini.js"
GithubUploader.upload_file uploader, 'Alpha Simprini-latest-spade.js', "Current Alpha Simprini (minispade)", "dist/alpha_simprini-spade.js" GithubUploader.upload_file uploader, 'alpha_simprini-latest-spade.js', "Current Alpha Simprini (minispade)", "dist/alpha_simprini-spade.js"
end end


desc "Create json document object" desc "Create json document object"
Expand Down
2 changes: 1 addition & 1 deletion src/alpha_simprini.coffee
Expand Up @@ -28,7 +28,7 @@ AS.Property = Taxi.Property


AS.COLLECTION_DELEGATES = ["first", "rest", "last", "compact", "flatten", "without", "union", "filter", "reverse", AS.COLLECTION_DELEGATES = ["first", "rest", "last", "compact", "flatten", "without", "union", "filter", "reverse",
"intersection", "difference", "uniq", "zip", "indexOf", "find", "detect", "sortBy", "intersection", "difference", "uniq", "zip", "indexOf", "find", "detect", "sortBy",
"lastIndexOf", "range", "include", "each", "map", "reject","all", "toArray", "pluck"] "lastIndexOf", "range", "include", "each", "map", "reject","all", "toArray", "pluck", "invoke"]


AS.require = (framework="alpha_simprini", libraries) -> AS.require = (framework="alpha_simprini", libraries) ->
if libraries is undefined if libraries is undefined
Expand Down
40 changes: 37 additions & 3 deletions src/alpha_simprini/client/application.coffee
Expand Up @@ -9,14 +9,28 @@ AS.Application = AS.Object.extend ({def, include}) ->
_.extend(this, config) _.extend(this, config)
@params = AS.params @params = AS.params
@el ?= $("body") @el ?= $("body")
@god_given_key_handlers() @godGivenKeyHandlers()
domready => domready =>
@boot() @boot()
# @::initialize.doc =
# params: [
# []
# ]
# desc: """
#
# """




def boot: -> def boot: ->
# @::boot.doc =
# params: [
# []
# ]
# desc: """
#
# """


def god_given_key_handlers: -> def godGivenKeyHandlers: ->
handlers = handlers =
'': 'escape' '': 'escape'
'⌘+↩': 'accept' '⌘+↩': 'accept'
Expand All @@ -39,13 +53,33 @@ AS.Application = AS.Object.extend ({def, include}) ->
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()
@trigger("delete", event) @trigger("delete", event)
# @::godGivenKeyHandlers.doc =
# params: [
# []
# ]
# desc: """
#
# """


def view: (constructor, options={}) -> def view: (constructor, options={}) ->
options.application = this options.application = this
constructor.new options constructor.new options
# @::view.doc =
# params: [
# []
# ]
# desc: """
#
# """


def append: (view) -> def append: (view) ->
@el.append view.el @el.append view.el
# @::append.doc =
# params: [
# []
# ]
# desc: """
#
# """


42 changes: 42 additions & 0 deletions src/alpha_simprini/client/binding.coffee
Expand Up @@ -16,23 +16,65 @@ AS.Binding = AS.Object.extend ({def}) ->
@bindingGroup = bindingGroup @bindingGroup = bindingGroup


@setup() @setup()
# @::initialize.doc =
# params: [
# []
# ]
# desc: """
#
# """


def makeContent: -> def makeContent: ->
@context.$ [] @context.$ []
# @::makeContent.doc =
# params: [
# []
# ]
# desc: """
#
# """


def willGroupBindings: -> def willGroupBindings: ->
@constructor.willGroupBindings or _.isFunction(@fn) @constructor.willGroupBindings or _.isFunction(@fn)
# @::willGroupBindings.doc =
# params: [
# []
# ]
# desc: """
#
# """


def fieldValue: -> def fieldValue: ->
if _.isArray(@field) if _.isArray(@field)
@model.readPath(@field) @model.readPath(@field)
else else
@field.get() @field.get()
# @::fieldValue.doc =
# params: [
# []
# ]
# desc: """
#
# """


def require_option: (name) -> def require_option: (name) ->
return unless @options[name] is undefined return unless @options[name] is undefined
throw new AS.Binding.MissingOption("You must specify the #{name} option for #{@constructor.name} bindings.") throw new AS.Binding.MissingOption("You must specify the #{name} option for #{@constructor.name} bindings.")
# @::requireOption.doc =
# params: [
# []
# ]
# desc: """
#
# """


def setup: -> def setup: ->
# @::setup.doc =
# params: [
# []
# ]
# desc: """
#
# """


class AS.Binding.MissingOption extends Error class AS.Binding.MissingOption extends Error
28 changes: 28 additions & 0 deletions src/alpha_simprini/client/binding/check_box.coffee
Expand Up @@ -2,15 +2,43 @@ AS.Binding.CheckBox = AS.Binding.Input.extend ({def}) ->
def initialize: (context, model, field, options={}, fn=undefined) -> def initialize: (context, model, field, options={}, fn=undefined) ->
options.type = "checkbox" options.type = "checkbox"
@_super.apply(this, arguments) @_super.apply(this, arguments)
# @::initialize.doc =
# params: [
# []
# ]
# desc: """
#
# """


def setContent: -> def setContent: ->
@content.attr "checked", @fieldValue() @content.attr "checked", @fieldValue()
# @::setContent.doc =
# params: [
# []
# ]
# desc: """
#
# """


def bindContent: -> def bindContent: ->
@context.binds @content, "change", _.bind(@setField, this) @context.binds @content, "change", _.bind(@setField, this)
# @::bindContext.doc =
# params: [
# []
# ]
# desc: """
#
# """


def setField: -> def setField: ->
if @content.is ":checked" if @content.is ":checked"
@field.set true @field.set true
else else
@field.set false @field.set false
# @::setField.doc =
# params: [
# []
# ]
# desc: """
#
# """
21 changes: 21 additions & 0 deletions src/alpha_simprini/client/binding/container.coffee
Expand Up @@ -4,6 +4,13 @@ AS.Binding.Container = AS.Object.extend ({delegate, include, def, defs}) ->
def initialize: (@domElement) -> def initialize: (@domElement) ->
@el = jQuery(@domElement) @el = jQuery(@domElement)
@containerChildren = [] @containerChildren = []
# @::initialize.doc =
# params: [
# []
# ]
# desc: """
#
# """


def appendChild: (child) -> def appendChild: (child) ->
if child instanceof jQuery if child instanceof jQuery
Expand All @@ -12,7 +19,21 @@ AS.Binding.Container = AS.Object.extend ({delegate, include, def, defs}) ->
else else
@containerChildren.push child @containerChildren.push child
@domElement.appendChild(child) @domElement.appendChild(child)
# @::appendChild.doc =
# params: [
# []
# ]
# desc: """
#
# """


def empty: -> def empty: ->
jQuery(@containerChildren).remove() jQuery(@containerChildren).remove()
@containerChildren = [] @containerChildren = []
# @::empty.doc =
# params: [
# []
# ]
# desc: """
#
# """

0 comments on commit 271d37a

Please sign in to comment.