Permalink
Browse files

resolved saveURL to saveUrl everywhere (including docs), and fixed an…

… bug with the saveDataType addition.
  • Loading branch information...
jejacks0n committed Mar 12, 2012
1 parent dbd08e4 commit 0853286387494f88cda3f1788756eb39ec7c43b2
View
@@ -259,12 +259,12 @@ default it will use JSON, that JSON looks like:
}
Where it gets saved to is also up to you.. by default it submits a post to the current url, but you can adjust this by
-setting Mercury.saveURL, or passing it into the Mercury.PageEditor constructor.. how you do this is dependent on how
-you're using loading mercury (via the loader, or by using the route method). In both situations setting Mercury.saveURL
+setting Mercury.saveUrl, or passing it into the Mercury.PageEditor constructor.. how you do this is dependent on how
+you're using loading mercury (via the loader, or by using the route method). In both situations setting Mercury.saveUrl
is the most consistent.
jQuery(window).on('mercury:ready', function() {
- Mercury.saveURL = '/contents';
+ Mercury.saveUrl = '/contents';
});
Assuming you have a ContentsController and a RESTful route, this will make it through to the create action. Where you
@@ -36,9 +36,9 @@ describe "Mercury.PageEditor", ->
expect(window.mercuryInstance).toEqual(@pageEditor)
it "accepts a saveUrl, and options", ->
- @pageEditor = new Mercury.PageEditor('/foo/1', {foo: 'bar'})
+ @pageEditor = new Mercury.PageEditor('/foo/1', {foo: 'bar', saveDataType: 'text'})
expect(@pageEditor.saveUrl).toEqual('/foo/1')
- expect(@pageEditor.options).toEqual({foo: 'bar', visible: true})
+ expect(@pageEditor.options).toEqual({foo: 'bar', saveDataType: 'text', visible: true})
it "sets the visible option to true unless it's set", ->
@pageEditor = new Mercury.PageEditor('/foo/1', {foo: 'bar', visible: false})
@@ -650,12 +650,12 @@ describe "Mercury.PageEditor", ->
expect(@ajaxSpy.argsForCall[0][0]).toEqual('/foo/bar')
@pageEditor.saveUrl = null
- Mercury.saveURL = '/foo/bit'
+ Mercury.saveUrl = '/foo/bit'
@pageEditor.save()
expect(@ajaxSpy.argsForCall[1][0]).toEqual('/foo/bit')
@pageEditor.saveUrl = null
- Mercury.saveURL = null
+ Mercury.saveUrl = null
@pageEditor.save()
expect(@ajaxSpy.argsForCall[2][0]).toEqual('/foo/baz')
@@ -9,7 +9,7 @@ class @Mercury.PageEditor
throw Mercury.I18n('Mercury.PageEditor can only be instantiated once.') if window.mercuryInstance
@options.visible = true unless (@options.visible == false || @options.visible == 'no')
- @option.saveDataType = 'json' unless (@options.saveDataType == false || @options.saveDataType)
+ @options.saveDataType = 'json' unless (@options.saveDataType == false || @options.saveDataType)
@visible = @options.visible
window.mercuryInstance = @
@@ -199,7 +199,7 @@ class @Mercury.PageEditor
save: (callback) ->
- url = @saveUrl ? Mercury.saveURL ? @iframeSrc()
+ url = @saveUrl ? Mercury.saveUrl ? @iframeSrc()
data = @serialize()
Mercury.log('saving', data)
data = jQuery.toJSON(data) unless @options.saveStyle == 'form'
@@ -1,7 +1,7 @@
class Mercury.PageEditor extends Mercury.PageEditor
save: ->
- url = @saveUrl ? Mercury.saveURL ? @iframeSrc()
+ url = @saveUrl ? Mercury.saveUrl ? @iframeSrc()
data = @serializeAsXml()
console.log('saving', data)
return
@@ -25,4 +25,4 @@ class Mercury.PageEditor extends Mercury.PageEditor
for snippetName, snippetProperties of regionProperties['snippets']
snippetNodes.push("<#{snippetName} name=\"#{snippetProperties['name']}\"><![CDATA[#{jQuery.toJSON(snippetProperties['options'])}]]></#{snippetName}>")
regionNodes.push("<region name=\"#{regionName}\" type=\"#{regionProperties['type']}\"><value>\n<![CDATA[#{regionProperties['value']}]]>\n</value><snippets>#{snippetNodes.join('')}</snippets></region>")
- return "<regions>#{regionNodes.join('')}</regions>"
+ return "<regions>#{regionNodes.join('')}</regions>"

0 comments on commit 0853286

Please sign in to comment.