Merge remote-tracking branch 'origin/rails_3_1' into rails_3_1
This commit is contained in:
commit
915a28dc0a
|
@ -11,25 +11,6 @@ class Locomotive.Models.Page extends Backbone.Model
|
||||||
@set
|
@set
|
||||||
editable_elements: new Locomotive.Models.EditableElementsCollection(@get('editable_elements'))
|
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: ->
|
toJSON: ->
|
||||||
_.tap super, (hash) =>
|
_.tap super, (hash) =>
|
||||||
hash.editable_elements = @get('editable_elements').toJSONForSave() if @get('editable_elements')
|
hash.editable_elements = @get('editable_elements').toJSONForSave() if @get('editable_elements')
|
||||||
|
|
|
@ -14,15 +14,8 @@ class Locomotive.Views.EditableElements.ShortTextView extends Backbone.View
|
||||||
after_render: ->
|
after_render: ->
|
||||||
settings = _.extend {}, @tinymce_settings(),
|
settings = _.extend {}, @tinymce_settings(),
|
||||||
onchange_callback: (editor) =>
|
onchange_callback: (editor) =>
|
||||||
console.log('content changed !!!! (' + @model.cid + '), ' + editor.getBody().innerHTML)
|
|
||||||
console.log(@model)
|
|
||||||
@model.set(content: editor.getBody().innerHTML)
|
@model.set(content: editor.getBody().innerHTML)
|
||||||
|
|
||||||
console.log('here ?')
|
|
||||||
|
|
||||||
window.a = @$('textarea')
|
|
||||||
window.b = settings
|
|
||||||
|
|
||||||
@$('textarea').tinymce(settings)
|
@$('textarea').tinymce(settings)
|
||||||
|
|
||||||
tinymce_settings: ->
|
tinymce_settings: ->
|
||||||
|
|
|
@ -88,7 +88,6 @@ class Locomotive.Views.Pages.FormView extends Locomotive.Views.Shared.FormView
|
||||||
reset_editable_elements: ->
|
reset_editable_elements: ->
|
||||||
console.log('reset_editable_elements')
|
console.log('reset_editable_elements')
|
||||||
@editable_elements_view.remove()
|
@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')
|
@editable_elements_view.collection = @model.get('editable_elements')
|
||||||
@render_editable_elements()
|
@render_editable_elements()
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ class Locomotive.Views.Pages.EditView extends Locomotive.Views.Pages.FormView
|
||||||
|
|
||||||
@model.save {},
|
@model.save {},
|
||||||
success: (model, response, xhr) =>
|
success: (model, response, xhr) =>
|
||||||
console.log('success')
|
|
||||||
model._normalize()
|
model._normalize()
|
||||||
|
|
||||||
$.growl('success', xhr.getResponseHeader('X-Message'))
|
$.growl('success', xhr.getResponseHeader('X-Message'))
|
||||||
|
@ -22,13 +21,6 @@ class Locomotive.Views.Pages.EditView extends Locomotive.Views.Pages.FormView
|
||||||
@refresh_editable_elements()
|
@refresh_editable_elements()
|
||||||
|
|
||||||
error: (model, xhr) =>
|
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)
|
errors = JSON.parse(xhr.responseText)
|
||||||
|
|
||||||
@show_errors errors
|
@show_errors errors
|
||||||
|
|
|
@ -3,31 +3,4 @@ Locomotive.Views.Pages ||= {}
|
||||||
class Locomotive.Views.Pages.NewView extends Locomotive.Views.Pages.FormView
|
class Locomotive.Views.Pages.NewView extends Locomotive.Views.Pages.FormView
|
||||||
|
|
||||||
save: (event) ->
|
save: (event) ->
|
||||||
event.stopPropagation() & event.preventDefault()
|
# TODO
|
||||||
|
|
||||||
@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'))
|
|
|
@ -10,10 +10,10 @@ module Locomotive::BaseHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def inputs_folded?(resource)
|
def inputs_folded?(resource)
|
||||||
resource.persisted? || !resource.errors.empty?
|
resource.persisted? && resource.errors.empty?
|
||||||
end
|
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 = { :i18n => true, :css => name.dasherize.downcase }
|
||||||
default_options.merge!(options)
|
default_options.merge!(options)
|
||||||
|
|
||||||
|
|
7
doc/TODO
7
doc/TODO
|
@ -12,16 +12,15 @@ x editable_short_text => tinymce
|
||||||
x backbone / handlebar
|
x backbone / handlebar
|
||||||
- new formtastic inputs
|
- new formtastic inputs
|
||||||
x menu / submenu in full css3 (no images)
|
x menu / submenu in full css3 (no images)
|
||||||
- create/edit page in ajax
|
x fix css in firefox
|
||||||
x edit
|
x update page in ajax
|
||||||
- create
|
|
||||||
- fix other sections
|
- fix other sections
|
||||||
- content types
|
- content types
|
||||||
- edit my account
|
- edit my account
|
||||||
- create a new site
|
- create a new site
|
||||||
- edit my site
|
- edit my site
|
||||||
- theme assets
|
- theme assets
|
||||||
- fix css in firefox
|
|
||||||
|
|
||||||
|
|
||||||
BACKLOG:
|
BACKLOG:
|
||||||
|
|
Loading…
Reference in New Issue