knitkit 2.1.15 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/app/controllers/knitkit/base_controller.rb +1 -1
- data/app/controllers/knitkit/comments_controller.rb +7 -2
- data/app/controllers/knitkit/erp_app/desktop/app_controller.rb +78 -98
- data/app/controllers/knitkit/erp_app/desktop/articles_controller.rb +65 -45
- data/app/controllers/knitkit/erp_app/desktop/content_controller.rb +22 -12
- data/app/controllers/knitkit/erp_app/desktop/file_assets_controller.rb +1 -1
- data/app/controllers/knitkit/erp_app/desktop/image_assets_controller.rb +28 -16
- data/app/controllers/knitkit/erp_app/desktop/inquiries_controller.rb +15 -49
- data/app/controllers/knitkit/erp_app/desktop/online_document_sections_controller.rb +4 -3
- data/app/controllers/knitkit/erp_app/desktop/position_controller.rb +69 -11
- data/app/controllers/knitkit/erp_app/desktop/theme_controller.rb +63 -60
- data/app/controllers/knitkit/erp_app/desktop/website_controller.rb +98 -82
- data/app/controllers/knitkit/erp_app/desktop/website_host_controller.rb +77 -0
- data/app/controllers/knitkit/erp_app/desktop/website_nav_controller.rb +64 -44
- data/app/controllers/knitkit/erp_app/desktop/website_nav_item_controller.rb +147 -0
- data/app/controllers/knitkit/erp_app/desktop/website_section_controller.rb +81 -45
- data/app/controllers/knitkit/mobile_controller.rb +15 -0
- data/app/controllers/knitkit/online_document_sections_controller.rb +2 -1
- data/app/controllers/knitkit/unauthorized_controller.rb +0 -1
- data/app/controllers/knitkit/website_sections_controller.rb +7 -4
- data/app/mailers/website_inquiry_mailer.rb +8 -7
- data/app/models/content.rb +11 -2
- data/app/models/document.rb +2 -17
- data/app/models/published_website.rb +96 -59
- data/app/models/theme.rb +100 -14
- data/app/models/website.rb +260 -28
- data/app/models/website_inquiry.rb +5 -12
- data/app/models/website_section.rb +9 -1
- data/app/views/knitkit/blogs/_add_comment.html.erb +44 -23
- data/app/views/knitkit/blogs/_comment.html.erb +4 -6
- data/app/views/knitkit/blogs/index.html.erb +63 -49
- data/app/views/knitkit/blogs/show.html.erb +17 -12
- data/app/views/knitkit/mobile/index.html.erb +162 -0
- data/app/views/knitkit/online_document_sections/index.html.erb +7 -5
- data/app/views/knitkit/unauthorized/index.html.erb +8 -4
- data/app/views/knitkit/website_sections/index.html.erb +8 -4
- data/app/views/layouts/knitkit/base.html.erb +79 -63
- data/app/views/layouts/knitkit/online_document_sections.html.erb +74 -52
- data/app/views/menus/knitkit/_default_menu.html.erb +4 -4
- data/app/views/menus/knitkit/_default_section_menu.html.erb +22 -23
- data/app/views/shared/knitkit/_bread_crumb.html.erb +10 -7
- data/app/views/shared/knitkit/_footer.html.erb +2 -2
- data/app/views/website_inquiry_mailer/inquiry.erb +23 -2
- data/app/widgets/contact_us/base.rb +25 -50
- data/app/widgets/contact_us/javascript/contact_us.js +7 -7
- data/app/widgets/contact_us/views/error.html.erb +6 -8
- data/app/widgets/contact_us/views/index.html.erb +28 -1
- data/app/widgets/contact_us/views/layouts/base.html.erb +9 -6
- data/app/widgets/contact_us/views/success.html.erb +3 -3
- data/app/widgets/google_map/views/index.html.erb +36 -36
- data/app/widgets/login/base.rb +1 -0
- data/app/widgets/login/javascript/login.js +3 -3
- data/app/widgets/login/views/index.html.erb +46 -26
- data/app/widgets/login/views/layouts/base.html.erb +15 -13
- data/app/widgets/login/views/login_header.html.erb +7 -9
- data/app/widgets/manage_profile/base.rb +116 -164
- data/app/widgets/manage_profile/views/_address.html.erb +184 -0
- data/app/widgets/manage_profile/views/_contact_information_form.html.erb +23 -192
- data/app/widgets/manage_profile/views/_email_address.html.erb +163 -0
- data/app/widgets/manage_profile/views/_password_form.html.erb +23 -20
- data/app/widgets/manage_profile/views/_phone_number.html.erb +165 -0
- data/app/widgets/manage_profile/views/_user_information_form.html.erb +49 -33
- data/app/widgets/manage_profile/views/error.html.erb +6 -0
- data/app/widgets/manage_profile/views/index.html.erb +44 -46
- data/app/widgets/manage_profile/views/layouts/base.html.erb +3 -1
- data/app/widgets/manage_profile/views/success.html.erb +5 -0
- data/app/widgets/reset_password/views/index.html.erb +33 -28
- data/app/widgets/reset_password/views/layouts/base.html.erb +10 -1
- data/app/widgets/search/base.rb +37 -25
- data/app/widgets/search/views/_inline_search_form.html.erb +12 -0
- data/app/widgets/search/views/_search_form.html.erb +41 -0
- data/app/widgets/search/views/index.html.erb +5 -3
- data/app/widgets/search/views/layouts/base.html.erb +13 -23
- data/app/widgets/search/views/show.html.erb +32 -47
- data/app/widgets/signup/base.rb +1 -1
- data/app/widgets/signup/javascript/signup.js +7 -9
- data/app/widgets/signup/views/_signup_form.html.erb +34 -29
- data/app/widgets/signup/views/error.html.erb +11 -11
- data/app/widgets/signup/views/index.html.erb +3 -2
- data/app/widgets/signup/views/layouts/base.html.erb +8 -5
- data/app/widgets/signup/views/success.html.erb +5 -4
- data/config/routes.rb +39 -28
- data/db/data_migrations/20120809020508_update_website_and_configuration.rb +3 -0
- data/db/migrate/20110211002317_setup_knitkit.rb +0 -1
- data/db/migrate/20131112013052_add_knitkit_missing_indexes.rb +33 -0
- data/db/migrate/20140622212723_update_website_inquiries.rb +22 -0
- data/db/migrate/20140911185022_add_publishing_to_website.rb +5 -0
- data/db/migrate/20141013073349_add_custom_fields_to_documents.rb +12 -0
- data/db/migrate/20141016101936_upgrade_remove_dynamic_attributes.rb +13 -0
- data/lib/knitkit.rb +0 -1
- data/lib/knitkit/engine.rb +1 -0
- data/lib/knitkit/extensions.rb +4 -0
- data/lib/knitkit/extensions/active_record/acts_as_commentable.rb +33 -0
- data/lib/knitkit/extensions/active_record/acts_as_document.rb +0 -12
- data/lib/knitkit/extensions/active_record/acts_as_publishable.rb +7 -10
- data/lib/knitkit/extensions/compass_ae/widgets/base.rb +2 -4
- data/lib/knitkit/extensions/compass_ae/widgets/widget_proxy_controller.rb +4 -1
- data/lib/knitkit/extensions/railties/action_view/helpers/blog_helper.rb +16 -13
- data/lib/knitkit/extensions/railties/action_view/helpers/content_helper.rb +10 -8
- data/lib/knitkit/extensions/railties/theme_support/asset_tag_helper.rb +123 -108
- data/lib/knitkit/extensions/will_paginate/link_renderer.rb +67 -0
- data/lib/knitkit/routing_filter/section_router.rb +10 -8
- data/lib/knitkit/syntax_validator.rb +2 -2
- data/lib/knitkit/version.rb +7 -3
- data/public/images/inline_edit/close.png +0 -0
- data/public/images/knitkit/close_window.png +0 -0
- data/public/images/knitkit/logo.png +0 -0
- data/public/images/knitkit/splash/images/add-site.png +0 -0
- data/public/images/knitkit/splash/images/adjust-site.png +0 -0
- data/public/images/knitkit/splash/images/browse-site.png +0 -0
- data/public/images/knitkit/splash/images/find-themes.png +0 -0
- data/public/images/knitkit/splash/images/settings.png +0 -0
- data/public/images/knitkit/splash/images/tutorials.png +0 -0
- data/public/images/knitkit/splash/splash.png +0 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/articles_grid_panel.js +656 -627
- data/public/javascripts/erp_app/desktop/applications/knitkit/center_region.js +444 -333
- data/public/javascripts/erp_app/desktop/applications/knitkit/{east_region.js → east_region/east_region.js} +33 -33
- data/public/javascripts/erp_app/desktop/applications/knitkit/east_region/file_assets_panel.js +332 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/east_region/image_assets_data_view.js +144 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/east_region/image_assets_panel.js +335 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/{widgets_panel.js → east_region/widgets_panel.js} +55 -55
- data/public/javascripts/erp_app/desktop/applications/knitkit/inquiries_grid_panel.js +150 -37
- data/public/javascripts/erp_app/desktop/applications/knitkit/module.js +228 -96
- data/public/javascripts/erp_app/desktop/applications/knitkit/publish_window.js +89 -85
- data/public/javascripts/erp_app/desktop/applications/knitkit/published_grid_panel.js +238 -217
- data/public/javascripts/erp_app/desktop/applications/knitkit/select_roles_window.js +59 -54
- data/public/javascripts/erp_app/desktop/applications/knitkit/splash_screen.js +170 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/top_menu/main_menu.js +1168 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/top_menu/websites_combo.js +71 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/versions_grid_panel.js +301 -306
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/article.js +216 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/document.js +182 -153
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/host.js +48 -65
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/menu.js +93 -94
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/section.js +523 -197
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/website_nav_items.js +20 -34
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/hosts_tree_panel.js +74 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/menu_tree_panel.js +245 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/site_contents_tree_panel.js +360 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/themes_tree_panel.js +348 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/west_region.js +106 -1132
- data/public/javascripts/knitkit/bootstrap-datepicker.js +474 -0
- data/public/javascripts/knitkit/bootstrap.min.js +7 -0
- data/public/javascripts/knitkit/confirm-bootstrap.js +110 -0
- data/public/javascripts/knitkit/inline_editing.js +73 -50
- data/public/javascripts/knitkit/jquery.maskedinput.min.js +7 -0
- data/public/javascripts/knitkit/mobile/app/view/Main.js +108 -0
- data/public/javascripts/knitkit/mobile/ux/slidenavigation/View.js +734 -0
- data/public/javascripts/knitkit/theme.js +76 -0
- data/public/stylesheets/erp_app/desktop/applications/knitkit/knitkit.css +95 -35
- data/public/stylesheets/knitkit/bootstrap-responsive.min.css +10 -0
- data/public/stylesheets/knitkit/bootstrap.min.css +7 -0
- data/public/stylesheets/knitkit/custom.css +122 -0
- data/public/stylesheets/knitkit/datepicker.css +182 -0
- data/public/stylesheets/knitkit/inline_editing.css +58 -58
- data/spec/controllers/knitkit/erp_app/desktop/website_section_controller_spec.rb +1 -1
- data/spec/dummy/config/application.rb +1 -1
- data/spec/models/article_spec.rb +3 -3
- data/spec/models/content_spec.rb +9 -9
- data/spec/models/website_spec.rb +1 -1
- metadata +100 -114
- data/app/helpers/application_helper.rb +0 -134
- data/app/views/knitkit/articles/index.html.erb +0 -3
- data/app/views/knitkit/articles/show.html.erb +0 -4
- data/app/views/menus/knitkit/_default_sub_menu.html.erb +0 -43
- data/app/views/menus/knitkit/_default_sub_section_menu.html.erb +0 -47
- data/app/widgets/contact_us/views/_contact_form.html.erb +0 -36
- data/app/widgets/dynamic_forms/base.rb +0 -139
- data/app/widgets/dynamic_forms/javascript/dynamic_forms.js +0 -110
- data/app/widgets/dynamic_forms/views/error.html.erb +0 -5
- data/app/widgets/dynamic_forms/views/index.html.erb +0 -8
- data/app/widgets/dynamic_forms/views/success.html.erb +0 -4
- data/app/widgets/dynamic_grid/base.rb +0 -130
- data/app/widgets/dynamic_grid/helpers/controller/dynamic_grid_controller_helper.rb +0 -3
- data/app/widgets/dynamic_grid/helpers/view/dynamic_grid_view_helper.rb +0 -3
- data/app/widgets/dynamic_grid/javascript/dynamic_grid.js +0 -177
- data/app/widgets/dynamic_grid/views/index.html.erb +0 -14
- data/app/widgets/login/views/reset_password.html.erb +0 -26
- data/app/widgets/manage_profile/views/default_type_error.html.erb +0 -5
- data/app/widgets/scaffold/base.rb +0 -87
- data/app/widgets/scaffold/helpers/controller/scaffold_controller_helper.rb +0 -3
- data/app/widgets/scaffold/helpers/view/scaffold_view_helper.rb +0 -3
- data/app/widgets/scaffold/javascript/scaffold.js +0 -337
- data/app/widgets/scaffold/views/index.html.erb +0 -15
- data/app/widgets/search/views/_search.html.erb +0 -39
- data/public/images/knitkit/bullet.png +0 -0
- data/public/images/knitkit/close.png +0 -0
- data/public/images/knitkit/content.png +0 -0
- data/public/images/knitkit/footer.png +0 -0
- data/public/images/knitkit/graphic.png +0 -0
- data/public/images/knitkit/greyFadeDown.png +0 -0
- data/public/images/knitkit/link.png +0 -0
- data/public/images/knitkit/menu.png +0 -0
- data/public/images/knitkit/menu_select.png +0 -0
- data/public/images/knitkit/search.png +0 -0
- data/public/images/knitkit/tooltip.gif +0 -0
- data/public/javascripts/ajax_pagination.js +0 -33
- data/public/javascripts/datepicker.js +0 -445
- data/public/javascripts/erp_app/desktop/applications/knitkit/file_assets_panel.js +0 -341
- data/public/javascripts/erp_app/desktop/applications/knitkit/image_assets_data_view.js +0 -31
- data/public/javascripts/erp_app/desktop/applications/knitkit/image_assets_panel.js +0 -263
- data/public/javascripts/erp_app/desktop/applications/knitkit/section_articles_grid_panel.js +0 -722
- data/public/javascripts/erp_app/desktop/applications/knitkit/themes_tree_panel.js +0 -585
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/website.js +0 -155
- data/public/javascripts/knitkit/helpers.js +0 -26
- data/public/stylesheets/datepicker.css +0 -121
- data/public/stylesheets/extjs/resources/css/knitkit_extjs_4.css +0 -233
- data/public/stylesheets/knitkit/style.css +0 -426
|
@@ -12,15 +12,20 @@ module Knitkit
|
|
|
12
12
|
content = Content.find(id)
|
|
13
13
|
content.body_html = html
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
#TODO this should probably be moved into the view
|
|
16
|
+
if content.altered?
|
|
17
|
+
if content.save
|
|
18
|
+
unless params[:site_id].blank?
|
|
19
|
+
website = Website.find(params[:site_id])
|
|
20
|
+
content.publish(website, 'Auto Publish', content.version, current_user) if website.publish_on_save?
|
|
21
|
+
end
|
|
22
|
+
#added for inline editing
|
|
23
|
+
result[:last_update] = content.updated_at.strftime("%m/%d/%Y %I:%M%p")
|
|
24
|
+
else
|
|
25
|
+
result = {:success => false}
|
|
19
26
|
end
|
|
20
|
-
#added for inline editing
|
|
21
|
-
result[:last_update] = content.updated_at.strftime("%m/%d/%Y %I:%M%p")
|
|
22
27
|
else
|
|
23
|
-
result = {:success =>
|
|
28
|
+
result = {:success => true}
|
|
24
29
|
end
|
|
25
30
|
|
|
26
31
|
render :json => result
|
|
@@ -39,13 +44,18 @@ module Knitkit
|
|
|
39
44
|
content = Content.find(id)
|
|
40
45
|
content.excerpt_html = html
|
|
41
46
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
#TODO this should probably be moved into the view
|
|
48
|
+
if content.altered?
|
|
49
|
+
if content.save
|
|
50
|
+
unless params[:site_id].blank?
|
|
51
|
+
website = Website.find(params[:site_id])
|
|
52
|
+
content.publish(website, 'Auto Publish', content.version, current_user) if website.publish_on_save?
|
|
53
|
+
end
|
|
54
|
+
else
|
|
55
|
+
result = {:success => false}
|
|
46
56
|
end
|
|
47
57
|
else
|
|
48
|
-
result = {:success =>
|
|
58
|
+
result = {:success => true}
|
|
49
59
|
end
|
|
50
60
|
|
|
51
61
|
render :json => result
|
|
@@ -66,7 +66,7 @@ module Knitkit
|
|
|
66
66
|
begin
|
|
67
67
|
upload_path == 'root_node' ? @assets_model.add_file(data, File.join(base_path,name)) : @assets_model.add_file(data, File.join(@file_support.root,upload_path,name))
|
|
68
68
|
result = {:success => true}
|
|
69
|
-
rescue
|
|
69
|
+
rescue => ex
|
|
70
70
|
logger.error ex.message
|
|
71
71
|
logger.error ex.backtrace.join("\n")
|
|
72
72
|
result = {:success => false, :error => "Error uploading file."}
|
|
@@ -2,11 +2,17 @@ module Knitkit
|
|
|
2
2
|
module ErpApp
|
|
3
3
|
module Desktop
|
|
4
4
|
class ImageAssetsController < FileAssetsController
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
def get_images
|
|
7
7
|
directory = (params[:directory] == 'root_node' or params[:directory].blank?) ? base_path : params[:directory]
|
|
8
8
|
# this @assets_model.images.select should be refactored into a query
|
|
9
|
-
render :json => @assets_model.images.select{|image| image.directory == directory.sub(@file_support.root,'')}.collect{|image|{:
|
|
9
|
+
render :json => @assets_model.images.select { |image| image.directory == directory.sub(@file_support.root, '') }.collect { |image| {:id => image.id,
|
|
10
|
+
:name => image.name,
|
|
11
|
+
:shortName => image.name[0..15],
|
|
12
|
+
:url => image.data.url,
|
|
13
|
+
:height => image.height,
|
|
14
|
+
:width => image.width,
|
|
15
|
+
:downloadPath => image.data.path} }
|
|
10
16
|
end
|
|
11
17
|
|
|
12
18
|
def upload_file
|
|
@@ -19,7 +25,6 @@ module Knitkit
|
|
|
19
25
|
capability_resource = "GlobalImageAsset"
|
|
20
26
|
end
|
|
21
27
|
|
|
22
|
-
model = DesktopApplication.find_by_internal_identifier('knitkit')
|
|
23
28
|
begin
|
|
24
29
|
current_user.with_capability(capability_type, capability_resource) do
|
|
25
30
|
result = {}
|
|
@@ -27,10 +32,18 @@ module Knitkit
|
|
|
27
32
|
name = params[:name]
|
|
28
33
|
data = request.raw_post
|
|
29
34
|
|
|
35
|
+
if params[:is_drag_drop]
|
|
36
|
+
data = Base64.decode64(data.split(',').last)
|
|
37
|
+
end
|
|
38
|
+
|
|
30
39
|
begin
|
|
31
|
-
upload_path == 'root_node'
|
|
32
|
-
|
|
33
|
-
|
|
40
|
+
file_asset = if upload_path == 'root_node'
|
|
41
|
+
@assets_model.add_file(data, File.join(base_path, name))
|
|
42
|
+
else
|
|
43
|
+
@assets_model.add_file(data, File.join(@file_support.root, upload_path, name))
|
|
44
|
+
end
|
|
45
|
+
result = {:success => true, :url => file_asset.data.url}
|
|
46
|
+
rescue => ex
|
|
34
47
|
logger.error ex.message
|
|
35
48
|
logger.error ex.backtrace.join("\n")
|
|
36
49
|
result = {:success => false, :error => "Error uploading file."}
|
|
@@ -39,7 +52,7 @@ module Knitkit
|
|
|
39
52
|
#the awesome uploader widget whats this to mime type text, leave it render :inline
|
|
40
53
|
render :inline => result.to_json
|
|
41
54
|
end
|
|
42
|
-
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability=>ex
|
|
55
|
+
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
|
43
56
|
render :json => {:success => false, :message => ex.message}
|
|
44
57
|
end
|
|
45
58
|
end
|
|
@@ -57,7 +70,6 @@ module Knitkit
|
|
|
57
70
|
|
|
58
71
|
nodes_to_delete = (params[:selected_nodes] ? JSON(params[:selected_nodes]) : [params[:node]])
|
|
59
72
|
|
|
60
|
-
model = DesktopApplication.find_by_internal_identifier('knitkit')
|
|
61
73
|
begin
|
|
62
74
|
result = false
|
|
63
75
|
nodes_to_delete.each do |path|
|
|
@@ -65,13 +77,13 @@ module Knitkit
|
|
|
65
77
|
path = "#{path}/" if params[:leaf] == 'false' and path.match(/\/$/).nil?
|
|
66
78
|
begin
|
|
67
79
|
name = File.basename(path)
|
|
68
|
-
result, message, is_folder = @file_support.delete_file(File.join(@file_support.root,path))
|
|
80
|
+
result, message, is_folder = @file_support.delete_file(File.join(@file_support.root, path))
|
|
69
81
|
if result and !is_folder
|
|
70
82
|
file = @assets_model.files.find(:first, :conditions => ['name = ? and directory = ?', ::File.basename(path), ::File.dirname(path)])
|
|
71
83
|
file.destroy
|
|
72
84
|
end
|
|
73
85
|
messages << message
|
|
74
|
-
rescue Exception=>ex
|
|
86
|
+
rescue Exception => ex
|
|
75
87
|
Rails.logger.error ex.message
|
|
76
88
|
Rails.logger.error ex.backtrace.join("\n")
|
|
77
89
|
render :json => {:success => false, :error => "Error deleting #{name}"} and return
|
|
@@ -83,7 +95,7 @@ module Knitkit
|
|
|
83
95
|
else
|
|
84
96
|
render :json => {:success => false, :error => messages.join(',')}
|
|
85
97
|
end
|
|
86
|
-
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability=>ex
|
|
98
|
+
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
|
87
99
|
render :json => {:success => false, :message => ex.message}
|
|
88
100
|
end
|
|
89
101
|
end
|
|
@@ -105,8 +117,8 @@ module Knitkit
|
|
|
105
117
|
def set_file_support
|
|
106
118
|
@file_support = ErpTechSvcs::FileSupport::Base.new(:storage => Rails.application.config.erp_tech_svcs.file_storage)
|
|
107
119
|
end
|
|
108
|
-
|
|
109
|
-
end#ImageAssetsController
|
|
110
|
-
end#Desktop
|
|
111
|
-
end#ErpApp
|
|
112
|
-
end#Knitkit
|
|
120
|
+
|
|
121
|
+
end #ImageAssetsController
|
|
122
|
+
end #Desktop
|
|
123
|
+
end #ErpApp
|
|
124
|
+
end #Knitkit
|
|
@@ -3,66 +3,32 @@ module Knitkit
|
|
|
3
3
|
module Desktop
|
|
4
4
|
class InquiriesController < Knitkit::ErpApp::Desktop::AppController
|
|
5
5
|
|
|
6
|
-
def
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
columns = []
|
|
11
|
-
definition.each do |field_hash|
|
|
12
|
-
field_hash['width'] = 120
|
|
13
|
-
columns << DynamicGridColumn.build_column(field_hash)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
columns << DynamicGridColumn.build_column({ :fieldLabel => "Username", :name => 'username', :xtype => 'textfield' })
|
|
17
|
-
columns << DynamicGridColumn.build_column({ :fieldLabel => "Created At", :name => 'created_at', :xtype => 'datefield', :width => 75 })
|
|
18
|
-
columns << DynamicGridColumn.build_view_column("Ext.getCmp('knitkitCenterRegion').showComment(rec.get('message'));")
|
|
19
|
-
columns << DynamicGridColumn.build_delete_column("Ext.getCmp('InquiriesGridPanel').deleteInquiry(rec);")
|
|
20
|
-
|
|
21
|
-
definition << DynamicFormField.textfield({ :fieldLabel => "Username", :name => 'username' })
|
|
22
|
-
definition << DynamicFormField.datefield({ :fieldLabel => "Created At", :name => 'created_at' })
|
|
23
|
-
definition << DynamicFormField.hidden({ :fieldLabel => "ID", :name => 'id' })
|
|
24
|
-
|
|
25
|
-
result = "{
|
|
26
|
-
\"success\": true,
|
|
27
|
-
\"model\": \"WebsiteInquiry\",
|
|
28
|
-
\"validations\": \"[]\",
|
|
29
|
-
\"columns\": [#{columns.join(',')}],
|
|
30
|
-
\"fields\": #{definition.to_json}
|
|
31
|
-
}"
|
|
32
|
-
|
|
33
|
-
render :inline => result
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def get
|
|
37
|
-
WebsiteInquiry.include_root_in_json = false
|
|
6
|
+
def index
|
|
7
|
+
limit = params[:limit] || 15
|
|
8
|
+
offset = params[:start] || 0
|
|
38
9
|
|
|
39
10
|
website = Website.find(params[:website_id])
|
|
40
11
|
sort_hash = params[:sort].blank? ? {} : Hash.symbolize_keys(JSON.parse(params[:sort]).first)
|
|
41
12
|
sort = sort_hash[:property] || 'created_at'
|
|
42
|
-
dir
|
|
13
|
+
dir = sort_hash[:direction] || 'DESC'
|
|
43
14
|
|
|
44
|
-
|
|
15
|
+
total = website.website_inquiries.count
|
|
45
16
|
|
|
46
|
-
|
|
47
|
-
website_inquiries.each do |i|
|
|
48
|
-
wihash = i.data.dynamic_attributes_without_prefix
|
|
17
|
+
inquiries = website.website_inquiries.limit(limit).offset(offset).order("#{sort} #{dir}")
|
|
49
18
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
render :inline => "{ total:#{website_inquiries.total_entries}, data:#{wi.to_json} }"
|
|
19
|
+
render :json => {:success => true, :total => total, :inquiries => inquiries.collect { |inquiry|
|
|
20
|
+
inquiry.to_hash(:only => [:id, :first_name, :last_name, :message, :email, :created_at],
|
|
21
|
+
:username => (inquiry.created_by.nil? ? '' : inquiry.created_by.username)) }
|
|
22
|
+
}
|
|
57
23
|
end
|
|
58
24
|
|
|
59
|
-
def
|
|
25
|
+
def destroy
|
|
60
26
|
website_inquiry = WebsiteInquiry.find(params[:id])
|
|
61
27
|
website_inquiry.destroy
|
|
62
28
|
render :json => {:success => true}
|
|
63
29
|
end
|
|
64
30
|
|
|
65
|
-
end#InquiriesController
|
|
66
|
-
end#Desktop
|
|
67
|
-
end#ErpApp
|
|
68
|
-
end#Knitkit
|
|
31
|
+
end #InquiriesController
|
|
32
|
+
end #Desktop
|
|
33
|
+
end #ErpApp
|
|
34
|
+
end #Knitkit
|
|
@@ -4,8 +4,9 @@ module Knitkit
|
|
|
4
4
|
class OnlineDocumentSectionsController < Knitkit::ErpApp::Desktop::AppController
|
|
5
5
|
|
|
6
6
|
def new
|
|
7
|
-
website = Website.find(params[:website_id])
|
|
8
|
-
online_document_section = OnlineDocumentSection.new(:website_id => website.id,
|
|
7
|
+
@website = Website.find(params[:website_id])
|
|
8
|
+
online_document_section = OnlineDocumentSection.new(:website_id => @website.id,
|
|
9
|
+
:in_menu => params[:in_menu] == 'yes', :title => params[:title],
|
|
9
10
|
:internal_identifier => params[:internal_identifier])
|
|
10
11
|
|
|
11
12
|
if online_document_section.save
|
|
@@ -19,7 +20,7 @@ module Knitkit
|
|
|
19
20
|
DocumentedItem.create(:documented_content_id => documented_content.id, :online_document_section_id => online_document_section.id)
|
|
20
21
|
end
|
|
21
22
|
|
|
22
|
-
result = {:success => true, :node => build_section_hash(online_document_section
|
|
23
|
+
result = {:success => true, :node => build_section_hash(online_document_section),
|
|
23
24
|
:documented_content => documented_content.content_hash}
|
|
24
25
|
else
|
|
25
26
|
message = "<ul>"
|
|
@@ -2,28 +2,86 @@ module Knitkit
|
|
|
2
2
|
module ErpApp
|
|
3
3
|
module Desktop
|
|
4
4
|
class PositionController < Knitkit::ErpApp::Desktop::AppController
|
|
5
|
-
|
|
6
|
-
def
|
|
7
|
-
|
|
5
|
+
|
|
6
|
+
def change_section_parent
|
|
7
|
+
begin
|
|
8
|
+
current_user.with_capability('drag_item', 'WebsiteTree') do
|
|
9
|
+
|
|
10
|
+
new_parent = WebsiteSection.where('id = ?', params[:parent_id]).first
|
|
11
|
+
website_section = WebsiteSection.find(params[:section_id])
|
|
12
|
+
|
|
13
|
+
if new_parent
|
|
14
|
+
website_section.move_to_child_of(new_parent)
|
|
15
|
+
else
|
|
16
|
+
website_section.move_to_root
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
render :json => {:success => true}
|
|
20
|
+
|
|
21
|
+
end
|
|
22
|
+
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
|
23
|
+
render :json => {:success => false, :message => ex.message}
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def update_section_position
|
|
8
28
|
begin
|
|
9
29
|
current_user.with_capability('drag_item', 'WebsiteTree') do
|
|
10
30
|
|
|
11
31
|
params[:position_array].each do |position|
|
|
12
|
-
model =
|
|
32
|
+
model = WebsiteSection.find(position['id'])
|
|
13
33
|
model.position = position['position'].to_i
|
|
14
34
|
model.save
|
|
15
35
|
end
|
|
16
36
|
|
|
17
37
|
render :json => {:success => true}
|
|
18
|
-
|
|
38
|
+
|
|
19
39
|
end
|
|
20
|
-
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability=>ex
|
|
40
|
+
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
|
21
41
|
render :json => {:success => false, :message => ex.message}
|
|
22
42
|
end
|
|
23
43
|
end
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
44
|
+
|
|
45
|
+
def update_menu_item_position
|
|
46
|
+
begin
|
|
47
|
+
current_user.with_capability('drag_item', 'WebsiteTree') do
|
|
48
|
+
|
|
49
|
+
params[:position_array].each do |position|
|
|
50
|
+
model = WebsiteNavItem.find(position['id'])
|
|
51
|
+
model.position = position['position'].to_i
|
|
52
|
+
model.save
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
render :json => {:success => true}
|
|
56
|
+
|
|
57
|
+
end
|
|
58
|
+
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
|
59
|
+
render :json => {:success => false, :message => ex.message}
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def update_article_position
|
|
64
|
+
begin
|
|
65
|
+
current_user.with_capability('drag_item', 'WebsiteTree') do
|
|
66
|
+
|
|
67
|
+
website_section = WebsiteSection.find(params[:section_id])
|
|
68
|
+
|
|
69
|
+
params[:position_array].each do |position|
|
|
70
|
+
model = website_section.website_section_contents.where('content_id = ?', position['id']).first
|
|
71
|
+
model.position = position['position'].to_i
|
|
72
|
+
model.save
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
render :json => {:success => true}
|
|
76
|
+
|
|
77
|
+
end
|
|
78
|
+
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
|
79
|
+
render :json => {:success => false, :message => ex.message}
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
end #PositionController
|
|
84
|
+
end #Desktop
|
|
85
|
+
end #ErpApp
|
|
86
|
+
end #Knitkit
|
|
29
87
|
|
|
@@ -3,7 +3,7 @@ module Knitkit
|
|
|
3
3
|
module Desktop
|
|
4
4
|
class ThemeController < ::ErpApp::Desktop::FileManager::BaseController
|
|
5
5
|
before_filter :set_file_support
|
|
6
|
-
before_filter :set_website, :only => [:new, :change_status, :available_themes]
|
|
6
|
+
before_filter :set_website, :only => [:index, :new, :change_status, :available_themes]
|
|
7
7
|
before_filter :set_theme, :only => [:delete, :change_status, :theme_widget, :available_widgets]
|
|
8
8
|
IGNORED_PARAMS = %w{action controller node_id theme_data}
|
|
9
9
|
|
|
@@ -21,11 +21,13 @@ module Knitkit
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def available_themes
|
|
24
|
-
render :json => {:success => true,
|
|
24
|
+
render :json => {:success => true,
|
|
25
|
+
:themes => @website.themes.map { |theme| {:id => theme.id, :name => theme.name} }}
|
|
25
26
|
end
|
|
26
27
|
|
|
27
28
|
def available_widgets
|
|
28
|
-
render :json => {:success => true,
|
|
29
|
+
render :json => {:success => true,
|
|
30
|
+
:widgets => @theme.non_themed_widgets.map { |widget| {:id => widget, :name => widget.humanize} }}
|
|
29
31
|
end
|
|
30
32
|
|
|
31
33
|
def theme_widget
|
|
@@ -40,17 +42,17 @@ module Knitkit
|
|
|
40
42
|
Theme.import(params[:theme_data], @website)
|
|
41
43
|
else
|
|
42
44
|
theme = Theme.create(:website => @website, :name => params[:name], :theme_id => params[:theme_id])
|
|
43
|
-
theme.version
|
|
44
|
-
theme.author
|
|
45
|
+
theme.version = params[:version]
|
|
46
|
+
theme.author = params[:author]
|
|
45
47
|
theme.homepage = params[:homepage]
|
|
46
|
-
theme.summary
|
|
48
|
+
theme.summary = params[:summary]
|
|
47
49
|
theme.save
|
|
48
50
|
theme.create_theme_files!
|
|
49
51
|
end
|
|
50
52
|
|
|
51
53
|
render :inline => {:success => true}.to_json
|
|
52
54
|
end
|
|
53
|
-
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability=>ex
|
|
55
|
+
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
|
54
56
|
render :json => {:success => false, :message => ex.message}
|
|
55
57
|
end
|
|
56
58
|
end
|
|
@@ -61,10 +63,10 @@ module Knitkit
|
|
|
61
63
|
if @theme.destroy
|
|
62
64
|
render :json => {:success => true}
|
|
63
65
|
else
|
|
64
|
-
render :json =>
|
|
66
|
+
render :json => {:success => false}
|
|
65
67
|
end
|
|
66
68
|
end
|
|
67
|
-
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability=>ex
|
|
69
|
+
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
|
68
70
|
render :json => {:success => false, :message => ex.message}
|
|
69
71
|
end
|
|
70
72
|
end
|
|
@@ -84,7 +86,7 @@ module Knitkit
|
|
|
84
86
|
|
|
85
87
|
render :json => {:success => true}
|
|
86
88
|
end
|
|
87
|
-
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability=>ex
|
|
89
|
+
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
|
88
90
|
render :json => {:success => false, :message => ex.message}
|
|
89
91
|
end
|
|
90
92
|
end
|
|
@@ -98,7 +100,7 @@ module Knitkit
|
|
|
98
100
|
def create_file
|
|
99
101
|
begin
|
|
100
102
|
current_user.with_capability('view', 'Theme') do
|
|
101
|
-
path = File.join(@file_support.root,params[:path])
|
|
103
|
+
path = File.join(@file_support.root, params[:path])
|
|
102
104
|
name = params[:name]
|
|
103
105
|
|
|
104
106
|
theme = get_theme(path)
|
|
@@ -106,7 +108,7 @@ module Knitkit
|
|
|
106
108
|
|
|
107
109
|
render :json => {:success => true}
|
|
108
110
|
end
|
|
109
|
-
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability=>ex
|
|
111
|
+
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
|
110
112
|
render :json => {:success => false, :message => ex.message}
|
|
111
113
|
end
|
|
112
114
|
end
|
|
@@ -114,13 +116,13 @@ module Knitkit
|
|
|
114
116
|
def create_folder
|
|
115
117
|
begin
|
|
116
118
|
current_user.with_capability('view', 'Theme') do
|
|
117
|
-
path = File.join(@file_support.root,params[:path])
|
|
119
|
+
path = File.join(@file_support.root, params[:path])
|
|
118
120
|
name = params[:name]
|
|
119
121
|
|
|
120
122
|
@file_support.create_folder(path, name)
|
|
121
123
|
render :json => {:success => true}
|
|
122
124
|
end
|
|
123
|
-
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability=>ex
|
|
125
|
+
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
|
124
126
|
render :json => {:success => false, :message => ex.message}
|
|
125
127
|
end
|
|
126
128
|
end
|
|
@@ -128,7 +130,7 @@ module Knitkit
|
|
|
128
130
|
def update_file
|
|
129
131
|
begin
|
|
130
132
|
current_user.with_capability('view', 'Theme') do
|
|
131
|
-
path = File.join(@file_support.root,params[:node])
|
|
133
|
+
path = File.join(@file_support.root, params[:node])
|
|
132
134
|
content = params[:content]
|
|
133
135
|
|
|
134
136
|
type = File.extname(File.basename(path)).gsub(/^\.+/, '').to_sym
|
|
@@ -141,18 +143,18 @@ module Knitkit
|
|
|
141
143
|
render :json => {:success => false, :message => result}
|
|
142
144
|
end
|
|
143
145
|
end
|
|
144
|
-
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability=>ex
|
|
146
|
+
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
|
145
147
|
render :json => {:success => false, :message => ex.message}
|
|
146
148
|
end
|
|
147
149
|
end
|
|
148
150
|
|
|
149
151
|
def save_move
|
|
150
|
-
result
|
|
152
|
+
result = {}
|
|
151
153
|
nodes_to_move = (params[:selected_nodes] ? JSON(params[:selected_nodes]) : [params[:node]])
|
|
152
154
|
begin
|
|
153
155
|
nodes_to_move.each do |node|
|
|
154
156
|
current_user.with_capability('view', 'Theme') do
|
|
155
|
-
path
|
|
157
|
+
path = File.join(@file_support.root, node)
|
|
156
158
|
new_parent_path = File.join(@file_support.root, params[:parent_node])
|
|
157
159
|
|
|
158
160
|
unless @file_support.exists? path
|
|
@@ -165,7 +167,7 @@ module Knitkit
|
|
|
165
167
|
end
|
|
166
168
|
end
|
|
167
169
|
render :json => result
|
|
168
|
-
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability=>ex
|
|
170
|
+
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
|
169
171
|
render :json => {:success => false, :message => ex.message}
|
|
170
172
|
end
|
|
171
173
|
end
|
|
@@ -173,18 +175,18 @@ module Knitkit
|
|
|
173
175
|
def download_file
|
|
174
176
|
begin
|
|
175
177
|
current_user.with_capability('view', 'Theme') do
|
|
176
|
-
path = File.join(@file_support.root,params[:path])
|
|
178
|
+
path = File.join(@file_support.root, params[:path])
|
|
177
179
|
contents, message = @file_support.get_contents(path)
|
|
178
180
|
|
|
179
181
|
send_data contents, :filename => File.basename(path)
|
|
180
182
|
end
|
|
181
|
-
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability=>ex
|
|
183
|
+
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
|
182
184
|
render :json => {:success => false, :message => ex.message}
|
|
183
185
|
end
|
|
184
186
|
end
|
|
185
187
|
|
|
186
188
|
def get_contents
|
|
187
|
-
path = File.join(@file_support.root,params[:node])
|
|
189
|
+
path = File.join(@file_support.root, params[:node])
|
|
188
190
|
contents, message = @file_support.get_contents(path)
|
|
189
191
|
|
|
190
192
|
if contents.nil?
|
|
@@ -208,7 +210,7 @@ module Knitkit
|
|
|
208
210
|
begin
|
|
209
211
|
theme.add_file(data, name)
|
|
210
212
|
result = {:success => true}
|
|
211
|
-
rescue
|
|
213
|
+
rescue => ex
|
|
212
214
|
logger.error ex.message
|
|
213
215
|
logger.error ex.backtrace.join("\n")
|
|
214
216
|
result = {:success => false, :error => "Error uploading #{name}"}
|
|
@@ -216,7 +218,7 @@ module Knitkit
|
|
|
216
218
|
|
|
217
219
|
render :inline => result.to_json
|
|
218
220
|
end
|
|
219
|
-
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability=>ex
|
|
221
|
+
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
|
220
222
|
render :json => {:success => false, :message => ex.message}
|
|
221
223
|
end
|
|
222
224
|
end
|
|
@@ -227,16 +229,16 @@ module Knitkit
|
|
|
227
229
|
begin
|
|
228
230
|
result = false
|
|
229
231
|
nodes_to_delete.each do |path|
|
|
230
|
-
current_user.with_capability('view', 'Theme') do
|
|
232
|
+
current_user.with_capability('view', 'Theme') do
|
|
231
233
|
begin
|
|
232
234
|
name = File.basename(path)
|
|
233
|
-
result, message, is_folder = @file_support.delete_file(File.join(@file_support.root,path))
|
|
235
|
+
result, message, is_folder = @file_support.delete_file(File.join(@file_support.root, path))
|
|
234
236
|
if result && !is_folder
|
|
235
237
|
theme_file = get_theme_file(path)
|
|
236
238
|
theme_file.destroy
|
|
237
239
|
end
|
|
238
240
|
messages << message
|
|
239
|
-
rescue Exception=>ex
|
|
241
|
+
rescue Exception => ex
|
|
240
242
|
Rails.logger.error ex.message
|
|
241
243
|
Rails.logger.error ex.backtrace.join("\n")
|
|
242
244
|
render :json => {:success => false, :error => "Error deleting #{name}"} and return
|
|
@@ -248,7 +250,7 @@ module Knitkit
|
|
|
248
250
|
else
|
|
249
251
|
render :json => {:success => false, :error => messages.join(',')}
|
|
250
252
|
end
|
|
251
|
-
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability=>ex
|
|
253
|
+
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
|
252
254
|
render :json => {:success => false, :message => ex.message}
|
|
253
255
|
end
|
|
254
256
|
end
|
|
@@ -267,9 +269,9 @@ module Knitkit
|
|
|
267
269
|
theme_file.save
|
|
268
270
|
end
|
|
269
271
|
|
|
270
|
-
render :json =>
|
|
272
|
+
render :json => {:success => true, :message => message}
|
|
271
273
|
end
|
|
272
|
-
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability=>ex
|
|
274
|
+
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
|
273
275
|
render :json => {:success => false, :message => ex.message}
|
|
274
276
|
end
|
|
275
277
|
end
|
|
@@ -291,9 +293,9 @@ module Knitkit
|
|
|
291
293
|
|
|
292
294
|
def get_theme(path)
|
|
293
295
|
sites_index = path.index('sites')
|
|
294
|
-
sites_path
|
|
295
|
-
site_name
|
|
296
|
-
site
|
|
296
|
+
sites_path = path[sites_index..path.length]
|
|
297
|
+
site_name = sites_path.split('/')[1]
|
|
298
|
+
site = Website.find_by_internal_identifier(site_name)
|
|
297
299
|
|
|
298
300
|
themes_index = path.index('themes')
|
|
299
301
|
path = path[themes_index..path.length]
|
|
@@ -311,43 +313,38 @@ module Knitkit
|
|
|
311
313
|
|
|
312
314
|
def setup_tree
|
|
313
315
|
tree = []
|
|
314
|
-
sites = Website.all
|
|
315
|
-
sites.each do |site|
|
|
316
|
-
site_hash = {
|
|
317
|
-
:text => site.name,
|
|
318
|
-
:browseable => true,
|
|
319
|
-
:contextMenuDisabled => true,
|
|
320
|
-
:iconCls => 'icon-globe',
|
|
321
|
-
:id => "site_#{site.id}",
|
|
322
|
-
:leaf => false,
|
|
323
|
-
:children => []
|
|
324
|
-
}
|
|
325
316
|
|
|
317
|
+
if @website
|
|
326
318
|
#handle themes
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
319
|
+
@website.themes.each do |theme|
|
|
320
|
+
theme_hash = {:text => "#{theme.name}[#{theme.theme_id}]", :handleContextMenu => true,
|
|
321
|
+
:siteId => @website.id, :isActive => (theme.active == 1), :iconCls => 'icon-content',
|
|
322
|
+
:isTheme => true, :id => theme.id, :children => []}
|
|
323
|
+
|
|
330
324
|
if theme.active == 1
|
|
331
325
|
theme_hash[:iconCls] = 'icon-add'
|
|
332
326
|
else
|
|
333
327
|
theme_hash[:iconCls] = 'icon-delete'
|
|
334
328
|
end
|
|
329
|
+
|
|
335
330
|
['stylesheets', 'javascripts', 'images', 'templates', 'widgets'].each do |resource_folder|
|
|
336
|
-
theme_hash[:children] << {
|
|
331
|
+
theme_hash[:children] << {
|
|
332
|
+
:themeId => theme.id,
|
|
333
|
+
:siteId => @website.id,
|
|
334
|
+
:text => resource_folder.capitalize,
|
|
335
|
+
:iconCls => 'icon-content',
|
|
336
|
+
:handleContextMenu => (resource_folder == 'widgets'),
|
|
337
|
+
:id => "#{theme.url}/#{resource_folder}"
|
|
338
|
+
}
|
|
337
339
|
end
|
|
338
|
-
|
|
340
|
+
|
|
341
|
+
tree << theme_hash
|
|
339
342
|
end
|
|
340
|
-
site_hash[:children] << themes_hash
|
|
341
|
-
tree << site_hash
|
|
342
343
|
end
|
|
343
344
|
|
|
344
345
|
render :json => tree
|
|
345
346
|
end
|
|
346
347
|
|
|
347
|
-
def set_website
|
|
348
|
-
@website = Website.find(params[:site_id])
|
|
349
|
-
end
|
|
350
|
-
|
|
351
348
|
def set_theme
|
|
352
349
|
@theme = Theme.find(params[:theme_id])
|
|
353
350
|
end
|
|
@@ -355,8 +352,14 @@ module Knitkit
|
|
|
355
352
|
def set_file_support
|
|
356
353
|
@file_support = ErpTechSvcs::FileSupport::Base.new(:storage => ErpTechSvcs::Config.file_storage)
|
|
357
354
|
end
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
end
|
|
355
|
+
|
|
356
|
+
def set_website
|
|
357
|
+
if params[:website_id]
|
|
358
|
+
@website = Website.find(params[:website_id])
|
|
359
|
+
end
|
|
360
|
+
end
|
|
361
|
+
|
|
362
|
+
end #ThemeController
|
|
363
|
+
end #Desktop
|
|
364
|
+
end #ErpApp
|
|
365
|
+
end #Knitkit
|