qwerty 0.0.1.pre → 0.0.3.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (338) hide show
  1. data/README.rdoc +20 -6
  2. data/app/controllers/documents_controller.rb +20 -1
  3. data/app/controllers/qwerty_admin/base_controller.rb +5 -4
  4. data/app/controllers/qwerty_base_controller.rb +6 -3
  5. data/app/helpers/documents_helper.rb +1 -1
  6. data/app/models/document.rb +8 -3
  7. data/app/views/cms/show.html.erb +4 -0
  8. data/app/views/kaminari/twitter/_first_page.html.erb +13 -0
  9. data/app/views/kaminari/twitter/_gap.html.erb +11 -0
  10. data/app/views/kaminari/twitter/_last_page.html.erb +3 -0
  11. data/app/views/kaminari/twitter/_next_page.html.erb +3 -0
  12. data/app/views/kaminari/twitter/_page.html.erb +5 -0
  13. data/app/views/kaminari/twitter/_paginator.html.erb +17 -0
  14. data/app/views/kaminari/twitter/_prev_page.html.erb +12 -0
  15. data/app/views/layouts/qwerty_admin.html.erb +0 -1
  16. data/app/views/qwerty_admin/documents/_document.html.erb +4 -2
  17. data/app/views/qwerty_admin/documents/_form.html.erb +1 -1
  18. data/app/views/qwerty_admin/documents/index.html.erb +3 -3
  19. data/app/views/qwerty_admin/documents/show.html.erb +6 -2
  20. data/app/views/qwerty_admin/nodes/_node.html.erb +2 -2
  21. data/config/routes.rb +2 -2
  22. data/db/migrate/20110909144300_create_documents.rb +1 -1
  23. data/lib/generators/qwerty/copy_views/copy_views_generator.rb +10 -0
  24. data/lib/generators/qwerty/create_document_views/create_document_views_generator.rb +18 -0
  25. data/lib/generators/qwerty/create_document_views/templates/show.html.erb +22 -0
  26. data/lib/generators/qwerty/install/install_generator.rb +24 -0
  27. data/lib/generators/qwerty/install/templates/README +30 -0
  28. data/lib/generators/qwerty/install/templates/qwerty.rb +34 -0
  29. data/lib/generators/qwerty/install/templates/sitemap.rb +39 -0
  30. data/lib/qwerty/engine.rb +0 -1
  31. data/lib/qwerty/version.rb +1 -1
  32. data/lib/qwerty.rb +40 -3
  33. data/lib/tasks/qwerty_tasks.rake +9 -2
  34. data/test/dummy/app/views/cms/blog.html.erb +10 -0
  35. data/test/dummy/config/sitemap.rb +4 -4
  36. data/test/dummy/db/schema.rb +1 -15
  37. data/test/dummy/log/development.log +31645 -0
  38. data/test/dummy/tmp/dragonfly/cache/meta/08/583d3580bdba862155e60de9a00668e59daf9a +0 -0
  39. data/test/dummy/tmp/dragonfly/cache/meta/09/828a2e2227c8ee400355ae1a23ad2bd790141d +0 -0
  40. data/test/dummy/tmp/dragonfly/cache/meta/0d/3d65cfd83d3144d664a407c58772a9af580f2c +0 -0
  41. data/test/dummy/tmp/dragonfly/cache/meta/1f/f07ad344a1cb0b8ec31186f4dc9db0839ad627 +0 -0
  42. data/test/dummy/tmp/dragonfly/cache/meta/31/2c7a5054f251c184a219299e46d5dd6f0730cd +0 -0
  43. data/test/dummy/tmp/dragonfly/cache/meta/33/fd8b6a50207f556064a867cd45a5a913fc39e6 +0 -0
  44. data/test/dummy/tmp/dragonfly/cache/meta/36/a1e2bafc0b1be17cdfbcc85af2c1ddbdc97274 +0 -0
  45. data/test/dummy/tmp/dragonfly/cache/meta/51/d20274bbbbb01e6fa7dcdd39776bfb0a001dda +0 -0
  46. data/test/dummy/tmp/dragonfly/cache/meta/5b/4beef5209ea5ca056828b4b61d413f586dc689 +0 -0
  47. data/test/dummy/tmp/dragonfly/cache/meta/5e/f7d5756119e2b71e82ea878824891efc8d4e98 +0 -0
  48. data/test/dummy/tmp/dragonfly/cache/meta/64/41ffd938beeeae87f4cb84ed8cc2dc89d7ebc0 +0 -0
  49. data/test/dummy/tmp/dragonfly/cache/meta/66/4c2f6718656261fba53eae83feecda49a4fe27 +0 -0
  50. data/test/dummy/tmp/dragonfly/cache/meta/66/f44aba1428593600ff0e47ea6aa54362e39a59 +0 -0
  51. data/test/dummy/tmp/dragonfly/cache/meta/6c/e61baa71dc8133c47f88feebb2dc25158461f0 +0 -0
  52. data/test/dummy/tmp/dragonfly/cache/meta/6d/d387d4d65cd8d6d331d45659f28626df019f06 +0 -0
  53. data/test/dummy/tmp/dragonfly/cache/meta/75/868cd14b8d420dcd4ef44afcd20722ad7a1c3f +0 -0
  54. data/test/dummy/tmp/dragonfly/cache/meta/77/08cd91d09e6cc0e0393e02a0fb2e0205cf34af +0 -0
  55. data/test/dummy/tmp/dragonfly/cache/meta/77/89d929429830411758a64c37875ee16224640d +0 -0
  56. data/test/dummy/tmp/dragonfly/cache/meta/7c/14b32e4e029b0200d54b210b4148be0349e72c +0 -0
  57. data/test/dummy/tmp/dragonfly/cache/meta/7f/0b8b6f8f34b458916f99a528f4cab40107490d +0 -0
  58. data/test/dummy/tmp/dragonfly/cache/meta/80/5841ac20acdd8dd41460c8346294abc5c4dd8f +0 -0
  59. data/test/dummy/tmp/dragonfly/cache/meta/81/5c4edaf06b6f561037f8424878bc479644cfe2 +0 -0
  60. data/test/dummy/tmp/dragonfly/cache/meta/87/6f1ac29d9a3be64d8ec07d988ee2f7e9210a8c +0 -0
  61. data/test/dummy/tmp/dragonfly/cache/meta/9b/1e5d2a62e4e1c014350ded8b89e08731e51e12 +0 -0
  62. data/test/dummy/tmp/dragonfly/cache/meta/a0/ca7d61a5e5763e257e13dcbc2b0f11abfd607c +0 -0
  63. data/test/dummy/tmp/dragonfly/cache/meta/a6/415b21bb312e94f5386bebaf0b9dd96f102a4c +0 -0
  64. data/test/dummy/tmp/dragonfly/cache/meta/ae/67c778b4cac5a750af11726e141b1c44969772 +0 -0
  65. data/test/dummy/tmp/dragonfly/cache/meta/bc/3d6a023e30186fa647759d74acd8538ec159d9 +0 -0
  66. data/test/dummy/tmp/dragonfly/cache/meta/c2/630081ff80175138d240306b29a05a5557fe32 +0 -0
  67. data/test/dummy/tmp/dragonfly/cache/meta/df/91db539ca547413619d0dadb1e773568d66321 +0 -0
  68. data/test/dummy/tmp/dragonfly/cache/meta/e7/6a8134e4f01b53cb7ab6551c68f0c44faac748 +0 -0
  69. data/test/dummy/tmp/dragonfly/cache/meta/ee/fe74949a8c2a0bbc077385a12944d9f98a12e0 +0 -0
  70. data/test/dummy/tmp/dragonfly/cache/meta/ef/f08311365a487d92cc4a5a33a327b00fa4a576 +0 -0
  71. data/test/dummy/tmp/dragonfly/cache/meta/f9/67ac04386c59253bd80f4034d18af166cc5691 +0 -0
  72. data/test/dummy/tmp/dragonfly/cache/meta/ff/d5f8f0d3f33df0282fc5c47f8761d3f328806c +0 -0
  73. metadata +67 -324
  74. data/app/assets/javascripts/ckeditor/CHANGES.html +0 -1433
  75. data/app/assets/javascripts/ckeditor/INSTALL.html +0 -92
  76. data/app/assets/javascripts/ckeditor/LICENSE.html +0 -1327
  77. data/app/assets/javascripts/ckeditor/adapters/jquery.js +0 -6
  78. data/app/assets/javascripts/ckeditor/ckeditor.js +0 -149
  79. data/app/assets/javascripts/ckeditor/ckeditor.pack +0 -211
  80. data/app/assets/javascripts/ckeditor/ckeditor_basic.js +0 -8
  81. data/app/assets/javascripts/ckeditor/ckeditor_basic_source.js +0 -20
  82. data/app/assets/javascripts/ckeditor/ckeditor_source.js +0 -35
  83. data/app/assets/javascripts/ckeditor/config.js +0 -78
  84. data/app/assets/javascripts/ckeditor/contents.css +0 -25
  85. data/app/assets/javascripts/ckeditor/filebrowser/images/gal_add.jpg +0 -0
  86. data/app/assets/javascripts/ckeditor/filebrowser/images/gal_add.png +0 -0
  87. data/app/assets/javascripts/ckeditor/filebrowser/images/gal_del.png +0 -0
  88. data/app/assets/javascripts/ckeditor/filebrowser/images/gal_more.gif +0 -0
  89. data/app/assets/javascripts/ckeditor/filebrowser/images/preloader.gif +0 -0
  90. data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/ckfnothumb.gif +0 -0
  91. data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/mp3.gif +0 -0
  92. data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/pdf.gif +0 -0
  93. data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/rar.gif +0 -0
  94. data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/swf.gif +0 -0
  95. data/app/assets/javascripts/ckeditor/filebrowser/images/thumbs/xls.gif +0 -0
  96. data/app/assets/javascripts/ckeditor/filebrowser/javascripts/application.js +0 -222
  97. data/app/assets/javascripts/ckeditor/filebrowser/javascripts/fileuploader.js +0 -1301
  98. data/app/assets/javascripts/ckeditor/filebrowser/javascripts/jquery.js +0 -18
  99. data/app/assets/javascripts/ckeditor/filebrowser/javascripts/jquery.tmpl.js +0 -10
  100. data/app/assets/javascripts/ckeditor/filebrowser/javascripts/rails.js +0 -363
  101. data/app/assets/javascripts/ckeditor/filebrowser/stylesheets/uploader.css +0 -117
  102. data/app/assets/javascripts/ckeditor/images/spacer.gif +0 -0
  103. data/app/assets/javascripts/ckeditor/lang/_languages.js +0 -6
  104. data/app/assets/javascripts/ckeditor/lang/_translationstatus.txt +0 -61
  105. data/app/assets/javascripts/ckeditor/lang/af.js +0 -6
  106. data/app/assets/javascripts/ckeditor/lang/ar.js +0 -6
  107. data/app/assets/javascripts/ckeditor/lang/bg.js +0 -6
  108. data/app/assets/javascripts/ckeditor/lang/bn.js +0 -6
  109. data/app/assets/javascripts/ckeditor/lang/bs.js +0 -6
  110. data/app/assets/javascripts/ckeditor/lang/ca.js +0 -6
  111. data/app/assets/javascripts/ckeditor/lang/cs.js +0 -6
  112. data/app/assets/javascripts/ckeditor/lang/cy.js +0 -6
  113. data/app/assets/javascripts/ckeditor/lang/da.js +0 -6
  114. data/app/assets/javascripts/ckeditor/lang/de.js +0 -6
  115. data/app/assets/javascripts/ckeditor/lang/el.js +0 -6
  116. data/app/assets/javascripts/ckeditor/lang/en-au.js +0 -6
  117. data/app/assets/javascripts/ckeditor/lang/en-ca.js +0 -6
  118. data/app/assets/javascripts/ckeditor/lang/en-gb.js +0 -6
  119. data/app/assets/javascripts/ckeditor/lang/en.js +0 -6
  120. data/app/assets/javascripts/ckeditor/lang/eo.js +0 -6
  121. data/app/assets/javascripts/ckeditor/lang/es.js +0 -6
  122. data/app/assets/javascripts/ckeditor/lang/et.js +0 -6
  123. data/app/assets/javascripts/ckeditor/lang/eu.js +0 -6
  124. data/app/assets/javascripts/ckeditor/lang/fa.js +0 -6
  125. data/app/assets/javascripts/ckeditor/lang/fi.js +0 -6
  126. data/app/assets/javascripts/ckeditor/lang/fo.js +0 -6
  127. data/app/assets/javascripts/ckeditor/lang/fr-ca.js +0 -6
  128. data/app/assets/javascripts/ckeditor/lang/fr.js +0 -6
  129. data/app/assets/javascripts/ckeditor/lang/gl.js +0 -6
  130. data/app/assets/javascripts/ckeditor/lang/gu.js +0 -6
  131. data/app/assets/javascripts/ckeditor/lang/he.js +0 -6
  132. data/app/assets/javascripts/ckeditor/lang/hi.js +0 -6
  133. data/app/assets/javascripts/ckeditor/lang/hr.js +0 -6
  134. data/app/assets/javascripts/ckeditor/lang/hu.js +0 -6
  135. data/app/assets/javascripts/ckeditor/lang/is.js +0 -6
  136. data/app/assets/javascripts/ckeditor/lang/it.js +0 -6
  137. data/app/assets/javascripts/ckeditor/lang/ja.js +0 -6
  138. data/app/assets/javascripts/ckeditor/lang/ka.js +0 -6
  139. data/app/assets/javascripts/ckeditor/lang/km.js +0 -6
  140. data/app/assets/javascripts/ckeditor/lang/ko.js +0 -6
  141. data/app/assets/javascripts/ckeditor/lang/lt.js +0 -6
  142. data/app/assets/javascripts/ckeditor/lang/lv.js +0 -6
  143. data/app/assets/javascripts/ckeditor/lang/mn.js +0 -6
  144. data/app/assets/javascripts/ckeditor/lang/ms.js +0 -6
  145. data/app/assets/javascripts/ckeditor/lang/nb.js +0 -6
  146. data/app/assets/javascripts/ckeditor/lang/nl.js +0 -6
  147. data/app/assets/javascripts/ckeditor/lang/no.js +0 -6
  148. data/app/assets/javascripts/ckeditor/lang/pl.js +0 -6
  149. data/app/assets/javascripts/ckeditor/lang/pt-br.js +0 -6
  150. data/app/assets/javascripts/ckeditor/lang/pt.js +0 -6
  151. data/app/assets/javascripts/ckeditor/lang/ro.js +0 -6
  152. data/app/assets/javascripts/ckeditor/lang/ru.js +0 -6
  153. data/app/assets/javascripts/ckeditor/lang/sk.js +0 -6
  154. data/app/assets/javascripts/ckeditor/lang/sl.js +0 -6
  155. data/app/assets/javascripts/ckeditor/lang/sr-latn.js +0 -6
  156. data/app/assets/javascripts/ckeditor/lang/sr.js +0 -6
  157. data/app/assets/javascripts/ckeditor/lang/sv.js +0 -6
  158. data/app/assets/javascripts/ckeditor/lang/th.js +0 -6
  159. data/app/assets/javascripts/ckeditor/lang/tr.js +0 -6
  160. data/app/assets/javascripts/ckeditor/lang/uk.js +0 -6
  161. data/app/assets/javascripts/ckeditor/lang/vi.js +0 -6
  162. data/app/assets/javascripts/ckeditor/lang/zh-cn.js +0 -6
  163. data/app/assets/javascripts/ckeditor/lang/zh.js +0 -6
  164. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/dialogs/a11yhelp.js +0 -7
  165. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/lang/en.js +0 -6
  166. data/app/assets/javascripts/ckeditor/plugins/a11yhelp/lang/he.js +0 -6
  167. data/app/assets/javascripts/ckeditor/plugins/about/dialogs/about.js +0 -6
  168. data/app/assets/javascripts/ckeditor/plugins/about/dialogs/logo_ckeditor.png +0 -0
  169. data/app/assets/javascripts/ckeditor/plugins/adobeair/plugin.js +0 -6
  170. data/app/assets/javascripts/ckeditor/plugins/ajax/plugin.js +0 -6
  171. data/app/assets/javascripts/ckeditor/plugins/attachment/dialogs/attachment.js +0 -1
  172. data/app/assets/javascripts/ckeditor/plugins/attachment/images/attachment.png +0 -0
  173. data/app/assets/javascripts/ckeditor/plugins/attachment/lang/en.js +0 -10
  174. data/app/assets/javascripts/ckeditor/plugins/attachment/lang/ru.js +0 -10
  175. data/app/assets/javascripts/ckeditor/plugins/attachment/lang/uk.js +0 -10
  176. data/app/assets/javascripts/ckeditor/plugins/attachment/plugin.js +0 -1
  177. data/app/assets/javascripts/ckeditor/plugins/autogrow/plugin.js +0 -6
  178. data/app/assets/javascripts/ckeditor/plugins/bbcode/plugin.js +0 -9
  179. data/app/assets/javascripts/ckeditor/plugins/clipboard/dialogs/paste.js +0 -7
  180. data/app/assets/javascripts/ckeditor/plugins/colordialog/dialogs/colordialog.js +0 -7
  181. data/app/assets/javascripts/ckeditor/plugins/devtools/lang/en.js +0 -6
  182. data/app/assets/javascripts/ckeditor/plugins/devtools/plugin.js +0 -6
  183. data/app/assets/javascripts/ckeditor/plugins/dialog/dialogDefinition.js +0 -4
  184. data/app/assets/javascripts/ckeditor/plugins/div/dialogs/div.js +0 -8
  185. data/app/assets/javascripts/ckeditor/plugins/docprops/dialogs/docprops.js +0 -10
  186. data/app/assets/javascripts/ckeditor/plugins/docprops/plugin.js +0 -6
  187. data/app/assets/javascripts/ckeditor/plugins/embed/dialogs/embed.js +0 -1
  188. data/app/assets/javascripts/ckeditor/plugins/embed/images/embed.png +0 -0
  189. data/app/assets/javascripts/ckeditor/plugins/embed/lang/en.js +0 -9
  190. data/app/assets/javascripts/ckeditor/plugins/embed/lang/ru.js +0 -9
  191. data/app/assets/javascripts/ckeditor/plugins/embed/lang/uk.js +0 -9
  192. data/app/assets/javascripts/ckeditor/plugins/embed/plugin.js +0 -1
  193. data/app/assets/javascripts/ckeditor/plugins/find/dialogs/find.js +0 -10
  194. data/app/assets/javascripts/ckeditor/plugins/flash/dialogs/flash.js +0 -9
  195. data/app/assets/javascripts/ckeditor/plugins/flash/images/placeholder.png +0 -0
  196. data/app/assets/javascripts/ckeditor/plugins/forms/dialogs/button.js +0 -6
  197. data/app/assets/javascripts/ckeditor/plugins/forms/dialogs/checkbox.js +0 -6
  198. data/app/assets/javascripts/ckeditor/plugins/forms/dialogs/form.js +0 -6
  199. data/app/assets/javascripts/ckeditor/plugins/forms/dialogs/hiddenfield.js +0 -6
  200. data/app/assets/javascripts/ckeditor/plugins/forms/dialogs/radio.js +0 -6
  201. data/app/assets/javascripts/ckeditor/plugins/forms/dialogs/select.js +0 -9
  202. data/app/assets/javascripts/ckeditor/plugins/forms/dialogs/textarea.js +0 -6
  203. data/app/assets/javascripts/ckeditor/plugins/forms/dialogs/textfield.js +0 -6
  204. data/app/assets/javascripts/ckeditor/plugins/forms/images/hiddenfield.gif +0 -0
  205. data/app/assets/javascripts/ckeditor/plugins/iframe/dialogs/iframe.js +0 -7
  206. data/app/assets/javascripts/ckeditor/plugins/iframe/images/placeholder.png +0 -0
  207. data/app/assets/javascripts/ckeditor/plugins/iframedialog/plugin.js +0 -6
  208. data/app/assets/javascripts/ckeditor/plugins/image/dialogs/image.js +0 -13
  209. data/app/assets/javascripts/ckeditor/plugins/link/dialogs/anchor.js +0 -6
  210. data/app/assets/javascripts/ckeditor/plugins/link/dialogs/link.js +0 -12
  211. data/app/assets/javascripts/ckeditor/plugins/link/images/anchor.gif +0 -0
  212. data/app/assets/javascripts/ckeditor/plugins/liststyle/dialogs/liststyle.js +0 -7
  213. data/app/assets/javascripts/ckeditor/plugins/pagebreak/images/pagebreak.gif +0 -0
  214. data/app/assets/javascripts/ckeditor/plugins/pastefromword/filter/default.js +0 -11
  215. data/app/assets/javascripts/ckeditor/plugins/pastetext/dialogs/pastetext.js +0 -6
  216. data/app/assets/javascripts/ckeditor/plugins/placeholder/dialogs/placeholder.js +0 -6
  217. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/en.js +0 -6
  218. data/app/assets/javascripts/ckeditor/plugins/placeholder/lang/he.js +0 -6
  219. data/app/assets/javascripts/ckeditor/plugins/placeholder/placeholder.gif +0 -0
  220. data/app/assets/javascripts/ckeditor/plugins/placeholder/plugin.js +0 -6
  221. data/app/assets/javascripts/ckeditor/plugins/scayt/dialogs/options.js +0 -8
  222. data/app/assets/javascripts/ckeditor/plugins/scayt/dialogs/toolbar.css +0 -6
  223. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_address.png +0 -0
  224. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_blockquote.png +0 -0
  225. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_div.png +0 -0
  226. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_h1.png +0 -0
  227. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_h2.png +0 -0
  228. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_h3.png +0 -0
  229. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_h4.png +0 -0
  230. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_h5.png +0 -0
  231. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_h6.png +0 -0
  232. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_p.png +0 -0
  233. data/app/assets/javascripts/ckeditor/plugins/showblocks/images/block_pre.png +0 -0
  234. data/app/assets/javascripts/ckeditor/plugins/smiley/dialogs/smiley.js +0 -7
  235. data/app/assets/javascripts/ckeditor/plugins/smiley/images/angel_smile.gif +0 -0
  236. data/app/assets/javascripts/ckeditor/plugins/smiley/images/angry_smile.gif +0 -0
  237. data/app/assets/javascripts/ckeditor/plugins/smiley/images/broken_heart.gif +0 -0
  238. data/app/assets/javascripts/ckeditor/plugins/smiley/images/confused_smile.gif +0 -0
  239. data/app/assets/javascripts/ckeditor/plugins/smiley/images/cry_smile.gif +0 -0
  240. data/app/assets/javascripts/ckeditor/plugins/smiley/images/devil_smile.gif +0 -0
  241. data/app/assets/javascripts/ckeditor/plugins/smiley/images/embaressed_smile.gif +0 -0
  242. data/app/assets/javascripts/ckeditor/plugins/smiley/images/envelope.gif +0 -0
  243. data/app/assets/javascripts/ckeditor/plugins/smiley/images/heart.gif +0 -0
  244. data/app/assets/javascripts/ckeditor/plugins/smiley/images/kiss.gif +0 -0
  245. data/app/assets/javascripts/ckeditor/plugins/smiley/images/lightbulb.gif +0 -0
  246. data/app/assets/javascripts/ckeditor/plugins/smiley/images/omg_smile.gif +0 -0
  247. data/app/assets/javascripts/ckeditor/plugins/smiley/images/regular_smile.gif +0 -0
  248. data/app/assets/javascripts/ckeditor/plugins/smiley/images/sad_smile.gif +0 -0
  249. data/app/assets/javascripts/ckeditor/plugins/smiley/images/shades_smile.gif +0 -0
  250. data/app/assets/javascripts/ckeditor/plugins/smiley/images/teeth_smile.gif +0 -0
  251. data/app/assets/javascripts/ckeditor/plugins/smiley/images/thumbs_down.gif +0 -0
  252. data/app/assets/javascripts/ckeditor/plugins/smiley/images/thumbs_up.gif +0 -0
  253. data/app/assets/javascripts/ckeditor/plugins/smiley/images/tounge_smile.gif +0 -0
  254. data/app/assets/javascripts/ckeditor/plugins/smiley/images/whatchutalkingabout_smile.gif +0 -0
  255. data/app/assets/javascripts/ckeditor/plugins/smiley/images/wink_smile.gif +0 -0
  256. data/app/assets/javascripts/ckeditor/plugins/specialchar/dialogs/specialchar.js +0 -7
  257. data/app/assets/javascripts/ckeditor/plugins/specialchar/lang/en.js +0 -6
  258. data/app/assets/javascripts/ckeditor/plugins/styles/styles/default.js +0 -6
  259. data/app/assets/javascripts/ckeditor/plugins/stylesheetparser/plugin.js +0 -6
  260. data/app/assets/javascripts/ckeditor/plugins/table/dialogs/table.js +0 -9
  261. data/app/assets/javascripts/ckeditor/plugins/tableresize/plugin.js +0 -7
  262. data/app/assets/javascripts/ckeditor/plugins/tabletools/dialogs/tableCell.js +0 -8
  263. data/app/assets/javascripts/ckeditor/plugins/templates/dialogs/templates.js +0 -7
  264. data/app/assets/javascripts/ckeditor/plugins/templates/templates/default.js +0 -6
  265. data/app/assets/javascripts/ckeditor/plugins/templates/templates/images/template1.gif +0 -0
  266. data/app/assets/javascripts/ckeditor/plugins/templates/templates/images/template2.gif +0 -0
  267. data/app/assets/javascripts/ckeditor/plugins/templates/templates/images/template3.gif +0 -0
  268. data/app/assets/javascripts/ckeditor/plugins/uicolor/dialogs/uicolor.js +0 -7
  269. data/app/assets/javascripts/ckeditor/plugins/uicolor/lang/en.js +0 -6
  270. data/app/assets/javascripts/ckeditor/plugins/uicolor/lang/he.js +0 -6
  271. data/app/assets/javascripts/ckeditor/plugins/uicolor/plugin.js +0 -6
  272. data/app/assets/javascripts/ckeditor/plugins/uicolor/uicolor.gif +0 -0
  273. data/app/assets/javascripts/ckeditor/plugins/uicolor/yui/assets/hue_bg.png +0 -0
  274. data/app/assets/javascripts/ckeditor/plugins/uicolor/yui/assets/hue_thumb.png +0 -0
  275. data/app/assets/javascripts/ckeditor/plugins/uicolor/yui/assets/picker_mask.png +0 -0
  276. data/app/assets/javascripts/ckeditor/plugins/uicolor/yui/assets/picker_thumb.png +0 -0
  277. data/app/assets/javascripts/ckeditor/plugins/uicolor/yui/assets/yui.css +0 -6
  278. data/app/assets/javascripts/ckeditor/plugins/uicolor/yui/yui.js +0 -76
  279. data/app/assets/javascripts/ckeditor/plugins/wsc/dialogs/ciframe.html +0 -49
  280. data/app/assets/javascripts/ckeditor/plugins/wsc/dialogs/tmpFrameset.html +0 -52
  281. data/app/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc.css +0 -6
  282. data/app/assets/javascripts/ckeditor/plugins/wsc/dialogs/wsc.js +0 -7
  283. data/app/assets/javascripts/ckeditor/plugins/xml/plugin.js +0 -6
  284. data/app/assets/javascripts/ckeditor/skins/kama/dialog.css +0 -10
  285. data/app/assets/javascripts/ckeditor/skins/kama/editor.css +0 -13
  286. data/app/assets/javascripts/ckeditor/skins/kama/icons.png +0 -0
  287. data/app/assets/javascripts/ckeditor/skins/kama/icons_rtl.png +0 -0
  288. data/app/assets/javascripts/ckeditor/skins/kama/images/dialog_sides.gif +0 -0
  289. data/app/assets/javascripts/ckeditor/skins/kama/images/dialog_sides.png +0 -0
  290. data/app/assets/javascripts/ckeditor/skins/kama/images/dialog_sides_rtl.png +0 -0
  291. data/app/assets/javascripts/ckeditor/skins/kama/images/mini.gif +0 -0
  292. data/app/assets/javascripts/ckeditor/skins/kama/images/noimage.png +0 -0
  293. data/app/assets/javascripts/ckeditor/skins/kama/images/sprites.png +0 -0
  294. data/app/assets/javascripts/ckeditor/skins/kama/images/sprites_ie6.png +0 -0
  295. data/app/assets/javascripts/ckeditor/skins/kama/images/toolbar_start.gif +0 -0
  296. data/app/assets/javascripts/ckeditor/skins/kama/skin.js +0 -7
  297. data/app/assets/javascripts/ckeditor/skins/kama/templates.css +0 -6
  298. data/app/assets/javascripts/ckeditor/skins/office2003/dialog.css +0 -9
  299. data/app/assets/javascripts/ckeditor/skins/office2003/editor.css +0 -14
  300. data/app/assets/javascripts/ckeditor/skins/office2003/icons.png +0 -0
  301. data/app/assets/javascripts/ckeditor/skins/office2003/icons_rtl.png +0 -0
  302. data/app/assets/javascripts/ckeditor/skins/office2003/images/dialog_sides.gif +0 -0
  303. data/app/assets/javascripts/ckeditor/skins/office2003/images/dialog_sides.png +0 -0
  304. data/app/assets/javascripts/ckeditor/skins/office2003/images/dialog_sides_rtl.png +0 -0
  305. data/app/assets/javascripts/ckeditor/skins/office2003/images/mini.gif +0 -0
  306. data/app/assets/javascripts/ckeditor/skins/office2003/images/noimage.png +0 -0
  307. data/app/assets/javascripts/ckeditor/skins/office2003/images/sprites.png +0 -0
  308. data/app/assets/javascripts/ckeditor/skins/office2003/images/sprites_ie6.png +0 -0
  309. data/app/assets/javascripts/ckeditor/skins/office2003/skin.js +0 -6
  310. data/app/assets/javascripts/ckeditor/skins/office2003/templates.css +0 -6
  311. data/app/assets/javascripts/ckeditor/skins/v2/dialog.css +0 -9
  312. data/app/assets/javascripts/ckeditor/skins/v2/editor.css +0 -13
  313. data/app/assets/javascripts/ckeditor/skins/v2/icons.png +0 -0
  314. data/app/assets/javascripts/ckeditor/skins/v2/icons_rtl.png +0 -0
  315. data/app/assets/javascripts/ckeditor/skins/v2/images/dialog_sides.gif +0 -0
  316. data/app/assets/javascripts/ckeditor/skins/v2/images/dialog_sides.png +0 -0
  317. data/app/assets/javascripts/ckeditor/skins/v2/images/dialog_sides_rtl.png +0 -0
  318. data/app/assets/javascripts/ckeditor/skins/v2/images/mini.gif +0 -0
  319. data/app/assets/javascripts/ckeditor/skins/v2/images/noimage.png +0 -0
  320. data/app/assets/javascripts/ckeditor/skins/v2/images/sprites.png +0 -0
  321. data/app/assets/javascripts/ckeditor/skins/v2/images/sprites_ie6.png +0 -0
  322. data/app/assets/javascripts/ckeditor/skins/v2/images/toolbar_start.gif +0 -0
  323. data/app/assets/javascripts/ckeditor/skins/v2/skin.js +0 -6
  324. data/app/assets/javascripts/ckeditor/skins/v2/templates.css +0 -6
  325. data/app/assets/javascripts/ckeditor/themes/default/theme.js +0 -8
  326. data/app/models/ckeditor/asset.rb +0 -4
  327. data/app/models/ckeditor/attachment_file.rb +0 -15
  328. data/app/models/ckeditor/picture.rb +0 -13
  329. data/config/initializers/ckeditor.rb +0 -18
  330. data/db/migrate/20110919190859_create_ckeditor_assets.rb +0 -26
  331. data/test/dummy/public/ckeditor_assets/attachments/2/p1010062.jpg +0 -0
  332. data/test/dummy/public/ckeditor_assets/pictures/1/content_member_9440972.jpeg +0 -0
  333. data/test/dummy/public/ckeditor_assets/pictures/1/original_member_9440972.jpeg +0 -0
  334. data/test/dummy/public/ckeditor_assets/pictures/1/thumb_member_9440972.jpeg +0 -0
  335. data/test/dummy/public/ckeditor_assets/pictures/3/content_p1010062.jpg +0 -0
  336. data/test/dummy/public/ckeditor_assets/pictures/3/original_p1010062.jpg +0 -0
  337. data/test/dummy/public/ckeditor_assets/pictures/3/thumb_p1010062.jpg +0 -0
  338. data/test/dummy/tmp/pids/server.pid +0 -1
data/README.rdoc CHANGED
@@ -1,16 +1,30 @@
1
1
  = Qwerty
2
2
 
3
+ == Install
4
+
3
5
  gem 'qwerty'
4
- rake qwerty_engine:install:migrations
5
- rails generate ckeditor:install
6
6
 
7
- todo:
8
- rake qwerty_engine:install
9
- - create sample sitemap.rb
10
- - copy across views
7
+ For now we also need to add an additional dependancy to your Gemfile, since Gem's can not depend on git repositories only released versions
8
+
9
+ gem 'simple_form', :git => 'git://github.com/plataformatec/simple_form.git'
10
+ gem 'kaminari', :git => 'git://github.com/ivanyv/kaminari.git'
11
+
12
+ rake qwerty_engine:install:migrations
13
+ rake db:migrate
14
+ rails g qwerty:install
11
15
 
12
16
  Developer Notes
13
17
 
14
18
  Vim users: To allow rails.vim to detect this is as a Rails project "touch config/environment.rb", which has already been added to .gitignore.
15
19
 
20
+ Release Policy
21
+
22
+ Create release branch from next
23
+ Bump version in Qwerty module: http://semver.org/
24
+ Document release as required
25
+ Merge release branch in to master and next
26
+ Tag master using with 'v' prefix e.g v0.0.1
27
+ Build and push gem to Rubyforge: http://yehudakatz.com/2010/04/02/using-gemspecs-as-intended/
28
+
29
+
16
30
  This project rocks and uses MIT-LICENSE.
@@ -9,15 +9,34 @@ class DocumentsController < QwertyBaseController
9
9
  def show
10
10
  path = request.path == '/' ? '/home' : request.path
11
11
  @document = Document.public.find_by_permalink!(path)
12
+ prepare_view_environment
12
13
  render locate_template(@document)
13
14
  end
14
15
 
15
16
  private
17
+
18
+ def prepare_view_environment
19
+ # e.g @blog
20
+ instance_variable_set("@#{@document.node_name}", @document)
21
+ # e.g @posts
22
+ if @document.can_have_children?
23
+ @document.node.children.each do | node |
24
+ logger.warn("[Qwerty] Both parent and child have the same node name, so @#{@document.node_name} is overwriting @#{node.name.pluralize}, use @document instead to access the parent document") if node.name.pluralize == @document.node_name
25
+ instance_variable_set("@#{node.name.pluralize}", node.documents.public.order(node.get(:sort) || 'published_at desc').page(page_param(@document)).per(node.get(:per_page) || 10))
26
+ end
27
+ end
28
+ end
29
+
30
+ def page_param(document)
31
+ params[document.node_name + '_page']
32
+ end
16
33
 
17
34
  # TODO: move this in a class in lib, path_prefix should be setable in
18
35
  # Qwerty.options
19
36
  # Use Pathname class:
20
37
  # http://ruby-doc.org/stdlib/libdoc/pathname/rdoc/index.html
38
+ # Or ViewResolver
39
+ # http://jkfill.com/2011/03/11/implementing-a-rails-3-view-resolver/
21
40
 
22
41
  def locate_template(document)
23
42
  view_prefix = 'cms'
@@ -35,7 +54,7 @@ class DocumentsController < QwertyBaseController
35
54
  paths.uniq.each do | path |
36
55
  view_paths.each do | view_path |
37
56
  rel_path = File.join(view_prefix, path) + '.html.erb'
38
- full_path = File.join(view_path, rel_path)
57
+ full_path = File.join(view_path.to_s, rel_path)
39
58
  if File.exists? full_path
40
59
  logger.debug "Found: #{full_path}"
41
60
  return rel_path
@@ -1,8 +1,9 @@
1
1
  class QwertyAdmin::BaseController < InheritedResources::Base
2
- # Module which has a method called 'autherize', this is called from a before_filter below
3
- include Qwerty.options[:admin_autherization]
4
2
 
5
- before_filter :autherize
3
+ unless Qwerty.options[:admin_autherization].nil?
4
+ include Qwerty.options[:admin_autherization]
5
+ before_filter :autherize
6
+ end
6
7
 
7
- layout 'qwerty_admin'
8
+ layout Qwerty.options[:admin_layout] unless Qwerty.options[:admin_layout].nil?
8
9
  end
@@ -1,6 +1,9 @@
1
1
  class QwertyBaseController < ApplicationController
2
- # Module which has a method called 'autherize', this is called from a before_filter below
3
- include Qwerty.options[:autherization]
4
2
 
5
- before_filter :autherize
3
+ unless Qwerty.options[:autherization].nil?
4
+ include Qwerty.options[:autherization]
5
+ before_filter :autherize
6
+ end
7
+
8
+ layout Qwerty.options[:layout] unless Qwerty.options[:layout].nil?
6
9
  end
@@ -6,6 +6,6 @@ module DocumentsHelper
6
6
  end
7
7
 
8
8
  def document_path(document)
9
- document.permalink
9
+ document.is_a?(Document) ? document.permalink : super(document)
10
10
  end
11
11
  end
@@ -11,15 +11,16 @@ class Document < ActiveRecord::Base
11
11
 
12
12
  image_accessor :image
13
13
 
14
- default_scope :order => 'position ASC'
14
+ # default_scope :order => 'position ASC'
15
15
 
16
16
  scope :by_node, lambda { |node| where(:node_id => node.id) }
17
17
  scope :public, where(:published => true)
18
18
 
19
19
  before_save :set_summary, :set_meta_fields
20
- before_validation :set_published_at, :set_permalink
20
+ before_validation :set_published_at
21
+ before_validation :set_permalink, :on => :create
21
22
 
22
- delegate :get, :to => :node
23
+ delegate :get, :set, :to => :node
23
24
 
24
25
  def node_name
25
26
  node.name
@@ -29,6 +30,10 @@ class Document < ActiveRecord::Base
29
30
  !image.nil?
30
31
  end
31
32
 
33
+ def can_have_children?
34
+ !node.children.empty?
35
+ end
36
+
32
37
  private
33
38
 
34
39
  def set_summary
@@ -1,3 +1,7 @@
1
+ <div style="padding:8px; background-color:#E9EDF2; margin: 10px;">
2
+ <strong>Warning</strong>: This is the default document template, to generate sample templates run: <code>rails g qwerty:create_document_views</code>
3
+ </div>
4
+
1
5
  <h2><%= @document.title %></h2>
2
6
 
3
7
  <% if @document.image? %>
@@ -0,0 +1,13 @@
1
+ <%#
2
+ -# Link to the "First" page
3
+ -# available local variables
4
+ -# url: url to the first page
5
+ -# current_page: a page object for the currently displayed page
6
+ -# num_pages: total number of pages
7
+ -# per_page: number of items to fetch per page
8
+ -# remote: data-remote
9
+ %>
10
+ <li class='prev <%= 'disabled' if current_page.first? %>'>
11
+ <%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote %>
12
+ </li>
13
+
@@ -0,0 +1,11 @@
1
+ <%#
2
+ -# Non-link tag that stands for skipped pages...
3
+ -# available local variables
4
+ -# current_page: a page object for the currently displayed page
5
+ -# num_pages: total number of pages
6
+ -# per_page: number of items to fetch per page
7
+ -# remote: data-remote
8
+ %>
9
+ <li class='disabled'>
10
+ <%= link_to(raw(t 'views.pagination.truncate'), "#") %>
11
+ </li>
@@ -0,0 +1,3 @@
1
+ <li class='next <%= 'disabled' if current_page.last? %>'>
2
+ <%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote} %>
3
+ </li>
@@ -0,0 +1,3 @@
1
+ <li class='next <%= 'disabled' if current_page.last? %>'>
2
+ <%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote %>
3
+ </li>
@@ -0,0 +1,5 @@
1
+ <li class='<%= 'active' if page.current? %>'>
2
+ <%= link_to_unless(page.current?, page, url, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil}) do |name| %>
3
+ <%= link_to(name, "#") %>
4
+ <% end %>
5
+ </li>
@@ -0,0 +1,17 @@
1
+ <%= paginator.render do %>
2
+ <div class='pagination'>
3
+ <ul>
4
+ <%= first_page_tag unless current_page.first? %>
5
+ <%= prev_page_tag unless current_page.first? %>
6
+ <% each_page do |page| %>
7
+ <% if page.left_outer? || page.right_outer? || page.inside_window? %>
8
+ <%= page_tag page %>
9
+ <% elsif !page.was_truncated? %>
10
+ <%= gap_tag %>
11
+ <% end %>
12
+ <% end %>
13
+ <%= next_page_tag unless current_page.last? %>
14
+ <%= last_page_tag unless current_page.last? %>
15
+ </ul>
16
+ </div>
17
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <%#
2
+ -# Link to the "Previous" page
3
+ -# available local variables
4
+ -# url: url to the previous page
5
+ -# current_page: a page object for the currently displayed page
6
+ -# num_pages: total number of pages
7
+ -# per_page: number of items to fetch per page
8
+ -# remote: data-remote
9
+ %>
10
+ <li class='prev <%= 'disabled' if current_page.first? %>'>
11
+ <%= link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote %>
12
+ </li>
@@ -6,7 +6,6 @@
6
6
  <link rel="stylesheet" href="http://twitter.github.com/bootstrap/1.3.0/bootstrap.min.css">
7
7
  <%= javascript_include_tag "application" %>
8
8
  <%= javascript_include_tag 'http://twitter.github.com/bootstrap/1.3.0/bootstrap-alerts.js' %>
9
- <%= javascript_include_tag "ckeditor/ckeditor.js" %>
10
9
  <%= csrf_meta_tags %>
11
10
  <style type="text/css">
12
11
  body {
@@ -16,8 +16,10 @@
16
16
  </div>
17
17
 
18
18
  <div class="span4 offset2">
19
- <%= link_to image_tag('qwerty/admin/icons/up.png'), up_qwerty_admin_document_path(document), :class => 'btn small' unless document.last? %>
20
- <%= link_to image_tag('qwerty/admin/icons/down.png'), down_qwerty_admin_document_path(document), :class => 'btn small' unless document.first? %>
19
+ <% if document.get(:sort).try('include?', 'position') %>
20
+ <%= link_to image_tag('qwerty/admin/icons/up.png'), up_qwerty_admin_document_path(document), :class => "btn small#{' disabled' if document.first?}" %>
21
+ <%= link_to image_tag('qwerty/admin/icons/down.png'), down_qwerty_admin_document_path(document), :class => "btn small#{' disabled' if document.last?}" %>
22
+ <% end %>
21
23
  <%= link_to 'Edit', edit_qwerty_admin_document_path(document), :class => 'btn small' %>
22
24
  <%= link_to 'Live', document_path(document), :target => '_blank', :class => 'btn small' %>
23
25
  </div>
@@ -6,7 +6,7 @@
6
6
  <div class='inputs'>
7
7
  <fieldset>
8
8
  <%= form.input :title if fields.include?('title') %>
9
- <%= form.input :body, :as => :ckeditor , :input_html => { :cols => 5 } if fields.include?('body') %>
9
+ <%= form.input :body, :hint => 'HTML allowed', :input_html => { :rows => 9, :class => 'span14' } if fields.include?('body')%>
10
10
  <%= form.input :summary, :hint => 'Plain text only, automatically set if left blank', :input_html => { :rows => 5, :class => 'span14'} if fields.include?('summary') %>
11
11
  <%= form.input :url, :as => :url if fields.include?('url') %>
12
12
  <%= form.input :published if fields.include?('published') %>
@@ -1,5 +1,6 @@
1
1
  <h2>Sitemap</h2>
2
2
 
3
+
3
4
  <div id="documents">
4
5
  <% @documents.each do | document | %>
5
6
 
@@ -16,14 +17,13 @@
16
17
  </div>
17
18
 
18
19
  <div class="span4 offset2">
19
- <%= link_to image_tag('qwerty/admin/icons/up.png'), up_qwerty_admin_document_path(document), :class => 'btn small' unless document.last? %>
20
- <%= link_to image_tag('qwerty/admin/icons/down.png'), down_qwerty_admin_document_path(document), :class => 'btn small' unless document.first? %>
20
+ <%= link_to image_tag('qwerty/admin/icons/up.png'), up_qwerty_admin_document_path(document), :class => 'btn small' unless document.first? %>
21
+ <%= link_to image_tag('qwerty/admin/icons/down.png'), down_qwerty_admin_document_path(document), :class => 'btn small' unless document.last? %>
21
22
  <%= link_to 'Edit', edit_qwerty_admin_document_path(document), :class => 'btn small' %>
22
23
  <%= link_to 'Live', document_path(document), :target => '_blank', :class => 'btn small' %>
23
24
  </div>
24
25
  </div>
25
26
 
26
-
27
27
  <p>
28
28
  <% document.node.children.each do | node | %>
29
29
  <%= link_to "Add #{node.name.capitalize}", new_qwerty_admin_document_path(:parent_id => document.id, :node_id => node.id), :class => 'btn primary' %>
@@ -20,13 +20,17 @@
20
20
  <div class='node'>
21
21
  <h3><%= node.name.pluralize.capitalize %></h3>
22
22
 
23
- <% unless @document.leaf? %>
23
+ <% unless node.documents.empty? %>
24
24
  <div class="documents">
25
- <%= render :partial => @document.children.by_node(node) %>
25
+ <% documents = node.documents.order(node.get(:sort) || 'published_at desc').page(params["#{node.name}_page".to_sym]).per(10 / @document.node.children.size) %>
26
+ <%= render :partial => documents %>
26
27
  </div>
27
28
  <% else %>
28
29
  <p>No <%= node.name.capitalize.pluralize %> have been added yet.</p>
29
30
  <% end %>
31
+
32
+ <%= paginate documents, :route => :qwerty_admin_document_path, :param_name => "#{node.name}_page", :theme => :twitter %>
33
+
30
34
  <p>
31
35
  <%= link_to "Add #{node.name.capitalize}", new_qwerty_admin_document_path(:parent_id => @document.id, :node_id => node.id), :class => 'btn primary' %>
32
36
  </p>
@@ -1,8 +1,8 @@
1
1
  <li class='node'><%= (node.leaf? ? node.name.pluralize : node.name).capitalize %>
2
2
  <span>
3
3
  <%= link_to 'Add', new_qwerty_admin_node_path(:parent_id => node.id) %>
4
- <%= link_to 'Up', up_qwerty_admin_node_path(node) %>
5
- <%= link_to 'Down', down_qwerty_admin_node_path(node) %>
4
+ <%= link_to 'Up', up_qwerty_admin_node_path(node) unless node.last? %>
5
+ <%= link_to 'Down', down_qwerty_admin_node_path(node) unless node.first? %>
6
6
  <%= link_to 'Edit', edit_qwerty_admin_node_path(node) %>
7
7
  <%= link_to 'Delete', qwerty_admin_node_path(node), :method => :delete, :confirm => 'Are you sure?' %>
8
8
  <%= node.position %>
data/config/routes.rb CHANGED
@@ -3,7 +3,7 @@ Rails.application.routes.draw do
3
3
 
4
4
  root :to => 'documents#show'
5
5
 
6
- namespace :qwerty_admin do
6
+ scope Qwerty.options[:admin_route_namespace], :module => :qwerty_admin, :as => :qwerty_admin do
7
7
  root :to => 'documents#index'
8
8
 
9
9
  resources :nodes do
@@ -22,5 +22,5 @@ Rails.application.routes.draw do
22
22
  end
23
23
 
24
24
 
25
- match '*permalink' => 'documents#show'
25
+ match '*permalink' => 'documents#show', :as => :document
26
26
  end
@@ -8,7 +8,7 @@ class CreateDocuments < ActiveRecord::Migration
8
8
  t.integer :lft
9
9
  t.integer :rgt
10
10
  t.integer :depth, :default => 0
11
- t.integer :position, :default => 0
11
+ t.integer :position, :default => 1
12
12
  t.integer :node_id
13
13
  t.timestamps
14
14
  end
@@ -0,0 +1,10 @@
1
+ module Qwerty
2
+ class CopyViewsGenerator < Rails::Generators::Base
3
+ source_root File.expand_path('../../../../../', __FILE__)
4
+ desc 'Copy views for customising'
5
+
6
+ def copy_views
7
+ directory 'app/views', 'app/views', :recursive => true
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,18 @@
1
+ class Qwerty::CreateDocumentViewsGenerator < Rails::Generators::Base
2
+ source_root File.expand_path('../templates', __FILE__)
3
+ desc 'Create a example views for a documents'
4
+
5
+ def generate_views(node = Sitemap.root)
6
+ node.children.each do | node |
7
+ generate_view(node)
8
+ generate_views(node) unless node.leaf?
9
+ end
10
+ end
11
+
12
+ private
13
+
14
+ def generate_view(node)
15
+ destination_root = Rails.root
16
+ template 'show.html.erb', "app/views/cms/#{node.ancestry.gsub('/root/', '').gsub('/', '.')}.html.erb", :node => node
17
+ end
18
+ end
@@ -0,0 +1,22 @@
1
+ <% node = config[:node]
2
+ parent_var = '@' + (node.children.any? { |n| n.name.pluralize == node.name } ? 'document' : node.name)
3
+ -%>
4
+ <h2><%%= <%= parent_var %>.title %></h2>
5
+
6
+ <div class='body'><%%= <%= parent_var %>.body.html_safe %></div>
7
+
8
+ <% node.children.each do | node | %>
9
+
10
+ <div id="<%= node.name.pluralize %>">
11
+ <%% @<%= node.name.pluralize %>.each do | <%= node.name %> | %>
12
+ <div class='<%= node.name %>'>
13
+ <h3><%%= link_to <%= node.name %>.title, document_path(<%= node.name %>) %></h3>
14
+
15
+ <div><%%= <%= node.name %>.summary %></div>
16
+ <div><%%= <%= node.name %>.published_at %></div>
17
+ </div>
18
+ <%% end %>
19
+
20
+ <%%= paginate @<%= node.name.pluralize %>, :route => :document_path, :param_name => "#{@<%= node.name %>}_page", :theme => :twitter %>
21
+ </div>
22
+ <% end %>
@@ -0,0 +1,24 @@
1
+ module Qwerty
2
+ class InstallGenerator < Rails::Generators::Base
3
+ source_root File.expand_path('../templates', __FILE__)
4
+ desc 'Install Qwerty in to your Rails application'
5
+
6
+ invoke 'qwerty:copy_views'
7
+
8
+ def copy_sitemap_config
9
+ template 'sitemap.rb', 'config/sitemap.rb'
10
+ end
11
+
12
+ def copy_initializers
13
+ template 'qwerty.rb', 'config/initializers/qwerty.rb'
14
+ end
15
+
16
+ def remove_index_html
17
+ remove_file 'public/index.html'
18
+ end
19
+
20
+ def show_readme
21
+ readme 'README'
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,30 @@
1
+ ===============================================================================
2
+ _
3
+ | |
4
+ __ ___ _____ _ __| |_ _ _
5
+ / _` \ \ /\ / / _ \ '__| __| | | |
6
+ | (_| |\ V V / __/ | | |_| |_| |
7
+ \__, | \_/\_/ \___|_| \__|\__, |
8
+ | | __/ |
9
+ |_| |___/
10
+
11
+
12
+ 1. Construct your sitemap
13
+
14
+ config/sitemap.rb
15
+
16
+ 2. Load your sitemap and some Lipsum content
17
+
18
+ rake bootstrap
19
+
20
+ 3. Start the server
21
+
22
+ rails s
23
+
24
+ 4. Open your browser
25
+
26
+ visit localhost:3000
27
+
28
+ 5. Enjoy !
29
+
30
+ ===============================================================================
@@ -0,0 +1,34 @@
1
+ Qwerty.configure do | config |
2
+ # config.options[:admin_title] = 'Qwerty'
3
+
4
+ # Qwerty does not include autherisation/authentication, it hooks in to your
5
+ # applications own choices. This way you can use authlogic, devise, cancan or
6
+ # any other system.
7
+ #
8
+ # Create a module with a autherize method, the autherize method is called from
9
+ # a before_filter in every one of Qwerty's admin controllers.
10
+ #
11
+ # Example:
12
+ # module Qwerty
13
+ # module DeviseAuth
14
+ # def autherize
15
+ # # Delegate to Devise
16
+ # authenticate_user!
17
+ # raise 'You must be an admin' unless current_user.admin?
18
+ # end
19
+ # end
20
+ # end
21
+ #
22
+ # config.options[:admin_autherization] = Qwerty::DeviseAuth
23
+ #
24
+ # Qwerty comes bundled with two Auth stratagies AllowAuth and DenyAuth.
25
+ # As the names suggest AllowAuth allows everything and DenyAuth allows
26
+ # nothing.
27
+ #
28
+ # You can also autherize a user for regular CMS pages, for example if some
29
+ # pages need to be private. By default anyone is allowed to view all
30
+ # non-admin pages.
31
+ #
32
+ # config.options[:autherization] = Qwerty::AllowAuth
33
+ end
34
+
@@ -0,0 +1,39 @@
1
+ Sitemap.build do | root |
2
+ root.undeleteable!
3
+
4
+ root.add(:home) do | home |
5
+ home.undeleteable!
6
+ end
7
+
8
+ root.add(:project) do | project |
9
+ project.undeleteable!
10
+
11
+ project.add(:page) do | page |
12
+ page.set(:per_page => 10)
13
+ page.set(:sort => 'updated_at desc')
14
+
15
+ page.add(:image) do | image |
16
+ image.set(:per_page => 10)
17
+ image.set(:sort => 'position asc')
18
+ end
19
+ end
20
+ end
21
+
22
+ root.add(:about) do | about |
23
+ about.undeleteable!
24
+
25
+ about.add(:page) do | page |
26
+ page.set(:per_page => 10)
27
+ page.set(:sort => 'title asc')
28
+ end
29
+ end
30
+
31
+ root.add(:blog) do | blog |
32
+ blog.undeleteable!
33
+
34
+ blog.add(:post) do | post |
35
+ post.set(:per_page => 10)
36
+ post.set(:sort => 'published_at asc')
37
+ end
38
+ end
39
+ end
data/lib/qwerty/engine.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  module Qwerty
2
2
  class Engine < Rails::Engine
3
- config.autoload_paths += %W(#{config.root}/app/models/ckeditor)
4
3
  end
5
4
  end
@@ -1,3 +1,3 @@
1
1
  module Qwerty
2
- VERSION = "0.0.1.pre"
2
+ VERSION = "0.0.3.pre"
3
3
  end
data/lib/qwerty.rb CHANGED
@@ -1,3 +1,14 @@
1
+ # Dependencies
2
+ require 'nested_set'
3
+ require 'acts_as_list'
4
+ require "inherited_resources"
5
+ require "simple_form"
6
+ require "jquery-rails"
7
+ require "sanitize"
8
+ require "dragonfly"
9
+ require "faker"
10
+
11
+ # Qwerty
1
12
  require "qwerty/engine"
2
13
  require "qwerty/allow_auth"
3
14
  require "qwerty/deny_auth"
@@ -7,13 +18,39 @@ module Qwerty
7
18
  class << self
8
19
 
9
20
  # Provides configurability to Qwerty
21
+ #
10
22
  # * admin_title: The title shown in the admin UI
11
- # * authentication: Module which is mixed in to CMS controllers, it must have a method called 'autherize', which is called from a before_filter
23
+ #
24
+ # * admin_autherization: Module which is mixed in to Qwerty admin
25
+ # controllers, it must have a method called 'autherize', which is called
26
+ # from a before_filter. Set to nil to turn autherization off.
27
+ #
28
+ # * autherization: Module which is mixed in to public facing Qwerty, works
29
+ # in the same way as admin_authentication. Usually this will be left as nil
30
+ # to allow anybody access to CMS pages.
31
+ #
32
+ # Note: All Qwerty controllers inherit from ApplicationController, so your
33
+ # autherize method will have access to its private methods e.g current_user.
34
+ #
35
+ # * admin_layout: The layout to use for all Qwerty's admin controllers,
36
+ # set o nil to use Rails default layout
37
+ #
38
+ # * layout: The layout to use for Qwerty's public facing controllers, set
39
+ # to nil to use the Rails default layout
40
+ #
41
+ # * admin_route_namespace: The namespace for the admin controllers, you may
42
+ # wish to change this to '/admin' if you have other controllers in this
43
+ # namespace and you want consistant URL's. Note: if you change this your
44
+ # views will still reside in 'views/qwerty_admin'.
45
+
12
46
  def options
13
47
  @options ||= {
14
48
  :admin_title => 'Qwerty CMS',
15
- :autherization => Qwerty::AllowAuth,
16
- :admin_autherization => Qwerty::AllowAuth
49
+ :autherization => nil,
50
+ :admin_autherization => nil,
51
+ :admin_layout => 'qwerty_admin',
52
+ :layout => nil,
53
+ :admin_route_namespace => '/qwerty_admin'
17
54
  }
18
55
  end
19
56
 
@@ -1,5 +1,12 @@
1
- desc "Descructivly rebuild the site"
2
- task :bootstrap => [:environment] do
1
+ desc "Destructively rebuild the site"
2
+ task :bootstrap => [:load_sitemap, :load_lipsum]
3
+
4
+ desc 'Load sitemap from config/sitemap.rb'
5
+ task :load_sitemap => [:environment] do
3
6
  Sitemap.load_from_disk!
7
+ end
8
+
9
+ desc 'Load some Lispsum content for all nodes in Sitemap'
10
+ task :load_lipsum => [:environment] do
4
11
  Qwerty::Lipsum.new.run!
5
12
  end
@@ -0,0 +1,10 @@
1
+ <h2><%= @blog.title %></h2>
2
+
3
+ <% @posts.each do | post | %>
4
+ <h3><%= link_to post.title, document_path(post) %></h3>
5
+
6
+ <div><%= post.summary %></div>
7
+ <div><%= post.published_at %></div>
8
+ <% end %>
9
+
10
+ <%= paginate @posts, :route => :document_path, :param_name => "#{@blog.node_name}_page", :theme => :twitter %>