kuji-mercury-rails 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/app/views/mercury/modals/character.html +1 -1
  2. data/app/views/mercury/modals/htmleditor.html +1 -1
  3. data/app/views/mercury/modals/link.html +1 -1
  4. data/app/views/mercury/modals/media.html +1 -1
  5. data/app/views/mercury/modals/table.html +1 -1
  6. data/app/views/mercury/snippets/example/options.html.erb +1 -1
  7. data/config/engine.rb +1 -1
  8. data/features/loading/loading.feature +1 -1
  9. data/features/regions/editable/inserting_snippets.feature +7 -7
  10. data/spec/javascripts/mercury/page_editor_spec.js.coffee +9 -16
  11. data/spec/javascripts/mercury/panel_spec.js.coffee +4 -2
  12. data/spec/javascripts/mercury/regions/snippetable_spec.js.coffee +1 -1
  13. data/spec/javascripts/mercury/snippet_spec.js.coffee +2 -10
  14. data/spec/javascripts/mercury/uploader_spec.js.coffee +0 -16
  15. data/vendor/assets/javascripts/mercury.js +0 -4
  16. data/vendor/assets/javascripts/mercury/locales/da.locale.js.coffee +7 -7
  17. data/vendor/assets/javascripts/mercury/mercury.js.coffee +1 -1
  18. data/vendor/assets/javascripts/mercury/page_editor.js.coffee +4 -10
  19. data/vendor/assets/javascripts/mercury/panel.js.coffee +2 -2
  20. data/vendor/assets/javascripts/mercury/plugins/save_as_xml/mercury/page_editor.js.coffee +2 -2
  21. data/vendor/assets/javascripts/mercury/snippet.js.coffee +4 -13
  22. data/vendor/assets/javascripts/mercury/toolbar.button.js.coffee +2 -2
  23. data/vendor/assets/javascripts/mercury/uploader.js.coffee +17 -35
  24. data/vendor/assets/stylesheets/mercury/dialog.css +0 -4
  25. data/vendor/assets/stylesheets/mercury/mercury.css +115 -1
  26. metadata +40 -80
  27. data/POST_INSTALL +0 -15
  28. data/features/regions/image/uploading_images.feature +0 -0
  29. data/features/regions/simple/basic_editing.feature +0 -5
  30. data/spec/javascripts/mercury/regions/image_spec.js.coffee +0 -34
  31. data/spec/javascripts/mercury/regions/simple_spec.js.coffee +0 -33
  32. data/spec/javascripts/templates/mercury/regions/image.html +0 -1
  33. data/spec/javascripts/templates/mercury/regions/simple.html +0 -3
  34. data/vendor/assets/javascripts/mercury/locales/ar.locale.js.coffee +0 -207
  35. data/vendor/assets/javascripts/mercury/regions/image.js.coffee +0 -114
  36. data/vendor/assets/javascripts/mercury/regions/simple.js.coffee +0 -325
  37. data/vendor/assets/stylesheets/mercury/form.css +0 -118
@@ -1,4 +1,4 @@
1
- <form id="mercury_character" class="mercury-form" style="width:456px">
1
+ <form id="mercury_character" style="width:456px">
2
2
 
3
3
  <div class="mercury-display-pane-container">
4
4
  <div class="mercury-display-pane">
@@ -1,4 +1,4 @@
1
- <form id="mercury_html_editor" class="mercury-form" style="width:650px">
1
+ <form id="mercury_html_editor" style="width:650px">
2
2
 
3
3
  <textarea class="mercury-display-pane-container" rows="5" style="width:100%"></textarea>
4
4
 
@@ -1,4 +1,4 @@
1
- <form id="mercury_link" class="mercury-form" style="width:600px">
1
+ <form id="mercury_link" style="width:600px">
2
2
 
3
3
  <div class="mercury-display-pane-container">
4
4
  <div class="mercury-display-pane">
@@ -1,4 +1,4 @@
1
- <form id="mercury_media" class="mercury-form" style="width:600px">
1
+ <form id="mercury_media" style="width:600px">
2
2
 
3
3
  <div class="mercury-display-pane-container">
4
4
  <div class="mercury-display-pane">
@@ -1,4 +1,4 @@
1
- <form id="mercury_table" class="mercury-form" style="width:700px">
1
+ <form id="mercury_table" style="width:700px">
2
2
 
3
3
  <div class="mercury-display-pane-container">
4
4
  <div class="mercury-display-pane">
@@ -1,4 +1,4 @@
1
- <%= form_for 'options', { :html => { :class => 'mercury-form', :style => 'width:600px' } } do |f| %>
1
+ <%= form_for 'options', { :html => { :style => 'width:600px' } } do |f| %>
2
2
 
3
3
  <div class="mercury-display-pane-container">
4
4
  <div class="mercury-display-pane">
@@ -4,7 +4,7 @@ module Mercury
4
4
  class Engine < Rails::Engine
5
5
 
6
6
  # Additional application configuration to include precompiled assets.
7
- initializer :assets, :group => :all do |app|
7
+ initializer :assets do |app|
8
8
  app.config.assets.precompile += %w( mercury.js mercury.css mercury_overrides.css )
9
9
  end
10
10
 
@@ -19,4 +19,4 @@ Feature:
19
19
 
20
20
 
21
21
  Scenario: A user can expect to see the status bar
22
- Then I should see "Mercury Editor v0.3.1" within the statusbar
22
+ Then I should see "Mercury Editor v0.3.0" within the statusbar
@@ -25,7 +25,7 @@ Feature:
25
25
  And fill in "Favorite Beer" with "Stella"
26
26
  And press "Insert Snippet"
27
27
  Then the modal window should not be visible
28
- And the contents of the editable region should be "this is <div data-version='1' data-snippet='snippet_14' class='mercury-snippet example-snippet' contenteditable='false'><strong>Jeremy</strong> likes Stella</div><span>simple</span> <b>content</b>"
28
+ And the contents of the editable region should be "this is <div data-version='1' data-snippet='snippet_14' class='mercury-snippet' contenteditable='false'><strong>Jeremy</strong> likes Stella</div><span>simple</span> <b>content</b>"
29
29
 
30
30
 
31
31
  Scenario: A user can use the snippet toolbar to remove a snippet
@@ -52,7 +52,7 @@ Feature:
52
52
  When I fill in "First Name" with "Jeremy"
53
53
  And fill in "Favorite Beer" with "Stella"
54
54
  And press "Insert Snippet"
55
- Then the contents of the editable region should be "<div data-version='2' data-snippet='snippet_42' class='mercury-snippet example-snippet' contenteditable='false'><strong>Jeremy</strong> likes Stella</div> <b>content</b>"
55
+ Then the contents of the editable region should be "<div data-version='2' data-snippet='snippet_42' class='mercury-snippet' contenteditable='false'><strong>Jeremy</strong> likes Stella</div> <b>content</b>"
56
56
 
57
57
 
58
58
  Scenario: A user can make changes to a snippets options, and they'll be versioned for undo and redo
@@ -63,7 +63,7 @@ Feature:
63
63
  And I fill in "First Name" with "Jeremy"
64
64
  And fill in "Favorite Beer" with "Stella"
65
65
  And press "Insert Snippet"
66
- Then the contents of the editable region should be "<div data-version='2' data-snippet='snippet_42' class='mercury-snippet example-snippet' contenteditable='false'><strong>Jeremy</strong> likes Stella</div> <b>content</b>"
66
+ Then the contents of the editable region should be "<div data-version='2' data-snippet='snippet_42' class='mercury-snippet' contenteditable='false'><strong>Jeremy</strong> likes Stella</div> <b>content</b>"
67
67
 
68
68
  When I edit the snippet
69
69
  Then the "First Name" field should contain "Jeremy"
@@ -72,10 +72,10 @@ Feature:
72
72
  When fill in "First Name" with "Diesel"
73
73
  And fill in "Favorite Beer" with "Bells Hopslam"
74
74
  And press "Insert Snippet"
75
- Then the content of the editable region should be "<div data-version='3' data-snippet='snippet_42' class='mercury-snippet example-snippet' contenteditable='false'><strong>Diesel</strong> likes Bells Hopslam</div> <b>content</b>"
75
+ Then the content of the editable region should be "<div data-version='3' data-snippet='snippet_42' class='mercury-snippet' contenteditable='false'><strong>Diesel</strong> likes Bells Hopslam</div> <b>content</b>"
76
76
 
77
77
  When I click on the "Undo" button
78
- Then the contents of the editable region should be "<div data-version='2' data-snippet='snippet_42' class='mercury-snippet example-snippet' contenteditable='false'><strong>Jeremy</strong> likes Stella</div> <b>content</b>"
78
+ Then the contents of the editable region should be "<div data-version='2' data-snippet='snippet_42' class='mercury-snippet' contenteditable='false'><strong>Jeremy</strong> likes Stella</div> <b>content</b>"
79
79
 
80
80
  When I edit the snippet
81
81
  # todo: this is a bug
@@ -84,7 +84,7 @@ Feature:
84
84
 
85
85
  When I close the modal
86
86
  When I click on the "Redo" button
87
- Then the contents of the editable region should be "<div data-version='3' data-snippet='snippet_42' class='mercury-snippet example-snippet' contenteditable='false'><strong>Diesel</strong> likes Bells Hopslam</div> <b>content</b>"
87
+ Then the contents of the editable region should be "<div data-version='3' data-snippet='snippet_42' class='mercury-snippet' contenteditable='false'><strong>Diesel</strong> likes Bells Hopslam</div> <b>content</b>"
88
88
 
89
89
  When I edit the snippet
90
90
  Then the "First Name" field should contain "Diesel"
@@ -93,7 +93,7 @@ Feature:
93
93
  When I fill in "First Name" with "Jen"
94
94
  And fill in "Favorite Beer" with "Miller High Life"
95
95
  And press "Insert Snippet"
96
- Then the contents of the editable region should be "<div data-version='4' data-snippet='snippet_42' class='mercury-snippet example-snippet' contenteditable='false'><strong>Jen</strong> likes Miller High Life</div> <b>content</b>"
96
+ Then the contents of the editable region should be "<div data-version='4' data-snippet='snippet_42' class='mercury-snippet' contenteditable='false'><strong>Jen</strong> likes Miller High Life</div> <b>content</b>"
97
97
 
98
98
 
99
99
  # Scenario: When a user saves, the snippets should be gone from the html, but the options are serialized
@@ -36,9 +36,9 @@ describe "Mercury.PageEditor", ->
36
36
  expect(window.mercuryInstance).toEqual(@pageEditor)
37
37
 
38
38
  it "accepts a saveUrl, and options", ->
39
- @pageEditor = new Mercury.PageEditor('/foo/1', {foo: 'bar', saveDataType: 'text'})
39
+ @pageEditor = new Mercury.PageEditor('/foo/1', {foo: 'bar'})
40
40
  expect(@pageEditor.saveUrl).toEqual('/foo/1')
41
- expect(@pageEditor.options).toEqual({foo: 'bar', saveDataType: 'text', visible: true})
41
+ expect(@pageEditor.options).toEqual({foo: 'bar', visible: true})
42
42
 
43
43
  it "sets the visible option to true unless it's set", ->
44
44
  @pageEditor = new Mercury.PageEditor('/foo/1', {foo: 'bar', visible: false})
@@ -650,12 +650,12 @@ describe "Mercury.PageEditor", ->
650
650
  expect(@ajaxSpy.argsForCall[0][0]).toEqual('/foo/bar')
651
651
 
652
652
  @pageEditor.saveUrl = null
653
- Mercury.saveUrl = '/foo/bit'
653
+ Mercury.saveURL = '/foo/bit'
654
654
  @pageEditor.save()
655
655
  expect(@ajaxSpy.argsForCall[1][0]).toEqual('/foo/bit')
656
656
 
657
657
  @pageEditor.saveUrl = null
658
- Mercury.saveUrl = null
658
+ Mercury.saveURL = null
659
659
  @pageEditor.save()
660
660
  expect(@ajaxSpy.argsForCall[2][0]).toEqual('/foo/baz')
661
661
 
@@ -711,21 +711,14 @@ describe "Mercury.PageEditor", ->
711
711
  describe "on failed ajax request", ->
712
712
 
713
713
  beforeEach ->
714
- @ajaxSpy.andCallFake((url, options) => options.error({'response': 'object'}) )
714
+ @ajaxSpy.andCallFake((url, options) => options.error() )
715
715
 
716
- it "alerts and triggers save_failed with the url", ->
717
- alert_spy = spyOn(window, 'alert').andCallFake(=>)
718
- trigger_spy = spyOn(Mercury, 'trigger').andCallFake(=>)
719
-
716
+ it "alerts with the url", ->
717
+ spy = spyOn(window, 'alert').andCallFake(=>)
720
718
  @pageEditor.saveUrl = '/foo/bar'
721
719
  @pageEditor.save()
722
-
723
- expect(alert_spy.callCount).toEqual(1)
724
- expect(alert_spy.argsForCall[0]).toEqual(['Mercury was unable to save to the url: /foo/bar'])
725
-
726
- expect(trigger_spy.callCount).toEqual(1)
727
- expect(trigger_spy.argsForCall[0][0]).toEqual('save_failed')
728
- expect(trigger_spy.argsForCall[0][1]).toBeDefined()
720
+ expect(spy.callCount).toEqual(1)
721
+ expect(spy.argsForCall[0]).toEqual(['Mercury was unable to save to the url: /foo/bar'])
729
722
 
730
723
  describe "PUT", ->
731
724
 
@@ -22,7 +22,7 @@ describe "Mercury.Panel", ->
22
22
  html = $('<div>').html(@panel.element).html()
23
23
  expect(html).toContain('class="mercury-panel loading"')
24
24
  expect(html).toContain('style="display:none;"')
25
- expect(html).toContain('<h1><span>foo panel</span></h1><div class="mercury-panel-pane"></div>')
25
+ expect(html).toContain('<h1>foo panel</h1><div class="mercury-panel-pane"></div>')
26
26
  expect(html).not.toContain('class="mercury-panel-close"')
27
27
 
28
28
  it "appends to any element", ->
@@ -159,14 +159,16 @@ describe "Mercury.Panel", ->
159
159
  it "sets the element html to be the data passed to it", ->
160
160
  @panel.loadContent('<span>hello world!</span>')
161
161
  html = @panel.element.html()
162
+ expect(html).toContain('<h1>foo panel</h1>')
162
163
  expect(html).toContain('class="mercury-panel-pane"')
163
164
  expect(html).toContain('style="visibility: hidden;')
164
165
  expect(html).toContain('hello world!')
165
166
 
166
- it "sets the element html to be the data passed to it -- translated", ->
167
+ it "sets the element html to be the data passed to it", ->
167
168
  Mercury.config.localization.enabled = true
168
169
  @panel.loadContent('<span>hello world!</span>')
169
170
  html = @panel.element.html()
171
+ expect(html).toContain('<h1>foo panel</h1>')
170
172
  expect(html).toContain('class="mercury-panel-pane"')
171
173
  expect(html).toContain('style="visibility: hidden;')
172
174
  expect(html).toContain('bork! bork!')
@@ -312,7 +312,7 @@ describe "Mercury.Regions.Snippetable.actions", ->
312
312
 
313
313
  it "finds the snippet by it's identity and replaces it with the new snippet", ->
314
314
  @actions['insertSnippet'].call(@region, {value: Mercury.Snippet.find('snippet_1')})
315
- expect($('#snippetable_region2').html()).toContain('class="mercury-snippet example-snippet"')
315
+ expect($('#snippetable_region2').html()).toContain('class="mercury-snippet"')
316
316
  expect($('#snippetable_region2').html()).toContain('contenteditable="false"')
317
317
  expect($('#snippetable_region2').html()).toContain('data-version="1"')
318
318
  expect($('#snippetable_region2').html()).toContain('data-snippet="snippet_1"')
@@ -35,7 +35,7 @@ describe "Mercury.Snippet", ->
35
35
  it "builds an element (in whatever context is provided", ->
36
36
  ret = @snippet.getHTML($(document))
37
37
  html = $('<div>').html(ret).html()
38
- expect(html).toContain('class="mercury-snippet foo-snippet"')
38
+ expect(html).toContain('class="mercury-snippet"')
39
39
  expect(html).toContain('contenteditable="false"')
40
40
  expect(html).toContain('data-snippet="identity"')
41
41
  expect(html).toContain('data-version="1"')
@@ -218,15 +218,7 @@ describe "Mercury.Snippet class methods", ->
218
218
  it "pushes into the collection array", ->
219
219
  Mercury.Snippet.create('foo', {foo: 'bar'})
220
220
  expect(Mercury.Snippet.all.length).toEqual(1)
221
-
222
- describe "when an snuppet exist with an identical identity", ->
223
- it "generates a unique identity", ->
224
- Mercury.Snippet.load
225
- snippet_1: {name: 'foo', options: {foo: 'bar'}}
226
- snippet_2: {name: 'bar', options: {baz: 'pizza'}}
227
-
228
- ret = Mercury.Snippet.create('noobie', {noobie: 'one'})
229
- expect(ret.identity).toEqual('snippet_0')
221
+
230
222
 
231
223
  describe ".find", ->
232
224
 
@@ -4,8 +4,6 @@ describe "Mercury.uploader", ->
4
4
 
5
5
  beforeEach ->
6
6
  Mercury.config.uploading.enabled = true
7
- @fileReaderSupport = spyOn(Mercury.uploader, 'fileReaderSupported')
8
- @fileReaderSupport.andCallFake(=> true)
9
7
  $.fx.off = true
10
8
  @mockFile = {
11
9
  size: 1024
@@ -222,7 +220,6 @@ describe "Mercury.uploader", ->
222
220
  Mercury.uploader.file = new Mercury.uploader.File(@mockFile)
223
221
  Mercury.uploader.build()
224
222
  spyOn(FileReader.prototype, 'readAsBinaryString').andCallFake(=>)
225
- @fileReaderSupport.andCallFake(=> true)
226
223
  @readAsDataURLSpy = spyOn(Mercury.uploader.File.prototype, 'readAsDataURL').andCallFake((callback) => callback('data-url'))
227
224
 
228
225
  it "calls file.readAsDataURL", ->
@@ -238,19 +235,6 @@ describe "Mercury.uploader", ->
238
235
  Mercury.uploader.loadImage()
239
236
  expect(spy.callCount).toEqual(1)
240
237
 
241
- describe "#loadImage without FileReader", ->
242
-
243
- beforeEach ->
244
- Mercury.uploader.options = {appendTo: '#test'}
245
- Mercury.uploader.file = new Mercury.uploader.File(@mockFile)
246
- Mercury.uploader.build()
247
- @fileReaderSupport.andCallFake(=> false)
248
-
249
- it "calls upload", ->
250
- spy = spyOn(Mercury.uploader, 'upload').andCallFake(=>)
251
- Mercury.uploader.loadImage()
252
- expect(spy.callCount).toEqual(1)
253
-
254
238
 
255
239
  describe "#upload", ->
256
240
 
@@ -230,9 +230,6 @@ window.Mercury = {
230
230
  // By default this is the id attribute but can be changed to a data attribute should you want to use something
231
231
  // custom instead.
232
232
  //
233
- // determineType: This function is called after checking the data-type attribute for the correct field type. Use
234
- // it if you want to programatically set the type based on inspection of the region.
235
- //
236
233
  // dataAttributes: The dataAttributes is an array of data attributes that will be serialized and returned to the
237
234
  // server upon saving. These attributes, when applied to a Mercury region element, will be automatically serialized
238
235
  // and submitted with the AJAX request sent when a page is saved. These are expected to be HTML5 data attributes,
@@ -240,7 +237,6 @@ window.Mercury = {
240
237
  regions: {
241
238
  className: 'mercury-region',
242
239
  identifier: 'id',
243
- // determineType: function(region){},
244
240
  dataAttributes: []
245
241
  },
246
242
 
@@ -68,10 +68,10 @@ Mercury.I18n['da'] =
68
68
 
69
69
  # ### General
70
70
  # Error Messages
71
- "Mercury.Regions.%s is unsupported in this client. Supported browsers are %s.": "Mercury.Regions.%s er ikke understøttet i denne browser. Understøttede browsere er %s."
71
+ "Mercury.Regions.%s is unsupported in this client. Supported browsers are %s.": "Mercury.Regions.%s er ustøttet i denne klient. Støttede browsere er %s."
72
72
  "Mercury.PageEditor can only be instantiated once.": "Mercury.PageEditor kan kun blive instantieret én gang."
73
- "Opera isn't a fully supported browser, your results may not be optimal.": "Opera er ikke en fuldt ud understøttet. Dine resultater kan derfor være uoptimale."
74
- "Mercury.PageEditor failed to load: %s\n\nPlease try refreshing.": "Mercury.PageEditor kunne ikke starte: %s\n\n Prøv venligst at opdatere siden."
73
+ "Opera isn't a fully supported browser, your results may not be optimal.": "Opera er ikke en fuldt ud støttet browser. Dine resultater kan derfor være uoptimale."
74
+ "Mercury.PageEditor failed to load: %s\n\nPlease try refreshing.": "Mercury.PageEditor fejlede med at indlæse: %s\n\n Prøv venligst at opdatere siden."
75
75
  "Region type is malformed, no data-type provided, or \"%s\" is unknown for the \"%s\" region.": "Regionstype er forkert formateret. Enten blev ingen datatype angivet, ellers er \"%s\" ukendt for \"%s\"regionen."
76
76
  "Mercury was unable to save to the url: %s": "Mercury var ikke i stand til at gemme til addressen: %s"
77
77
  # Confirmations
@@ -100,12 +100,12 @@ Mercury.I18n['da'] =
100
100
  "Error: Unable to upload the file": "Fejl: Kunne ikke uploade filen"
101
101
  "Malformed response from server": "Deform svar fra server"
102
102
  "Too large": "For stor"
103
- "Unsupported format": "Formatet er ikke understøttet"
103
+ "Unsupported format": "Formatet er ikke støttet"
104
104
  # Statuses
105
105
  "Processing...": "Forarbejder..."
106
106
  "Uploading...": "Uploader..."
107
107
  "Aborted": "Afbrudt"
108
- "Successfully uploaded...": "Upload færdig..."
108
+ "Successfully uploaded...": "Uploadningen lykkedes..."
109
109
  "Name: %s": "Navn: %s"
110
110
  "Size: %s": "Størrelse: %s"
111
111
  "Type: %s": "Type: %s"
@@ -129,7 +129,7 @@ Mercury.I18n['da'] =
129
129
  "Existing Links": "Eksisterende links"
130
130
  "Bookmark": "Bogmærke"
131
131
  "Options": "Indstillinger"
132
- "Link Target": "Link Target"
132
+ "Link Target": "Link mål"
133
133
  "Self (the same window or tab)": "Self (det samme vindue eller fane)"
134
134
  "Blank (a new window or tab)": "Blank (et nyt vindue eller fane)"
135
135
  "Top (removes any frames)": "Top (fjerner eventuelle rammer)"
@@ -141,7 +141,7 @@ Mercury.I18n['da'] =
141
141
  # Insert Media Modal (media.html)
142
142
  "Images": "Billeder"
143
143
  "Videos": "Videoer"
144
- "YouTube Share URL": "YouTube del-URL"
144
+ "YouTube Share URL": "YouTube delnings-URL"
145
145
  "Vimeo URL": "Vimeo-URL"
146
146
  "Alignment": "Justering"
147
147
  "None": "Ingen"
@@ -34,7 +34,7 @@
34
34
  #
35
35
  @Mercury ||= {}
36
36
  jQuery.extend @Mercury,
37
- version: '0.3.1'
37
+ version: '0.3.0'
38
38
 
39
39
  # Mercury object namespaces
40
40
  Regions: Mercury.Regions || {}
@@ -9,7 +9,6 @@ class @Mercury.PageEditor
9
9
  throw Mercury.I18n('Mercury.PageEditor can only be instantiated once.') if window.mercuryInstance
10
10
 
11
11
  @options.visible = true unless (@options.visible == false || @options.visible == 'no')
12
- @options.saveDataType = 'json' unless (@options.saveDataType == false || @options.saveDataType)
13
12
  @visible = @options.visible
14
13
 
15
14
  window.mercuryInstance = @
@@ -76,11 +75,7 @@ class @Mercury.PageEditor
76
75
  if region.data('region')
77
76
  region = region.data('region')
78
77
  else
79
- type = (
80
- region.data('type') ||
81
- ( jQuery.type(Mercury.config.regions.determineType) == 'function' && Mercury.config.regions.determineType(region) ) ||
82
- 'unknown'
83
- ).titleize()
78
+ type = (region.data('type') || 'unknown').titleize()
84
79
  throw Mercury.I18n('Region type is malformed, no data-type provided, or "%s" is unknown for the "%s" region.', type, region.attr('id') || 'unknown') if type == 'Unknown' || !Mercury.Regions[type]
85
80
  if !Mercury.Regions[type].supported
86
81
  Mercury.notify('Mercury.Regions.%s is unsupported in this client. Supported browsers are %s.', type, Mercury.Regions[type].supportedText)
@@ -199,7 +194,7 @@ class @Mercury.PageEditor
199
194
 
200
195
 
201
196
  save: (callback) ->
202
- url = @saveUrl ? Mercury.saveUrl ? @iframeSrc()
197
+ url = @saveUrl ? Mercury.saveURL ? @iframeSrc()
203
198
  data = @serialize()
204
199
  Mercury.log('saving', data)
205
200
  data = jQuery.toJSON(data) unless @options.saveStyle == 'form'
@@ -207,14 +202,13 @@ class @Mercury.PageEditor
207
202
  jQuery.ajax url, {
208
203
  headers: Mercury.ajaxHeaders()
209
204
  type: method || 'POST'
210
- dataType: @options.saveDataType,
205
+ dataType: @options.saveDataType || 'json'
211
206
  data: {content: data, _method: method}
212
207
  success: =>
213
208
  Mercury.changes = false
214
209
  Mercury.trigger('saved')
215
210
  callback() if typeof(callback) == 'function'
216
- error: (response) =>
217
- Mercury.trigger('save_failed', response)
211
+ error: =>
218
212
  Mercury.notify('Mercury was unable to save to the url: %s', url)
219
213
  }
220
214
 
@@ -6,7 +6,7 @@ class @Mercury.Panel extends Mercury.Dialog
6
6
 
7
7
  build: ->
8
8
  @element = jQuery('<div>', {class: 'mercury-panel loading', style: 'display:none;'})
9
- @titleElement = jQuery("<h1><span>#{Mercury.I18n(@options.title)}</span></h1>").appendTo(@element)
9
+ @titleElement = jQuery("<h1>#{Mercury.I18n(@options.title)}</h1>").appendTo(@element)
10
10
  @paneElement = jQuery('<div>', {class: 'mercury-panel-pane'}).appendTo(@element)
11
11
 
12
12
  if @options.closeButton
@@ -100,7 +100,7 @@ class @Mercury.Panel extends Mercury.Dialog
100
100
  makeDraggable: ->
101
101
  elementWidth = @element.width()
102
102
  @element.draggable {
103
- handle: 'h1 span',
103
+ handle: 'h1',
104
104
  axis: 'x',
105
105
  opacity: 0.70
106
106
  scroll: false,
@@ -1,7 +1,7 @@
1
1
  class Mercury.PageEditor extends Mercury.PageEditor
2
2
 
3
3
  save: ->
4
- url = @saveUrl ? Mercury.saveUrl ? @iframeSrc()
4
+ url = @saveUrl ? Mercury.saveURL ? @iframeSrc()
5
5
  data = @serializeAsXml()
6
6
  console.log('saving', data)
7
7
  return
@@ -25,4 +25,4 @@ class Mercury.PageEditor extends Mercury.PageEditor
25
25
  for snippetName, snippetProperties of regionProperties['snippets']
26
26
  snippetNodes.push("<#{snippetName} name=\"#{snippetProperties['name']}\"><![CDATA[#{jQuery.toJSON(snippetProperties['options'])}]]></#{snippetName}>")
27
27
  regionNodes.push("<region name=\"#{regionName}\" type=\"#{regionProperties['type']}\"><value>\n<![CDATA[#{regionProperties['value']}]]>\n</value><snippets>#{snippetNodes.join('')}</snippets></region>")
28
- return "<regions>#{regionNodes.join('')}</regions>"
28
+ return "<regions>#{regionNodes.join('')}</regions>"
@@ -12,13 +12,7 @@ class @Mercury.Snippet
12
12
 
13
13
 
14
14
  @create: (name, options) ->
15
- if @all.length > 0
16
- identity = "snippet_0"
17
- for snippet, i in @all
18
- identity = "snippet_#{i+1}" if snippet.identity == identity
19
- else
20
- identity = "snippet_#{@all.length}"
21
-
15
+ identity = "snippet_#{@all.length}"
22
16
  instance = new Mercury.Snippet(name, identity, options)
23
17
  @all.push(instance)
24
18
  return instance
@@ -44,12 +38,9 @@ class @Mercury.Snippet
44
38
 
45
39
 
46
40
  getHTML: (context, callback = null) ->
47
- element = jQuery('<div>', {
48
- class: "mercury-snippet #{@name}-snippet"
49
- contenteditable: "false"
50
- 'data-snippet': @identity
51
- 'data-version': @version
52
- }, context)
41
+ element = jQuery('<div class="mercury-snippet" contenteditable="false">', context)
42
+ element.attr({'data-snippet': @identity})
43
+ element.attr({'data-version': @version})
53
44
  element.html("[#{@identity}]")
54
45
  @loadPreview(element, callback)
55
46
  return element