smithycms 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (278) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/app/assets/javascripts/smithy/application.js +6 -6
  4. data/app/assets/javascripts/smithy/nested_forms.js +1 -1
  5. data/app/controllers/smithy/page_contents_controller.rb +2 -0
  6. data/app/controllers/smithy/pages_controller.rb +5 -1
  7. data/app/models/smithy/image.rb +0 -1
  8. data/app/models/smithy/page.rb +1 -0
  9. data/app/models/smithy/page_content.rb +2 -1
  10. data/app/models/smithy/permitted_params.rb +6 -2
  11. data/app/models/smithy/site.rb +1 -1
  12. data/app/views/smithy/assets/_asset.html.erb +2 -2
  13. data/app/views/smithy/assets/_form.html.erb +2 -3
  14. data/app/views/smithy/content_blocks/edit.html.erb +4 -4
  15. data/app/views/smithy/content_pieces/edit.html.erb +1 -1
  16. data/app/views/smithy/images/_form_fields.html.erb +4 -4
  17. data/app/views/smithy/pages/_container.html.erb +4 -4
  18. data/app/views/smithy/pages/_page_related.html.erb +2 -1
  19. data/app/views/smithy/settings/_setting.html.erb +1 -1
  20. data/app/views/smithy/templates/edit.html.erb +2 -2
  21. data/config/initializers/dragonfly.rb +1 -1
  22. data/lib/smithy/content_blocks/model.rb +2 -1
  23. data/lib/smithy/liquid/drops/page.rb +32 -0
  24. data/lib/smithy/liquid/filters/asset_tag.rb +10 -2
  25. data/lib/smithy/liquid/filters/resize.rb +1 -1
  26. data/lib/smithy/liquid/tags/nav.rb +23 -8
  27. data/lib/smithy/version.rb +1 -1
  28. metadata +5 -255
  29. data/app/assets/javascripts/ace/ace.js +0 -11
  30. data/app/assets/javascripts/ace/ext-elastic_tabstops_lite.js +0 -1
  31. data/app/assets/javascripts/ace/ext-emmet.js +0 -1
  32. data/app/assets/javascripts/ace/ext-keybinding_menu.js +0 -1
  33. data/app/assets/javascripts/ace/ext-language_tools.js +0 -1
  34. data/app/assets/javascripts/ace/ext-modelist.js +0 -1
  35. data/app/assets/javascripts/ace/ext-options.js +0 -1
  36. data/app/assets/javascripts/ace/ext-searchbox.js +0 -1
  37. data/app/assets/javascripts/ace/ext-settings_menu.js +0 -1
  38. data/app/assets/javascripts/ace/ext-spellcheck.js +0 -1
  39. data/app/assets/javascripts/ace/ext-split.js +0 -1
  40. data/app/assets/javascripts/ace/ext-static_highlight.js +0 -1
  41. data/app/assets/javascripts/ace/ext-statusbar.js +0 -1
  42. data/app/assets/javascripts/ace/ext-textarea.js +0 -1
  43. data/app/assets/javascripts/ace/ext-themelist.js +0 -1
  44. data/app/assets/javascripts/ace/ext-whitespace.js +0 -1
  45. data/app/assets/javascripts/ace/keybinding-emacs.js +0 -1
  46. data/app/assets/javascripts/ace/keybinding-vim.js +0 -1
  47. data/app/assets/javascripts/ace/mode-abap.js +0 -1
  48. data/app/assets/javascripts/ace/mode-actionscript.js +0 -1
  49. data/app/assets/javascripts/ace/mode-ada.js +0 -1
  50. data/app/assets/javascripts/ace/mode-asciidoc.js +0 -1
  51. data/app/assets/javascripts/ace/mode-assembly_x86.js +0 -1
  52. data/app/assets/javascripts/ace/mode-autohotkey.js +0 -1
  53. data/app/assets/javascripts/ace/mode-batchfile.js +0 -1
  54. data/app/assets/javascripts/ace/mode-c9search.js +0 -1
  55. data/app/assets/javascripts/ace/mode-c_cpp.js +0 -1
  56. data/app/assets/javascripts/ace/mode-clojure.js +0 -1
  57. data/app/assets/javascripts/ace/mode-cobol.js +0 -1
  58. data/app/assets/javascripts/ace/mode-coffee.js +0 -1
  59. data/app/assets/javascripts/ace/mode-coldfusion.js +0 -1
  60. data/app/assets/javascripts/ace/mode-csharp.js +0 -1
  61. data/app/assets/javascripts/ace/mode-css.js +0 -1
  62. data/app/assets/javascripts/ace/mode-curly.js +0 -1
  63. data/app/assets/javascripts/ace/mode-d.js +0 -1
  64. data/app/assets/javascripts/ace/mode-dart.js +0 -1
  65. data/app/assets/javascripts/ace/mode-diff.js +0 -1
  66. data/app/assets/javascripts/ace/mode-django.js +0 -1
  67. data/app/assets/javascripts/ace/mode-dot.js +0 -1
  68. data/app/assets/javascripts/ace/mode-ejs.js +0 -1
  69. data/app/assets/javascripts/ace/mode-erlang.js +0 -1
  70. data/app/assets/javascripts/ace/mode-forth.js +0 -1
  71. data/app/assets/javascripts/ace/mode-ftl.js +0 -1
  72. data/app/assets/javascripts/ace/mode-glsl.js +0 -1
  73. data/app/assets/javascripts/ace/mode-golang.js +0 -1
  74. data/app/assets/javascripts/ace/mode-groovy.js +0 -1
  75. data/app/assets/javascripts/ace/mode-haml.js +0 -1
  76. data/app/assets/javascripts/ace/mode-haskell.js +0 -1
  77. data/app/assets/javascripts/ace/mode-haxe.js +0 -1
  78. data/app/assets/javascripts/ace/mode-html.js +0 -1
  79. data/app/assets/javascripts/ace/mode-html_ruby.js +0 -1
  80. data/app/assets/javascripts/ace/mode-ini.js +0 -1
  81. data/app/assets/javascripts/ace/mode-jade.js +0 -1
  82. data/app/assets/javascripts/ace/mode-java.js +0 -1
  83. data/app/assets/javascripts/ace/mode-javascript.js +0 -1
  84. data/app/assets/javascripts/ace/mode-json.js +0 -1
  85. data/app/assets/javascripts/ace/mode-jsoniq.js +0 -1
  86. data/app/assets/javascripts/ace/mode-jsp.js +0 -1
  87. data/app/assets/javascripts/ace/mode-jsx.js +0 -1
  88. data/app/assets/javascripts/ace/mode-julia.js +0 -1
  89. data/app/assets/javascripts/ace/mode-latex.js +0 -1
  90. data/app/assets/javascripts/ace/mode-less.js +0 -1
  91. data/app/assets/javascripts/ace/mode-liquid.js +0 -1
  92. data/app/assets/javascripts/ace/mode-lisp.js +0 -1
  93. data/app/assets/javascripts/ace/mode-livescript.js +0 -1
  94. data/app/assets/javascripts/ace/mode-logiql.js +0 -1
  95. data/app/assets/javascripts/ace/mode-lsl.js +0 -1
  96. data/app/assets/javascripts/ace/mode-lua.js +0 -1
  97. data/app/assets/javascripts/ace/mode-luapage.js +0 -1
  98. data/app/assets/javascripts/ace/mode-lucene.js +0 -1
  99. data/app/assets/javascripts/ace/mode-makefile.js +0 -1
  100. data/app/assets/javascripts/ace/mode-markdown.js +0 -1
  101. data/app/assets/javascripts/ace/mode-matlab.js +0 -1
  102. data/app/assets/javascripts/ace/mode-mushcode.js +0 -1
  103. data/app/assets/javascripts/ace/mode-mushcode_high_rules.js +0 -1
  104. data/app/assets/javascripts/ace/mode-mysql.js +0 -1
  105. data/app/assets/javascripts/ace/mode-objectivec.js +0 -1
  106. data/app/assets/javascripts/ace/mode-ocaml.js +0 -1
  107. data/app/assets/javascripts/ace/mode-pascal.js +0 -1
  108. data/app/assets/javascripts/ace/mode-perl.js +0 -1
  109. data/app/assets/javascripts/ace/mode-pgsql.js +0 -1
  110. data/app/assets/javascripts/ace/mode-php.js +0 -1
  111. data/app/assets/javascripts/ace/mode-plain_text.js +0 -1
  112. data/app/assets/javascripts/ace/mode-powershell.js +0 -1
  113. data/app/assets/javascripts/ace/mode-prolog.js +0 -1
  114. data/app/assets/javascripts/ace/mode-properties.js +0 -1
  115. data/app/assets/javascripts/ace/mode-python.js +0 -1
  116. data/app/assets/javascripts/ace/mode-r.js +0 -1
  117. data/app/assets/javascripts/ace/mode-rdoc.js +0 -1
  118. data/app/assets/javascripts/ace/mode-rhtml.js +0 -1
  119. data/app/assets/javascripts/ace/mode-ruby.js +0 -1
  120. data/app/assets/javascripts/ace/mode-rust.js +0 -1
  121. data/app/assets/javascripts/ace/mode-sass.js +0 -1
  122. data/app/assets/javascripts/ace/mode-scad.js +0 -1
  123. data/app/assets/javascripts/ace/mode-scala.js +0 -1
  124. data/app/assets/javascripts/ace/mode-scheme.js +0 -1
  125. data/app/assets/javascripts/ace/mode-scss.js +0 -1
  126. data/app/assets/javascripts/ace/mode-sh.js +0 -1
  127. data/app/assets/javascripts/ace/mode-snippets.js +0 -1
  128. data/app/assets/javascripts/ace/mode-sql.js +0 -1
  129. data/app/assets/javascripts/ace/mode-stylus.js +0 -1
  130. data/app/assets/javascripts/ace/mode-svg.js +0 -1
  131. data/app/assets/javascripts/ace/mode-tcl.js +0 -1
  132. data/app/assets/javascripts/ace/mode-tex.js +0 -1
  133. data/app/assets/javascripts/ace/mode-text.js +0 -0
  134. data/app/assets/javascripts/ace/mode-textile.js +0 -1
  135. data/app/assets/javascripts/ace/mode-tmsnippet.js +0 -1
  136. data/app/assets/javascripts/ace/mode-toml.js +0 -1
  137. data/app/assets/javascripts/ace/mode-twig.js +0 -1
  138. data/app/assets/javascripts/ace/mode-typescript.js +0 -1
  139. data/app/assets/javascripts/ace/mode-vbscript.js +0 -1
  140. data/app/assets/javascripts/ace/mode-velocity.js +0 -1
  141. data/app/assets/javascripts/ace/mode-verilog.js +0 -1
  142. data/app/assets/javascripts/ace/mode-xml.js +0 -1
  143. data/app/assets/javascripts/ace/mode-xquery.js +0 -1
  144. data/app/assets/javascripts/ace/mode-yaml.js +0 -1
  145. data/app/assets/javascripts/ace/snippets/abap.js +0 -1
  146. data/app/assets/javascripts/ace/snippets/actionscript.js +0 -1
  147. data/app/assets/javascripts/ace/snippets/ada.js +0 -1
  148. data/app/assets/javascripts/ace/snippets/asciidoc.js +0 -1
  149. data/app/assets/javascripts/ace/snippets/assembly_x86.js +0 -1
  150. data/app/assets/javascripts/ace/snippets/autohotkey.js +0 -1
  151. data/app/assets/javascripts/ace/snippets/batchfile.js +0 -1
  152. data/app/assets/javascripts/ace/snippets/c9search.js +0 -1
  153. data/app/assets/javascripts/ace/snippets/c_cpp.js +0 -1
  154. data/app/assets/javascripts/ace/snippets/clojure.js +0 -1
  155. data/app/assets/javascripts/ace/snippets/cobol.js +0 -1
  156. data/app/assets/javascripts/ace/snippets/coffee.js +0 -1
  157. data/app/assets/javascripts/ace/snippets/coldfusion.js +0 -1
  158. data/app/assets/javascripts/ace/snippets/csharp.js +0 -1
  159. data/app/assets/javascripts/ace/snippets/css.js +0 -1
  160. data/app/assets/javascripts/ace/snippets/curly.js +0 -1
  161. data/app/assets/javascripts/ace/snippets/d.js +0 -1
  162. data/app/assets/javascripts/ace/snippets/dart.js +0 -1
  163. data/app/assets/javascripts/ace/snippets/diff.js +0 -1
  164. data/app/assets/javascripts/ace/snippets/django.js +0 -1
  165. data/app/assets/javascripts/ace/snippets/dot.js +0 -1
  166. data/app/assets/javascripts/ace/snippets/ejs.js +0 -1
  167. data/app/assets/javascripts/ace/snippets/erlang.js +0 -1
  168. data/app/assets/javascripts/ace/snippets/forth.js +0 -1
  169. data/app/assets/javascripts/ace/snippets/ftl.js +0 -1
  170. data/app/assets/javascripts/ace/snippets/glsl.js +0 -1
  171. data/app/assets/javascripts/ace/snippets/golang.js +0 -1
  172. data/app/assets/javascripts/ace/snippets/groovy.js +0 -1
  173. data/app/assets/javascripts/ace/snippets/haml.js +0 -1
  174. data/app/assets/javascripts/ace/snippets/haskell.js +0 -1
  175. data/app/assets/javascripts/ace/snippets/haxe.js +0 -1
  176. data/app/assets/javascripts/ace/snippets/html.js +0 -1
  177. data/app/assets/javascripts/ace/snippets/html_ruby.js +0 -1
  178. data/app/assets/javascripts/ace/snippets/ini.js +0 -1
  179. data/app/assets/javascripts/ace/snippets/jade.js +0 -1
  180. data/app/assets/javascripts/ace/snippets/java.js +0 -1
  181. data/app/assets/javascripts/ace/snippets/javascript.js +0 -1
  182. data/app/assets/javascripts/ace/snippets/json.js +0 -1
  183. data/app/assets/javascripts/ace/snippets/jsoniq.js +0 -1
  184. data/app/assets/javascripts/ace/snippets/jsp.js +0 -1
  185. data/app/assets/javascripts/ace/snippets/jsx.js +0 -1
  186. data/app/assets/javascripts/ace/snippets/julia.js +0 -1
  187. data/app/assets/javascripts/ace/snippets/latex.js +0 -1
  188. data/app/assets/javascripts/ace/snippets/less.js +0 -1
  189. data/app/assets/javascripts/ace/snippets/liquid.js +0 -1
  190. data/app/assets/javascripts/ace/snippets/lisp.js +0 -1
  191. data/app/assets/javascripts/ace/snippets/livescript.js +0 -1
  192. data/app/assets/javascripts/ace/snippets/logiql.js +0 -1
  193. data/app/assets/javascripts/ace/snippets/lsl.js +0 -1
  194. data/app/assets/javascripts/ace/snippets/lua.js +0 -1
  195. data/app/assets/javascripts/ace/snippets/luapage.js +0 -1
  196. data/app/assets/javascripts/ace/snippets/lucene.js +0 -1
  197. data/app/assets/javascripts/ace/snippets/makefile.js +0 -1
  198. data/app/assets/javascripts/ace/snippets/markdown.js +0 -1
  199. data/app/assets/javascripts/ace/snippets/matlab.js +0 -1
  200. data/app/assets/javascripts/ace/snippets/mushcode.js +0 -1
  201. data/app/assets/javascripts/ace/snippets/mushcode_high_rules.js +0 -1
  202. data/app/assets/javascripts/ace/snippets/mysql.js +0 -1
  203. data/app/assets/javascripts/ace/snippets/objectivec.js +0 -1
  204. data/app/assets/javascripts/ace/snippets/ocaml.js +0 -1
  205. data/app/assets/javascripts/ace/snippets/pascal.js +0 -1
  206. data/app/assets/javascripts/ace/snippets/perl.js +0 -1
  207. data/app/assets/javascripts/ace/snippets/pgsql.js +0 -1
  208. data/app/assets/javascripts/ace/snippets/php.js +0 -1
  209. data/app/assets/javascripts/ace/snippets/plain_text.js +0 -1
  210. data/app/assets/javascripts/ace/snippets/powershell.js +0 -1
  211. data/app/assets/javascripts/ace/snippets/prolog.js +0 -1
  212. data/app/assets/javascripts/ace/snippets/properties.js +0 -1
  213. data/app/assets/javascripts/ace/snippets/python.js +0 -1
  214. data/app/assets/javascripts/ace/snippets/r.js +0 -1
  215. data/app/assets/javascripts/ace/snippets/rdoc.js +0 -1
  216. data/app/assets/javascripts/ace/snippets/rhtml.js +0 -1
  217. data/app/assets/javascripts/ace/snippets/ruby.js +0 -1
  218. data/app/assets/javascripts/ace/snippets/rust.js +0 -1
  219. data/app/assets/javascripts/ace/snippets/sass.js +0 -1
  220. data/app/assets/javascripts/ace/snippets/scad.js +0 -1
  221. data/app/assets/javascripts/ace/snippets/scala.js +0 -1
  222. data/app/assets/javascripts/ace/snippets/scheme.js +0 -1
  223. data/app/assets/javascripts/ace/snippets/scss.js +0 -1
  224. data/app/assets/javascripts/ace/snippets/sh.js +0 -1
  225. data/app/assets/javascripts/ace/snippets/snippets.js +0 -1
  226. data/app/assets/javascripts/ace/snippets/sql.js +0 -1
  227. data/app/assets/javascripts/ace/snippets/stylus.js +0 -1
  228. data/app/assets/javascripts/ace/snippets/svg.js +0 -1
  229. data/app/assets/javascripts/ace/snippets/tcl.js +0 -1
  230. data/app/assets/javascripts/ace/snippets/tex.js +0 -1
  231. data/app/assets/javascripts/ace/snippets/text.js +0 -1
  232. data/app/assets/javascripts/ace/snippets/textile.js +0 -1
  233. data/app/assets/javascripts/ace/snippets/toml.js +0 -1
  234. data/app/assets/javascripts/ace/snippets/twig.js +0 -1
  235. data/app/assets/javascripts/ace/snippets/typescript.js +0 -1
  236. data/app/assets/javascripts/ace/snippets/vbscript.js +0 -1
  237. data/app/assets/javascripts/ace/snippets/velocity.js +0 -1
  238. data/app/assets/javascripts/ace/snippets/verilog.js +0 -1
  239. data/app/assets/javascripts/ace/snippets/xml.js +0 -1
  240. data/app/assets/javascripts/ace/snippets/xquery.js +0 -1
  241. data/app/assets/javascripts/ace/snippets/yaml.js +0 -1
  242. data/app/assets/javascripts/ace/theme-ambiance.js +0 -1
  243. data/app/assets/javascripts/ace/theme-chaos.js +0 -1
  244. data/app/assets/javascripts/ace/theme-chrome.js +0 -1
  245. data/app/assets/javascripts/ace/theme-clouds.js +0 -1
  246. data/app/assets/javascripts/ace/theme-clouds_midnight.js +0 -1
  247. data/app/assets/javascripts/ace/theme-cobalt.js +0 -1
  248. data/app/assets/javascripts/ace/theme-crimson_editor.js +0 -1
  249. data/app/assets/javascripts/ace/theme-dawn.js +0 -1
  250. data/app/assets/javascripts/ace/theme-dreamweaver.js +0 -1
  251. data/app/assets/javascripts/ace/theme-eclipse.js +0 -1
  252. data/app/assets/javascripts/ace/theme-github.js +0 -1
  253. data/app/assets/javascripts/ace/theme-idle_fingers.js +0 -1
  254. data/app/assets/javascripts/ace/theme-kr.js +0 -1
  255. data/app/assets/javascripts/ace/theme-merbivore.js +0 -1
  256. data/app/assets/javascripts/ace/theme-merbivore_soft.js +0 -1
  257. data/app/assets/javascripts/ace/theme-mono_industrial.js +0 -1
  258. data/app/assets/javascripts/ace/theme-monokai.js +0 -1
  259. data/app/assets/javascripts/ace/theme-pastel_on_dark.js +0 -1
  260. data/app/assets/javascripts/ace/theme-solarized_dark.js +0 -1
  261. data/app/assets/javascripts/ace/theme-solarized_light.js +0 -1
  262. data/app/assets/javascripts/ace/theme-terminal.js +0 -1
  263. data/app/assets/javascripts/ace/theme-textmate.js +0 -1
  264. data/app/assets/javascripts/ace/theme-tomorrow.js +0 -1
  265. data/app/assets/javascripts/ace/theme-tomorrow_night.js +0 -1
  266. data/app/assets/javascripts/ace/theme-tomorrow_night_blue.js +0 -1
  267. data/app/assets/javascripts/ace/theme-tomorrow_night_bright.js +0 -1
  268. data/app/assets/javascripts/ace/theme-tomorrow_night_eighties.js +0 -1
  269. data/app/assets/javascripts/ace/theme-twilight.js +0 -1
  270. data/app/assets/javascripts/ace/theme-vibrant_ink.js +0 -1
  271. data/app/assets/javascripts/ace/theme-xcode.js +0 -1
  272. data/app/assets/javascripts/ace/worker-coffee.js +0 -1
  273. data/app/assets/javascripts/ace/worker-css.js +0 -1
  274. data/app/assets/javascripts/ace/worker-javascript.js +0 -1
  275. data/app/assets/javascripts/ace/worker-json.js +0 -1
  276. data/app/assets/javascripts/ace/worker-lua.js +0 -1
  277. data/app/assets/javascripts/ace/worker-php.js +0 -1
  278. data/app/assets/javascripts/ace/worker-xquery.js +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d0ab8b11085718311aa429107facbda10a9d5a06
4
- data.tar.gz: 369a6bd0dfa66abb8ba69428354736db59551a0d
3
+ metadata.gz: 1f6c0427e4a30c1d753bcd02f46771123d83b945
4
+ data.tar.gz: 229c35d059afad3e7586d7d28cd9a34b52340288
5
5
  SHA512:
6
- metadata.gz: 6ce6ccd39153e2f66c7710d221570d25c42d815503ebee6aeee3bf04232261580f5e22b872ebc2afe60956a5aadcfb28f5c941df620029d0eba4f2ca99706ad9
7
- data.tar.gz: a2cdcbc9abe95a55cd064983a55a8fcb4461663efc542588718ac9be680c5cebdc7cef3bc3a90100505ed7d9d59828f3b2b6ca29368455b68c533ab052c39845
6
+ metadata.gz: 2448ff969ad38a466e2b04bea3a767a9b6b92575777234be1185b98bbff2a62b88c66ca92600ec84ccc2949042cc9d70388fd3c2ae9766b64b971cf34fcdbdfd
7
+ data.tar.gz: 5e8fda95465b163f34df96c0bfd8fe229852f2551bb0e9e155865aa7b6ece0d500a14e1bce20bdedd9a3c4855cacc55d91b69adff85519fc017f221177954985
data/README.md CHANGED
@@ -19,11 +19,11 @@ A "Content Block" is simply an ActiveRecord model with a Smithy inclusion (<code
19
19
  To get started, add this to your Gemfile
20
20
 
21
21
  ```ruby
22
- gem 'smithy'
22
+ gem 'smithycms'
23
23
  ```
24
24
 
25
25
  If you need basic authentication and don't want to integrate with existing auth in your system, add this to your Gemfile too:
26
- gem 'smithy-auth'
26
+ gem 'smithycms-auth'
27
27
 
28
28
  Installing the CMS is simple, you can just
29
29
 
@@ -4,10 +4,10 @@
4
4
  //= require jquery-fileupload/basic
5
5
  //= require jquery-fileupload/vendor/tmpl
6
6
  //= require bootstrap
7
- //= require ace/ace
8
- //= require ace/mode-css.js
9
- //= require ace/mode-html.js
10
- //= require ace/mode-javascript.js
11
- //= require ace/mode-liquid.js
12
- //= require ace/mode-markdown.js
7
+ //= require ace-1.1.3/ace
8
+ //= require ace-1.1.3/mode-css.js
9
+ //= require ace-1.1.3/mode-html.js
10
+ //= require ace-1.1.3/mode-javascript.js
11
+ //= require ace-1.1.3/mode-liquid.js
12
+ //= require ace-1.1.3/mode-markdown.js
13
13
  //= require_tree .
@@ -34,7 +34,7 @@ $(function() {
34
34
  var new_id = new Date().getTime();
35
35
  content = content.replace(regexp, new_id)
36
36
 
37
- $(this).parent().after(content);
37
+ $(this).parent().append(content);
38
38
  return false;
39
39
  });
40
40
 
@@ -19,6 +19,7 @@ module Smithy
19
19
  # see PageContent#content_block_attributes=
20
20
  @page_content.content_block_type = filtered_params[:content_block_type]
21
21
  @page_content.attributes = filtered_params
22
+ # @page_content.content_block_attributes = params[:page_content][:content_block_attributes] if params[:page_content][:content_block_attributes]
22
23
  @page_content.page = @page
23
24
  @page_content.save
24
25
  respond_with @page_content do |format|
@@ -32,6 +33,7 @@ module Smithy
32
33
 
33
34
  def update
34
35
  @page_content = Smithy::PageContent.find(params[:id])
36
+ # @page_content.content_block_attributes = params[:page_content][:content_block_attributes]
35
37
  @saved = @page_content.update_attributes(filtered_params)
36
38
  flash.notice = "Your content was saved" if @saved
37
39
  respond_with @page_content do |format|
@@ -78,7 +78,11 @@ module Smithy
78
78
  end
79
79
 
80
80
  def load_page_from_path
81
- @page = Page.friendly.find(page_path)
81
+ if smithy_current_user
82
+ @page = Page.friendly.find(page_path)
83
+ else
84
+ @page = Page.published.friendly.find(page_path)
85
+ end
82
86
  redirect_to @page.external_link and return false if @page.external_link?
83
87
  end
84
88
 
@@ -5,7 +5,6 @@ module Smithy
5
5
  validates_presence_of :asset
6
6
 
7
7
  belongs_to :asset
8
- has_many :page_contents, :as => :content_block, :dependent => :destroy
9
8
 
10
9
  class << self
11
10
  def content_block_description
@@ -18,6 +18,7 @@ module Smithy
18
18
  accepts_nested_attributes_for :contents, :reject_if => lambda {|a| a['label'].blank? || a['container'].blank? || a['content_block'].blank? }, :allow_destroy => true
19
19
 
20
20
  scope :included_in_navigation, -> { where("show_in_navigation=? AND published_at <= ?", true, Time.now) }
21
+ scope :published, -> { where('published_at <= ?', Time.now) }
21
22
 
22
23
  attr_accessor :publish
23
24
 
@@ -5,7 +5,7 @@ module Smithy
5
5
  validates_presence_of :label, :container, :page
6
6
 
7
7
  belongs_to :page, :touch => true
8
- belongs_to :content_block, :polymorphic => true
8
+ belongs_to :content_block, :polymorphic => true, :dependent => :destroy
9
9
  belongs_to :content_block_template
10
10
 
11
11
  before_update :set_publishable
@@ -22,6 +22,7 @@ module Smithy
22
22
  end
23
23
 
24
24
  def content_block_attributes=(attributes)
25
+ return unless attributes.present?
25
26
  klass = content_block_type.safe_constantize || "Smithy::#{content_block_type}".safe_constantize
26
27
  if klass
27
28
  self.content_block = klass.find_or_initialize_by_id(attributes.delete(:id))
@@ -5,6 +5,8 @@ module Smithy
5
5
  attributes = send("#{param.to_s}_attributes".to_sym)
6
6
  if attributes == :all
7
7
  params.fetch(param, {}).permit!
8
+ elsif attributes.respond_to? :call
9
+ attributes.call
8
10
  else
9
11
  params.fetch(param, {}).permit( *attributes )
10
12
  end
@@ -19,7 +21,8 @@ module Smithy
19
21
  end
20
22
 
21
23
  def content_block_attributes
22
- [ :name, :templates_attributes ]
24
+ # [ :name, templates_attributes: [ :id, :name, :content, :_destroy ] ]
25
+ :all
23
26
  end
24
27
 
25
28
  def content_block_template_attributes
@@ -35,7 +38,8 @@ module Smithy
35
38
  end
36
39
 
37
40
  def page_content_attributes
38
- [ :label, :container, :content_block_type, :content_block_attributes, :content_block_template_id, :position ]
41
+ # [ :label, :container, :content_block_type, :content_block_template_id, :position ]
42
+ :all
39
43
  end
40
44
 
41
45
  def page_list_attributes
@@ -1,6 +1,6 @@
1
1
  module Smithy
2
2
  class Site
3
- @@title = nil
3
+ cattr_accessor :title
4
4
 
5
5
  class << self
6
6
  def title
@@ -3,8 +3,8 @@
3
3
  <%= link_to "<img src=\"#{asset.file.thumb("170x114#").url}\" width=\"170\" height=\"114\" alt=\"\">".html_safe, asset.file.url %>
4
4
  <p class="name"><strong><%= asset.name %></strong></p>
5
5
  <div class="pull-right">
6
- <%= link_to "Edit", [:edit, asset], :class => "btn btn-mini" %>
7
- <%= link_to "Delete", asset, :class => "btn btn-mini btn-danger", :method => :delete, :confirm => "Are you sure?" %>
6
+ <%= link_to "Edit", [:edit, asset], class: "btn btn-mini" %>
7
+ <%= link_to "Delete", asset, class: "btn btn-mini btn-danger", method: :delete, data: { confirm: "Are you sure?" } %>
8
8
  </div>
9
9
  </div>
10
10
  </li>
@@ -4,9 +4,8 @@
4
4
  <%= f.input :file, :as => :file %>
5
5
  <%= f.input :retained_file, :as => :hidden %>
6
6
  <% if @asset.file %>
7
- <div>
8
- <img src="<%= @asset.file.thumb("300x300").url %>" alt="">
9
- </div>
7
+ <div><img src="<%= @asset.file.thumb("300x300").url %>" alt=""></div>
8
+ <div><%= link_to @asset.file.remote_url, @asset.file.remote_url %></div>
10
9
  <% end %>
11
10
  <% end %>
12
11
  <%= f.actions :submit %>
@@ -1,6 +1,6 @@
1
1
  <% content_for :title, "Content Blocks" %>
2
2
 
3
- <%= render :partial => "secondary_nav" %>
3
+ <%= render partial: "secondary_nav" %>
4
4
 
5
5
  <%= semantic_form_for @content_block do |f| %>
6
6
  <%= f.inputs do %>
@@ -18,14 +18,14 @@
18
18
 
19
19
  <div><%= link_to_add_fields "Add a Template", :templates, f %></div>
20
20
  <%= f.semantic_fields_for(:templates) do |builder| %>
21
- <%= render :partial => "template_fields", :locals => { :f => builder } %>
21
+ <%= render partial: "template_fields", locals: { f: builder } %>
22
22
  <% end %>
23
23
 
24
24
  <%= f.actions do %>
25
- <%= f.action :submit, :label => "Save this Content Block" %>
25
+ <%= f.action :submit, label: "Save this Content Block" %>
26
26
  <% end %>
27
27
  <% end %>
28
28
 
29
29
  <% content_for :related do %>
30
- <p><%= link_to "Delete Content Block", @content_block, :method => :delete, :confirm => "Are you sure you want to delete this Content Block?", :class => 'btn btn-danger' %></p>
30
+ <p><%= link_to "Delete Content Block", @content_block, method: :delete, data: { confirm: "Are you sure you want to delete this Content Block?" }, class: 'btn btn-danger' %></p>
31
31
  <% end %>
@@ -9,5 +9,5 @@
9
9
 
10
10
 
11
11
  <% content_for :related do %>
12
- <%= content_tag :p, link_to("Delete #{klass_name}", @record, :method => :delete, :confirm => "Are you sure you want to delete this #{klass_name}?", :class => 'btn btn-danger') if @record.persisted? %></p>
12
+ <%= content_tag :p, link_to("Delete #{klass_name}", @record, method: :delete, data: { confirm: "Are you sure you want to delete this #{klass_name}?" }, class: 'btn btn-danger') if @record.persisted? %></p>
13
13
  <% end %>
@@ -2,9 +2,12 @@
2
2
  <%= f.input :asset, :collection => Smithy::Asset.order(:name) %>
3
3
  <%= f.input :alternate_text %>
4
4
  <% end %>
5
+ <%= f.inputs "Linked Image (optional)" do %>
6
+ <%= f.input :link_url %>
7
+ <% end %>
5
8
  <%= f.inputs "Content (optional)" do %>
6
9
  <%= f.input :content, :as => :text, :input_html => { :class => "span12", :id => "image_content-#{f.object.id || 'new'}" }, :hint => "Use markdown syntax for formatting. You can also use HTML directly. <a href=\"#{guide_path('markdown')}\" data-toggle=\"remote-load\" data-target=\"#content-guide\">See our markdown syntax reference</a>".html_safe %>
7
- <div id="image_content_editor-<%= f.object.id || 'new' %>" class="image_content_editor"></div>
10
+ <div id="image_content_editor-<%= f.object.id || 'new' %>" class="ace_editor"></div>
8
11
  <div id="content-guide"></div>
9
12
  <% end %>
10
13
 
@@ -20,9 +23,6 @@
20
23
  <%= f.input :height %>
21
24
  <%= f.input :image_scaling, :as => :select, :collection => Smithy::Image.image_scaling_options %>
22
25
  <% end %>
23
- <%= f.inputs "Linked Image (optional)" do %>
24
- <%= f.input :link_url %>
25
- <% end %>
26
26
  <%= f.inputs "HTML Attributes (optional)" do %>
27
27
  <%= f.input :html_attributes %>
28
28
  <% end %>
@@ -5,20 +5,20 @@
5
5
  <%= content_tag_for :tr, page_content do %>
6
6
  <td>
7
7
  <i class="icon-reorder handle"></i>
8
- <%= link_to "edit", edit_page_content_path(@page.id, page_content), :class => "btn btn-small btn-primary" %>
8
+ <%= link_to "edit", edit_page_content_path(@page.id, page_content), class: "btn btn-small btn-primary" %>
9
9
  </td>
10
10
  <td><strong><%= page_content.label %></strong></td>
11
11
  <td><%= page_content.content_block_type.demodulize %></td>
12
12
  <td><%= page_content.updated_at.strftime('%b %e, %Y %H:%M:%S') %></td>
13
13
  <td>
14
14
  <div class="pull-right">
15
- <%= link_to "preview", preview_page_content_path(@page.id, page_content), :class => "btn btn-small", "data-previewtoggle" => "modal" %>
16
- <%= link_to "<i class=\"icon-trash\"></i> delete".html_safe, page_content_path(@page.id, page_content), :method => :delete, :confirm => "Do you really want to delete this content?", :class => "btn btn-small btn-danger" %>
15
+ <%= link_to "preview", preview_page_content_path(@page.id, page_content), class: "btn btn-small", data: { previewtoggle: "modal" } %>
16
+ <%= link_to "<i class=\"icon-trash\"></i> delete".html_safe, page_content_path(@page.id, page_content), method: :delete, data: { confirm: "Do you really want to delete this content?" }, class: "btn btn-small btn-danger" %>
17
17
  </div>
18
18
  </td>
19
19
  <% end %>
20
20
  <% end %>
21
21
  </table>
22
- <div><%= link_to "Add to #{container.display_name}", new_page_content_path(@page.id, :page_content => { :container => container.name }), :class => "btn btn-primary btn-small" %></div>
22
+ <div><%= link_to "Add to #{container.display_name}", new_page_content_path(@page.id, page_content: { container: container.name }), class: "btn btn-primary btn-small" %></div>
23
23
  <% end %>
24
24
  </div>
@@ -17,5 +17,6 @@
17
17
  </dl>
18
18
  </div>
19
19
 
20
- <%= content_tag :p, link_to("Delete Page", page_path(@page.id), :method => :delete, :confirm => "Are you sure you want to delete this page?", :class => 'btn btn-danger') if @page.persisted? %></p>
20
+ <%= content_tag :p, link_to("View Page", @page.path, class: 'btn btn-primary') if @page.persisted? && @page.published? %></p>
21
+ <%= content_tag :p, link_to("Delete Page", page_path(@page.id), method: :delete, data: { confirm: "Are you sure you want to delete this page?" }, class: 'btn btn-danger') if @page.persisted? %></p>
21
22
  <% end %>
@@ -2,5 +2,5 @@
2
2
  <dd>
3
3
  <%= setting.value %>
4
4
  <%= link_to "edit", [:edit, setting], :class => 'btn btn-mini' %>
5
- <%= link_to "delete", setting, :class => 'btn btn-mini btn-danger', :confirm => "Are you sure?", :method => :delete %>
5
+ <%= link_to "delete", setting, class: 'btn btn-mini btn-danger', data: { confirm: "Are you sure?" }, method: :delete %>
6
6
  </dd>
@@ -5,7 +5,7 @@
5
5
 
6
6
  <%= semantic_form_for @template do |f| %>
7
7
  <%= f.inputs do %>
8
- <%= f.input :content, :label => "Template Content", :input_html => { :id => "template_content-#{@template.id}" } %>
8
+ <%= f.input :content, :label => "Template Content", input_html: { id: "template_content-#{@template.id}" } %>
9
9
  <div id="template_content_editor-<%= @template.id %>" class="template_content_editor"></div>
10
10
  <% end %>
11
11
  <%= f.actions do %>
@@ -32,5 +32,5 @@
32
32
  </div>
33
33
  <% end %>
34
34
 
35
- <p><%= link_to "Delete #{@template.template_type.capitalize}", @template, :method => :delete, :confirm => "Are you sure you want to delete this #{@template.template_type}?", :class => 'btn btn-danger' %></p>
35
+ <p><%= link_to "Delete #{@template.template_type.capitalize}", @template, method: :delete, data: { confirm: "Are you sure you want to delete this #{@template.template_type}?" }, class: 'btn btn-danger' %></p>
36
36
  <% end %>
@@ -10,7 +10,7 @@ Dragonfly.app.configure do
10
10
  convert_command = `which convert`.strip.presence || "/usr/local/bin/convert"
11
11
  identify_command = `which identify`.strip.presence || "/usr/local/bin/identify"
12
12
 
13
- url_format '/uploads/assets/:job/:basename.:format'
13
+ url_format '/uploads/assets/:job/:name'
14
14
 
15
15
  datastore Smithy::Asset.dragonfly_datastore
16
16
  end
@@ -3,7 +3,8 @@ module Smithy
3
3
  module Model
4
4
  extend ActiveSupport::Concern
5
5
  included do
6
- has_many :page_contents, :as => :content_block
6
+ has_many :page_contents, :as => :content_block, class_name: '::Smithy::PageContent'
7
+ has_many :pages, through: :page_contents, class_name: '::Smithy::Page'
7
8
  Smithy::ContentBlocks::Registry.register self
8
9
  end
9
10
 
@@ -16,6 +16,10 @@ module Smithy
16
16
  self._source.children.map(&:to_liquid)
17
17
  end
18
18
 
19
+ def nav_children
20
+ self._source.children.included_in_navigation.map(&:to_liquid)
21
+ end
22
+
19
23
  def container
20
24
  self.rendered_containers
21
25
  end
@@ -28,6 +32,20 @@ module Smithy
28
32
  self._source.keywords
29
33
  end
30
34
 
35
+ def next
36
+ sibling = if self._source.leaf?
37
+ self._source.right_sibling
38
+ elsif self._source.children.size
39
+ self._source.children.first
40
+ end
41
+ sibling ||= self._source.parent.right_sibling
42
+ sibling.to_liquid
43
+ end
44
+
45
+ def next_sibling
46
+ self._source.right_sibling.to_liquid
47
+ end
48
+
31
49
  def parent
32
50
  self._source.parent.to_liquid
33
51
  end
@@ -36,6 +54,20 @@ module Smithy
36
54
  self._source.url
37
55
  end
38
56
 
57
+ def previous
58
+ sibling = if self._source.left_sibling && self._source.left_sibling.leaf?
59
+ self._source.left_sibling
60
+ elsif self._source.left_sibling && self._source.left_sibling.children.size
61
+ self._source.left_sibling.children.last
62
+ end
63
+ sibling ||= self._source.parent
64
+ sibling.to_liquid
65
+ end
66
+
67
+ def previous_sibling
68
+ sibling = self._source.left_sibling.to_liquid
69
+ end
70
+
39
71
  def published?
40
72
  self._source.published?
41
73
  end
@@ -3,8 +3,8 @@ module Smithy
3
3
  module Filters
4
4
  module AssetTag
5
5
  def image_tag(input, *args)
6
- image_options = inline_options(args_to_options(args))
7
- "<img src=\"#{input}\" #{image_options}>"
6
+ image_options = args_to_options(args)
7
+ controller.view_context.send(:image_tag, input, image_options)
8
8
  end
9
9
 
10
10
  protected
@@ -20,6 +20,14 @@ module Smithy
20
20
  options
21
21
  end
22
22
 
23
+ def context
24
+ context = self.instance_variable_get(:@context)
25
+ end
26
+
27
+ def controller
28
+ context.registers[:controller]
29
+ end
30
+
23
31
  # Write options (Hash) into a string according to the following pattern:
24
32
  # <key1>="<value1>", <key2>="<value2", ...etc
25
33
  def inline_options(options = {})
@@ -3,7 +3,7 @@ module Smithy
3
3
  module Filters
4
4
  module Resize
5
5
  def resize(input, resize_string)
6
- Locomotive::Dragonfly.resize_url(input, resize_string)
6
+ Smithy::Dragonfly.resize_url(input, resize_string)
7
7
  end
8
8
  end
9
9
  ::Liquid::Template.register_filter(Resize)
@@ -4,17 +4,21 @@ module Smithy
4
4
  class Nav < ::Liquid::Tag
5
5
  Syntax = /(#{::Liquid::Expression}+)?/
6
6
 
7
- # {% nav site|page, id: 'main-nav', depth: 1, class: 'nav', active_class: 'on' }
7
+ # {% nav %} is equivalent to
8
+ # {% nav site, depth: 1, id: 'nav', class: '', wrapper: true, active_class: 'on', include_root: 'true'}
9
+ # {% nav site|site-section|page|section %}
8
10
  def initialize(tag_name, markup, tokens)
9
- @options = { :id => 'nav', :depth => 1, :class => '', :active_class => 'on' }
11
+ @options = { :id => 'nav', :depth => 1, :class => '', :active_class => 'on', :include_root => false }
10
12
  if markup =~ Syntax
11
13
  @source = ($1 || 'site').gsub(/"|'/, '')
12
14
  markup.scan(::Liquid::TagAttributes) do |key, value|
13
15
  @options[key.to_sym] = value.gsub(/"|'/, '')
14
16
  end
17
+ @options[:active_nested_class] = 'in'
15
18
  @options[:depth] = @options[:depth].to_i
16
19
  @options[:depth] = 100 if @options[:depth] == 0
17
- @options[:wrapper] == "false" ? false : true
20
+ @options[:wrapper] = @options[:wrapper] == "false" ? false : true
21
+ @options[:include_root] = @options[:include_root] == "true" ? true : false
18
22
  else
19
23
  raise ::Liquid::SyntaxError.new("Syntax Error in 'nav' - Valid syntax: nav <site|page|section> <options>")
20
24
  end
@@ -29,7 +33,8 @@ module Smithy
29
33
  @site = context.registers[:site]
30
34
  @page = context.registers[:page]
31
35
  @controller = context.registers[:controller]
32
- render_wrapper(render_list_items(root_node, 1), @options[:id])
36
+ list_items = render_list_items(root_node)
37
+ @options[:wrapper] ? render_wrapper(list_items, @options[:id]) : list_items
33
38
  end
34
39
 
35
40
  def render_children(parent, depth)
@@ -43,12 +48,15 @@ module Smithy
43
48
  href = item.url
44
49
  label = item.title
45
50
  css_class = " class=\"#{@options[:active_class]}\"" if (@page && @page.id == item.id) || (@controller && [item.path, item.external_link].include?(@controller.request.path))
51
+ css_class ||= " class=\"#{@options[:active_nested_class]}\"" if @page && @page.ancestors.include?(item)
46
52
  %Q{#{" " * depth}<li id="#{item_id}"#{css_class}><a href="#{href}" id="#{item_id}-link">#{label}</a>#{render_children(item, depth.succ)}</li>}
47
53
  end
48
54
 
49
- def render_list_items(parent, depth)
50
- return if depth > @options[:depth] || parent.leaf?
51
- parent.children.included_in_navigation.inject([]) do |items, item|
55
+ def render_list_items(parent, depth=1)
56
+ return unless write_child_list_items?(parent, depth)
57
+ items = []
58
+ items << render_list_item(parent, depth) if depth == 1 && @options[:include_root]
59
+ parent.children.included_in_navigation.inject(items) do |items, item|
52
60
  items << render_list_item(item, depth)
53
61
  end.join("\n")
54
62
  end
@@ -60,7 +68,7 @@ module Smithy
60
68
 
61
69
  def root_node
62
70
  case @source
63
- when 'site'
71
+ when 'site', 'site-section'
64
72
  Smithy::Page.root
65
73
  when 'page'
66
74
  @page
@@ -69,6 +77,13 @@ module Smithy
69
77
  end
70
78
  end
71
79
 
80
+ private
81
+ def write_child_list_items?(parent, depth)
82
+ return false unless parent.present? && !parent.leaf?
83
+ return true if @source == 'site-section' && @page.self_and_ancestors.include?(parent)
84
+ depth > @options[:depth] ? false : true
85
+ end
86
+
72
87
  end
73
88
  ::Liquid::Template.register_tag('nav', Nav)
74
89
  end
@@ -1,3 +1,3 @@
1
1
  module Smithy
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end