cortex 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (342) hide show
  1. checksums.yaml +7 -0
  2. data/.babelrc +18 -0
  3. data/.codeclimate.yml +43 -0
  4. data/.csslintrc +2 -0
  5. data/.editorconfig +9 -0
  6. data/.eslintignore +1 -0
  7. data/.eslintrc.yml +277 -0
  8. data/.github/PULL_REQUEST_TEMPLATE.md +47 -0
  9. data/.gitignore +82 -0
  10. data/.npmignore +34 -0
  11. data/.postcssrc.yml +3 -0
  12. data/.rspec +3 -0
  13. data/.rubocop.yml +1156 -0
  14. data/CODE_OF_CONDUCT.md +74 -0
  15. data/CONTRIBUTING.md +58 -0
  16. data/Gemfile +101 -0
  17. data/Gemfile.lock +604 -0
  18. data/Guardfile +23 -0
  19. data/LICENSE.md +201 -0
  20. data/README.md +239 -0
  21. data/Rakefile +22 -0
  22. data/app/assets/config/cortex_manifest.js +4 -0
  23. data/app/assets/fonts/cortex/Montserrat-Light.otf +0 -0
  24. data/app/assets/fonts/cortex/Montserrat-Medium.otf +0 -0
  25. data/app/assets/fonts/cortex/Montserrat-Regular.otf +0 -0
  26. data/app/assets/fonts/cortex/Montserrat-SemiBold.otf +0 -0
  27. data/app/assets/images/cortex/favicon.ico +0 -0
  28. data/app/assets/images/cortex/icons/add.svg +59 -0
  29. data/app/assets/images/cortex/icons/blog.png +0 -0
  30. data/app/assets/images/cortex/icons/media.png +0 -0
  31. data/app/assets/images/cortex/logo.svg +43 -0
  32. data/app/assets/javascripts/cortex/application.js +17 -0
  33. data/app/assets/javascripts/cortex/authentication.js +6 -0
  34. data/app/assets/javascripts/cortex/base.js +6 -0
  35. data/app/assets/javascripts/cortex/datepicker_init.js +29 -0
  36. data/app/assets/javascripts/cortex/flash.js +7 -0
  37. data/app/assets/javascripts/cortex/form.js +6 -0
  38. data/app/assets/javascripts/cortex/media_dialogs.js +40 -0
  39. data/app/assets/javascripts/cortex/quick_links.js +13 -0
  40. data/app/assets/stylesheets/cortex/application.scss +34 -0
  41. data/app/assets/stylesheets/cortex/authentication.scss +34 -0
  42. data/app/assets/stylesheets/cortex/base.scss +4 -0
  43. data/app/assets/stylesheets/cortex/bootstrap-namespaced.scss +57 -0
  44. data/app/assets/stylesheets/cortex/components/card.scss +9 -0
  45. data/app/assets/stylesheets/cortex/components/dialog.scss +67 -0
  46. data/app/assets/stylesheets/cortex/components/flash.scss +60 -0
  47. data/app/assets/stylesheets/cortex/components/form.scss +45 -0
  48. data/app/assets/stylesheets/cortex/components/header.scss +53 -0
  49. data/app/assets/stylesheets/cortex/components/index.scss +28 -0
  50. data/app/assets/stylesheets/cortex/components/jumbo-button.scss +41 -0
  51. data/app/assets/stylesheets/cortex/components/loaders.scss +76 -0
  52. data/app/assets/stylesheets/cortex/components/notes.scss +26 -0
  53. data/app/assets/stylesheets/cortex/components/sidebar.scss +120 -0
  54. data/app/assets/stylesheets/cortex/components/table.scss +7 -0
  55. data/app/assets/stylesheets/cortex/components/tenant-switcher.scss +209 -0
  56. data/app/assets/stylesheets/cortex/components/ui.scss +119 -0
  57. data/app/assets/stylesheets/cortex/demo.scss +140 -0
  58. data/app/assets/stylesheets/cortex/directives/aspect-ratio.scss +9 -0
  59. data/app/assets/stylesheets/cortex/helpers.scss +1701 -0
  60. data/app/assets/stylesheets/cortex/layout.scss +21 -0
  61. data/app/assets/stylesheets/cortex/material-icons.scss +13 -0
  62. data/app/assets/stylesheets/cortex/variables/_colors.scss +46 -0
  63. data/app/assets/stylesheets/cortex/variables/_material-overrides.scss +1 -0
  64. data/app/assets/stylesheets/cortex/variables/_typography.scss +114 -0
  65. data/app/cells/cortex/application_cell.rb +8 -0
  66. data/app/cells/cortex/content_type/nav.haml +5 -0
  67. data/app/cells/cortex/content_type_cell.rb +10 -0
  68. data/app/cells/cortex/field_cell.rb +35 -0
  69. data/app/cells/cortex/index/content_item/column.haml +4 -0
  70. data/app/cells/cortex/index/content_item_cell.rb +37 -0
  71. data/app/cells/cortex/index/index.haml +5 -0
  72. data/app/cells/cortex/index/table_body.haml +11 -0
  73. data/app/cells/cortex/index/table_headers.haml +5 -0
  74. data/app/cells/cortex/index_cell.rb +53 -0
  75. data/app/cells/cortex/wizard/column/show.haml +10 -0
  76. data/app/cells/cortex/wizard/column_cell.rb +21 -0
  77. data/app/cells/cortex/wizard/field/show.haml +30 -0
  78. data/app/cells/cortex/wizard/field_cell.rb +29 -0
  79. data/app/cells/cortex/wizard/plugin/show.haml +1 -0
  80. data/app/cells/cortex/wizard/plugin_cell.rb +28 -0
  81. data/app/cells/cortex/wizard/show.haml +1 -0
  82. data/app/cells/cortex/wizard/step/show.haml +2 -0
  83. data/app/cells/cortex/wizard/step_cell.rb +17 -0
  84. data/app/cells/cortex/wizard_cell.rb +15 -0
  85. data/app/containers/cortex/transaction_container.rb +23 -0
  86. data/app/controllers/concerns/cortex/decoratable.rb +16 -0
  87. data/app/controllers/cortex/admin_controller.rb +7 -0
  88. data/app/controllers/cortex/application_controller.rb +19 -0
  89. data/app/controllers/cortex/authentication/passwords_controller.rb +3 -0
  90. data/app/controllers/cortex/authentication/sessions_controller.rb +3 -0
  91. data/app/controllers/cortex/content_items_controller.rb +75 -0
  92. data/app/controllers/cortex/content_types_controller.rb +19 -0
  93. data/app/controllers/cortex/dashboards_controller.rb +7 -0
  94. data/app/controllers/cortex/graphql_controller.rb +40 -0
  95. data/app/controllers/cortex/tenants_controller.rb +12 -0
  96. data/app/devise/cortex/authentication_failure.rb +12 -0
  97. data/app/graphql/cortex/cortex_schema.rb +8 -0
  98. data/app/graphql/cortex/interfaces/.keep +0 -0
  99. data/app/graphql/cortex/mutations/.keep +0 -0
  100. data/app/graphql/cortex/types/content_item_type.rb +31 -0
  101. data/app/graphql/cortex/types/content_type_type.rb +23 -0
  102. data/app/graphql/cortex/types/contract_type.rb +10 -0
  103. data/app/graphql/cortex/types/date_time_type.rb +8 -0
  104. data/app/graphql/cortex/types/field_item_type.rb +15 -0
  105. data/app/graphql/cortex/types/field_type.rb +18 -0
  106. data/app/graphql/cortex/types/mutation_type.rb +5 -0
  107. data/app/graphql/cortex/types/query_type.rb +45 -0
  108. data/app/graphql/cortex/types/tenant_type.rb +19 -0
  109. data/app/graphql/cortex/types/user_type.rb +20 -0
  110. data/app/helpers/cortex/application_helper.rb +75 -0
  111. data/app/helpers/cortex/cells/association_helper.rb +25 -0
  112. data/app/helpers/cortex/content_item_helper.rb +106 -0
  113. data/app/helpers/cortex/dashboard_helper.rb +19 -0
  114. data/app/helpers/cortex/popup_helper.rb +27 -0
  115. data/app/jobs/cortex/application_job.rb +4 -0
  116. data/app/mailers/cortex/application_mailer.rb +6 -0
  117. data/app/mailers/cortex/password_reset_mailer.rb +13 -0
  118. data/app/models/concerns/cortex/belongs_to_tenant.rb +13 -0
  119. data/app/models/concerns/cortex/has_firstname_lastname.rb +11 -0
  120. data/app/models/concerns/cortex/has_gravatar.rb +18 -0
  121. data/app/models/concerns/cortex/searchable.rb +11 -0
  122. data/app/models/concerns/cortex/searchable_content_item.rb +31 -0
  123. data/app/models/concerns/cortex/searchable_content_item_for_content_type.rb +52 -0
  124. data/app/models/concerns/cortex/searchable_content_type.rb +11 -0
  125. data/app/models/cortex/application_record.rb +17 -0
  126. data/app/models/cortex/content_item.rb +71 -0
  127. data/app/models/cortex/content_type.rb +27 -0
  128. data/app/models/cortex/contentable_decorator.rb +8 -0
  129. data/app/models/cortex/contract.rb +12 -0
  130. data/app/models/cortex/decorator.rb +13 -0
  131. data/app/models/cortex/field.rb +36 -0
  132. data/app/models/cortex/field_item.rb +54 -0
  133. data/app/models/cortex/field_type.rb +44 -0
  134. data/app/models/cortex/permission.rb +11 -0
  135. data/app/models/cortex/role.rb +12 -0
  136. data/app/models/cortex/tenant.rb +41 -0
  137. data/app/models/cortex/user.rb +77 -0
  138. data/app/operations/cortex/database_transact_operation.rb +17 -0
  139. data/app/operations/cortex/execute_content_item_state_change_operation.rb +16 -0
  140. data/app/operations/cortex/parse_content_item_field_items_operation.rb +18 -0
  141. data/app/operations/cortex/persist_content_item_operation.rb +12 -0
  142. data/app/policies/cortex/application_policy.rb +55 -0
  143. data/app/policies/cortex/content_item_policy.rb +49 -0
  144. data/app/policies/cortex/content_type_policy.rb +38 -0
  145. data/app/transactions/concerns/cortex/content_itemable.rb +15 -0
  146. data/app/transactions/concerns/cortex/field_item_transactor.rb +28 -0
  147. data/app/transactions/concerns/cortex/widget_parsable.rb +19 -0
  148. data/app/transactions/cortex/application_transaction.rb +5 -0
  149. data/app/transactions/cortex/create_content_item_transaction.rb +35 -0
  150. data/app/transactions/cortex/get_content_item_transaction.rb +4 -0
  151. data/app/transactions/cortex/get_content_items_for_content_type_transaction.rb +34 -0
  152. data/app/transactions/cortex/get_publish_state_transaction.rb +28 -0
  153. data/app/transactions/cortex/new_field_item_transaction.rb +16 -0
  154. data/app/transactions/cortex/update_content_item_transaction.rb +45 -0
  155. data/app/transactions/cortex/update_field_item_transaction.rb +23 -0
  156. data/app/types/cortex/application_types.rb +21 -0
  157. data/app/types/cortex/content_item_transaction_type.rb +10 -0
  158. data/app/types/cortex/core_types.rb +5 -0
  159. data/app/types/cortex/transaction_type.rb +5 -0
  160. data/app/views/cortex/authentication/passwords/new.html.haml +13 -0
  161. data/app/views/cortex/authentication/sessions/new.html.haml +20 -0
  162. data/app/views/cortex/authentication/shared/_links.html.haml +19 -0
  163. data/app/views/cortex/content_items/_form.html.haml +13 -0
  164. data/app/views/cortex/content_items/_grid.html.haml +1 -0
  165. data/app/views/cortex/content_items/edit.html.haml +2 -0
  166. data/app/views/cortex/content_items/index.html.haml +4 -0
  167. data/app/views/cortex/content_items/new.html.haml +2 -0
  168. data/app/views/cortex/content_types/index.html.haml +2 -0
  169. data/app/views/cortex/content_types/new.html.haml +0 -0
  170. data/app/views/cortex/dashboards/index.html.haml +6 -0
  171. data/app/views/cortex/graphql/ide.haml +1 -0
  172. data/app/views/cortex/partials/_breadcrumb.html.haml +2 -0
  173. data/app/views/cortex/partials/_cortex_redux_state.html.haml +1 -0
  174. data/app/views/cortex/partials/_flash.html.haml +25 -0
  175. data/app/views/cortex/partials/_media_dialogs.html.haml +13 -0
  176. data/app/views/cortex/partials/_navigation.html.haml +15 -0
  177. data/app/views/cortex/partials/_notes.html.haml +17 -0
  178. data/app/views/cortex/partials/_quick_links.html.haml +22 -0
  179. data/app/views/cortex/partials/_sidebar.html.haml +7 -0
  180. data/app/views/cortex/partials/_topbar.html.haml +5 -0
  181. data/app/views/cortex/partials/_user_control.html.haml +7 -0
  182. data/app/views/cortex/partials/authentication/_header.html.haml +4 -0
  183. data/app/views/cortex/partials/trackers/_google_analytics.html.haml +10 -0
  184. data/app/views/cortex/partials/trackers/_qualtrics.html.haml +10 -0
  185. data/app/views/cortex/password_reset_mailer/send_password_reset.html.erb +5 -0
  186. data/app/views/cortex/password_reset_mailer/send_password_reset.text.erb +5 -0
  187. data/app/views/layouts/cortex/application.html.haml +30 -0
  188. data/app/views/layouts/cortex/devise.html.haml +19 -0
  189. data/app/views/layouts/cortex/mailer.html.erb +13 -0
  190. data/app/views/layouts/cortex/mailer.text.erb +1 -0
  191. data/bin/rails +25 -0
  192. data/config/config.yml +22 -0
  193. data/config/initializers/devise.rb +35 -0
  194. data/config/initializers/elasticsearch.rb +3 -0
  195. data/config/initializers/filter_parameter_logging.rb +4 -0
  196. data/config/initializers/flipper.rb +16 -0
  197. data/config/initializers/graphiql.rb +51 -0
  198. data/config/initializers/inflections.rb +16 -0
  199. data/config/initializers/load_config.rb +16 -0
  200. data/config/initializers/mime_types.rb +5 -0
  201. data/config/initializers/plugins.rb +17 -0
  202. data/config/initializers/react_on_rails.rb +15 -0
  203. data/config/initializers/rolify.rb +9 -0
  204. data/config/initializers/tag_parsers.rb +5 -0
  205. data/config/locales/devise.en.yml +64 -0
  206. data/config/routes.rb +41 -0
  207. data/cortex.gemspec +84 -0
  208. data/db/migrate/0_enable_pgcrypto_extension.rb +5 -0
  209. data/db/migrate/10_create_fields.rb +15 -0
  210. data/db/migrate/11_create_content_items.rb +14 -0
  211. data/db/migrate/12_create_field_items.rb +12 -0
  212. data/db/migrate/13_create_field_types.rb +5 -0
  213. data/db/migrate/1_create_users.rb +14 -0
  214. data/db/migrate/2_create_tenants.rb +26 -0
  215. data/db/migrate/3_add_devise_to_users.rb +49 -0
  216. data/db/migrate/4_create_roles.rb +15 -0
  217. data/db/migrate/5_create_permissions.rb +16 -0
  218. data/db/migrate/6_create_flipper_tables.rb +20 -0
  219. data/db/migrate/7_create_contracts.rb +11 -0
  220. data/db/migrate/8_create_decorators.rb +21 -0
  221. data/db/migrate/9_create_content_types.rb +17 -0
  222. data/db/seeds.rb +40 -0
  223. data/db/seeds.yml +33 -0
  224. data/lib/assets/.keep +0 -0
  225. data/lib/breadcrumbs/title_builder.rb +12 -0
  226. data/lib/cortex.rb +4 -0
  227. data/lib/cortex/engine.rb +41 -0
  228. data/lib/cortex/version.rb +3 -0
  229. data/lib/helpers/utility_helper.rb +7 -0
  230. data/lib/tasks/cortex_tasks.rake +13 -0
  231. data/lib/tasks/elasticsearch_tasks.rake +1 -0
  232. data/node_package/.babelrc +26 -0
  233. data/node_package/src/components/side_bar/environment_flag.jsx +21 -0
  234. data/node_package/src/components/side_bar/tenant_list.jsx +65 -0
  235. data/node_package/src/components/wizard/column.jsx +29 -0
  236. data/node_package/src/components/wizard/field.jsx +22 -0
  237. data/node_package/src/components/wizard/step.jsx +20 -0
  238. data/node_package/src/constants/tenant_switcher.jsx +17 -0
  239. data/node_package/src/constants/type_constants.jsx +12 -0
  240. data/node_package/src/constants/wizard.jsx +9 -0
  241. data/node_package/src/containers/layout.jsx +33 -0
  242. data/node_package/src/containers/tenant_switcher_container.jsx +115 -0
  243. data/node_package/src/containers/wizard_container.jsx +28 -0
  244. data/node_package/src/elements/loaders.jsx +7 -0
  245. data/node_package/src/helpers/formatting.jsx +5 -0
  246. data/node_package/src/helpers/tenant_ancestry.jsx +14 -0
  247. data/node_package/src/helpers/tenant_lookup.jsx +23 -0
  248. data/node_package/src/index.jsx +21 -0
  249. data/node_package/src/reducers/index.jsx +13 -0
  250. data/node_package/src/reducers/rails_context_reducer.jsx +5 -0
  251. data/node_package/src/reducers/tenant_switcher_reducer.jsx +74 -0
  252. data/node_package/src/reducers/wizard_reducer.jsx +32 -0
  253. data/node_package/src/services/rails_api_service.jsx +13 -0
  254. data/node_package/src/store/store.jsx +15 -0
  255. data/package.json +66 -0
  256. data/spec/dummy/Rakefile +7 -0
  257. data/spec/dummy/app/assets/config/manifest.js +4 -0
  258. data/spec/dummy/app/assets/javascripts/application.js +2 -0
  259. data/spec/dummy/app/assets/stylesheets/application.scss +2 -0
  260. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  261. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  262. data/spec/dummy/app/javascript/packs/application.js +8 -0
  263. data/spec/dummy/app/javascript/packs/cortex.jsx +1 -0
  264. data/spec/dummy/app/jobs/application_job.rb +2 -0
  265. data/spec/dummy/app/mailers/application_mailer.rb +4 -0
  266. data/spec/dummy/app/views/layouts/application.html.haml +11 -0
  267. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  268. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  269. data/spec/dummy/bin/bundle +105 -0
  270. data/spec/dummy/bin/rails +4 -0
  271. data/spec/dummy/bin/rake +4 -0
  272. data/spec/dummy/bin/rspec +17 -0
  273. data/spec/dummy/bin/setup +38 -0
  274. data/spec/dummy/bin/update +29 -0
  275. data/spec/dummy/bin/webpack +29 -0
  276. data/spec/dummy/bin/webpack-dev-server +29 -0
  277. data/spec/dummy/bin/yarn +11 -0
  278. data/spec/dummy/config.ru +7 -0
  279. data/spec/dummy/config/apollo_engine_proxy.yml +23 -0
  280. data/spec/dummy/config/application.rb +21 -0
  281. data/spec/dummy/config/boot.rb +11 -0
  282. data/spec/dummy/config/cable.yml +9 -0
  283. data/spec/dummy/config/config.yml +22 -0
  284. data/spec/dummy/config/database.yml +22 -0
  285. data/spec/dummy/config/environment.rb +5 -0
  286. data/spec/dummy/config/environments/development.rb +74 -0
  287. data/spec/dummy/config/environments/production.rb +103 -0
  288. data/spec/dummy/config/environments/staging.rb +103 -0
  289. data/spec/dummy/config/environments/test.rb +65 -0
  290. data/spec/dummy/config/initializers/application_controller_renderer.rb +6 -0
  291. data/spec/dummy/config/initializers/assets.rb +14 -0
  292. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  293. data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
  294. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  295. data/spec/dummy/config/initializers/inflections.rb +16 -0
  296. data/spec/dummy/config/initializers/load_config.rb +9 -0
  297. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  298. data/spec/dummy/config/initializers/react_on_rails.rb +41 -0
  299. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  300. data/spec/dummy/config/initializers/sentry.rb +6 -0
  301. data/spec/dummy/config/initializers/session_store.rb +7 -0
  302. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  303. data/spec/dummy/config/locales/en.yml +8 -0
  304. data/spec/dummy/config/newrelic.yml +224 -0
  305. data/spec/dummy/config/puma.rb +47 -0
  306. data/spec/dummy/config/routes.rb +5 -0
  307. data/spec/dummy/config/secrets.yml +32 -0
  308. data/spec/dummy/config/sidekiq.yml +9 -0
  309. data/spec/dummy/config/webpack/development.js +3 -0
  310. data/spec/dummy/config/webpack/environment.js +3 -0
  311. data/spec/dummy/config/webpack/production.js +3 -0
  312. data/spec/dummy/config/webpack/test.js +3 -0
  313. data/spec/dummy/config/webpacker.yml +66 -0
  314. data/spec/dummy/db/migrate/20180118233001_enable_pgcrypto_extension.cortex.rb +6 -0
  315. data/spec/dummy/db/migrate/20180118233002_create_users.cortex.rb +15 -0
  316. data/spec/dummy/db/migrate/20180118233003_create_tenants.cortex.rb +27 -0
  317. data/spec/dummy/db/migrate/20180118233004_add_devise_to_users.cortex.rb +50 -0
  318. data/spec/dummy/db/migrate/20180118233005_create_roles.cortex.rb +16 -0
  319. data/spec/dummy/db/migrate/20180118233006_create_permissions.cortex.rb +17 -0
  320. data/spec/dummy/db/migrate/20180118233007_create_flipper_tables.cortex.rb +21 -0
  321. data/spec/dummy/db/migrate/20180118233008_create_contracts.cortex.rb +12 -0
  322. data/spec/dummy/db/migrate/20180118233009_create_decorators.cortex.rb +22 -0
  323. data/spec/dummy/db/migrate/20180118233010_create_content_types.cortex.rb +18 -0
  324. data/spec/dummy/db/migrate/20180118233011_create_fields.cortex.rb +16 -0
  325. data/spec/dummy/db/migrate/20180118233012_create_content_items.cortex.rb +15 -0
  326. data/spec/dummy/db/migrate/20180118233013_create_field_items.cortex.rb +13 -0
  327. data/spec/dummy/db/migrate/20180118233014_create_field_types.cortex.rb +6 -0
  328. data/spec/dummy/db/schema.rb +258 -0
  329. data/spec/dummy/db/seeds.rb +1 -0
  330. data/spec/dummy/lib/tasks/content_types_tasks.rake +31 -0
  331. data/spec/dummy/lib/tasks/employer/blog_tasks.rake +345 -0
  332. data/spec/dummy/package.json +28 -0
  333. data/spec/dummy/public/404.html +67 -0
  334. data/spec/dummy/public/422.html +67 -0
  335. data/spec/dummy/public/500.html +66 -0
  336. data/spec/dummy/public/robots.txt +5 -0
  337. data/spec/dummy/spec/javascripts/support/jasmine.yml +50 -0
  338. data/spec/dummy/yarn.lock +6615 -0
  339. data/spec/rails_helper.rb +57 -0
  340. data/spec/spec_helper.rb +96 -0
  341. data/yarn.lock +6032 -0
  342. metadata +1061 -0
@@ -0,0 +1,13 @@
1
+ # This migration comes from cortex (originally 12)
2
+ class CreateFieldItems < ActiveRecord::Migration[5.1]
3
+ def change
4
+ create_table :cortex_field_items, id: :uuid do |t|
5
+ t.jsonb :data, null: false, default: {}, index: { using: :gin }
6
+ t.references :field, type: :uuid, null: false, foreign_key: { to_table: :cortex_fields }
7
+ t.references :content_item, type: :uuid, null: false, foreign_key: { to_table: :cortex_content_items }
8
+
9
+ t.datetime :deleted_at, index: true
10
+ t.timestamps null: false
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,6 @@
1
+ # This migration comes from cortex (originally 13)
2
+ class CreateFieldTypes < ActiveRecord::Migration[5.1]
3
+ def change
4
+ create_table :cortex_field_types, id: :uuid
5
+ end
6
+ end
@@ -0,0 +1,258 @@
1
+ # This file is auto-generated from the current state of the database. Instead
2
+ # of editing this file, please use the migrations feature of Active Record to
3
+ # incrementally modify your database, and then regenerate this schema definition.
4
+ #
5
+ # Note that this schema.rb definition is the authoritative source for your
6
+ # database schema. If you need to create the application database on another
7
+ # system, you should be using db:schema:load, not running all the migrations
8
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
10
+ #
11
+ # It's strongly recommended that you check this file into your version control system.
12
+
13
+ ActiveRecord::Schema.define(version: 20180118233014) do
14
+
15
+ # These are extensions that must be enabled in order to support this database
16
+ enable_extension "plpgsql"
17
+ enable_extension "pgcrypto"
18
+
19
+ create_table "cortex_content_items", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
20
+ t.string "state"
21
+ t.uuid "content_type_id", null: false
22
+ t.uuid "tenant_id", null: false
23
+ t.uuid "creator_id", null: false
24
+ t.uuid "updated_by_id"
25
+ t.datetime "deleted_at"
26
+ t.datetime "created_at", null: false
27
+ t.datetime "updated_at", null: false
28
+ t.index ["content_type_id"], name: "index_cortex_content_items_on_content_type_id"
29
+ t.index ["creator_id"], name: "index_cortex_content_items_on_creator_id"
30
+ t.index ["deleted_at"], name: "index_cortex_content_items_on_deleted_at"
31
+ t.index ["state"], name: "index_cortex_content_items_on_state"
32
+ t.index ["tenant_id"], name: "index_cortex_content_items_on_tenant_id"
33
+ t.index ["updated_by_id"], name: "index_cortex_content_items_on_updated_by_id"
34
+ end
35
+
36
+ create_table "cortex_content_types", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
37
+ t.string "name", null: false
38
+ t.string "name_id", null: false
39
+ t.text "description"
40
+ t.uuid "creator_id", null: false
41
+ t.uuid "tenant_id", null: false
42
+ t.uuid "contract_id", null: false
43
+ t.boolean "publishable", default: false, null: false
44
+ t.string "icon", default: "help"
45
+ t.datetime "deleted_at"
46
+ t.datetime "created_at", null: false
47
+ t.datetime "updated_at", null: false
48
+ t.index ["contract_id"], name: "index_cortex_content_types_on_contract_id"
49
+ t.index ["creator_id"], name: "index_cortex_content_types_on_creator_id"
50
+ t.index ["deleted_at"], name: "index_cortex_content_types_on_deleted_at"
51
+ t.index ["name"], name: "index_cortex_content_types_on_name"
52
+ t.index ["name_id"], name: "index_cortex_content_types_on_name_id"
53
+ t.index ["tenant_id"], name: "index_cortex_content_types_on_tenant_id"
54
+ end
55
+
56
+ create_table "cortex_contentable_decorators", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
57
+ t.uuid "decorator_id"
58
+ t.string "contentable_type"
59
+ t.uuid "contentable_id"
60
+ t.uuid "tenant_id", null: false
61
+ t.datetime "deleted_at"
62
+ t.datetime "created_at", null: false
63
+ t.datetime "updated_at", null: false
64
+ t.index ["contentable_type", "contentable_id"], name: "index_cortex_contentable_decorators_on_contentable"
65
+ t.index ["decorator_id"], name: "index_cortex_contentable_decorators_on_decorator_id"
66
+ t.index ["deleted_at"], name: "index_cortex_contentable_decorators_on_deleted_at"
67
+ t.index ["tenant_id"], name: "index_cortex_contentable_decorators_on_tenant_id"
68
+ end
69
+
70
+ create_table "cortex_contracts", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
71
+ t.string "name", null: false
72
+ t.uuid "tenant_id", null: false
73
+ t.datetime "deleted_at"
74
+ t.datetime "created_at", null: false
75
+ t.datetime "updated_at", null: false
76
+ t.index ["deleted_at"], name: "index_cortex_contracts_on_deleted_at"
77
+ t.index ["name"], name: "index_cortex_contracts_on_name"
78
+ t.index ["tenant_id"], name: "index_cortex_contracts_on_tenant_id"
79
+ end
80
+
81
+ create_table "cortex_decorators", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
82
+ t.string "name", null: false
83
+ t.jsonb "data", default: {}, null: false
84
+ t.uuid "tenant_id", null: false
85
+ t.datetime "deleted_at"
86
+ t.datetime "created_at", null: false
87
+ t.datetime "updated_at", null: false
88
+ t.index ["deleted_at"], name: "index_cortex_decorators_on_deleted_at"
89
+ t.index ["name"], name: "index_cortex_decorators_on_name"
90
+ t.index ["tenant_id"], name: "index_cortex_decorators_on_tenant_id"
91
+ end
92
+
93
+ create_table "cortex_field_items", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
94
+ t.jsonb "data", default: {}, null: false
95
+ t.uuid "field_id", null: false
96
+ t.uuid "content_item_id", null: false
97
+ t.datetime "deleted_at"
98
+ t.datetime "created_at", null: false
99
+ t.datetime "updated_at", null: false
100
+ t.index ["content_item_id"], name: "index_cortex_field_items_on_content_item_id"
101
+ t.index ["data"], name: "index_cortex_field_items_on_data", using: :gin
102
+ t.index ["deleted_at"], name: "index_cortex_field_items_on_deleted_at"
103
+ t.index ["field_id"], name: "index_cortex_field_items_on_field_id"
104
+ end
105
+
106
+ create_table "cortex_field_types", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
107
+ end
108
+
109
+ create_table "cortex_fields", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
110
+ t.string "name", null: false
111
+ t.string "name_id", null: false
112
+ t.string "field_type", null: false
113
+ t.jsonb "metadata", default: {}, null: false
114
+ t.jsonb "validations", default: {}, null: false
115
+ t.uuid "content_type_id", null: false
116
+ t.datetime "deleted_at"
117
+ t.datetime "created_at", null: false
118
+ t.datetime "updated_at", null: false
119
+ t.index ["content_type_id"], name: "index_cortex_fields_on_content_type_id"
120
+ t.index ["deleted_at"], name: "index_cortex_fields_on_deleted_at"
121
+ t.index ["field_type"], name: "index_cortex_fields_on_field_type"
122
+ t.index ["name"], name: "index_cortex_fields_on_name"
123
+ t.index ["name_id"], name: "index_cortex_fields_on_name_id"
124
+ end
125
+
126
+ create_table "cortex_flipper_features", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
127
+ t.string "key", null: false
128
+ t.datetime "created_at", null: false
129
+ t.datetime "updated_at", null: false
130
+ t.index ["key"], name: "index_cortex_flipper_features_on_key", unique: true
131
+ end
132
+
133
+ create_table "cortex_flipper_gates", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
134
+ t.string "feature_key", null: false
135
+ t.string "key", null: false
136
+ t.string "value"
137
+ t.datetime "created_at", null: false
138
+ t.datetime "updated_at", null: false
139
+ t.index ["feature_key"], name: "index_cortex_flipper_gates_on_feature_key", unique: true
140
+ t.index ["key"], name: "index_cortex_flipper_gates_on_key", unique: true
141
+ t.index ["value"], name: "index_cortex_flipper_gates_on_value", unique: true
142
+ end
143
+
144
+ create_table "cortex_permissions", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
145
+ t.string "name"
146
+ t.string "resource_type"
147
+ t.uuid "resource_id"
148
+ t.datetime "deleted_at"
149
+ t.datetime "created_at", null: false
150
+ t.datetime "updated_at", null: false
151
+ t.index ["deleted_at"], name: "index_cortex_permissions_on_deleted_at"
152
+ t.index ["name"], name: "index_cortex_permissions_on_name"
153
+ t.index ["resource_id"], name: "index_cortex_permissions_on_resource_id"
154
+ t.index ["resource_type"], name: "index_cortex_permissions_on_resource_type"
155
+ end
156
+
157
+ create_table "cortex_permissions_roles", id: false, force: :cascade do |t|
158
+ t.uuid "permission_id", null: false
159
+ t.uuid "role_id", null: false
160
+ t.index ["permission_id"], name: "index_cortex_permissions_roles_on_permission_id"
161
+ t.index ["role_id"], name: "index_cortex_permissions_roles_on_role_id"
162
+ end
163
+
164
+ create_table "cortex_roles", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
165
+ t.string "name"
166
+ t.string "resource_type"
167
+ t.uuid "resource_id"
168
+ t.datetime "deleted_at"
169
+ t.datetime "created_at", null: false
170
+ t.datetime "updated_at", null: false
171
+ t.index ["deleted_at"], name: "index_cortex_roles_on_deleted_at"
172
+ t.index ["name"], name: "index_cortex_roles_on_name"
173
+ t.index ["resource_type", "resource_id"], name: "index_cortex_roles_on_resource_type_and_resource_id"
174
+ end
175
+
176
+ create_table "cortex_roles_users", id: false, force: :cascade do |t|
177
+ t.uuid "role_id", null: false
178
+ t.uuid "user_id", null: false
179
+ t.index ["role_id"], name: "index_cortex_roles_users_on_role_id"
180
+ t.index ["user_id"], name: "index_cortex_roles_users_on_user_id"
181
+ end
182
+
183
+ create_table "cortex_tenants", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
184
+ t.string "name", limit: 50, null: false
185
+ t.string "name_id", null: false
186
+ t.text "description"
187
+ t.uuid "parent_id"
188
+ t.integer "lft"
189
+ t.integer "rgt"
190
+ t.integer "depth"
191
+ t.datetime "deleted_at"
192
+ t.datetime "active_at"
193
+ t.datetime "deactive_at"
194
+ t.uuid "owner_id"
195
+ t.datetime "created_at", null: false
196
+ t.datetime "updated_at", null: false
197
+ t.index ["deleted_at"], name: "index_cortex_tenants_on_deleted_at"
198
+ t.index ["name"], name: "index_cortex_tenants_on_name", unique: true
199
+ t.index ["name_id"], name: "index_cortex_tenants_on_name_id", unique: true
200
+ t.index ["owner_id"], name: "index_cortex_tenants_on_owner_id"
201
+ t.index ["parent_id"], name: "index_cortex_tenants_on_parent_id"
202
+ end
203
+
204
+ create_table "cortex_tenants_users", id: false, force: :cascade do |t|
205
+ t.uuid "tenant_id", null: false
206
+ t.uuid "user_id", null: false
207
+ t.index ["tenant_id"], name: "index_cortex_tenants_users_on_tenant_id"
208
+ t.index ["user_id"], name: "index_cortex_tenants_users_on_user_id"
209
+ end
210
+
211
+ create_table "cortex_users", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
212
+ t.string "email", default: "", null: false
213
+ t.string "firstname", null: false
214
+ t.string "lastname", null: false
215
+ t.string "locale", limit: 30, default: "en_US", null: false
216
+ t.string "timezone", limit: 30, default: "EST", null: false
217
+ t.datetime "deleted_at"
218
+ t.datetime "created_at", null: false
219
+ t.datetime "updated_at", null: false
220
+ t.uuid "active_tenant_id"
221
+ t.string "encrypted_password", default: "", null: false
222
+ t.string "reset_password_token"
223
+ t.datetime "reset_password_sent_at"
224
+ t.datetime "remember_created_at"
225
+ t.integer "sign_in_count", default: 0, null: false
226
+ t.datetime "current_sign_in_at"
227
+ t.datetime "last_sign_in_at"
228
+ t.string "current_sign_in_ip"
229
+ t.string "last_sign_in_ip"
230
+ t.index ["active_tenant_id"], name: "index_cortex_users_on_active_tenant_id"
231
+ t.index ["deleted_at"], name: "index_cortex_users_on_deleted_at"
232
+ t.index ["email"], name: "index_cortex_users_on_email", unique: true
233
+ t.index ["reset_password_token"], name: "index_cortex_users_on_reset_password_token", unique: true
234
+ end
235
+
236
+ add_foreign_key "cortex_content_items", "cortex_content_types", column: "content_type_id"
237
+ add_foreign_key "cortex_content_items", "cortex_tenants", column: "tenant_id"
238
+ add_foreign_key "cortex_content_items", "cortex_users", column: "creator_id"
239
+ add_foreign_key "cortex_content_items", "cortex_users", column: "updated_by_id"
240
+ add_foreign_key "cortex_content_types", "cortex_contracts", column: "contract_id"
241
+ add_foreign_key "cortex_content_types", "cortex_tenants", column: "tenant_id"
242
+ add_foreign_key "cortex_content_types", "cortex_users", column: "creator_id"
243
+ add_foreign_key "cortex_contentable_decorators", "cortex_decorators", column: "decorator_id"
244
+ add_foreign_key "cortex_contentable_decorators", "cortex_tenants", column: "tenant_id"
245
+ add_foreign_key "cortex_contracts", "cortex_tenants", column: "tenant_id"
246
+ add_foreign_key "cortex_decorators", "cortex_tenants", column: "tenant_id"
247
+ add_foreign_key "cortex_field_items", "cortex_content_items", column: "content_item_id"
248
+ add_foreign_key "cortex_field_items", "cortex_fields", column: "field_id"
249
+ add_foreign_key "cortex_fields", "cortex_content_types", column: "content_type_id"
250
+ add_foreign_key "cortex_permissions_roles", "cortex_permissions", column: "permission_id"
251
+ add_foreign_key "cortex_permissions_roles", "cortex_roles", column: "role_id"
252
+ add_foreign_key "cortex_roles_users", "cortex_roles", column: "role_id"
253
+ add_foreign_key "cortex_roles_users", "cortex_users", column: "user_id"
254
+ add_foreign_key "cortex_tenants", "cortex_users", column: "owner_id"
255
+ add_foreign_key "cortex_tenants_users", "cortex_tenants", column: "tenant_id"
256
+ add_foreign_key "cortex_tenants_users", "cortex_users", column: "user_id"
257
+ add_foreign_key "cortex_users", "cortex_tenants", column: "active_tenant_id"
258
+ end
@@ -0,0 +1 @@
1
+ Cortex::Engine.load_seed
@@ -0,0 +1,31 @@
1
+ Bundler.require(:default, Rails.env)
2
+
3
+ namespace :content_types do
4
+ desc 'Re-Seeds (will wipe existing ContentTypes!) CortexStarter with Core Custom Content Seed Data'
5
+ task reseed: :environment do
6
+ Rake::Task['content_types:clear'].execute
7
+ Rake::Task['content_types:seed'].execute
8
+ end
9
+
10
+ desc 'Seeds CortexStarter with Core Custom Content Seed Data'
11
+ task seed: :environment do
12
+ Rake::Task['cortex:core:media:seed'].execute
13
+ Rake::Task['employer:blog:seed'].execute
14
+ end
15
+
16
+ desc 'Clear Existing Custom Content Data From DB'
17
+ task clear: :environment do
18
+ puts "Clearing ContentTypes..."
19
+ Cortex::ContentType.destroy_all
20
+ puts "Clearing Fields..."
21
+ Cortex::Field.destroy_all
22
+ puts "Clearing ContentItems..."
23
+ Cortex::ContentItem.destroy_all
24
+ puts "Clearing FieldItems..."
25
+ Cortex::FieldItem.destroy_all
26
+ puts "Clearing ContentableDecorators..."
27
+ Cortex::ContentableDecorator.destroy_all
28
+ puts "Clearing Decorators..."
29
+ Cortex::Decorator.destroy_all
30
+ end
31
+ end
@@ -0,0 +1,345 @@
1
+ Bundler.require(:default, Rails.env)
2
+
3
+ namespace :employer do
4
+ namespace :blog do
5
+ desc 'Seed Employer Blog ContentType and Fields'
6
+ task seed: :environment do
7
+ example_tenant = Cortex::Tenant.find_by_name('Example')
8
+
9
+ def research_tree
10
+ tree = Tree.new
11
+ tree.add_node({name: "CB Research"})
12
+ tree.add_node({name: "Third Party Research"})
13
+
14
+ tree
15
+ end
16
+
17
+ def category_tree
18
+ tree = Tree.new
19
+ tree.add_node({ name: "Product News" })
20
+ tree.add_node({ name: "Company News, Research and Trends" })
21
+ tree.add_node({ name: "Client Success Stories" })
22
+ tree.add_node({ name: "Recruiting Solutions" })
23
+ tree.add_node({ name: "Employment Screening" })
24
+ tree.add_node({ name: "Human Capital Management" })
25
+
26
+ tree
27
+ end
28
+
29
+ def persona_tree
30
+ tree = Tree.new
31
+ tree.add_node({name: "General Audience"})
32
+ tree.add_node({name: "Recruiters"})
33
+ tree.add_node({name: "Sourcers"})
34
+ tree.add_node({name: "Managers/Directors"})
35
+ tree.add_node({name: "C-Level"})
36
+
37
+ tree
38
+ end
39
+
40
+ puts "Creating Employer Blog ContentType..."
41
+ blog = Cortex::ContentType.new({
42
+ name: "Employer Blog",
43
+ name_id: "employer_blog",
44
+ description: "Blog for Employer",
45
+ icon: "description",
46
+ tenant: example_tenant,
47
+ creator: Cortex::User.first,
48
+ contract: Cortex::Contract.first, # TODO: This is obviously bad. This whole file is bad.
49
+ publishable: true
50
+ })
51
+ blog.save!
52
+
53
+ puts "Creating Fields..."
54
+ blog.fields.new(name: 'Body', name_id: 'body', field_type: 'text_field_type', metadata: {parse_widgets: true}, validations: { presence: true, length: { minimum: 50} })
55
+ blog.fields.new(name: 'Title', name_id: 'title', field_type: 'text_field_type', validations: {presence: true, length: { maximum: 100 } })
56
+ blog.fields.new(name: 'Description', name_id: 'description', field_type: 'text_field_type', validations: {presence: true, length: { maximum: 200, minimum: 50} })
57
+ blog.fields.new(name: 'Slug', name_id: 'slug', field_type: 'text_field_type', validations: {presence: true, uniqueness: true, length: { maximum: 75 } })
58
+ blog.fields.new(name: 'Author', name_id: 'author', field_type: 'author_field_type')
59
+ blog.fields.new(name: 'Tags', name_id: 'tags', field_type: 'tag_field_type')
60
+ blog.fields.new(name: 'Publish Date', name_id: 'publish_date', field_type: 'date_time_field_type', metadata: {state: 'Published'})
61
+ blog.fields.new(name: 'Expiration Date', name_id: 'expiration_date', field_type: 'date_time_field_type', metadata: {state: 'Expired'})
62
+ blog.fields.new(name: 'SEO Title', name_id: 'seo_title', field_type: 'text_field_type', validations: {presence: true, length: {maximum: 70}, uniqueness: true })
63
+ blog.fields.new(name: 'SEO Description', name_id: 'seo_description', field_type: 'text_field_type', validations: {presence: true, length: {maximum: 160} })
64
+ blog.fields.new(name: 'SEO Keywords', name_id: 'seo_keywords', field_type: 'tag_field_type')
65
+ blog.fields.new(name: 'No Index', name_id: 'no_index', field_type: 'boolean_field_type')
66
+ blog.fields.new(name: 'No Follow', name_id: 'no_follow', field_type: 'boolean_field_type')
67
+ blog.fields.new(name: 'No Snippet', name_id: 'no_snippet', field_type: 'boolean_field_type')
68
+ blog.fields.new(name: 'No ODP', name_id: 'no_odp', field_type: 'boolean_field_type')
69
+ blog.fields.new(name: 'No Archive', name_id: 'no_archive', field_type: 'boolean_field_type')
70
+ blog.fields.new(name: 'No Image Index', name_id: 'no_image_index', field_type: 'boolean_field_type')
71
+ blog.fields.new(name: 'Categories', name_id: 'categories', field_type: 'tree_field_type', metadata: {allowed_values: category_tree}, validations: {maximum: 2, minimum: 1})
72
+ blog.fields.new(name: 'Research', name_id: 'research', field_type: 'tree_field_type', metadata: {allowed_values: research_tree}, validations: {minimum: 1})
73
+ blog.fields.new(name: 'Persona', name_id: 'persona', field_type: 'tree_field_type', metadata: {allowed_values: persona_tree})
74
+ blog.fields.new(name: 'Featured Image', name_id: 'featured_image', field_type: 'content_item_field_type',
75
+ metadata: {
76
+ field_name: 'Asset'
77
+ })
78
+
79
+ puts "Saving Employer Blog..."
80
+ blog.save!
81
+
82
+ puts "Creating Wizard Cortex::Decorators..."
83
+ wizard_hash = {
84
+ "steps": [
85
+ {
86
+ "name": "Write",
87
+ "heading": "First thing's first..",
88
+ "description": "Author your post using Cortex's WYSIWYG editor.",
89
+ "columns": [
90
+ {
91
+ "heading": "Writing Panel Sections's Optional Heading",
92
+ "grid_width": 12,
93
+ "display": {
94
+ "classes": [
95
+ "text--right"
96
+ ]
97
+ },
98
+ "elements": [
99
+ {
100
+ "id": blog.fields.find_by_name('Title').id
101
+ },
102
+ {
103
+ "id": blog.fields.find_by_name('Body').id,
104
+ "render_method": "wysiwyg",
105
+ "input": {
106
+ "display": {
107
+ "styles": {
108
+ "height": "500px"
109
+ }
110
+ }
111
+ }
112
+ }
113
+ ]
114
+ }
115
+ ]
116
+ },
117
+
118
+ {
119
+ "name": "Details",
120
+ "heading": "Let's talk about your post..",
121
+ "description": "Provide details and metadata that will enhance search or inform end-users.",
122
+ "columns": [
123
+ {
124
+ "heading": "Publishing (Optional Heading)",
125
+ "grid_width": 6,
126
+ "elements": [
127
+ {
128
+ "id": blog.fields.find_by_name('Description').id,
129
+ "tooltip": 'This is a short description and will be used as the preview text for a reader before they click into your full post.'
130
+ },
131
+ {
132
+ "id": blog.fields.find_by_name('Publish Date').id
133
+ },
134
+ {
135
+ "id": blog.fields.find_by_name('Expiration Date').id
136
+ }
137
+ ]
138
+ },
139
+ {
140
+ "grid_width": 6,
141
+ "elements": [
142
+ {
143
+ "id": blog.fields.find_by_name('Tags').id
144
+ },
145
+ {
146
+ "id": blog.fields.find_by_name('Slug').id,
147
+ "tooltip": "This is your post's URL. Between each word, place a hyphen. Best if between 35-50 characters and don't include years/dates."
148
+ },
149
+ {
150
+ "id": blog.fields.find_by_name('Author').id
151
+ }
152
+ ]
153
+ }
154
+ ]
155
+ },
156
+ {
157
+ "name": "Categorize",
158
+ "heading": "Sort Into Categories..",
159
+ "description": "Select the categories that best describe your post.",
160
+ "columns": [
161
+ {
162
+ "heading": "Publishing (Optional Heading)",
163
+ "grid_width": 4,
164
+ "elements": [
165
+ {
166
+ "id": blog.fields.find_by_name('Categories').id,
167
+ "render_method": "checkboxes",
168
+ "tooltip": "Please select 1-2 Categories."
169
+ }
170
+ ]
171
+ },
172
+ {
173
+ "grid_width": 4,
174
+ "elements": [
175
+ {
176
+ "id": blog.fields.find_by_name('Persona').id,
177
+ "render_method": "dropdown",
178
+ "tooltip": "If this is for a specific role or audience, please select. If it's for everyone, choose general audience."
179
+ }
180
+ ]
181
+ },
182
+ {
183
+ "grid_width": 4,
184
+ "elements": [
185
+ {
186
+ "id": blog.fields.find_by_name('Research').id,
187
+ "render_method": "dropdown",
188
+ "tooltip": "If your post is based on research, please select if it's CB owned or created (including Emsi), or if we're reporting on someone else's data."
189
+ }
190
+ ]
191
+ }
192
+ ]
193
+ },
194
+ {
195
+ "name": "Add Featured Image",
196
+ "description": "Add an image to feature with this Blog Post.",
197
+ "columns": [
198
+ {
199
+ "heading": "Image (Optional Heading)",
200
+ "grid_width": 12,
201
+ "elements": [
202
+ {
203
+ "id": blog.fields.find_by_name('Featured Image').id,
204
+ "render_method": "popup"
205
+ }
206
+ ]
207
+ }
208
+ ]
209
+ },
210
+ {
211
+ "name": "Search",
212
+ "heading": "How can others find your post..",
213
+ "description": "Provide SEO metadata to help your post get found by your Users!",
214
+ "columns": [
215
+ {
216
+ "grid_width": 6,
217
+ "elements": [
218
+ {
219
+ "id": blog.fields.find_by_name('SEO Title').id,
220
+ "tooltip": 'Please use <70 characters for your SEO title for optimal appearance in search results.'
221
+ },
222
+ {
223
+ "id": blog.fields.find_by_name('SEO Description').id,
224
+ "tooltip": 'The description should optimally be between 150-160 characters and keyword rich.'
225
+ },
226
+ {
227
+ "id": blog.fields.find_by_name('SEO Keywords').id,
228
+ "tooltip": 'Utilize the recommended keywords as tags to boost your SEO performance.'
229
+ }
230
+ ]
231
+ },
232
+ {
233
+ "grid_width": 6,
234
+ "description": "Select these if you don't want your post to be indexed by search engines like Google",
235
+ "elements": [
236
+ {
237
+ "id": blog.fields.find_by_name('No Index').id
238
+ },
239
+ {
240
+ "id": blog.fields.find_by_name('No Follow').id
241
+ },
242
+ {
243
+ "id": blog.fields.find_by_name('No Snippet').id
244
+ },
245
+ {
246
+ "id": blog.fields.find_by_name('No ODP').id
247
+ },
248
+ {
249
+ "id": blog.fields.find_by_name('No Archive').id
250
+ },
251
+ {
252
+ "id": blog.fields.find_by_name('No Image Index').id
253
+ }
254
+ ]
255
+ }
256
+ ]
257
+ }
258
+ ]
259
+ }
260
+
261
+ blog_wizard_decorator = Cortex::Decorator.new(name: "Wizard", data: wizard_hash, tenant: example_tenant)
262
+ blog_wizard_decorator.save!
263
+
264
+ Cortex::ContentableDecorator.create!({
265
+ decorator_id: blog_wizard_decorator.id,
266
+ contentable_id: blog.id,
267
+ contentable_type: 'Cortex::ContentType',
268
+ tenant: example_tenant
269
+ })
270
+
271
+ puts "Creating Index Cortex::Decorators..."
272
+ index_hash = {
273
+ "columns":
274
+ [
275
+ {
276
+ "name": "Author",
277
+ "grid_width": 2,
278
+ "cells": [{
279
+ "field": {
280
+ "method": "creator.email"
281
+ },
282
+ "display": {
283
+ "classes": [
284
+ "circular"
285
+ ]
286
+ }
287
+ }]
288
+ },
289
+ {
290
+ "name": "Post Details",
291
+ "cells": [
292
+ {
293
+ "field": {
294
+ "id": blog.fields.find_by_name('Title').id
295
+ },
296
+ "display": {
297
+ "classes": [
298
+ "bold",
299
+ "upcase"
300
+ ]
301
+ }
302
+ },
303
+ {
304
+ "field": {
305
+ "id": blog.fields.find_by_name('Slug').id
306
+ }
307
+ },
308
+ {
309
+ "field": {
310
+ "method": "publish_state"
311
+ }
312
+ }
313
+ ]
314
+ },
315
+ {
316
+ "name": "Tags",
317
+ "cells": [
318
+ {
319
+ "field": {
320
+ "id": blog.fields.find_by_name('Tags').id
321
+ },
322
+ "display": {
323
+ "classes": [
324
+ "tag",
325
+ "rounded"
326
+ ]
327
+ }
328
+ }
329
+ ]
330
+ }
331
+ ]
332
+ }
333
+
334
+ blog_index_decorator = Cortex::Decorator.new(name: "Index", data: index_hash, tenant: example_tenant)
335
+ blog_index_decorator.save!
336
+
337
+ Cortex::ContentableDecorator.create!({
338
+ decorator_id: blog_index_decorator.id,
339
+ contentable_id: blog.id,
340
+ contentable_type: 'Cortex::ContentType',
341
+ tenant: example_tenant
342
+ })
343
+ end
344
+ end
345
+ end