templet_rails 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. checksums.yaml +5 -5
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +334 -269
  4. data/Rakefile +21 -7
  5. data/app/assets/config/templet_rails_manifest.js +2 -0
  6. data/app/assets/javascripts/templet_rails/application.js +15 -0
  7. data/app/assets/stylesheets/templet_rails/application.css +15 -0
  8. data/app/controllers/templet/json_rendering_helpers.rb +12 -0
  9. data/app/controllers/templet/rendering_helpers.rb +53 -0
  10. data/app/controllers/templet/viewer_call_string.rb +144 -0
  11. data/app/controllers/templet/viewer_call_string_class.rb +65 -0
  12. data/app/controllers/templet/viewer_responders.rb +121 -0
  13. data/app/controllers/templet_rails/application_controller.rb +5 -0
  14. data/app/helpers/templet/constants.rb +54 -0
  15. data/app/helpers/templet/forms/bs_form.rb +73 -0
  16. data/app/helpers/templet/forms/bs_form_errors.rb +38 -0
  17. data/app/helpers/templet/forms/bs_form_field.rb +114 -0
  18. data/app/helpers/templet/forms/bs_form_group.rb +115 -0
  19. data/app/helpers/templet/layouts/html_rails.rb +36 -0
  20. data/app/helpers/templet/links.rb +28 -0
  21. data/app/helpers/templet/links/bs_btn_class.rb +61 -0
  22. data/app/helpers/templet/links/bs_link_set_base.rb +168 -0
  23. data/app/helpers/templet/links/bs_link_set_collection.rb +21 -0
  24. data/app/helpers/templet/links/bs_link_set_navigation.rb +62 -0
  25. data/app/helpers/templet/links/rest_link_procs.rb +163 -0
  26. data/app/helpers/templet/links/rest_link_procs_parent.rb +39 -0
  27. data/app/helpers/templet/links/rest_link_procs_sets.rb +30 -0
  28. data/app/helpers/templet/links/rest_link_text.rb +102 -0
  29. data/app/helpers/templet/links/rest_path.rb +90 -0
  30. data/app/helpers/templet/mixins.rb +9 -0
  31. data/app/helpers/templet/mixins/bs.rb +11 -0
  32. data/app/helpers/templet/mixins/bs/grid.rb +53 -0
  33. data/app/helpers/templet/mixins/bs/lists.rb +77 -0
  34. data/app/helpers/templet/mixins/field_procs.rb +140 -0
  35. data/app/helpers/templet/mixins/html_presenters.rb +82 -0
  36. data/app/helpers/templet/require_all.rb +45 -0
  37. data/app/helpers/templet/utils/html_search_form.rb +53 -0
  38. data/app/helpers/templet/utils/link_set_factory.rb +46 -0
  39. data/app/helpers/templet/utils/link_set_factory_wrapper.rb +53 -0
  40. data/app/helpers/templet/utils/list_model_parents.rb +27 -0
  41. data/app/helpers/templet/utils/navbar_form.rb +26 -0
  42. data/app/helpers/templet/utils/selected_wrapper.rb +40 -0
  43. data/app/helpers/templet/viewer.rb +11 -0
  44. data/app/helpers/templet/viewer/meta_model.rb +66 -0
  45. data/app/helpers/templet/viewer/meta_model_defaults.rb +56 -0
  46. data/app/helpers/templet/viewer/presenters.rb +44 -0
  47. data/app/helpers/templet/viewer/rest_actions.rb +24 -0
  48. data/app/helpers/templet/viewer_base.rb +111 -0
  49. data/app/helpers/templet/viewer_rest.rb +144 -0
  50. data/app/helpers/templet_helper.rb +10 -0
  51. data/app/helpers/templet_rails/application_helper.rb +4 -0
  52. data/app/jobs/templet_rails/application_job.rb +4 -0
  53. data/app/mailers/templet_rails/application_mailer.rb +6 -0
  54. data/app/models/templet_rails/application_record.rb +5 -0
  55. data/app/views/layouts/templet_rails/application.html.erb +16 -0
  56. data/config/routes.rb +2 -0
  57. data/lib/generators/templet/controller/controller_generator.rb +70 -68
  58. data/lib/generators/templet/core_install/USAGE +14 -0
  59. data/lib/generators/templet/core_install/core_install_generator.rb +77 -0
  60. data/lib/generators/templet/core_rspec/USAGE +5 -8
  61. data/lib/generators/templet/core_rspec/core_rspec_generator.rb +32 -47
  62. data/lib/generators/templet/destroy/USAGE +1 -1
  63. data/lib/generators/templet/destroy/destroy_generator.rb +87 -84
  64. data/lib/generators/templet/install/USAGE +16 -0
  65. data/lib/generators/templet/install/install_generator.rb +103 -0
  66. data/lib/generators/templet/routes/routes_generator.rb +43 -41
  67. data/lib/generators/templet/rspec/rspec_generator.rb +1 -0
  68. data/lib/generators/templet/scaffold/scaffold_generator.rb +66 -64
  69. data/lib/generators/templet/shared/core_helpers.rb +10 -0
  70. data/lib/generators/templet/shared/model_fields.rb +2 -2
  71. data/lib/generators/templet/templates/core/app/base_viewer.rb +1 -1
  72. data/lib/generators/templet/templates/core/app/{panel → layouts}/layout_base.rb +3 -3
  73. data/lib/generators/templet/templates/core/app/{panel → layouts}/layout_header.rb +3 -1
  74. data/lib/generators/templet/templates/core/app/{panel → layouts}/layout_header_sidebar.rb +2 -1
  75. data/lib/generators/templet/templates/core/app/{panel/nav.rb → layouts/navbar.rb} +2 -2
  76. data/lib/generators/templet/templates/core/app/layouts/navbar_args_option.rb +32 -0
  77. data/lib/generators/templet/templates/core/app/{link_sets/navbar.rb → layouts/navbar_links.rb} +2 -2
  78. data/lib/generators/templet/templates/core/app/{panel → layouts}/options_config.rb +3 -3
  79. data/lib/generators/templet/templates/core/app/layouts/panel/flash_messages.rb +35 -0
  80. data/lib/generators/templet/templates/core/app/layouts/panel/show_parents_option.rb +24 -0
  81. data/lib/generators/templet/templates/core/app/layouts/panel/sidebar_links_option.rb +26 -0
  82. data/lib/generators/templet/templates/core/spec/layouts/flash_messages_spec.rb +18 -0
  83. data/lib/generators/templet/templates/core/spec/layouts/navbar_spec.rb +19 -0
  84. data/lib/generators/templet/templates/core/spec/support/apis/api_helper.rb +2 -0
  85. data/lib/generators/templet/templates/core/spec/support/apis/shared_examples_a_json_controller.rb +1 -1
  86. data/lib/generators/templet/templates/core/spec/support/{viewer → shared}/partial_test_helpers.rb +0 -0
  87. data/lib/generators/templet/templates/core/templet/viewer_base.rb +3 -3
  88. data/lib/generators/templet/viewer/viewer_generator.rb +60 -58
  89. data/lib/tasks/templet_rails_tasks.rake +4 -0
  90. data/lib/templet_rails.rb +1 -1
  91. data/lib/templet_rails/engine.rb +5 -0
  92. data/lib/templet_rails/version.rb +1 -1
  93. data/spec/dummy/Rakefile +6 -0
  94. data/spec/dummy/app/assets/config/manifest.js +4 -0
  95. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  96. data/spec/dummy/app/assets/javascripts/cable.js +13 -0
  97. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  98. data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
  99. data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
  100. data/spec/dummy/app/controllers/answers_controller.rb +86 -0
  101. data/spec/dummy/app/controllers/application_controller.rb +2 -0
  102. data/spec/dummy/app/controllers/categories_controller.rb +80 -0
  103. data/spec/dummy/app/controllers/questions_controller.rb +86 -0
  104. data/spec/dummy/app/helpers/app.rb +4 -0
  105. data/spec/dummy/app/helpers/app/answer_viewer.rb +21 -0
  106. data/spec/dummy/app/helpers/app/base_viewer.rb +7 -0
  107. data/spec/dummy/app/helpers/app/category_viewer.rb +26 -0
  108. data/spec/dummy/app/helpers/app/layouts/layout_base.rb +40 -0
  109. data/spec/dummy/app/helpers/app/layouts/layout_header.rb +24 -0
  110. data/spec/dummy/app/helpers/app/layouts/layout_header_sidebar.rb +19 -0
  111. data/spec/dummy/app/helpers/app/layouts/navbar.rb +55 -0
  112. data/spec/dummy/app/helpers/app/layouts/navbar_args_option.rb +32 -0
  113. data/spec/dummy/app/helpers/app/layouts/navbar_links.rb +12 -0
  114. data/spec/dummy/app/helpers/app/layouts/options_config.rb +19 -0
  115. data/spec/dummy/app/helpers/app/layouts/panel/flash_messages.rb +35 -0
  116. data/spec/dummy/app/helpers/app/layouts/panel/show_parents_option.rb +24 -0
  117. data/spec/dummy/app/helpers/app/layouts/panel/sidebar_links_option.rb +26 -0
  118. data/spec/dummy/app/helpers/app/question_viewer.rb +26 -0
  119. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  120. data/spec/dummy/app/jobs/application_job.rb +2 -0
  121. data/spec/dummy/app/mailers/application_mailer.rb +4 -0
  122. data/spec/dummy/app/models/answer.rb +12 -0
  123. data/spec/dummy/app/models/application_record.rb +3 -0
  124. data/spec/dummy/app/models/category.rb +11 -0
  125. data/spec/dummy/app/models/question.rb +15 -0
  126. data/spec/dummy/app/views/layouts/application.html.erb +15 -0
  127. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  128. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  129. data/spec/dummy/bin/bundle +3 -0
  130. data/spec/dummy/bin/rails +4 -0
  131. data/spec/dummy/bin/rake +4 -0
  132. data/spec/dummy/bin/setup +36 -0
  133. data/spec/dummy/bin/update +31 -0
  134. data/spec/dummy/bin/yarn +11 -0
  135. data/spec/dummy/config.ru +5 -0
  136. data/spec/dummy/config/application.rb +30 -0
  137. data/spec/dummy/config/boot.rb +5 -0
  138. data/spec/dummy/config/cable.yml +10 -0
  139. data/spec/dummy/config/database.yml +25 -0
  140. data/spec/dummy/config/environment.rb +5 -0
  141. data/spec/dummy/config/environments/development.rb +61 -0
  142. data/spec/dummy/config/environments/production.rb +94 -0
  143. data/spec/dummy/config/environments/test.rb +46 -0
  144. data/spec/dummy/config/initializers/application_controller_renderer.rb +8 -0
  145. data/spec/dummy/config/initializers/assets.rb +14 -0
  146. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  147. data/spec/dummy/config/initializers/content_security_policy.rb +25 -0
  148. data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
  149. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  150. data/spec/dummy/config/initializers/inflections.rb +16 -0
  151. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  152. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  153. data/spec/dummy/config/locales/en.yml +33 -0
  154. data/spec/dummy/config/puma.rb +34 -0
  155. data/spec/dummy/config/routes.rb +9 -0
  156. data/spec/dummy/config/spring.rb +6 -0
  157. data/spec/dummy/config/storage.yml +34 -0
  158. data/spec/dummy/db/development.sqlite3 +0 -0
  159. data/spec/dummy/db/migrate/20190709192619_create_categories.rb +9 -0
  160. data/spec/dummy/db/migrate/20190709192656_create_questions.rb +12 -0
  161. data/spec/dummy/db/migrate/20190709192737_create_answers.rb +13 -0
  162. data/spec/dummy/db/schema.rb +42 -0
  163. data/spec/dummy/db/test.sqlite3 +0 -0
  164. data/spec/dummy/log/development.log +64 -0
  165. data/spec/dummy/log/test.log +40792 -0
  166. data/spec/dummy/package.json +5 -0
  167. data/spec/dummy/public/404.html +67 -0
  168. data/spec/dummy/public/422.html +67 -0
  169. data/spec/dummy/public/500.html +66 -0
  170. data/{lib/generators/templet/templates/core/controllers/.keep → spec/dummy/public/apple-touch-icon-precomposed.png} +0 -0
  171. data/spec/dummy/public/apple-touch-icon.png +0 -0
  172. data/spec/dummy/public/favicon.ico +0 -0
  173. data/spec/dummy/spec/apis/answers_controller_spec.rb +17 -0
  174. data/spec/dummy/spec/apis/categories_controller_spec.rb +13 -0
  175. data/spec/dummy/spec/apis/questions_controller_spec.rb +15 -0
  176. data/spec/dummy/spec/helpers/app/answer_viewer_spec.rb +18 -0
  177. data/spec/dummy/spec/helpers/app/category_viewer_spec.rb +14 -0
  178. data/spec/dummy/spec/helpers/app/layouts/flash_messages_spec.rb +18 -0
  179. data/spec/dummy/spec/helpers/app/layouts/navbar_spec.rb +19 -0
  180. data/spec/dummy/spec/helpers/app/question_viewer_spec.rb +16 -0
  181. data/spec/dummy/spec/support/apis/api_helper.rb +15 -0
  182. data/spec/dummy/spec/support/apis/shared_examples_a_json_controller.rb +196 -0
  183. data/spec/dummy/spec/support/templet/partial_test_helpers.rb +32 -0
  184. data/spec/dummy/spec/support/templet/shared_examples_a_viewer.rb +105 -0
  185. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/-6/-6-48LISBeQVJvpEXNgFstDrCriEFNmvje6XhidzlV4.cache +1 -0
  186. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/-D/-DLE9y_1ICajcEaHcprHYBO8vjXpHySH_56FSb0SLOs.cache +0 -0
  187. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/-Y/-YJ1ILDQvu3hOKkF0VR9K_z04e2-EVHglO0MAFS8gpQ.cache +1 -0
  188. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/-_/-_7FgdEon9WttcnvoyQAysmonCHN7FxsrcuDa5OTUJQ.cache +1 -0
  189. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/0u/0u-iWymOJvpggI1uY7Na3322xwcjNY7egB-czjV96m4.cache +2 -0
  190. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/0x/0xArd189AygdGItqWO0_5BfinFQjLZjwyVsAGWqOgKg.cache +1 -0
  191. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/2S/2SfjLWkOp2BGM0OzwsshKpnXI8rlJFOV6ZJsIszRn6k.cache +1 -0
  192. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/3h/3hFAACevvXtDja9zz3rMK6gA1MD1I7_puWyRRkV7sLk.cache +2 -0
  193. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/4o/4oNwzIrltWrfajciBz7JHd5RT5_XVv04L6NdaBGN794.cache +3 -0
  194. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/7F/7F3o6QQqoI0bDk6-A5qMN8LCZQALddlu23KiRWBxtWk.cache +0 -0
  195. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Af/AfFBDeKpi4wSUc7rcjxfjPbEgV6GOGXTjeZhHrfDX48.cache +0 -0
  196. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Bf/BfD6ZVgFq-kWDMMVb2EE5ZAKgsgn1VUR9oVxD0hHVMI.cache +0 -0
  197. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Bo/Bogjbc_D5J-6_m5KEgeXt_GHc-IbUt1_FDWP4PHV0P8.cache +1 -0
  198. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/DF/DF3HgsSD9LO1Bz8d3GJi_G6wBExmsnBJ6b1pvZEGE7w.cache +1 -0
  199. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/DO/DO8Gqh32jK2GrO9uIlH7qvDkelVw0VM8CTSOUj6iUEo.cache +1 -0
  200. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/GC/GCNwk_ABiY0z51bz8iC8tqLLWKhQwxW4-JLNKv-SRe0.cache +1 -0
  201. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Gl/Gls_Zud1kxq7p08FGBfzalbaLMlLBl28bOYebh7Ljrg.cache +0 -0
  202. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Gm/GmHHk4YNC0G2V_5gQZp0U6mKFPxGSgL7fwWI3_fajrk.cache +1 -0
  203. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Gr/GreB3WHN8MyWMDFGNyqJJcxGblgo-5XepsEHvdJSQGI.cache +1 -0
  204. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/HC/HCDOUd7-S45aJ_PjVAC_Vmjyud3i1aQv4cE3t9_Z3Dw.cache +2 -0
  205. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Hd/HdvsElcHSt7aKjG9jocgIQJEvBjBbeSZ8HntI1pc38o.cache +1 -0
  206. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Iv/IvR5RxSTQkxfGWSoy5S2s7wO5u5qwCJ5mNAhqNJtJDY.cache +0 -0
  207. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/JS/JSYyQZJzLNqpmVR--ZDUW6PY7_HflyFFHDAOLenxlP4.cache +1 -0
  208. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Jx/JxJXzSistcpH4S_9CbGx_wyjVTaE77ZDDfOc4uTfvdM.cache +0 -0
  209. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/MH/MHCZUSVJq62YPmcVVkfjp2B5uH_nDL7snLl4yqvlSJY.cache +1 -0
  210. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/MY/MY5theanttko1gCnW9vKb0Z1GkJn8Ofk149HwOt0UAM.cache +0 -0
  211. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Mn/MnGg5XDll2jo-E_CTC1htiNc0hOY6z80_bwGCvpYTXk.cache +1 -0
  212. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Nt/NtYu5CjAvU5ZHxSOn6Q4LPukD3hBE-3vYe30d_uSBzM.cache +1 -0
  213. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Nu/NuIepb7qomZzBDAJMUROsshKo8TJxdmFR4yOe64W58w.cache +1 -0
  214. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/R7/R7ngeIqpdwSWkbjbxxzh6B-KczkWMcxYMIkj5inxrV8.cache +1 -0
  215. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/S9/S9MhILnM64qd2M9Z92TrNMtw7VUWZxf3H367OO8rlhs.cache +2 -0
  216. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/SI/SIZUy2mtjUm_G1YIulRCovzgkCwV1eoR2NLiYcsR1Ws.cache +0 -0
  217. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Sl/SlECThrSAExfICiFGVi-zu240BVDaUldaRs4qcj354U.cache +0 -0
  218. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/St/St6dTA4niiCDLnnArKZV38uZNFf6MbEZ_jHGC-Upft0.cache +0 -0
  219. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/T6/T6p-BnPmMCmpJdaqrjWmLMsBW8SNJpSW6w-Azc3XGVk.cache +1 -0
  220. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Vs/VsZPCEai1GtOT-vHjxMS8kAP9ASG5i_2O_EP76uI7Qs.cache +0 -0
  221. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Vv/Vv6dack32HV3tIZ_6F4BF8Mrrnb7wZEG4VlEKumQ6L0.cache +2 -0
  222. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Wp/WpV6mJwJX9dwIFJGLoJoa-gXNe1-ZHusE9SwvnWysa8.cache +0 -0
  223. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Wy/Wya0wl0Q2nXYb5-bC5Fbo0sDZfKb3415AjtSjld7fQI.cache +1 -0
  224. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/b7/b7j7TIOE1nnqvMku0QePWFrwCkaKkNpxkiWST6PAplo.cache +1 -0
  225. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ck/ckDOh-FroVE8r1fwUNWmnRconIREuVdmkZEFkaP9KfU.cache +1 -0
  226. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/eN/eNQPQP-9gB3xzxJBsG7soV6Ie0YZ3gxIS97PgYtZVT8.cache +0 -0
  227. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/gb/gbUMPMF8S0OQVsFHyAjHpHVEg-3iZzTVIQZDmfq-ycE.cache +1 -0
  228. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/if/ifyb5SlIS8vkACz_6P0uTOGijMB4C5TyFWmrMq3DYIg.cache +2 -0
  229. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/jg/jg-s5YLdnojCtHqzfDTsvcy6UHewDRl1X09qlGyvyag.cache +1 -0
  230. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ko/koPyQus8Oqrx18bnLj-5nJrKvFf6FDDQbv2qEa7Bl7M.cache +0 -0
  231. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/lG/lGRRazgrFErFx1PkfDlca6r-0MGQR40i0tq0Wgm2FNU.cache +1 -0
  232. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/lS/lStvx9Beg2l4s8L-QdTSKuc5_qQPQAZPnIcRI7JkpPE.cache +2 -0
  233. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/lZ/lZIacHrJV5bDohEHsVOXDGIDrUH2h4YvwV9g-MWmh3k.cache +3 -0
  234. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/lq/lqM4-wfprvp5FEBp1pSm88Jwx-Vb2oJab2rjLtUcIyM.cache +1 -0
  235. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/n_/n_xYqQYhwEMQknb3jFQnjlxxBE9TzMNHCdJ-bEyZFIw.cache +2 -0
  236. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/nx/nxTv3sKVUQZADJyM3dPaVmUA78MIsMLD_K279yN_GsI.cache +2 -0
  237. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ps/psGFyjvQcs8JpIV8BDeCqQfHaLYgIgSAi86n4RrFpFs.cache +1 -0
  238. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/r1/r1IIabhuPhgB3n8V3ZMRN0SqIsXJ8bH0ABTRzHTG1SU.cache +2 -0
  239. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/vt/vtskp0QTt72oDQNM6mYZ8pCclh2HICHeYZ1QtDvC5xo.cache +1 -0
  240. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/wi/win_v0ZNu-l7AoRx8w3ls1xcy0mUExLBVMCSr5oaJFc.cache +2 -0
  241. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/yo/yoggubxI12fIM1o5TtxUialrUN-LWOfRaV_tqc1HAC4.cache +0 -0
  242. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zH/zHnHpZP25wEHaF3mI_M9RGH1zeCApf6mwhLB3Lku1zs.cache +3 -0
  243. data/spec/dummy/tmp/development_secret.txt +1 -0
  244. data/spec/factories/answers.rb +10 -0
  245. data/spec/factories/categories.rb +5 -0
  246. data/spec/factories/questions.rb +8 -0
  247. data/spec/helpers/templet/forms/bs_form_errors_spec.rb +18 -0
  248. data/spec/helpers/templet/forms/bs_form_spec.rb +58 -0
  249. data/spec/helpers/templet/layout/html_rails_spec.rb +64 -0
  250. data/spec/helpers/templet/links/bs_link_set_collection_spec.rb +79 -0
  251. data/spec/helpers/templet/links/rest_link_procs_params_spec.rb +68 -0
  252. data/spec/helpers/templet/links/rest_link_procs_parents_spec.rb +78 -0
  253. data/spec/helpers/templet/links/rest_link_procs_spec.rb +140 -0
  254. data/spec/models/answer_spec.rb +9 -0
  255. data/spec/models/category_spec.rb +9 -0
  256. data/spec/models/question_spec.rb +9 -0
  257. data/spec/rails_helper.rb +61 -0
  258. data/spec/spec_helper.rb +108 -0
  259. data/spec/support/templet/model_parent_helpers.rb +36 -0
  260. data/spec/support/templet/partial_test_helpers.rb +32 -0
  261. data/spec/support/templet/rest_link_procs_assignments.rb +43 -0
  262. data/spec/support/templet/rest_link_procs_helpers.rb +15 -0
  263. metadata +470 -38
  264. data/.gitignore +0 -8
  265. data/.travis.yml +0 -5
  266. data/Gemfile +0 -6
  267. data/LICENSE.txt +0 -21
  268. data/bin/console +0 -14
  269. data/bin/setup +0 -8
  270. data/lib/generators/templet/core/USAGE +0 -23
  271. data/lib/generators/templet/core/core_generator.rb +0 -128
  272. data/lib/generators/templet/templates/core/app/panel/flash_messages.rb +0 -33
  273. data/lib/generators/templet/templates/core/app/panel/nav_args_option.rb +0 -30
  274. data/lib/generators/templet/templates/core/app/panel/show_parents_option.rb +0 -22
  275. data/lib/generators/templet/templates/core/app/panel/sidebar_links_option.rb +0 -24
  276. data/templet_rails.gemspec +0 -36
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e7deaf8989e6c551f2a2a43643b4a9cf0cc869f6
4
- data.tar.gz: d36afba37dfd38b61d462d812df24ec821413265
2
+ SHA256:
3
+ metadata.gz: ef2754d432745180b4320ecd6fd27b4b947e704387735db7f4453dc0153649d4
4
+ data.tar.gz: 49fd8a805cb8199ae055964ada2ebdaa28d6d0e7f7cd12dcea4a1e661dcf3093
5
5
  SHA512:
6
- metadata.gz: f717307ac491b39041177dcaa47bc3939e7bfa746829759f77a2963ac1a58263a521fca4e7a537e482fa3f7278b7d4526afe18bec17490681978f1414f8fd4e9
7
- data.tar.gz: 5144a6c2c625b587c55c263a42943503f6c1ac01ced1220aa833aa6c6fca5129a936c6fab38c14c7c9b7668b23cbedc70d926e5ef169ca89d982822dcbe3cab3
6
+ metadata.gz: 7b827e845ac901d87db748e74ccdfdb732dff07225215bb8548485f8d7c51950950debfe917a6e30ea52cdfe37ce0f0c3c6e97331d8cb743d33a6caa4f62b67c
7
+ data.tar.gz: d72cbd74415bf74e347ad562211eb96c0417469094f6a5823c5f60489635ffb53be7f14919eff310f6855c465bbad650024318d6e736f836520b83271148a351
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2019
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Templet
1
+ # Templet Rails
2
2
 
3
3
  ## Sections
4
4
 
@@ -24,20 +24,23 @@ a wider summary.
24
24
 
25
25
  This is a framework to render views in Rails.
26
26
 
27
- It replaces ERb (or HAML, etc.) scripts with a single class
28
- that, by default, renders (Bootstrap) HTML for the standard REST actions.
27
+ It replaces ERb (HAML, etc.) scripts with pure Ruby classes
28
+ that, by default, render (Bootstrap) HTML for the standard REST actions.
29
29
 
30
- It facilitates a more object oriented approach to coding up views,
31
- yet remains compatible with existing view scripts and Helper methods.
30
+ This facilitates a more object oriented approach to writing view code,
31
+ yet the framework retains compatibility with
32
+ Rails' view scripts and Helper methods.
32
33
 
33
34
  If you're familiar with Rails,
34
- getting to grips with this framework should cause little difficulty,
35
- or take much time.
35
+ it shouldn't take you too much effort to learn this framework.
36
+ Its underlying API is not large or complicated,
37
+ and you can have a REST interface up and running
38
+ as quickly as you can with Rails' scaffold generators.
36
39
 
37
40
  ### Example Application
38
41
 
39
42
  To learn it practically, there is an example Rails app,
40
- [questionable](https://github.com/srycyk/questionable),
43
+ [templet_demo](https://github.com/srycyk/templet_demo),
41
44
  which is a small administrative front-end of just three models.
42
45
 
43
46
  This small app has lots of examples that illustrate
@@ -55,22 +58,23 @@ there is this guide.
55
58
 
56
59
  Although it's quite wordy, short of examples, not exhaustive,
57
60
  and a lot to take in at one sitting,
58
- nevertheless, it does explain why you may want to use it,
61
+ it does explain why you may want to use the framework,
59
62
  where you begin,
60
63
  how it works,
61
64
  what it contains,
62
- and its internal organisation.
65
+ as well as outlining its internal organisation.
63
66
 
64
- In addition, there is another guide found at,
67
+ In addition, there is another guide, to be found at
65
68
  [templet](https://github.com/srycyk/templet),
66
- that describes the DSL that renders HTML tags.
69
+ which describes the DSL that renders HTML tags.
70
+
67
71
  This DSL, which is heavily used by the higher-level framework,
68
72
  is so straightforward and succinct
69
- that you may only need a passing acquaintance with it.
73
+ that you may only need a passing acquaintance with its documentation.
70
74
  _You may well pick it up as you go along._
71
75
 
72
- For hard-core punishment gluttons, there is yet more documentation -
73
- the source code carries comments in the harder bits,
76
+ For devoted punishment gluttons, there is yet more to read -
77
+ the source code carries comments
74
78
  and the purpose of each class is spelled out.
75
79
 
76
80
  <a name="intro"></a>
@@ -86,9 +90,11 @@ and
86
90
  The first is a self-contained DSL for rendering markup, i.e. HTML pages.
87
91
 
88
92
  The second, which relies on the first,
89
- is a Rails framework that has similar functionality to
90
- the the Rails scaffold generator.
91
- And it is as easy to get working, but more modular and extensible.
93
+ is a framework (packaged as a Rails Engine)
94
+ that has similar functionality to
95
+ the Rails scaffold generator.
96
+ It is just as easy to get working and to change,
97
+ but it is, arguably, more modular and concise.
92
98
 
93
99
  > Naturally, these gems need to be declared in your *Gemfile*.
94
100
  > Please see the *Configuration* section below for further details.
@@ -100,7 +106,7 @@ So much so that *framework* may be too grand a term,
100
106
  as it could equally be described as a pattern,
101
107
  with an attached API.
102
108
 
103
- The framework follows many of Rails' conventions,
109
+ The framework follows many of Rails' (naming) conventions,
104
110
  notably it provides default behaviour
105
111
  that can be easily overridden or supplanted.
106
112
 
@@ -108,12 +114,12 @@ that can be easily overridden or supplanted.
108
114
 
109
115
  It allows the DRY principle to be more easily applied to the views
110
116
  than with the usual templates, (like ERb &amp; HAML),
111
- which are essentially a single block of in-line code,
112
- which can quickly become long and repetitive.
117
+ which are essentially a single stretch of in-line code
118
+ that can quickly become long and repetitive.
113
119
 
114
- The framework promotes productivity
120
+ This framework promotes productivity
115
121
  as the views can be written in idiomatic Ruby,
116
- thus allowing more standardisation, concision and encapsulation.
122
+ thus allowing more standardisation, reuse and encapsulation.
117
123
 
118
124
  The framework does *not*, in any way, *monkey-patch* the Rails core,
119
125
  and should work with just about any version of Rails, even future ones!
@@ -121,8 +127,9 @@ Though it requires a fairly recent (i.e. supported) version of Ruby.
121
127
 
122
128
  ### Installing
123
129
 
124
- An installation involves issuing a few commands, and, almost certainly,
125
- will have no knock-on effects elsewhere.
130
+ An installation involves issuing a few commands,
131
+ and, almost certainly,
132
+ it will cause no conflicts with other packages.
126
133
  Likewise, a de-installation is even less trouble.
127
134
 
128
135
  ### Twitter Bootstrap Dependency
@@ -134,19 +141,20 @@ _Without it, the HTML will look awful!_
134
141
  If you don't currently use this particular Bootstrap (3.3) version,
135
142
  it won't be difficult, or take too long, to update the source yourself.
136
143
 
137
- But if you don't use Bootstrap, it'll take some time
144
+ But if you don't use Bootstrap, it'll take you some time
138
145
  to modify the source to accommodate some other CSS library.
139
146
 
140
147
  ### Main Sections
141
148
 
142
- The framework introduces the following code divisions:
149
+ The framework is divided into the following parts:
143
150
 
144
- 1. The framework's core code,
145
- which is directly copied into your application's file system,
146
- in a few separate sub-directories.
147
- This shouldn't need much changing - if any.
151
+ 1. The framework's core code.
152
+ This is accessed from inside of the *templet_rails* engine.
153
+ But if you decide to modify this code yourself,
154
+ there is a generator that will copy it into
155
+ your application's file system,
148
156
 
149
- 2. Application code, consisting of your own
157
+ 2. Application code. This consists of your own
150
158
  modules that cater for specific use-cases.
151
159
  _As a part of the initial installation,
152
160
  there are general-purpose classes pre-installed in this area,
@@ -159,12 +167,12 @@ The framework introduces the following code divisions:
159
167
  #### Two Basic Steps
160
168
 
161
169
  To build individual application modules with the framework,
162
- you create a controller and a *Viewer* class,
170
+ you need to create a Controller and *Viewer* class,
163
171
  both of which can be generated.
164
172
 
165
173
  ##### The Controller
166
174
 
167
- The controller looks pretty much the same as usual,
175
+ A controller will look pretty much the same as usual,
168
176
  except for the way the view is invoked.
169
177
 
170
178
  You render a view by calling, from the controller,
@@ -177,24 +185,27 @@ to launch the view rendering.
177
185
  ##### The Viewer
178
186
 
179
187
  This *Viewer* class carries out all of the HTML rendering,
180
- letting you diverge from default functionality
188
+ and it lets you diverge from default functionality
181
189
  that is provided by its superclasses.
182
190
 
183
- Normally, there is just one of these classes per controller,
184
- and they have (public) method names in common.
185
-
186
191
  Inside this *Viewer* class, you're able to override a hatful of methods,
187
192
  for either fine, or coarse, grained modifications.
188
193
 
189
- Among other things, this class offers the following features:
194
+ Normally, there is just one of these classes per controller,
195
+ and they have (public) method names in common.
196
+ For example, an *index* method, in the controller,
197
+ calls a counterpart *index* method in the *Viewer* class.
198
+
199
+ Among other things, this *Viewer* class offers the following features:
190
200
 
191
- 1. Adding, or excluding, one or two surrounding Layouts which are
192
- shared by a group of pages.
201
+ 1. A main surrounding Layout which can be varied,
202
+ (maybe by inheritance),
203
+ and also be shared by a specified subset of pages.
204
+ For JS requests, obviously, it's left out.
193
205
 
194
- 2. An ability to use Partials that let you split the whole
195
- into discrete parts.
206
+ 2. Partials that let you split a whole page into discrete parts.
196
207
  Like the Layouts above, they are similar (in intent) to
197
- their correlates in Rails, but here they are Ruby subclasses
208
+ their correlates in Rails, but here they are Ruby (subclasses)
198
209
  that render HTML by means of a rudimentary DSL.
199
210
 
200
211
  3. An API to render composite HTML components,
@@ -215,8 +226,8 @@ Among other things, this class offers the following features:
215
226
 
216
227
  #### Generators
217
228
 
218
- The gem for the framework consists of several generators,
219
- which are your starting point.
229
+ The gem for the framework consists of several generators.
230
+ These are your starting point in application development.
220
231
 
221
232
  A few are to do with the installation of the framework,
222
233
  and are to be run just once.
@@ -225,7 +236,7 @@ The others are for producing application code,
225
236
  and are to be run multiple times with varying arguments.
226
237
 
227
238
  Principally, there is a scaffold generator that creates, at once,
228
- a controller, a *Viewer* class to customise the HTML output,
239
+ a controller, a *Viewer* class (to customise the HTML output),
229
240
  some RSpec tests, and a Rails routing entry.
230
241
 
231
242
  The generated code code should work without intervention,
@@ -243,18 +254,20 @@ which are mentioned in the *Configuration* section at the end.
243
254
 
244
255
  ### What is it?
245
256
 
246
- It is a Ruby framework, with associated libraries,
247
- that provide an object oriented (pure Ruby) approach to
248
- the rendering of markup, i.e. HTML and XML.
257
+ It is a framework, together with associated libraries,
258
+ for rendering views in Rails.
259
+ It provides scaffold-like functionality,
260
+ and it permits you to render markup (HTML) in pure Ruby,
261
+ thereby lending itself to component-based OO paradigms.
249
262
 
250
- The framework is sparse, has few dependencies
251
- and is not particularly complicated.
263
+ The framework is pretty sparse, has few dependencies,
264
+ and is not difficult to code in.
252
265
 
253
266
  ### Why use it?
254
267
 
255
268
  Primarily, it's to boost development efficiency.
256
269
 
257
- But you may also find it more comfortable to code in,
270
+ But you may also find it more comfortable to work with,
258
271
  as it gives you more of a free rein than, say, ERb scripts.
259
272
 
260
273
  #### *It's quick*
@@ -272,24 +285,25 @@ it lets you do so easily and briefly.
272
285
  In Rails, object oriented support stops at the view stage.
273
286
 
274
287
  When you use scripts like ERb or HAML or SLIM,
275
- you're constrained by their in-line procedural design.
288
+ you're constrained by their in-line procedural methodology.
276
289
 
277
- These scripts often end up being monolithic and painful to maintain.
290
+ These scripts often end up being monolithic and awkward to maintain.
278
291
  Code sharing is too verbose,
279
- as it usually results in a proliferation of tiny files and
292
+ as it can result in a proliferation of tiny files and
280
293
  complex helper methods, which, since they are global in scope,
281
294
  need to be named with care.
282
295
 
283
296
  In contrast, within this framework everything can be written in
284
- pure unrestrained Ruby,
285
- allowing you to use the language's object oriented (and functional)
297
+ unrestrained Ruby,
298
+ allowing you to use the language's object oriented, and functional,
286
299
  features as you see fit.
287
300
 
288
301
  For example, using this framework, it's much easier
289
302
  to implement general-purpose components,
290
303
  to fine-tune small variations,
291
304
  to enforce site-wide uniformity in presentation,
292
- and to rearrange the page sections.
305
+ to produce syntactically correct HTML,
306
+ and to rearrange the various sections of a page.
293
307
 
294
308
  ### How easy is to learn?
295
309
 
@@ -304,14 +318,13 @@ In this framework, you're still able to use the
304
318
  like *render*, *link\_to* and *options\_from\_collection\_for\_select*.
305
319
 
306
320
  This allows you to *mix 'n' match* the two approaches,
307
- which lays out a path should you require to switch
308
- from from one methodology to the other.
321
+ allowing them both to sit alongside one another.
309
322
 
310
323
  ### How is this facility used?
311
324
 
312
325
  You can use it as a framework
313
326
  that performs the entire view rendering process,
314
- or you can just use it as a library (toolkit) to render view segments.
327
+ or you can use it as a library (toolkit) to render view segments.
315
328
 
316
329
  #### *As a framework*
317
330
 
@@ -325,7 +338,7 @@ To use it as a framework there are generally just two classes to create,
325
338
  2. A *Viewer* class, which renders complete HTML pages
326
339
  for (the actions of) its corresponding controller,
327
340
  with which it has a similarly named public API.
328
- For example, both may share the public method names, *index* and *show*.
341
+ For example, both may have public methods, *index* and *show*.
329
342
 
330
343
  #### *As a library*
331
344
 
@@ -343,38 +356,37 @@ Highly unlikely, as it doesn't alter anything in any existing classes,
343
356
  and there aren't too many calls to the Rails API.
344
357
 
345
358
  It has only one run-time dependency on a third-party gem,
346
- as it uses *Twitter Bootstrap 3.3*, (for the HTML presentation).
359
+ which is *Twitter Bootstrap 3.3*, (for HTML styling).
347
360
 
348
361
  ### What does it contain?
349
362
 
350
363
  The package consists of two relatively small gems,
351
- firstly, a rendering DSL,
352
- and secondly, a gem that is for use with Rails and Bootstrap (3.3).
353
-
354
- The first is a run-time dependency.
355
- The second contains several generators
356
- that add files in your application's file system.
364
+ which are both run-time dependencies.
365
+ The first is a DSL for rendering HTML,
366
+ the second is an engine that is for use with Rails and Bootstrap (3.3),
367
+ that contains the framework's source and several generators.
357
368
 
358
369
  ### Where does it add its code?
359
370
 
360
- The framework, by default, is copied into two
361
- directories: *app/helpers/templet/* and *app/controllers/templet/*,
362
- and two Ruby modules in *app/helpers/*.
363
-
364
371
  Your application view's code is put under *app/helpers/app/*.
372
+ There's a generator to set this area up.
373
+
374
+ The framework's source is accessed from
375
+ within the *templet_rails* engine.
376
+ But if you plan to change the source,
377
+ you can use a generator to copy it into your app directly.
365
378
 
366
379
  ### Is it easy to deinstall?
367
380
 
368
- If you try it out, and then decide to ditch it,
381
+ If you try it out, and then opt to ditch it,
369
382
  a rollback will almost certainly be effortless.
370
383
 
371
384
  It will just involve deleting a number of files,
372
385
  for which there's a generator, *templet:destroy*.
373
386
 
374
387
  This generator deletes all of the framework
375
- and the nearly all of the application files,
376
- apart from any controllers that you may have generated,
377
- and entries in *config/routes.rb*.
388
+ and the nearly all of the application files -
389
+ your controllers and entries in *config/routes.rb* are left alone.
378
390
 
379
391
  ### What does it depend on?
380
392
 
@@ -384,7 +396,7 @@ This is not strictly compulsory, (it'll spit out the HTML regardless)
384
396
  but, right now, you'll have to change the source code yourself
385
397
  to disentangle this dependency,
386
398
 
387
- It's currently for Bootstrap 3.3, but if you
399
+ It's currently for Bootstrap version 3.3, but if you do
388
400
  fork the code for compatibility with, say, Bootstrap 4,
389
401
  you should only be occupied for a few hours,
390
402
  and you'll only need to edit a half-dozen files at most.
@@ -393,16 +405,21 @@ However, if you don't use Bootstrap,
393
405
  and you choose to adapt this framework
394
406
  to work with some other styling (CSS) API,
395
407
  it'll likely take you a good while.
408
+ _Not so much in the number of code changes,
409
+ but in tracking them down._
396
410
 
397
411
  ### Will it be supported?
398
412
 
399
413
  No guarantee!
400
414
  But will you need long-term external support? Probably not.
401
415
 
402
- The code-base so small that taking responsibility
416
+ The code-base is so small that taking responsibility
403
417
  for its upkeep should not be too onerous.
404
418
  There is little to go wrong.
405
419
 
420
+ Dealing with future Ruby and Rails deprecations
421
+ will probably be your biggest risk.
422
+
406
423
  ### Are there tests?
407
424
 
408
425
  It comes supplied with a rudimentary testing system.
@@ -414,23 +431,25 @@ using (Nokogiri) CSS selectors on the resultant HTML.
414
431
 
415
432
  Although limited in scope, these tests can be written in
416
433
  a very small chunk of declarative code.
417
- Nonetheless, in their present form, they are not a viable substitute
418
- for the usual model and feature tests.
434
+ Nonetheless, in their present form,
435
+ they are not a viable substitute for the usual testing suites.
419
436
 
420
437
  When running the tests, it needs the gems:
421
438
  *rspec*, *nokogiri* and *factory_bot*,
422
- for which (model) factories have already been defined.
439
+ for which (model) factories have previously been defined.
423
440
 
424
441
  ### What sort of applications is it most suited for?
425
442
 
426
443
  1. It's ideal for REST-based apps, especially administrative dashboards.
427
444
 
428
445
  2. Experimental or MVP sites, where it can quickly plug holes.
429
- The framework reduces development time because most modifications
430
- can be written in compact sections of (structured) code.
446
+ The framework reduces development time because many modifications
447
+ can be written in small (centralised) code sections,
448
+ and more complex modifications can be structured in whatever
449
+ way you think best.
431
450
 
432
- 3. In general, it's for data-base driven sites -
433
- not so much for fancy (HTML/JS-heavy) sites
451
+ 3. In general, it's for data-base driven (form-filling) sites -
452
+ not really for fancy (JS-heavy, graphic-laden) sites
434
453
  where data is passively consumed.
435
454
 
436
455
  ### What are its advantages?
@@ -439,33 +458,39 @@ for which (model) factories have already been defined.
439
458
  than the conventional Rails ERb rendering.
440
459
 
441
460
  2. Presentational changes can be made from a single place,
442
- and then propagate immediately throughout the whole site.
461
+ and then they'll propagate immediately throughout the whole site.
443
462
  For example, all textual HTML links can be changed to iconic
444
463
  in a single line of code.
445
464
 
446
465
  3. It lets you do things like putting view segments
447
466
  into variables that you can pass around for, say,
448
- later rendition within another nested component.
467
+ later rendition within another (nested) component.
449
468
 
450
469
  4. It can be used alongside existing views scripts and Helper methods.
451
470
 
452
471
  5. Testing view components is made easier, as they can be implemented
453
- in separate stand-alone classes.
472
+ in separate stand-alone classes with regulated input.
454
473
 
455
474
  ### What are its disadvantages?
456
475
 
457
476
  1. The bare Bootstrap styling is characterless,
458
- and the HTML will be difficult for designers to modify.
477
+ and the HTML will be tricky for web designers to modify.
459
478
 
460
- 2. The way in which this framework is structured may rub against your
461
- existing practices.
479
+ 2. The way in which this framework is laid out may
480
+ rub against your existing practices,
481
+ which may necessitate so much code reorganisation
482
+ that adopting the framework won't be worthwhile.
462
483
 
463
484
  3. Some functionality, provided by Rails, for view rendering
464
- is now not available. These are things like: view path look-ups,
465
- Turbolinks support, and an inability to *yield* additional content
466
- at arbitrary positions on the page.
467
-
468
- 4. Similarly, caching view segments may be more difficult than usual.
485
+ become unavailable.
486
+ Principally these things are: view path look-ups,
487
+ shortcuts for rendering collections,
488
+ inferring partial names from instance variables,
489
+ and an inability to *yield* additional content
490
+ at arbitrary positions on the page, i.e. *content_for* blocks.
491
+ _But in practice, this shouldn't be much of a constraint._
492
+
493
+ 4. Caching view segments may be prove harder than usual.
469
494
  You should still be able to use Rails' low-level fragment caching,
470
495
  but partial caching is impossible.
471
496
 
@@ -476,21 +501,21 @@ for which (model) factories have already been defined.
476
501
  6. But seriously, there may be possible security issues with
477
502
  code injection attacks.
478
503
  This is because the whole page is made *html_safe*.
479
- Probably the best way of safeguarding against this is by adding model
480
- validations to ensure that malicious snippets of code cannot be saved
481
- to begin with.
504
+ Probably the best way of safeguarding against this is by including
505
+ model validations to ensure that malicious snippets of code
506
+ cannot be saved to begin with.
482
507
  There is a validator module,
483
- (*app/models/concerns/nasty_char_validator.rb*, in *questionable*)
508
+ (*app/models/concerns/nasty_char_validator.rb*, in *templet_demo*)
484
509
  which can be added to model classes to prevent users from saving
485
510
  records containing field values with non-standard punctuation.
486
511
  Alternatively, you could *sanitize* input fields
487
- in a *before_validation* callback.
512
+ in a *before_validation* callback (inside of a model).
488
513
 
489
514
  ### How does it compare to similar offerings?
490
515
 
491
516
  Although the following claims do present
492
- the framework in its *best light*,
493
- they, nevertheless, hold good, arguably.
517
+ this framework in its *best light*,
518
+ nevertheless, some might say otherwise.
494
519
 
495
520
  1. It is similar in function to data-base maintenance gems,
496
521
  (like *active_admin*),
@@ -508,7 +533,11 @@ they, nevertheless, hold good, arguably.
508
533
  4. You can write HTML with the economy of HAML or SLIM,
509
534
  and be assured that it's well-formed.
510
535
 
511
- 5. The *Viewer* classes, in themselves, have the simplicity of Sinatra.
536
+ 5. The *Viewer* classes, in themselves, have the simplicity of, say,
537
+ Sinatra scripts, as they permit a number of distinct web pages
538
+ to be defined in a single file, which is fine in simple cases.
539
+ But in more complicated cases, you'd write a dedicated class
540
+ to render the HTML, and you'd invoke it from the *Viewer* class.
512
541
 
513
542
  <a name="gen"></a>
514
543
  ## Generators
@@ -517,7 +546,7 @@ The generators are your first port of call.
517
546
  One is invoked to install the framework's core code.
518
547
  Others are invoked as an initial step in developing application modules.
519
548
 
520
- The generators are contained in the gem, *templet_rails*.
549
+ The generators are contained in the engine, *templet_rails*.
521
550
  Apart from documentation, this gem contains nothing else of interest,
522
551
  and it's only for use in the development environment.
523
552
 
@@ -528,9 +557,10 @@ $ rails g
528
557
  ...
529
558
  Templet:
530
559
  templet:controller
531
- templet:core
560
+ templet:core_install
532
561
  templet:core_rspec
533
562
  templet:destroy
563
+ templet:install
534
564
  templet:routes
535
565
  templet:rspec
536
566
  templet:scaffold
@@ -541,57 +571,23 @@ Templet:
541
571
  > *Troubleshooting tip.* If you're unable to see these generators as listed,
542
572
  > from the command-line, try this: `$ mkdir lib/generators`.
543
573
 
544
- ### Framework Installation
545
-
546
- The first generator to run is *templet:core*,
547
- which copies the complete source code of the framework into
548
- your local file system - once and for all.
549
-
550
- To install the framework, from the command line, key in:
551
-
552
- ````
553
- $ rails generator templet:core
554
- ````
555
-
556
- #### Testing the Framework Internally
557
-
558
- If you wish to add some tests for the framework itself,
559
- then you can run the generator *templet:core_rspec*.
560
- This generator copies files into your *spec/helpers/* directory tree,
561
- (inside the sub-directories: *app/* and *templet/*).
562
-
563
- This part is best left out at first, as it adds clutter,
564
- slowing down your test suite without any real pay back.
565
- However, if you modify the framework for yourself
566
- then these tests may be useful.
567
-
568
- #### Deinstallation
569
-
570
- If you decide to remove the framework,
571
- you can run the generator *templet:destroy*.
572
- This deletes __all__ associated files, apart from the controllers.
573
- You do this with:
574
-
575
- ```
576
- $ rails generator templet:destroy --all
577
- ```
578
-
579
574
  ### Generating Application Code
580
575
 
581
- The remaining generators are for use when
582
- you begin to write your own application modules.
576
+ The first generator to run is *templet:install*,
577
+ which prepares an area for putting your
578
+ application code in - once and for all.
583
579
 
584
- But prior to using these generators, you need a model already in place,
580
+ Prior to using these generators, you need a model already in place,
585
581
  which you can create using the standard Rails (model) generator.
586
582
 
583
+ #### Scaffold Generator
584
+
587
585
  These generators replace Rails' controller and view generators,
588
586
  with which they have a lot in common.
589
587
  That is, they provide basic REST functionality,
590
588
  (i.e. a data-base administration interface),
591
- that should run without error straight off,
592
- and is ready for you to change.
593
-
594
- #### Scaffold Generator
589
+ that should run without error straight off.
590
+ And the code produced is ready for you to customise.
595
591
 
596
592
  The quickest way to start is by using the *templet:scaffold* generator,
597
593
  which creates the following:
@@ -612,7 +608,7 @@ which creates the following:
612
608
 
613
609
  4. REST routing entries, which are written to *config/routes.rb*.
614
610
 
615
- In turn, it runs the four generators:
611
+ In succession, the scaffold runs the four generators:
616
612
 
617
613
  1. templet:controller
618
614
  3. templet:viewer
@@ -627,20 +623,57 @@ which is useful, if, say, you don't want Rspec tests installed.
627
623
  There are several options available which let you specify the names of
628
624
  controllers, models, installation directories, etc..
629
625
  For full information on usage, call any of them with the *--help* option.
630
- For example, `rails g templet:core --help`
626
+ For example, `rails g templet:install --help`
631
627
  The scaffold generator lists all of the options concerned with
632
628
  producing application code.
633
629
 
634
630
  Like in Rails, the generators only provide support for REST functionality.
635
631
  If your requirements diverge from this,
636
632
  and you're forced to write code from scratch,
637
- then these generators probably won't be a great deal of use.
638
- _In such cases, you should find the framework no more difficult
633
+ then the code these generators produce
634
+ probably won't be a great deal of use.
635
+ _In such cases, you should still find the framework no more difficult
639
636
  to code in than traditional view scripts - and maybe it'll be easier._
640
637
 
641
- > Once you're over and done with the generators, you can remove this gem.
642
- > Note that the other gem, *templet*, is a run-time dependency,
643
- > so needs to be present in all environments.
638
+ #### Deinstallation
639
+
640
+ If you decide to remove the framework, and it artefacts,
641
+ you can run the generator *templet:destroy*.
642
+ This deletes __all__ associated files, apart from the controllers.
643
+ You do this with:
644
+
645
+ ```
646
+ $ rails generator templet:destroy --all
647
+ ```
648
+
649
+ ### Framework Installation
650
+
651
+ Although it is more convenient to access
652
+ the framework from within the engine, (*templet_rails*),
653
+ the generator, *templet:core_install*,
654
+ will copy the complete source code of the framework into
655
+ your local file system.
656
+
657
+ This should only be done if you require
658
+ to alter the framework's source code.
659
+
660
+ To install the framework from the command line, you key in:
661
+
662
+ ````
663
+ $ rails generator templet:core_install
664
+ ````
665
+
666
+ #### Testing the Framework Internally
667
+
668
+ If you wish to add some tests for the framework itself,
669
+ then you can run the generator *templet:core_rspec*.
670
+ This generator copies files into your *spec/helpers/* directory tree,
671
+ (inside the sub-directories: *app/* and *templet/*).
672
+
673
+ This part is best left out, as it adds clutter,
674
+ slowing down your test suite without any real pay back.
675
+ However, if you modify the framework for yourself
676
+ then these tests may be useful.
644
677
 
645
678
  <a name="notes"></a>
646
679
  ## Notes
@@ -651,95 +684,91 @@ This part recaps some of what was said before, but in a bit more depth.
651
684
 
652
685
  The framework has a strict hierarchy,
653
686
  in which the higher layers depend on those below.
654
- Starting at the bottom, there are the four layers:
687
+ Starting at the bottom, there are four layers:
655
688
 
656
689
  1. A bare-boned DSL that renders markup tags. You pass in a number of
657
690
  method look-up contexts into this API,
658
- as well as local variables.
691
+ as well as local variables as and when they're required.
659
692
 
660
693
  2. Support for components (as Ruby classes) that render
661
694
  (encapsulated) view segments.
662
695
 
663
- 3. A Rails-like micro-framework that stands in for the usual
664
- view handling mechanism, (i.e. ERb scripts),
665
- providing default functionality, ready to be changed.
696
+ 3. A Rails-like micro-framework that stands in for an existing
697
+ view handling mechanism, e.g. ERb or Haml scripts.
698
+ The framework provides default functionality
699
+ that can be readily changed.
666
700
 
667
701
  4. A Rails scaffolding substitute, that generates a REST administrative
668
- interface. This includes a controller and a *Viewer* class.
702
+ interface. This consists of pairs of Controller and *Viewer* classes.
669
703
 
670
- This is a rather abstract refined description -
704
+ This description, admittedly, is too abstract and refined -
671
705
  so don't linger as more concrete details come next.
672
706
 
673
707
  ### The Framework
674
708
 
675
709
  #### Prerequisites
676
710
 
677
- At run-time, the framework has a single dependent gem, *templet*.
678
-
679
- For testing, it requires *rspec*, *nokogiri* and *factory_bot*.
680
- And it needs *factory_bot* factories for the models being tested.
681
-
682
- #### Framework Code Locations
683
-
684
- The core code, which is installed by the generator, *templet:core*,
685
- is placed in two directories:
711
+ At run-time, the framework has two dependent
712
+ gems, *templet* and *templet_rails*
713
+ _The first is a DSL to generate HTML, the second is a Rails Engine._
686
714
 
687
- 1. In *app/helpers/templet/*, which is a tree (of several branches)
688
- that contains the bulk of the code.
689
- It contains the run-time framework and libraries.
690
- _Incidentally, there is a generator option to relocate this directory._
715
+ For testing, it requires the gems: *rspec*, *nokogiri* and *factory_bot*.
716
+ Also, it needs *factory_bot* factories defined for
717
+ each of the models that are subjects of the tests.
691
718
 
692
- 2. In *app/controllers/templet/*, which contains a few controller modules
693
- of helper methods that simplify the process of invoking the view.
694
-
695
- Also, there are another two files, *app/helpers/templet_helper.rb*
696
- and *app/helpers/app.rb*, which, for now, can be safely deleted.
697
- They are reserved for global settings, the former for the framework,
698
- the latter for the application.
719
+ The testing, however, is optional.
720
+ If you write a comprehensive set of tests yourself,
721
+ the ones that this framework provides will be too superficial.
699
722
 
700
723
  ### Writing Applications
701
724
 
702
- As usual, it's assumed that your applications will, for the most part,
703
- be made up of a series of REST interfaces,
704
- which have one or more models that are fetched from a data-base.
725
+ As is usual in Rails, it's assumed that your application will,
726
+ for the most part, be made up of a series of REST interfaces,
727
+ which contain models that are mapped to some sort of data-store.
705
728
 
706
729
  If your requirements don't square with this methodology,
707
730
  then the framework may only be of limited assistance,
708
- but this much is also true of Rails.
731
+ but this much is also true of Rails itself.
709
732
 
710
733
  #### Application Code Locations
711
734
 
712
735
  In addition to the core code, (mentioned in the preceding section),
713
- the generator, *templet:core*, also creates another directory tree
736
+ the generator, *templet:install*, also creates another directory tree
714
737
  for view-specific application code.
715
738
 
716
739
  The generator installs a skeletal application area,
717
- (under the directory, *app/helpers/app/*),
718
- which is where your own application code goes.
740
+ under the directory, *app/helpers/app/*.
741
+ Also, there's a file *app/helpers/app.rb*,
742
+ which is for your own global settings,
743
+ and which you can delete.
744
+
745
+ Your own application code is to be put here.
719
746
  _At present, relocating this directory might cause issues._
720
747
 
721
748
  The generator also installs (in this area) some place-holder
722
749
  classes for the HTML layouts and REST link menus.
723
- These are put in the two sub-directories, *panel/* and *link_sets/*.
724
- The code placed here is only a suggestion to give you an idea
725
- of how the various elements fit together.
750
+ These are put in the sub-directory, *layouts/*.
751
+ The code placed here is really only a suggestion,
752
+ so will need editing or, most likely, drastic revision,
753
+ However, its basic structure indicates how application
754
+ modules may be assembled.
726
755
 
727
- > By the way, no files are needed in the view's usual directory tree,
728
- > i.e. *app/views/*, except mailers, of course.
729
- > Nor are (the Rails generated) Helper modules needed,
730
- > but their base directory (*app/helpers/*) is still used.
756
+ > By the way, **no** files are needed in the view's usual directory tree,
757
+ > i.e. *app/views/* - except mailers, of course.
758
+ > Nor are (the Rails generated) Helper modules needed.
759
+ > However, the base directory (*app/helpers/*) remains in use.
731
760
 
732
761
  #### Application Modules
733
762
 
734
763
  As said, to hook into the framework,
735
764
  you build individual application modules with a *Controller* and,
736
765
  nearly always, a *Viewer* class.
737
- As said, both of these can be generated.
766
+ As said, both of these classes can be generated.
738
767
 
739
768
  #### The Controller
740
769
 
741
- The controller is put in its usual directory and will look familiar.
742
- It carries out its usual tasks in the usual way - for example,
770
+ The controller is put in its usual location and will look familiar.
771
+ It carries out its tasks in the usual way - for example,
743
772
  you still apply filters and define instance variables for use in the view.
744
773
  The only substantial difference is in the view dispatching.
745
774
 
@@ -764,16 +793,17 @@ And should be useful if you write controller code by hand.
764
793
 
765
794
  The *Viewer* is actually called from the controller's
766
795
  built-in *render* helper method, as an *inline* template.
767
- Eventually, it's a line of code (in the controller) resembling something
768
- like: `render inline: 'ViewerClass.new.index'`.
796
+ Eventually, the call is reduced to line of code resembling:
797
+ `render inline: 'ViewerClass.new.index'`.
769
798
 
770
799
  However, in the current implementation,
771
800
  this *inline* template does not call the *Viewer* class directly,
772
- but instead uses the bridging class, *ViewerCallString*.
801
+ but instead uses a bridging class, *ViewerCallString*.
802
+
773
803
  This class compiles a string of executable Ruby that makes the
774
- actual call to the *Viewer* that fires up the view rendering.
804
+ actual call to the *Viewer*, that initiates the view rendering.
775
805
  This round about path is taken so to pass in (implicitly)
776
- various variables for accessing within the view context.
806
+ a number of variables for accessing within the view context.
777
807
  _This source of this class, *ViewerCallString* is quite well documented._
778
808
 
779
809
  #### The Viewer Class
@@ -781,64 +811,71 @@ _This source of this class, *ViewerCallString* is quite well documented._
781
811
  This class, which is placed under the directory, *app/helpers/app/*,
782
812
  (or sub-directory thereof),
783
813
  performs the functions of the usual view templates, such as ERb scripts.
784
- It renders the entire HTML page for each appropriate controller action.
814
+ It renders an entire HTML page for each appropriate controller action.
785
815
 
786
816
  It inherits from a few superclasses,
787
817
  (e.g. *Templet::ViewerRest*),
788
818
  that provide very basic behaviour that you'll,
789
819
  inevitably, need to extend or replace.
790
- You can do this at any granularity.
820
+ You can do this at any granularity:
791
821
 
792
- * For small changes, like specifying the fields
793
- to display on the *index* or *show* pages.
822
+ 1. For small changes, like specifying the fields
823
+ to display on the *index* or *show* pages.
794
824
 
795
- * For medium-sized changes, like adding pagination, images,
796
- supplementary (contextual) text, link sets, etc..
825
+ 2. For medium-sized changes, like adding pagination, images,
826
+ supplementary text, contextual variation, link sets, etc..
797
827
 
798
- * For very large changes, like writing all of the HTML yourself or
799
- calling ERb templates (via the built-in view helper method *render*).
828
+ 3. For big changes, you may siphon off all of the HTML rendering to a
829
+ separate class, (perhaps inheriting from *Templet::Component::Partial*).
830
+ Or even, pathologically, resort back to ERb scripts,
831
+ (in which case, you'd run the script with the Rails-supplied
832
+ helper method *render*).
800
833
 
801
- Broadly speaking, such changes are made by overriding methods.
834
+ Changes for the first two of these can often be made by overriding methods.
802
835
 
803
- The superclass naming convention, where you append the substring *Viewer*
804
- onto a singular declension of the controller's (camel-cased) name,
805
- saves you from having to explicitly state
806
- the fully qualified class name when you call instances
807
- of this *Viewer* class from the controller.
808
- For example, this (derived) class may be called something
809
- like *App::UserViewer* or,
810
- if it's namespaced, *App::Admin::UserViewer*.
836
+ > The superclass naming convention, where you append the substring *Viewer*
837
+ > onto a singular declension of the controller's (camel-cased) name,
838
+ > saves you from having to explicitly state
839
+ > the fully qualified class name when you call instances
840
+ > of this *Viewer* class from the controller.
841
+ > An example might make this easier to swallow: this (derived) class
842
+ > should be called something like *App::UserViewer* or,
843
+ > if it's to be namespaced, *App::Admin::UserViewer*.
811
844
 
812
845
  #### The Viewer Subclass
813
846
 
814
847
  As said, the *Viewer* class inherits from a number of superclasses.
815
848
  These are: *App::BaseViewer*, (for site-wide settings), which inherits
816
849
  a non-abstract base class, *Templet::ViewerRest*,
817
- which itself inherits from the abstract class, *Templet::ViewerBase*.
850
+ which, in turn, inherits from the abstract class, *Templet::ViewerBase*.
818
851
 
819
852
  The purpose of these subclasses are to render markup (HTML)
820
- for each of the relevant controller actions.
821
- To expedite this, it has the following functionality:
853
+ for each of the corresponding controller actions.
854
+ To expedite this, these superclasses expose the following functions
855
+ that may be made use of when applying your own changes:
822
856
 
823
- 1. Handles shared layouts, which can be varied per controller,
824
- via the *Viewer*.
857
+ 1. Shared layout handling, which can be varied per controller,
858
+ (or action), via directives in the *Viewer* class.
825
859
 
826
- 2. Provides ready access to the underlying API.
860
+ 2. Ready access to the underlying API.
827
861
 
828
- 3. Exposes a number of named data items for use in the view.
829
- Most of these are set up in the call from the controller.
862
+ 3. Providing access to a number of named data items for use in the view.
863
+ Most of these are set up in the call from the controller, like
864
+ instance variables, literal names and run-time options.
830
865
 
831
866
  In very simple cases, you can use an instance
832
867
  of *Templet::ViewerRest*, or *App::BaseViewer*, directly,
833
868
  whereupon a REST interface should still be fully operational.
834
- _Your own subclasses let you deviate from the *no-frills* functionality._
869
+ _Your own subclasses let you deviate from the
870
+ provided *no-frills* functionality._
835
871
 
836
872
  #### HTML Layouts
837
873
 
838
- As in Rails, you can specify layouts which are used by all
874
+ As in Rails, you can specify a layout that is to be used by all
839
875
  (or a circumscribed group of) controllers.
840
876
 
841
- But in this framework there are two layouts, an inner and outer.
877
+ However, in this framework, by default,
878
+ there are two layouts, an outer and inner.
842
879
 
843
880
  These are specified by class names returned by the *Viewer*
844
881
  instance methods, *layout_class* and *panel_class*.
@@ -848,13 +885,13 @@ The former is for the outer layout, the latter for the inner.
848
885
 
849
886
  This is equivalent to the layout that comes with Rails.
850
887
  It contains everything except for the HTML *body* tag,
851
- that is, it fills in the *head* tag,
888
+ that is, it populates in the *head* tag,
852
889
  pulling in assets, such as the *Bootstrap* CSS and JS libraries.
853
890
 
854
- This layout is specified in a class kept inside of the framework's
855
- directory tree, namely, *app/helpers/templet/layouts/html.rb*
856
- If you want to use something else instead,
857
- you should put a new version in your application area.
891
+ This (outer) layout is specified in a class
892
+ kept inside of the framework's directory tree,
893
+ namely, *app/helpers/templet/layouts/html.rb*.
894
+ It is rendered inside the *body* HTML tag.
858
895
 
859
896
  If the HTTP request is for the JS output format (i.e. remote, AJAX)
860
897
  then this (outer) layout is omitted - as you'd expect!
@@ -862,11 +899,11 @@ then this (outer) layout is omitted - as you'd expect!
862
899
  ##### The Inner Layout
863
900
 
864
901
  As said, you can also specify a further inner layout,
865
- (that is rendered within the *body* HTML tag),
866
902
  which allows you to display supplementary markup,
867
903
  like menus and headings.
904
+ This inner layout is included in JS (AJAX) requests.
868
905
 
869
- These layout classes are found in the directory, *app/helpers/app/panel/*.
906
+ These layout classes are put in the directory, *app/helpers/app/layouts/*.
870
907
 
871
908
  As noted, you'll want to change this inner layout,
872
909
  as it generated for you with pre-written sample code,
@@ -877,10 +914,10 @@ whose participant classes have names that are prefixed with *Layout*.
877
914
 
878
915
  In this directory, there are also sample classes,
879
916
  suffixed with *Option*,
880
- that provide custom functionality for various page sections.
917
+ that provide custom functionality for the assorted page sections.
881
918
  They are set up in the class, *OptionsConfig*.
882
919
  You may possibly adopt this pattern in your own code,
883
- or just get shot of it.
920
+ or just get rid of it.
884
921
 
885
922
  #### REST Link Menus
886
923
 
@@ -891,14 +928,14 @@ These classes are in the directory, *app/helpers/templet/links/*.
891
928
  They are for use with any type of *ActiveRecord* model,
892
929
  combined with, if need be, a model's parent and grand-parent.
893
930
  And even a dependent's name, (i.e. a model's children),
894
- which is used to dispay a forward HTML link.
931
+ which is used to display a forward HTML link.
895
932
 
896
933
  There are, primarily, two template classes
897
934
  that render a list of HTML links for REST actions.
898
935
  These two are *Templet::Links::BsLinkSetNavigation*
899
936
  and *Templet::Links::BsLinkSetCollection*.
900
- The former is given a model *instance* (for the actions: edit show etc.),
901
- the latter is given a model's *name* (for the actions: index new etc.).
937
+ The former is given a model *instance* (for the actions: edit show etc.).
938
+ The latter is given a model's *name* (for the actions: index new etc.).
902
939
 
903
940
  You can add arbitrary links (at certain spots) to these lists of HTML links
904
941
  by subclassing one of the two above classes.
@@ -906,9 +943,9 @@ by subclassing one of the two above classes.
906
943
  These classes inherit from *Templet::Links::BsLinkSetBase*,
907
944
  which have utility methods to render individual HTML links.
908
945
 
909
- The directory, *app/helpers/app/link_sets/*, is reserved for
946
+ The directory, *app/helpers/app/links/*, is reserved for
910
947
  your own classes that render HTML link menus.
911
- Your own classes should inherit from one of the three classes above.
948
+ Your own classes can inherit from one of the three classes above.
912
949
 
913
950
  The (list of) links can be presented in HTML containers,
914
951
  such as the various *Bootstrap* Button Groups and Navbars.
@@ -917,15 +954,15 @@ that do this for you.
917
954
 
918
955
  This part has, perhaps, the most intricate functionality,
919
956
  and is best learned by looking at sample code in the example app,
920
- [questionable](https://github.com/srycyk/questionable).
957
+ [templet_demo](https://github.com/srycyk/templet_demo).
921
958
 
922
959
  > Do note that this example app has many other examples of API usage,
923
960
  > and is complementary to this guide,
924
- > as it has the examples that are absent here.
961
+ > as it has lots of examples that are absent in this guide.
925
962
 
926
963
  #### HTML Components
927
964
 
928
- The API has utility mixin methods to render the standard
965
+ The API has utility mixin methods to render standard
929
966
  HTML lists and tables - to which CSS class names can be passed.
930
967
 
931
968
  1. The lists (HTML tag *ul*) take as input a Ruby Array of list items.
@@ -946,7 +983,7 @@ There are other API facilities including:
946
983
 
947
984
  2. Mixin methods that return various lambdas
948
985
  that are used by the generic components.
949
- A model instance is often passed to these lambdas.
986
+ A model instance is often passed into these lambdas.
950
987
 
951
988
  3. Classes to let you render HTML input forms in a short block of code.
952
989
  The outputted HTML will be adorned with Bootstrap's regalia,
@@ -955,8 +992,8 @@ There are other API facilities including:
955
992
 
956
993
  4. Classes to render composite view segments, like a search form.
957
994
 
958
- These facilities are in sub-directories below *app/helpers/templet/*,
959
- and are *mixins/ (1 &amp; 2)*, *forms/ (2)*, and *utils/ (3)*.
995
+ > These facilities are in sub-directories below *app/helpers/templet/*,
996
+ > and are *mixins/ (1 &amp; 2)*, *forms/ (2)*, and *utils/ (3)*.
960
997
 
961
998
  ### System Variables
962
999
 
@@ -972,9 +1009,9 @@ and can be used in two ways:
972
1009
  to which a block is passed, as in:
973
1010
  `renderer.call { span 'Goodbye cruel world' }`.
974
1011
 
975
- 2. Directly, as in `renderer.root_path`. but this has limited usefulness.
1012
+ 2. Directly, as in `renderer.root_path`. to retrieve single values.
976
1013
 
977
- For REST controllers there are the objects *model*, *parent*, and
1014
+ For REST controllers, there are the objects *model*, *parent*, and
978
1015
  perhaps *grand\_parent*, as well as a few others.
979
1016
  These are used for generic components,
980
1017
  such as REST link menus and headings.
@@ -985,10 +1022,37 @@ you can define instance variables in the controller
985
1022
  and then pass their names into the *Viewer* class,
986
1023
  whereupon they will become accessible (by name) in the view code.
987
1024
 
1025
+ ### Framework Code
1026
+
1027
+ Normally, the framework's source code will be accessed
1028
+ from within the *templet_rails* engine.
1029
+
1030
+ But if you require to modify the framework's code yourself,
1031
+ you can copy the source into your application file system.
1032
+
1033
+ The core code, which can be installed by the
1034
+ generator, *templet:core_install*,
1035
+ is placed in two directories:
1036
+
1037
+ 1. In *app/helpers/templet/*, which is a tree (of several branches)
1038
+ that contains the bulk of the code.
1039
+ It contains the run-time framework and libraries.
1040
+ _Incidentally, there is a generator option to relocate this directory._
1041
+
1042
+ 2. In *app/controllers/templet/*, which contains a few controller modules
1043
+ of helper methods that simplify the process of invoking the view.
1044
+
1045
+ Also, there is another file, *app/helpers/templet_helper.rb*
1046
+ which can be safely deleted.
1047
+ It is reserved for global setting for the framework.
1048
+
1049
+ If you install the core code locally,
1050
+ the engine, *templet_rails*, will no longer be required at run-time.
1051
+
988
1052
  ### Configuration
989
1053
 
990
1054
  The example application,
991
- [questionable](https://github.com/srycyk/questionable),
1055
+ [templet_demo](https://github.com/srycyk/templet_demo),
992
1056
  has all of these configuration settings in place,
993
1057
  so may be worth looking at if anything goes wrong in your app.
994
1058
 
@@ -1003,16 +1067,17 @@ There are two necessary lines to add to your *Gemfile*:
1003
1067
  ```
1004
1068
 
1005
1069
  You can, instead, leave the *git* address out,
1006
- and fetch the gems in the usual way, i.e. from *rubygems.org*.
1070
+ and fetch the gems directly from the repository, *rubygems.org*.
1007
1071
  Fetching from *github*, however, will give you the most recent version.
1008
1072
 
1009
1073
  In addition, there are following gems:
1010
1074
 
1011
1075
  ```
1076
+ gem 'jquery-rails'
1012
1077
  gem 'bootstrap-sass', '~> 3.3.7'
1013
1078
 
1014
1079
  group :development, :test do
1015
- gem 'factory_bot_rails'
1080
+ gem 'factory_bot_rails', '4.10.0'
1016
1081
  end
1017
1082
 
1018
1083
  # These are optional
@@ -1033,7 +1098,7 @@ Dir["./spec/support/**/*.rb"].each {|file| require file }
1033
1098
  The testing suites require that you have *factory\_bot* factories
1034
1099
  set up for the models that are to be the subject of the tests.
1035
1100
 
1036
- The framework installation will add a number of configuration files
1101
+ Also, the installation will add a number of configuration files
1037
1102
  in *spec/support/apis/* and *spec/support/templet/*.
1038
1103
 
1039
1104
  ## Licence
@@ -1048,12 +1113,12 @@ mail me at stephen.rycyk@googlemail.com
1048
1113
 
1049
1114
  ### To Do
1050
1115
 
1051
- 1. Upgrade support for installing a new version of the framework,
1052
- without affecting application code.
1053
- 2. Add two global config files for handling variation.
1054
- One for the framework, another for the application.
1055
- 3. Allow more flexibility about where the directory trees are to be located.
1056
- 4. Remove all files to do with Rspec support unless this is explicitly requested.
1057
- 5. Add support for mailer templates, so that HTML and plain-text formatted
1058
- mails are both rendered from a single source of text.
1059
- 6. Refactor the classes producing REST link menus.
1116
+ * Allow more flexibility about where the directory trees are to be situated.
1117
+ * Make Rspec support more optional. Should it be explicitly requested?
1118
+ * Decouple ActiveRecord dependencies.
1119
+ * Add support for rendering serialized fields.
1120
+ * Make calling the Viewer class from controller less cumbersome.
1121
+ * Refactor the classes producing REST link menus.
1122
+ * Add support for mailer templates, so that HTML and plain-text formatted
1123
+ mails are both rendered from a single source of text.
1124
+ * Support for Bootstrap 4.