knitkit 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +22 -0
- data/app/controllers/knitkit/base_controller.rb +15 -2
- data/app/controllers/knitkit/blogs_controller.rb +4 -4
- data/app/controllers/knitkit/erp_app/desktop/app_controller.rb +16 -2
- data/app/controllers/knitkit/erp_app/desktop/articles_controller.rb +198 -57
- data/app/controllers/knitkit/erp_app/desktop/content_controller.rb +25 -11
- data/app/controllers/knitkit/erp_app/desktop/file_assets_controller.rb +123 -44
- data/app/controllers/knitkit/erp_app/desktop/image_assets_controller.rb +83 -9
- data/app/controllers/knitkit/erp_app/desktop/online_document_sections_controller.rb +38 -0
- data/app/controllers/knitkit/erp_app/desktop/position_controller.rb +15 -6
- data/app/controllers/knitkit/erp_app/desktop/theme_controller.rb +185 -98
- data/app/controllers/knitkit/erp_app/desktop/versions_controller.rb +38 -16
- data/app/controllers/knitkit/erp_app/desktop/website_controller.rb +126 -68
- data/app/controllers/knitkit/erp_app/desktop/website_nav_controller.rb +154 -107
- data/app/controllers/knitkit/erp_app/desktop/website_section_controller.rb +113 -54
- data/app/controllers/knitkit/online_document_sections_controller.rb +45 -0
- data/app/controllers/knitkit/unauthorized_controller.rb +5 -0
- data/app/controllers/knitkit/website_sections_controller.rb +8 -9
- data/app/mailers/document_mailer.rb +10 -0
- data/app/models/article.rb +1 -1
- data/app/models/content.rb +35 -3
- data/app/models/document.rb +8 -0
- data/app/models/document_type.rb +3 -0
- data/app/models/documented_content.rb +29 -0
- data/app/models/documented_item.rb +31 -0
- data/app/models/extensions/configuration.rb +5 -0
- data/app/models/extensions/party.rb +13 -0
- data/app/models/online_document_section.rb +40 -0
- data/app/models/theme.rb +22 -26
- data/app/models/valid_document.rb +4 -0
- data/app/models/website.rb +158 -119
- data/app/models/website_inquiry.rb +7 -2
- data/app/models/website_inquiry_mailer.rb +4 -3
- data/app/models/website_party_role.rb +5 -0
- data/app/models/website_section.rb +76 -38
- data/app/views/document_mailer/email_document.html.erb +12 -0
- data/app/views/knitkit/blogs/_add_comment.html.erb +2 -2
- data/app/views/knitkit/online_document_sections/index.html.erb +149 -0
- data/app/views/knitkit/website_sections/index.html.erb +0 -1
- data/app/views/layouts/knitkit/base.html.erb +4 -2
- data/app/views/layouts/knitkit/online_document_sections.html.erb +59 -0
- data/app/views/menus/knitkit/_default_menu.html.erb +1 -1
- data/app/views/menus/knitkit/_default_section_menu.html.erb +1 -1
- data/app/views/menus/knitkit/_default_sub_menu.html.erb +2 -2
- data/app/views/menus/knitkit/_default_sub_section_menu.html.erb +1 -1
- data/app/widgets/contact_us/base.rb +5 -5
- data/app/widgets/contact_us/javascript/contact_us.js +2 -1
- data/app/widgets/google_map/base.rb +0 -4
- data/app/widgets/google_map/javascript/google_map.js +4 -3
- data/app/widgets/login/base.rb +0 -5
- data/app/widgets/login/javascript/login.js +155 -153
- data/app/widgets/login/views/index.html.erb +3 -3
- data/app/widgets/login/views/reset_password.html.erb +2 -2
- data/app/widgets/manage_profile/base.rb +46 -67
- data/app/widgets/manage_profile/javascript/manage_profile.js +2 -1
- data/app/widgets/manage_profile/views/_user_information_form.html.erb +5 -1
- data/app/widgets/reset_password/base.rb +4 -6
- data/app/widgets/reset_password/javascript/reset_password.js +2 -1
- data/app/widgets/reset_password/views/index.html.erb +4 -3
- data/app/widgets/search/base.rb +1 -5
- data/app/widgets/search/javascript/search.js +2 -1
- data/app/widgets/search/views/show.html.erb +2 -2
- data/app/widgets/signup/base.rb +7 -6
- data/app/widgets/signup/javascript/signup.js +2 -1
- data/app/widgets/signup/views/error.html.erb +1 -1
- data/config/routes.rb +6 -2
- data/db/data_migrations/20110509223702_add_publisher_role.rb +10 -0
- data/db/data_migrations/20111118182910_setup_knitkit_capabilities.rb +84 -0
- data/db/data_migrations/20120127144444_create_website_role_types.rb +13 -0
- data/db/data_migrations/20120127150505_create_website_default_configuration.rb +72 -0
- data/db/data_migrations/20120127150506_add_primary_host_to_website_configuration.rb +33 -0
- data/db/data_migrations/20120316150424_add_is_template_to_default_website_config.rb +16 -0
- data/db/data_migrations/upgrade/20120210195616_add_website_configs.rb +19 -0
- data/db/data_migrations/upgrade/20120213205519_populate_website_iids.rb +17 -0
- data/db/migrate/20110211002317_setup_knitkit.rb +22 -5
- data/db/migrate/20111207161928_create_documented_items_table.rb +13 -0
- data/db/migrate/20111208180539_add_document_id_to_documented_item.rb +9 -0
- data/db/migrate/20120315163736_add_document.rb +32 -0
- data/db/migrate/20120503183431_create_valid_documents.rb +16 -0
- data/db/migrate/upgrade/20120116201510_add_render_base_layout_flag.rb +13 -0
- data/db/migrate/upgrade/20120127143745_create_website_party_roles.rb +24 -0
- data/db/migrate/upgrade/20120213184509_add_iid_to_websites.rb +14 -0
- data/lib/knitkit.rb +2 -0
- data/lib/knitkit/config.rb +31 -0
- data/lib/knitkit/engine.rb +12 -3
- data/lib/knitkit/extensions.rb +1 -3
- data/lib/knitkit/extensions/action_controller/theme_support/acts_as_themed_controller.rb +2 -3
- data/lib/knitkit/extensions/active_record/acts_as_document.rb +63 -0
- data/lib/knitkit/extensions/active_record/acts_as_publishable.rb +5 -4
- data/lib/knitkit/extensions/compass_ae/widgets/base.rb +70 -0
- data/lib/knitkit/extensions/railties/action_view.rb +22 -10
- data/lib/knitkit/extensions/railties/theme_support/asset_tag_helper.rb +3 -3
- data/lib/knitkit/extensions/railties/theme_support/theme_file_resolver.rb +8 -3
- data/lib/knitkit/routing_filter/section_router.rb +16 -6
- data/lib/knitkit/version.rb +7 -1
- data/public/images/check.png +0 -0
- data/public/images/credit_card.png +0 -0
- data/public/images/knitkit/tooltip.gif +0 -0
- data/public/javascripts/ajax_pagination.js +33 -0
- data/public/javascripts/datepicker.js +6 -1
- data/public/javascripts/erp_app/desktop/applications/knitkit/articles_grid_panel.js +731 -258
- data/public/javascripts/erp_app/desktop/applications/knitkit/center_region.js +289 -238
- data/public/javascripts/erp_app/desktop/applications/knitkit/comments_grid_panel.js +2 -4
- data/public/javascripts/erp_app/desktop/applications/knitkit/east_region.js +29 -3
- data/public/javascripts/erp_app/desktop/applications/knitkit/file_assets_panel.js +193 -21
- data/public/javascripts/erp_app/desktop/applications/knitkit/image_assets_data_view.js +27 -26
- data/public/javascripts/erp_app/desktop/applications/knitkit/image_assets_panel.js +167 -20
- data/public/javascripts/erp_app/desktop/applications/knitkit/inquiries_grid_panel.js +1 -2
- data/public/javascripts/erp_app/desktop/applications/knitkit/module.js +5 -1
- data/public/javascripts/erp_app/desktop/applications/knitkit/publish_window.js +2 -2
- data/public/javascripts/erp_app/desktop/applications/knitkit/published_grid_panel.js +20 -11
- data/public/javascripts/erp_app/desktop/applications/knitkit/section_articles_grid_panel.js +279 -228
- data/public/javascripts/erp_app/desktop/applications/knitkit/themes_tree_panel.js +40 -40
- data/public/javascripts/erp_app/desktop/applications/knitkit/versions_grid_panel.js +83 -76
- data/public/javascripts/erp_app/desktop/applications/knitkit/west_region.js +1961 -1397
- data/public/javascripts/erp_app/desktop/applications/knitkit/widgets_panel.js +47 -43
- data/public/javascripts/knitkit/helpers.js +26 -0
- data/public/stylesheets/erp_app/desktop/applications/knitkit/knitkit.css +1 -2
- data/public/stylesheets/knitkit/documentation.css +50 -0
- data/public/stylesheets/knitkit/style.css +23 -1
- data/spec/controllers/knitkit/erp_app/desktop/articles_controller_spec.rb +8 -0
- data/spec/controllers/knitkit/erp_app/desktop/website_controller_spec.rb +396 -0
- data/spec/controllers/knitkit/erp_app/desktop/website_nav_controller_spec.rb +260 -0
- data/spec/controllers/knitkit/erp_app/desktop/website_section_controller_spec.rb +222 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +43 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +8 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/spec.rb +27 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +12 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/config/workflow.yml +1 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/factories/article.rb +4 -0
- data/spec/factories/basic.rb +3 -0
- data/spec/factories/blog.rb +5 -0
- data/spec/factories/documented_content.rb +4 -0
- data/spec/factories/documented_item.rb +4 -0
- data/spec/factories/online_document_section.rb +6 -0
- data/spec/factories/published_website.rb +4 -0
- data/spec/factories/theme.rb +6 -0
- data/spec/factories/website.rb +5 -0
- data/spec/factories/website_host.rb +4 -0
- data/spec/factories/website_nav.rb +5 -0
- data/spec/factories/website_nav_item.rb +4 -0
- data/spec/factories/website_section.rb +5 -0
- data/spec/models/article_spec.rb +35 -0
- data/spec/models/attribute_type_spec.rb +55 -0
- data/spec/models/attribute_value_spec.rb +114 -0
- data/spec/models/blog_spec.rb +16 -0
- data/spec/models/comment_spec.rb +11 -0
- data/spec/models/content_spec.rb +187 -0
- data/spec/models/documented_item_spec.rb +29 -0
- data/spec/models/online_document_section_spec.rb +34 -0
- data/spec/models/published_element_spec.rb +11 -0
- data/spec/models/published_website_spec.rb +11 -0
- data/spec/models/theme_spec.rb +12 -0
- data/spec/models/website_host_spec.rb +11 -0
- data/spec/models/website_inquiry_spec.rb +24 -0
- data/spec/models/website_nav_item_spec.rb +11 -0
- data/spec/models/website_nav_spec.rb +11 -0
- data/spec/models/website_section_content_spec.rb +11 -0
- data/spec/models/website_section_spec.rb +49 -0
- data/spec/models/website_spec.rb +146 -0
- data/spec/spec_helper.rb +61 -0
- metadata +391 -154
- data/app/controllers/knitkit/articles_controller.rb +0 -7
- data/lib/knitkit/extensions/compass/widgets/base.rb +0 -53
@@ -6,7 +6,7 @@
|
|
6
6
|
<ul id="menu">
|
7
7
|
<% @website_sections.each do |section| %>
|
8
8
|
<%if section.in_menu %>
|
9
|
-
<%if section.has_access?(current_user)%>
|
9
|
+
<%if section.has_access?(@current_user)%>
|
10
10
|
<% if (!@website_section.nil? && section.id == @website_section.id) or (!selected_section_parent.nil? and selected_section_parent.id == section.id) %>
|
11
11
|
<li class="selected">
|
12
12
|
<%
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<ul id="side_menu">
|
4
4
|
<%
|
5
5
|
menu_items.each do |menu_item| %>
|
6
|
-
<%if menu_item.has_access?(current_user)%>
|
6
|
+
<%if menu_item.has_access?(@current_user)%>
|
7
7
|
<% if menu_item_selected(menu_item) %>
|
8
8
|
<li class="selected">
|
9
9
|
<%
|
@@ -19,7 +19,7 @@
|
|
19
19
|
<% unless selected_menu_item.positioned_children.nil? %>
|
20
20
|
<ul class="side_menu_children">
|
21
21
|
<% selected_menu_item.positioned_children.each do |child_menu_item| %>
|
22
|
-
<% if child_menu_item.has_access?(current_user)%>
|
22
|
+
<% if child_menu_item.has_access?(@current_user)%>
|
23
23
|
<% if menu_item_selected(child_menu_item) %>
|
24
24
|
<li class="selected">
|
25
25
|
<% else %>
|
@@ -7,7 +7,7 @@
|
|
7
7
|
<ul id="side_menu">
|
8
8
|
<% section.positioned_children.each do |child_section| %>
|
9
9
|
<%if child_section.in_menu %>
|
10
|
-
<%if child_section.has_access?(current_user)%>
|
10
|
+
<%if child_section.has_access?(@current_user)%>
|
11
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
12
|
<li class="selected">
|
13
13
|
<%
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Widgets
|
2
2
|
module ContactUs
|
3
3
|
class Base < ErpApp::Widgets::Base
|
4
|
+
include ActionView::Helpers::SanitizeHelper
|
5
|
+
|
4
6
|
def index
|
5
7
|
@use_dynamic_form = params[:use_dynamic_form]
|
6
8
|
|
@@ -22,6 +24,8 @@ module Widgets
|
|
22
24
|
@website = Website.find_by_host(request.host_with_port)
|
23
25
|
@website_inquiry = WebsiteInquiry.new
|
24
26
|
|
27
|
+
subject = strip_tags(params[:email_subject])
|
28
|
+
params.delete(:email_subject)
|
25
29
|
params[:created_by] = current_user unless current_user.nil?
|
26
30
|
params[:created_with_form_id] = params[:dynamic_form_id] if params[:dynamic_form_id] and params[:is_html_form].blank?
|
27
31
|
params[:website_id] = @website.id
|
@@ -29,7 +33,7 @@ module Widgets
|
|
29
33
|
|
30
34
|
if @website_inquiry
|
31
35
|
if @website.email_inquiries?
|
32
|
-
@website_inquiry.send_email
|
36
|
+
@website_inquiry.send_email(subject)
|
33
37
|
end
|
34
38
|
|
35
39
|
if @is_html_form
|
@@ -62,10 +66,6 @@ module Widgets
|
|
62
66
|
def title
|
63
67
|
"Contact Us"
|
64
68
|
end
|
65
|
-
|
66
|
-
def views_location
|
67
|
-
File.join(File.dirname(__FILE__),"/views")
|
68
|
-
end
|
69
69
|
|
70
70
|
def widget_name
|
71
71
|
File.basename(File.dirname(__FILE__))
|
@@ -7,7 +7,8 @@ Compass.ErpApp.Widgets.ContactUs = {
|
|
7
7
|
Compass.ErpApp.Widgets.AvailableWidgets.push({
|
8
8
|
name:'Contact Us',
|
9
9
|
iconUrl:'/images/icons/message/message_48x48.png',
|
10
|
-
onClick:Compass.ErpApp.Widgets.ContactUs.addContactUs
|
10
|
+
onClick:Compass.ErpApp.Widgets.ContactUs.addContactUs,
|
11
|
+
about:'This widget creates a form to allow for website inqueries.'
|
11
12
|
});
|
12
13
|
|
13
14
|
|
@@ -16,8 +16,8 @@ Compass.ErpApp.Widgets.GoogleMap = {
|
|
16
16
|
type: 'memory'
|
17
17
|
},
|
18
18
|
data:[{
|
19
|
-
title:'
|
20
|
-
address:'
|
19
|
+
title:'TrueNorth.',
|
20
|
+
address:'1 S Orange Ave Orlando, FL 32801'
|
21
21
|
}]
|
22
22
|
});
|
23
23
|
|
@@ -170,5 +170,6 @@ Compass.ErpApp.Widgets.GoogleMap = {
|
|
170
170
|
Compass.ErpApp.Widgets.AvailableWidgets.push({
|
171
171
|
name:'Google Map',
|
172
172
|
iconUrl:'/images/icons/map/map_48x48.png',
|
173
|
-
onClick:Compass.ErpApp.Widgets.GoogleMap.addGoogleMap
|
173
|
+
onClick:Compass.ErpApp.Widgets.GoogleMap.addGoogleMap,
|
174
|
+
about:'This widget creates a google map with drop points you setup.'
|
174
175
|
});
|
data/app/widgets/login/base.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
module Widgets
|
3
2
|
module Login
|
4
3
|
class Base < ErpApp::Widgets::Base
|
@@ -42,10 +41,6 @@ module Widgets
|
|
42
41
|
File.join(File.dirname(__FILE__),"/views")
|
43
42
|
end
|
44
43
|
|
45
|
-
def widget_name
|
46
|
-
File.basename(File.dirname(__FILE__))
|
47
|
-
end
|
48
|
-
|
49
44
|
def base_layout
|
50
45
|
begin
|
51
46
|
file = File.join(File.dirname(__FILE__),"/views/layouts/base.html.erb")
|
@@ -1,162 +1,164 @@
|
|
1
1
|
Compass.ErpApp.Widgets.Login = {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
var action = basicForm.findField('widgetLayout').getValue();
|
2
|
+
addLogin:function(){
|
3
|
+
var addLoginWidgetWindow = Ext.create("Ext.window.Window",{
|
4
|
+
layout:'fit',
|
5
|
+
width:375,
|
6
|
+
title:'Add Login Widget',
|
7
|
+
plain: true,
|
8
|
+
buttonAlign:'center',
|
9
|
+
items: Ext.create("Ext.form.Panel",{
|
10
|
+
labelWidth: 100,
|
11
|
+
frame:false,
|
12
|
+
bodyStyle:'padding:5px 5px 0',
|
13
|
+
defaults: {
|
14
|
+
width: 225
|
15
|
+
},
|
16
|
+
items: [
|
17
|
+
{
|
18
|
+
xtype: 'combo',
|
19
|
+
forceSelection:true,
|
20
|
+
store: [
|
21
|
+
[':login_header','Header'],
|
22
|
+
[':login_page','Page'],
|
23
|
+
],
|
24
|
+
fieldLabel: 'Widget View',
|
25
|
+
value:':login_page',
|
26
|
+
name: 'widgetLayout',
|
27
|
+
allowBlank: false,
|
28
|
+
triggerAction: 'all',
|
29
|
+
listeners:{
|
30
|
+
change:function(field, newValue, oldValue){
|
31
|
+
var basicForm = field.findParentByType('form').getForm();
|
32
|
+
var loginWidgetLoginToField = basicForm.findField('loginWidgetLoginTo');
|
33
|
+
var loginWidgetLogoutToField = basicForm.findField('loginWidgetLogoutTo');
|
34
|
+
var loginWidgetLoginUrlField = basicForm.findField('loginWidgetLoginUrl');
|
35
|
+
var loginWidgetSignUpUrlField = basicForm.findField('loginWidgetSignUpUrl');
|
36
|
+
var loginWidgetResetPasswordUrlField = basicForm.findField('loginWidgetResetPasswordUrl');
|
37
|
+
if(newValue == ':login_header'){
|
38
|
+
loginWidgetLoginToField.hide();
|
39
|
+
loginWidgetLogoutToField.hide();
|
40
|
+
loginWidgetLoginUrlField.show();
|
41
|
+
loginWidgetResetPasswordUrlField.hide();
|
42
|
+
loginWidgetLoginUrlField.setValue('/login');
|
43
|
+
loginWidgetSignUpUrlField.setValue('/sign-up');
|
44
|
+
loginWidgetResetPasswordUrlField.setValue('/reset-password');
|
45
|
+
}
|
46
|
+
else{
|
47
|
+
loginWidgetLoginToField.show();
|
48
|
+
loginWidgetLogoutToField.show();
|
49
|
+
loginWidgetLoginUrlField.hide();
|
50
|
+
loginWidgetResetPasswordUrlField.show();
|
51
|
+
loginWidgetLoginToField.setValue('/home');
|
52
|
+
loginWidgetLogoutToField.setValue('/home');
|
53
|
+
loginWidgetSignUpUrlField.setValue('/sign-up');
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
},
|
58
|
+
{
|
59
|
+
xtype:'textfield',
|
60
|
+
fieldLabel:'Login To',
|
61
|
+
allowBlank:false,
|
62
|
+
value:'/home',
|
63
|
+
id:'loginWidgetLoginTo'
|
64
|
+
},
|
65
|
+
{
|
66
|
+
xtype:'textfield',
|
67
|
+
fieldLabel:'Logout To',
|
68
|
+
allowBlank:false,
|
69
|
+
value:'/home',
|
70
|
+
id:'loginWidgetLogoutTo'
|
71
|
+
},
|
72
|
+
{
|
73
|
+
xtype:'textfield',
|
74
|
+
fieldLabel:'Login Url',
|
75
|
+
allowBlank:false,
|
76
|
+
hidden:true,
|
77
|
+
value:'/login',
|
78
|
+
id:'loginWidgetLoginUrl'
|
79
|
+
},
|
80
|
+
{
|
81
|
+
xtype:'textfield',
|
82
|
+
toolTip:'Only needed if Signup widget is setup.',
|
83
|
+
fieldLabel:'Sign Up Url',
|
84
|
+
allowBlank:true,
|
85
|
+
value:'/sign-up',
|
86
|
+
id:'loginWidgetSignUpUrl'
|
87
|
+
},
|
88
|
+
{
|
89
|
+
xtype:'textfield',
|
90
|
+
toolTip:'Only needed if Reset Password widget is setup.',
|
91
|
+
fieldLabel:'Reset Password Url',
|
92
|
+
allowBlank:true,
|
93
|
+
hidden:true,
|
94
|
+
value:'/reset-password',
|
95
|
+
id:'loginWidgetResetPasswordUrl'
|
96
|
+
}
|
97
|
+
]
|
98
|
+
}),
|
99
|
+
buttons: [{
|
100
|
+
text:'Submit',
|
101
|
+
listeners:{
|
102
|
+
'click':function(button){
|
103
|
+
var tpl = null;
|
104
|
+
var content = null;
|
105
|
+
var window = button.findParentByType('window');
|
106
|
+
var formPanel = window.query('form')[0];
|
107
|
+
var basicForm = formPanel.getForm();
|
108
|
+
var action = basicForm.findField('widgetLayout').getValue();
|
110
109
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
110
|
+
var loginWidgetSignUpUrlField = basicForm.findField('loginWidgetSignUpUrl');
|
111
|
+
var loginWidgetResetPasswordUrlField = basicForm.findField('loginWidgetResetPasswordUrl');
|
112
|
+
var data = {
|
113
|
+
action:action
|
114
|
+
};
|
115
|
+
data.loginWidgetSignUpUrl = loginWidgetSignUpUrlField.getValue();
|
116
|
+
data.loginWidgetResetPasswordUrl = loginWidgetResetPasswordUrlField.getValue();
|
117
|
+
if(action == ':login_header'){
|
118
|
+
var loginWidgetLoginUrlField = basicForm.findField('loginWidgetLoginUrl');
|
119
|
+
data.loginWidgetLoginUrl = loginWidgetLoginUrlField.getValue();
|
120
|
+
tpl = new Ext.XTemplate("<%= render_widget :login,\n",
|
121
|
+
" :action => :login_header,\n",
|
122
|
+
" :params => {:login_url => '{loginWidgetLoginUrl}',\n",
|
123
|
+
" :signup_url => '{loginWidgetSignUpUrl}'}%>");
|
124
|
+
content = tpl.apply(data);
|
125
|
+
}
|
126
|
+
else{
|
127
|
+
var loginWidgetLoginToField = basicForm.findField('loginWidgetLoginTo');
|
128
|
+
var loginWidgetLogoutToField = basicForm.findField('loginWidgetLogoutTo');
|
129
|
+
data.loginWidgetLoginTo = loginWidgetLoginToField.getValue();
|
130
|
+
data.loginWidgetLogoutTo = loginWidgetLogoutToField.getValue();
|
131
|
+
tpl = new Ext.XTemplate("<%= render_widget :login,\n",
|
132
|
+
" :params => {:login_to => '{loginWidgetLoginTo}',\n",
|
133
|
+
" :logout_to => '{loginWidgetLogoutTo}',\n",
|
134
|
+
" #optional field if Sign Up widget is setup\n",
|
135
|
+
" #:signup_url => '{loginWidgetSignUpUrl}',\n",
|
136
|
+
" #optional field if Reset Password widget is setup\n",
|
137
|
+
" #:reset_password_url => '{loginWidgetResetPasswordUrl}'}%>");
|
138
|
+
content = tpl.apply(data);
|
139
|
+
}
|
139
140
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
141
|
+
//add rendered template to center region editor
|
142
|
+
Ext.getCmp('knitkitCenterRegion').addContentToActiveCodeMirror(content);
|
143
|
+
addLoginWidgetWindow.close();
|
144
|
+
}
|
145
|
+
}
|
146
|
+
},{
|
147
|
+
text: 'Close',
|
148
|
+
handler: function(){
|
149
|
+
addLoginWidgetWindow.close();
|
150
|
+
}
|
151
|
+
}]
|
152
|
+
});
|
153
|
+
addLoginWidgetWindow.show();
|
154
|
+
}
|
154
155
|
}
|
155
156
|
|
156
157
|
Compass.ErpApp.Widgets.AvailableWidgets.push({
|
157
|
-
|
158
|
-
|
159
|
-
|
158
|
+
name:'Login',
|
159
|
+
iconUrl:'/images/icons/key/key_48x48.png',
|
160
|
+
onClick:Compass.ErpApp.Widgets.Login.addLogin,
|
161
|
+
about:'This widget creates a login form to allow users to log into the website.'
|
160
162
|
});
|
161
163
|
|
162
164
|
|