Skip to content

Instantly share code, notes, and snippets.

@hakunin
Created November 29, 2012 11:32
Show Gist options
  • Select an option

  • Save hakunin/4168386 to your computer and use it in GitHub Desktop.

Select an option

Save hakunin/4168386 to your computer and use it in GitHub Desktop.
inline editor example using commonview
class PublicProfile
template: ->
"""
<div el="slogan_wrap_el"></div>
"""
bind: ->
@slogan_editor = new InlineEditor(
parent: @slogan_wrap_el
static_if: (subject) ->
subejct.id != window.user.id
...
update: ->
@slogan_editor.setUser(@user)
@slogan_editor.static(@user.is != window.user.id)
class ShortTextInlineEditor extend CommonView
cunstructor: (parent, option)
super(parent)
@options = options
template: ->
"""
<input el="inline_value"...>
"""
setSubject: (subject) ->
@subject = subject
@inline_value.val(@subject[option.attribute])
#....
if predicate = @options.static_if
@static(predicate(@subject) == true)
static: (go_static) ->
# ....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment