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
@@ -1,6 +1,8 @@
1
1
  Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self, items, record) {
2
- var sectionId = record.data.id.split('_')[1];
2
+ var sectionId = record.get('recordId');
3
+ var websiteId = compassDesktop.getModule('knitkit-win').currentWebsite.id;
3
4
 
5
+ // Add Article
4
6
  items.push({
5
7
  text: 'Add Article',
6
8
  iconCls: 'icon-document',
@@ -12,7 +14,8 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
12
14
  xtype: 'textfield',
13
15
  fieldLabel: 'Title',
14
16
  allowBlank: false,
15
- name: 'title'
17
+ name: 'title',
18
+ itemId: 'title'
16
19
  },
17
20
  {
18
21
  xtype: 'radiogroup',
@@ -55,22 +58,15 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
55
58
  ];
56
59
 
57
60
  Ext.widget('window', {
58
- layout: 'fit',
59
61
  modal: true,
60
- width: 375,
61
62
  title: 'Create New Article',
62
- plain: true,
63
63
  buttonAlign: 'center',
64
+ defaultFocus: 'title',
64
65
  items: {
65
66
  xtype: 'form',
66
- labelWidth: 110,
67
67
  frame: false,
68
68
  bodyStyle: 'padding:5px 5px 0',
69
- width: 425,
70
69
  url: '/knitkit/erp_app/desktop/articles/new/' + sectionId,
71
- defaults: {
72
- width: 300
73
- },
74
70
  items: addFormItems
75
71
  },
76
72
  buttons: [
@@ -81,9 +77,12 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
81
77
  var window = button.findParentByType('window');
82
78
  var formPanel = window.query('form')[0];
83
79
 
80
+ var loadMask = new Ext.LoadMask(window, {msg: 'Please wait...'});
81
+
84
82
  formPanel.getForm().submit({
85
83
  reset: true,
86
84
  success: function (form, action) {
85
+ loadMask.hide();
87
86
  var obj = Ext.decode(action.response.responseText);
88
87
  if (obj.success) {
89
88
  obj.node.createdAt = obj.node.created_at;
@@ -96,6 +95,7 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
96
95
  window.close();
97
96
  },
98
97
  failure: function (form, action) {
98
+ loadMask.hide();
99
99
  Ext.Msg.alert("Error", "Error creating article");
100
100
  }
101
101
  });
@@ -112,26 +112,23 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
112
112
  }).show();
113
113
  }
114
114
  }
115
- })
116
- ;
115
+ });
117
116
 
117
+ // Attach Article
118
118
  items.push({
119
119
  text: 'Attach Article',
120
120
  iconCls: 'icon-copy',
121
121
  listeners: {
122
122
  'click': function () {
123
- Ext.widget('window', {
124
- layout: 'fit',
125
- width: 375,
123
+ var window = Ext.widget('window', {
124
+ modal: true,
126
125
  title: 'Attach Existing Article',
127
126
  plain: true,
128
127
  buttonAlign: 'center',
129
128
  items: {
130
129
  xtype: 'form',
131
- labelWidth: 75,
132
130
  frame: false,
133
131
  bodyStyle: 'padding:5px 5px 0',
134
- width: 425,
135
132
  url: '/knitkit/erp_app/desktop/articles/add_existing/' + sectionId,
136
133
  items: [
137
134
  {
@@ -139,8 +136,6 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
139
136
  xtype: 'combo',
140
137
  hiddenName: 'website_id',
141
138
  name: 'website_id',
142
- labelWidth: 50,
143
- width: 350,
144
139
  loadingText: 'Retrieving Websites...',
145
140
  store: Ext.create('Ext.data.Store', {
146
141
  autoLoad: true,
@@ -170,7 +165,7 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
170
165
  ],
171
166
  listeners: {
172
167
  'load': function (store) {
173
- available_articles_filter_combobox = Ext.ComponentQuery.query('#available_articles_filter_combobox')[0];
168
+ available_articles_filter_combobox = window.down('#available_articles_filter_combobox');
174
169
  available_articles_filter_combobox.select(0);
175
170
  available_articles_filter_combobox.fireEvent('select');
176
171
  }
@@ -187,12 +182,11 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
187
182
  allowBlank: false,
188
183
  listeners: {
189
184
  'select': function (combo, records) {
190
- available_articles_combobox = Ext.ComponentQuery.query('#available_articles_combobox')[0];
191
- available_articles_combobox.getPicker().setLoading(false);
185
+ available_articles_combobox = window.down('#available_articles_combobox');
192
186
  available_articles_combobox.getStore().load({
193
187
  params: {
194
188
  section_id: sectionId,
195
- website_id: Ext.ComponentQuery.query('#available_articles_filter_combobox')[0].getValue()
189
+ website_id: window.down('#available_articles_filter_combobox').getValue()
196
190
  }
197
191
  });
198
192
  }
@@ -203,8 +197,6 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
203
197
  itemId: 'available_articles_combobox',
204
198
  hiddenName: 'article_id',
205
199
  name: 'article_id',
206
- labelWidth: 50,
207
- width: 350,
208
200
  loadingText: 'Retrieving Articles...',
209
201
  store: Ext.create('Ext.data.Store', {
210
202
  autoLoad: false,
@@ -235,12 +227,14 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
235
227
  listeners: {
236
228
  'beforeload': function (store) {
237
229
  Ext.apply(store.getProxy().extraParams, {
238
- website_id: Ext.ComponentQuery.query('#available_articles_filter_combobox')[0].getValue()
230
+ website_id: window.down('#available_articles_filter_combobox').getValue()
239
231
  });
240
232
  },
241
233
  'load': function (store, records) {
242
- available_articles_combobox = Ext.ComponentQuery.query('#available_articles_combobox')[0];
243
- available_articles_combobox.setValue(store.getAt(0).data.id);
234
+ if (records.length > 0) {
235
+ available_articles_combobox = window.down('#available_articles_combobox');
236
+ available_articles_combobox.setValue(records.first().get('id'));
237
+ }
244
238
  }
245
239
  }
246
240
  }),
@@ -264,9 +258,13 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
264
258
  'click': function (button) {
265
259
  var window = button.findParentByType('window');
266
260
  var formPanel = window.query('form')[0];
261
+
262
+ var loadMask = new Ext.LoadMask(window, {msg: 'Please wait...'});
263
+
267
264
  formPanel.getForm().submit({
268
265
  reset: true,
269
266
  success: function (form, action) {
267
+ loadMask.hide();
270
268
  var obj = Ext.decode(action.response.responseText);
271
269
  if (obj.success) {
272
270
  obj.article.createdAt = obj.article.created_at;
@@ -280,6 +278,7 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
280
278
  }
281
279
  },
282
280
  failure: function (form, action) {
281
+ loadMask.hide();
283
282
  Ext.Msg.alert("Error", "Error Attaching article");
284
283
  }
285
284
  });
@@ -293,11 +292,13 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
293
292
  }
294
293
  }
295
294
  ]
296
- }).show();
295
+ });
296
+ window.show();
297
297
  }
298
298
  }
299
299
  });
300
300
 
301
+ // Update Security
301
302
  if (currentUser.hasCapability('unsecure', 'WebsiteSection') || currentUser.hasCapability('secure', 'WebsiteSection')) {
302
303
  items.push({
303
304
  text: 'Security',
@@ -311,34 +312,30 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
311
312
  });
312
313
  }
313
314
 
315
+ // Create Section
314
316
  if (currentUser.hasCapability('create', 'WebsiteSection') && !record.get('isBlog')) {
315
317
  items.push({
316
- text: 'Add Section',
318
+ text: 'Add Page',
317
319
  iconCls: 'icon-add',
318
320
  listeners: {
319
321
  'click': function () {
320
322
  Ext.widget("window", {
321
323
  modal: true,
322
- layout: 'fit',
323
- width: 375,
324
- title: 'New Section',
325
- plain: true,
324
+ title: 'New Page',
326
325
  buttonAlign: 'center',
326
+ defaultFocus: 'title',
327
327
  items: {
328
328
  xtype: 'form',
329
- labelWidth: 110,
330
329
  frame: false,
331
330
  bodyStyle: 'padding:5px 5px 0',
332
331
  url: '/knitkit/erp_app/desktop/section/new',
333
- defaults: {
334
- width: 225
335
- },
336
332
  items: [
337
333
  {
338
334
  xtype: 'textfield',
339
335
  fieldLabel: 'Title',
340
336
  allowBlank: false,
341
- name: 'title'
337
+ name: 'title',
338
+ itemId: 'title'
342
339
  },
343
340
  {
344
341
  xtype: 'textfield',
@@ -419,9 +416,12 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
419
416
  var window = button.findParentByType('window');
420
417
  var formPanel = window.query('.form')[0];
421
418
 
419
+ var loadMask = new Ext.LoadMask(window, {msg: 'Please wait...'});
420
+
422
421
  formPanel.getForm().submit({
423
422
  reset: true,
424
423
  success: function (form, action) {
424
+ loadMask.hide();
425
425
  var obj = Ext.decode(action.response.responseText);
426
426
  if (obj.success) {
427
427
  record.appendChild(obj.node);
@@ -432,13 +432,13 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
432
432
  }
433
433
  },
434
434
  failure: function (form, action) {
435
- //self.clearWindowStatus();
435
+ loadMask.hide();
436
436
  var obj = Ext.decode(action.response.responseText);
437
437
  if (obj.message) {
438
438
  Ext.Msg.alert("Error", obj.message);
439
439
  }
440
440
  else {
441
- Ext.Msg.alert("Error", "Error creating section.");
441
+ Ext.Msg.alert("Error", "Error creating page.");
442
442
  }
443
443
  }
444
444
  });
@@ -458,6 +458,7 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
458
458
  });
459
459
  }
460
460
 
461
+ // Edit Section
461
462
  if (currentUser.hasCapability('edit', 'WebsiteSection')) {
462
463
  items.push({
463
464
  text: 'Update ' + record.data["type"],
@@ -465,33 +466,24 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
465
466
  listeners: {
466
467
  'click': function () {
467
468
  Ext.widget("window", {
468
- layout: 'fit',
469
469
  modal: true,
470
- width: 375,
471
- title: 'Update Section',
472
- plain: true,
470
+ title: 'Update Page',
473
471
  buttonAlign: 'center',
474
472
  items: {
475
473
  xtype: 'form',
476
- labelWidth: 110,
477
474
  frame: false,
478
475
  bodyStyle: 'padding:5px 5px 0',
479
476
  url: '/knitkit/erp_app/desktop/section/update',
480
- defaults: {
481
- width: 375
482
- },
483
477
  items: [
484
478
  {
485
479
  xtype: 'textfield',
486
480
  fieldLabel: 'Title',
487
- width: 320,
488
481
  value: record.data.text,
489
482
  name: 'title'
490
483
  },
491
484
  {
492
485
  xtype: 'textfield',
493
486
  fieldLabel: 'Internal ID',
494
- width: 320,
495
487
  allowBlank: true,
496
488
  name: 'internal_identifier',
497
489
  value: record.data.internal_identifier
@@ -499,7 +491,6 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
499
491
  {
500
492
  xtype: 'radiogroup',
501
493
  fieldLabel: 'Display in menu?',
502
- width: 220,
503
494
  name: 'in_menu',
504
495
  columns: 2,
505
496
  items: [
@@ -521,7 +512,6 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
521
512
  {
522
513
  xtype: 'radiogroup',
523
514
  fieldLabel: 'Render with Base Layout?',
524
- width: 220,
525
515
  name: 'render_with_base_layout',
526
516
  columns: 2,
527
517
  items: [
@@ -543,7 +533,6 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
543
533
  {
544
534
  xtype: 'displayfield',
545
535
  fieldLabel: 'Path',
546
- width: 320,
547
536
  name: 'path',
548
537
  value: record.data.path
549
538
  },
@@ -561,10 +550,12 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
561
550
  'click': function (button) {
562
551
  var window = button.findParentByType('window');
563
552
  var formPanel = window.query('.form')[0];
564
- //self.setWindowStatus('Updating section...');
553
+
554
+ var loadMask = new Ext.LoadMask(window, {msg: 'Please wait...'});
555
+
565
556
  formPanel.getForm().submit({
566
557
  success: function (form, action) {
567
- //self.clearWindowStatus();
558
+ loadMask.hide();
568
559
  var values = formPanel.getValues();
569
560
  record.set('title', values.title);
570
561
  record.set('text', values.title);
@@ -575,7 +566,7 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
575
566
  window.close();
576
567
  },
577
568
  failure: function (form, action) {
578
- //self.clearWindowStatus();
569
+ loadMask.hide();
579
570
  var obj = Ext.decode(action.response.responseText);
580
571
  Ext.Msg.alert("Error", obj.msg);
581
572
  }
@@ -593,11 +584,11 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
593
584
  }).show();
594
585
  }
595
586
  }
596
- })
597
- ;
587
+ });
598
588
  }
599
589
 
600
- //no layouts for blogs.
590
+ // Edit / Update Layout
591
+ // no layouts for blogs.
601
592
  if (Compass.ErpApp.Utility.isBlank(record.data['isBlog']) && record.data['hasLayout']) {
602
593
  if (currentUser.hasCapability('edit', 'WebsiteSectionLayout')) {
603
594
  items.push({
@@ -647,13 +638,138 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
647
638
  }
648
639
  }
649
640
 
641
+ // Copy Section
642
+ items.push({
643
+ text: 'Copy ' + record.data["type"],
644
+ iconCls: 'icon-copy',
645
+ listeners: {
646
+ 'click': function () {
647
+ Ext.widget("window", {
648
+ modal: true,
649
+ title: 'Copy' + record.data["type"],
650
+ buttonAlign: 'center',
651
+ items: {
652
+ xtype: 'form',
653
+ frame: false,
654
+ bodyStyle: 'padding:5px 5px 0',
655
+ url: '/knitkit/erp_app/desktop/section/copy',
656
+ items: [
657
+ {
658
+ xtype: 'combo',
659
+ name: 'parent_section_id',
660
+ loadingText: 'Retrieving Pages...',
661
+ store: Ext.create("Ext.data.Store", {
662
+ proxy: {
663
+ type: 'ajax',
664
+ url: '/knitkit/erp_app/desktop/section/existing_sections',
665
+ reader: {
666
+ type: 'json'
667
+ },
668
+ extraParams: {
669
+ exclude_document_sections: true,
670
+ website_id: websiteId
671
+ }
672
+ },
673
+ autoLoad: true,
674
+ fields: [
675
+ {
676
+ name: 'id'
677
+ },
678
+ {
679
+ name: 'title_permalink'
680
+
681
+ }
682
+ ]
683
+ }),
684
+ forceSelection: true,
685
+ allowBlank: true,
686
+ fieldLabel: 'Parent Page',
687
+ mode: 'local',
688
+ displayField: 'title_permalink',
689
+ valueField: 'id',
690
+ triggerAction: 'all'
691
+ },
692
+ {
693
+ xtype: 'textfield',
694
+ fieldLabel: 'Title',
695
+ value: record.data.text,
696
+ name: 'title'
697
+ },
698
+ {
699
+ xtype: 'hidden',
700
+ name: 'id',
701
+ value: sectionId
702
+ },
703
+ {
704
+ xtype: 'hidden',
705
+ name: 'website_id',
706
+ value: websiteId
707
+ }
708
+ ]
709
+ },
710
+ buttons: [
711
+ {
712
+ text: 'Submit',
713
+ listeners: {
714
+ 'click': function (button) {
715
+ var window = button.findParentByType('window');
716
+ var formPanel = window.query('.form')[0];
717
+
718
+ var loadMask = new Ext.LoadMask(window, {msg: 'Copying page...'});
719
+
720
+ formPanel.getForm().submit({
721
+ success: function (form, action) {
722
+ var obj = Ext.decode(action.response.responseText);
723
+ var values = formPanel.getValues();
724
+ var parentNode = record.getOwnerTree().getRootNode();
725
+
726
+ loadMask.hide();
727
+
728
+ if (!Ext.isEmpty(values.parent_section_id)) {
729
+ parentNode = parentNode.findChildBy(function (node) {
730
+ if (node.get('recordType') == 'WebsiteSection'
731
+ && node.get('recordId') == values.parent_section_id) {
732
+ return true;
733
+ }
734
+ }, this, true);
735
+ }
736
+
737
+ if (parentNode && parentNode != record.getOwnerTree().getRootNode() && parentNode.isExpanded()) {
738
+ record.getOwnerTree().getStore().load({node: parentNode});
739
+ }
740
+
741
+ window.close();
742
+ },
743
+ failure: function (form, action) {
744
+ loadMask.hide();
745
+
746
+ var obj = Ext.decode(action.response.responseText);
747
+ Ext.Msg.alert("Error", obj.message);
748
+ }
749
+ });
750
+ }
751
+ }
752
+ },
753
+ {
754
+ text: 'Close',
755
+ handler: function (btn) {
756
+ btn.up('window').close();
757
+ }
758
+ }
759
+ ]
760
+ }).show();
761
+ }
762
+ }
763
+ });
764
+
765
+ // Delete Section
650
766
  if (currentUser.hasCapability('delete', 'WebsiteSection')) {
651
767
  items.push({
652
768
  text: 'Delete ' + record.data["type"],
653
769
  iconCls: 'icon-delete',
654
770
  listeners: {
655
771
  'click': function () {
656
- Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete this section?<br> NOTE: Articles belonging to this section will be orphaned.<br><br>', function (btn) {
772
+ Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete the page?<h3>' + record.data["text"] + '</h3> NOTE: Articles belonging to this page will be orphaned.<br><br>', function (btn) {
657
773
  if (btn == 'no') {
658
774
  return false;
659
775
  }
@@ -671,11 +787,11 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
671
787
  record.remove();
672
788
  }
673
789
  else {
674
- Ext.Msg.alert('Error', 'Error deleting section');
790
+ Ext.Msg.alert('Error', 'Error deleting page');
675
791
  }
676
792
  },
677
793
  failure: function (response) {
678
- Ext.Msg.alert('Error', 'Error deleting section');
794
+ Ext.Msg.alert('Error', 'Error deleting page');
679
795
  }
680
796
  });
681
797
  }
@@ -684,6 +800,6 @@ Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions = function (self,
684
800
  }
685
801
  });
686
802
  }
803
+
687
804
  return items;
688
- }
689
- ;
805
+ };