knitkit 3.0.0 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (203) hide show
  1. checksums.yaml +4 -4
  2. data/{public → app/assets}/images/check.png +0 -0
  3. data/{public → app/assets}/images/credit_card.png +0 -0
  4. data/{public → app/assets}/images/inline_edit/close.png +0 -0
  5. data/{public → app/assets}/images/knitkit/icons/document.png +0 -0
  6. data/{public → app/assets}/images/knitkit/icons/multi_doc.png +0 -0
  7. data/{public → app/assets}/images/knitkit/logo.png +0 -0
  8. data/{public → app/assets}/images/knitkit/splash/images/add-site.png +0 -0
  9. data/app/assets/images/knitkit/splash/images/add_website_105x105-active.png +0 -0
  10. data/app/assets/images/knitkit/splash/images/add_website_105x105.png +0 -0
  11. data/{public → app/assets}/images/knitkit/splash/images/adjust-site.png +0 -0
  12. data/{public → app/assets}/images/knitkit/splash/images/browse-site.png +0 -0
  13. data/app/assets/images/knitkit/splash/images/browse_db_105x105-active.png +0 -0
  14. data/app/assets/images/knitkit/splash/images/browse_db_105x105.png +0 -0
  15. data/app/assets/images/knitkit/splash/images/console_105x105-active.png +0 -0
  16. data/app/assets/images/knitkit/splash/images/console_105x105.png +0 -0
  17. data/{public → app/assets}/images/knitkit/splash/images/find-themes.png +0 -0
  18. data/app/assets/images/knitkit/splash/images/find_themes_105x105-active.png +0 -0
  19. data/app/assets/images/knitkit/splash/images/find_themes_105x105.png +0 -0
  20. data/app/assets/images/knitkit/splash/images/learn_more_105x105-active.png +0 -0
  21. data/app/assets/images/knitkit/splash/images/learn_more_105x105.png +0 -0
  22. data/{public → app/assets}/images/knitkit/splash/images/settings.png +0 -0
  23. data/{public → app/assets}/images/knitkit/splash/images/tutorials.png +0 -0
  24. data/app/assets/images/knitkit/splash/splash.png +0 -0
  25. data/app/assets/images/widgets/manage_profile/contact_information.png +0 -0
  26. data/app/assets/images/widgets/manage_profile/password.png +0 -0
  27. data/app/assets/images/widgets/manage_profile/user_information.png +0 -0
  28. data/app/assets/javascripts/erp_app/desktop/applications/knitkit/app.js +24 -0
  29. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/articles_grid_panel.js +15 -12
  30. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/center_region.js +69 -48
  31. data/app/assets/javascripts/erp_app/desktop/applications/knitkit/comments_grid_panel.js +214 -0
  32. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/east_region/east_region.js +0 -0
  33. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/east_region/file_assets_panel.js +17 -19
  34. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/east_region/image_assets_data_view.js +13 -3
  35. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/east_region/image_assets_panel.js +59 -48
  36. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/east_region/widgets_panel.js +0 -0
  37. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/inquiries_grid_panel.js +2 -2
  38. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/module.js +2 -2
  39. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/publish_window.js +0 -0
  40. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/published_grid_panel.js +1 -1
  41. data/app/assets/javascripts/erp_app/desktop/applications/knitkit/splash_screen.js +268 -0
  42. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/top_menu/main_menu.js +85 -33
  43. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/top_menu/websites_combo.js +0 -0
  44. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/versions_grid_panel.js +5 -28
  45. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/article.js +22 -8
  46. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/document.js +143 -25
  47. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/host.js +5 -1
  48. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/menu.js +2 -0
  49. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/section.js +181 -65
  50. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/website_nav_items.js +0 -0
  51. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/hosts_tree_panel.js +0 -0
  52. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/menu_tree_panel.js +0 -0
  53. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/site_contents_tree_panel.js +121 -116
  54. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/themes_tree_panel.js +101 -10
  55. data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/west_region.js +9 -5
  56. data/app/assets/javascripts/knitkit-web.js +22 -0
  57. data/app/assets/javascripts/knitkit/additional-methods.min.js +4 -0
  58. data/app/assets/javascripts/knitkit/bootstrap.min.js +7 -0
  59. data/app/assets/javascripts/knitkit/captcha.js +154 -0
  60. data/{public → app/assets}/javascripts/knitkit/confirm-bootstrap.js +1 -1
  61. data/{public → app/assets}/javascripts/knitkit/inline_editing.js +1 -1
  62. data/{public → app/assets}/javascripts/knitkit/jquery.maskedinput.min.js +0 -0
  63. data/app/assets/javascripts/knitkit/jquery.validate.min.js +4 -0
  64. data/app/assets/javascripts/knitkit/js.cookie.js +145 -0
  65. data/{public → app/assets}/javascripts/knitkit/theme.js +0 -0
  66. data/app/assets/stylesheets/erp_app/desktop/applications/knitkit/app.css +12 -0
  67. data/{public → app/assets}/stylesheets/erp_app/desktop/applications/knitkit/knitkit.css +23 -33
  68. data/app/assets/stylesheets/erp_app/shared/knitkit_shared.css +21 -0
  69. data/app/assets/stylesheets/fonts/glyphicons-halflings-regular.eot +0 -0
  70. data/app/assets/stylesheets/fonts/glyphicons-halflings-regular.svg +288 -0
  71. data/app/assets/stylesheets/fonts/glyphicons-halflings-regular.ttf +0 -0
  72. data/app/assets/stylesheets/fonts/glyphicons-halflings-regular.woff +0 -0
  73. data/app/assets/stylesheets/fonts/glyphicons-halflings-regular.woff2 +0 -0
  74. data/app/assets/stylesheets/knitkit-web.css +16 -0
  75. data/app/assets/stylesheets/knitkit/bootstrap.min.css +5 -0
  76. data/app/assets/stylesheets/knitkit/captcha.css +59 -0
  77. data/app/assets/stylesheets/knitkit/custom.css +144 -0
  78. data/{public → app/assets}/stylesheets/knitkit/inline_editing.css +0 -0
  79. data/app/assets/stylesheets/knitkit/submenu.css +93 -0
  80. data/app/controllers/api/v1/websites_controller.rb +14 -0
  81. data/app/controllers/captcha_controller.rb +53 -0
  82. data/app/controllers/knitkit/base_controller.rb +1 -5
  83. data/app/controllers/knitkit/erp_app/desktop/app_controller.rb +2 -9
  84. data/app/controllers/knitkit/erp_app/desktop/articles_controller.rb +20 -7
  85. data/app/controllers/knitkit/erp_app/desktop/file_assets_controller.rb +38 -28
  86. data/app/controllers/knitkit/erp_app/desktop/image_assets_controller.rb +16 -9
  87. data/app/controllers/knitkit/erp_app/desktop/online_document_sections_controller.rb +69 -15
  88. data/app/controllers/knitkit/erp_app/desktop/position_controller.rb +45 -58
  89. data/app/controllers/knitkit/erp_app/desktop/theme_controller.rb +64 -29
  90. data/app/controllers/knitkit/erp_app/desktop/website_controller.rb +36 -13
  91. data/app/controllers/knitkit/erp_app/desktop/website_host_controller.rb +12 -0
  92. data/app/controllers/knitkit/erp_app/desktop/website_nav_controller.rb +4 -11
  93. data/app/controllers/knitkit/erp_app/desktop/website_nav_item_controller.rb +2 -9
  94. data/app/controllers/knitkit/erp_app/desktop/website_section_controller.rb +56 -20
  95. data/app/controllers/knitkit/online_document_sections_controller.rb +9 -3
  96. data/app/mailers/website_inquiry_mailer.rb +11 -3
  97. data/app/models/content.rb +16 -6
  98. data/app/models/documented_item.rb +12 -1
  99. data/app/models/online_document_section.rb +54 -20
  100. data/app/models/published_website.rb +16 -0
  101. data/app/models/theme.rb +53 -47
  102. data/app/models/website.rb +172 -191
  103. data/app/models/website_section.rb +64 -30
  104. data/app/views/knitkit/blogs/show.html.erb +5 -2
  105. data/app/views/layouts/knitkit/base.html.erb +54 -51
  106. data/app/views/menus/knitkit/_default_menu.html.erb +11 -11
  107. data/app/views/menus/knitkit/_default_section_menu.html.erb +2 -2
  108. data/app/views/menus/knitkit/_default_sub_menu.erb +27 -0
  109. data/app/views/menus/knitkit/_default_sub_section_menu.html.erb +30 -0
  110. data/app/views/website_inquiry_mailer/inquiry.html.erb +266 -0
  111. data/app/widgets/contact_us/base.rb +26 -16
  112. data/app/widgets/contact_us/javascript/contact_us.js +1 -1
  113. data/app/widgets/contact_us/views/error.html.erb +7 -3
  114. data/app/widgets/contact_us/views/index.html.erb +36 -28
  115. data/app/widgets/google_map/javascript/google_map.js +1 -1
  116. data/app/widgets/google_map/views/index.html.erb +1 -1
  117. data/app/widgets/login/javascript/login.js +1 -1
  118. data/app/widgets/login/views/index.html.erb +1 -1
  119. data/app/widgets/manage_profile/base.rb +141 -112
  120. data/app/widgets/manage_profile/javascript/manage_profile.js +2 -2
  121. data/app/widgets/manage_profile/views/_password_form.html.erb +1 -1
  122. data/app/widgets/manage_profile/views/_user_information_form.html.erb +1 -30
  123. data/app/widgets/manage_profile/views/index.html.erb +42 -40
  124. data/app/widgets/reset_password/base.rb +39 -8
  125. data/app/widgets/reset_password/javascript/reset_password.js +1 -1
  126. data/app/widgets/reset_password/views/index.html.erb +3 -3
  127. data/app/widgets/reset_password/views/invalid_reset_token.html.erb +7 -0
  128. data/app/widgets/reset_password/views/layouts/base.html.erb +1 -1
  129. data/app/widgets/reset_password/views/reset_password.html.erb +39 -0
  130. data/app/widgets/reset_password/views/reset_success.html.erb +5 -0
  131. data/app/widgets/search/base.rb +5 -5
  132. data/app/widgets/search/javascript/search.js +6 -6
  133. data/app/widgets/search/views/_inline_search_form.html.erb +23 -12
  134. data/app/widgets/search/views/_search_form.html.erb +34 -30
  135. data/app/widgets/search/views/layouts/base.html.erb +6 -1
  136. data/app/widgets/signup/base.rb +73 -30
  137. data/app/widgets/signup/javascript/signup.js +1 -1
  138. data/app/widgets/signup/views/_signup_form.html.erb +2 -1
  139. data/app/widgets/signup/views/layouts/base.html.erb +1 -1
  140. data/app/widgets/signup/views/success.html.erb +2 -3
  141. data/config/routes.rb +25 -4
  142. data/db/data_migrations/20110509223702_add_publisher_role.rb +0 -2
  143. data/db/data_migrations/20110816153456_add_knitkit_application.rb +7 -15
  144. data/db/data_migrations/20120127150505_create_website_default_configuration.rb +63 -3
  145. data/db/data_migrations/20150118180450_add_website_member_roles.rb +12 -0
  146. data/db/data_migrations/20150414150359_nest_knitkit_security_roles.rb +35 -0
  147. data/db/data_migrations/20150414173437_move_website_roles_under_website_builder.rb +19 -0
  148. data/db/migrate/20110211002317_setup_knitkit.rb +86 -39
  149. data/lib/knitkit.rb +8 -2
  150. data/lib/knitkit/config.rb +2 -3
  151. data/lib/knitkit/engine.rb +35 -4
  152. data/lib/knitkit/extensions.rb +2 -1
  153. data/lib/knitkit/extensions/action_controller/theme_support/acts_as_themed_controller.rb +1 -1
  154. data/lib/knitkit/extensions/action_mailer/theme_support/acts_as_themed_mailer.rb +1 -1
  155. data/lib/knitkit/extensions/compass_ae/mailers/user_mailer.rb +31 -0
  156. data/lib/knitkit/extensions/compass_ae/widgets/base.rb +1 -1
  157. data/lib/knitkit/extensions/railties/action_controller/captcha_helper.rb +43 -0
  158. data/lib/knitkit/extensions/railties/action_view/helpers/content_helper.rb +1 -1
  159. data/lib/knitkit/extensions/railties/action_view/helpers/menu_helper.rb +11 -1
  160. data/lib/knitkit/extensions/railties/theme_support/asset_tag_helper.rb +83 -0
  161. data/lib/knitkit/routing_filter/section_router.rb +24 -14
  162. data/lib/knitkit/version.rb +1 -1
  163. data/lib/tasks/knitkit_tasks.rake +89 -4
  164. data/lib/tasks/theme_parser.rake +85 -0
  165. data/public/fonts/glyphicons-halflings-regular.eot +0 -0
  166. data/public/fonts/glyphicons-halflings-regular.svg +288 -0
  167. data/public/fonts/glyphicons-halflings-regular.ttf +0 -0
  168. data/public/fonts/glyphicons-halflings-regular.woff +0 -0
  169. data/public/fonts/glyphicons-halflings-regular.woff2 +0 -0
  170. data/public/paypal-button.min.js +7 -0
  171. metadata +161 -82
  172. data/app/assets/javascripts/knitkit/application.js +0 -9
  173. data/app/assets/stylesheets/knitkit/application.css +0 -7
  174. data/app/mailers/document_mailer.rb +0 -10
  175. data/app/views/document_mailer/email_document.html.erb +0 -12
  176. data/app/views/knitkit/mobile/index.html.erb +0 -162
  177. data/app/views/knitkit/online_document_sections/index.html.erb +0 -279
  178. data/app/views/layouts/knitkit/online_document_sections.html.erb +0 -80
  179. data/app/views/website_inquiry_mailer/inquiry.erb +0 -24
  180. data/db/data_migrations/20120127150506_add_primary_host_to_website_configuration.rb +0 -33
  181. data/db/data_migrations/20120316150424_add_is_template_to_default_website_config.rb +0 -16
  182. data/db/data_migrations/20120809020508_update_website_and_configuration.rb +0 -82
  183. data/db/data_migrations/20121129185611_upgrade_website_role_iid.rb +0 -20
  184. data/db/migrate/20130405184234_add_use_markdown_to_section.rb +0 -19
  185. data/db/migrate/20131112013052_add_knitkit_missing_indexes.rb +0 -33
  186. data/db/migrate/20140622212723_update_website_inquiries.rb +0 -22
  187. data/db/migrate/20140911185022_add_publishing_to_website.rb +0 -5
  188. data/db/migrate/20141013073349_add_custom_fields_to_documents.rb +0 -12
  189. data/db/migrate/20141016101936_upgrade_remove_dynamic_attributes.rb +0 -13
  190. data/lib/knitkit/extensions/railties/theme_support/theme_file_resolver.rb +0 -49
  191. data/public/images/knitkit/close_window.png +0 -0
  192. data/public/images/knitkit/splash/splash.png +0 -0
  193. data/public/javascripts/erp_app/desktop/applications/knitkit/comments_grid_panel.js +0 -215
  194. data/public/javascripts/erp_app/desktop/applications/knitkit/select_roles_window.js +0 -108
  195. data/public/javascripts/erp_app/desktop/applications/knitkit/splash_screen.js +0 -170
  196. data/public/javascripts/knitkit/bootstrap-datepicker.js +0 -474
  197. data/public/javascripts/knitkit/bootstrap.min.js +0 -7
  198. data/public/javascripts/knitkit/mobile/app/view/Main.js +0 -108
  199. data/public/javascripts/knitkit/mobile/ux/slidenavigation/View.js +0 -734
  200. data/public/stylesheets/knitkit/bootstrap-responsive.min.css +0 -10
  201. data/public/stylesheets/knitkit/bootstrap.min.css +0 -7
  202. data/public/stylesheets/knitkit/custom.css +0 -122
  203. data/public/stylesheets/knitkit/datepicker.css +0 -182
@@ -0,0 +1,19 @@
1
+ class MoveWebsiteRolesUnderWebsiteBuilder
2
+
3
+ def self.up
4
+ Website.all.each do |website|
5
+ role = website.role
6
+
7
+ role.move_to_child_of(SecurityRole.iid('website_builder'))
8
+ end
9
+ end
10
+
11
+ def self.down
12
+ Website.all.each do |website|
13
+ role = website.role
14
+
15
+ role.move_to_child_of(nil)
16
+ end
17
+ end
18
+
19
+ end
@@ -1,20 +1,22 @@
1
1
  class SetupKnitkit < ActiveRecord::Migration
2
2
  def self.up
3
3
 
4
+ # websites
4
5
  unless table_exists?(:websites)
5
6
  create_table :websites do |t|
6
7
  t.string :name
7
8
  t.string :title
8
9
  t.string :subtitle
9
10
  t.string :internal_identifier
10
- t.string :email
11
- t.boolean :auto_activate_publication
12
- t.boolean :email_inquiries
11
+ t.boolean :publishing, :default => false
13
12
 
14
13
  t.timestamps
15
14
  end
15
+
16
+ add_index :websites, :internal_identifier, :name => 'websites_internal_identifier_idx'
16
17
  end
17
18
 
19
+ # website_hosts
18
20
  unless table_exists?(:website_hosts)
19
21
  create_table :website_hosts do |t|
20
22
  t.references :website
@@ -26,16 +28,24 @@ class SetupKnitkit < ActiveRecord::Migration
26
28
  add_index :website_hosts, :website_id
27
29
  end
28
30
 
31
+ # website_inquiries
29
32
  unless table_exists?(:website_inquiries)
30
33
  create_table :website_inquiries do |t|
31
34
  t.integer :website_id
35
+ t.string :first_name
36
+ t.string :last_name
37
+ t.string :email
38
+ t.text :message
39
+ t.references :created_by
32
40
 
33
41
  t.timestamps
34
42
  end
35
43
 
36
44
  add_index :website_inquiries, :website_id
45
+ add_index :website_inquiries, :created_by_id, :name => 'inquiry_created_by_idx'
37
46
  end
38
47
 
48
+ # website_sections
39
49
  unless table_exists?(:website_sections)
40
50
  create_table :website_sections do |t|
41
51
  t.string :title
@@ -50,6 +60,7 @@ class SetupKnitkit < ActiveRecord::Migration
50
60
  t.string :internal_identifier
51
61
  t.integer :version
52
62
  t.boolean :render_base_layout, :default => true
63
+ t.boolean :use_markdown
53
64
 
54
65
  #better nested set columns
55
66
  t.integer :parent_id
@@ -69,8 +80,12 @@ class SetupKnitkit < ActiveRecord::Migration
69
80
  add_index :website_sections, :internal_identifier, :name => 'section_iid_idx'
70
81
 
71
82
  WebsiteSection.create_versioned_table
83
+
84
+ add_index :website_section_versions, :website_id, :name => 'website_section_versions_website_id_idx'
85
+ add_index :website_section_versions, :internal_identifier, :name => 'website_section_versions_internal_identifier_idx'
72
86
  end
73
87
 
88
+ # contents
74
89
  unless table_exists?(:contents)
75
90
  create_table :contents do |t|
76
91
  t.string :type
@@ -95,13 +110,18 @@ class SetupKnitkit < ActiveRecord::Migration
95
110
  add_index :contents, :internal_identifier, :name => 'contents_iid_idx'
96
111
 
97
112
  Content.create_versioned_table
113
+
114
+ add_index :content_versions, :created_by_id, :name => 'content_versions_created_by_id_idx'
115
+ add_index :content_versions, :updated_by_id, :name => 'content_versions_updated_by_id_idx'
116
+ add_index :content_versions, :internal_identifier, :name => 'content_versions_internal_identifier_idx'
98
117
  end
99
118
 
119
+ # website_section_contents
100
120
  unless table_exists?(:website_section_contents)
101
121
  create_table :website_section_contents do |t|
102
122
  t.integer :website_section_id
103
123
  t.integer :content_id
104
- t.string :content_area
124
+ t.string :content_area
105
125
  t.integer :position, :default => 0
106
126
 
107
127
  t.timestamps
@@ -113,6 +133,7 @@ class SetupKnitkit < ActiveRecord::Migration
113
133
  add_index :website_section_contents, :content_area
114
134
  end
115
135
 
136
+ # themes
116
137
  unless table_exists?(:themes)
117
138
  create_table :themes do |t|
118
139
  t.references :website
@@ -131,6 +152,7 @@ class SetupKnitkit < ActiveRecord::Migration
131
152
  add_index :themes, :active
132
153
  end
133
154
 
155
+ # published_websites
134
156
  unless table_exists?(:published_websites)
135
157
  create_table :published_websites do |t|
136
158
  t.references :website
@@ -149,6 +171,7 @@ class SetupKnitkit < ActiveRecord::Migration
149
171
  add_index :published_websites, :published_by_id
150
172
  end
151
173
 
174
+ # published_elements
152
175
  unless table_exists?(:published_elements)
153
176
  create_table :published_elements do |t|
154
177
  t.references :published_website
@@ -166,12 +189,13 @@ class SetupKnitkit < ActiveRecord::Migration
166
189
  add_index :published_elements, :published_by_id
167
190
  end
168
191
 
192
+ # comments
169
193
  unless table_exists?(:comments)
170
194
  create_table :comments do |t|
171
- t.string :commentor_name
172
- t.string :email
173
- t.text :comment
174
- t.integer :approved
195
+ t.string :commentor_name
196
+ t.string :email
197
+ t.text :comment
198
+ t.integer :approved
175
199
  t.datetime :approved_at
176
200
  t.references :user
177
201
  t.references :commented_record, :polymorphic => true
@@ -184,6 +208,7 @@ class SetupKnitkit < ActiveRecord::Migration
184
208
  add_index :comments, [:user_id]
185
209
  end
186
210
 
211
+ # website_nav_items
187
212
  unless table_exists?(:website_nav_items)
188
213
  create_table :website_nav_items do |t|
189
214
  t.references :website_nav
@@ -208,6 +233,7 @@ class SetupKnitkit < ActiveRecord::Migration
208
233
  add_index :website_nav_items, :rgt
209
234
  end
210
235
 
236
+ # website_navs
211
237
  unless table_exists?(:website_navs)
212
238
  create_table :website_navs do |t|
213
239
  t.references :website
@@ -219,12 +245,14 @@ class SetupKnitkit < ActiveRecord::Migration
219
245
  add_index :website_navs, :website_id
220
246
  end
221
247
 
248
+ # tags
222
249
  unless table_exists?(:tags)
223
250
  create_table :tags do |t|
224
251
  t.column :name, :string
225
252
  end
226
253
  end
227
254
 
255
+ # tags
228
256
  unless table_exists?(:taggings)
229
257
  create_table :taggings do |t|
230
258
  t.column :tag_id, :integer
@@ -244,6 +272,7 @@ class SetupKnitkit < ActiveRecord::Migration
244
272
  add_index :taggings, [:taggable_id, :taggable_type, :context], :name => 'taggable_poly_idx'
245
273
  end
246
274
 
275
+ # website_party_roles
247
276
  unless table_exists? :website_party_roles
248
277
  create_table :website_party_roles do |t|
249
278
  #foreign keys
@@ -258,45 +287,63 @@ class SetupKnitkit < ActiveRecord::Migration
258
287
  add_index :website_party_roles, :role_type_id
259
288
  add_index :website_party_roles, :party_id
260
289
  end
261
-
262
- create_table :documented_items, :force => true do |t|
263
- t.string :documented_klass, :null => true
264
- t.integer :documented_content_id, :null => true
265
- t.integer :online_document_section_id
266
- t.timestamps
267
- end
268
-
269
- create_table :documents do |t|
270
- t.string :external_identifier
271
- t.string :internal_identifier
272
- t.string :description
273
- t.datetime :document_date
274
290
 
275
- t.references :document_record, :polymorphic => true
276
- t.references :document_type
291
+ # documented_items
292
+ unless table_exists? :documented_items
293
+ create_table :documented_items do |t|
294
+ t.string :documented_klass, :null => true
295
+ t.integer :documented_content_id, :null => true
296
+ t.integer :online_document_section_id
297
+ t.timestamps
298
+ end
277
299
 
278
- t.timestamps
300
+ add_index :documented_items, :documented_content_id, :name => 'documented_items_documented_content_id_idx'
301
+ add_index :documented_items, :online_document_section_id, :name => 'documented_items_online_document_section_id_idx'
279
302
  end
280
303
 
281
- add_index :documents, [:document_record_type, :document_record_id], :name => 'document_record_poly_idx'
282
- add_index :documents, :document_type_id, :name => 'document_type_idx'
304
+ # documents
305
+ unless table_exists? :documents
306
+ create_table :documents do |t|
307
+ t.string :external_identifier
308
+ t.string :internal_identifier
309
+ t.string :description
310
+ t.datetime :document_date
311
+
312
+ t.references :document_record, :polymorphic => true
313
+ t.references :document_type
314
+ t.text :custom_fields
283
315
 
284
- create_table :document_types do |t|
285
- t.string :external_identifier
286
- t.string :internal_identifier
287
- t.string :description
316
+ t.timestamps
317
+ end
288
318
 
289
- t.timestamps
319
+ add_index :documents, [:document_record_type, :document_record_id], :name => 'document_record_poly_idx'
320
+ add_index :documents, :document_type_id, :name => 'document_type_idx'
321
+ add_index :documents, :internal_identifier, :name => 'documents_internal_identifier_idx'
290
322
  end
291
-
292
- create_table :valid_documents do |t|
293
- t.references :document
294
- t.references :documented_model, :polymorphic => true
323
+
324
+ # document_types
325
+ unless table_exists? :document_types
326
+ create_table :document_types do |t|
327
+ t.string :external_identifier
328
+ t.string :internal_identifier
329
+ t.string :description
330
+
331
+ t.timestamps
332
+ end
333
+
334
+ add_index :document_types, :internal_identifier, :name => 'document_types_internal_identifier_idx'
295
335
  end
296
336
 
297
- add_index :valid_documents, :document_id
298
- add_index :valid_documents, [:documented_model_id, :documented_model_type], :name => 'valid_documents_model_idx'
337
+ # valid_documents
338
+ unless table_exists? :valid_documents
339
+ create_table :valid_documents do |t|
340
+ t.references :document
341
+ t.references :documented_model, :polymorphic => true
342
+ end
299
343
 
344
+ add_index :valid_documents, :document_id
345
+ add_index :valid_documents, [:documented_model_id, :documented_model_type], :name => 'valid_documents_model_idx'
346
+ end
300
347
  end
301
348
 
302
349
  def self.down
@@ -305,8 +352,8 @@ class SetupKnitkit < ActiveRecord::Migration
305
352
 
306
353
  # check that each table exists before trying to delete it.
307
354
  [:websites, :website_sections, :contents, :website_section_contents, :documents, :document_types, :valid_documents,
308
- :themes, :theme_files, :published_websites, :published_elements, :website_party_roles,
309
- :comments,:website_hosts,:website_nav_items, :website_navs, :tags, :taggings, :documented_items].each do |tbl|
355
+ :themes, :theme_files, :published_websites, :published_elements, :website_party_roles,
356
+ :comments, :website_hosts, :website_nav_items, :website_navs, :tags, :taggings, :documented_items].each do |tbl|
310
357
  if table_exists?(tbl)
311
358
  drop_table tbl
312
359
  end
@@ -1,14 +1,20 @@
1
1
  #compass libraries
2
2
  require 'erp_app'
3
3
 
4
+ require 'momentjs-rails'
5
+ require 'bootstrap3-datetimepicker-rails'
6
+ require 'html_truncator'
7
+ require 'visual_captcha'
8
+ require 'kramdown'
4
9
  require 'routing_filter'
10
+
11
+ require 'knitkit/extensions'
5
12
  require "knitkit/version"
6
13
  require "knitkit/routing_filter/section_router.rb"
7
- require 'knitkit/extensions'
8
14
  require "knitkit/syntax_validator"
9
15
  require "knitkit/config"
10
16
  require "knitkit/engine"
11
- require 'kramdown'
17
+
12
18
 
13
19
  module Knitkit
14
20
  end
@@ -1,13 +1,12 @@
1
1
  module Knitkit
2
2
  module Config
3
3
  class << self
4
- attr_accessor :unauthorized_url, :ignored_prefix_paths, :images_base_path
4
+ attr_accessor :unauthorized_url, :ignored_prefix_paths
5
5
 
6
6
  def init!
7
7
  @defaults = {
8
8
  :@unauthorized_url => '/unauthorized',
9
- :@ignored_prefix_paths => [],
10
- :@images_base_path => File.join("public", "knitkit")
9
+ :@ignored_prefix_paths => []
11
10
  }
12
11
  end
13
12
 
@@ -8,12 +8,43 @@ module Knitkit
8
8
  isolate_namespace Knitkit
9
9
 
10
10
  config.knitkit = Knitkit::Config
11
-
12
- initializer "knikit.merge_public" do |app|
11
+
12
+ initializer "knitkit.merge_public" do |app|
13
13
  app.middleware.insert_before Rack::Runtime, ::ActionDispatch::Static, "#{root}/public"
14
14
  end
15
15
 
16
- ActiveSupport.on_load(:active_record) do
16
+ initializer :assets do |config|
17
+ # include widget javascript assets
18
+ Dir.foreach(root.join("app", "assets", "javascripts", "widgets")) do |dir|
19
+ next if dir == '.' or dir == '..'
20
+ Dir.foreach(root.join("app", "assets", "javascripts", "widgets", dir)) do |file|
21
+ Rails.application.config.assets.precompile << File.join("widgets", dir, file)
22
+ end
23
+ end if File.exists?(root.join("app", "assets", "stylesheets", "widgets"))
24
+
25
+ # include widget stylesheet assets
26
+ Dir.foreach(root.join("app", "assets", "stylesheets", "widgets")) do |dir|
27
+ next if dir == '.' or dir == '..'
28
+ Dir.foreach(root.join("app", "assets", "stylesheets", "widgets", dir)) do |file|
29
+ Rails.application.config.assets.precompile << File.join("widgets", dir, file)
30
+ end
31
+ end if File.exists?(root.join("app", "assets", "stylesheets", "widgets"))
32
+
33
+ Rails.application.config.assets.paths << root.join("app", "assets", "images")
34
+ Rails.application.config.assets.precompile += %w{ knitkit-web.css knitkit/custom.css knitkit-web.js knitkit/theme.js }
35
+ Rails.application.config.assets.precompile += %w{ erp_app/desktop/applications/knitkit/app.js }
36
+ Rails.application.config.assets.precompile += %w{ erp_app/desktop/applications/knitkit/app.css }
37
+
38
+ Rails.application.config.assets.precompile += %w{ erp_app/shared/knitkit_shared.css }
39
+ ErpApp::Config.shared_css_assets += %w{ erp_app/shared/knitkit_shared.css }
40
+ end
41
+
42
+ # filter sensitive information during logging
43
+ initializer "kntikit.params.filter" do |app|
44
+ app.config.filter_parameters += [:card_number, :cvc, :exp_month, :exp_year]
45
+ end
46
+
47
+ ActiveSupport.on_load(:active_record) do
17
48
  include Knitkit::Extensions::ActiveRecord::ActsAsPublishable
18
49
  include Knitkit::Extensions::ActiveRecord::ThemeSupport::HasManyThemes
19
50
  include Knitkit::Extensions::ActiveRecord::ActsAsDocument
@@ -30,6 +61,6 @@ module Knitkit
30
61
 
31
62
  ErpBaseErpSvcs.register_as_compass_ae_engine(config, self)
32
63
  ::ErpApp::Widgets::Loader.load_compass_ae_widgets(config, self)
33
-
64
+
34
65
  end#Engine
35
66
  end#Knitkit
@@ -4,7 +4,6 @@ require 'knitkit/extensions/core/array'
4
4
  #railties
5
5
  require 'knitkit/extensions/railties/action_view/base'
6
6
  require 'knitkit/extensions/railties/theme_support/asset_tag_helper'
7
- require 'knitkit/extensions/railties/theme_support/theme_file_resolver'
8
7
 
9
8
  #active_record extensions
10
9
  require 'knitkit/extensions/active_record/acts_as_publishable'
@@ -20,3 +19,5 @@ require 'knitkit/extensions/action_mailer/theme_support/acts_as_themed_mailer'
20
19
 
21
20
  #willpaginate
22
21
  require 'knitkit/extensions/will_paginate/link_renderer'
22
+
23
+ require 'knitkit/extensions/railties/action_controller/captcha_helper'
@@ -56,7 +56,7 @@ module Knitkit
56
56
  path = "#{theme[:path]}/templates"
57
57
  cached_resolver = ThemeSupport::Cache.theme_resolvers.find { |cached_resolver| cached_resolver.to_path == path }
58
58
  if cached_resolver.nil?
59
- resolver = ActionView::ThemeFileResolver.new(path)
59
+ resolver = ActionView::CompassAeFileResolver.new(path)
60
60
  ThemeSupport::Cache.theme_resolvers << resolver
61
61
  resolver
62
62
  else
@@ -37,7 +37,7 @@ module Knitkit
37
37
  path = "#{theme[:path]}/templates"
38
38
  cached_resolver = ThemeSupport::Cache.theme_resolvers.find { |cached_resolver| cached_resolver.to_path == path }
39
39
  if cached_resolver.nil?
40
- resolver = ActionView::ThemeFileResolver.new(path)
40
+ resolver = ActionView::CompassAeFileResolver.new(path)
41
41
  ThemeSupport::Cache.theme_resolvers << resolver
42
42
  resolver
43
43
  else
@@ -0,0 +1,31 @@
1
+ UserMailer.class_eval do
2
+ acts_as_themed_mailer
3
+
4
+ def activation_needed_email(user)
5
+ # add theme paths if a website is present
6
+ if user.instance_attributes[:website_id]
7
+ add_theme_view_paths(Website.find(user.instance_attributes[:website_id]))
8
+ end
9
+
10
+ @user = user
11
+ @url = "#{get_domain(user.instance_attributes[:domain])}/users/activate/#{user.activation_token}"
12
+ @url << "?login_url=#{@user.instance_attributes[:login_url]}" unless @user.instance_attributes[:login_url].nil?
13
+
14
+ @temp_password = @user.instance_attributes[:temp_password] unless @user.instance_attributes[:temp_password].nil?
15
+
16
+ mail(:to => user.email, :subject => "An account has been created and needs activation")
17
+ end
18
+
19
+ def reset_password_email(user)
20
+ # add theme paths if a website is present
21
+ if user.instance_attributes[:website_id]
22
+ add_theme_view_paths(Website.find(user.instance_attributes[:website_id]))
23
+ end
24
+
25
+ @user = user
26
+ @reset_password_token = @user.reset_password_token
27
+
28
+ @url = "#{get_domain(user.instance_attributes[:domain])}#{@user.instance_attributes[:reset_password_url]}?token=#{@reset_password_token}"
29
+ mail(:to => user.email, :subject => "Your password has been reset")
30
+ end
31
+ end