This commit is contained in:
did 2011-11-25 13:38:31 +01:00
parent fcd2146c11
commit cb735a0539
7 changed files with 6 additions and 69 deletions

View File

@ -11,25 +11,6 @@ class Locomotive.Models.Page extends Backbone.Model
@set
editable_elements: new Locomotive.Models.EditableElementsCollection(@get('editable_elements'))
# unless _.isArray @get('editable_elements')
# console.log('already a collection')
# return
#
# previous_collection = @previous('editable_elements')
#
# console.log(previous_collection)
#
# if _.isArray collection
# collection = new Locomotive.Models.EditableElementsCollection(@get('editable_elements'))
# else
# collection.fetch(@get('editable_elements'))
#
# @set(editable_elements: collection)
# @set
# editable_elements: new Locomotive.Models.EditableElementsCollection(@get('editable_elements'))
toJSON: ->
_.tap super, (hash) =>
hash.editable_elements = @get('editable_elements').toJSONForSave() if @get('editable_elements')

View File

@ -14,15 +14,8 @@ class Locomotive.Views.EditableElements.ShortTextView extends Backbone.View
after_render: ->
settings = _.extend {}, @tinymce_settings(),
onchange_callback: (editor) =>
console.log('content changed !!!! (' + @model.cid + '), ' + editor.getBody().innerHTML)
console.log(@model)
@model.set(content: editor.getBody().innerHTML)
console.log('here ?')
window.a = @$('textarea')
window.b = settings
@$('textarea').tinymce(settings)
tinymce_settings: ->

View File

@ -88,7 +88,6 @@ class Locomotive.Views.Pages.FormView extends Locomotive.Views.Shared.FormView
reset_editable_elements: ->
console.log('reset_editable_elements')
@editable_elements_view.remove()
# @editable_elements_view = new Locomotive.Views.EditableElements.EditAllView(collection: @model.get('editable_elements'))
@editable_elements_view.collection = @model.get('editable_elements')
@render_editable_elements()

View File

@ -11,7 +11,6 @@ class Locomotive.Views.Pages.EditView extends Locomotive.Views.Pages.FormView
@model.save {},
success: (model, response, xhr) =>
console.log('success')
model._normalize()
$.growl('success', xhr.getResponseHeader('X-Message'))
@ -22,13 +21,6 @@ class Locomotive.Views.Pages.EditView extends Locomotive.Views.Pages.FormView
@refresh_editable_elements()
error: (model, xhr) =>
console.log('error')
# window.model = model
window.model = model
window.xhr = xhr
# probably restore the previous attributes
errors = JSON.parse(xhr.responseText)
@show_errors errors

View File

@ -3,31 +3,4 @@ Locomotive.Views.Pages ||= {}
class Locomotive.Views.Pages.NewView extends Locomotive.Views.Pages.FormView
save: (event) ->
event.stopPropagation() & event.preventDefault()
@clear_errors()
console.log('saving')
@model.save {},
success: (model, response, xhr) =>
console.log('success')
model._normalize()
$.growl('success', xhr.getResponseHeader('X-Message'))
if model.get('template_changed') == true
@reset_editable_elements()
else
@refresh_editable_elements()
error: (model, xhr) =>
console.log('error')
window.xhr = xhr
errors = JSON.parse(xhr.responseText)
@show_errors errors
$.growl('error', xhr.getResponseHeader('X-Message'))
# TODO

View File

@ -10,10 +10,10 @@ module Locomotive::BaseHelper
end
def inputs_folded?(resource)
resource.persisted? || !resource.errors.empty?
resource.persisted? && resource.errors.empty?
end
def submenu_entry(name, url, options = {}, &block) # TODO: rename method name (remove admin)
def submenu_entry(name, url, options = {}, &block)
default_options = { :i18n => true, :css => name.dasherize.downcase }
default_options.merge!(options)

View File

@ -12,16 +12,15 @@ x editable_short_text => tinymce
x backbone / handlebar
- new formtastic inputs
x menu / submenu in full css3 (no images)
- create/edit page in ajax
x edit
- create
x fix css in firefox
x update page in ajax
- fix other sections
- content types
- edit my account
- create a new site
- edit my site
- theme assets
- fix css in firefox
BACKLOG: