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
@@ -26,6 +26,11 @@ module Knitkit
|
|
26
26
|
begin
|
27
27
|
current_user.with_capability('create', 'WebsiteHost') do
|
28
28
|
website = Website.find(params[:website_id])
|
29
|
+
existing_website_host = WebsiteHost.find_by_host(params[:host])
|
30
|
+
if existing_website_host
|
31
|
+
website_name = existing_website_host.website.name
|
32
|
+
raise "Host #{existing_website_host.host} already used by #{website_name}"
|
33
|
+
end
|
29
34
|
website_host = WebsiteHost.create(:host => params[:host])
|
30
35
|
website.hosts << website_host
|
31
36
|
website.save
|
@@ -51,6 +56,11 @@ module Knitkit
|
|
51
56
|
begin
|
52
57
|
current_user.with_capability('edit', 'WebsiteHost') do
|
53
58
|
website_host = WebsiteHost.find(params[:id])
|
59
|
+
existing_website_host = WebsiteHost.find_by_host(params[:host])
|
60
|
+
if existing_website_host
|
61
|
+
website_name = existing_website_host.website.name
|
62
|
+
raise "Host #{existing_website_host.host} already used by #{website_name}"
|
63
|
+
end
|
54
64
|
website_host.host = params[:host]
|
55
65
|
website_host.save
|
56
66
|
|
@@ -58,6 +68,8 @@ module Knitkit
|
|
58
68
|
end
|
59
69
|
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
60
70
|
render :json => {:success => false, :message => ex.message}
|
71
|
+
rescue => ex
|
72
|
+
render :json => {:success => false, :message => ex.message}
|
61
73
|
end
|
62
74
|
end
|
63
75
|
|
@@ -11,7 +11,7 @@ module Knitkit
|
|
11
11
|
if @website
|
12
12
|
@website.website_navs.each do |website_nav|
|
13
13
|
menu_hash = {:text => website_nav.name, :websiteNavId => website_nav.id, :canAddMenuItems => true,
|
14
|
-
:iconCls => 'icon-
|
14
|
+
:iconCls => 'icon-folder', :isWebsiteNav => true, :leaf => false, :children => []}
|
15
15
|
|
16
16
|
menu_hash[:children] = website_nav.website_nav_items.positioned.map { |item| build_menu_item_hash(item) }
|
17
17
|
|
@@ -35,7 +35,7 @@ module Knitkit
|
|
35
35
|
result[:success] = true
|
36
36
|
result[:node] = {:text => params[:name],
|
37
37
|
:websiteNavId => website_nav.id,
|
38
|
-
:iconCls => 'icon-
|
38
|
+
:iconCls => 'icon-folder',
|
39
39
|
:canAddMenuItems => true,
|
40
40
|
:isWebsiteNav => true,
|
41
41
|
:leaf => false,
|
@@ -186,16 +186,9 @@ module Knitkit
|
|
186
186
|
if current_user.has_capability?('secure', 'WebsiteNavItem') or current_user.has_capability?('unsecure', 'WebsiteNavItem')
|
187
187
|
website_nav_item = WebsiteNavItem.find(params[:id])
|
188
188
|
|
189
|
-
roles = []
|
189
|
+
roles = JSON.parse(params[:security])
|
190
190
|
|
191
|
-
|
192
|
-
params.each do |k, v|
|
193
|
-
if v == 'on'
|
194
|
-
roles.push(k)
|
195
|
-
end
|
196
|
-
end
|
197
|
-
|
198
|
-
if roles.empty?
|
191
|
+
if roles.blank? || roles.empty?
|
199
192
|
website_nav_item.remove_capability(:view)
|
200
193
|
else
|
201
194
|
capability = website_nav_item.add_capability(:view)
|
@@ -115,16 +115,9 @@ module Knitkit
|
|
115
115
|
if current_user.has_capability?('secure', 'WebsiteNavItem') or current_user.has_capability?('unsecure', 'WebsiteNavItem')
|
116
116
|
website_nav_item = WebsiteNavItem.find(params[:id])
|
117
117
|
|
118
|
-
roles = []
|
118
|
+
roles = JSON.parse(params[:security])
|
119
119
|
|
120
|
-
|
121
|
-
params.each do |k, v|
|
122
|
-
if v == 'on'
|
123
|
-
roles.push(k)
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
if roles.empty?
|
120
|
+
if roles.blank? || roles.empty?
|
128
121
|
website_nav_item.remove_capability(:view)
|
129
122
|
else
|
130
123
|
capability = website_nav_item.add_capability(:view)
|
@@ -19,6 +19,7 @@ module Knitkit
|
|
19
19
|
result = {:success => false, :message => 'Blog can not be the title of a Blog'}
|
20
20
|
else
|
21
21
|
website_section = WebsiteSection.new
|
22
|
+
website_section.parent_id = params[:website_section_id] if params[:website_section_id]
|
22
23
|
website_section.website_id = @website.id
|
23
24
|
website_section.in_menu = params[:in_menu] == 'yes'
|
24
25
|
website_section.title = params[:title]
|
@@ -34,8 +35,11 @@ module Knitkit
|
|
34
35
|
end
|
35
36
|
|
36
37
|
if params[:type] == "OnlineDocumentSection"
|
37
|
-
documented_content = DocumentedContent.create(:title => website_section.title,
|
38
|
-
|
38
|
+
documented_content = DocumentedContent.create(:title => website_section.title,
|
39
|
+
:created_by => current_user,
|
40
|
+
:body_html => website_section.title)
|
41
|
+
DocumentedItem.create(:documented_content_id => documented_content.id,
|
42
|
+
:online_document_section_id => website_section.id)
|
39
43
|
end
|
40
44
|
|
41
45
|
website_section.update_path!
|
@@ -52,9 +56,11 @@ module Knitkit
|
|
52
56
|
end
|
53
57
|
end
|
54
58
|
rescue => ex
|
55
|
-
# TODO send error notification
|
56
59
|
Rails.logger.error ex.message
|
57
60
|
Rails.logger.error ex.backtrace.join("\n")
|
61
|
+
|
62
|
+
ExceptionNotifier.notify_exception(ex) if defined? ExceptionNotifier
|
63
|
+
|
58
64
|
result = {:success => false, :message => 'Could not create Section'}
|
59
65
|
end
|
60
66
|
|
@@ -65,17 +71,46 @@ module Knitkit
|
|
65
71
|
end
|
66
72
|
end
|
67
73
|
|
74
|
+
def copy
|
75
|
+
begin
|
76
|
+
|
77
|
+
@website = Website.find(params[:website_id])
|
78
|
+
parent_section = WebsiteSection.where('id = ?', params[:parent_section_id]).first
|
79
|
+
section_to_copy = WebsiteSection.find(params[:id])
|
80
|
+
|
81
|
+
new_section = section_to_copy.copy(params[:title].strip, true, true)
|
82
|
+
|
83
|
+
if parent_section
|
84
|
+
new_section.move_to_child_of(parent_section)
|
85
|
+
new_section.save
|
86
|
+
end
|
87
|
+
|
88
|
+
# update all children paths after all are saved.
|
89
|
+
new_section.self_and_descendants.each do |section|
|
90
|
+
section.update_path!
|
91
|
+
end
|
92
|
+
|
93
|
+
result = {:success => true, :parentNodeId => params[:parent_section_id], :node => build_section_hash(new_section)}
|
94
|
+
|
95
|
+
rescue => ex
|
96
|
+
# TODO send error notification
|
97
|
+
Rails.logger.error ex.message
|
98
|
+
Rails.logger.error ex.backtrace.join("\n")
|
99
|
+
|
100
|
+
ExceptionNotifier.notify_exception(ex) if defined? ExceptionNotifier
|
101
|
+
|
102
|
+
result = {:success => false, :message => 'Could not copy Section'}
|
103
|
+
end
|
104
|
+
|
105
|
+
render :json => result
|
106
|
+
end
|
107
|
+
|
68
108
|
def delete
|
69
109
|
begin
|
70
110
|
ActiveRecord::Base.transaction do
|
71
111
|
current_user.with_capability('delete', 'WebsiteSection') do
|
72
112
|
section = WebsiteSection.find(params[:id])
|
73
113
|
|
74
|
-
# we need to remove any content related to this section if it is an OnlineDocumentSection
|
75
|
-
if section.type == 'OnlineDocumentSection'
|
76
|
-
section.website_section_contents.destroy_all
|
77
|
-
end
|
78
|
-
|
79
114
|
render :json => section.destroy ? {:success => true} : {:success => false}
|
80
115
|
end
|
81
116
|
end
|
@@ -91,16 +126,9 @@ module Knitkit
|
|
91
126
|
|
92
127
|
def update_security
|
93
128
|
if current_user.has_capability?('secure', 'WebsiteSection') or current_user.has_capability?('unsecure', 'WebsiteSection')
|
94
|
-
roles = []
|
129
|
+
roles = JSON.parse(params[:security])
|
95
130
|
|
96
|
-
|
97
|
-
params.each do |k, v|
|
98
|
-
if v == 'on'
|
99
|
-
roles.push(k)
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
if roles.empty?
|
131
|
+
if roles.blank? || roles.empty?
|
104
132
|
@website_section.remove_capability(:view)
|
105
133
|
else
|
106
134
|
capability = @website_section.add_capability(:view)
|
@@ -201,7 +229,9 @@ module Knitkit
|
|
201
229
|
|
202
230
|
def available_articles_filter
|
203
231
|
menu = []
|
204
|
-
websites = Website.
|
232
|
+
websites = Website.joins(:website_party_roles)
|
233
|
+
.where('website_party_roles.party_id = ?', current_user.party.dba_organization.id)
|
234
|
+
.where('website_party_roles.role_type_id = ?', RoleType.iid('dba_org')).all
|
205
235
|
all_articles = [{:name => 'All Articles', :id => 0}]
|
206
236
|
orphaned_articles = [{:name => 'Orphaned Articles Only', :id => -1}]
|
207
237
|
|
@@ -220,7 +250,8 @@ module Knitkit
|
|
220
250
|
current_articles = Article.joins(:website_section_contents).where("website_section_id = #{params[:section_id]}").all
|
221
251
|
|
222
252
|
# Defaults to retrieving all articles
|
223
|
-
available_articles = Article.
|
253
|
+
available_articles = Article.with_party_role(current_user.party.dba_organization,
|
254
|
+
RoleType.iid('dba_org')).order('LOWER(contents.internal_identifier) ASC')
|
224
255
|
|
225
256
|
# Orphaned Articles
|
226
257
|
if !website_id.blank? and website_id.to_i == -1
|
@@ -244,7 +275,12 @@ module Knitkit
|
|
244
275
|
"#{self.title} - #{self.path}"
|
245
276
|
end
|
246
277
|
end
|
247
|
-
|
278
|
+
|
279
|
+
if params[:exclude_document_sections].present?
|
280
|
+
render :inline => website.sections.where('type is null').to_json(:only => [:id], :methods => [:title_permalink])
|
281
|
+
else
|
282
|
+
render :inline => website.sections.to_json(:only => [:id], :methods => [:title_permalink])
|
283
|
+
end
|
248
284
|
end
|
249
285
|
|
250
286
|
protected
|
@@ -9,7 +9,13 @@ module Knitkit
|
|
9
9
|
|
10
10
|
def index
|
11
11
|
@online_document = OnlineDocumentSection.find(params[:section_id])
|
12
|
+
end
|
13
|
+
|
14
|
+
def show
|
15
|
+
@online_document = OnlineDocumentSection.find(params[:section_id])
|
12
16
|
@online_document = nil if @online_document.id == find_root.id
|
17
|
+
|
18
|
+
render :show, :layout => false
|
13
19
|
end
|
14
20
|
|
15
21
|
def search
|
@@ -31,8 +37,7 @@ module Knitkit
|
|
31
37
|
end
|
32
38
|
|
33
39
|
def get_content
|
34
|
-
document_section = OnlineDocumentSection.
|
35
|
-
.where(:website_id => @website.id).first
|
40
|
+
document_section = OnlineDocumentSection.find(params[:document_section_id])
|
36
41
|
content = document_section.documented_item_published_content(@active_publication) unless @active_publication.nil?
|
37
42
|
content = document_section.documented_item.content if @active_publication.nil? or content.nil?
|
38
43
|
|
@@ -56,7 +61,8 @@ module Knitkit
|
|
56
61
|
end
|
57
62
|
|
58
63
|
def build_document_hash(document_section)
|
59
|
-
{:id => document_section.
|
64
|
+
{:id => document_section.id,
|
65
|
+
:internalIdentifier => document_section.internal_identifier,
|
60
66
|
:title => document_section.title,
|
61
67
|
:leaf => document_section.leaf,
|
62
68
|
:iconCls => (document_section.leaf ? 'icon-documentation-document' : 'icon-documentation-multi-document'),
|
@@ -1,11 +1,19 @@
|
|
1
|
+
|
1
2
|
class WebsiteInquiryMailer < ActionMailer::Base
|
3
|
+
acts_as_themed_mailer
|
4
|
+
|
5
|
+
default :from => ErpTechSvcs::Config.email_notifications_from
|
6
|
+
|
7
|
+
def inquiry(website_inquiry, dba_organization=nil)
|
8
|
+
# add theme paths if a website is present
|
9
|
+
if website_inquiry.website
|
10
|
+
add_theme_view_paths(website_inquiry.website)
|
11
|
+
end
|
2
12
|
|
3
|
-
def inquiry(website_inquiry)
|
4
13
|
subject = "#{website_inquiry.website.title} Inquiry"
|
5
14
|
@website_inquiry = website_inquiry
|
6
|
-
|
15
|
+
|
7
16
|
mail(:to => website_inquiry.website.configurations.first.get_item(ConfigurationItemType.find_by_internal_identifier('contact_us_email_address')).options.first.value,
|
8
|
-
:from => website_inquiry.email,
|
9
17
|
:subject => subject,
|
10
18
|
:content_type => 'text/html'
|
11
19
|
)
|
data/app/models/content.rb
CHANGED
@@ -3,6 +3,8 @@ require 'will_paginate/array'
|
|
3
3
|
class Content < ActiveRecord::Base
|
4
4
|
attr_protected :created_at, :updated_at
|
5
5
|
|
6
|
+
has_party_roles
|
7
|
+
|
6
8
|
extend FriendlyId
|
7
9
|
friendly_id :title, :use => [:slugged], :slug_column => :permalink
|
8
10
|
|
@@ -14,7 +16,16 @@ class Content < ActiveRecord::Base
|
|
14
16
|
|
15
17
|
acts_as_taggable
|
16
18
|
acts_as_commentable
|
17
|
-
acts_as_versioned :table_name => :content_versions
|
19
|
+
acts_as_versioned :table_name => :content_versions do
|
20
|
+
def excerpt_html
|
21
|
+
if attributes['excerpt_html'].blank?
|
22
|
+
HTML_Truncator.truncate(attributes['body_html'], 25)
|
23
|
+
else
|
24
|
+
attributes['excerpt_html']
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
18
29
|
can_be_published
|
19
30
|
|
20
31
|
has_many :website_section_contents, :dependent => :destroy
|
@@ -45,7 +56,7 @@ class Content < ActiveRecord::Base
|
|
45
56
|
end
|
46
57
|
|
47
58
|
predicate = predicate.where("(UPPER(contents.title) LIKE UPPER('%#{options[:query]}%')
|
48
|
-
OR UPPER(contents.excerpt_html) LIKE UPPER('%#{options[:query]}%')
|
59
|
+
OR UPPER(contents.excerpt_html) LIKE UPPER('%#{options[:query]}%')
|
49
60
|
OR UPPER(contents.body_html) LIKE UPPER('%#{options[:query]}%') )").order("contents.created_at DESC")
|
50
61
|
|
51
62
|
if options[:page]
|
@@ -68,11 +79,11 @@ class Content < ActiveRecord::Base
|
|
68
79
|
end
|
69
80
|
|
70
81
|
def self.find_by_section_id(website_section_id)
|
71
|
-
Content.joins(:website_section_contents).where('website_section_id = ?', website_section_id).order("website_section_contents.position ASC, website_section_contents.created_at DESC")
|
82
|
+
Content.joins(:website_section_contents).where('website_section_id = ?', website_section_id).order("website_section_contents.position ASC, website_section_contents.created_at DESC")
|
72
83
|
end
|
73
84
|
|
74
85
|
def self.find_by_section_id_filtered_by_id(website_section_id, id_filter_list)
|
75
|
-
Content.joins(:website_section_contents).where("website_section_id = ? AND contents.id IN (#{id_filter_list.join(',')})", website_section_id)
|
86
|
+
Content.joins(:website_section_contents).where("website_section_id = ? AND contents.id IN (#{id_filter_list.join(',')})", website_section_id)
|
76
87
|
end
|
77
88
|
|
78
89
|
def self.find_published_by_section(active_publication, website_section)
|
@@ -103,8 +114,7 @@ class Content < ActiveRecord::Base
|
|
103
114
|
end
|
104
115
|
|
105
116
|
def position(website_section_id)
|
106
|
-
|
107
|
-
position
|
117
|
+
self.website_section_contents.find_by_website_section_id(website_section_id).position
|
108
118
|
end
|
109
119
|
|
110
120
|
def get_comments(limit)
|
@@ -2,7 +2,9 @@ class DocumentedItem < ActiveRecord::Base
|
|
2
2
|
attr_protected :created_at, :updated_at
|
3
3
|
|
4
4
|
belongs_to :online_document_section
|
5
|
-
|
5
|
+
|
6
|
+
before_destroy :destroy_content
|
7
|
+
|
6
8
|
def content
|
7
9
|
if content?
|
8
10
|
Content.find(documented_content_id)
|
@@ -30,4 +32,13 @@ class DocumentedItem < ActiveRecord::Base
|
|
30
32
|
def self.find_by_section_id( website_section_id )
|
31
33
|
DocumentedItem.where(["online_document_section_id = ?", website_section_id]).first
|
32
34
|
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def destroy_content
|
39
|
+
if content?
|
40
|
+
Content.find(documented_content_id).destroy
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
33
44
|
end
|
@@ -8,32 +8,66 @@ class OnlineDocumentSection < WebsiteSection
|
|
8
8
|
rescue
|
9
9
|
nil
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
def documented_item_published_content_html(active_publication)
|
13
13
|
documented_item_published_content(active_publication).body_html
|
14
14
|
rescue
|
15
15
|
nil
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
|
+
def copy(title=nil, copy_children=false, created_by=nil)
|
19
|
+
new_section = OnlineDocumentSection.new
|
20
|
+
|
21
|
+
new_section.title = title.nil? ? self.title : title
|
22
|
+
new_section.layout = self.layout
|
23
|
+
new_section.in_menu = self.in_menu
|
24
|
+
new_section.use_markdown = self.use_markdown
|
25
|
+
new_section.render_base_layout = self.render_base_layout
|
26
|
+
new_section.website_id = self.website_id
|
27
|
+
|
28
|
+
new_section.save!
|
29
|
+
|
30
|
+
# copy documented content
|
31
|
+
documented_item = DocumentedItem.where('online_document_section_id = ?', self.id).first
|
32
|
+
documented_content = DocumentedContent.find(documented_item.documented_content_id)
|
33
|
+
new_documented_content = documented_content.dup
|
34
|
+
|
35
|
+
# clear out internal identifier
|
36
|
+
new_documented_content.internal_identifier = nil
|
37
|
+
|
38
|
+
new_documented_content.created_by = created_by
|
39
|
+
new_documented_content.save!
|
40
|
+
DocumentedItem.create!(:documented_content_id => new_documented_content.id, :online_document_section_id => new_section.id)
|
41
|
+
|
42
|
+
if copy_children
|
43
|
+
self.children.each do |child_section|
|
44
|
+
new_child_section = child_section.copy(nil, copy_children, created_by)
|
45
|
+
new_child_section.move_to_child_of(new_section)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
new_section
|
50
|
+
end
|
51
|
+
|
18
52
|
def build_section_hash
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
53
|
+
{
|
54
|
+
:name => self.title,
|
55
|
+
:has_layout => false,
|
56
|
+
:use_markdown => self.use_markdown,
|
57
|
+
:type => self.class.to_s,
|
58
|
+
:in_menu => self.in_menu,
|
59
|
+
:path => self.path,
|
60
|
+
:permalink => self.permalink,
|
61
|
+
:internal_identifier => self.internal_identifier,
|
62
|
+
:position => self.position,
|
63
|
+
:online_document_sections => self.children.each.map { |child| child.build_section_hash },
|
64
|
+
:articles => [],
|
65
|
+
:documented_item => {
|
66
|
+
:name => documented_item_content.title,
|
67
|
+
:display_title => documented_item_content.display_title,
|
68
|
+
:internal_identifier => documented_item_content.internal_identifier
|
69
|
+
}
|
36
70
|
}
|
37
|
-
section_hash
|
38
71
|
end
|
72
|
+
|
39
73
|
end
|