card 1.16.1 → 1.16.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (372) hide show
  1. checksums.yaml +4 -4
  2. data/.yardoc/checksums +60 -0
  3. data/.yardoc/object_types +0 -0
  4. data/.yardoc/objects/root.dat +0 -0
  5. data/.yardoc/proxy_types +0 -0
  6. data/.yardopts +6 -0
  7. data/README_Developers.rdoc +100 -0
  8. data/VERSION +1 -1
  9. data/card.gemspec +18 -18
  10. data/db/migrate/20150724210803_add_comment_to_actions.rb +5 -0
  11. data/db/migrate_core_cards/20150724123438_update_file_and_image_cards.rb +70 -0
  12. data/db/migrate_core_cards/20150807205221_create_references_for_search_cards.rb +10 -0
  13. data/db/migrate_core_cards/data/1.12_stylesheets/common.scss +4 -2
  14. data/db/schema.rb +2 -1
  15. data/db/seed/new/card_actions.yml +2334 -12538
  16. data/db/seed/new/card_acts.yml +1 -1
  17. data/db/seed/new/card_changes.yml +7384 -38929
  18. data/db/seed/new/card_references.yml +207 -207
  19. data/db/seed/new/cards.yml +1364 -1440
  20. data/db/seed/test/fixtures/card_actions.yml +3285 -13219
  21. data/db/seed/test/fixtures/card_acts.yml +107 -107
  22. data/db/seed/test/fixtures/card_changes.yml +10830 -42375
  23. data/db/seed/test/fixtures/card_references.yml +393 -393
  24. data/db/seed/test/fixtures/cards.yml +1701 -1777
  25. data/db/version.txt +1 -1
  26. data/db/version_core_cards.txt +1 -1
  27. data/lib/card.rb +13 -3
  28. data/lib/card/chunk.rb +22 -15
  29. data/lib/card/content.rb +9 -8
  30. data/lib/card/diff.rb +79 -79
  31. data/lib/card/loader.rb +33 -33
  32. data/lib/card/name.rb +8 -0
  33. data/lib/card/set.rb +44 -17
  34. data/lib/card/set_pattern.rb +8 -0
  35. data/lib/cardio.rb +19 -3
  36. data/mod/01_core/chunk/link.rb +7 -6
  37. data/mod/01_core/chunk/query_reference.rb +65 -0
  38. data/mod/01_core/set/all/content.rb +1 -1
  39. data/mod/01_core/set/all/fetch.rb +15 -7
  40. data/mod/01_core/set/all/initialize.rb +4 -3
  41. data/mod/01_core/set/all/phases.rb +12 -8
  42. data/mod/01_core/set/all/references.rb +12 -6
  43. data/mod/01_core/set/all/rules.rb +14 -11
  44. data/mod/01_core/set/all/states.rb +2 -1
  45. data/mod/01_core/set/all/tracked_attributes.rb +14 -0
  46. data/mod/01_core/spec/set/all/collection_spec.rb +5 -5
  47. data/mod/01_core/spec/set/all/name_spec.rb +6 -6
  48. data/mod/01_history/lib/card/act.rb +2 -2
  49. data/mod/01_history/lib/card/action.rb +11 -2
  50. data/mod/01_history/set/all/actions.rb +4 -3
  51. data/mod/01_history/set/all/content_history.rb +1 -1
  52. data/mod/01_history/set/all/history.rb +55 -66
  53. data/mod/02_basic_types/set/all/file.rb +26 -3
  54. data/mod/02_basic_types/set/type/pointer.rb +13 -14
  55. data/mod/02_basic_types/spec/set/all/file_spec.rb +0 -1
  56. data/mod/03_machines/lib/card/machine.rb +4 -4
  57. data/mod/03_machines/lib/javascript/wagn_mod.js.coffee +4 -17
  58. data/mod/03_machines/lib/stylesheets/style_cards.scss +5 -0
  59. data/mod/03_machines/set/right/machine_input.rb +3 -0
  60. data/mod/03_machines/set/right/machine_output.rb +4 -0
  61. data/mod/04_settings/lib/card/setting.rb +2 -1
  62. data/mod/04_settings/set/abstract/permission.rb +95 -0
  63. data/mod/04_settings/set/right/comment.rb +2 -90
  64. data/mod/04_settings/set/right/create.rb +2 -2
  65. data/mod/04_settings/set/right/delete.rb +2 -3
  66. data/mod/04_settings/set/right/read.rb +3 -2
  67. data/mod/04_settings/set/right/update.rb +3 -2
  68. data/mod/04_settings/set/self/recent_settings.rb +3 -0
  69. data/mod/04_settings/set/type/setting.rb +9 -1
  70. data/mod/05_email/set/all/notify.rb +2 -1
  71. data/mod/05_email/set/type/email_template.rb +17 -17
  72. data/mod/05_standard/file/credit_image/image-icon.png +0 -0
  73. data/mod/05_standard/file/credit_image/image-large.png +0 -0
  74. data/mod/05_standard/file/credit_image/image-medium.png +0 -0
  75. data/mod/05_standard/file/credit_image/image-original.png +0 -0
  76. data/mod/05_standard/file/credit_image/image-small.png +0 -0
  77. data/mod/05_standard/file/favicon/{icon-image.png → image-icon.png} +0 -0
  78. data/mod/05_standard/file/favicon/{large-image.png → image-large.png} +0 -0
  79. data/mod/05_standard/file/favicon/{medium-image.png → image-medium.png} +0 -0
  80. data/mod/05_standard/file/favicon/{original-image.png → image-original.png} +0 -0
  81. data/mod/05_standard/file/favicon/{small-image.png → image-small.png} +0 -0
  82. data/mod/05_standard/file/logo/{icon-image.png → image-icon.png} +0 -0
  83. data/mod/05_standard/file/logo/{large-image.png → image-large.png} +0 -0
  84. data/mod/05_standard/file/logo/{medium-image.png → image-medium.png} +0 -0
  85. data/mod/05_standard/file/logo/{original-image.png → image-original.png} +0 -0
  86. data/mod/05_standard/file/logo/{small-image.png → image-small.png} +0 -0
  87. data/mod/05_standard/lib/carrier_wave/cardmount.rb +79 -0
  88. data/mod/05_standard/lib/file_uploader.rb +127 -0
  89. data/mod/05_standard/lib/image_uploader.rb +35 -0
  90. data/mod/05_standard/set/abstract/attachment.rb +85 -0
  91. data/mod/05_standard/set/all/error.rb +1 -18
  92. data/mod/05_standard/set/all/event_viz.rb +17 -14
  93. data/mod/05_standard/set/all/rich_html/editing.rb +10 -10
  94. data/mod/05_standard/set/all/rich_html/toolbar.rb +44 -37
  95. data/mod/05_standard/set/right/account.rb +1 -1
  96. data/mod/05_standard/set/right/password.rb +9 -10
  97. data/mod/05_standard/set/self/recent.rb +1 -1
  98. data/mod/05_standard/set/type/file.rb +43 -31
  99. data/mod/05_standard/set/type/image.rb +22 -6
  100. data/mod/05_standard/set/type/search_type.rb +4 -2
  101. data/mod/05_standard/set/type/session.rb +7 -5
  102. data/mod/05_standard/set/type/set.rb +3 -1
  103. data/mod/05_standard/spec/set/all/history_spec.rb +1 -1
  104. data/mod/05_standard/spec/set/type/cardtype_spec.rb +3 -3
  105. data/mod/05_standard/spec/set/type/file_spec.rb +85 -1
  106. data/mod/05_standard/spec/set/type/image_spec.rb +89 -5
  107. data/mod/05_standard/spec/set/type/search_type_spec.rb +16 -1
  108. data/mod/06_bootstrap/file/{cerulean_skin/icon-image.png → cerulean_skin_image/image-icon.png} +0 -0
  109. data/mod/06_bootstrap/file/{cerulean_skin/large-image.png → cerulean_skin_image/image-large.png} +0 -0
  110. data/mod/06_bootstrap/file/{cerulean_skin/medium-image.png → cerulean_skin_image/image-medium.png} +0 -0
  111. data/mod/06_bootstrap/file/{cerulean_skin/original-image.png → cerulean_skin_image/image-original.png} +0 -0
  112. data/mod/06_bootstrap/file/{cerulean_skin/small-image.png → cerulean_skin_image/image-small.png} +0 -0
  113. data/mod/06_bootstrap/file/{cosmo_skin/icon-image.png → cosmo_skin_image/image-icon.png} +0 -0
  114. data/mod/06_bootstrap/file/{cosmo_skin/large-image.png → cosmo_skin_image/image-large.png} +0 -0
  115. data/mod/06_bootstrap/file/{cosmo_skin/medium-image.png → cosmo_skin_image/image-medium.png} +0 -0
  116. data/mod/06_bootstrap/file/{cosmo_skin/original-image.png → cosmo_skin_image/image-original.png} +0 -0
  117. data/mod/06_bootstrap/file/{cosmo_skin/small-image.png → cosmo_skin_image/image-small.png} +0 -0
  118. data/mod/06_bootstrap/file/{cyborg_skin/icon-image.png → cyborg_skin_image/image-icon.png} +0 -0
  119. data/mod/06_bootstrap/file/{cyborg_skin/large-image.png → cyborg_skin_image/image-large.png} +0 -0
  120. data/mod/06_bootstrap/file/{cyborg_skin/medium-image.png → cyborg_skin_image/image-medium.png} +0 -0
  121. data/mod/06_bootstrap/file/{cyborg_skin/original-image.png → cyborg_skin_image/image-original.png} +0 -0
  122. data/mod/06_bootstrap/file/{cyborg_skin/small-image.png → cyborg_skin_image/image-small.png} +0 -0
  123. data/mod/06_bootstrap/file/{darkly_skin/icon-image.png → darkly_skin_image/image-icon.png} +0 -0
  124. data/mod/06_bootstrap/file/{darkly_skin/large-image.png → darkly_skin_image/image-large.png} +0 -0
  125. data/mod/06_bootstrap/file/{darkly_skin/medium-image.png → darkly_skin_image/image-medium.png} +0 -0
  126. data/mod/06_bootstrap/file/{darkly_skin/original-image.png → darkly_skin_image/image-original.png} +0 -0
  127. data/mod/06_bootstrap/file/{darkly_skin/small-image.png → darkly_skin_image/image-small.png} +0 -0
  128. data/mod/06_bootstrap/file/{flatly_skin/icon-image.png → flatly_skin_image/image-icon.png} +0 -0
  129. data/mod/06_bootstrap/file/{flatly_skin/large-image.png → flatly_skin_image/image-large.png} +0 -0
  130. data/mod/06_bootstrap/file/{flatly_skin/medium-image.png → flatly_skin_image/image-medium.png} +0 -0
  131. data/mod/06_bootstrap/file/{flatly_skin/original-image.png → flatly_skin_image/image-original.png} +0 -0
  132. data/mod/06_bootstrap/file/{flatly_skin/small-image.png → flatly_skin_image/image-small.png} +0 -0
  133. data/mod/06_bootstrap/file/{journal_skin/icon-image.png → journal_skin_image/image-icon.png} +0 -0
  134. data/mod/06_bootstrap/file/{journal_skin/large-image.png → journal_skin_image/image-large.png} +0 -0
  135. data/mod/06_bootstrap/file/{journal_skin/medium-image.png → journal_skin_image/image-medium.png} +0 -0
  136. data/mod/06_bootstrap/file/{journal_skin/original-image.png → journal_skin_image/image-original.png} +0 -0
  137. data/mod/06_bootstrap/file/{journal_skin/small-image.png → journal_skin_image/image-small.png} +0 -0
  138. data/mod/06_bootstrap/file/{lumen_skin/icon-image.png → lumen_skin_image/image-icon.png} +0 -0
  139. data/mod/06_bootstrap/file/{lumen_skin/large-image.png → lumen_skin_image/image-large.png} +0 -0
  140. data/mod/06_bootstrap/file/{lumen_skin/medium-image.png → lumen_skin_image/image-medium.png} +0 -0
  141. data/mod/06_bootstrap/file/{lumen_skin/original-image.png → lumen_skin_image/image-original.png} +0 -0
  142. data/mod/06_bootstrap/file/{lumen_skin/small-image.png → lumen_skin_image/image-small.png} +0 -0
  143. data/mod/06_bootstrap/file/{paper_skin/icon-image.png → paper_skin_image/image-icon.png} +0 -0
  144. data/mod/06_bootstrap/file/{paper_skin/large-image.png → paper_skin_image/image-large.png} +0 -0
  145. data/mod/06_bootstrap/file/{paper_skin/medium-image.png → paper_skin_image/image-medium.png} +0 -0
  146. data/mod/06_bootstrap/file/{paper_skin/original-image.png → paper_skin_image/image-original.png} +0 -0
  147. data/mod/06_bootstrap/file/{paper_skin/small-image.png → paper_skin_image/image-small.png} +0 -0
  148. data/mod/06_bootstrap/file/{readable_skin/icon-image.png → readable_skin_image/image-icon.png} +0 -0
  149. data/mod/06_bootstrap/file/{readable_skin/large-image.png → readable_skin_image/image-large.png} +0 -0
  150. data/mod/06_bootstrap/file/{readable_skin/medium-image.png → readable_skin_image/image-medium.png} +0 -0
  151. data/mod/06_bootstrap/file/{readable_skin/original-image.png → readable_skin_image/image-original.png} +0 -0
  152. data/mod/06_bootstrap/file/{readable_skin/small-image.png → readable_skin_image/image-small.png} +0 -0
  153. data/mod/06_bootstrap/file/{sandstone_skin/icon-image.png → sandstone_skin_image/image-icon.png} +0 -0
  154. data/mod/06_bootstrap/file/{sandstone_skin/large-image.png → sandstone_skin_image/image-large.png} +0 -0
  155. data/mod/06_bootstrap/file/{sandstone_skin/medium-image.png → sandstone_skin_image/image-medium.png} +0 -0
  156. data/mod/06_bootstrap/file/{sandstone_skin/original-image.png → sandstone_skin_image/image-original.png} +0 -0
  157. data/mod/06_bootstrap/file/{sandstone_skin/small-image.png → sandstone_skin_image/image-small.png} +0 -0
  158. data/mod/06_bootstrap/file/{simplex_skin/icon-image.png → simplex_skin_image/image-icon.png} +0 -0
  159. data/mod/06_bootstrap/file/{simplex_skin/large-image.png → simplex_skin_image/image-large.png} +0 -0
  160. data/mod/06_bootstrap/file/{simplex_skin/medium-image.png → simplex_skin_image/image-medium.png} +0 -0
  161. data/mod/06_bootstrap/file/{simplex_skin/original-image.png → simplex_skin_image/image-original.png} +0 -0
  162. data/mod/06_bootstrap/file/{simplex_skin/small-image.png → simplex_skin_image/image-small.png} +0 -0
  163. data/mod/06_bootstrap/file/{slate_skin/icon-image.png → slate_skin_image/image-icon.png} +0 -0
  164. data/mod/06_bootstrap/file/{slate_skin/large-image.png → slate_skin_image/image-large.png} +0 -0
  165. data/mod/06_bootstrap/file/{slate_skin/medium-image.png → slate_skin_image/image-medium.png} +0 -0
  166. data/mod/06_bootstrap/file/{slate_skin/original-image.png → slate_skin_image/image-original.png} +0 -0
  167. data/mod/06_bootstrap/file/{slate_skin/small-image.png → slate_skin_image/image-small.png} +0 -0
  168. data/mod/06_bootstrap/file/{spacelab_skin/icon-image.png → spacelab_skin_image/image-icon.png} +0 -0
  169. data/mod/06_bootstrap/file/{spacelab_skin/large-image.png → spacelab_skin_image/image-large.png} +0 -0
  170. data/mod/06_bootstrap/file/{spacelab_skin/medium-image.png → spacelab_skin_image/image-medium.png} +0 -0
  171. data/mod/06_bootstrap/file/{spacelab_skin/original-image.png → spacelab_skin_image/image-original.png} +0 -0
  172. data/mod/06_bootstrap/file/{spacelab_skin/small-image.png → spacelab_skin_image/image-small.png} +0 -0
  173. data/mod/06_bootstrap/file/{superhero_skin/icon-image.png → superhero_skin_image/image-icon.png} +0 -0
  174. data/mod/06_bootstrap/file/{superhero_skin/large-image.png → superhero_skin_image/image-large.png} +0 -0
  175. data/mod/06_bootstrap/file/{superhero_skin/medium-image.png → superhero_skin_image/image-medium.png} +0 -0
  176. data/mod/06_bootstrap/file/{superhero_skin/original-image.png → superhero_skin_image/image-original.png} +0 -0
  177. data/mod/06_bootstrap/file/{superhero_skin/small-image.png → superhero_skin_image/image-small.png} +0 -0
  178. data/mod/06_bootstrap/file/{united_skin/icon-image.png → united_skin_image/image-icon.png} +0 -0
  179. data/mod/06_bootstrap/file/{united_skin/large-image.png → united_skin_image/image-large.png} +0 -0
  180. data/mod/06_bootstrap/file/{united_skin/medium-image.png → united_skin_image/image-medium.png} +0 -0
  181. data/mod/06_bootstrap/file/{united_skin/original-image.png → united_skin_image/image-original.png} +0 -0
  182. data/mod/06_bootstrap/file/{united_skin/small-image.png → united_skin_image/image-small.png} +0 -0
  183. data/mod/06_bootstrap/file/{yeti_skin/icon-image.png → yeti_skin_image/image-icon.png} +0 -0
  184. data/mod/06_bootstrap/file/{yeti_skin/large-image.png → yeti_skin_image/image-large.png} +0 -0
  185. data/mod/06_bootstrap/file/{yeti_skin/medium-image.png → yeti_skin_image/image-medium.png} +0 -0
  186. data/mod/06_bootstrap/file/{yeti_skin/original-image.png → yeti_skin_image/image-original.png} +0 -0
  187. data/mod/06_bootstrap/file/{yeti_skin/small-image.png → yeti_skin_image/image-small.png} +0 -0
  188. data/mod/06_bootstrap/lib/stylesheets/bootstrap_cards.scss +5 -3
  189. data/spec/lib/card/reference_spec.rb +8 -1
  190. data/tmpsets/README.md +2 -0
  191. data/tmpsets/set/mod001-01_core/all/active_card.rb +40 -0
  192. data/tmpsets/set/mod001-01_core/all/collection.rb +348 -0
  193. data/tmpsets/set/mod001-01_core/all/content.rb +68 -0
  194. data/tmpsets/set/mod001-01_core/all/erb.rb +17 -0
  195. data/tmpsets/set/mod001-01_core/all/fetch.rb +242 -0
  196. data/tmpsets/set/mod001-01_core/all/haml.rb +13 -0
  197. data/tmpsets/set/mod001-01_core/all/initialize.rb +56 -0
  198. data/tmpsets/set/mod001-01_core/all/name.rb +279 -0
  199. data/tmpsets/set/mod001-01_core/all/pattern.rb +62 -0
  200. data/tmpsets/set/mod001-01_core/all/permissions.rb +289 -0
  201. data/tmpsets/set/mod001-01_core/all/phases.rb +187 -0
  202. data/tmpsets/set/mod001-01_core/all/references.rb +130 -0
  203. data/tmpsets/set/mod001-01_core/all/rules.rb +324 -0
  204. data/tmpsets/set/mod001-01_core/all/states.rb +28 -0
  205. data/tmpsets/set/mod001-01_core/all/templating.rb +132 -0
  206. data/tmpsets/set/mod001-01_core/all/tracked_attributes.rb +136 -0
  207. data/tmpsets/set/mod001-01_core/all/trash.rb +56 -0
  208. data/tmpsets/set/mod001-01_core/all/type.rb +91 -0
  209. data/tmpsets/set/mod001-01_core/all/utils.rb +162 -0
  210. data/tmpsets/set/mod001-01_core/all/view_cache.rb +14 -0
  211. data/tmpsets/set/mod002-01_history/all/actions.rb +54 -0
  212. data/tmpsets/set/mod002-01_history/all/content_history.rb +140 -0
  213. data/tmpsets/set/mod002-01_history/all/history.rb +341 -0
  214. data/tmpsets/set/mod003-02_basic_types/all/all_css.rb +48 -0
  215. data/tmpsets/set/mod003-02_basic_types/all/all_csv.rb +58 -0
  216. data/tmpsets/set/mod003-02_basic_types/all/all_js.rb +13 -0
  217. data/tmpsets/set/mod003-02_basic_types/all/base.rb +128 -0
  218. data/tmpsets/set/mod003-02_basic_types/all/file.rb +42 -0
  219. data/tmpsets/set/mod003-02_basic_types/all/json.rb +72 -0
  220. data/tmpsets/set/mod003-02_basic_types/all/rss.rb +78 -0
  221. data/tmpsets/set/mod003-02_basic_types/all/text.rb +14 -0
  222. data/tmpsets/set/mod003-02_basic_types/type/html.rb +33 -0
  223. data/tmpsets/set/mod003-02_basic_types/type/plain_text.rb +16 -0
  224. data/tmpsets/set/mod003-02_basic_types/type/pointer.rb +358 -0
  225. data/tmpsets/set/mod004-03_machines/right/machine_input.rb +8 -0
  226. data/tmpsets/set/mod004-03_machines/right/machine_output.rb +30 -0
  227. data/tmpsets/set/mod004-03_machines/self/script_ace.rb +18 -0
  228. data/tmpsets/set/mod004-03_machines/self/script_card_menu.rb +17 -0
  229. data/tmpsets/set/mod004-03_machines/self/script_html5shiv_printshiv.rb +8 -0
  230. data/tmpsets/set/mod004-03_machines/self/script_jquery.rb +8 -0
  231. data/tmpsets/set/mod004-03_machines/self/script_jquery_helper.rb +18 -0
  232. data/tmpsets/set/mod004-03_machines/self/script_slot.rb +13 -0
  233. data/tmpsets/set/mod004-03_machines/self/script_tinymce.rb +8 -0
  234. data/tmpsets/set/mod004-03_machines/self/style_bootstrap_compatible.rb +11 -0
  235. data/tmpsets/set/mod004-03_machines/self/style_cards.rb +12 -0
  236. data/tmpsets/set/mod004-03_machines/self/style_jquery_ui_smoothness.rb +9 -0
  237. data/tmpsets/set/mod004-03_machines/type/coffee_script.rb +67 -0
  238. data/tmpsets/set/mod004-03_machines/type/css.rb +55 -0
  239. data/tmpsets/set/mod004-03_machines/type/java_script.rb +43 -0
  240. data/tmpsets/set/mod004-03_machines/type/scss.rb +28 -0
  241. data/tmpsets/set/mod004-03_machines/type/skin.rb +18 -0
  242. data/tmpsets/set/mod005-04_settings/abstract/permission.rb +101 -0
  243. data/tmpsets/set/mod005-04_settings/right/add_help.rb +17 -0
  244. data/tmpsets/set/mod005-04_settings/right/comment.rb +9 -0
  245. data/tmpsets/set/mod005-04_settings/right/create.rb +9 -0
  246. data/tmpsets/set/mod005-04_settings/right/default.rb +9 -0
  247. data/tmpsets/set/mod005-04_settings/right/delete.rb +9 -0
  248. data/tmpsets/set/mod005-04_settings/right/help.rb +9 -0
  249. data/tmpsets/set/mod005-04_settings/right/read.rb +9 -0
  250. data/tmpsets/set/mod005-04_settings/right/script.rb +16 -0
  251. data/tmpsets/set/mod005-04_settings/right/structure.rb +16 -0
  252. data/tmpsets/set/mod005-04_settings/right/style.rb +16 -0
  253. data/tmpsets/set/mod005-04_settings/right/update.rb +9 -0
  254. data/tmpsets/set/mod005-04_settings/self/accountable.rb +9 -0
  255. data/tmpsets/set/mod005-04_settings/self/add_help.rb +8 -0
  256. data/tmpsets/set/mod005-04_settings/self/autoname.rb +8 -0
  257. data/tmpsets/set/mod005-04_settings/self/captcha.rb +8 -0
  258. data/tmpsets/set/mod005-04_settings/self/create.rb +8 -0
  259. data/tmpsets/set/mod005-04_settings/self/default.rb +8 -0
  260. data/tmpsets/set/mod005-04_settings/self/delete.rb +8 -0
  261. data/tmpsets/set/mod005-04_settings/self/help.rb +8 -0
  262. data/tmpsets/set/mod005-04_settings/self/input.rb +7 -0
  263. data/tmpsets/set/mod005-04_settings/self/layout.rb +8 -0
  264. data/tmpsets/set/mod005-04_settings/self/on_create.rb +8 -0
  265. data/tmpsets/set/mod005-04_settings/self/on_delete.rb +8 -0
  266. data/tmpsets/set/mod005-04_settings/self/on_update.rb +8 -0
  267. data/tmpsets/set/mod005-04_settings/self/options.rb +8 -0
  268. data/tmpsets/set/mod005-04_settings/self/options_label.rb +8 -0
  269. data/tmpsets/set/mod005-04_settings/self/read.rb +8 -0
  270. data/tmpsets/set/mod005-04_settings/self/recent_settings.rb +8 -0
  271. data/tmpsets/set/mod005-04_settings/self/script.rb +8 -0
  272. data/tmpsets/set/mod005-04_settings/self/structure.rb +8 -0
  273. data/tmpsets/set/mod005-04_settings/self/style.rb +8 -0
  274. data/tmpsets/set/mod005-04_settings/self/table_of_contents.rb +8 -0
  275. data/tmpsets/set/mod005-04_settings/self/thanks.rb +8 -0
  276. data/tmpsets/set/mod005-04_settings/self/update.rb +8 -0
  277. data/tmpsets/set/mod005-04_settings/type/setting.rb +96 -0
  278. data/tmpsets/set/mod006-05_email/all/email_html.rb +11 -0
  279. data/tmpsets/set/mod006-05_email/all/email_text.rb +11 -0
  280. data/tmpsets/set/mod006-05_email/all/follow.rb +260 -0
  281. data/tmpsets/set/mod006-05_email/all/notify.rb +244 -0
  282. data/tmpsets/set/mod006-05_email/all/observer.rb +33 -0
  283. data/tmpsets/set/mod006-05_email/right/bcc.rb +51 -0
  284. data/tmpsets/set/mod006-05_email/right/cc.rb +9 -0
  285. data/tmpsets/set/mod006-05_email/right/follow.rb +90 -0
  286. data/tmpsets/set/mod006-05_email/right/follow_fields.rb +8 -0
  287. data/tmpsets/set/mod006-05_email/right/followers.rb +35 -0
  288. data/tmpsets/set/mod006-05_email/right/following.rb +58 -0
  289. data/tmpsets/set/mod006-05_email/right/from.rb +9 -0
  290. data/tmpsets/set/mod006-05_email/right/html_message.rb +9 -0
  291. data/tmpsets/set/mod006-05_email/right/to.rb +9 -0
  292. data/tmpsets/set/mod006-05_email/self/always.rb +20 -0
  293. data/tmpsets/set/mod006-05_email/self/created.rb +27 -0
  294. data/tmpsets/set/mod006-05_email/self/edited.rb +30 -0
  295. data/tmpsets/set/mod006-05_email/self/follow.rb +8 -0
  296. data/tmpsets/set/mod006-05_email/self/follow_defaults.rb +71 -0
  297. data/tmpsets/set/mod006-05_email/self/never.rb +21 -0
  298. data/tmpsets/set/mod006-05_email/type/email_template.rb +119 -0
  299. data/tmpsets/set/mod006-05_email/type_plus_right/user/follow.rb +182 -0
  300. data/tmpsets/set/mod007-05_standard/abstract/attachment.rb +91 -0
  301. data/tmpsets/set/mod007-05_standard/all/account.rb +73 -0
  302. data/tmpsets/set/mod007-05_standard/all/comment.rb +45 -0
  303. data/tmpsets/set/mod007-05_standard/all/error.rb +198 -0
  304. data/tmpsets/set/mod007-05_standard/all/event_viz.rb +75 -0
  305. data/tmpsets/set/mod007-05_standard/all/links.rb +153 -0
  306. data/tmpsets/set/mod007-05_standard/all/rich_html/content.rb +248 -0
  307. data/tmpsets/set/mod007-05_standard/all/rich_html/editing.rb +216 -0
  308. data/tmpsets/set/mod007-05_standard/all/rich_html/form.rb +238 -0
  309. data/tmpsets/set/mod007-05_standard/all/rich_html/header.rb +80 -0
  310. data/tmpsets/set/mod007-05_standard/all/rich_html/menu.rb +135 -0
  311. data/tmpsets/set/mod007-05_standard/all/rich_html/modal.rb +98 -0
  312. data/tmpsets/set/mod007-05_standard/all/rich_html/toolbar.rb +271 -0
  313. data/tmpsets/set/mod007-05_standard/all/rich_html/wrapper.rb +158 -0
  314. data/tmpsets/set/mod007-05_standard/right/account.rb +187 -0
  315. data/tmpsets/set/mod007-05_standard/right/discussion.rb +9 -0
  316. data/tmpsets/set/mod007-05_standard/right/email.rb +57 -0
  317. data/tmpsets/set/mod007-05_standard/right/password.rb +44 -0
  318. data/tmpsets/set/mod007-05_standard/right/salt.rb +11 -0
  319. data/tmpsets/set/mod007-05_standard/right/stats.rb +41 -0
  320. data/tmpsets/set/mod007-05_standard/right/status.rb +15 -0
  321. data/tmpsets/set/mod007-05_standard/right/token.rb +11 -0
  322. data/tmpsets/set/mod007-05_standard/right/when_created.rb +11 -0
  323. data/tmpsets/set/mod007-05_standard/right/when_last_edited.rb +11 -0
  324. data/tmpsets/set/mod007-05_standard/rstar/rules.rb +411 -0
  325. data/tmpsets/set/mod007-05_standard/self/account_links.rb +55 -0
  326. data/tmpsets/set/mod007-05_standard/self/alerts.rb +11 -0
  327. data/tmpsets/set/mod007-05_standard/self/all.rb +28 -0
  328. data/tmpsets/set/mod007-05_standard/self/foot.rb +14 -0
  329. data/tmpsets/set/mod007-05_standard/self/head.rb +126 -0
  330. data/tmpsets/set/mod007-05_standard/self/navbox.rb +39 -0
  331. data/tmpsets/set/mod007-05_standard/self/now.rb +12 -0
  332. data/tmpsets/set/mod007-05_standard/self/performance_log.rb +98 -0
  333. data/tmpsets/set/mod007-05_standard/self/recent.rb +54 -0
  334. data/tmpsets/set/mod007-05_standard/self/search.rb +49 -0
  335. data/tmpsets/set/mod007-05_standard/self/signin.rb +130 -0
  336. data/tmpsets/set/mod007-05_standard/self/stats.rb +109 -0
  337. data/tmpsets/set/mod007-05_standard/self/version.rb +15 -0
  338. data/tmpsets/set/mod007-05_standard/type/basic.rb +52 -0
  339. data/tmpsets/set/mod007-05_standard/type/cardtype.rb +78 -0
  340. data/tmpsets/set/mod007-05_standard/type/date.rb +14 -0
  341. data/tmpsets/set/mod007-05_standard/type/file.rb +103 -0
  342. data/tmpsets/set/mod007-05_standard/type/image.rb +89 -0
  343. data/tmpsets/set/mod007-05_standard/type/layout_type.rb +21 -0
  344. data/tmpsets/set/mod007-05_standard/type/number.rb +25 -0
  345. data/tmpsets/set/mod007-05_standard/type/phrase.rb +9 -0
  346. data/tmpsets/set/mod007-05_standard/type/search_type.rb +291 -0
  347. data/tmpsets/set/mod007-05_standard/type/session.rb +42 -0
  348. data/tmpsets/set/mod007-05_standard/type/set.rb +354 -0
  349. data/tmpsets/set/mod007-05_standard/type/signup.rb +150 -0
  350. data/tmpsets/set/mod007-05_standard/type/toggle.rb +18 -0
  351. data/tmpsets/set/mod007-05_standard/type/uri.rb +17 -0
  352. data/tmpsets/set/mod007-05_standard/type/user.rb +78 -0
  353. data/tmpsets/set/mod008-06_bootstrap/all/bootstrap/form.rb +41 -0
  354. data/tmpsets/set/mod008-06_bootstrap/all/bootstrap/helper.rb +150 -0
  355. data/tmpsets/set/mod008-06_bootstrap/all/bootstrap/wrapper.rb +18 -0
  356. data/tmpsets/set/mod008-06_bootstrap/all/rich_bootstrap.rb +14 -0
  357. data/tmpsets/set/mod008-06_bootstrap/self/bootstrap_cards.rb +15 -0
  358. data/tmpsets/set/mod008-06_bootstrap/self/bootstrap_js.rb +13 -0
  359. data/tmpsets/set/mod008-06_bootstrap/self/bootswatch_shared.rb +38 -0
  360. data/tmpsets/set/mod008-06_bootstrap/self/smartmenu_css.rb +13 -0
  361. data/tmpsets/set/mod008-06_bootstrap/self/smartmenu_js.rb +12 -0
  362. data/tmpsets/set_pattern/100-all.rb +24 -0
  363. data/tmpsets/set_pattern/101-all_plus.rb +26 -0
  364. data/tmpsets/set_pattern/102-type.rb +36 -0
  365. data/tmpsets/set_pattern/103-star.rb +28 -0
  366. data/tmpsets/set_pattern/104-rstar.rb +30 -0
  367. data/tmpsets/set_pattern/105-right.rb +33 -0
  368. data/tmpsets/set_pattern/106-type_plus_right.rb +36 -0
  369. data/tmpsets/set_pattern/107-self.rb +32 -0
  370. metadata +306 -107
  371. data/mod/05_standard/set/all/attach.rb +0 -164
  372. data/mod/05_standard/spec/set/all/attach_spec.rb +0 -9
@@ -0,0 +1,103 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class Card; module Set; module Type; module File; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/file.rb ~~~~~~~~~~~
3
+ include Abstract::Attachment
4
+
5
+ set_specific_attributes :file, :remote_file_url
6
+ mount_uploader :file, FileUploader
7
+
8
+ format do
9
+ view :source do |args|
10
+ card.attachment.url
11
+ end
12
+
13
+ view :core do |args|
14
+ handle_source args do |source|
15
+ card_url source
16
+ end
17
+ end
18
+
19
+ def handle_source args
20
+ source = _render_source args
21
+ source ? yield( source ) : ''
22
+ rescue
23
+ 'File Error'
24
+ end
25
+ end
26
+
27
+
28
+
29
+ format :file do
30
+
31
+ view :core do |args| # returns send_file args. not in love with this...
32
+ if format = card.attachment_format( params[:format] ) # this means we only support known formats. dislike.
33
+ if params[:explicit_file] and r = controller.response
34
+ r.headers["Expires"] = 1.year.from_now.httpdate
35
+ #r.headers["Cache-Control"] = "public" # currently using default "private", because proxy servers could block needed permission checks
36
+ end
37
+
38
+ # elsif ![format, 'file'].member? params[:format] # formerly supported redirecting to correct file format
39
+ # return redirect_to( request.fullpath.sub( /\.#{params[:format]}\b/, '.' + format ) ) #card.attachment.url(style) )
40
+
41
+ file = selected_file_version
42
+ [ file.path,
43
+ {
44
+ :type => file.content_type,
45
+ :filename => "#{card.cardname.safe_key}.#{file.extension}",
46
+ :x_sendfile => true,
47
+ :disposition => (params[:format]=='file' ? 'attachment' : 'inline' )
48
+ }
49
+ ]
50
+ else
51
+ _render_not_found
52
+ end
53
+ end
54
+
55
+ def selected_file_version
56
+ card.attachment
57
+ end
58
+
59
+ end
60
+
61
+
62
+ format :html do
63
+
64
+ view :core do |args|
65
+ handle_source args do |source|
66
+ "<a href=\"#{source}\">Download #{ showname args[:title] }</a>"
67
+ end
68
+ end
69
+
70
+ view :editor do |args|
71
+ #Rails.logger.debug "editor for file #{card.inspect}"
72
+ file_chooser args
73
+ end
74
+
75
+ def file_chooser args, db_column=:file
76
+ preview =
77
+ if !card.new_card?
78
+ content_tag :div, _render_core(args).html_safe,
79
+ :class=>'attachment-preview', :id=>"#{card.attachment.filename}-preview"
80
+ end
81
+
82
+ <<-HTML
83
+ <div class="choose-file">
84
+ #{preview}
85
+ <div>#{file_field db_column, :class=>'file-upload slotter'}</div>
86
+ </div>
87
+ <div class="chosen-file" style="display:none">
88
+ <div>
89
+ <label>File chosen:</label>
90
+ <span class="chosen-filename"></span>
91
+ </div>
92
+ <div><a class="cancel-upload">Unchoose</a></div>
93
+ </div>
94
+ HTML
95
+ end
96
+
97
+ end
98
+
99
+
100
+
101
+
102
+ # ~~~~~~~~~~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/file.rb ~~~~~~~~~~~
103
+ end;end;end;end;
@@ -0,0 +1,89 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class Card; module Set; module Type; module Image; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/image.rb ~~~~~~~~~~~
3
+ include Abstract::Attachment
4
+ set_specific_attributes :image, :remote_image_url
5
+ mount_uploader :image, ImageUploader
6
+
7
+
8
+ format do
9
+
10
+ include File::Format
11
+
12
+ view :closed_content do |args|
13
+ _render_core :size=>:icon
14
+ end
15
+
16
+ view :source do |args|
17
+ style = case
18
+ when @mode==:closed ; :icon
19
+ when args[:size] ; args[:size].to_sym
20
+ when main? ; :large
21
+ else ; :medium
22
+ end
23
+ style = :original if style.to_sym == :full
24
+ if style == :original
25
+ card.image.url
26
+ else
27
+ card.image.versions[style].url
28
+ end
29
+ end
30
+
31
+ end
32
+
33
+ format :html do
34
+ include File::HtmlFormat
35
+
36
+
37
+ view :editor do |args|
38
+ file_chooser args, :image
39
+ end
40
+
41
+
42
+ view :core do |args|
43
+ handle_source args do |source|
44
+ source == 'missing' ? "<!-- image missing #{@card.name} -->" : image_tag(source)
45
+ end
46
+ end
47
+
48
+
49
+ view :content_changes do |args|
50
+ out = ''
51
+ size = args[:diff_type]==:summary ? :icon : :medium
52
+ if !args[:hide_diff] and args[:action] and last_change = card.last_change_on(:db_content,:before=>args[:action])
53
+ card.selected_action_id=last_change.card_action_id
54
+ out << Card::Diff.render_added_chunk(_render_core(:size=>size))
55
+ end
56
+ card.selected_action_id=args[:action].id
57
+ out << Card::Diff.render_deleted_chunk(_render_core(:size=>size))
58
+ out
59
+ end
60
+
61
+ end
62
+
63
+ format :css do
64
+ view :core do |args|
65
+ render_source
66
+ end
67
+
68
+ view :content do |args| #why is this necessary?
69
+ render_core
70
+ end
71
+ end
72
+
73
+ format :file do
74
+ include File::FileFormat
75
+
76
+ view :style do |args| #should this be in model?
77
+ ['', 'full'].member?( args[:style].to_s ) ? :original : args[:style]
78
+ end
79
+
80
+ def selected_file_version
81
+ style = _render_style(:style=>params[:size]).to_sym
82
+ (style && style != :original) ? card.attachment.versions[style] : card.attachment
83
+ end
84
+ end
85
+
86
+
87
+
88
+ # ~~~~~~~~~~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/image.rb ~~~~~~~~~~~
89
+ end;end;end;end;
@@ -0,0 +1,21 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class Card; module Set; module Type; module LayoutType; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/layout_type.rb ~~~~~~~~~~~
3
+ # -*- encoding : utf-8 -*-
4
+ include Html
5
+
6
+ format do
7
+ include Html::Format
8
+ end
9
+
10
+ format :html do
11
+ include Html::HtmlFormat
12
+
13
+ view :core do |args|
14
+ with_inclusion_mode :template do
15
+ process_content ::CodeRay.scan( _render_raw, :html ).div
16
+ end
17
+ end
18
+ end
19
+
20
+ # ~~~~~~~~~~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/layout_type.rb ~~~~~~~~~~~
21
+ end;end;end;end;
@@ -0,0 +1,25 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class Card; module Set; module Type; module Number; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/number.rb ~~~~~~~~~~~
3
+
4
+ view :editor do |args|
5
+ text_field :content, :class=>'card-content'
6
+ end
7
+
8
+ event :validate_number, :after=>:approve do
9
+ errors.add :content, "'#{content}' is not numeric" unless valid_number?( content )
10
+ end
11
+
12
+ def valid_number?( string )
13
+ valid = true
14
+ begin
15
+ Kernel.Float( string )
16
+ rescue ArgumentError, TypeError
17
+ valid = false
18
+ end
19
+ valid
20
+ end
21
+
22
+
23
+
24
+ # ~~~~~~~~~~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/number.rb ~~~~~~~~~~~
25
+ end;end;end;end;
@@ -0,0 +1,9 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class Card; module Set; module Type; module Phrase; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/phrase.rb ~~~~~~~~~~~
3
+ view :editor do |args|
4
+ text_field :content, :class=>'card-content'
5
+ end
6
+
7
+
8
+ # ~~~~~~~~~~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/phrase.rb ~~~~~~~~~~~
9
+ end;end;end;end;
@@ -0,0 +1,291 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class Card; module Set; module Type; module SearchType; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/search_type.rb ~~~~~~~~~~~
3
+
4
+
5
+ def item_cards params={}
6
+ s = query(params)
7
+ raise("OH NO.. no limit") unless s[:limit]
8
+ # forces explicit limiting
9
+ # can be 0 or less to force no limit
10
+ Card.search( s )
11
+ end
12
+
13
+ def item_names params={}
14
+ Card.search(query(params.merge(:return=>:name)))
15
+ end
16
+
17
+ def item_type
18
+ query[:type]
19
+ end
20
+
21
+ def count params={}
22
+ Card.count_by_wql query( params )
23
+ end
24
+
25
+ def query params={}
26
+ @query ||= {}
27
+ @query[params.to_s] ||= get_query(params.clone)
28
+ end
29
+
30
+ def get_query params={}
31
+ query = Auth.as_bot do ## why is this a wagn_bot thing? can't deny search content??
32
+ query_content = params.delete(:query) || raw_content
33
+ #warn "get_query #{name}, #{query_content}, #{params.inspect}"
34
+ raise("Error in card '#{self.name}':can't run search with empty content") if query_content.empty?
35
+ String === query_content ? JSON.parse( query_content ) : query_content
36
+ end
37
+ query.symbolize_keys!.merge! params.symbolize_keys
38
+ if default_limit = query.delete(:default_limit) and !query[:limit]
39
+ query[:limit] = default_limit
40
+ end
41
+ query[:context] ||= (cardname.junction? ? cardname.left_name : cardname)
42
+ query
43
+ end
44
+
45
+
46
+
47
+
48
+ format do
49
+
50
+ view :core do |args|
51
+ search_vars args
52
+
53
+ case
54
+ when e = search_vars[:error]
55
+ %{#{e.class.to_s} :: #{e.message} :: #{card.raw_content}}
56
+ when search_vars[:query][:return] =='count'
57
+ search_results.to_s
58
+ when @mode == :template
59
+ render :raw
60
+ else
61
+ _render_card_list args
62
+ end
63
+ end
64
+
65
+ view :card_list do |args|
66
+ if search_results.empty?
67
+ 'no results'
68
+ else
69
+ search_results.map do |c|
70
+ nest c
71
+ end.join "\n"
72
+ end
73
+ end
74
+
75
+ def search_vars args={}
76
+ @search_vars ||=
77
+ begin
78
+ v = {}
79
+ v[:query] = card.query(search_params)
80
+ v[:item] = set_inclusion_opts args.merge( :query_view=>v[:query][:view] )
81
+ v
82
+ rescue =>e
83
+ { :error => e }
84
+ end
85
+ end
86
+
87
+ def search_results
88
+ @search_results ||=
89
+ begin
90
+ card.item_cards search_params
91
+ rescue => e
92
+ { :error => e}
93
+ end
94
+ end
95
+
96
+ def search_result_names
97
+ @search_result_names ||=
98
+ begin
99
+ card.item_names search_params
100
+ rescue => e
101
+ { :error => e}
102
+ end
103
+ end
104
+
105
+ def each_reference_with_args args={}
106
+ search_result_names.each do |name|
107
+ yield(name, nest_args(args.reverse_merge!(:item=>:content)))
108
+ end
109
+ end
110
+
111
+ def set_inclusion_opts args
112
+ @inclusion_defaults = nil
113
+ @inclusion_opts ||= {}
114
+ @inclusion_opts[:view] = args[:item] || inclusion_opts[:view] || args[:query_view] || default_item_view
115
+ # explicit > inclusion syntax > WQL > inclusion defaults
116
+ end
117
+
118
+
119
+
120
+ def page_link text, page, current=false, options={}
121
+ @paging_path_args[:offset] = page * @paging_limit
122
+ options.merge!(:class=>'card-paging-link slotter', :remote => true)
123
+ link_to raw(text), path(@paging_path_args), options
124
+ end
125
+
126
+ def page_li text, page, current=false, options={}
127
+ css_class = if current
128
+ 'active'
129
+ elsif !page
130
+ 'disabled'
131
+ end
132
+ page ||= 0
133
+ content_tag :li, :class=>css_class do
134
+ page_link text, page, current, options
135
+ end
136
+ end
137
+
138
+ def previous_page_link page
139
+ page_li '<span aria-hidden="true">&laquo;</span>', page, false, 'aria-label'=>"Previous"
140
+ end
141
+
142
+ def next_page_link page
143
+ page_li '<span aria-hidden="true">&raquo;</span>', page, false, 'aria-label'=>"Next"
144
+ end
145
+
146
+ def ellipse_page
147
+ content_tag :li, content_tag(:span, '...')
148
+ end
149
+
150
+ def chunk_list
151
+ :query
152
+ end
153
+ end
154
+
155
+
156
+ format :data do
157
+
158
+ view :card_list do |args|
159
+ search_results.map do |c|
160
+ nest c
161
+ end
162
+ end
163
+ end
164
+
165
+ format :csv do
166
+ view :card_list do |args|
167
+ items = super args
168
+ if @depth == 0
169
+ render_csv_title_row + items
170
+ else
171
+ items
172
+ end
173
+ end
174
+ end
175
+
176
+ format :json do
177
+ def default_search_params
178
+ set_default_search_params :default_limit => 0
179
+ end
180
+ end
181
+
182
+ format :rss do
183
+ def raw_feed_items
184
+ search_params.merge!(:default_limit => 25)
185
+ search_results
186
+ end
187
+ end
188
+
189
+ format :html do
190
+
191
+ view :card_list do |args|
192
+ paging = _optional_render :paging, args
193
+
194
+ if search_results.empty?
195
+ render_no_search_results(args)
196
+ else
197
+ results =
198
+ search_results.map do |c|
199
+ item_view = inclusion_defaults(c)[:view]
200
+ %{
201
+ <div class="search-result-item item-#{ item_view }">
202
+ #{nest(c, :size=>args[:size], :view=>item_view)}
203
+ </div>
204
+ }
205
+ end.join "\n"
206
+
207
+ %{
208
+ #{ paging }
209
+ <div class="search-result-list">
210
+ #{ results }
211
+ </div>
212
+ #{ paging if search_results.length > 10 }
213
+ }
214
+ end
215
+ end
216
+
217
+
218
+ view :closed_content do |args|
219
+ if @depth > self.class.max_depth
220
+ "..."
221
+ else
222
+ search_limit = args[:closed_search_limit]
223
+ search_params[:limit] = search_limit && search_limit < Card.config.closed_search_limit ?
224
+ search_limit : Card.config.closed_search_limit
225
+ _render_core args.merge( :hide=>'paging', :item=>:link )
226
+ # TODO: if item is queryified to be "name", then that should work. otherwise use link
227
+ end
228
+ end
229
+
230
+ view :editor, :mod=>Html::HtmlFormat
231
+
232
+ view :no_search_results do |args|
233
+ %{<div class="search-no-results"></div>}
234
+ end
235
+
236
+ view :paging do |args|
237
+ s = card.query search_params
238
+ offset, limit = s[:offset].to_i, s[:limit].to_i
239
+ return '' if limit < 1
240
+ return '' if offset==0 && limit > offset + search_results.length #avoid query if we know there aren't enough results to warrant paging
241
+ total = card.count search_params
242
+ return '' if limit >= total # should only happen if limit exactly equals the total
243
+
244
+ @paging_path_args = { :limit => limit, :item=> inclusion_defaults(card)[:view] }
245
+ @paging_limit = limit
246
+
247
+ s[:vars].each { |key, value| @paging_path_args["_#{key}"] = value }
248
+
249
+ out = ['<nav><ul class="pagination paging">' ]
250
+
251
+ total_pages = ((total-1) / limit).to_i
252
+ current_page = ( offset / limit).to_i # should already be integer
253
+ window = 2 # should be configurable
254
+ window_min = current_page - window
255
+ window_max = current_page + window
256
+
257
+ previous_page = current_page > 0 ? current_page - 1 : false
258
+ out << previous_page_link(previous_page)
259
+ if window_min > 0
260
+ out << page_li( 1, 0 )
261
+ out << ellipse_page if window_min > 1
262
+ end
263
+
264
+ (window_min .. window_max).each do |page|
265
+ next if page < 0 or page > total_pages
266
+ text = page + 1
267
+ out << page_li( text, page, page==current_page )
268
+ end
269
+
270
+ if total_pages > window_max
271
+ out << ellipse_page if total_pages > window_max + 1
272
+ out << page_li( total_pages + 1, total_pages )
273
+ end
274
+
275
+ next_page = current_page < total_pages ? current_page + 1 : false
276
+ out << next_page_link(next_page)
277
+
278
+ out << %{</ul></nav>}
279
+ out.join
280
+ end
281
+
282
+ def default_search_params
283
+ set_default_search_params :default_limit=>20
284
+ end
285
+
286
+ end
287
+
288
+
289
+
290
+ # ~~~~~~~~~~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/search_type.rb ~~~~~~~~~~~
291
+ end;end;end;end;