back to the original editable_short_text (#349)
This commit is contained in:
parent
21469ce367
commit
1ae9557515
@ -16,7 +16,7 @@ class Locomotive.Models.Page extends Backbone.Model
|
|||||||
|
|
||||||
toJSON: ->
|
toJSON: ->
|
||||||
_.tap super, (hash) =>
|
_.tap super, (hash) =>
|
||||||
_.each ['content_type_id_text', 'edit_url', 'parent_id_text', 'response_type_text'], (key) => delete hash[key]
|
_.each ['fullpath', 'localized_fullpaths', 'templatized_from_parent', 'target_klass_name_text', 'content_type_id_text', 'edit_url', 'parent_id_text', 'response_type_text'], (key) => delete hash[key]
|
||||||
|
|
||||||
delete hash['editable_elements']
|
delete hash['editable_elements']
|
||||||
hash.editable_elements = @get('editable_elements').toJSONForSave() if @get('editable_elements')? && @get('editable_elements').length > 0
|
hash.editable_elements = @get('editable_elements').toJSONForSave() if @get('editable_elements')? && @get('editable_elements').length > 0
|
||||||
|
@ -2,7 +2,35 @@
|
|||||||
|
|
||||||
Locomotive.Views.EditableElements ||= {}
|
Locomotive.Views.EditableElements ||= {}
|
||||||
|
|
||||||
class Locomotive.Views.EditableElements.LongTextView extends Locomotive.Views.EditableElements.ShortTextView
|
class Locomotive.Views.EditableElements.LongTextView extends Backbone.View
|
||||||
|
|
||||||
|
tagName: 'li'
|
||||||
|
|
||||||
|
className: 'text input html'
|
||||||
|
|
||||||
|
render: ->
|
||||||
|
$(@el).html(ich.editable_text_input(@model.toJSON()))
|
||||||
|
|
||||||
|
return @
|
||||||
|
|
||||||
|
after_render: ->
|
||||||
|
settings = _.extend {}, @tinymce_settings(),
|
||||||
|
oninit: ((editor) =>
|
||||||
|
$.cmd 'S', (() =>
|
||||||
|
@model.set(content: editor.getBody().innerHTML)
|
||||||
|
$(@el).parents('form').trigger('submit')
|
||||||
|
), [], ignoreCase: true, document: editor.dom.doc),
|
||||||
|
onchange_callback: (editor) =>
|
||||||
|
@model.set(content: editor.getBody().innerHTML)
|
||||||
|
|
||||||
|
@$('textarea').tinymce(settings)
|
||||||
|
|
||||||
tinymce_settings: ->
|
tinymce_settings: ->
|
||||||
window.Locomotive.tinyMCE.defaultSettings
|
window.Locomotive.tinyMCE.defaultSettings
|
||||||
|
|
||||||
|
refresh: ->
|
||||||
|
# do nothing
|
||||||
|
|
||||||
|
remove: ->
|
||||||
|
@$('textarea').tinymce().destroy()
|
||||||
|
super
|
||||||
|
@ -4,31 +4,19 @@ class Locomotive.Views.EditableElements.ShortTextView extends Backbone.View
|
|||||||
|
|
||||||
tagName: 'li'
|
tagName: 'li'
|
||||||
|
|
||||||
className: 'text input html'
|
className: 'text input short'
|
||||||
|
|
||||||
render: ->
|
render: ->
|
||||||
$(@el).html(ich.editable_text_input(@model.toJSON()))
|
$(@el).html(ich.editable_text_input(@model.toJSON()))
|
||||||
|
|
||||||
|
@$('textarea').bind 'keyup', (event) =>
|
||||||
|
input = $(event.target)
|
||||||
|
@model.set(content: input.val())
|
||||||
|
|
||||||
return @
|
return @
|
||||||
|
|
||||||
after_render: ->
|
after_render: ->
|
||||||
settings = _.extend {}, @tinymce_settings(),
|
|
||||||
oninit: ((editor) =>
|
|
||||||
$.cmd 'S', (() =>
|
|
||||||
@model.set(content: editor.getBody().innerHTML)
|
|
||||||
$(@el).parents('form').trigger('submit')
|
|
||||||
), [], ignoreCase: true, document: editor.dom.doc),
|
|
||||||
onchange_callback: (editor) =>
|
|
||||||
@model.set(content: editor.getBody().innerHTML)
|
|
||||||
|
|
||||||
@$('textarea').tinymce(settings)
|
|
||||||
|
|
||||||
tinymce_settings: ->
|
|
||||||
window.Locomotive.tinyMCE.minimalSettings
|
|
||||||
|
|
||||||
refresh: ->
|
|
||||||
# do nothing
|
# do nothing
|
||||||
|
|
||||||
remove: ->
|
refresh: ->
|
||||||
@$('textarea').tinymce().destroy()
|
# do nothing
|
||||||
super
|
|
@ -295,6 +295,17 @@ form.formtastic {
|
|||||||
}
|
}
|
||||||
} // li.string, li.password
|
} // li.string, li.password
|
||||||
|
|
||||||
|
&.text {
|
||||||
|
|
||||||
|
&.short textarea {
|
||||||
|
padding: 5px;
|
||||||
|
height: 28px;
|
||||||
|
width: 696px;
|
||||||
|
overflow-y: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // li.text
|
||||||
|
|
||||||
&.locale, &.locales {
|
&.locale, &.locales {
|
||||||
.list {
|
.list {
|
||||||
margin-left: 150px;
|
margin-left: 150px;
|
||||||
|
Loading…
Reference in New Issue
Block a user