mercury-rails 0.2.3 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. data/app/controllers/{images_controller.rb → mercury/images_controller.rb} +3 -3
  2. data/app/controllers/mercury_controller.rb +13 -3
  3. data/app/models/{image.rb → mercury/image.rb} +3 -1
  4. data/app/views/layouts/mercury.html.erb +14 -6
  5. data/app/views/mercury/lightviews/about.html +7 -3
  6. data/app/views/mercury/modals/character.html +2 -2
  7. data/app/views/mercury/modals/htmleditor.html +2 -2
  8. data/app/views/mercury/modals/link.html +3 -3
  9. data/app/views/mercury/modals/media.html +3 -3
  10. data/app/views/mercury/modals/table.html +3 -3
  11. data/app/views/mercury/panels/snippets.html +1 -1
  12. data/app/views/mercury/selects/formatblock.html +9 -9
  13. data/app/views/mercury/snippets/example/options.html.erb +27 -16
  14. data/config/engine.rb +35 -0
  15. data/db/migrate/{20110526035601_create_images.rb → 20110526035601_create_mercury_images.rb} +2 -2
  16. data/features/loading/loading.feature +1 -1
  17. data/features/loading/navigating.feature +1 -1
  18. data/features/loading/user_interface.feature +2 -2
  19. data/features/regions/editable/basic_editing.feature +8 -8
  20. data/features/regions/editable/inserting_snippets.feature +4 -5
  21. data/features/regions/editable/inserting_tables.feature +9 -9
  22. data/features/step_definitions/mercury_steps.rb +20 -23
  23. data/features/step_definitions/web_steps.rb +5 -5
  24. data/features/support/mercury_selectors.rb +1 -0
  25. data/lib/generators/mercury/install/install_generator.rb +24 -3
  26. data/lib/generators/mercury/install/templates/mongoid_paperclip_image.rb +17 -0
  27. data/lib/mercury-rails.rb +0 -1
  28. data/lib/mercury/authentication.rb +8 -0
  29. data/spec/javascripts/mercury/dialog_spec.js.coffee +28 -21
  30. data/spec/javascripts/mercury/dialogs/backcolor_spec.js.coffee +0 -2
  31. data/spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee +0 -2
  32. data/spec/javascripts/mercury/dialogs/formatblock_spec.js.coffee +0 -2
  33. data/spec/javascripts/mercury/dialogs/snippetpanel_spec.js.coffee +0 -2
  34. data/spec/javascripts/mercury/dialogs/style_spec.js.coffee +0 -2
  35. data/spec/javascripts/mercury/history_buffer_spec.js.coffee +0 -2
  36. data/spec/javascripts/mercury/lightview_spec.js.coffee +42 -21
  37. data/spec/javascripts/mercury/mercury_spec.js.coffee +87 -7
  38. data/spec/javascripts/mercury/modal_spec.js.coffee +53 -23
  39. data/spec/javascripts/mercury/modals/htmleditor_spec.js.coffee +0 -2
  40. data/spec/javascripts/mercury/modals/insertcharacter_spec.js.coffee +2 -3
  41. data/spec/javascripts/mercury/modals/insertlink_spec.js.coffee +0 -2
  42. data/spec/javascripts/mercury/modals/insertmedia_spec.js.coffee +2 -2
  43. data/spec/javascripts/mercury/modals/insertsnippet_spec.js.coffee +0 -2
  44. data/spec/javascripts/mercury/modals/inserttable_spec.js.coffee +2 -4
  45. data/spec/javascripts/mercury/native_extensions_spec.js.coffee +20 -2
  46. data/spec/javascripts/mercury/page_editor_spec.js.coffee +130 -35
  47. data/spec/javascripts/mercury/palette_spec.js.coffee +4 -6
  48. data/spec/javascripts/mercury/panel_spec.js.coffee +44 -6
  49. data/spec/javascripts/mercury/region_spec.js.coffee +42 -8
  50. data/spec/javascripts/mercury/regions/editable_spec.js.coffee +0 -2
  51. data/spec/javascripts/mercury/regions/markupable_spec.js.coffee +0 -2
  52. data/spec/javascripts/mercury/regions/snippetable_spec.js.coffee +3 -5
  53. data/spec/javascripts/mercury/select_spec.js.coffee +4 -6
  54. data/spec/javascripts/mercury/snippet_spec.js.coffee +3 -4
  55. data/spec/javascripts/mercury/snippet_toolbar_spec.js.coffee +2 -4
  56. data/spec/javascripts/mercury/statusbar_spec.js.coffee +0 -2
  57. data/spec/javascripts/mercury/table_editor_spec.js.coffee +2 -4
  58. data/spec/javascripts/mercury/toolbar.button_group_spec.js.coffee +0 -2
  59. data/spec/javascripts/mercury/toolbar.button_spec.js.coffee +34 -15
  60. data/spec/javascripts/mercury/toolbar.expander_spec.js.coffee +0 -2
  61. data/spec/javascripts/mercury/toolbar_spec.js.coffee +41 -26
  62. data/spec/javascripts/mercury/tooltip_spec.js.coffee +3 -5
  63. data/spec/javascripts/mercury/uploader_spec.js.coffee +8 -14
  64. data/spec/javascripts/spec_helper.js +1 -0
  65. data/spec/javascripts/templates/mercury/page_editor.html +1 -0
  66. data/spec/javascripts/templates/mercury/region.html +2 -2
  67. data/vendor/assets/images/mercury/missing-image.png +0 -0
  68. data/vendor/assets/javascripts/mercury.js +218 -112
  69. data/vendor/assets/javascripts/mercury/dependencies/{jquery-1.6.js → jquery-1.7.js} +2030 -1595
  70. data/vendor/assets/javascripts/mercury/dependencies/jquery.additions.js +55 -0
  71. data/vendor/assets/javascripts/mercury/dialog.js.coffee +7 -5
  72. data/vendor/assets/javascripts/mercury/dialogs/backcolor.js.coffee +1 -1
  73. data/vendor/assets/javascripts/mercury/dialogs/forecolor.js.coffee +1 -1
  74. data/vendor/assets/javascripts/mercury/dialogs/formatblock.js.coffee +1 -1
  75. data/vendor/assets/javascripts/mercury/dialogs/{objectspanel.js.coffee → snippetpanel.js.coffee} +2 -2
  76. data/vendor/assets/javascripts/mercury/dialogs/style.js.coffee +1 -1
  77. data/vendor/assets/javascripts/mercury/finalize.js.coffee +3 -0
  78. data/vendor/assets/javascripts/mercury/lightview.js.coffee +76 -30
  79. data/vendor/assets/javascripts/mercury/locales/da.locale.js.coffee +211 -0
  80. data/vendor/assets/javascripts/mercury/locales/de.locale.js.coffee +206 -0
  81. data/vendor/assets/javascripts/mercury/locales/es.locale.js.coffee +211 -0
  82. data/vendor/assets/javascripts/mercury/locales/example.local.js.coffee +211 -0
  83. data/vendor/assets/javascripts/mercury/locales/fr.locale.js.coffee +211 -0
  84. data/vendor/assets/javascripts/mercury/locales/it.locale.js.coffee +208 -0
  85. data/vendor/assets/javascripts/mercury/locales/ko.local.js.coffee +206 -0
  86. data/vendor/assets/javascripts/mercury/locales/nl.locale.js.coffee +206 -0
  87. data/vendor/assets/javascripts/mercury/locales/pt.locale.js.coffee +211 -0
  88. data/vendor/assets/javascripts/mercury/locales/sv.local.js.coffee +209 -0
  89. data/vendor/assets/javascripts/mercury/locales/swedish_chef.locale.js.coffee +213 -0
  90. data/vendor/assets/javascripts/mercury/mercury.js.coffee +62 -17
  91. data/vendor/assets/javascripts/mercury/modal.js.coffee +34 -21
  92. data/vendor/assets/javascripts/mercury/modals/htmleditor.js.coffee +1 -2
  93. data/vendor/assets/javascripts/mercury/modals/insertcharacter.js.coffee +3 -3
  94. data/vendor/assets/javascripts/mercury/modals/insertlink.js.coffee +4 -4
  95. data/vendor/assets/javascripts/mercury/modals/insertmedia.js.coffee +10 -9
  96. data/vendor/assets/javascripts/mercury/modals/insertsnippet.js.coffee +1 -1
  97. data/vendor/assets/javascripts/mercury/modals/inserttable.js.coffee +8 -9
  98. data/vendor/assets/javascripts/mercury/native_extensions.js.coffee +26 -8
  99. data/vendor/assets/javascripts/mercury/page_editor.js.coffee +68 -46
  100. data/vendor/assets/javascripts/mercury/palette.js.coffee +1 -1
  101. data/vendor/assets/javascripts/mercury/panel.js.coffee +25 -7
  102. data/vendor/assets/javascripts/mercury/plugins/save_as_xml/mercury/page_editor.js.coffee +1 -0
  103. data/vendor/assets/javascripts/mercury/region.js.coffee +21 -17
  104. data/vendor/assets/javascripts/mercury/regions/editable.js.coffee +47 -35
  105. data/vendor/assets/javascripts/mercury/regions/markupable.js.coffee +43 -36
  106. data/vendor/assets/javascripts/mercury/regions/snippetable.js.coffee +22 -24
  107. data/vendor/assets/javascripts/mercury/select.js.coffee +3 -2
  108. data/vendor/assets/javascripts/mercury/snippet.js.coffee +2 -1
  109. data/vendor/assets/javascripts/mercury/snippet_toolbar.js.coffee +10 -7
  110. data/vendor/assets/javascripts/mercury/statusbar.js.coffee +4 -4
  111. data/vendor/assets/javascripts/mercury/table_editor.js.coffee +1 -3
  112. data/vendor/assets/javascripts/mercury/toolbar.button.js.coffee +42 -20
  113. data/vendor/assets/javascripts/mercury/toolbar.button_group.js.coffee +3 -3
  114. data/vendor/assets/javascripts/mercury/toolbar.expander.js.coffee +2 -2
  115. data/vendor/assets/javascripts/mercury/toolbar.js.coffee +8 -6
  116. data/vendor/assets/javascripts/mercury/tooltip.js.coffee +13 -9
  117. data/vendor/assets/javascripts/mercury/uploader.js.coffee +22 -16
  118. data/vendor/assets/javascripts/mercury_loader.js +2 -0
  119. data/vendor/assets/javascripts/mercury_overrides.js +6 -0
  120. data/vendor/assets/stylesheets/mercury/all_images.css.erb +89 -0
  121. data/vendor/assets/stylesheets/mercury/dialog.css +13 -4
  122. data/vendor/assets/stylesheets/mercury/lightview.css +66 -15
  123. data/vendor/assets/stylesheets/mercury/mercury.css +12 -7
  124. data/vendor/assets/stylesheets/mercury/modal.css +9 -5
  125. data/vendor/assets/stylesheets/mercury/toolbar.css +3 -29
  126. metadata +266 -144
  127. data/POST_INSTALL +0 -15
  128. data/README.md +0 -299
  129. data/VERSION +0 -1
  130. data/annotated_source.template +0 -57
  131. data/config/routes.rb +0 -15
  132. data/mercury-rails.gemspec +0 -288
  133. data/spec/javascripts/responses/blank.html +0 -1
  134. data/vendor/assets/javascripts/mercury/lightviews/imageprocessor.js.coffee +0 -2
@@ -149,3 +149,58 @@ jQuery.extend(jQuery.easing, {
149
149
  var _escapeable = /["\\\x00-\x1f\x7f-\x9f]/g;
150
150
  var _meta = {'\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\'};
151
151
  })(jQuery);
152
+
153
+ /*
154
+ * jQuery Localizer Plugin
155
+ *
156
+ * Copyright (c) 2011 Sagi Mann (with a basic reworking by Jeremy Jackson)
157
+ * All rights reserved.
158
+ *
159
+ * Redistribution and use in source and binary forms are permitted provided that the above copyright notice and this
160
+ * paragraph are duplicated in all such forms and that any documentation, advertising materials, and other materials
161
+ * related to such distribution and use acknowledge that the software was developed by the <organization>. The name of
162
+ * the University may not be used to endorse or promote products derived from this software without specific prior
163
+ * written permission.
164
+ *
165
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE
166
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
167
+ */
168
+ (function($) {
169
+ $.fn.localize = function(locale) {
170
+ this.find('*').contents().each(function() {
171
+ var translated = false;
172
+ var source = '';
173
+ if (typeof(this.data) == 'string') {
174
+ source = $.trim(this.data);
175
+ if (source && (translated = (locale.sub[source] || locale.top[source]))) {
176
+ this.data = translated;
177
+ }
178
+ }
179
+
180
+ if (this.nodeName == 'IMG' && this.attributes['src']) {
181
+ source = this.attributes['src'].nodeValue;
182
+ if (source && (translated = (locale.sub[source] || locale.top[source]))) {
183
+ $(this).attr('src', translated);
184
+ }
185
+ }
186
+
187
+ if (this.nodeName == "A" && this.attributes['href']) {
188
+ source = $.trim(this.attributes['href'].nodeValue);
189
+ if (source && (translated = (locale.sub[source] || locale.top[source]))) {
190
+ $(this).attr('href', translated);
191
+ }
192
+ }
193
+
194
+ if (this.nodeName == "INPUT" && this.attributes['type']) {
195
+ if (this.attributes['value'] && ['submit', 'reset', 'button'].indexOf(this.attributes['type'].nodeValue.toLowerCase()) > -1) {
196
+ source = $.trim(this.attributes['value'].nodeValue);
197
+ if (source && (translated = (locale.sub[source] || locale.top[source]))) {
198
+ $(this).attr('value', translated);
199
+ }
200
+ }
201
+ }
202
+
203
+ return this;
204
+ });
205
+ };
206
+ })(jQuery);
@@ -47,7 +47,8 @@ class @Mercury.Dialog
47
47
  # **Note:** By stopping the mousedown event we're limiting what's possible in dialogs, but this is needed to keep
48
48
  # focus from being taken away from the active region when different things are clicked on in dialogs.
49
49
  bindEvents: ->
50
- @element.mousedown (event) -> event.stopPropagation()
50
+ @element.on 'mousedown', (event) ->
51
+ event.stopPropagation()
51
52
 
52
53
 
53
54
  # ## #preload
@@ -93,7 +94,7 @@ class @Mercury.Dialog
93
94
 
94
95
  # ## #position
95
96
  #
96
- # Interface method. Implemenations are expected to position the dialog themselves.
97
+ # Interface method. Implementations are expected to position the dialog themselves.
97
98
  #
98
99
  # @keepVisible _boolean_ specifies if the element should stay visible if it's already visible.
99
100
  position: (keepVisible) ->
@@ -127,8 +128,8 @@ class @Mercury.Dialog
127
128
  if Mercury.preloadedViews[@url]
128
129
  # If there's a preloadedView defined for the url being requested, load that one.
129
130
  @loadContent(Mercury.preloadedViews[@url])
130
- # And call the dialog handler if there's one. We've broken the handlers out into seperate files so they can be
131
- # tested more easily, but you can define your own by putting them in dialogHanders.
131
+ # And call the dialog handler if there's one. We've broken the handlers out into separate files so they can be
132
+ # tested more easily, but you can define your own by putting them in dialogHandlers.
132
133
  Mercury.dialogHandlers[@name].call(@) if Mercury.dialogHandlers[@name]
133
134
  callback() if callback
134
135
  else
@@ -142,7 +143,7 @@ class @Mercury.Dialog
142
143
  # If the Ajax fails, we hide the dialog and alert the user about the error.
143
144
  @hide()
144
145
  @button.removeClass('pressed') if @button
145
- alert("Mercury was unable to load #{@url} for the #{@name} dialog.")
146
+ Mercury.notify('Mercury was unable to load %s for the "%s" dialog.', @url, @name)
146
147
  }
147
148
 
148
149
 
@@ -155,3 +156,4 @@ class @Mercury.Dialog
155
156
  @loaded = true
156
157
  @element.removeClass('loading')
157
158
  @element.html(data)
159
+ @element.localize(Mercury.locale()) if Mercury.config.localization.enabled
@@ -1,5 +1,5 @@
1
1
  @Mercury.dialogHandlers.backColor = ->
2
- @element.find('.picker, .last-picked').click (event) =>
2
+ @element.find('.picker, .last-picked').on 'click', (event) =>
3
3
  color = jQuery(event.target).css('background-color')
4
4
  @element.find('.last-picked').css({background: color})
5
5
  @button.css({backgroundColor: color})
@@ -1,5 +1,5 @@
1
1
  @Mercury.dialogHandlers.foreColor = ->
2
- @element.find('.picker, .last-picked').click (event) =>
2
+ @element.find('.picker, .last-picked').on 'click', (event) =>
3
3
  color = jQuery(event.target).css('background-color')
4
4
  @element.find('.last-picked').css({background: color})
5
5
  @button.css({backgroundColor: color})
@@ -1,4 +1,4 @@
1
1
  @Mercury.dialogHandlers.formatblock = ->
2
- @element.find('[data-tag]').click (event) =>
2
+ @element.find('[data-tag]').on 'click', (event) =>
3
3
  tag = jQuery(event.target).data('tag')
4
4
  Mercury.trigger('action', {action: 'formatblock', value: tag})
@@ -1,10 +1,10 @@
1
1
  @Mercury.dialogHandlers.snippetPanel = ->
2
2
  # make the filter work
3
- @element.find('input.filter').keyup =>
3
+ @element.find('input.filter').on 'keyup', =>
4
4
  value = @element.find('input.filter').val()
5
5
  for snippet in @element.find('li[data-filter]')
6
6
  if LiquidMetal.score(jQuery(snippet).data('filter'), value) == 0 then jQuery(snippet).hide() else jQuery(snippet).show()
7
7
 
8
8
  # when an element is dragged, set it so we have a global object
9
- @element.find('img[data-snippet]').bind 'dragstart', (event) ->
9
+ @element.find('img[data-snippet]').on 'dragstart', ->
10
10
  Mercury.snippet = jQuery(@).data('snippet')
@@ -1,4 +1,4 @@
1
1
  @Mercury.dialogHandlers.style = ->
2
- @element.find('[data-class]').click (event) =>
2
+ @element.find('[data-class]').on 'click', (event) =>
3
3
  className = jQuery(event.target).data('class')
4
4
  Mercury.trigger('action', {action: 'style', value: className})
@@ -0,0 +1,3 @@
1
+ # tell everyone that Mercury has loaded
2
+ Mercury.onload() if Mercury.onload
3
+ jQuery(window).trigger('mercury:loaded')
@@ -2,14 +2,15 @@
2
2
  Mercury.lightview.show(url, options)
3
3
  return Mercury.lightview
4
4
 
5
- jQuery.extend Mercury.lightview, {
6
-
5
+ jQuery.extend Mercury.lightview,
7
6
  minWidth: 400
8
7
 
9
8
  show: (@url, @options = {}) ->
10
9
  Mercury.trigger('focus:window')
11
10
  @initialize()
12
11
  if @visible then @update() else @appear()
12
+ if @options.content
13
+ setTimeout 500, => @loadContent(@options.content)
13
14
 
14
15
 
15
16
  initialize: ->
@@ -34,21 +35,27 @@ jQuery.extend Mercury.lightview, {
34
35
  @element.appendTo(jQuery(@options.appendTo).get(0) ? 'body')
35
36
  @overlay.appendTo(jQuery(@options.appendTo).get(0) ? 'body')
36
37
 
37
- @titleElement.find('span').html(@options.title)
38
-
39
38
 
40
39
  bindEvents: ->
41
- Mercury.bind 'refresh', => @resize(true)
42
- Mercury.bind 'resize', => @position() if @visible
40
+ Mercury.on 'refresh', => @resize(true)
41
+ Mercury.on 'resize', => @position() if @visible
42
+
43
+ @overlay.on 'click', =>
44
+ @hide() unless @options.closeButton
45
+
46
+ @titleElement.find('.mercury-lightview-close').on 'click', =>
47
+ @hide()
43
48
 
44
- @overlay.click => @hide() unless @options.closeButton
45
- @titleElement.find('.mercury-lightview-close').click => @hide()
49
+ @element.on 'ajax:beforeSend', (event, xhr, options) =>
50
+ options.success = (content) =>
51
+ @loadContent(content)
46
52
 
47
- jQuery(document).bind 'keydown', (event) =>
53
+ jQuery(document).on 'keydown', (event) =>
48
54
  @hide() if event.keyCode == 27 && @visible
49
55
 
50
56
 
51
57
  appear: ->
58
+ @showing = true
52
59
  @position()
53
60
 
54
61
  @overlay.show().css({opacity: 0})
@@ -57,47 +64,75 @@ jQuery.extend Mercury.lightview, {
57
64
  @element.show().css({opacity: 0})
58
65
  @element.stop().animate {opacity: 1}, 200, 'easeInOutSine', =>
59
66
  @visible = true
67
+ @showing = false
60
68
  @load()
61
69
 
62
70
 
63
71
  resize: (keepVisible) ->
72
+ visibility = if keepVisible then 'visible' else 'hidden'
73
+
64
74
  viewportWidth = Mercury.displayRect.width
65
75
  viewportHeight = Mercury.displayRect.fullHeight
66
76
 
67
- @element.css({overflow: 'hidden'})
68
- @contentElement.css({visibility: 'hidden', display: 'none', width: 'auto', height: 'auto'})
77
+ titleHeight = @titleElement.outerHeight()
69
78
 
70
- width = @contentElement.outerWidth() + 40 + 2
79
+ width = @contentElement.outerWidth()
71
80
  width = viewportWidth - 40 if width > viewportWidth - 40 || @options.fullSize
72
- height = @contentElement.outerHeight() + @titleElement.outerHeight() + 30
81
+
82
+ @contentPane.css({height: 'auto'}) if @contentPane
83
+ @contentElement.css({height: 'auto', visibility: visibility, display: 'block'})
84
+
85
+ height = @contentElement.outerHeight() + titleHeight
73
86
  height = viewportHeight - 20 if height > viewportHeight - 20 || @options.fullSize
74
87
 
75
88
  width = 300 if width < 300
76
89
  height = 150 if height < 150
77
90
 
78
91
  @element.stop().animate {top: ((viewportHeight - height) / 2) + 10, left: (Mercury.displayRect.width - width) / 2, width: width, height: height}, 200, 'easeInOutSine', =>
79
- @contentElement.css({visibility: 'visible', display: 'block', opacity: 0})
80
- @contentElement.stop().animate({opacity: 1}, 200, 'easeInOutSine')
81
- @element.css({overflow: 'auto'})
92
+ @contentElement.css({visibility: 'visible', display: 'block'})
93
+ if @contentPane.length
94
+ @contentElement.css({height: height - titleHeight, overflow: 'visible'})
95
+ controlHeight = if @contentControl.length then @contentControl.outerHeight() else 0
96
+ @contentPane.css({height: height - titleHeight - controlHeight - 40})
97
+ @contentPane.find('.mercury-display-pane').css({width: width - 40})
98
+ else
99
+ @contentElement.css({height: height - titleHeight - 30, overflow: 'auto'})
82
100
 
83
101
 
84
102
  position: ->
85
103
  viewportWidth = Mercury.displayRect.width
86
104
  viewportHeight = Mercury.displayRect.fullHeight
87
105
 
88
- @contentElement.css({position: 'absolute', width: 'auto', height: 'auto'})
89
- width = @contentElement.width() + 40 + 2
90
- width = viewportWidth - 40 if width > viewportWidth - 40 || @options.fullSize
106
+ @contentPane.css({height: 'auto'}) if @contentPane
107
+ @contentElement.css({height: 'auto'})
108
+ @element.css({width: 'auto', height: 'auto', display: 'block', visibility: 'hidden'})
91
109
 
110
+ width = @contentElement.width() + 40
92
111
  height = @contentElement.height() + @titleElement.outerHeight() + 30
112
+
113
+ width = viewportWidth - 40 if width > viewportWidth - 40 || @options.fullSize
93
114
  height = viewportHeight - 20 if height > viewportHeight - 20 || @options.fullSize
94
- @contentElement.css({position: 'relative'})
95
115
 
96
116
  width = 300 if width < 300
97
117
  height = 150 if height < 150
98
118
 
99
- @element.css({top: ((viewportHeight - height) / 2) + 10, left: (viewportWidth - width) / 2, width: width, height: height, overflow: 'auto'})
100
- @contentElement.css({width: width - 40, height: height - 30 - @titleElement.outerHeight()}) if @visible
119
+ titleHeight = @titleElement.outerHeight()
120
+ if @contentPane && @contentPane.length
121
+ @contentElement.css({height: height - titleHeight, overflow: 'visible'})
122
+ controlHeight = if @contentControl.length then @contentControl.outerHeight() else 0
123
+ @contentPane.css({height: height - titleHeight - controlHeight - 40})
124
+ @contentPane.find('.mercury-display-pane').css({width: width - 40})
125
+ else
126
+ @contentElement.css({height: height - titleHeight - 30, overflow: 'auto'})
127
+
128
+ @element.css {
129
+ top: ((viewportHeight - height) / 2) + 10,
130
+ left: (viewportWidth - width) / 2,
131
+ width: width
132
+ height: height
133
+ display: if @visible then 'block' else 'none'
134
+ visibility: 'visible'
135
+ }
101
136
 
102
137
 
103
138
  update: ->
@@ -111,15 +146,16 @@ jQuery.extend Mercury.lightview, {
111
146
  return unless @url
112
147
  @element.addClass('loading')
113
148
  if Mercury.preloadedViews[@url]
114
- setTimeout((=> @loadContent(Mercury.preloadedViews[@url])), 10)
149
+ setTimeout(10, => @loadContent(Mercury.preloadedViews[@url]))
115
150
  else
116
151
  jQuery.ajax @url, {
117
- type: @options.loadType || 'get'
152
+ headers: Mercury.ajaxHeaders()
153
+ type: @options.loadType || 'GET'
118
154
  data: @options.loadData
119
155
  success: (data) => @loadContent(data)
120
156
  error: =>
121
157
  @hide()
122
- alert("Mercury was unable to load #{@url} for the lightview.")
158
+ Mercury.notify('Mercury was unable to load %s for the lightview.', @url)
123
159
  }
124
160
 
125
161
 
@@ -132,15 +168,23 @@ jQuery.extend Mercury.lightview, {
132
168
  @contentElement.html(data)
133
169
  @contentElement.css({display: 'none', visibility: 'hidden'})
134
170
 
171
+ # for complex lightview content, we provide panes and controls
172
+ @contentPane = @element.find('.mercury-display-pane-container')
173
+ @contentControl = @element.find('.mercury-display-controls')
174
+
135
175
  @options.afterLoad.call(@) if @options.afterLoad
136
- if @options.handler && Mercury.lightviewHandlers[@options.handler]
137
- Mercury.lightviewHandlers[@options.handler].call(@)
176
+ if @options.handler
177
+ if Mercury.modalHandlers[@options.handler]
178
+ Mercury.modalHandlers[@options.handler].call(@)
179
+ else if Mercury.lightviewHandlers[@options.handler]
180
+ Mercury.lightviewHandlers[@options.handler].call(@)
138
181
 
182
+ @element.localize(Mercury.locale()) if Mercury.config.localization.enabled
139
183
  @resize()
140
184
 
141
185
 
142
186
  setTitle: ->
143
- @titleElement.find('span').html(@options.title)
187
+ @titleElement.find('span').html(Mercury.I18n(@options.title))
144
188
 
145
189
 
146
190
  reset: ->
@@ -149,11 +193,13 @@ jQuery.extend Mercury.lightview, {
149
193
 
150
194
 
151
195
  hide: ->
196
+ return if @showing
197
+ @options = {}
198
+ @initialized = false
199
+
152
200
  Mercury.trigger('focus:frame')
153
201
  @element.hide()
154
202
  @overlay.hide()
155
203
  @reset()
156
204
 
157
205
  @visible = false
158
-
159
- }
@@ -0,0 +1,211 @@
1
+ Mercury.I18n['da'] =
2
+ # ## Javascript Strings
3
+
4
+ # ### Default Configuration
5
+ "Save": "Gem"
6
+ "Save this page": "Gem denne side"
7
+ "Preview": "Forhåndsvisning"
8
+ "Preview this page": "Forhåndsvis denne side"
9
+ "Undo": "Fortryd"
10
+ "Undo your last action": "Fortryd din sidste hændelse"
11
+ "Redo": "Gentag"
12
+ "Redo your last action": "Gentag din sidste hændelse"
13
+ "Link": "Link"
14
+ "Insert Link": "Indsæt link"
15
+ "Media": "Media"
16
+ "Insert Media (images and videos)": "Indsæt media (billeder og videoer)"
17
+ "Table": "Tabel"
18
+ "Insert Table": "Indsæt Tabel"
19
+ "Character": "Tegn"
20
+ "Special Characters": "Specialtegn"
21
+ "Snippet": "Snippet"
22
+ "Snippet Panel": "Snippetpanel"
23
+ "History": "Historie"
24
+ "Page Version History": "Sidens versionshistorik"
25
+ "Notes": "Noter"
26
+ "Page Notes": "Sidenoter"
27
+ "Style": "Stil"
28
+ "Block Format": "Blokformat"
29
+ "Background Color": "Baggrundsfarve"
30
+ "Text Color": "Tekstfarve"
31
+ "Bold": "Fed"
32
+ "Italicize": "Kursiv"
33
+ "Overline": "Overstreg"
34
+ "Strikethrough": "Gennemstreg"
35
+ "Underline": "Understreg"
36
+ "Subscript": "Sænket skrift"
37
+ "Superscript": "Hævet skrift"
38
+ "Align Left": "Venstrejusteret"
39
+ "Center": "Centreret"
40
+ "Align Right": "Højrejusteret"
41
+ "Justify Full": "Lige margener"
42
+ "Unordered List": "Usorteret liste"
43
+ "Numbered List": "Nummereret liste"
44
+ "Decrease Indentation": "Formindsk indrykning"
45
+ "Increase Indentation": "Forøg indrykning"
46
+ "Insert Table Row": "Indsæt tabelrække"
47
+ "Insert a table row before the cursor": "Indsæt en tabelrække før pegeren"
48
+ "Insert a table row after the cursor": "Indsæt en tabelrække efter pegeren"
49
+ "Delete Table Row": "Slet tabelrække"
50
+ "Delete this table row": "Slet denne tabelrække"
51
+ "Insert Table Column": "Indsæt tabelkolonne"
52
+ "Insert a table column before the cursor": "Indsæt en tabelkolonne før pegeren"
53
+ "Insert a table column after the cursor": "Indsæt en tabelkolonne efter pegeren"
54
+ "Delete Table Column": "Slet tabelkolonne"
55
+ "Delete this table column": "Slet denne tabelkolonne"
56
+ "Increase Cell Columns": "Forøg cellekolonner"
57
+ "Decrease Cell Columns": "Formindsk cellekolonner"
58
+ "Increase Cell Rows": "Forøg cellerækker"
59
+ "Decrease Cell Rows": "Formindsk cellerækker"
60
+ "Horizontal Rule": "Vandret linje"
61
+ "Insert a horizontal rule": "Indsæt en vandret linje"
62
+ "Remove Formatting": "Fjern formatering"
63
+ "Remove formatting for the selection": "Fjern formatering fra markeringen"
64
+ "Edit HTML": "Rediger HTML"
65
+ "Edit the HTML content": "Rediger HTML-indholdet"
66
+ "Edit Snippet Settings": "Rediger snippetindstillinger"
67
+ "Remove Snippet": "Fjern snippet"
68
+
69
+ # ### General
70
+ # Error Messages
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
+ "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 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
+ "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
+ "Mercury was unable to save to the url: %s": "Mercury var ikke i stand til at gemme til addressen: %s"
77
+ # Confirmations
78
+ "You have unsaved changes. Are you sure you want to leave without saving them first?": "Du har ændringer der ikke er blevet gemt. Er du sikker på, at du vil forlade siden uden først at gemme dem?"
79
+
80
+ # ### Toolbar / Buttons
81
+ # Error Messages
82
+ "Unknown button type \"%s\" used for the \"%s\" button.": "Ukendt knaptype \"%s\" anvendt for \"%s\"knappen."
83
+ "Unknown button structure -- please provide an array, object, or string for \"%s\".": "Ukendt knappestruktur -- Angiv venligst et array, objekt eller en streng for \"%s\"."
84
+
85
+ # ### Modals / Dialogs / Etc.
86
+ # Error Messages
87
+ "Mercury was unable to load %s for the \"%s\" dialog.": "Mercury kunne ikke indlæse %s for \"%s\"dialogen."
88
+ "Mercury was unable to load %s for the lightview.": "Mercury kunne ikke indlæse %s for lightview."
89
+ "Mercury was unable to load %s for the modal.": "Mercury kunne ikke indlæse %s for denna modal."
90
+
91
+ # ### Snippets
92
+ # Error Messages
93
+ "Error loading the preview for the \"%s\" snippet.": "Fejl ved indlæsning af forhåndsvisningen for \"%s\"snippeten."
94
+ # Misc
95
+ "Snippet Options": "Snippetindstillinger"
96
+
97
+ # ### Uploader
98
+ # Error Messages
99
+ "Unable to process response: %s": "Kunne ikke forarbejde svar: %s"
100
+ "Error: Unable to upload the file": "Fejl: Kunne ikke uploade filen"
101
+ "Malformed response from server": "Deform svar fra server"
102
+ "Too large": "For stor"
103
+ "Unsupported format": "Formatet er ikke støttet"
104
+ # Statuses
105
+ "Processing...": "Forarbejder..."
106
+ "Uploading...": "Uploader..."
107
+ "Aborted": "Afbrudt"
108
+ "Successfully uploaded...": "Uploadningen lykkedes..."
109
+ "Name: %s": "Navn: %s"
110
+ "Size: %s": "Størrelse: %s"
111
+ "Type: %s": "Type: %s"
112
+
113
+ # Inserting Media
114
+ "Error: The provided youtube share url was invalid.": "Fejl: Den angivede delningsadressen for YouTube er forkert."
115
+ "Error: The provided vimeo url was invalid.": "Fejl: Den angivede Vimeo-adresse er forkert."
116
+
117
+ # Statusbar
118
+ "Path:": "Sti:"
119
+
120
+
121
+ # ## HTML / Template Strings
122
+
123
+ # ### Modals
124
+ # Insert Link Modal (link.html)
125
+ "Link Content": "Link indhold"
126
+ "Standard Links": "Standard links"
127
+ "URL": "URL"
128
+ "Index / Bookmark Links": "Indeks- / bogmærkelinks"
129
+ "Existing Links": "Eksisterende links"
130
+ "Bookmark": "Bogmærke"
131
+ "Options": "Indstillinger"
132
+ "Link Target": "Link mål"
133
+ "Self (the same window or tab)": "Self (det samme vindue eller fane)"
134
+ "Blank (a new window or tab)": "Blank (et nyt vindue eller fane)"
135
+ "Top (removes any frames)": "Top (fjerner eventuelle rammer)"
136
+ "Popup Window (javascript new window popup)": "Popupvindue (JavaScript nyt vindue popup)"
137
+ "Popup Width": "Bredde for popup"
138
+ "Popup Height": "Højde for popup"
139
+ "Insert Link": "Indsæt link"
140
+
141
+ # Insert Media Modal (media.html)
142
+ "Images": "Billeder"
143
+ "Videos": "Videoer"
144
+ "YouTube Share URL": "YouTube delnings-URL"
145
+ "Vimeo URL": "Vimeo-URL"
146
+ "Alignment": "Justering"
147
+ "None": "Ingen"
148
+ "Left": "Venstre"
149
+ "Right": "Højre"
150
+ "Top": "Top"
151
+ "Middle": "Midt"
152
+ "Bottom": "Bund"
153
+ "Absolute Middle": "Absolut midte"
154
+ "Absolute Bottom": "Absolut bund"
155
+ "Width": "Bredde"
156
+ "Height": "Højde"
157
+ "Insert Media": "Indsæt media"
158
+
159
+ # Insert Table Modal (table.html)
160
+ "Rows": "Rækker"
161
+ "Add Before": "Tilføj før"
162
+ "Add After": "Tilføj efter"
163
+ "Remove": "Fjern"
164
+ "Columns": "Kolonner"
165
+ "Row Span": "Rækkevidde"
166
+ "Column Span": "Kolonnevidde"
167
+ "Options": "Indstillinger"
168
+ "Alignment": "Justering"
169
+ "Border": "Ramme"
170
+ "Spacing": "Mellemrum"
171
+ "Insert Table": "Indsæt tabel"
172
+
173
+ # HTML Editor Modal (htmleditor.html)
174
+ "HTML Editor": "HTML-editor"
175
+ "Save and Replace": "Gem og erstat"
176
+
177
+ # ### Dialogs / Etc.
178
+ # Color Palettes (forecolor.html, backcolor.html)
179
+ "Last Color Picked": "Sidste valgte farve"
180
+
181
+ # Block Format Select (formatblock.html)
182
+ "Heading 1": "Rubrik 1"
183
+ "Heading 2": "Rubrik 2"
184
+ "Heading 3": "Rubrik 3"
185
+ "Heading 4": "Rubrik 4"
186
+ "Heading 5": "Rubrik 5"
187
+ "Heading 6": "Rubrik 6"
188
+ "Paragraph": "Paragraf"
189
+ "Blockquote": "Citattekst"
190
+ "Formatted": "Formateret"
191
+
192
+ # About Mercury Panel (about.html)
193
+ "Project Home": "Projektets hjemmeside"
194
+ "Project Source": "Projektets kildekode"
195
+
196
+ # ### Demo / Placeholder / Defaults
197
+ "The history panel is expected to be implemented with a server back end. Since this is a demo, we didn't include it.": "Historikpanelet forventes at være implementeret med en server back-end. Eftersom dette er en demo så inkluderede vi den ikke."
198
+
199
+ "The notes panel is expected to be implemented with a server back end. Since this is a demo, we didn't include it.": "Notepanelet forventes at være implementeret med en server back-end. Eftersom dette er en demo så inkluderede vi den ikke."
200
+
201
+ "Snippet Name": "Snippetnavn"
202
+ "A one or two line long description of what this snippet does.": "En eller to linjers lang beskrivelse om hvad denne snippet gør."
203
+
204
+ "First Name": "Fornavn"
205
+ "Favorite Beer": "Favorit øl"
206
+ "Insert Snippet": "Indsæt snippet"
207
+
208
+
209
+ # ## Custom Regional Overrides (eg. en-US)
210
+ _US_:
211
+ "Save": "Gem"