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
@@ -35,9 +35,15 @@ Ext.define('SiteContentsModel', {
35
35
  'parentItemId',
36
36
  'tag_list',
37
37
  // if an article is part of a blog then you can edit the excerpt
38
- 'canEditExcerpt',
39
- {name: 'createdAt', mapping: 'created_at', type: 'date'},
40
- {name: 'updatedAt', mapping: 'updated_at', type: 'date'}
38
+ 'canEditExcerpt', {
39
+ name: 'createdAt',
40
+ mapping: 'created_at',
41
+ type: 'date'
42
+ }, {
43
+ name: 'updatedAt',
44
+ mapping: 'updated_at',
45
+ type: 'date'
46
+ }
41
47
  ]
42
48
  });
43
49
 
@@ -57,7 +63,7 @@ var siteContentsStore = Ext.create('Ext.data.TreeStore', {
57
63
  expanded: true
58
64
  },
59
65
  listeners: {
60
- beforeexpand: function (node, eOpts) {
66
+ beforeexpand: function(node, eOpts) {
61
67
  if (!node.isRoot()) {
62
68
  var tree = node.getOwnerTree();
63
69
  tree.getStore().getProxy().setExtraParam('record_type', node.get('recordType'));
@@ -77,7 +83,7 @@ var viewConfigItems = {
77
83
  markDirty: false,
78
84
  plugins: pluginItems,
79
85
  listeners: {
80
- 'beforedrop': function (dom, data, overModel, dropPosition, dropHandlers, options) {
86
+ 'beforedrop': function(dom, data, overModel, dropPosition, dropHandlers, options) {
81
87
  var record = data.records.first();
82
88
 
83
89
  if (record.get('objectType') == 'Article') {
@@ -86,7 +92,7 @@ var viewConfigItems = {
86
92
  }
87
93
  }
88
94
  },
89
- 'drop': function (dom, data, overModel, dropPosition, options) {
95
+ 'drop': function(dom, data, overModel, dropPosition, options) {
90
96
  var positionArray = [],
91
97
  record = data.records.first(),
92
98
  result = true,
@@ -95,67 +101,59 @@ var viewConfigItems = {
95
101
  if (record.get('isSection') || record.get('isDocument')) {
96
102
  // if the record is modified and the parentId has changed we need to change
97
103
  // the section parent
98
- if (record.modified && record.modified.parentId) {
99
- Ext.Ajax.request({
100
- url: '/knitkit/erp_app/desktop/position/change_section_parent',
101
- method: 'PUT',
102
- params: {
103
- section_id: record.get('id').split('_')[1],
104
- parent_id: record.get('parentId').split('_')[1]
105
- },
106
- success: function (response) {
107
- var obj = Ext.decode(response.responseText);
108
- if (!obj.success) {
109
- Ext.Msg.alert("Error", obj.message);
110
- result = false;
111
- }
112
- },
113
- failure: function (response) {
114
- Ext.Msg.alert('Error', 'Error saving positions.');
115
- result = false;
116
- }
104
+ var parentNode = null;
105
+
106
+ if (dropPosition == 'append') {
107
+ positionArray.push({
108
+ id: record.get('recordId'),
109
+ parent_id: overModel.get('recordId'),
110
+ position: 0
117
111
  });
112
+
113
+ parentNode = overModel;
114
+ } else {
115
+ parentNode = overModel.parentNode;
118
116
  }
119
- else {
120
- overModel.parentNode.eachChild(function (node) {
121
- if (node.get('isSection') || record.get('isDocument')) {
122
- positionArray.push({
123
- id: node.data.id.split('_')[1],
124
- position: counter
125
- });
126
- counter++;
127
- }
128
- });
129
117
 
130
- Ext.Ajax.request({
131
- url: '/knitkit/erp_app/desktop/position/update_section_position',
132
- method: 'PUT',
133
- jsonData: {
134
- position_array: positionArray
135
- },
136
- success: function (response) {
137
- var obj = Ext.decode(response.responseText);
138
- if (!obj.success) {
139
- Ext.Msg.alert("Error", obj.message);
140
- result = false;
141
- }
142
- },
143
- failure: function (response) {
144
- Ext.Msg.alert('Error', 'Error saving positions.');
118
+ parentNode.eachChild(function(node) {
119
+ if (node.get('isSection') || record.get('isDocument')) {
120
+ positionArray.push({
121
+ id: node.get('recordId'),
122
+ parent_id: node.parentNode.get('recordId'),
123
+ position: counter
124
+ });
125
+
126
+ counter++;
127
+ }
128
+ });
129
+
130
+ Ext.Ajax.request({
131
+ url: '/knitkit/erp_app/desktop/position/update_section_position',
132
+ method: 'PUT',
133
+ jsonData: {
134
+ position_array: positionArray
135
+ },
136
+ success: function(response) {
137
+ var obj = Ext.decode(response.responseText);
138
+ if (!obj.success) {
139
+ Ext.Msg.alert("Error", obj.message);
145
140
  result = false;
146
141
  }
147
- });
148
- }
142
+ },
143
+ failure: function(response) {
144
+ Ext.Msg.alert('Error', 'Error saving positions.');
145
+ result = false;
146
+ }
147
+ });
149
148
  }
150
149
  // this is an article
151
150
  else {
152
151
  if (record.modified && record.modified.parentId) {
153
152
  result = false;
154
- }
155
- else {
156
- overModel.parentNode.eachChild(function (node) {
153
+ } else {
154
+ overModel.parentNode.eachChild(function(node) {
157
155
  positionArray.push({
158
- id: node.get('id'),
156
+ id: node.get('recordId'),
159
157
  position: counter
160
158
  });
161
159
  counter++;
@@ -168,16 +166,16 @@ var viewConfigItems = {
168
166
  position_array: positionArray
169
167
  },
170
168
  params: {
171
- section_id: record.parentNode.get('id').split('_')[1]
169
+ section_id: record.parentNode.get('recordId')
172
170
  },
173
- success: function (response) {
171
+ success: function(response) {
174
172
  var obj = Ext.decode(response.responseText);
175
173
  if (!obj.success) {
176
174
  Ext.Msg.alert("Error", obj.message);
177
175
  result = false;
178
176
  }
179
177
  },
180
- failure: function (response) {
178
+ failure: function(response) {
181
179
  Ext.Msg.alert('Error', 'Error saving positions.');
182
180
  result = false;
183
181
  }
@@ -202,7 +200,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.SiteContentsTreePanel", {
202
200
  store: siteContentsStore,
203
201
  enableDD: true,
204
202
 
205
- editSectionLayout: function (sectionName, sectionId, websiteId) {
203
+ editSectionLayout: function(sectionName, sectionId, websiteId) {
206
204
  var self = this;
207
205
 
208
206
  Ext.Ajax.request({
@@ -211,40 +209,37 @@ Ext.define("Compass.ErpApp.Desktop.Applications.SiteContentsTreePanel", {
211
209
  params: {
212
210
  id: sectionId
213
211
  },
214
- success: function (response) {
212
+ success: function(response) {
215
213
  self.initialConfig['centerRegion'].editSectionLayout(
216
214
  sectionName,
217
215
  websiteId,
218
216
  sectionId,
219
- response.responseText,
220
- [
221
- {
222
- text: 'Insert Content Area',
223
- handler: function (btn) {
224
- var codeMirror = btn.findParentByType('codemirror');
225
- Ext.MessageBox.prompt('New File', 'Please enter content area name:', function (btn, text) {
226
- if (btn == 'ok') {
227
- codeMirror.insertContent('<%=render_content_area(:' + text + ')%>');
228
- }
217
+ response.responseText, [{
218
+ text: 'Insert Content Area',
219
+ handler: function(btn) {
220
+ var codeMirror = btn.findParentByType('codemirror');
221
+ Ext.MessageBox.prompt('New File', 'Please enter content area name:', function(btn, text) {
222
+ if (btn == 'ok') {
223
+ codeMirror.insertContent('<%=render_content_area(:' + text + ')%>');
224
+ }
229
225
 
230
- });
231
- }
226
+ });
232
227
  }
233
- ]);
228
+ }]);
234
229
  },
235
- failure: function (response) {
230
+ failure: function(response) {
236
231
  Ext.Msg.alert('Error', 'Error loading section layout.');
237
232
  }
238
233
  });
239
234
  },
240
235
 
241
- clearWebsite: function () {
236
+ clearWebsite: function() {
242
237
  var store = this.getStore();
243
238
  store.getProxy().extraParams = {};
244
239
  store.load();
245
240
  },
246
241
 
247
- selectWebsite: function (website) {
242
+ selectWebsite: function(website) {
248
243
  var store = this.getStore();
249
244
  store.getProxy().extraParams = {
250
245
  website_id: website.id
@@ -253,51 +248,69 @@ Ext.define("Compass.ErpApp.Desktop.Applications.SiteContentsTreePanel", {
253
248
  },
254
249
 
255
250
  listeners: {
256
- 'itemclick': function (view, record, htmlItem, index, e) {
251
+ itemclick: function(view, record, htmlItem, index, e) {
252
+ var url = null;
257
253
  var self = this;
258
254
  e.stopEvent();
255
+
259
256
  if (record.data['isSection']) {
260
257
  self.initialConfig['centerRegion'].openIframeInTab(record.data.text, record.data['url']);
261
- }
262
- else if (record.data['objectType'] === "Article") {
263
- var url = '/knitkit/erp_app/desktop/articles/show/' + record.data.id;
258
+ } else if (record.data['objectType'] === "Article") {
259
+ url = '/knitkit/erp_app/desktop/articles/show/' + record.get('recordId');
264
260
 
265
261
  Ext.Ajax.request({
266
262
  url: url,
267
263
  method: 'GET',
268
264
  extraParams: {
269
- id: record.data.id
265
+ id: record.get('recordId')
270
266
  },
271
267
  timeout: 90000,
272
- success: function (response) {
268
+ success: function(response) {
273
269
  var article = Ext.decode(response.responseText);
274
- self.initialConfig['centerRegion'].editContent(record.data.text, record.data.id, article.body_html, record.data['siteId'], 'article');
270
+ self.initialConfig['centerRegion'].editContent(record.data.text, record.get('recordId'), article.body_html, record.data['siteId'], 'article');
271
+ },
272
+ failure: function() {
273
+ Ext.Msg.alert('Error', 'Could not load content');
275
274
  }
276
275
  });
277
- }
278
- else if (record.data['isDocument']) {
276
+ } else if (record.data['isDocument']) {
277
+ url = '/knitkit/erp_app/desktop/online_document_sections/' + record.get('recordId') + '/content/';
279
278
  var contentInfo = record.data['contentInfo'];
280
- if (record.data['useMarkdown']) {
281
- self.initialConfig['centerRegion'].editDocumentationMarkdown(
282
- contentInfo.title,
283
- record.data['siteId'],
284
- contentInfo.id,
285
- contentInfo.body_html,
286
- []
287
- );
288
- }
289
- else {
290
- self.initialConfig['centerRegion'].editContent(
291
- record.data['contentInfo'].title,
292
- record.data['contentInfo'].id,
293
- record.data['contentInfo'].body_html,
294
- record.data['siteId'],
295
- 'article'
296
- );
297
- }
279
+
280
+ Ext.Ajax.request({
281
+ url: url,
282
+ method: 'GET',
283
+ timeout: 90000,
284
+ success: function(response) {
285
+ var result = Ext.decode(response.responseText);
286
+ if (result.success) {
287
+ if (record.data['useMarkdown']) {
288
+ self.initialConfig['centerRegion'].editDocumentationMarkdown(
289
+ contentInfo.title,
290
+ record.data['siteId'],
291
+ contentInfo.id,
292
+ result.content, []
293
+ );
294
+ } else {
295
+ self.initialConfig['centerRegion'].editContent(
296
+ contentInfo.title,
297
+ contentInfo.id,
298
+ result.content,
299
+ record.data['siteId'],
300
+ 'article'
301
+ );
302
+ }
303
+ } else {
304
+ Ext.Msg.alert('Error', 'Could not load content');
305
+ }
306
+ },
307
+ failure: function() {
308
+ Ext.Msg.alert('Error', 'Could not load content');
309
+ }
310
+ });
298
311
  }
299
312
  },
300
- 'itemcontextmenu': function (view, record, htmlItem, index, e) {
313
+ itemcontextmenu: function(view, record, htmlItem, index, e) {
301
314
  e.stopEvent();
302
315
  var items = [];
303
316
 
@@ -306,7 +319,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.SiteContentsTreePanel", {
306
319
  text: 'View In Web Navigator',
307
320
  iconCls: 'icon-globe',
308
321
  listeners: {
309
- 'click': function () {
322
+ 'click': function() {
310
323
  var webNavigator = window.compassDesktop.getModule('web-navigator-win');
311
324
  webNavigator.createWindow(record.data['url']);
312
325
  }
@@ -337,24 +350,16 @@ Ext.define("Compass.ErpApp.Desktop.Applications.SiteContentsTreePanel", {
337
350
 
338
351
  if (record.data['isSection']) {
339
352
  items = Compass.ErpApp.Desktop.Applications.Knitkit.addSectionOptions(self, items, record);
340
- }
341
- else if (record.data['isWebsite']) {
353
+ } else if (record.data['isWebsite']) {
342
354
  items = Compass.ErpApp.Desktop.Applications.Knitkit.addWebsiteOptions(self, items, record);
343
355
  }
344
356
 
345
- if (items.length != 0) {
357
+ if (items.length !== 0) {
346
358
  var contextMenu = Ext.create("Ext.menu.Menu", {
347
359
  items: items
348
360
  });
349
361
  contextMenu.showAt(e.xy);
350
362
  }
351
363
  }
352
- },
353
-
354
- initComponent: function (config) {
355
- config = Ext.apply({
356
- }, config);
357
-
358
- this.callParent([config]);
359
364
  }
360
365
  });
@@ -22,6 +22,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.ThemesTreePanel", {
22
22
 
23
23
  Ext.create("Ext.window.Window", {
24
24
  layout: 'fit',
25
+ modal: true,
25
26
  width: 375,
26
27
  title: 'Theme Widget',
27
28
  plain: true,
@@ -171,8 +172,93 @@ Ext.define("Compass.ErpApp.Desktop.Applications.ThemesTreePanel", {
171
172
  });
172
173
  },
173
174
 
174
- deleteTheme: function (themeId) {
175
- var self = this;
175
+ showUpdateThemeForm: function(node){
176
+ Ext.create("Ext.window.Window", {
177
+ layout: 'fit',
178
+ modal: true,
179
+ title: 'Rename Theme',
180
+ width: 360,
181
+ plain: true,
182
+ buttonAlign: 'center',
183
+ defaultFocus: 'name',
184
+ items: Ext.create('widget.form', {
185
+ labelWidth: 110,
186
+ frame: false,
187
+ bodyStyle: 'padding:5px 5px 0',
188
+ fileUpload: true,
189
+ url: '/knitkit/erp_app/desktop/theme/update',
190
+ defaults: {
191
+ width: 320
192
+ },
193
+ items: [
194
+ {
195
+ xtype: 'hidden',
196
+ name: 'id',
197
+ value: node.get('id')
198
+ },
199
+ {
200
+ xtype: 'textfield',
201
+ fieldLabel: 'Name',
202
+ value: node.get('name'),
203
+ allowBlank: false,
204
+ name: 'name',
205
+ itemId: 'name'
206
+ }
207
+ ]
208
+ }),
209
+ buttons: [
210
+ {
211
+ text: 'Submit',
212
+ listeners: {
213
+ 'click': function (button) {
214
+ var window = button.findParentByType('window'),
215
+ formPanel = window.query('form')[0],
216
+
217
+ westRegion = Ext.ComponentQuery.query('#knitkitWestRegion').first(),
218
+ themesTreePanel = westRegion.down('#themesTreePanel');
219
+
220
+
221
+ var loading = new Ext.LoadMask(window, {msg: 'Please wait...'});
222
+ loading.show();
223
+
224
+ formPanel.getForm().submit({
225
+ reset: true,
226
+ timeout: 300000,
227
+ success: function (form, action) {
228
+ loading.hide();
229
+ window.close();
230
+
231
+ var obj = Ext.decode(action.response.responseText);
232
+ if (obj.success) {
233
+ // update node
234
+ node.set('name', obj.theme.name);
235
+ node.set('text', obj.theme.text);
236
+ node.commit();
237
+ }
238
+ },
239
+ failure: function (form, action) {
240
+ loading.hide();
241
+
242
+ Ext.Msg.alert("Error", "Error updating theme");
243
+ }
244
+ });
245
+ }
246
+ }
247
+ },
248
+ {
249
+ text: 'Close',
250
+ handler: function (btn) {
251
+ btn.up('window').close();
252
+ }
253
+ }
254
+ ]
255
+ }).show();
256
+ },
257
+
258
+ deleteTheme: function (theme) {
259
+ var self = this,
260
+ themeId = theme.get('id');
261
+
176
262
  self.initialConfig['centerRegion'].setWindowStatus('Deleting theme...');
177
263
  Ext.Ajax.request({
178
264
  url: '/knitkit/erp_app/desktop/theme/delete',
@@ -184,9 +270,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.ThemesTreePanel", {
184
270
  var obj = Ext.decode(response.responseText);
185
271
  if (obj.success) {
186
272
  self.initialConfig['centerRegion'].clearWindowStatus();
187
- self.getStore().load({
188
- node: self.getRootNode()
189
- });
273
+ theme.parentNode.removeChild(theme);
190
274
  }
191
275
  else {
192
276
  Ext.Msg.alert('Error', 'Error deleting theme');
@@ -226,6 +310,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.ThemesTreePanel", {
226
310
  fields: [
227
311
  'isTheme',
228
312
  'themeId',
313
+ 'name',
229
314
  'isActive',
230
315
  'siteId',
231
316
  'text',
@@ -238,9 +323,6 @@ Ext.define("Compass.ErpApp.Desktop.Applications.ThemesTreePanel", {
238
323
  scroll: 'vertical',
239
324
  //containerScroll: true,
240
325
  listeners: {
241
- 'load': function (store) {
242
- store.getRootNode().expandChildren();
243
- },
244
326
  'showImage': function (fileManager, node, themeId) {
245
327
  var themeId = null;
246
328
  var themeNode = node;
@@ -267,7 +349,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.ThemesTreePanel", {
267
349
  }
268
350
  self.initialConfig['centerRegion'].editTemplateFile(node, content, [], themeId);
269
351
  },
270
- 'handleContextMenu': function (fileManager, node, e) {
352
+ 'handleContextMenu': function (fileManager, node, item, index, e) {
271
353
  var items = [];
272
354
 
273
355
  if (node.isRoot()) {
@@ -307,12 +389,21 @@ Ext.define("Compass.ErpApp.Desktop.Applications.ThemesTreePanel", {
307
389
  return false;
308
390
  }
309
391
  else if (btn == 'yes') {
310
- self.deleteTheme(node.data.id);
392
+ self.deleteTheme(node);
311
393
  }
312
394
  });
313
395
  }
314
396
  }
315
397
  });
398
+ items.push({
399
+ text: 'Rename Theme',
400
+ iconCls: 'icon-edit',
401
+ listeners: {
402
+ 'click': function () {
403
+ self.showUpdateThemeForm(node);
404
+ }
405
+ }
406
+ });
316
407
  items.push({
317
408
  text: 'Export',
318
409
  iconCls: 'icon-document_out',