mercury-rails 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. data/LICENSE +20 -0
  2. data/README.rdoc +152 -0
  3. data/VERSION +1 -0
  4. data/app/assets/images/mercury/button.png +0 -0
  5. data/app/assets/images/mercury/clippy.png +0 -0
  6. data/app/assets/images/mercury/default-snippet.png +0 -0
  7. data/app/assets/images/mercury/loading-dark.gif +0 -0
  8. data/app/assets/images/mercury/loading-light.gif +0 -0
  9. data/app/assets/images/mercury/search-icon.png +0 -0
  10. data/app/assets/images/mercury/toolbar/editable/buttons.png +0 -0
  11. data/app/assets/images/mercury/toolbar/markupable/buttons.png +0 -0
  12. data/app/assets/images/mercury/toolbar/primary/_expander.png +0 -0
  13. data/app/assets/images/mercury/toolbar/primary/_pressed.png +0 -0
  14. data/app/assets/images/mercury/toolbar/primary/historypanel.png +0 -0
  15. data/app/assets/images/mercury/toolbar/primary/insertcharacter.png +0 -0
  16. data/app/assets/images/mercury/toolbar/primary/insertlink.png +0 -0
  17. data/app/assets/images/mercury/toolbar/primary/insertmedia.png +0 -0
  18. data/app/assets/images/mercury/toolbar/primary/inserttable.png +0 -0
  19. data/app/assets/images/mercury/toolbar/primary/inspectorpanel.png +0 -0
  20. data/app/assets/images/mercury/toolbar/primary/notespanel.png +0 -0
  21. data/app/assets/images/mercury/toolbar/primary/objectspanel.png +0 -0
  22. data/app/assets/images/mercury/toolbar/primary/preview.png +0 -0
  23. data/app/assets/images/mercury/toolbar/primary/redo.png +0 -0
  24. data/app/assets/images/mercury/toolbar/primary/save.png +0 -0
  25. data/app/assets/images/mercury/toolbar/primary/todospanel.png +0 -0
  26. data/app/assets/images/mercury/toolbar/primary/undo.png +0 -0
  27. data/app/assets/images/mercury/toolbar/snippetable/buttons.png +0 -0
  28. data/app/assets/javascripts/mercury.js +30 -0
  29. data/app/assets/javascripts/mercury/dialog.js.coffee +75 -0
  30. data/app/assets/javascripts/mercury/dialogs/backcolor.js.coffee +6 -0
  31. data/app/assets/javascripts/mercury/dialogs/forecolor.js.coffee +6 -0
  32. data/app/assets/javascripts/mercury/dialogs/formatblock.js.coffee +4 -0
  33. data/app/assets/javascripts/mercury/dialogs/objectspanel.js.coffee +10 -0
  34. data/app/assets/javascripts/mercury/dialogs/style.js.coffee +4 -0
  35. data/app/assets/javascripts/mercury/history_buffer.js.coffee +30 -0
  36. data/app/assets/javascripts/mercury/mercury.js.coffee +293 -0
  37. data/app/assets/javascripts/mercury/modal.js.coffee +177 -0
  38. data/app/assets/javascripts/mercury/modals/htmleditor.js.coffee +10 -0
  39. data/app/assets/javascripts/mercury/modals/insertcharacter.js.coffee +4 -0
  40. data/app/assets/javascripts/mercury/modals/insertlink.js.coffee +92 -0
  41. data/app/assets/javascripts/mercury/modals/insertmedia.js.coffee +72 -0
  42. data/app/assets/javascripts/mercury/modals/insertsnippet.js.coffee +11 -0
  43. data/app/assets/javascripts/mercury/modals/inserttable.js.coffee +56 -0
  44. data/app/assets/javascripts/mercury/native_extensions.js.coffee +47 -0
  45. data/app/assets/javascripts/mercury/page_editor.js.coffee +139 -0
  46. data/app/assets/javascripts/mercury/palette.js.coffee +29 -0
  47. data/app/assets/javascripts/mercury/panel.js.coffee +97 -0
  48. data/app/assets/javascripts/mercury/region.js.coffee +103 -0
  49. data/app/assets/javascripts/mercury/regions/editable.js.coffee +546 -0
  50. data/app/assets/javascripts/mercury/regions/markupable.js.coffee +380 -0
  51. data/app/assets/javascripts/mercury/regions/snippetable.js.coffee +127 -0
  52. data/app/assets/javascripts/mercury/select.js.coffee +40 -0
  53. data/app/assets/javascripts/mercury/snippet.js.coffee +92 -0
  54. data/app/assets/javascripts/mercury/snippet_toolbar.js.coffee +69 -0
  55. data/app/assets/javascripts/mercury/statusbar.js.coffee +25 -0
  56. data/app/assets/javascripts/mercury/table_editor.js.coffee +266 -0
  57. data/app/assets/javascripts/mercury/toolbar.button.js.coffee +152 -0
  58. data/app/assets/javascripts/mercury/toolbar.button_group.js.coffee +42 -0
  59. data/app/assets/javascripts/mercury/toolbar.expander.js.coffee +56 -0
  60. data/app/assets/javascripts/mercury/toolbar.js.coffee +72 -0
  61. data/app/assets/javascripts/mercury/tooltip.js.coffee +67 -0
  62. data/app/assets/javascripts/mercury/uploader.js.coffee +213 -0
  63. data/app/assets/javascripts/mercury/websocket.js.coffee +34 -0
  64. data/app/assets/stylesheets/mercury.css +31 -0
  65. data/app/assets/stylesheets/mercury/dialog.scss +178 -0
  66. data/app/assets/stylesheets/mercury/mercury.scss +119 -0
  67. data/app/assets/stylesheets/mercury/modal.scss +192 -0
  68. data/app/assets/stylesheets/mercury/statusbar.scss +23 -0
  69. data/app/assets/stylesheets/mercury/toolbar.scss +417 -0
  70. data/app/assets/stylesheets/mercury/tooltip.scss +26 -0
  71. data/app/assets/stylesheets/mercury/uploader.scss +109 -0
  72. data/app/controllers/images_controller.rb +19 -0
  73. data/app/controllers/mercury_controller.rb +20 -0
  74. data/app/models/image.rb +14 -0
  75. data/app/views/layouts/mercury.html.haml +12 -0
  76. data/app/views/mercury/modals/character.html.haml +252 -0
  77. data/app/views/mercury/modals/htmleditor.html.haml +8 -0
  78. data/app/views/mercury/modals/link.html.haml +31 -0
  79. data/app/views/mercury/modals/media.html.haml +33 -0
  80. data/app/views/mercury/modals/sanitizer.html.haml +4 -0
  81. data/app/views/mercury/modals/table.html.haml +49 -0
  82. data/app/views/mercury/palettes/backcolor.html.haml +79 -0
  83. data/app/views/mercury/palettes/forecolor.html.haml +79 -0
  84. data/app/views/mercury/panels/history.html.haml +0 -0
  85. data/app/views/mercury/panels/notes.html.haml +0 -0
  86. data/app/views/mercury/panels/snippets.html.haml +10 -0
  87. data/app/views/mercury/selects/formatblock.html.haml +10 -0
  88. data/app/views/mercury/selects/style.html.haml +4 -0
  89. data/app/views/mercury/snippets/example.html.haml +2 -0
  90. data/app/views/mercury/snippets/example_options.html.haml +16 -0
  91. data/config/engine.rb +6 -0
  92. data/config/routes.rb +15 -0
  93. data/db/migrate/20110526035601_create_images.rb +11 -0
  94. data/features/editing/basic.feature +11 -0
  95. data/features/step_definitions/debug_steps.rb +14 -0
  96. data/features/step_definitions/web_steps.rb +211 -0
  97. data/features/support/env.rb +46 -0
  98. data/features/support/paths.rb +35 -0
  99. data/features/support/selectors.rb +42 -0
  100. data/lib/mercury-rails.rb +4 -0
  101. data/log/.gitkeep +0 -0
  102. data/mercury-rails.gemspec +230 -0
  103. data/spec/javascripts/mercury/dialog_spec.js.coffee +258 -0
  104. data/spec/javascripts/mercury/history_buffer_spec.js.coffee +79 -0
  105. data/spec/javascripts/mercury/mercury_spec.js.coffee +52 -0
  106. data/spec/javascripts/mercury/native_extensions_spec.js.coffee +66 -0
  107. data/spec/javascripts/mercury/page_editor_spec.js.coffee +435 -0
  108. data/spec/javascripts/mercury/palette_spec.js.coffee +51 -0
  109. data/spec/javascripts/mercury/panel_spec.js.coffee +147 -0
  110. data/spec/javascripts/mercury/region_spec.js.coffee +261 -0
  111. data/spec/javascripts/mercury/regions/_editable_.js.coffee +0 -0
  112. data/spec/javascripts/mercury/regions/_markupable_.js.coffee +0 -0
  113. data/spec/javascripts/mercury/regions/snippetable_spec.js.coffee +368 -0
  114. data/spec/javascripts/mercury/select_spec.js.coffee +51 -0
  115. data/spec/javascripts/mercury/snippet_spec.js.coffee +246 -0
  116. data/spec/javascripts/mercury/snippet_toolbar_spec.js.coffee +186 -0
  117. data/spec/javascripts/mercury/statusbar_spec.js.coffee +78 -0
  118. data/spec/javascripts/mercury/table_editor_spec.js.coffee +192 -0
  119. data/spec/javascripts/mercury/toolbar.button_group_spec.js.coffee +92 -0
  120. data/spec/javascripts/mercury/toolbar.button_spec.js.coffee +341 -0
  121. data/spec/javascripts/mercury/toolbar.expander_spec.js.coffee +120 -0
  122. data/spec/javascripts/mercury/toolbar_spec.js.coffee +152 -0
  123. data/spec/javascripts/mercury/tooltip_spec.js.coffee +188 -0
  124. data/spec/javascripts/mercury/uploader_spec.js.coffee +512 -0
  125. data/spec/javascripts/responses/blank.html +1 -0
  126. data/spec/javascripts/spec_helper.js +513 -0
  127. data/spec/javascripts/templates/mercury/dialog.html +2 -0
  128. data/spec/javascripts/templates/mercury/page_editor.html +24 -0
  129. data/spec/javascripts/templates/mercury/palette.html +16 -0
  130. data/spec/javascripts/templates/mercury/panel.html +16 -0
  131. data/spec/javascripts/templates/mercury/region.html +2 -0
  132. data/spec/javascripts/templates/mercury/regions/snippetable.html +4 -0
  133. data/spec/javascripts/templates/mercury/select.html +16 -0
  134. data/spec/javascripts/templates/mercury/snippet.html +1 -0
  135. data/spec/javascripts/templates/mercury/snippet_toolbar.html +16 -0
  136. data/spec/javascripts/templates/mercury/statusbar.html +7 -0
  137. data/spec/javascripts/templates/mercury/table_editor.html +65 -0
  138. data/spec/javascripts/templates/mercury/toolbar.button.html +64 -0
  139. data/spec/javascripts/templates/mercury/toolbar.button_group.html +9 -0
  140. data/spec/javascripts/templates/mercury/toolbar.expander.html +18 -0
  141. data/spec/javascripts/templates/mercury/toolbar.html +10 -0
  142. data/spec/javascripts/templates/mercury/tooltip.html +12 -0
  143. data/spec/javascripts/templates/mercury/uploader.html +11 -0
  144. data/vendor/assets/javascripts/jquery-1.6.js +8865 -0
  145. data/vendor/assets/javascripts/jquery-ui-1.8.13.custom.min.js +249 -0
  146. data/vendor/assets/javascripts/jquery-ui-1.8.13.sortable.custom.js +1078 -0
  147. data/vendor/assets/javascripts/jquery.easing.js +173 -0
  148. data/vendor/assets/javascripts/jquery.json2.js +178 -0
  149. data/vendor/assets/javascripts/jquery.serialize_object.js +16 -0
  150. data/vendor/assets/javascripts/jquery.ujs.js +289 -0
  151. data/vendor/assets/javascripts/liquidmetal.js +88 -0
  152. data/vendor/assets/javascripts/showdown.js +1362 -0
  153. metadata +364 -0
@@ -0,0 +1,33 @@
1
+ = semantic_form_for 'media', { html: { id: 'mercury_media', style: 'width:600px' } } do |f|
2
+
3
+ .mercury-modal-pane-container
4
+ .mercury-modal-pane
5
+
6
+ = f.inputs 'Images' do
7
+ = f.input :image_url, required: false, input_html: { class: 'selectable' },
8
+ label: '<input name="media_type" type="radio" value="image_url" checked="checked"/>URL'.html_safe
9
+
10
+ = f.inputs 'Videos' do
11
+ = f.input :youtube_url, required: false, input_html: { class: 'selectable' },
12
+ label: '<input name="media_type" type="radio" value="youtube_url"/>YouTube Share URL'.html_safe
13
+ = f.input :vimeo_url, required: false, input_html: { class: 'selectable' },
14
+ label: '<input name="media_type" type="radio" value="vimeo_url"/>Vimeo URL'.html_safe
15
+
16
+ = f.inputs 'Options' do
17
+
18
+ #image_url.media-options
19
+ = f.input :image_alignment, as: :select, required: false, label: 'Alignment', include_blank: 'None',
20
+ collection: [['Left', 'left'], ['Right', 'right'], ['Top', 'top'], ['Middle', 'middle'], ['Bottom', 'bottom'], ['Absolute Middle', 'absmiddle'], ['Absolute Bottom', 'absbottom']]
21
+
22
+ #youtube_url.media-options{ :style => 'display:none' }
23
+ = f.input :youtube_width, required: false, label: 'Width', input_html: { value: '560' }
24
+ = f.input :youtube_height, required: false, label: 'Height', input_html: { value: '349' }
25
+
26
+ #vimeo_url.media-options{ :style => 'display:none' }
27
+ = f.input :vimeo_width, required: false, label: 'Width', input_html: { value: '400' }
28
+ = f.input :vimeo_height, required: false, label: 'Height', input_html: { value: '225' }
29
+
30
+ .mercury-modal-controls
31
+
32
+ = f.buttons do
33
+ = f.commit_button 'Insert Media'
@@ -0,0 +1,4 @@
1
+ #mercury_sanitizer{ style: 'width:450px' }
2
+ .information It looks like you've pasted directly from Microsoft Office!<br/><br/>Sadly though, your browser wasn't able to properly handle what you pasted. But that's ok, because I've sanitized it for you!
3
+ %textarea{ rows: '20', wrap: 'off' }
4
+ %strong You can just copy and paste the sanitized content that appears above.
@@ -0,0 +1,49 @@
1
+ = semantic_form_for 'table', { html: { id: 'mercury_table', style: 'width:700px' } } do |f|
2
+
3
+ .mercury-modal-pane-container
4
+ .mercury-modal-pane
5
+
6
+ #table_display
7
+
8
+ %table{ border: 1, cellspacing: 0 }
9
+ %tr
10
+ %td
11
+ %td
12
+ %td
13
+ %tr
14
+ %td
15
+ %td
16
+ %td
17
+
18
+ #table_options
19
+ = f.inputs do
20
+ %li{ class: "select input optional", id: "table_rows_input" }
21
+ %label{ for: "table_rows" } Rows
22
+ %input{ type: 'button', name: 'insertrowbefore', class: 'action', value: 'Add Before' }/
23
+ %input{ type: 'button', name: 'insertrowafter', class: 'action', value: 'Add After' }/
24
+ %input{ type: 'button', name: 'deleterow', class: 'action', value: 'Remove' }/
25
+ %li{ class: "select input optional", id: "table_columns_input" }
26
+ %label{ for: "table_columns" } Columns
27
+ %input{ type: 'button', name: 'insertcolumnbefore', class: 'action', value: 'Add Before' }/
28
+ %input{ type: 'button', name: 'insertcolumnafter', class: 'action', value: 'Add After' }/
29
+ %input{ type: 'button', name: 'deletecolumn', class: 'action', value: 'Remove' }/
30
+ %hr
31
+ %li{ class: "select input optional", id: "table_row_adjust_input" }
32
+ %label{ for: "table_row_adjust" } Row Span
33
+ %input{ type: 'button', name: 'increaserowspan', class: 'action', value: '+' }/
34
+ %input{ type: 'button', name: 'decreaserowspan', class: 'action', value: '-' }/
35
+ %li{ class: "select input optional", id: "table_column_adjust_input" }
36
+ %label{ for: "table_column_adjust" } Column Span
37
+ %input{ type: 'button', name: 'increasecolspan', class: 'action', value: '+' }/
38
+ %input{ type: 'button', name: 'decreasecolspan', class: 'action', value: '-' }/
39
+
40
+ = f.inputs 'Options' do
41
+ = f.input :alignment, as: :select, required: false, include_blank: 'None',
42
+ collection: [['Left', 'left'], ['Right', 'right']]
43
+ = f.input :border, required: false, input_html: { value: 1 }
44
+ = f.input :spacing, required: false, input_html: { value: 0 }
45
+
46
+ .mercury-modal-controls
47
+
48
+ = f.buttons do
49
+ = f.commit_button 'Insert Table'
@@ -0,0 +1,79 @@
1
+ .mercury-color-picker
2
+ .picker{ style: "background:#FFFFFF" }
3
+ .picker{ style: "background:#FFCCCC" }
4
+ .picker{ style: "background:#FFCC99" }
5
+ .picker{ style: "background:#FFFF99" }
6
+ .picker{ style: "background:#FFFFCC" }
7
+ .picker{ style: "background:#99FF99" }
8
+ .picker{ style: "background:#99FFFF" }
9
+ .picker{ style: "background:#CCFFFF" }
10
+ .picker{ style: "background:#CCCCFF" }
11
+ .picker{ style: "background:#FFCCFF" }
12
+
13
+ .picker{ style: "background:#CCCCCC" }
14
+ .picker{ style: "background:#FF6666" }
15
+ .picker{ style: "background:#FF9966" }
16
+ .picker{ style: "background:#FFFF66" }
17
+ .picker{ style: "background:#FFFF33" }
18
+ .picker{ style: "background:#66FF99" }
19
+ .picker{ style: "background:#33FFFF" }
20
+ .picker{ style: "background:#66FFFF" }
21
+ .picker{ style: "background:#9999FF" }
22
+ .picker{ style: "background:#FF99FF" }
23
+
24
+ .picker{ style: "background:#C0C0C0" }
25
+ .picker{ style: "background:#FF0000" }
26
+ .picker{ style: "background:#FF9900" }
27
+ .picker{ style: "background:#FFCC66" }
28
+ .picker{ style: "background:#FFFF00" }
29
+ .picker{ style: "background:#33FF33" }
30
+ .picker{ style: "background:#66CCCC" }
31
+ .picker{ style: "background:#33CCFF" }
32
+ .picker{ style: "background:#6666CC" }
33
+ .picker{ style: "background:#CC66CC" }
34
+
35
+ .picker{ style: "background:#999999" }
36
+ .picker{ style: "background:#CC0000" }
37
+ .picker{ style: "background:#FF6600" }
38
+ .picker{ style: "background:#FFCC33" }
39
+ .picker{ style: "background:#FFCC00" }
40
+ .picker{ style: "background:#33CC00" }
41
+ .picker{ style: "background:#00CCCC" }
42
+ .picker{ style: "background:#3366FF" }
43
+ .picker{ style: "background:#6633FF" }
44
+ .picker{ style: "background:#CC33CC" }
45
+
46
+ .picker{ style: "background:#666666" }
47
+ .picker{ style: "background:#990000" }
48
+ .picker{ style: "background:#CC6600" }
49
+ .picker{ style: "background:#CC9933" }
50
+ .picker{ style: "background:#999900" }
51
+ .picker{ style: "background:#009900" }
52
+ .picker{ style: "background:#339999" }
53
+ .picker{ style: "background:#3333FF" }
54
+ .picker{ style: "background:#6600CC" }
55
+ .picker{ style: "background:#993399" }
56
+
57
+ .picker{ style: "background:#333333" }
58
+ .picker{ style: "background:#660000" }
59
+ .picker{ style: "background:#993300" }
60
+ .picker{ style: "background:#996633" }
61
+ .picker{ style: "background:#666600" }
62
+ .picker{ style: "background:#006600" }
63
+ .picker{ style: "background:#336666" }
64
+ .picker{ style: "background:#000099" }
65
+ .picker{ style: "background:#333399" }
66
+ .picker{ style: "background:#663366" }
67
+
68
+ .picker{ style: "background:#000000" }
69
+ .picker{ style: "background:#330000" }
70
+ .picker{ style: "background:#663300" }
71
+ .picker{ style: "background:#663333" }
72
+ .picker{ style: "background:#333300" }
73
+ .picker{ style: "background:#003300" }
74
+ .picker{ style: "background:#003333" }
75
+ .picker{ style: "background:#000066" }
76
+ .picker{ style: "background:#330099" }
77
+ .picker{ style: "background:#330033" }
78
+
79
+ .last-picked Last Color Picked
@@ -0,0 +1,79 @@
1
+ .mercury-color-picker
2
+ .picker{ style: "background:#FFFFFF" }
3
+ .picker{ style: "background:#FFCCCC" }
4
+ .picker{ style: "background:#FFCC99" }
5
+ .picker{ style: "background:#FFFF99" }
6
+ .picker{ style: "background:#FFFFCC" }
7
+ .picker{ style: "background:#99FF99" }
8
+ .picker{ style: "background:#99FFFF" }
9
+ .picker{ style: "background:#CCFFFF" }
10
+ .picker{ style: "background:#CCCCFF" }
11
+ .picker{ style: "background:#FFCCFF" }
12
+
13
+ .picker{ style: "background:#CCCCCC" }
14
+ .picker{ style: "background:#FF6666" }
15
+ .picker{ style: "background:#FF9966" }
16
+ .picker{ style: "background:#FFFF66" }
17
+ .picker{ style: "background:#FFFF33" }
18
+ .picker{ style: "background:#66FF99" }
19
+ .picker{ style: "background:#33FFFF" }
20
+ .picker{ style: "background:#66FFFF" }
21
+ .picker{ style: "background:#9999FF" }
22
+ .picker{ style: "background:#FF99FF" }
23
+
24
+ .picker{ style: "background:#C0C0C0" }
25
+ .picker{ style: "background:#FF0000" }
26
+ .picker{ style: "background:#FF9900" }
27
+ .picker{ style: "background:#FFCC66" }
28
+ .picker{ style: "background:#FFFF00" }
29
+ .picker{ style: "background:#33FF33" }
30
+ .picker{ style: "background:#66CCCC" }
31
+ .picker{ style: "background:#33CCFF" }
32
+ .picker{ style: "background:#6666CC" }
33
+ .picker{ style: "background:#CC66CC" }
34
+
35
+ .picker{ style: "background:#999999" }
36
+ .picker{ style: "background:#CC0000" }
37
+ .picker{ style: "background:#FF6600" }
38
+ .picker{ style: "background:#FFCC33" }
39
+ .picker{ style: "background:#FFCC00" }
40
+ .picker{ style: "background:#33CC00" }
41
+ .picker{ style: "background:#00CCCC" }
42
+ .picker{ style: "background:#3366FF" }
43
+ .picker{ style: "background:#6633FF" }
44
+ .picker{ style: "background:#CC33CC" }
45
+
46
+ .picker{ style: "background:#666666" }
47
+ .picker{ style: "background:#990000" }
48
+ .picker{ style: "background:#CC6600" }
49
+ .picker{ style: "background:#CC9933" }
50
+ .picker{ style: "background:#999900" }
51
+ .picker{ style: "background:#009900" }
52
+ .picker{ style: "background:#339999" }
53
+ .picker{ style: "background:#3333FF" }
54
+ .picker{ style: "background:#6600CC" }
55
+ .picker{ style: "background:#993399" }
56
+
57
+ .picker{ style: "background:#333333" }
58
+ .picker{ style: "background:#660000" }
59
+ .picker{ style: "background:#993300" }
60
+ .picker{ style: "background:#996633" }
61
+ .picker{ style: "background:#666600" }
62
+ .picker{ style: "background:#006600" }
63
+ .picker{ style: "background:#336666" }
64
+ .picker{ style: "background:#000099" }
65
+ .picker{ style: "background:#333399" }
66
+ .picker{ style: "background:#663366" }
67
+
68
+ .picker{ style: "background:#000000" }
69
+ .picker{ style: "background:#330000" }
70
+ .picker{ style: "background:#663300" }
71
+ .picker{ style: "background:#663333" }
72
+ .picker{ style: "background:#333300" }
73
+ .picker{ style: "background:#003300" }
74
+ .picker{ style: "background:#003333" }
75
+ .picker{ style: "background:#000066" }
76
+ .picker{ style: "background:#330099" }
77
+ .picker{ style: "background:#330033" }
78
+
79
+ .last-picked Last Color Picked
File without changes
File without changes
@@ -0,0 +1,10 @@
1
+ .mercury-snippet-panel
2
+
3
+ .filter
4
+ %input.filter{ :type => 'text' }
5
+
6
+ %ul
7
+ %li{ 'data-filter' => "example-snippet" }
8
+ = image_tag('mercury/default-snippet.png', 'data-snippet' => 'example' )
9
+ %h4 Snippet Name
10
+ .description A one to two line long description of what this snippet does.
@@ -0,0 +1,10 @@
1
+ .mercury-select-options
2
+ %h1{ data: {tag: "h1"} } Heading 1 &lt;h1&gt;
3
+ %h2{ data: {tag: "h2"} } Heading 2 &lt;h2&gt;
4
+ %h3{ data: {tag: "h3"} } Heading 3 &lt;h3&gt;
5
+ %h4{ data: {tag: "h4"} } Heading 4 &lt;h4&gt;
6
+ %h5{ data: {tag: "h5"} } Heading 5 &lt;h5&gt;
7
+ %h6{ data: {tag: "h6"} } Heading 6 &lt;h6&gt;
8
+ %div{ data: {tag: "p"} } Paragraph &lt;p&gt;
9
+ %div{ data: {tag: "blockquote"} } Blockquote &lt;blockquote&gt;
10
+ %div{ data: {tag: "pre"} } Formatted &lt;pre&gt;
@@ -0,0 +1,4 @@
1
+ .mercury-select-options
2
+ .red{ data: {class: "red"} } Red text
3
+ .large-bold{ data: {class: "large-bold"} } Large bold text
4
+ .blue{ data: {class: "blue"} } Blue background
@@ -0,0 +1,2 @@
1
+ %h1= params[:options][:first_name]
2
+ %h2= "likes #{params[:options][:favorite_beer]}"
@@ -0,0 +1,16 @@
1
+ = semantic_form_for 'options', { html: { style: 'width:600px' } } do |f|
2
+
3
+ .mercury-modal-pane-container
4
+ .mercury-modal-pane
5
+
6
+ = f.inputs do
7
+ = f.input :first_name, required: false, label: 'First Name'
8
+
9
+ = f.inputs 'Options' do
10
+ = f.input :favorite_beer, as: :select, required: false, label: 'Favorite Beer', include_blank: false,
11
+ collection: [['Miller Lite', 'miller_lite'], ['PBR', 'pbr'], ['Coors', 'coors']]
12
+
13
+ .mercury-modal-controls
14
+
15
+ = f.buttons do
16
+ = f.commit_button 'Insert Snippet'
data/config/engine.rb ADDED
@@ -0,0 +1,6 @@
1
+ require "rails"
2
+
3
+ module Mercury
4
+ class Engine < Rails::Engine
5
+ end
6
+ end
data/config/routes.rb ADDED
@@ -0,0 +1,15 @@
1
+ Rails.application.routes.draw do
2
+
3
+ resources :images
4
+
5
+ match '/edit(/*requested_uri)' => "mercury#edit"
6
+ namespace :mercury do
7
+ match ':type/:resource' => "mercury#resource"
8
+ match 'snippets/:name/options' => "mercury#snippet_options"
9
+ match 'snippets/:name/preview' => "mercury#snippet_preview"
10
+ end
11
+
12
+ if defined?(Mercury::Application)
13
+ root to: "application#show"
14
+ end
15
+ end
@@ -0,0 +1,11 @@
1
+ class CreateImages < ActiveRecord::Migration
2
+ def change
3
+ create_table :images do |t|
4
+ t.string :image_file_name
5
+ t.string :image_content_type
6
+ t.integer :image_file_size
7
+ t.datetime :image_updated_at
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ Feature:
2
+ As a content editor type person
3
+ In order to manage content
4
+ I should be able to edit content using a toolbar
5
+
6
+ @javascript
7
+ Scenario: A user can expect to see the editor load
8
+ When I go to an edit page
9
+ Then I should see "Save" within the toolbar
10
+ And I should see "Preview" within the toolbar
11
+ And I should see "Bold" within the toolbar
@@ -0,0 +1,14 @@
1
+ # DEBUG / DELAY STEPS
2
+ #------------------------------------------------------------------------------
3
+
4
+ When /^(?:|I )sleep for (\d+) seconds?$/ do |seconds|
5
+ sleep(seconds.to_i)
6
+ end
7
+
8
+ When /^I debug?$/ do
9
+ put 'Debugging...'
10
+ unless ENV['RUBYMINE'].present?
11
+ require 'debug'
12
+ debugger
13
+ end
14
+ end
@@ -0,0 +1,211 @@
1
+ # TL;DR: YOU SHOULD DELETE THIS FILE
2
+ #
3
+ # This file was generated by Cucumber-Rails and is only here to get you a head start
4
+ # These step definitions are thin wrappers around the Capybara/Webrat API that lets you
5
+ # visit pages, interact with widgets and make assertions about page content.
6
+ #
7
+ # If you use these step definitions as basis for your features you will quickly end up
8
+ # with features that are:
9
+ #
10
+ # * Hard to maintain
11
+ # * Verbose to read
12
+ #
13
+ # A much better approach is to write your own higher level step definitions, following
14
+ # the advice in the following blog posts:
15
+ #
16
+ # * http://benmabey.com/2008/05/19/imperative-vs-declarative-scenarios-in-user-stories.html
17
+ # * http://dannorth.net/2011/01/31/whose-domain-is-it-anyway/
18
+ # * http://elabs.se/blog/15-you-re-cuking-it-wrong
19
+ #
20
+
21
+
22
+ require 'uri'
23
+ require 'cgi'
24
+ require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
25
+ require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "selectors"))
26
+
27
+ module WithinHelpers
28
+ def with_scope(locator)
29
+ locator ? within(*selector_for(locator)) { yield } : yield
30
+ end
31
+ end
32
+ World(WithinHelpers)
33
+
34
+ # Single-line step scoper
35
+ When /^(.*) within ([^:]+)$/ do |step, parent|
36
+ with_scope(parent) { When step }
37
+ end
38
+
39
+ # Multi-line step scoper
40
+ When /^(.*) within ([^:]+):$/ do |step, parent, table_or_string|
41
+ with_scope(parent) { When "#{step}:", table_or_string }
42
+ end
43
+
44
+ Given /^(?:|I )am on (.+)$/ do |page_name|
45
+ visit path_to(page_name)
46
+ end
47
+
48
+ When /^(?:|I )go to (.+)$/ do |page_name|
49
+ visit path_to(page_name)
50
+ end
51
+
52
+ When /^(?:|I )press "([^"]*)"$/ do |button|
53
+ click_button(button)
54
+ end
55
+
56
+ When /^(?:|I )follow "([^"]*)"$/ do |link|
57
+ click_link(link)
58
+ end
59
+
60
+ When /^(?:|I )fill in "([^"]*)" with "([^"]*)"$/ do |field, value|
61
+ fill_in(field, :with => value)
62
+ end
63
+
64
+ When /^(?:|I )fill in "([^"]*)" for "([^"]*)"$/ do |value, field|
65
+ fill_in(field, :with => value)
66
+ end
67
+
68
+ # Use this to fill in an entire form with data from a table. Example:
69
+ #
70
+ # When I fill in the following:
71
+ # | Account Number | 5002 |
72
+ # | Expiry date | 2009-11-01 |
73
+ # | Note | Nice guy |
74
+ # | Wants Email? | |
75
+ #
76
+ # TODO: Add support for checkbox, select og option
77
+ # based on naming conventions.
78
+ #
79
+ When /^(?:|I )fill in the following:$/ do |fields|
80
+ fields.rows_hash.each do |name, value|
81
+ When %{I fill in "#{name}" with "#{value}"}
82
+ end
83
+ end
84
+
85
+ When /^(?:|I )select "([^"]*)" from "([^"]*)"$/ do |value, field|
86
+ select(value, :from => field)
87
+ end
88
+
89
+ When /^(?:|I )check "([^"]*)"$/ do |field|
90
+ check(field)
91
+ end
92
+
93
+ When /^(?:|I )uncheck "([^"]*)"$/ do |field|
94
+ uncheck(field)
95
+ end
96
+
97
+ When /^(?:|I )choose "([^"]*)"$/ do |field|
98
+ choose(field)
99
+ end
100
+
101
+ When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"$/ do |path, field|
102
+ attach_file(field, File.expand_path(path))
103
+ end
104
+
105
+ Then /^(?:|I )should see "([^"]*)"$/ do |text|
106
+ if page.respond_to? :should
107
+ page.should have_content(text)
108
+ else
109
+ assert page.has_content?(text)
110
+ end
111
+ end
112
+
113
+ Then /^(?:|I )should see \/([^\/]*)\/$/ do |regexp|
114
+ regexp = Regexp.new(regexp)
115
+
116
+ if page.respond_to? :should
117
+ page.should have_xpath('//*', :text => regexp)
118
+ else
119
+ assert page.has_xpath?('//*', :text => regexp)
120
+ end
121
+ end
122
+
123
+ Then /^(?:|I )should not see "([^"]*)"$/ do |text|
124
+ if page.respond_to? :should
125
+ page.should have_no_content(text)
126
+ else
127
+ assert page.has_no_content?(text)
128
+ end
129
+ end
130
+
131
+ Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp|
132
+ regexp = Regexp.new(regexp)
133
+
134
+ if page.respond_to? :should
135
+ page.should have_no_xpath('//*', :text => regexp)
136
+ else
137
+ assert page.has_no_xpath?('//*', :text => regexp)
138
+ end
139
+ end
140
+
141
+ Then /^the "([^"]*)" field(?: within (.*))? should contain "([^"]*)"$/ do |field, parent, value|
142
+ with_scope(parent) do
143
+ field = find_field(field)
144
+ field_value = (field.tag_name == 'textarea') ? field.text : field.value
145
+ if field_value.respond_to? :should
146
+ field_value.should =~ /#{value}/
147
+ else
148
+ assert_match(/#{value}/, field_value)
149
+ end
150
+ end
151
+ end
152
+
153
+ Then /^the "([^"]*)" field(?: within (.*))? should not contain "([^"]*)"$/ do |field, parent, value|
154
+ with_scope(parent) do
155
+ field = find_field(field)
156
+ field_value = (field.tag_name == 'textarea') ? field.text : field.value
157
+ if field_value.respond_to? :should_not
158
+ field_value.should_not =~ /#{value}/
159
+ else
160
+ assert_no_match(/#{value}/, field_value)
161
+ end
162
+ end
163
+ end
164
+
165
+ Then /^the "([^"]*)" checkbox(?: within (.*))? should be checked$/ do |label, parent|
166
+ with_scope(parent) do
167
+ field_checked = find_field(label)['checked']
168
+ if field_checked.respond_to? :should
169
+ field_checked.should be_true
170
+ else
171
+ assert field_checked
172
+ end
173
+ end
174
+ end
175
+
176
+ Then /^the "([^"]*)" checkbox(?: within (.*))? should not be checked$/ do |label, parent|
177
+ with_scope(parent) do
178
+ field_checked = find_field(label)['checked']
179
+ if field_checked.respond_to? :should
180
+ field_checked.should be_false
181
+ else
182
+ assert !field_checked
183
+ end
184
+ end
185
+ end
186
+
187
+ Then /^(?:|I )should be on (.+)$/ do |page_name|
188
+ current_path = URI.parse(current_url).path
189
+ if current_path.respond_to? :should
190
+ current_path.should == path_to(page_name)
191
+ else
192
+ assert_equal path_to(page_name), current_path
193
+ end
194
+ end
195
+
196
+ Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
197
+ query = URI.parse(current_url).query
198
+ actual_params = query ? CGI.parse(query) : {}
199
+ expected_params = {}
200
+ expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')}
201
+
202
+ if actual_params.respond_to? :should
203
+ actual_params.should == expected_params
204
+ else
205
+ assert_equal expected_params, actual_params
206
+ end
207
+ end
208
+
209
+ Then /^show me the page$/ do
210
+ save_and_open_page
211
+ end