knitkit 3.0.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{public → app/assets}/images/check.png +0 -0
- data/{public → app/assets}/images/credit_card.png +0 -0
- data/{public → app/assets}/images/inline_edit/close.png +0 -0
- data/{public → app/assets}/images/knitkit/icons/document.png +0 -0
- data/{public → app/assets}/images/knitkit/icons/multi_doc.png +0 -0
- data/{public → app/assets}/images/knitkit/logo.png +0 -0
- data/{public → app/assets}/images/knitkit/splash/images/add-site.png +0 -0
- data/app/assets/images/knitkit/splash/images/add_website_105x105-active.png +0 -0
- data/app/assets/images/knitkit/splash/images/add_website_105x105.png +0 -0
- data/{public → app/assets}/images/knitkit/splash/images/adjust-site.png +0 -0
- data/{public → app/assets}/images/knitkit/splash/images/browse-site.png +0 -0
- data/app/assets/images/knitkit/splash/images/browse_db_105x105-active.png +0 -0
- data/app/assets/images/knitkit/splash/images/browse_db_105x105.png +0 -0
- data/app/assets/images/knitkit/splash/images/console_105x105-active.png +0 -0
- data/app/assets/images/knitkit/splash/images/console_105x105.png +0 -0
- data/{public → app/assets}/images/knitkit/splash/images/find-themes.png +0 -0
- data/app/assets/images/knitkit/splash/images/find_themes_105x105-active.png +0 -0
- data/app/assets/images/knitkit/splash/images/find_themes_105x105.png +0 -0
- data/app/assets/images/knitkit/splash/images/learn_more_105x105-active.png +0 -0
- data/app/assets/images/knitkit/splash/images/learn_more_105x105.png +0 -0
- data/{public → app/assets}/images/knitkit/splash/images/settings.png +0 -0
- data/{public → app/assets}/images/knitkit/splash/images/tutorials.png +0 -0
- data/app/assets/images/knitkit/splash/splash.png +0 -0
- data/app/assets/images/widgets/manage_profile/contact_information.png +0 -0
- data/app/assets/images/widgets/manage_profile/password.png +0 -0
- data/app/assets/images/widgets/manage_profile/user_information.png +0 -0
- data/app/assets/javascripts/erp_app/desktop/applications/knitkit/app.js +24 -0
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/articles_grid_panel.js +15 -12
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/center_region.js +69 -48
- data/app/assets/javascripts/erp_app/desktop/applications/knitkit/comments_grid_panel.js +214 -0
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/east_region/east_region.js +0 -0
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/east_region/file_assets_panel.js +17 -19
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/east_region/image_assets_data_view.js +13 -3
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/east_region/image_assets_panel.js +59 -48
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/east_region/widgets_panel.js +0 -0
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/inquiries_grid_panel.js +2 -2
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/module.js +2 -2
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/publish_window.js +0 -0
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/published_grid_panel.js +1 -1
- data/app/assets/javascripts/erp_app/desktop/applications/knitkit/splash_screen.js +268 -0
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/top_menu/main_menu.js +85 -33
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/top_menu/websites_combo.js +0 -0
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/versions_grid_panel.js +5 -28
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/article.js +22 -8
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/document.js +143 -25
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/host.js +5 -1
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/menu.js +2 -0
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/section.js +181 -65
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/helpers/website_nav_items.js +0 -0
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/hosts_tree_panel.js +0 -0
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/menu_tree_panel.js +0 -0
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/site_contents_tree_panel.js +121 -116
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/themes_tree_panel.js +101 -10
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/knitkit/west_region/west_region.js +9 -5
- data/app/assets/javascripts/knitkit-web.js +22 -0
- data/app/assets/javascripts/knitkit/additional-methods.min.js +4 -0
- data/app/assets/javascripts/knitkit/bootstrap.min.js +7 -0
- data/app/assets/javascripts/knitkit/captcha.js +154 -0
- data/{public → app/assets}/javascripts/knitkit/confirm-bootstrap.js +1 -1
- data/{public → app/assets}/javascripts/knitkit/inline_editing.js +1 -1
- data/{public → app/assets}/javascripts/knitkit/jquery.maskedinput.min.js +0 -0
- data/app/assets/javascripts/knitkit/jquery.validate.min.js +4 -0
- data/app/assets/javascripts/knitkit/js.cookie.js +145 -0
- data/{public → app/assets}/javascripts/knitkit/theme.js +0 -0
- data/app/assets/stylesheets/erp_app/desktop/applications/knitkit/app.css +12 -0
- data/{public → app/assets}/stylesheets/erp_app/desktop/applications/knitkit/knitkit.css +23 -33
- data/app/assets/stylesheets/erp_app/shared/knitkit_shared.css +21 -0
- data/app/assets/stylesheets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/app/assets/stylesheets/fonts/glyphicons-halflings-regular.svg +288 -0
- data/app/assets/stylesheets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/app/assets/stylesheets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/app/assets/stylesheets/fonts/glyphicons-halflings-regular.woff2 +0 -0
- data/app/assets/stylesheets/knitkit-web.css +16 -0
- data/app/assets/stylesheets/knitkit/bootstrap.min.css +5 -0
- data/app/assets/stylesheets/knitkit/captcha.css +59 -0
- data/app/assets/stylesheets/knitkit/custom.css +144 -0
- data/{public → app/assets}/stylesheets/knitkit/inline_editing.css +0 -0
- data/app/assets/stylesheets/knitkit/submenu.css +93 -0
- data/app/controllers/api/v1/websites_controller.rb +14 -0
- data/app/controllers/captcha_controller.rb +53 -0
- data/app/controllers/knitkit/base_controller.rb +1 -5
- data/app/controllers/knitkit/erp_app/desktop/app_controller.rb +2 -9
- data/app/controllers/knitkit/erp_app/desktop/articles_controller.rb +20 -7
- data/app/controllers/knitkit/erp_app/desktop/file_assets_controller.rb +38 -28
- data/app/controllers/knitkit/erp_app/desktop/image_assets_controller.rb +16 -9
- data/app/controllers/knitkit/erp_app/desktop/online_document_sections_controller.rb +69 -15
- data/app/controllers/knitkit/erp_app/desktop/position_controller.rb +45 -58
- data/app/controllers/knitkit/erp_app/desktop/theme_controller.rb +64 -29
- data/app/controllers/knitkit/erp_app/desktop/website_controller.rb +36 -13
- data/app/controllers/knitkit/erp_app/desktop/website_host_controller.rb +12 -0
- data/app/controllers/knitkit/erp_app/desktop/website_nav_controller.rb +4 -11
- data/app/controllers/knitkit/erp_app/desktop/website_nav_item_controller.rb +2 -9
- data/app/controllers/knitkit/erp_app/desktop/website_section_controller.rb +56 -20
- data/app/controllers/knitkit/online_document_sections_controller.rb +9 -3
- data/app/mailers/website_inquiry_mailer.rb +11 -3
- data/app/models/content.rb +16 -6
- data/app/models/documented_item.rb +12 -1
- data/app/models/online_document_section.rb +54 -20
- data/app/models/published_website.rb +16 -0
- data/app/models/theme.rb +53 -47
- data/app/models/website.rb +172 -191
- data/app/models/website_section.rb +64 -30
- data/app/views/knitkit/blogs/show.html.erb +5 -2
- data/app/views/layouts/knitkit/base.html.erb +54 -51
- data/app/views/menus/knitkit/_default_menu.html.erb +11 -11
- data/app/views/menus/knitkit/_default_section_menu.html.erb +2 -2
- data/app/views/menus/knitkit/_default_sub_menu.erb +27 -0
- data/app/views/menus/knitkit/_default_sub_section_menu.html.erb +30 -0
- data/app/views/website_inquiry_mailer/inquiry.html.erb +266 -0
- data/app/widgets/contact_us/base.rb +26 -16
- data/app/widgets/contact_us/javascript/contact_us.js +1 -1
- data/app/widgets/contact_us/views/error.html.erb +7 -3
- data/app/widgets/contact_us/views/index.html.erb +36 -28
- data/app/widgets/google_map/javascript/google_map.js +1 -1
- data/app/widgets/google_map/views/index.html.erb +1 -1
- data/app/widgets/login/javascript/login.js +1 -1
- data/app/widgets/login/views/index.html.erb +1 -1
- data/app/widgets/manage_profile/base.rb +141 -112
- data/app/widgets/manage_profile/javascript/manage_profile.js +2 -2
- data/app/widgets/manage_profile/views/_password_form.html.erb +1 -1
- data/app/widgets/manage_profile/views/_user_information_form.html.erb +1 -30
- data/app/widgets/manage_profile/views/index.html.erb +42 -40
- data/app/widgets/reset_password/base.rb +39 -8
- data/app/widgets/reset_password/javascript/reset_password.js +1 -1
- data/app/widgets/reset_password/views/index.html.erb +3 -3
- data/app/widgets/reset_password/views/invalid_reset_token.html.erb +7 -0
- data/app/widgets/reset_password/views/layouts/base.html.erb +1 -1
- data/app/widgets/reset_password/views/reset_password.html.erb +39 -0
- data/app/widgets/reset_password/views/reset_success.html.erb +5 -0
- data/app/widgets/search/base.rb +5 -5
- data/app/widgets/search/javascript/search.js +6 -6
- data/app/widgets/search/views/_inline_search_form.html.erb +23 -12
- data/app/widgets/search/views/_search_form.html.erb +34 -30
- data/app/widgets/search/views/layouts/base.html.erb +6 -1
- data/app/widgets/signup/base.rb +73 -30
- data/app/widgets/signup/javascript/signup.js +1 -1
- data/app/widgets/signup/views/_signup_form.html.erb +2 -1
- data/app/widgets/signup/views/layouts/base.html.erb +1 -1
- data/app/widgets/signup/views/success.html.erb +2 -3
- data/config/routes.rb +25 -4
- data/db/data_migrations/20110509223702_add_publisher_role.rb +0 -2
- data/db/data_migrations/20110816153456_add_knitkit_application.rb +7 -15
- data/db/data_migrations/20120127150505_create_website_default_configuration.rb +63 -3
- data/db/data_migrations/20150118180450_add_website_member_roles.rb +12 -0
- data/db/data_migrations/20150414150359_nest_knitkit_security_roles.rb +35 -0
- data/db/data_migrations/20150414173437_move_website_roles_under_website_builder.rb +19 -0
- data/db/migrate/20110211002317_setup_knitkit.rb +86 -39
- data/lib/knitkit.rb +8 -2
- data/lib/knitkit/config.rb +2 -3
- data/lib/knitkit/engine.rb +35 -4
- data/lib/knitkit/extensions.rb +2 -1
- data/lib/knitkit/extensions/action_controller/theme_support/acts_as_themed_controller.rb +1 -1
- data/lib/knitkit/extensions/action_mailer/theme_support/acts_as_themed_mailer.rb +1 -1
- data/lib/knitkit/extensions/compass_ae/mailers/user_mailer.rb +31 -0
- data/lib/knitkit/extensions/compass_ae/widgets/base.rb +1 -1
- data/lib/knitkit/extensions/railties/action_controller/captcha_helper.rb +43 -0
- data/lib/knitkit/extensions/railties/action_view/helpers/content_helper.rb +1 -1
- data/lib/knitkit/extensions/railties/action_view/helpers/menu_helper.rb +11 -1
- data/lib/knitkit/extensions/railties/theme_support/asset_tag_helper.rb +83 -0
- data/lib/knitkit/routing_filter/section_router.rb +24 -14
- data/lib/knitkit/version.rb +1 -1
- data/lib/tasks/knitkit_tasks.rake +89 -4
- data/lib/tasks/theme_parser.rake +85 -0
- data/public/fonts/glyphicons-halflings-regular.eot +0 -0
- data/public/fonts/glyphicons-halflings-regular.svg +288 -0
- data/public/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/public/fonts/glyphicons-halflings-regular.woff +0 -0
- data/public/fonts/glyphicons-halflings-regular.woff2 +0 -0
- data/public/paypal-button.min.js +7 -0
- metadata +161 -82
- data/app/assets/javascripts/knitkit/application.js +0 -9
- data/app/assets/stylesheets/knitkit/application.css +0 -7
- data/app/mailers/document_mailer.rb +0 -10
- data/app/views/document_mailer/email_document.html.erb +0 -12
- data/app/views/knitkit/mobile/index.html.erb +0 -162
- data/app/views/knitkit/online_document_sections/index.html.erb +0 -279
- data/app/views/layouts/knitkit/online_document_sections.html.erb +0 -80
- data/app/views/website_inquiry_mailer/inquiry.erb +0 -24
- data/db/data_migrations/20120127150506_add_primary_host_to_website_configuration.rb +0 -33
- data/db/data_migrations/20120316150424_add_is_template_to_default_website_config.rb +0 -16
- data/db/data_migrations/20120809020508_update_website_and_configuration.rb +0 -82
- data/db/data_migrations/20121129185611_upgrade_website_role_iid.rb +0 -20
- data/db/migrate/20130405184234_add_use_markdown_to_section.rb +0 -19
- data/db/migrate/20131112013052_add_knitkit_missing_indexes.rb +0 -33
- data/db/migrate/20140622212723_update_website_inquiries.rb +0 -22
- data/db/migrate/20140911185022_add_publishing_to_website.rb +0 -5
- data/db/migrate/20141013073349_add_custom_fields_to_documents.rb +0 -12
- data/db/migrate/20141016101936_upgrade_remove_dynamic_attributes.rb +0 -13
- data/lib/knitkit/extensions/railties/theme_support/theme_file_resolver.rb +0 -49
- data/public/images/knitkit/close_window.png +0 -0
- data/public/images/knitkit/splash/splash.png +0 -0
- data/public/javascripts/erp_app/desktop/applications/knitkit/comments_grid_panel.js +0 -215
- data/public/javascripts/erp_app/desktop/applications/knitkit/select_roles_window.js +0 -108
- data/public/javascripts/erp_app/desktop/applications/knitkit/splash_screen.js +0 -170
- data/public/javascripts/knitkit/bootstrap-datepicker.js +0 -474
- data/public/javascripts/knitkit/bootstrap.min.js +0 -7
- data/public/javascripts/knitkit/mobile/app/view/Main.js +0 -108
- data/public/javascripts/knitkit/mobile/ux/slidenavigation/View.js +0 -734
- data/public/stylesheets/knitkit/bootstrap-responsive.min.css +0 -10
- data/public/stylesheets/knitkit/bootstrap.min.css +0 -7
- data/public/stylesheets/knitkit/custom.css +0 -122
- data/public/stylesheets/knitkit/datepicker.css +0 -182
@@ -37,12 +37,10 @@ module Knitkit
|
|
37
37
|
end
|
38
38
|
|
39
39
|
begin
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
end
|
45
|
-
result = {:success => true, :url => file_asset.data.url}
|
40
|
+
path = (upload_path == 'root_node') ? File.join(base_path, name) : File.join(@file_support.root, upload_path, name)
|
41
|
+
@assets_model.add_file(data, path)
|
42
|
+
|
43
|
+
result = {:success => true, :node => @file_support.find_node(path, :file_asset_holder => @assets_model)}
|
46
44
|
rescue => ex
|
47
45
|
logger.error ex.message
|
48
46
|
logger.error ex.backtrace.join("\n")
|
@@ -83,9 +81,12 @@ module Knitkit
|
|
83
81
|
file.destroy
|
84
82
|
end
|
85
83
|
messages << message
|
86
|
-
rescue
|
84
|
+
rescue StandardError => ex
|
87
85
|
Rails.logger.error ex.message
|
88
86
|
Rails.logger.error ex.backtrace.join("\n")
|
87
|
+
|
88
|
+
ExceptionNotifier.notify_exception(ex) if defined? ExceptionNotifier
|
89
|
+
|
89
90
|
render :json => {:success => false, :error => "Error deleting #{name}"} and return
|
90
91
|
end
|
91
92
|
end # end current_user.with_capability
|
@@ -106,9 +107,15 @@ module Knitkit
|
|
106
107
|
@root_node = nil
|
107
108
|
|
108
109
|
if @context == :website
|
109
|
-
@root_node = File.join(
|
110
|
+
@root_node = File.join('public',
|
111
|
+
'sites',
|
112
|
+
@assets_model.iid,
|
113
|
+
'images') unless @assets_model.nil?
|
110
114
|
else
|
111
|
-
@root_node = File.join(
|
115
|
+
@root_node = File.join('public',
|
116
|
+
"dba_organizations",
|
117
|
+
current_user.party.dba_organization.id.to_s,
|
118
|
+
'images')
|
112
119
|
end
|
113
120
|
|
114
121
|
@root_node
|
@@ -2,25 +2,25 @@ module Knitkit
|
|
2
2
|
module ErpApp
|
3
3
|
module Desktop
|
4
4
|
class OnlineDocumentSectionsController < Knitkit::ErpApp::Desktop::AppController
|
5
|
-
|
6
|
-
def
|
5
|
+
|
6
|
+
def create
|
7
7
|
@website = Website.find(params[:website_id])
|
8
8
|
online_document_section = OnlineDocumentSection.new(:website_id => @website.id,
|
9
9
|
:in_menu => params[:in_menu] == 'yes', :title => params[:title],
|
10
10
|
:internal_identifier => params[:internal_identifier])
|
11
|
-
|
11
|
+
|
12
12
|
if online_document_section.save
|
13
13
|
if params[:website_section_id]
|
14
14
|
parent_website_section = WebsiteSection.find(params[:website_section_id])
|
15
15
|
online_document_section.move_to_child_of(parent_website_section)
|
16
|
-
end
|
17
|
-
online_document_section.update_path!
|
18
|
-
if params[:documenttype] == "Content"
|
19
|
-
documented_content = DocumentedContent.create(:title => online_document_section.title, :created_by => current_user, :body_html => online_document_section.title)
|
20
|
-
DocumentedItem.create(:documented_content_id => documented_content.id, :online_document_section_id => online_document_section.id)
|
21
16
|
end
|
22
|
-
|
23
|
-
|
17
|
+
online_document_section.update_path!
|
18
|
+
|
19
|
+
documented_content = DocumentedContent.create(:title => online_document_section.title, :created_by => current_user, :body_html => online_document_section.title)
|
20
|
+
DocumentedItem.create(:documented_content_id => documented_content.id, :online_document_section_id => online_document_section.id)
|
21
|
+
|
22
|
+
result = {:success => true,
|
23
|
+
:node => build_section_hash(online_document_section),
|
24
24
|
:documented_content => documented_content.content_hash}
|
25
25
|
else
|
26
26
|
message = "<ul>"
|
@@ -32,8 +32,62 @@ module Knitkit
|
|
32
32
|
end
|
33
33
|
|
34
34
|
render :json => result
|
35
|
-
end
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
35
|
+
end
|
36
|
+
|
37
|
+
def existing_documents
|
38
|
+
website = Website.find(params[:website_id])
|
39
|
+
OnlineDocumentSection.class_eval do
|
40
|
+
def title_permalink
|
41
|
+
"#{self.title} - #{self.path}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
render :inline => website.online_document_sections.to_json(:only => [:id], :methods => [:title_permalink])
|
45
|
+
end
|
46
|
+
|
47
|
+
def content
|
48
|
+
document_section = OnlineDocumentSection.find(params[:id])
|
49
|
+
|
50
|
+
render :json => {success: true, content: document_section.documented_item_content_html}
|
51
|
+
end
|
52
|
+
|
53
|
+
def copy
|
54
|
+
begin
|
55
|
+
|
56
|
+
@website = Website.find(params[:website_id])
|
57
|
+
parent_section = WebsiteSection.where('id = ?', params[:parent_section_id]).first
|
58
|
+
section_to_copy = OnlineDocumentSection.find(params[:id])
|
59
|
+
|
60
|
+
new_section = section_to_copy.copy(params[:title].strip, true, current_user)
|
61
|
+
|
62
|
+
if parent_section
|
63
|
+
new_section.move_to_child_of(parent_section)
|
64
|
+
new_section.save
|
65
|
+
end
|
66
|
+
|
67
|
+
# update all children paths after all are saved.
|
68
|
+
new_section.self_and_descendants.each do |section|
|
69
|
+
section.update_path!
|
70
|
+
end
|
71
|
+
|
72
|
+
result = {:success => true,
|
73
|
+
:parentNodeId => params[:parent_section_id],
|
74
|
+
:node => build_section_hash(new_section)}
|
75
|
+
|
76
|
+
|
77
|
+
rescue => ex
|
78
|
+
# TODO send error notification
|
79
|
+
Rails.logger.error ex.message
|
80
|
+
Rails.logger.error ex.backtrace.join("\n")
|
81
|
+
|
82
|
+
ExceptionNotifier.notify_exception(ex) if defined? ExceptionNotifier
|
83
|
+
|
84
|
+
result = {:success => false, :message => 'Could not copy Document'}
|
85
|
+
end
|
86
|
+
|
87
|
+
render :json => result
|
88
|
+
end
|
89
|
+
|
90
|
+
end # OnlineDocumentSectionsController
|
91
|
+
end # Desktop
|
92
|
+
end # ErpApp
|
93
|
+
end # Knitkit
|
@@ -3,85 +3,72 @@ module Knitkit
|
|
3
3
|
module Desktop
|
4
4
|
class PositionController < Knitkit::ErpApp::Desktop::AppController
|
5
5
|
|
6
|
-
|
7
|
-
begin
|
8
|
-
current_user.with_capability('drag_item', 'WebsiteTree') do
|
6
|
+
around_filter :wrap_in_transaction
|
9
7
|
|
10
|
-
|
11
|
-
|
8
|
+
def update_section_position
|
9
|
+
params[:position_array].each do |position|
|
10
|
+
website_section = WebsiteSection.find(position['id'])
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
if position['parent_id'].blank? || position['parent_id'] == 'root'
|
13
|
+
website_section.move_to_root
|
14
|
+
else
|
15
|
+
website_section.move_to_child_of(WebsiteSection.find(position['parent_id']))
|
16
|
+
end
|
18
17
|
|
19
|
-
|
18
|
+
website_section.position = position['position'].to_i
|
20
19
|
|
21
|
-
|
22
|
-
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
23
|
-
render :json => {:success => false, :message => ex.message}
|
20
|
+
website_section.save
|
24
21
|
end
|
22
|
+
|
23
|
+
render :json => {:success => true}
|
25
24
|
end
|
26
25
|
|
27
|
-
def
|
28
|
-
|
29
|
-
|
26
|
+
def update_menu_item_position
|
27
|
+
params[:position_array].each do |position|
|
28
|
+
website_nav_item = WebsiteNavItem.find(position['id'])
|
29
|
+
website_nav_item.position = position['position'].to_i
|
30
|
+
website_nav_item.save
|
31
|
+
end
|
30
32
|
|
31
|
-
|
32
|
-
|
33
|
-
model.position = position['position'].to_i
|
34
|
-
model.save
|
35
|
-
end
|
33
|
+
render :json => {:success => true}
|
34
|
+
end
|
36
35
|
|
37
|
-
|
36
|
+
def update_article_position
|
37
|
+
website_section = WebsiteSection.find(params[:section_id])
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
params[:position_array].each do |position|
|
40
|
+
article = website_section.website_section_contents.where('content_id = ?', position['id']).first
|
41
|
+
article.position = position['position'].to_i
|
42
|
+
article.save
|
42
43
|
end
|
44
|
+
|
45
|
+
render :json => {:success => true}
|
43
46
|
end
|
44
47
|
|
45
|
-
|
46
|
-
begin
|
47
|
-
current_user.with_capability('drag_item', 'WebsiteTree') do
|
48
|
+
private
|
48
49
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
def wrap_in_transaction
|
51
|
+
begin
|
52
|
+
ActiveRecord::Base.transaction do
|
53
|
+
current_user.with_capability('drag_item', 'WebsiteTree') do
|
54
|
+
yield
|
53
55
|
end
|
54
|
-
|
55
|
-
render :json => {:success => true}
|
56
|
-
|
57
56
|
end
|
58
57
|
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
59
58
|
render :json => {:success => false, :message => ex.message}
|
60
|
-
end
|
61
|
-
end
|
62
59
|
|
63
|
-
|
64
|
-
|
65
|
-
|
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
|
60
|
+
rescue => ex
|
61
|
+
Rails.logger.error ex.message + "\n"
|
62
|
+
Rails.logger.error ex.backtrace.join("\n")
|
74
63
|
|
75
|
-
|
64
|
+
# email notification
|
65
|
+
ExceptionNotifier.notify_exception(ex) if defined? ExceptionNotifier
|
76
66
|
|
77
|
-
|
78
|
-
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
79
|
-
render :json => {:success => false, :message => ex.message}
|
67
|
+
render :json => {success: false, message: 'Could not process request'}
|
80
68
|
end
|
81
69
|
end
|
82
70
|
|
83
|
-
end #PositionController
|
84
|
-
end #Desktop
|
85
|
-
end #ErpApp
|
86
|
-
end #Knitkit
|
87
|
-
|
71
|
+
end # PositionController
|
72
|
+
end # Desktop
|
73
|
+
end # ErpApp
|
74
|
+
end # Knitkit
|
@@ -39,7 +39,7 @@ module Knitkit
|
|
39
39
|
begin
|
40
40
|
current_user.with_capability('view', 'Theme') do
|
41
41
|
unless params[:theme_data].blank?
|
42
|
-
Theme.import(params[:theme_data], @website)
|
42
|
+
theme = Theme.import(params[:theme_data], @website)
|
43
43
|
else
|
44
44
|
theme = Theme.create(:website => @website, :name => params[:name], :theme_id => params[:theme_id])
|
45
45
|
theme.version = params[:version]
|
@@ -49,8 +49,29 @@ module Knitkit
|
|
49
49
|
theme.save
|
50
50
|
theme.create_theme_files!
|
51
51
|
end
|
52
|
+
render :inline => {:success => true, :node => build_tree_node(theme, @website)}.to_json
|
53
|
+
end
|
54
|
+
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
55
|
+
render :json => {:success => false, :message => ex.message}
|
56
|
+
end
|
57
|
+
end
|
52
58
|
|
53
|
-
|
59
|
+
def update
|
60
|
+
begin
|
61
|
+
current_user.with_capability('view', 'Theme') do
|
62
|
+
theme = Theme.find(params[:id])
|
63
|
+
theme.name = params[:name].strip
|
64
|
+
if theme.save
|
65
|
+
render :json => {
|
66
|
+
success: true,
|
67
|
+
theme: {
|
68
|
+
name: theme.name,
|
69
|
+
text: "#{theme.name}[#{theme.theme_id}]"
|
70
|
+
}
|
71
|
+
}
|
72
|
+
else
|
73
|
+
render :json => {success: false}
|
74
|
+
end
|
54
75
|
end
|
55
76
|
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
56
77
|
render :json => {:success => false, :message => ex.message}
|
@@ -106,7 +127,7 @@ module Knitkit
|
|
106
127
|
theme = get_theme(path)
|
107
128
|
theme.add_file('#Empty File', File.join(path, name))
|
108
129
|
|
109
|
-
render :json => {:success => true}
|
130
|
+
render :json => {:success => true, :node => @file_support.find_node(File.join(path, name), {:file_asset_holder => theme})}
|
110
131
|
end
|
111
132
|
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
112
133
|
render :json => {:success => false, :message => ex.message}
|
@@ -120,7 +141,7 @@ module Knitkit
|
|
120
141
|
name = params[:name]
|
121
142
|
|
122
143
|
@file_support.create_folder(path, name)
|
123
|
-
render :json => {:success => true}
|
144
|
+
render :json => {:success => true, :node => @file_support.find_node(File.join(path, name), {keep_full_path: false})}
|
124
145
|
end
|
125
146
|
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
126
147
|
render :json => {:success => false, :message => ex.message}
|
@@ -209,7 +230,7 @@ module Knitkit
|
|
209
230
|
|
210
231
|
begin
|
211
232
|
theme.add_file(data, name)
|
212
|
-
result = {:success => true}
|
233
|
+
result = {:success => true, :node => @file_support.find_node(name, {:file_asset_holder => theme})}
|
213
234
|
rescue => ex
|
214
235
|
logger.error ex.message
|
215
236
|
logger.error ex.backtrace.join("\n")
|
@@ -232,15 +253,18 @@ module Knitkit
|
|
232
253
|
current_user.with_capability('view', 'Theme') do
|
233
254
|
begin
|
234
255
|
name = File.basename(path)
|
235
|
-
result, message, is_folder = @file_support.delete_file(File.join(@file_support.root, path))
|
256
|
+
result, message, is_folder = @file_support.delete_file(File.join(@file_support.root, path), {force: true})
|
236
257
|
if result && !is_folder
|
237
258
|
theme_file = get_theme_file(path)
|
238
259
|
theme_file.destroy
|
239
260
|
end
|
240
261
|
messages << message
|
241
|
-
rescue
|
262
|
+
rescue StandardError => ex
|
242
263
|
Rails.logger.error ex.message
|
243
264
|
Rails.logger.error ex.backtrace.join("\n")
|
265
|
+
|
266
|
+
ExceptionNotifier.notify_exception(ex) if defined? ExceptionNotifier
|
267
|
+
|
244
268
|
render :json => {:success => false, :error => "Error deleting #{name}"} and return
|
245
269
|
end
|
246
270
|
end # end current_user.with_capability
|
@@ -262,7 +286,7 @@ module Knitkit
|
|
262
286
|
path = params[:node]
|
263
287
|
name = params[:file_name]
|
264
288
|
|
265
|
-
result, message = @file_support.rename_file(@file_support.root
|
289
|
+
result, message = @file_support.rename_file(File.join(@file_support.root, path), name)
|
266
290
|
if result
|
267
291
|
theme_file = get_theme_file(path)
|
268
292
|
theme_file.name = name
|
@@ -311,33 +335,44 @@ module Knitkit
|
|
311
335
|
theme.files.where('name = ? and directory = ?', ::File.basename(path), file_dir).first
|
312
336
|
end
|
313
337
|
|
338
|
+
def build_tree_node(theme, website)
|
339
|
+
|
340
|
+
theme_hash = {
|
341
|
+
:name => theme.name,
|
342
|
+
:text => "#{theme.name}[#{theme.theme_id}]",
|
343
|
+
:handleContextMenu => true,
|
344
|
+
:siteId => website.id,
|
345
|
+
:isActive => (theme.active == 1), :iconCls => 'icon-content',
|
346
|
+
:isTheme => true,
|
347
|
+
:id => theme.id,
|
348
|
+
:children => []
|
349
|
+
}
|
350
|
+
if theme.active == 1
|
351
|
+
theme_hash[:iconCls] = 'icon-add'
|
352
|
+
else
|
353
|
+
theme_hash[:iconCls] = 'icon-delete'
|
354
|
+
end
|
355
|
+
|
356
|
+
['stylesheets', 'javascripts', 'images', 'templates', 'widgets', 'fonts'].each do |resource_folder|
|
357
|
+
theme_hash[:children] << {
|
358
|
+
:themeId => theme.id,
|
359
|
+
:siteId => website.id,
|
360
|
+
:text => resource_folder.capitalize,
|
361
|
+
:iconCls => 'icon-content',
|
362
|
+
:handleContextMenu => (resource_folder == 'widgets'),
|
363
|
+
:id => "#{theme.url}/#{resource_folder}"
|
364
|
+
}
|
365
|
+
end
|
366
|
+
theme_hash
|
367
|
+
end
|
368
|
+
|
314
369
|
def setup_tree
|
315
370
|
tree = []
|
316
371
|
|
317
372
|
if @website
|
318
373
|
#handle themes
|
319
374
|
@website.themes.each do |theme|
|
320
|
-
theme_hash =
|
321
|
-
:siteId => @website.id, :isActive => (theme.active == 1), :iconCls => 'icon-content',
|
322
|
-
:isTheme => true, :id => theme.id, :children => []}
|
323
|
-
|
324
|
-
if theme.active == 1
|
325
|
-
theme_hash[:iconCls] = 'icon-add'
|
326
|
-
else
|
327
|
-
theme_hash[:iconCls] = 'icon-delete'
|
328
|
-
end
|
329
|
-
|
330
|
-
['stylesheets', 'javascripts', 'images', 'templates', 'widgets'].each do |resource_folder|
|
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
|
-
}
|
339
|
-
end
|
340
|
-
|
375
|
+
theme_hash = build_tree_node(theme, @website)
|
341
376
|
tree << theme_hash
|
342
377
|
end
|
343
378
|
end
|
@@ -8,9 +8,13 @@ module Knitkit
|
|
8
8
|
:build_host_hash, :activate_publication, :publish, :update, :delete]
|
9
9
|
|
10
10
|
def index
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
websites = Website.joins(:website_party_roles)
|
12
|
+
.where('website_party_roles.party_id = ?', current_user.party.dba_organization.id)
|
13
|
+
.where('website_party_roles.role_type_id = ?', RoleType.iid('dba_org'))
|
14
|
+
|
15
|
+
render :json => {:sites => websites.all.collect { |item| item.to_hash(:only => [:id, :name, :title, :subtitle],
|
16
|
+
:configuration_id => item.configurations.first.id,
|
17
|
+
:url => "#{request.protocol}#{item.config_value('primary_host')}") }}
|
14
18
|
end
|
15
19
|
|
16
20
|
def build_content_tree
|
@@ -71,8 +75,8 @@ module Knitkit
|
|
71
75
|
render :inline => "{\"success\":true, \"results\":#{published_websites.count},
|
72
76
|
\"totalCount\":#{@website.published_websites.count},
|
73
77
|
\"data\":#{published_websites.to_json(
|
74
|
-
|
75
|
-
|
78
|
+
:only => [:comment, :id, :version, :created_at, :active],
|
79
|
+
:methods => [:viewing, :published_by_username])} }"
|
76
80
|
end
|
77
81
|
|
78
82
|
def activate_publication
|
@@ -134,6 +138,12 @@ module Knitkit
|
|
134
138
|
first_publication.published_by = current_user
|
135
139
|
first_publication.save
|
136
140
|
|
141
|
+
website_host = WebsiteHost.find_by_host(params[:host])
|
142
|
+
if website_host
|
143
|
+
website_name = website_host.website.name
|
144
|
+
raise "Host #{website_host.host} already used by #{website_name}"
|
145
|
+
end
|
146
|
+
|
137
147
|
website.hosts << WebsiteHost.create(:host => params[:host])
|
138
148
|
website.configurations.first.update_configuration_item(ConfigurationItemType.find_by_internal_identifier('primary_host'), params[:host])
|
139
149
|
website.save
|
@@ -142,6 +152,11 @@ module Knitkit
|
|
142
152
|
|
143
153
|
PublishedWebsite.activate(website, 1, current_user)
|
144
154
|
|
155
|
+
# set the currents users dba_org as the dba_org for this website
|
156
|
+
WebsitePartyRole.create(website: website,
|
157
|
+
party: current_user.party.dba_organization,
|
158
|
+
role_type: RoleType.iid('dba_org'))
|
159
|
+
|
145
160
|
render :json => {:success => true, :website => website.to_hash(:only => [:id, :name],
|
146
161
|
:configuration_id => website.configurations.first.id,
|
147
162
|
:url => "http://#{website.config_value('primary_host')}")}
|
@@ -151,7 +166,6 @@ module Knitkit
|
|
151
166
|
Rails.logger.error("#{ex.message} + #{ex.backtrace.join("\n")}")
|
152
167
|
render :json => {:success => false, :message => ex.message}
|
153
168
|
end
|
154
|
-
|
155
169
|
end
|
156
170
|
|
157
171
|
def update
|
@@ -182,7 +196,7 @@ module Knitkit
|
|
182
196
|
zip_path = @website.export
|
183
197
|
begin
|
184
198
|
send_file(zip_path.to_s, :stream => false)
|
185
|
-
rescue
|
199
|
+
rescue StandardError => ex
|
186
200
|
raise "Error sending #{zip_path} file"
|
187
201
|
end
|
188
202
|
end
|
@@ -192,7 +206,7 @@ module Knitkit
|
|
192
206
|
if zip_path
|
193
207
|
begin
|
194
208
|
send_file(zip_path, :stream => false)
|
195
|
-
rescue
|
209
|
+
rescue StandardError => ex
|
196
210
|
raise "Error sending file. Make sure you have a website and an active theme."
|
197
211
|
end
|
198
212
|
else
|
@@ -209,17 +223,20 @@ module Knitkit
|
|
209
223
|
else
|
210
224
|
render :inline => {:success => false, :message => message}.to_json
|
211
225
|
end
|
226
|
+
WebsitePartyRole.create(website: website,
|
227
|
+
party: current_user.party.dba_organization,
|
228
|
+
role_type: RoleType.iid('dba_org'))
|
212
229
|
ensure
|
213
230
|
FileUtils.rm_r File.dirname(zip_path) rescue nil
|
214
231
|
end
|
215
232
|
|
216
|
-
def
|
217
|
-
|
233
|
+
def import_template
|
234
|
+
result = Website.import_template(params[:website_data], current_user)
|
218
235
|
|
219
|
-
if
|
220
|
-
render :inline => {:success => true, :website => website.to_hash(:only => [:id, :name])}.to_json
|
236
|
+
if result[:success]
|
237
|
+
render :inline => {:success => true, :website => result[:website].to_hash(:only => [:id, :name])}.to_json
|
221
238
|
else
|
222
|
-
render :inline => {:success => false, :message => message}.to_json
|
239
|
+
render :inline => {:success => false, :message => result[:message]}.to_json
|
223
240
|
end
|
224
241
|
end
|
225
242
|
|
@@ -230,6 +247,12 @@ module Knitkit
|
|
230
247
|
# example found in knitkit module.js
|
231
248
|
end
|
232
249
|
|
250
|
+
def get_current_host
|
251
|
+
current_host = request.host_with_port
|
252
|
+
existing_website_host = WebsiteHost.find_by_host(current_host)
|
253
|
+
render :json => {:success => !existing_website_host.present?, :host => current_host}
|
254
|
+
end
|
255
|
+
|
233
256
|
end # WebsiteController
|
234
257
|
end # Desktop
|
235
258
|
end # ErpApp
|