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
@@ -1,134 +0,0 @@
|
|
1
|
-
# Methods added to this helper will be available to all templates in the application.
|
2
|
-
=begin
|
3
|
-
module ApplicationHelper
|
4
|
-
def theme_stylesheet_path(theme, source)
|
5
|
-
theme = @controller.website.themes.find_by_theme_id(theme) unless theme.is_a?(Theme)
|
6
|
-
theme_compute_public_path(theme, source, theme.url + '/stylesheets', 'css')
|
7
|
-
end
|
8
|
-
alias_method :theme_path_to_stylesheet, :theme_stylesheet_path
|
9
|
-
|
10
|
-
def theme_stylesheet_link_tag(theme_id, *sources)
|
11
|
-
theme = @controller.website.themes.find_by_theme_id(theme_id)
|
12
|
-
return("could not find theme with the id #{theme_id}") unless theme
|
13
|
-
|
14
|
-
options = sources.extract_options!.stringify_keys
|
15
|
-
cache = options.delete("cache")
|
16
|
-
recursive = options.delete("recursive")
|
17
|
-
|
18
|
-
if ActionController::Base.perform_caching && cache
|
19
|
-
joined_stylesheet_name = (cache == true ? "all" : cache) + ".css"
|
20
|
-
joined_stylesheet_path = File.join(theme.path + '/stylesheets', joined_stylesheet_name)
|
21
|
-
|
22
|
-
paths = theme_compute_stylesheet_paths(theme, sources, recursive)
|
23
|
-
theme_write_asset_file_contents(theme, joined_stylesheet_path, paths) unless File.exists?(joined_stylesheet_path)
|
24
|
-
theme_stylesheet_tag(theme, joined_stylesheet_name, options)
|
25
|
-
else
|
26
|
-
theme_expand_stylesheet_sources(theme, sources, recursive).collect do |source|
|
27
|
-
theme_stylesheet_tag(theme, source, options)
|
28
|
-
end.join("\n")
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def theme_javascript_path(theme, source)
|
33
|
-
theme = @controller.website.themes.find_by_theme_id(theme) unless theme.is_a?(Theme)
|
34
|
-
theme_compute_public_path(theme, source, theme.url + '/javascripts', 'js')
|
35
|
-
end
|
36
|
-
alias_method :theme_path_to_javascript, :theme_javascript_path
|
37
|
-
|
38
|
-
def theme_javascript_include_tag(theme_id, *sources)
|
39
|
-
theme = @controller.website.themes.find_by_theme_id(theme_id)
|
40
|
-
return("could not find theme with the id #{theme_id}") unless theme
|
41
|
-
|
42
|
-
options = sources.extract_options!.stringify_keys
|
43
|
-
cache = options.delete("cache")
|
44
|
-
recursive = options.delete("recursive")
|
45
|
-
|
46
|
-
if ActionController::Base.perform_caching && cache
|
47
|
-
joined_javascript_name = (cache == true ? "all" : cache) + ".js"
|
48
|
-
joined_javascript_path = File.join(theme.path + '/javascripts', joined_javascript_name)
|
49
|
-
|
50
|
-
paths = theme_compute_javascript_paths(theme, sources, recursive)
|
51
|
-
theme_write_asset_file_contents(theme, joined_javascript_path, paths) unless File.exists?(joined_javascript_path)
|
52
|
-
theme_javascript_src_tag(theme, joined_javascript_name, options)
|
53
|
-
else
|
54
|
-
theme_expand_javascript_sources(theme, sources, recursive).collect do |source|
|
55
|
-
theme_javascript_src_tag(theme, source, options)
|
56
|
-
end.join("\n")
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
private
|
61
|
-
def theme_compute_public_path(theme, source, dir, ext = nil, include_host = true)
|
62
|
-
has_request = @controller.respond_to?(:request)
|
63
|
-
|
64
|
-
if ext && (File.extname(source).blank? || File.exist?(File.join(theme.path, dir, "#{source}.#{ext}")))
|
65
|
-
source += ".#{ext}"
|
66
|
-
end
|
67
|
-
|
68
|
-
unless source =~ %r{^[-a-z]+://}
|
69
|
-
source = "/#{dir}/#{source}" unless source[0] == ?/
|
70
|
-
|
71
|
-
source = theme_rewrite_asset_path(theme, source)
|
72
|
-
|
73
|
-
if has_request && include_host
|
74
|
-
unless source =~ %r{^#{ActionController::Base.relative_url_root}/}
|
75
|
-
source = "#{ActionController::Base.relative_url_root}#{source}"
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
if include_host && source !~ %r{^[-a-z]+://}
|
81
|
-
host = compute_asset_host(source)
|
82
|
-
|
83
|
-
if has_request && host.present? && host !~ %r{^[-a-z]+://}
|
84
|
-
host = "#{@controller.request.protocol}#{host}"
|
85
|
-
end
|
86
|
-
|
87
|
-
"#{host}#{source}"
|
88
|
-
else
|
89
|
-
source
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
def theme_stylesheet_tag(theme, source, options)
|
94
|
-
options = { "rel" => "stylesheet", "type" => Mime::CSS, "media" => "screen",
|
95
|
-
"href" => html_escape(theme_path_to_stylesheet(theme, source)) }.merge(options)
|
96
|
-
tag("link", options, false, false)
|
97
|
-
end
|
98
|
-
|
99
|
-
def theme_javascript_src_tag(theme, source, options)
|
100
|
-
options = { "type" => Mime::JS, "src" => theme_path_to_javascript(theme, source) }.merge(options)
|
101
|
-
content_tag("script", "", options)
|
102
|
-
end
|
103
|
-
|
104
|
-
def theme_compute_stylesheet_paths(theme, *args)
|
105
|
-
theme_expand_stylesheet_sources(theme, *args).collect do |source|
|
106
|
-
theme_compute_public_path(theme, source, theme.url + '/stylesheets', 'css', false)
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
def theme_compute_javascript_paths(theme, *args)
|
111
|
-
theme_expand_javascript_sources(theme, *args).collect do |source|
|
112
|
-
theme_compute_public_path(theme, source, theme.url + '/javascripts', 'js', false)
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
def theme_expand_javascript_sources(theme, sources, recursive = false)
|
117
|
-
if sources.include?(:all)
|
118
|
-
all_javascript_files = collect_asset_files(theme.path + '/javascripts', ('**' if recursive), '*.js').uniq
|
119
|
-
else
|
120
|
-
sources.collect { |source| determine_source(source, {}) }.flatten
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
def theme_expand_stylesheet_sources(theme, sources, recursive)
|
125
|
-
if sources.first == :all
|
126
|
-
collect_asset_files(theme.path + '/stylesheets', ('**' if recursive), '*.css')
|
127
|
-
else
|
128
|
-
sources.collect do |source|
|
129
|
-
determine_source(source, {})
|
130
|
-
end.flatten
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
134
|
-
=end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
<%if !menu_items.nil? && menu_items.count > 0%>
|
2
|
-
<div id="side_menu_container">
|
3
|
-
<ul id="side_menu">
|
4
|
-
<%
|
5
|
-
menu_items.each do |menu_item|
|
6
|
-
if menu_item.allow_access?(@current_user, :view)
|
7
|
-
if menu_item_selected(menu_item) %>
|
8
|
-
<li class="selected">
|
9
|
-
<% selected_menu_item = menu_item
|
10
|
-
else %>
|
11
|
-
<li>
|
12
|
-
<% end %>
|
13
|
-
<a href="<%= menu_item.path %>"><span><%= menu_item.title %></span></a>
|
14
|
-
</li>
|
15
|
-
|
16
|
-
<% unless selected_menu_item.nil? %>
|
17
|
-
<% unless selected_menu_item.positioned_children.nil? %>
|
18
|
-
<ul class="side_menu_children">
|
19
|
-
<% selected_menu_item.positioned_children.each do |child_menu_item|
|
20
|
-
if child_menu_item.allow_access?(@current_user, :view)
|
21
|
-
if menu_item_selected(child_menu_item) %>
|
22
|
-
<li class="selected">
|
23
|
-
<% else %>
|
24
|
-
<li>
|
25
|
-
<% end %>
|
26
|
-
<a href="<%= child_menu_item.path %>"><span><%= child_menu_item.title %></span></a>
|
27
|
-
</li>
|
28
|
-
<% end %>
|
29
|
-
<% end %>
|
30
|
-
</ul>
|
31
|
-
<%
|
32
|
-
end
|
33
|
-
selected_menu_item = nil
|
34
|
-
end
|
35
|
-
%>
|
36
|
-
<% end %>
|
37
|
-
<% end %>
|
38
|
-
|
39
|
-
</ul>
|
40
|
-
</div>
|
41
|
-
<%end%>
|
42
|
-
|
43
|
-
|
@@ -1,47 +0,0 @@
|
|
1
|
-
|
2
|
-
<% selected_section_parent = @website_section.nil? ? nil : @website_section.parent %>
|
3
|
-
<% unless section.nil? %>
|
4
|
-
<% section = section.root? ? section : section.root %>
|
5
|
-
<% unless section.positioned_children.empty? %>
|
6
|
-
<div id="side_menu_container">
|
7
|
-
<ul id="side_menu">
|
8
|
-
<% section.positioned_children.each do |child_section|
|
9
|
-
if child_section.in_menu
|
10
|
-
if child_section.allow_access?(@current_user, :view)
|
11
|
-
if (!@website_section.nil? && child_section.id == @website_section.id) or (!selected_section_parent.nil? and selected_section_parent.id == child_section.id) %>
|
12
|
-
<li class="selected">
|
13
|
-
<% selected_section = child_section
|
14
|
-
else %>
|
15
|
-
<li>
|
16
|
-
<% end %>
|
17
|
-
<a href="<%= child_section.path %>"><span><%= child_section.title %></span></a>
|
18
|
-
</li>
|
19
|
-
<% end %>
|
20
|
-
<% end %>
|
21
|
-
|
22
|
-
<% if !selected_section.nil? and !selected_section.children.empty? %>
|
23
|
-
<ul class="side_menu_children">
|
24
|
-
<%
|
25
|
-
selected_section.positioned_children.each do |child_section|
|
26
|
-
%>
|
27
|
-
<% if !@website_section.nil? && child_section.id == @website_section.id %>
|
28
|
-
<li class="selected">
|
29
|
-
<% else %>
|
30
|
-
<li>
|
31
|
-
<% end %>
|
32
|
-
<a href="<%= child_section.path %>"><span><%= child_section.title %></span></a>
|
33
|
-
</li>
|
34
|
-
<% end %>
|
35
|
-
</ul>
|
36
|
-
|
37
|
-
<%
|
38
|
-
selected_section = nil
|
39
|
-
end
|
40
|
-
%>
|
41
|
-
<% end %>
|
42
|
-
</ul>
|
43
|
-
</div>
|
44
|
-
<% end %>
|
45
|
-
<% end %>
|
46
|
-
|
47
|
-
|
@@ -1,36 +0,0 @@
|
|
1
|
-
<%if @use_dynamic_form%>
|
2
|
-
<div id="<%=widget_result_id %>"></div>
|
3
|
-
|
4
|
-
<%=raw render_dynamic_form('WebsiteInquiry', :width => 410) %>
|
5
|
-
|
6
|
-
<div id="dynamic_form_target"></div>
|
7
|
-
<%else%>
|
8
|
-
<div id="<%=widget_result_id %>"></div>
|
9
|
-
<div>
|
10
|
-
<%= form_remote_tag build_widget_url(:new) do %>
|
11
|
-
<div class="form_settings">
|
12
|
-
<p>
|
13
|
-
<span>First Name</span>
|
14
|
-
<%= text_field_tag :first_name %>
|
15
|
-
</p>
|
16
|
-
<p>
|
17
|
-
<span>Last Name</span>
|
18
|
-
<%= text_field_tag :last_name %>
|
19
|
-
</p>
|
20
|
-
<p>
|
21
|
-
<span>Email</span>
|
22
|
-
<%= text_field_tag :email %>
|
23
|
-
</p>
|
24
|
-
<p>
|
25
|
-
<span>Message</span>
|
26
|
-
<%= text_area_tag :message, nil, :class => 'contact textarea', :rows => 8, :cols => 50 %>
|
27
|
-
</p>
|
28
|
-
<p style="padding-top: 15px">
|
29
|
-
<span> </span>
|
30
|
-
<%= submit_tag "Submit", :disable_with => "Please wait...", :class => "submit", :style => 'margin: 0 0 0 0px;' %>
|
31
|
-
</p>
|
32
|
-
<input type="hidden" name="is_html_form" value="<%=!@use_dynamic_form%>"/>
|
33
|
-
</div>
|
34
|
-
<% end %>
|
35
|
-
</div>
|
36
|
-
<%end%>
|
@@ -1,139 +0,0 @@
|
|
1
|
-
module Widgets
|
2
|
-
module DynamicForms
|
3
|
-
class Base < ErpApp::Widgets::Base
|
4
|
-
def index
|
5
|
-
render
|
6
|
-
end
|
7
|
-
|
8
|
-
def new
|
9
|
-
begin
|
10
|
-
unless params[:file].nil?
|
11
|
-
# size check
|
12
|
-
if params[:file].tempfile.size > ErpTechSvcs::Config.max_file_size_in_mb.megabytes
|
13
|
-
raise "File cannot be larger than #{ErpTechSvcs::Config.max_file_size_in_mb}MB"
|
14
|
-
end
|
15
|
-
end
|
16
|
-
form_data = JSON.parse(params[:form_data_json])
|
17
|
-
form_data[:dynamic_form_id] = params[:dynamic_form_id]
|
18
|
-
form_data[:model_name] = params[:model_name]
|
19
|
-
form_data.symbolize_keys!
|
20
|
-
@website = Website.find_by_host(request.host_with_port)
|
21
|
-
|
22
|
-
if form_data[:email_subject].blank?
|
23
|
-
subject = "#{form_data[:model_name]} Submission from #{@website.title}"
|
24
|
-
else
|
25
|
-
subject = strip_tags(form_data[:email_subject])
|
26
|
-
form_data.delete(:email_subject)
|
27
|
-
end
|
28
|
-
|
29
|
-
@myDynamicObject = DynamicFormModel.get_instance(form_data[:model_name])
|
30
|
-
|
31
|
-
form_data[:created_by] = current_user unless current_user.nil?
|
32
|
-
form_data[:created_with_form_id] = form_data[:dynamic_form_id] if form_data[:dynamic_form_id] and params[:is_html_form].blank?
|
33
|
-
form_data[:website] = @website.title
|
34
|
-
|
35
|
-
@myDynamicObject = @myDynamicObject.assign_all_attributes(form_data, ErpApp::Widgets::Base::IGNORED_PARAMS)
|
36
|
-
|
37
|
-
# get dynamic for from form_data[:created_with_form_id]
|
38
|
-
form = DynamicForm.find(form_data[:created_with_form_id])
|
39
|
-
|
40
|
-
# check widget_action from dynamic form
|
41
|
-
if !form.nil? and ['email', 'both'].include?(form.widget_action)
|
42
|
-
# email data
|
43
|
-
attachments = (params[:file].nil? ? [] : [params[:file]])
|
44
|
-
send_email(form, @myDynamicObject, subject, attachments)
|
45
|
-
end
|
46
|
-
|
47
|
-
if form.nil? or (!form.nil? and ['save', 'both'].include?(form.widget_action))
|
48
|
-
#save data
|
49
|
-
@myDynamicObject.save
|
50
|
-
save_file_asset(form_data) unless params[:file].nil?
|
51
|
-
end
|
52
|
-
|
53
|
-
output = render_to_string(:template => "success", :layout => false)
|
54
|
-
render :inline => {
|
55
|
-
:success => true,
|
56
|
-
:response => (file_upload_request? ? ERB::Util.html_escape(output) : output)
|
57
|
-
}.to_json
|
58
|
-
rescue Exception => e
|
59
|
-
Rails.logger.error e.message
|
60
|
-
Rails.logger.error e.backtrace.join("\n")
|
61
|
-
output = render_to_string(:template => "error", :layout => false, :locals => {:message => e.message})
|
62
|
-
render :inline => {
|
63
|
-
:success => false,
|
64
|
-
:response => (file_upload_request? ? ERB::Util.html_escape(output) : output)
|
65
|
-
}.to_json
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
protected
|
70
|
-
def file_upload_request?
|
71
|
-
request.env['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest'
|
72
|
-
end
|
73
|
-
|
74
|
-
def save_file_asset(form_data)
|
75
|
-
result = {}
|
76
|
-
name = params[:file].original_filename
|
77
|
-
data = params[:file].tempfile
|
78
|
-
set_file_support
|
79
|
-
|
80
|
-
begin
|
81
|
-
@root_node = File.join(ErpTechSvcs::Config.file_assets_location, form_data[:model_name], @myDynamicObject.id.to_s)
|
82
|
-
file = @myDynamicObject.add_file(data, File.join(@file_support.root, base_path, name))
|
83
|
-
|
84
|
-
roles = ['admin', @myDynamicObject.role_iid]
|
85
|
-
(@myDynamicObject.file_security_default == 'private') ? file.add_capability(:download, 'FileAsset', roles) : file.remove_all_capabilities
|
86
|
-
|
87
|
-
return {:success => true}
|
88
|
-
rescue Exception => e
|
89
|
-
Rails.logger.error e.message
|
90
|
-
Rails.logger.error e.backtrace
|
91
|
-
raise "Error uploading file. #{e.message}"
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
def base_path
|
96
|
-
@base_path = (@root_node.nil? ? nil : File.join(@file_support.root, @root_node))
|
97
|
-
end
|
98
|
-
|
99
|
-
def set_file_support
|
100
|
-
@file_support = ErpTechSvcs::FileSupport::Base.new(:storage => ErpTechSvcs::Config.file_storage)
|
101
|
-
end
|
102
|
-
|
103
|
-
def send_email(form, dynamicObject, subject='', attachments=[])
|
104
|
-
begin
|
105
|
-
DynamicFormMailer.widget_email_with_attachments(form, dynamicObject, subject, attachments).deliver
|
106
|
-
rescue Exception => e
|
107
|
-
Rails.logger.error e.message
|
108
|
-
Rails.logger.error e.backtrace
|
109
|
-
raise "Error sending email. #{e.message}"
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
#should not be modified
|
114
|
-
#modify at your own risk
|
115
|
-
def locate
|
116
|
-
File.dirname(__FILE__)
|
117
|
-
end
|
118
|
-
|
119
|
-
class << self
|
120
|
-
def title
|
121
|
-
"Dynamic Forms"
|
122
|
-
end
|
123
|
-
|
124
|
-
def widget_name
|
125
|
-
File.basename(File.dirname(__FILE__))
|
126
|
-
end
|
127
|
-
|
128
|
-
def base_layout
|
129
|
-
begin
|
130
|
-
file = File.join(File.dirname(__FILE__),"/views/layouts/base.html.erb")
|
131
|
-
IO.read(file)
|
132
|
-
rescue
|
133
|
-
return nil
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
137
|
-
end
|
138
|
-
end
|
139
|
-
end
|
@@ -1,110 +0,0 @@
|
|
1
|
-
Compass.ErpApp.Widgets.DynamicForms = {
|
2
|
-
template: new Ext.XTemplate(
|
3
|
-
"<% # Optional Parameters:\n",
|
4
|
-
" # internal_identifier: Models can have multiple forms\n",
|
5
|
-
" # Leave blank if you want to use the default form\n",
|
6
|
-
" # Specify internal_identifier to choose a specific form %>\n",
|
7
|
-
"<%= render_widget :dynamic_forms,\n",
|
8
|
-
" :params => {:model_name => '{WidgetDynamicFormModelName}',\n",
|
9
|
-
" :internal_identifier => ''",
|
10
|
-
'<tpl if="WidgetDynamicFormWidth">',
|
11
|
-
",\n :width => {WidgetDynamicFormWidth} ",
|
12
|
-
'</tpl>',
|
13
|
-
"} %>"),
|
14
|
-
|
15
|
-
addDynamicForm: function () {
|
16
|
-
var addDynamicFormWidgetWindow = Ext.create("Ext.window.Window", {
|
17
|
-
layout: 'fit',
|
18
|
-
width: 375,
|
19
|
-
title: 'Add DynamicForm Widget',
|
20
|
-
plain: true,
|
21
|
-
buttonAlign: 'center',
|
22
|
-
items: Ext.create("Ext.form.Panel", {
|
23
|
-
labelWidth: 100,
|
24
|
-
frame: false,
|
25
|
-
bodyStyle: 'padding:5px 5px 0',
|
26
|
-
defaults: {
|
27
|
-
width: 325
|
28
|
-
},
|
29
|
-
items: [
|
30
|
-
{
|
31
|
-
xtype: 'combo',
|
32
|
-
value: '',
|
33
|
-
loadingText: 'Retrieving Dynamic Form Models ...',
|
34
|
-
store: Ext.create('Ext.data.Store', {
|
35
|
-
proxy: {
|
36
|
-
type: 'ajax',
|
37
|
-
reader: {
|
38
|
-
type: 'json',
|
39
|
-
root: 'dynamic_form_model'
|
40
|
-
},
|
41
|
-
url: '/erp_forms/erp_app/desktop/dynamic_forms/models/index'
|
42
|
-
},
|
43
|
-
fields: [
|
44
|
-
{
|
45
|
-
name: 'id'
|
46
|
-
},
|
47
|
-
{
|
48
|
-
name: 'model_name'
|
49
|
-
}
|
50
|
-
]
|
51
|
-
}),
|
52
|
-
forceSelection: true,
|
53
|
-
editable: true,
|
54
|
-
fieldLabel: 'Model Name',
|
55
|
-
autoSelect: true,
|
56
|
-
mode: 'remote',
|
57
|
-
name: 'model_name',
|
58
|
-
displayField: 'model_name',
|
59
|
-
valueField: 'model_name',
|
60
|
-
triggerAction: 'all',
|
61
|
-
allowBlank: false,
|
62
|
-
plugins: [new helpQtip("Dynamic Form Model Name (Class)")]
|
63
|
-
},
|
64
|
-
{
|
65
|
-
xtype: 'textfield',
|
66
|
-
fieldLabel: 'Form Width',
|
67
|
-
name: 'form_width',
|
68
|
-
allowBlank: true,
|
69
|
-
plugins: [new helpQtip("Form Width in Pixels. Leave blank for auto width.")]
|
70
|
-
}
|
71
|
-
]
|
72
|
-
}),
|
73
|
-
buttons: [
|
74
|
-
{
|
75
|
-
text: 'Submit',
|
76
|
-
listeners: {
|
77
|
-
'click': function (button) {
|
78
|
-
var formPanel = button.findParentByType('window').query('form').first(),
|
79
|
-
basicForm = formPanel.getForm(),
|
80
|
-
WidgetDynamicFormModelName = basicForm.findField('model_name'),
|
81
|
-
WidgetDynamicFormWidth = basicForm.findField('form_width');
|
82
|
-
if (basicForm.isValid()) {
|
83
|
-
var data = {
|
84
|
-
WidgetDynamicFormModelName: WidgetDynamicFormModelName.getValue(),
|
85
|
-
WidgetDynamicFormWidth: WidgetDynamicFormWidth.getValue()
|
86
|
-
};
|
87
|
-
|
88
|
-
//add rendered template to center region editor
|
89
|
-
Ext.getCmp('knitkitCenterRegion').addContentToActiveCodeMirror(Compass.ErpApp.Widgets.DynamicForms.template.apply(data));
|
90
|
-
addDynamicFormWidgetWindow.close();
|
91
|
-
}
|
92
|
-
}
|
93
|
-
}
|
94
|
-
},
|
95
|
-
{
|
96
|
-
text: 'Close',
|
97
|
-
handler: function () {
|
98
|
-
addDynamicFormWidgetWindow.close();
|
99
|
-
}
|
100
|
-
}
|
101
|
-
]
|
102
|
-
}).show();
|
103
|
-
}
|
104
|
-
};
|
105
|
-
|
106
|
-
Compass.ErpApp.Widgets.AvailableWidgets.push({
|
107
|
-
name: 'Dynamic Forms',
|
108
|
-
iconUrl: '/images/icons/document_text/document_text_48x48.png',
|
109
|
-
onClick: Compass.ErpApp.Widgets.DynamicForms.addDynamicForm
|
110
|
-
});
|