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,214 @@
1
+ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.CommentsGridPanel", {
2
+ extend: "Ext.grid.Panel",
3
+ alias: 'widget.knitkit_commentsgridpanel',
4
+
5
+ approve: function (rec) {
6
+ var self = this;
7
+ self.initialConfig['centerRegion'].setWindowStatus('Approving Comment...');
8
+ Ext.Ajax.request({
9
+ url: '/knitkit/erp_app/desktop/comments/approve',
10
+ method: 'POST',
11
+ params: {
12
+ id: rec.get("id")
13
+ },
14
+ success: function (response) {
15
+ var obj = Ext.decode(response.responseText);
16
+ if (obj.success) {
17
+ self.initialConfig['centerRegion'].clearWindowStatus();
18
+ self.getStore().load();
19
+ }
20
+ else {
21
+ Ext.Msg.alert('Error', 'Error approving comemnt');
22
+ self.initialConfig['centerRegion'].clearWindowStatus();
23
+ }
24
+ },
25
+ failure: function (response) {
26
+ self.initialConfig['centerRegion'].clearWindowStatus();
27
+ Ext.Msg.alert('Error', 'Error approving comemnt');
28
+ }
29
+ });
30
+
31
+
32
+ },
33
+
34
+ deleteComment: function (rec) {
35
+ var self = this;
36
+ self.initialConfig['centerRegion'].setWindowStatus('Deleting Comment...');
37
+ Ext.Ajax.request({
38
+ url: '/knitkit/erp_app/desktop/comments/delete',
39
+ method: 'POST',
40
+ params: {
41
+ id: rec.get("id")
42
+ },
43
+ success: function (response) {
44
+ var obj = Ext.decode(response.responseText);
45
+ if (obj.success) {
46
+ self.initialConfig['centerRegion'].clearWindowStatus();
47
+ self.getStore().load();
48
+ }
49
+ else {
50
+ Ext.Msg.alert('Error', 'Error deleting comemnt');
51
+ self.initialConfig['centerRegion'].clearWindowStatus();
52
+ }
53
+ },
54
+ failure: function (response) {
55
+ self.initialConfig['centerRegion'].clearWindowStatus();
56
+ Ext.Msg.alert('Error', 'Error deleting comemnt');
57
+ }
58
+ });
59
+ },
60
+
61
+ initComponent: function () {
62
+ this.callParent(arguments);
63
+ this.getStore().load();
64
+ },
65
+
66
+ constructor: function (config) {
67
+ var self = this;
68
+
69
+ var store = Ext.create('Ext.data.Store', {
70
+ proxy: {
71
+ type: 'ajax',
72
+ url: '/knitkit/erp_app/desktop/comments/index/' + config['contentId'],
73
+ reader: {
74
+ type: 'json',
75
+ root: 'comments'
76
+ }
77
+ },
78
+ remoteSort: true,
79
+ fields: [
80
+ {
81
+ name: 'id'
82
+ },
83
+ {
84
+ name: 'commentor_name'
85
+ },
86
+ {
87
+ name: 'email'
88
+ },
89
+ {
90
+ name: 'created_at'
91
+ },
92
+ {
93
+ name: 'approved?'
94
+ },
95
+ {
96
+ name: 'comment'
97
+ },
98
+ {
99
+ name: 'approved_by_username'
100
+ },
101
+ {
102
+ name: 'approved_at'
103
+ }
104
+ ]
105
+ });
106
+
107
+ config = Ext.apply({
108
+ store: store,
109
+ columns: [
110
+ {
111
+ header: 'Commentor',
112
+ sortable: true,
113
+ flex: 1,
114
+ dataIndex: 'commentor_name'
115
+ },
116
+ {
117
+ header: 'Email',
118
+ sortable: true,
119
+ flex: 1,
120
+ dataIndex: 'email'
121
+ },
122
+ {
123
+ header: 'Commented On',
124
+ dataIndex: 'created_at',
125
+ flex: 1,
126
+ sortable: true,
127
+ renderer: Ext.util.Format.dateRenderer('m/d/Y H:i:s')
128
+ },
129
+ {
130
+ menuDisabled: true,
131
+ resizable: false,
132
+ xtype: 'actioncolumn',
133
+ header: 'View',
134
+ align: 'center',
135
+ width: 50,
136
+ items: [{
137
+ icon: '/assets/icons/eye/eye_16x16.png',
138
+ tooltip: 'View',
139
+ handler: function (grid, rowIndex, colIndex) {
140
+ var rec = grid.getStore().getAt(rowIndex);
141
+ self.initialConfig['centerRegion'].showComment(rec.get('comment'));
142
+ }
143
+ }]
144
+ },
145
+ {
146
+ menuDisabled: true,
147
+ resizable: false,
148
+ xtype: 'actioncolumn',
149
+ header: 'Approve',
150
+ align: 'center',
151
+ width: 100,
152
+ items: [{
153
+ getClass: function (v, meta, rec) { // Or return a class from a function
154
+ if (rec.get('approved?')) {
155
+ this.items[0].tooltip = 'Approved';
156
+ return 'approved-col';
157
+ } else {
158
+ this.items[0].tooltip = 'Approve';
159
+ return 'approve-col';
160
+ }
161
+ },
162
+ handler: function (grid, rowIndex, colIndex) {
163
+ var rec = grid.getStore().getAt(rowIndex);
164
+ if (rec.get('approved?')) {
165
+ return false;
166
+ }
167
+ else {
168
+ self.approve(rec)
169
+ }
170
+ }
171
+ }]
172
+ },
173
+ {
174
+ header: 'Approved By',
175
+ sortable: true,
176
+ flex: 1,
177
+ dataIndex: 'approved_by_username'
178
+ },
179
+ {
180
+ header: 'Approved At',
181
+ sortable: true,
182
+ flex: 1,
183
+ dataIndex: 'approved_at',
184
+ renderer: Ext.util.Format.dateRenderer('m/d/Y H:i:s')
185
+ },
186
+ {
187
+ menuDisabled: true,
188
+ resizable: false,
189
+ xtype: 'actioncolumn',
190
+ header: 'Delete',
191
+ align: 'center',
192
+ width: 100,
193
+ items: [{
194
+ icon: '/assets/icons/delete/delete_16x16.png',
195
+ tooltip: 'Delete',
196
+ handler: function (grid, rowIndex, colIndex) {
197
+ var rec = grid.getStore().getAt(rowIndex);
198
+ self.deleteComment(rec);
199
+ }
200
+ }]
201
+ }
202
+ ],
203
+ bbar: Ext.create("Ext.PagingToolbar", {
204
+ pageSize: 10,
205
+ store: store,
206
+ displayInfo: true,
207
+ displayMsg: '{0} - {1} of {2}',
208
+ emptyMsg: "Empty"
209
+ })
210
+ }, config);
211
+
212
+ this.callParent([config]);
213
+ }
214
+ });
@@ -11,12 +11,16 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel", {
11
11
  this.changeSecurityOnFile = function (node, secure, model, websiteId) {
12
12
  var updateUrl = '/knitkit/erp_app/desktop/file_assets/' + model + '/update_security';
13
13
  Ext.Ajax.request({
14
- url: '/knitkit/erp_app/desktop/available_roles',
15
- method: 'POST',
14
+ url: '/api/v1/security_roles',
15
+ method: 'GET',
16
+ params:{
17
+ parent: 'website_builder',
18
+ include_admin: true
19
+ },
16
20
  success: function (response) {
17
21
  var obj = Ext.decode(response.responseText);
18
22
  if (obj.success) {
19
- Ext.create('widget.knikit_selectroleswindow', {
23
+ Ext.create('widget.selectroleswindow', {
20
24
  baseParams: {
21
25
  path: node.get('id'),
22
26
  website_id: websiteId
@@ -144,12 +148,12 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel", {
144
148
  e.stopEvent();
145
149
  return false;
146
150
  },
147
- 'fileDeleted': function (fileTreePanel, node) {
151
+ 'filedeleted': function (fileTreePanel, node) {
148
152
  },
149
- 'fileUploaded': function (fileTreePanel, node) {
153
+ 'fileuploaded': function (fileTreePanel, node) {
150
154
  },
151
155
  'downloadfile': function (fileTreePanel, node) {
152
- window.open("/download/" + node.data.text + "?path=" + node.data.downloadPath, 'mywindow', 'width=400,height=200');
156
+ window.open("/download/" + node.data.text + "?path=" + node.data.downloadPath + '&disposition=attachment', 'mywindow', 'width=400,height=200');
153
157
  return false;
154
158
  }
155
159
  }
@@ -239,22 +243,16 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel", {
239
243
  store.getRootNode().data.text = self.websiteName;
240
244
  self.websiteFileAssetsTreePanel.view.refresh();
241
245
  },
242
- 'show': function (panel) {
243
- // workaround for extJS rendering bug. tree tries to load faster than extjs can render, wait X ms
244
- setTimeout(function () {
245
- self.reloadWebsiteFileAssetsTreePanel(self.websiteId);
246
- }, 100);
247
- },
248
246
  'itemclick': function (view, record, item, index, e) {
249
247
  e.stopEvent();
250
248
  return false;
251
249
  },
252
- 'fileDeleted': function (fileTreePanel, node) {
250
+ 'filedeleted': function (fileTreePanel, node) {
253
251
  },
254
- 'fileUploaded': function (fileTreePanel, node) {
252
+ 'fileuploaded': function (fileTreePanel, node) {
255
253
  },
256
254
  'downloadfile': function (fileTreePanel, node) {
257
- window.open("/download/" + node.data.text + "?path=" + node.data.downloadPath, 'mywindow', 'width=400,height=200');
255
+ window.open("/download/" + node.data.text + "?path=" + node.data.downloadPath + '&disposition=attachment', 'mywindow', 'width=400,height=200');
258
256
  return false;
259
257
  }
260
258
  }
@@ -310,14 +308,14 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.FileAssetsPanel", {
310
308
 
311
309
  var items = [];
312
310
 
313
- if (currentUser.hasCapability('view', 'GlobalFileAsset')) {
314
- items.push(this.sharedFileAssetsTreePanel);
315
- }
316
-
317
311
  if (currentUser.hasCapability('view', 'SiteFileAsset')) {
318
312
  items.push(this.websiteFileAssetsTreePanel);
319
313
  }
320
314
 
315
+ if (currentUser.hasCapability('view', 'GlobalFileAsset')) {
316
+ items.push(this.sharedFileAssetsTreePanel);
317
+ }
318
+
321
319
  config = Ext.apply({
322
320
  deferredRender: false,
323
321
  layout: 'fit',
@@ -3,6 +3,11 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsDataView", {
3
3
  alias: 'widget.knitkit_imageassetsdataview',
4
4
  directory: null,
5
5
  websiteId: null,
6
+
7
+ setPath: function (path) {
8
+ this.title.update('Path: ' + path);
9
+ },
10
+
6
11
  constructor: function (config) {
7
12
  var self = this;
8
13
 
@@ -16,7 +21,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsDataView", {
16
21
 
17
22
  Compass.ErpApp.Utility.addEventHandler(viewElement.dom, 'dragover', function (e) {
18
23
  viewElement.setStyle('border', 'solid 1px red');
19
- e.preventDefault()
24
+ e.preventDefault();
20
25
  });
21
26
  Compass.ErpApp.Utility.addEventHandler(viewElement.dom, 'dragenter', function () {
22
27
  viewElement.setStyle('border', 'solid 1px red');
@@ -52,10 +57,11 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsDataView", {
52
57
  if (resultObj.success) {
53
58
  store.load({
54
59
  params: {
60
+ website_id: self.websiteId,
55
61
  directory: self.directory
56
62
  }
57
63
  });
58
- self.fireEvent('imageuploaded', self);
64
+ self.fireEvent('imageuploaded', self, resultObj.node);
59
65
  }
60
66
  else {
61
67
  Ext.Msg.alert('Error', 'Could not upload image');
@@ -85,7 +91,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsDataView", {
85
91
 
86
92
  var contextMenu = Ext.create("Ext.menu.Menu", {
87
93
  items: [
88
- {
94
+ {
89
95
  text: 'Insert Image At Cursor',
90
96
  iconCls: 'icon-add',
91
97
  handler: function () {
@@ -106,6 +112,10 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsDataView", {
106
112
  autoDestroy: true,
107
113
  style: 'overflow:auto',
108
114
  itemSelector: 'div.thumb-wrap',
115
+ renderTpl: [
116
+ '<div id="{id}-title">{title}</div>'
117
+ ],
118
+ childEls: ["title"],
109
119
  store: Ext.create('Ext.data.Store', {
110
120
  proxy: {
111
121
  type: 'ajax',
@@ -13,23 +13,19 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel", {
13
13
  uploadUrl: '/knitkit/erp_app/desktop/image_assets/shared/upload_file',
14
14
  module: config.module,
15
15
  listeners: {
16
- afterrender: function () {
17
- if (currentUser.hasCapability('view', 'GlobalImageAsset')) {
18
- self.sharedImageAssetsDataView.directory = 'root_node';
19
- var store = self.sharedImageAssetsDataView.getStore();
20
- store.load({
21
- params: {
22
- directory: 'root_node'
23
- }
24
- });
16
+ imageuploaded: function (comp, node) {
17
+ var record = self.sharedImageAssetsTreePanel.selectedDirectoryNode;
18
+
19
+ if (!record.isExpanded() && !record.isLoaded()) {
20
+ record.expand();
25
21
  }
26
- },
27
- imageuploaded: function (comp) {
28
- self.sharedImageAssetsTreePanel.getStore().load({
29
- callback: function () {
30
- self.sharedImageAssetsTreePanel.getView().refresh();
22
+ else {
23
+ record.appendChild(node);
24
+
25
+ if (!record.isExpanded()) {
26
+ record.expand();
31
27
  }
32
- });
28
+ }
33
29
  }
34
30
  }
35
31
  });
@@ -38,18 +34,19 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel", {
38
34
  url: '/knitkit/erp_app/desktop/image_assets/website/get_images',
39
35
  uploadUrl: '/knitkit/erp_app/desktop/image_assets/website/upload_file',
40
36
  listeners: {
41
- imageuploaded: function (comp) {
42
- var store = self.websiteImageAssetsTreePanel.getStore();
43
- store.load({
44
- callback: function () {
45
- self.websiteImageAssetsDataView.getStore().load({
46
- params: {
47
- directory: 'root_node',
48
- website_id: self.websiteId
49
- }
50
- });
37
+ imageuploaded: function (comp, node) {
38
+ var record = self.websiteImageAssetsTreePanel.selectedDirectoryNode;
39
+
40
+ if (!record.isExpanded() && !record.isLoaded()) {
41
+ record.expand();
42
+ }
43
+ else {
44
+ record.appendChild(node);
45
+
46
+ if (!record.isExpanded()) {
47
+ record.expand();
51
48
  }
52
- });
49
+ }
53
50
  }
54
51
  }
55
52
  });
@@ -98,6 +95,8 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel", {
98
95
  'itemclick': function (view, record, item, index, e) {
99
96
  e.stopEvent();
100
97
  if (!record.data["leaf"]) {
98
+ this.selectedDirectoryNode = record;
99
+ self.sharedImageAssetsDataView.setPath(record.getPath('text'));
101
100
  self.sharedImageAssetsDataView.directory = record.data.id;
102
101
  var store = self.sharedImageAssetsDataView.getStore();
103
102
  store.load({
@@ -110,17 +109,15 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel", {
110
109
  return false;
111
110
  }
112
111
  },
113
- 'fileDeleted': function (fileTreePanel, node) {
114
- var store = self.sharedImageAssetsDataView.getStore();
115
- store.load({
112
+ 'filedeleted': function (fileTreePanel, node) {
113
+ self.sharedImageAssetsDataView.getStore().load({
116
114
  params: {
117
115
  directory: node.parentNode.data.id
118
116
  }
119
117
  });
120
118
  },
121
- 'fileUploaded': function (fileTreePanel, node) {
122
- var store = self.sharedImageAssetsDataView.getStore();
123
- store.load({
119
+ 'fileuploaded': function (fileTreePanel, node) {
120
+ self.sharedImageAssetsDataView.getStore().load({
124
121
  params: {
125
122
  directory: node.data.id
126
123
  }
@@ -177,6 +174,8 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel", {
177
174
  if (self.websiteId !== null) {
178
175
  e.stopEvent();
179
176
  if (!record.data["leaf"]) {
177
+ this.selectedDirectoryNode = record;
178
+ self.websiteImageAssetsDataView.setPath(record.getPath('text'));
180
179
  self.websiteImageAssetsDataView.directory = record.data.id;
181
180
  self.websiteImageAssetsDataView.websiteId = self.websiteId;
182
181
  var store = self.websiteImageAssetsDataView.getStore();
@@ -192,15 +191,15 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel", {
192
191
  }
193
192
  }
194
193
  },
195
- 'fileDeleted': function (fileTreePanel, node) {
194
+ 'filedeleted': function (fileTreePanel, node) {
196
195
  self.websiteImageAssetsDataView.getStore().load({
197
196
  params: {
198
- directory: node.parentNode.data.downloadPath,
197
+ directory: node.parentNode.data.id,
199
198
  website_id: self.websiteId
200
199
  }
201
200
  });
202
201
  },
203
- 'fileUploaded': function (fileTreePanel, node) {
202
+ 'fileuploaded': function (fileTreePanel, node) {
204
203
  self.websiteImageAssetsDataView.getStore().load({
205
204
  params: {
206
205
  directory: node.data.id,
@@ -241,13 +240,7 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel", {
241
240
  autoRender: true,
242
241
  layout: 'border',
243
242
  title: 'Website',
244
- items: [this.websiteImageAssetsTreePanel, websiteImagesPanel],
245
- listeners: {
246
- scope: self,
247
- 'show': function (panel) {
248
- self.reloadWebsiteImageAssetsTreePanel(self.websiteId);
249
- }
250
- }
243
+ items: [this.websiteImageAssetsTreePanel, websiteImagesPanel]
251
244
  });
252
245
 
253
246
  this.selectWebsite = function (website) {
@@ -287,10 +280,12 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel", {
287
280
  });
288
281
 
289
282
  if (websiteId) {
290
- while (delNode = this.websiteImageAssetsTreePanel.getRootNode().childNodes[0]) {
291
- this.websiteImageAssetsTreePanel.getRootNode().removeChild(delNode);
283
+ var rootNode = this.websiteImageAssetsTreePanel.getRootNode();
284
+
285
+ while (delNode = rootNode.childNodes[0]) {
286
+ rootNode.removeChild(delNode);
292
287
  }
293
- this.websiteImageAssetsTreePanel.getRootNode().expand();
288
+ rootNode.expand();
294
289
 
295
290
  if (!this.websiteImageAssetsTreePanel.getStore().isLoading()) {
296
291
  this.websiteImageAssetsTreePanel.getStore().load();
@@ -300,6 +295,10 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel", {
300
295
  params: {
301
296
  directory: 'root_node',
302
297
  website_id: websiteId
298
+ },
299
+ callback: function () {
300
+ self.websiteImageAssetsTreePanel.selectedDirectoryNode = rootNode;
301
+ self.websiteImageAssetsDataView.setPath('/' + rootNode.data.text);
303
302
  }
304
303
  });
305
304
  }
@@ -307,14 +306,15 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel", {
307
306
  };
308
307
 
309
308
  var items = [];
310
- if (currentUser.hasCapability('view', 'GlobalImageAsset')) {
311
- items.push(sharedImagesLayout);
312
- }
313
309
 
314
310
  if (currentUser.hasCapability('view', 'SiteImageAsset')) {
315
311
  items.push(websiteImagesLayout);
316
312
  }
317
313
 
314
+ if (currentUser.hasCapability('view', 'GlobalImageAsset')) {
315
+ items.push(sharedImagesLayout);
316
+ }
317
+
318
318
  config = Ext.apply({
319
319
  deferredRender: false,
320
320
  layout: 'fit',
@@ -325,6 +325,17 @@ Ext.define("Compass.ErpApp.Desktop.Applications.Knitkit.ImageAssetsPanel", {
325
325
  afterrender: function (panel) {
326
326
  // workaround for extJS rendering bug. set activetab 1 above and 0 afterrender
327
327
  panel.setActiveTab(0);
328
+
329
+ // load shared assets
330
+ var rootNode = panel.sharedImageAssetsTreePanel.getRootNode();
331
+ panel.sharedImageAssetsTreePanel.selectedDirectoryNode = rootNode;
332
+ panel.sharedImageAssetsDataView.setPath(rootNode.getPath('text'));
333
+ panel.sharedImageAssetsDataView.directory = rootNode.data.id;
334
+ panel.sharedImageAssetsDataView.getStore().load({
335
+ params: {
336
+ directory: rootNode.data.id
337
+ }
338
+ });
328
339
  }
329
340
  }
330
341
  }, config);