knitkit 2.1.15 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 35f3ceea0007821006cbca76128f3c66aea5eff0
|
4
|
+
data.tar.gz: 391fe91b89b348a7700d28f9764c959a8028d8d0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 21e28ca0baca8b9f90e040a47ffa9a68f6279b3b3970b3c50463894933aaa830b622140c7146175f5b9369aee14b526778b1e5fd9e6c2b8414d3316b04140ffc
|
7
|
+
data.tar.gz: 73a2a52a625f305e5382ed4131e471839e81ce5fd844e1cc7ea8aad4b9fbb5e5d0e3dea631f298e5f870f3e01231c4ddf9eb6457a9c3d5a54a3519090f5fc8f3
|
@@ -7,12 +7,17 @@ module Knitkit
|
|
7
7
|
|
8
8
|
@comment = content.add_comment({:commentor_name => user.party.description, :email => user.email, :comment => comment})
|
9
9
|
|
10
|
-
|
10
|
+
if @comment.valid?
|
11
|
+
render :json => {:success => true, :message => 'Comment pending approval'}
|
12
|
+
else
|
13
|
+
render :json => {:success => false, :message => 'Error. Comment cannot be blank'}
|
14
|
+
end
|
11
15
|
end
|
12
16
|
|
13
17
|
#no section to set
|
14
18
|
def set_section
|
15
|
-
|
19
|
+
false
|
16
20
|
end
|
21
|
+
|
17
22
|
end
|
18
23
|
end
|
@@ -5,66 +5,18 @@ module Knitkit
|
|
5
5
|
KNIT_KIT_ROOT = Knitkit::Engine.root.to_s
|
6
6
|
|
7
7
|
def available_roles
|
8
|
-
render :json => {:success => true, :availableRoles => SecurityRole.order('description ASC').all.collect{|role| role.to_hash(:only => [:internal_identifier, :description])}}
|
8
|
+
render :json => {:success => true, :availableRoles => SecurityRole.order('description ASC').all.collect { |role| role.to_hash(:only => [:internal_identifier, :description]) }}
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
websites = Website.order('name ASC').all
|
13
|
-
|
14
|
-
tree = []
|
15
|
-
websites.each do |website|
|
16
|
-
@website_primary_host = website.config_value('primary_host')
|
17
|
-
|
18
|
-
website_hash = {
|
19
|
-
:text => website.name,
|
20
|
-
:configurationId => website.configurations.first.id,
|
21
|
-
:iconCls => 'icon-globe_disconnected',
|
22
|
-
:id => "website_#{website.id}",
|
23
|
-
:leaf => false,
|
24
|
-
:url => "http://#{@website_primary_host}",
|
25
|
-
:name => website.name,
|
26
|
-
:title => website.title,
|
27
|
-
:subtitle => website.subtitle,
|
28
|
-
:isWebsite => true,
|
29
|
-
:siteName => website.name,
|
30
|
-
:children => []
|
31
|
-
}
|
32
|
-
|
33
|
-
#handle hosts
|
34
|
-
hosts_hash = {:text => 'Hosts', :iconCls => 'icon-gear', :isHostRoot => true, :websiteId => website.id, :leaf => false, :children => []}
|
35
|
-
website.hosts.each do |website_host|
|
36
|
-
hosts_hash[:children] << {:text => website_host.attributes['host'], :websiteHostId => website_host.id, :host => website_host.attributes['host'], :iconCls => 'icon-globe', :url => "http://#{website_host.attributes['host']}", :isHost => true, :leaf => true, :children => []}
|
37
|
-
end
|
38
|
-
|
39
|
-
website_hash[:children] << hosts_hash
|
40
|
-
|
41
|
-
#handle sections
|
42
|
-
sections_hash = {:text => 'Sections', :isSectionRoot => true, :websiteId => website.id, :iconCls => 'icon-content', :leaf => false, :children => []}
|
43
|
-
website.website_sections.positioned.each do |website_section|
|
44
|
-
sections_hash[:children] << build_section_hash(website_section, website)
|
45
|
-
end
|
46
|
-
|
47
|
-
website_hash[:children] << sections_hash
|
48
|
-
|
49
|
-
#handle menus
|
50
|
-
menus_hash = {:text => 'Menus', :iconCls => 'icon-content', :isMenuRoot => true, :websiteId => website.id, :leaf => false, :children => []}
|
51
|
-
website.website_navs.each do |website_nav|
|
52
|
-
menu_hash = {:text => website_nav.name, :websiteNavId => website_nav.id, :websiteId => website.id, :canAddMenuItems => true, :iconCls => 'icon-index', :isWebsiteNav => true, :leaf => false, :children => []}
|
53
|
-
menu_hash[:children] = website_nav.website_nav_items.positioned.map{|item|build_menu_item_hash(website, item)}
|
54
|
-
menus_hash[:children] << menu_hash
|
55
|
-
end
|
56
|
-
|
57
|
-
website_hash[:children] << menus_hash
|
11
|
+
protected
|
58
12
|
|
59
|
-
|
60
|
-
|
13
|
+
def set_website
|
14
|
+
if params[:website_id]
|
15
|
+
@website = Website.find(params[:website_id])
|
16
|
+
@website_primary_host = @website.nil? ? nil : @website.config_value('primary_host')
|
61
17
|
end
|
62
|
-
|
63
|
-
render :json => tree
|
64
18
|
end
|
65
19
|
|
66
|
-
protected
|
67
|
-
|
68
20
|
def page
|
69
21
|
offset = params[:start].to_f
|
70
22
|
offset > 0 ? ((offset / params[:limit].to_f).to_i + 1) : 1
|
@@ -74,7 +26,7 @@ module Knitkit
|
|
74
26
|
params[:limit].nil? ? 20 : params[:limit].to_i
|
75
27
|
end
|
76
28
|
|
77
|
-
def build_menu_item_hash(
|
29
|
+
def build_menu_item_hash(item)
|
78
30
|
url = item.url
|
79
31
|
linked_to_item_id = nil
|
80
32
|
link_to_type = 'url'
|
@@ -85,69 +37,97 @@ module Knitkit
|
|
85
37
|
end
|
86
38
|
|
87
39
|
menu_item_hash = {
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
:leaf => false
|
40
|
+
:text => item.title,
|
41
|
+
:linkToType => link_to_type,
|
42
|
+
:canAddMenuItems => true,
|
43
|
+
:isSecured => item.is_secured?,
|
44
|
+
:roles => item.roles.collect { |item| item.internal_identifier },
|
45
|
+
:linkedToId => linked_to_item_id,
|
46
|
+
:websiteNavItemId => item.id,
|
47
|
+
:url => url,
|
48
|
+
:iconCls => item.is_secured? ? 'icon-document_lock' : 'icon-document',
|
49
|
+
:isWebsiteNavItem => true,
|
50
|
+
:leaf => false
|
100
51
|
}
|
101
52
|
|
102
|
-
menu_item_hash[:children] = item.positioned_children.map{ |child| build_menu_item_hash(
|
53
|
+
menu_item_hash[:children] = item.positioned_children.map { |child| build_menu_item_hash(child) }
|
103
54
|
|
104
55
|
menu_item_hash
|
105
56
|
end
|
106
57
|
|
107
|
-
def build_section_hash(website_section
|
58
|
+
def build_section_hash(website_section)
|
108
59
|
website_section_hash = {
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
60
|
+
recordType: 'WebsiteSection',
|
61
|
+
recordId: website_section.id,
|
62
|
+
:text => website_section.title,
|
63
|
+
:path => website_section.path,
|
64
|
+
:siteName => @website.name,
|
65
|
+
:siteId => @website.id,
|
66
|
+
:type => website_section.type,
|
67
|
+
:isSecured => website_section.is_secured?,
|
68
|
+
:roles => website_section.roles.collect { |item| item.internal_identifier },
|
69
|
+
:isSection => website_section.is_section?,
|
70
|
+
:isDocument => website_section.is_document_section?,
|
71
|
+
:useMarkdown => website_section.use_markdown,
|
72
|
+
:inMenu => website_section.in_menu,
|
73
|
+
:renderWithBaseLayout => website_section.render_base_layout?,
|
74
|
+
:hasLayout => !website_section.layout.blank?,
|
75
|
+
:id => "section_#{website_section.id}",
|
76
|
+
:url => "http://#{@website_primary_host}#{website_section.path}",
|
77
|
+
:internal_identifier => website_section.internal_identifier
|
78
|
+
|
125
79
|
}
|
126
|
-
|
80
|
+
|
81
|
+
if website_section.is_a?(OnlineDocumentSection) || website_section.type == 'OnlineDocumentSection'
|
127
82
|
document_section = OnlineDocumentSection.find(website_section.id)
|
128
83
|
if document_section.documented_item and document_section.documented_item_content
|
129
84
|
website_section_hash[:contentInfo] = document_section.documented_item_content.content_hash
|
130
85
|
end
|
131
|
-
end
|
86
|
+
end
|
132
87
|
|
133
|
-
if website_section.
|
88
|
+
if website_section.is_blog?
|
89
|
+
website_section_hash[:objectType] = 'Blog'
|
134
90
|
website_section_hash[:isBlog] = true
|
135
91
|
website_section_hash[:iconCls] = 'icon-blog'
|
136
|
-
website_section_hash[:leaf] =
|
92
|
+
website_section_hash[:leaf] = false
|
137
93
|
else
|
138
94
|
website_section_hash[:leaf] = false
|
139
|
-
website_section_hash[:
|
140
|
-
website_section_hash[:isSecured] ? website_section_hash[:iconCls] = 'icon-document_lock' : website_section_hash[:iconCls] = 'icon-document'
|
95
|
+
website_section_hash[:isSecured] ? website_section_hash[:iconCls] = 'icon-section_lock' : website_section_hash[:iconCls] = 'icon-section'
|
141
96
|
end
|
142
|
-
|
143
|
-
if
|
97
|
+
|
98
|
+
if website_section.is_a?(OnlineDocumentSection) || website_section.type == 'OnlineDocumentSection'
|
144
99
|
website_section_hash[:iconCls] = 'icon-document_info'
|
145
100
|
end
|
146
101
|
|
147
102
|
website_section_hash
|
148
103
|
end
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
104
|
+
|
105
|
+
def build_article_hash(website_section_content, website, can_edit_excerpt=false)
|
106
|
+
website_section = website_section_content.website_section
|
107
|
+
content = website_section_content.content
|
108
|
+
|
109
|
+
{
|
110
|
+
recordType: 'Article',
|
111
|
+
recordId: website_section_content.id,
|
112
|
+
:objectType => "Article",
|
113
|
+
:id => content.id,
|
114
|
+
:siteId => website.id,
|
115
|
+
:content_area => website_section_content.content_area,
|
116
|
+
:parentItemId => website_section.id,
|
117
|
+
:canEditExcerpt => can_edit_excerpt,
|
118
|
+
:tag_list => content.tags.join(', '),
|
119
|
+
:text => content.title,
|
120
|
+
:position => content.position(website_section.id),
|
121
|
+
:display_title => content.display_title,
|
122
|
+
:internal_identifier => content.internal_identifier,
|
123
|
+
:iconCls => 'icon-article',
|
124
|
+
:created_at => content.created_at,
|
125
|
+
:updated_at => content.updated_at,
|
126
|
+
:leaf => true
|
127
|
+
}
|
128
|
+
end
|
129
|
+
|
130
|
+
end #AppController
|
131
|
+
end #Desktop
|
132
|
+
end #ErpApp
|
133
|
+
end #Knitkit
|
@@ -5,34 +5,47 @@ module Knitkit
|
|
5
5
|
@@datetime_format = "%m/%d/%Y %l:%M%P"
|
6
6
|
|
7
7
|
def new
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
8
|
+
ActiveRecord::Base.transaction do
|
9
|
+
begin
|
10
|
+
current_user.with_capability('create', 'Content') do
|
11
|
+
result = {}
|
12
|
+
website_section_id = params[:section_id]
|
13
|
+
article = Article.new
|
14
|
+
|
15
|
+
article.tag_list = params[:tags].split(',').collect { |t| t.strip } unless params[:tags].blank?
|
16
|
+
article.title = params[:title]
|
17
|
+
article.internal_identifier = params[:internal_identifier]
|
18
|
+
article.display_title = params[:display_title] == 'yes'
|
19
|
+
article.created_by = current_user
|
20
|
+
|
21
|
+
if article.save
|
22
|
+
result[:node] = if website_section_id.blank?
|
23
|
+
{:text => params[:title],
|
24
|
+
:id => article.id,
|
25
|
+
:objectType => 'Article',
|
26
|
+
:parentItemId => params[:section_id],
|
27
|
+
:siteId => nil,
|
28
|
+
:iconCls => 'x-column-header-wysiwyg',
|
29
|
+
:leaf => true
|
30
|
+
}
|
31
|
+
else
|
32
|
+
website_section = WebsiteSection.find(website_section_id)
|
33
|
+
article.website_sections << website_section
|
34
|
+
website_section_content = article.update_content_area_and_position_by_section(website_section, params['content_area'], params['position'])
|
35
|
+
|
36
|
+
build_article_hash(website_section_content, website_section.website, website_section.is_blog?)
|
37
|
+
end
|
38
|
+
|
39
|
+
result[:success] = true
|
40
|
+
else
|
41
|
+
result[:success] = false
|
25
42
|
end
|
26
43
|
|
27
|
-
|
28
|
-
else
|
29
|
-
result[:success] = false
|
44
|
+
render :json => result
|
30
45
|
end
|
31
|
-
|
32
|
-
render :json =>
|
46
|
+
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
47
|
+
render :json => {:success => false, :message => ex.message}
|
33
48
|
end
|
34
|
-
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability=>ex
|
35
|
-
render :json => {:success => false, :message => ex.message}
|
36
49
|
end
|
37
50
|
end
|
38
51
|
|
@@ -43,7 +56,7 @@ module Knitkit
|
|
43
56
|
website_section_id = params[:section_id]
|
44
57
|
article = Article.find(params[:id])
|
45
58
|
|
46
|
-
article.tag_list = params[:tags].split(',').collect{|t| t.strip
|
59
|
+
article.tag_list = params[:tags].split(',').collect { |t| t.strip } unless params[:tags].blank?
|
47
60
|
article.title = params[:title]
|
48
61
|
article.internal_identifier = params[:internal_identifier]
|
49
62
|
article.display_title = params[:display_title] == 'yes'
|
@@ -62,7 +75,7 @@ module Knitkit
|
|
62
75
|
|
63
76
|
render :json => result
|
64
77
|
end
|
65
|
-
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability=>ex
|
78
|
+
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
66
79
|
render :json => {:success => false, :message => ex.message}
|
67
80
|
end
|
68
81
|
end
|
@@ -72,7 +85,7 @@ module Knitkit
|
|
72
85
|
current_user.with_capability('delete', 'Content') do
|
73
86
|
render :json => Article.destroy(params[:id]) ? {:success => true} : {:success => false}
|
74
87
|
end
|
75
|
-
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability=>ex
|
88
|
+
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
76
89
|
render :json => {:success => false, :message => ex.message}
|
77
90
|
end
|
78
91
|
end
|
@@ -82,10 +95,13 @@ module Knitkit
|
|
82
95
|
current_user.with_capability('add_existing', 'Content') do
|
83
96
|
website_section = WebsiteSection.find(params[:section_id])
|
84
97
|
website_section.contents << Article.find(params[:article_id])
|
98
|
+
website_section.save
|
85
99
|
|
86
|
-
|
100
|
+
website_section_content = website_section.website_section_contents.where('content_id = ?', params[:article_id]).first
|
101
|
+
|
102
|
+
render :json => {:success => true, :article => build_article_hash(website_section_content, website_section.website, website_section.is_blog?)}
|
87
103
|
end
|
88
|
-
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability=>ex
|
104
|
+
rescue ErpTechSvcs::Utils::CompassAccessNegotiator::Errors::UserDoesNotHaveCapability => ex
|
89
105
|
render :json => {:success => false, :message => ex.message}
|
90
106
|
end
|
91
107
|
end
|
@@ -94,6 +110,11 @@ module Knitkit
|
|
94
110
|
render :inline => Article.all.to_json(:only => [:internal_identifier, :id])
|
95
111
|
end
|
96
112
|
|
113
|
+
def show
|
114
|
+
article = Article.find(params[:section_id])
|
115
|
+
render :json => article.to_json
|
116
|
+
end
|
117
|
+
|
97
118
|
def get
|
98
119
|
website_section_id = params[:section_id]
|
99
120
|
section = WebsiteSection.find(website_section_id)
|
@@ -108,7 +129,7 @@ module Knitkit
|
|
108
129
|
|
109
130
|
sort_hash = params[:sort].blank? ? {} : Hash.symbolize_keys(JSON.parse(params[:sort]).first)
|
110
131
|
sort = sort_hash[:property] || sort_default
|
111
|
-
dir
|
132
|
+
dir = sort_hash[:direction] || dir_default
|
112
133
|
limit = params[:limit] || 10
|
113
134
|
start = params[:start] || 0
|
114
135
|
|
@@ -118,6 +139,7 @@ module Knitkit
|
|
118
139
|
|
119
140
|
Article.class_exec(website_section_id) do
|
120
141
|
@@website_section_id = website_section_id
|
142
|
+
|
121
143
|
def website_section_position
|
122
144
|
self.website_section_contents.find_by_website_section_id(@@website_section_id).position
|
123
145
|
end
|
@@ -130,8 +152,6 @@ module Knitkit
|
|
130
152
|
articles_hash[:id] = a.id
|
131
153
|
articles_hash[:title] = a.title
|
132
154
|
articles_hash[:tag_list] = a.tag_list.join(', ')
|
133
|
-
articles_hash[:body_html] = a.body_html
|
134
|
-
articles_hash[:excerpt_html] = a.excerpt_html
|
135
155
|
articles_hash[:internal_identifier] = a.internal_identifier
|
136
156
|
articles_hash[:display_title] = a.display_title
|
137
157
|
articles_hash[:position] = a.position(website_section_id)
|
@@ -147,12 +167,12 @@ module Knitkit
|
|
147
167
|
Article.include_root_in_json = false
|
148
168
|
sort_hash = params[:sort].blank? ? {} : Hash.symbolize_keys(JSON.parse(params[:sort]).first)
|
149
169
|
sort = sort_hash[:property] || 'title'
|
150
|
-
dir
|
170
|
+
dir = sort_hash[:direction] || 'ASC'
|
151
171
|
limit = params[:limit] || 20
|
152
172
|
start = params[:start] || 0
|
153
173
|
|
154
|
-
articles = Article.includes(:website_section_contents)
|
155
|
-
articles = articles.where(
|
174
|
+
articles = Article.includes(:website_section_contents)
|
175
|
+
articles = articles.where(:website_section_contents => {:content_id => nil}) if params[:show_orphaned] == 'true'
|
156
176
|
articles = articles.where("UPPER(contents.internal_identifier) LIKE UPPER('%#{params[:iid]}%')") unless params[:iid].blank?
|
157
177
|
articles = articles.where("UPPER(contents.title) LIKE UPPER('%#{params[:title]}%')") unless params[:title].blank?
|
158
178
|
articles = articles.where("UPPER(contents.body_html) LIKE UPPER('%#{params[:content]}%')
|
@@ -165,7 +185,7 @@ module Knitkit
|
|
165
185
|
articles.each do |a|
|
166
186
|
articles_hash = {}
|
167
187
|
articles_hash[:id] = a.id
|
168
|
-
articles_hash[:sections] = a.website_sections.collect{|section| section.title}.join(',')
|
188
|
+
articles_hash[:sections] = a.website_sections.collect { |section| section.title }.join(',')
|
169
189
|
articles_hash[:title] = a.title
|
170
190
|
articles_hash[:tag_list] = a.tag_list.join(', ')
|
171
191
|
articles_hash[:body_html] = a.body_html
|
@@ -187,7 +207,7 @@ module Knitkit
|
|
187
207
|
def article_attributes
|
188
208
|
sort_hash = params[:sort].blank? ? {} : Hash.symbolize_keys(JSON.parse(params[:sort]).first)
|
189
209
|
sort = sort_hash[:property] || 'created_at'
|
190
|
-
dir
|
210
|
+
dir = sort_hash[:direction] || 'DESC'
|
191
211
|
limit = params[:limit] || 40
|
192
212
|
start = params[:start] || 0
|
193
213
|
|
@@ -197,15 +217,15 @@ module Knitkit
|
|
197
217
|
|
198
218
|
if dir == "DESC"
|
199
219
|
if sort == "data_type" or sort == "description"
|
200
|
-
attributes = attributes.sort {|x,y| x.attribute_type.send(sort) <=> y.attribute_type.send(sort)}
|
220
|
+
attributes = attributes.sort { |x, y| x.attribute_type.send(sort) <=> y.attribute_type.send(sort) }
|
201
221
|
else
|
202
|
-
attributes = attributes.sort {|x,y| x.send(sort) <=> y.send(sort)}
|
222
|
+
attributes = attributes.sort { |x, y| x.send(sort) <=> y.send(sort) }
|
203
223
|
end
|
204
224
|
else
|
205
225
|
if sort == "data_type" or sort == "description"
|
206
|
-
attributes = attributes.sort {|x,y| y.attribute_type.send(sort) <=> x.attribute_type.send(sort)}
|
226
|
+
attributes = attributes.sort { |x, y| y.attribute_type.send(sort) <=> x.attribute_type.send(sort) }
|
207
227
|
else
|
208
|
-
attributes = attributes.sort {|x,y| y.send(sort) <=> x.send(sort)}
|
228
|
+
attributes = attributes.sort { |x, y| y.send(sort) <=> x.send(sort) }
|
209
229
|
end
|
210
230
|
end
|
211
231
|
|
@@ -277,8 +297,8 @@ module Knitkit
|
|
277
297
|
render :json => result
|
278
298
|
end
|
279
299
|
|
280
|
-
end#ArticlesController
|
281
|
-
end#Desktop
|
282
|
-
end#ErpApp
|
283
|
-
end#Knitkit
|
300
|
+
end #ArticlesController
|
301
|
+
end #Desktop
|
302
|
+
end #ErpApp
|
303
|
+
end #Knitkit
|
284
304
|
|