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
data/app/widgets/signup/base.rb
CHANGED
@@ -9,6 +9,10 @@ module Widgets
|
|
9
9
|
|
10
10
|
def new
|
11
11
|
@website = Website.find_by_host(request.host_with_port)
|
12
|
+
@configuration = @website.configurations.first
|
13
|
+
password_config_option = @configuration.get_item(ConfigurationItemType.find_by_internal_identifier('password_strength_regex')).options.first
|
14
|
+
primary_host = @configuration.get_item(ConfigurationItemType.find_by_internal_identifier('primary_host')).options.first
|
15
|
+
|
12
16
|
@email = params[:email]
|
13
17
|
@user = User.new(
|
14
18
|
:email => @email,
|
@@ -16,9 +20,11 @@ module Widgets
|
|
16
20
|
:password => params[:password],
|
17
21
|
:password_confirmation => params[:password_confirmation]
|
18
22
|
)
|
23
|
+
@user.password_validator = {:regex => password_config_option.value, :error_message => password_config_option.comment}
|
19
24
|
#set this to tell activation where to redirect_to for login and temp password
|
20
25
|
@user.add_instance_attribute(:login_url,params[:login_url])
|
21
|
-
@user.add_instance_attribute(:temp_password, params[:password])
|
26
|
+
@user.add_instance_attribute(:temp_password, params[:password])
|
27
|
+
@user.add_instance_attribute(:domain, primary_host.value)
|
22
28
|
begin
|
23
29
|
if @user.save
|
24
30
|
@user.roles << @website.role
|
@@ -29,7 +35,6 @@ module Widgets
|
|
29
35
|
else
|
30
36
|
render :update => {:id => "#{@uuid}_result", :view => :error}
|
31
37
|
end
|
32
|
-
render :json => {:success => success, :message => message}
|
33
38
|
rescue Exception=>ex
|
34
39
|
logger.error ex.message
|
35
40
|
logger.error ex.backtrace
|
@@ -47,10 +52,6 @@ module Widgets
|
|
47
52
|
def title
|
48
53
|
"Sign Up"
|
49
54
|
end
|
50
|
-
|
51
|
-
def views_location
|
52
|
-
File.join(File.dirname(__FILE__),"/views")
|
53
|
-
end
|
54
55
|
|
55
56
|
def widget_name
|
56
57
|
File.basename(File.dirname(__FILE__))
|
@@ -7,7 +7,8 @@ Compass.ErpApp.Widgets.Signup = {
|
|
7
7
|
Compass.ErpApp.Widgets.AvailableWidgets.push({
|
8
8
|
name:'Signup',
|
9
9
|
iconUrl:'/images/icons/user/user_48x48.png',
|
10
|
-
onClick:Compass.ErpApp.Widgets.Signup.addSignup
|
10
|
+
onClick:Compass.ErpApp.Widgets.Signup.addSignup,
|
11
|
+
about:'This widget allows new users of a website to sign up.'
|
11
12
|
});
|
12
13
|
|
13
14
|
|
data/config/routes.rb
CHANGED
@@ -2,14 +2,16 @@ Rails.application.routes.draw do
|
|
2
2
|
filter :section_router
|
3
3
|
|
4
4
|
get 'pages/:section_id' => 'knitkit/website_sections#index', :as => 'page'
|
5
|
-
get '
|
5
|
+
get 'onlinedocumentsections/:section_id' => 'knitkit/online_document_sections#index', :as => 'document'
|
6
|
+
#get 'onlinedocumentsections/:section_id/:id' => 'knitkit/online_document_sections#show', :as => 'document'
|
6
7
|
get 'blogs/:section_id(.:format)' => 'knitkit/blogs#index', :as => 'blogs'
|
7
8
|
get 'blogs/:section_id/:id' => 'knitkit/blogs#show', :as => 'blog_article'
|
8
9
|
get 'blogs/:section_id/tag/:tag_id(.:format)' => 'knitkit/blogs#tag', :as => 'blog_tag'
|
9
10
|
|
10
11
|
match '/comments/add/:section_id/:content_id' => 'knitkit/comments#add', :as => 'comments'
|
11
|
-
match '/unauthorized' => 'unauthorized#index', :as => 'knitkit/unauthorized'
|
12
|
+
match '/unauthorized' => 'knitkit/unauthorized#index', :as => 'knitkit/unauthorized'
|
12
13
|
match '/view_current_publication' => 'knitkit/base#view_current_publication'
|
14
|
+
match '/online_document_sections/build_tree' => 'knitkit/online_document_sections#build_tree'
|
13
15
|
end
|
14
16
|
|
15
17
|
Knitkit::Engine.routes.draw do
|
@@ -26,6 +28,8 @@ Knitkit::Engine.routes.draw do
|
|
26
28
|
match '/erp_app/desktop/site(/:action)' => 'erp_app/desktop/website'
|
27
29
|
#section
|
28
30
|
match '/erp_app/desktop/section/:action' => 'erp_app/desktop/website_section'
|
31
|
+
#document
|
32
|
+
match '/erp_app/desktop/online_document_sections/:action' => 'erp_app/desktop/online_document_sections'
|
29
33
|
#theme
|
30
34
|
match '/erp_app/desktop/theme/:action' => 'erp_app/desktop/theme'
|
31
35
|
#versions
|
@@ -2,10 +2,20 @@ class AddPublisherRole
|
|
2
2
|
|
3
3
|
def self.up
|
4
4
|
Role.create(:internal_identifier => 'publisher', :description => 'Publisher')
|
5
|
+
Role.create(:internal_identifier => 'content_author', :description => 'Content Author')
|
6
|
+
Role.create(:internal_identifier => 'layout_author', :description => 'Layout Author')
|
7
|
+
Role.create(:internal_identifier => 'editor', :description => 'Editor')
|
8
|
+
Role.create(:internal_identifier => 'designer', :description => 'Designer')
|
9
|
+
Role.create(:internal_identifier => 'website_author', :description => 'Website Author')
|
5
10
|
end
|
6
11
|
|
7
12
|
def self.down
|
8
13
|
Role.iid('publisher').destroy
|
14
|
+
Role.iid('content_author').destroy
|
15
|
+
Role.iid('layout_author').destroy
|
16
|
+
Role.iid('editor').destroy
|
17
|
+
Role.iid('designer').destroy
|
18
|
+
Role.iid('website_author').destroy
|
9
19
|
end
|
10
20
|
|
11
21
|
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
class SetupKnitkitCapabilities
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
Role.create(:internal_identifier => 'content_author', :description => 'Content Author') unless Role.find_by_internal_identifier("content_author")
|
5
|
+
Role.create(:internal_identifier => 'layout_author', :description => 'Layout Author') unless Role.find_by_internal_identifier("layout_author")
|
6
|
+
Role.create(:internal_identifier => 'editor', :description => 'Editor') unless Role.find_by_internal_identifier("editor")
|
7
|
+
Role.create(:internal_identifier => 'designer', :description => 'Designer') unless Role.find_by_internal_identifier("designer")
|
8
|
+
Role.create(:internal_identifier => 'website_author', :description => 'Website Author') unless Role.find_by_internal_identifier("website_author")
|
9
|
+
|
10
|
+
CapabilityType.create(:internal_identifier => 'import', :description => 'Import')
|
11
|
+
CapabilityType.create(:internal_identifier => 'publish', :description => 'Publish')
|
12
|
+
CapabilityType.create(:internal_identifier => 'activate', :description => 'Activate')
|
13
|
+
CapabilityType.create(:internal_identifier => 'secure', :description => 'Secure')
|
14
|
+
CapabilityType.create(:internal_identifier => 'unsecure', :description => 'Unsecure')
|
15
|
+
CapabilityType.create(:internal_identifier => 'revert_version', :description => 'Revert Version')
|
16
|
+
CapabilityType.create(:internal_identifier => 'add_existing', :description => 'Add Existing')
|
17
|
+
CapabilityType.create(:internal_identifier => 'upload', :description => 'Upload')
|
18
|
+
CapabilityType.create(:internal_identifier => 'edit_html', :description => 'Edit Html')
|
19
|
+
CapabilityType.create(:internal_identifier => 'edit_excerpt', :description => 'Edit Excerpt')
|
20
|
+
CapabilityType.create(:internal_identifier => 'drag_item', :description => 'Drag Item')
|
21
|
+
|
22
|
+
knitkit_application = DesktopApplication.find_by_internal_identifier('knitkit')
|
23
|
+
knitkit_application.add_capability('create', 'Menu', 'admin', 'website_author')
|
24
|
+
knitkit_application.add_capability('delete', 'Menu', 'admin', 'website_author')
|
25
|
+
knitkit_application.add_capability('edit', 'Menu', 'admin', 'website_author')
|
26
|
+
|
27
|
+
knitkit_application.add_capability('create', 'Website', 'admin', 'website_author')
|
28
|
+
knitkit_application.add_capability('delete', 'Website', 'admin', 'website_author')
|
29
|
+
knitkit_application.add_capability('edit', 'Website', 'admin', 'website_author')
|
30
|
+
knitkit_application.add_capability('import', 'Website', 'admin', 'website_author')
|
31
|
+
knitkit_application.add_capability('publish', 'Website', 'admin', 'publisher')
|
32
|
+
knitkit_application.add_capability('activate', 'Website', 'admin', 'publisher')
|
33
|
+
|
34
|
+
knitkit_application.add_capability('create', 'Host', 'admin', 'website_author')
|
35
|
+
knitkit_application.add_capability('delete', 'Host', 'admin', 'website_author')
|
36
|
+
knitkit_application.add_capability('edit', 'Host', 'admin', 'website_author')
|
37
|
+
|
38
|
+
knitkit_application.add_capability('create', 'Section', 'admin', 'website_author')
|
39
|
+
knitkit_application.add_capability('delete', 'Section', 'admin', 'website_author')
|
40
|
+
knitkit_application.add_capability('edit', 'Section', 'admin', 'website_author')
|
41
|
+
knitkit_application.add_capability('secure', 'Section', 'admin', 'website_author')
|
42
|
+
knitkit_application.add_capability('unsecure', 'Section', 'admin', 'website_author')
|
43
|
+
|
44
|
+
knitkit_application.add_capability('create', 'Layout', 'admin', 'layout_author')
|
45
|
+
knitkit_application.add_capability('edit', 'Layout', 'admin', 'layout_author')
|
46
|
+
|
47
|
+
knitkit_application.add_capability('create', 'Article', 'admin', 'content_author')
|
48
|
+
knitkit_application.add_capability('delete', 'Article', 'admin', 'content_author')
|
49
|
+
knitkit_application.add_capability('edit', 'Article', 'admin', 'content_author')
|
50
|
+
knitkit_application.add_capability('publish', 'Article', 'admin', 'content_author')
|
51
|
+
knitkit_application.add_capability('revert_version', 'Article', 'admin', 'content_author')
|
52
|
+
knitkit_application.add_capability('add_existing', 'Article', 'admin', 'content_author')
|
53
|
+
knitkit_application.add_capability('edit_html', 'Article', 'admin', 'content_author')
|
54
|
+
knitkit_application.add_capability('edit_excerpt', 'Article', 'admin', 'content_author')
|
55
|
+
|
56
|
+
knitkit_application.add_capability('create', 'MenuItem', 'admin', 'website_author')
|
57
|
+
knitkit_application.add_capability('delete', 'MenuItem', 'admin', 'website_author')
|
58
|
+
knitkit_application.add_capability('edit', 'MenuItem', 'admin', 'website_author')
|
59
|
+
knitkit_application.add_capability('secure', 'MenuItem', 'admin', 'website_author')
|
60
|
+
knitkit_application.add_capability('unsecure', 'MenuItem', 'admin', 'website_author')
|
61
|
+
|
62
|
+
knitkit_application.add_capability('view', 'Theme', 'admin', 'designer')
|
63
|
+
|
64
|
+
knitkit_application.add_capability('view', 'SiteImageAsset', 'admin', 'website_author', 'content_author')
|
65
|
+
|
66
|
+
knitkit_application.add_capability('view', 'GlobalImageAsset', 'admin', 'website_author', 'content_author')
|
67
|
+
knitkit_application.add_capability('upload', 'GlobalImageAsset', 'admin', 'website_author')
|
68
|
+
knitkit_application.add_capability('delete', 'GlobalImageAsset', 'admin', 'website_author')
|
69
|
+
|
70
|
+
knitkit_application.add_capability('view', 'SiteFileAsset', 'admin', 'website_author', 'content_author')
|
71
|
+
|
72
|
+
knitkit_application.add_capability('view', 'GlobalFileAsset', 'admin', 'website_author', 'content_author')
|
73
|
+
knitkit_application.add_capability('upload', 'GlobalFileAsset', 'admin', 'website_author')
|
74
|
+
knitkit_application.add_capability('delete', 'GlobalFileAsset', 'admin', 'website_author')
|
75
|
+
|
76
|
+
knitkit_application.add_capability('drag_item', 'WebsiteTree', 'admin', 'website_author')
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.down
|
80
|
+
knitkit_application = DesktopApplication.find_by_internal_identifier('knitkit')
|
81
|
+
knitkit_application.remove_all_capabilities
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateWebsiteRoleTypes
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
RoleType.create(:description => 'Website Owner', :internal_identifier => 'website_owner')
|
5
|
+
RoleType.create(:description => 'Website Member', :internal_identifier => 'website_member')
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.down
|
9
|
+
RoleType.website_owner.destroy
|
10
|
+
RoleType.website_member.destroy
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
class CreateWebsiteDefaultConfiguration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
unless ::Configuration.find_template('default_website_configuration')
|
5
|
+
website_setup_category = Category.create(:description => 'Website Setup', :internal_identifier => 'website_setup')
|
6
|
+
|
7
|
+
#configuration
|
8
|
+
configuration = Configuration.create(
|
9
|
+
:description => 'Default Website Configuration',
|
10
|
+
:internal_identifier => 'default_website_configuration',
|
11
|
+
:is_template => true
|
12
|
+
)
|
13
|
+
|
14
|
+
login_url_config_item_type = ConfigurationItemType.create(
|
15
|
+
:description => 'Login Url',
|
16
|
+
:internal_identifier => 'login_url',
|
17
|
+
:allow_user_defined_options => true
|
18
|
+
)
|
19
|
+
CategoryClassification.create(:category => website_setup_category, :classification => login_url_config_item_type)
|
20
|
+
configuration.configuration_item_types << login_url_config_item_type
|
21
|
+
|
22
|
+
home_page_url_config_item_type = ConfigurationItemType.create(
|
23
|
+
:description => 'Homepage Url',
|
24
|
+
:internal_identifier => 'homepage_url',
|
25
|
+
:allow_user_defined_options => true
|
26
|
+
)
|
27
|
+
CategoryClassification.create(:category => website_setup_category, :classification => home_page_url_config_item_type)
|
28
|
+
configuration.configuration_item_types << home_page_url_config_item_type
|
29
|
+
|
30
|
+
contact_us_email_address_item_type = ConfigurationItemType.create(
|
31
|
+
:description => 'Contact Us Email',
|
32
|
+
:internal_identifier => 'contact_us_email_address',
|
33
|
+
:allow_user_defined_options => true
|
34
|
+
)
|
35
|
+
CategoryClassification.create(:category => website_setup_category, :classification => contact_us_email_address_item_type)
|
36
|
+
configuration.configuration_item_types << contact_us_email_address_item_type
|
37
|
+
|
38
|
+
#password strength
|
39
|
+
simple_password_option = ConfigurationOption.create(
|
40
|
+
:description => 'Simple password',
|
41
|
+
:comment => 'must be at least 8 characters long and start and end with a letter',
|
42
|
+
:internal_identifier => 'simple_password_regex',
|
43
|
+
:value => '^[A-Za-z]\w{6,}[A-Za-z]$'
|
44
|
+
)
|
45
|
+
|
46
|
+
complex_password_option = ConfigurationOption.create(
|
47
|
+
:description => 'Complex password',
|
48
|
+
:comment => 'must be at least 10 characters, must contain at least one lower case letter, one upper case letter, one digit and one special character, valid special characters are @#$%^&+=',
|
49
|
+
:internal_identifier => 'complex_password_regex',
|
50
|
+
:value => '^.*(?=.{10,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=]).*$'
|
51
|
+
)
|
52
|
+
|
53
|
+
password_strength_config_item_type = ConfigurationItemType.create(
|
54
|
+
:description => 'Password Strength',
|
55
|
+
:internal_identifier => 'password_strength_regex'
|
56
|
+
)
|
57
|
+
CategoryClassification.create(:category => website_setup_category, :classification => password_strength_config_item_type)
|
58
|
+
|
59
|
+
password_strength_config_item_type.configuration_options << complex_password_option
|
60
|
+
password_strength_config_item_type.add_default_configuration_option(simple_password_option)
|
61
|
+
password_strength_config_item_type.save
|
62
|
+
configuration.configuration_item_types << password_strength_config_item_type
|
63
|
+
|
64
|
+
configuration.save
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.down
|
69
|
+
#remove data here
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class AddPrimaryHostToWebsiteConfiguration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
unless ConfigurationItemType.find_by_internal_identifier('primary_host')
|
5
|
+
website_setup_category = Category.find_by_internal_identifier('website_setup')
|
6
|
+
configuration = ::Configuration.find_template('default_website_configuration')
|
7
|
+
|
8
|
+
primary_host_config_item_type = ConfigurationItemType.create(
|
9
|
+
:description => 'Primary Host',
|
10
|
+
:internal_identifier => 'primary_host',
|
11
|
+
:allow_user_defined_options => true
|
12
|
+
)
|
13
|
+
CategoryClassification.create(:category => website_setup_category, :classification => primary_host_config_item_type)
|
14
|
+
configuration.configuration_item_types << primary_host_config_item_type
|
15
|
+
configuration.save
|
16
|
+
|
17
|
+
#update existing websites
|
18
|
+
Website.all.each do |website|
|
19
|
+
website_config = website.configurations.first
|
20
|
+
if(website_config.internal_identifier == 'default_website_configuration')
|
21
|
+
website_config.configuration_item_types << primary_host_config_item_type
|
22
|
+
website_config.add_configuration_item(primary_host_config_item_type, website.hosts.first.host)
|
23
|
+
website_config.save
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.down
|
30
|
+
#remove data here
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class AddIsTemplateToDefaultWebsiteConfig
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
default_website_config = Configuration.where('internal_identifier = ?', 'default_website_configuration').all
|
5
|
+
unless default_website_config.empty?
|
6
|
+
config = default_website_config.find{|config| config.websites.empty?}
|
7
|
+
config.is_template = true
|
8
|
+
config.save
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.down
|
13
|
+
#remove data here
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class AddWebsiteConfigs
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
#insert data here
|
5
|
+
Website.all.each do |w|
|
6
|
+
if w.configurations.empty?
|
7
|
+
config = Configuration.find_by_internal_identifier('default_website_configuration').clone(true)
|
8
|
+
config.update_configuration_item(ConfigurationItemType.find_by_internal_identifier('contact_us_email_address'), w.email)
|
9
|
+
w.configurations << config
|
10
|
+
w.save
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.down
|
16
|
+
#remove data here
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class PopulateWebsiteIids
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
#insert data here
|
5
|
+
Website.all.each do |w|
|
6
|
+
if w.internal_identifier.blank?
|
7
|
+
w.internal_identifier = "site-#{w.id}"
|
8
|
+
w.save
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.down
|
14
|
+
#remove data here
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -6,6 +6,7 @@ class SetupKnitkit < ActiveRecord::Migration
|
|
6
6
|
t.string :name
|
7
7
|
t.string :title
|
8
8
|
t.string :subtitle
|
9
|
+
t.string :internal_identifier
|
9
10
|
t.string :email
|
10
11
|
t.boolean :auto_activate_publication
|
11
12
|
t.boolean :email_inquiries
|
@@ -47,6 +48,7 @@ class SetupKnitkit < ActiveRecord::Migration
|
|
47
48
|
t.integer :position, :default => 0
|
48
49
|
t.string :internal_identifier
|
49
50
|
t.integer :version
|
51
|
+
t.boolean :render_base_layout, :default => true
|
50
52
|
|
51
53
|
#better nested set columns
|
52
54
|
t.integer :parent_id
|
@@ -132,7 +134,7 @@ class SetupKnitkit < ActiveRecord::Migration
|
|
132
134
|
create_table :published_websites do |t|
|
133
135
|
t.references :website
|
134
136
|
t.text :comment
|
135
|
-
t.decimal :version
|
137
|
+
t.decimal :version, :precision => 18, :scale => 6
|
136
138
|
t.boolean :active
|
137
139
|
t.integer :published_by_id
|
138
140
|
|
@@ -215,7 +217,7 @@ class SetupKnitkit < ActiveRecord::Migration
|
|
215
217
|
|
216
218
|
add_index :website_navs, :website_id
|
217
219
|
end
|
218
|
-
|
220
|
+
|
219
221
|
unless table_exists?(:tags)
|
220
222
|
create_table :tags do |t|
|
221
223
|
t.column :name, :string
|
@@ -228,12 +230,12 @@ class SetupKnitkit < ActiveRecord::Migration
|
|
228
230
|
t.column :taggable_id, :integer
|
229
231
|
t.column :tagger_id, :integer
|
230
232
|
t.column :tagger_type, :string
|
231
|
-
|
233
|
+
|
232
234
|
# You should make sure that the column created is
|
233
235
|
# long enough to store the required class names.
|
234
236
|
t.column :taggable_type, :string
|
235
237
|
t.column :context, :string
|
236
|
-
|
238
|
+
|
237
239
|
t.column :created_at, :datetime
|
238
240
|
end
|
239
241
|
|
@@ -241,6 +243,21 @@ class SetupKnitkit < ActiveRecord::Migration
|
|
241
243
|
add_index :taggings, [:taggable_id, :taggable_type, :context], :name => 'taggable_poly_idx'
|
242
244
|
end
|
243
245
|
|
246
|
+
unless table_exists? :website_party_roles
|
247
|
+
create_table :website_party_roles do |t|
|
248
|
+
#foreign keys
|
249
|
+
t.references :website
|
250
|
+
t.references :role_type
|
251
|
+
t.references :party
|
252
|
+
|
253
|
+
t.timestamps
|
254
|
+
end
|
255
|
+
|
256
|
+
add_index :website_party_roles, :website_id
|
257
|
+
add_index :website_party_roles, :role_type_id
|
258
|
+
add_index :website_party_roles, :party_id
|
259
|
+
end
|
260
|
+
|
244
261
|
end
|
245
262
|
|
246
263
|
def self.down
|
@@ -249,7 +266,7 @@ class SetupKnitkit < ActiveRecord::Migration
|
|
249
266
|
|
250
267
|
# check that each table exists before trying to delete it.
|
251
268
|
[:websites, :website_sections, :contents, :website_section_contents,
|
252
|
-
:themes, :theme_files, :published_websites, :published_elements,
|
269
|
+
:themes, :theme_files, :published_websites, :published_elements, :website_party_roles,
|
253
270
|
:comments,:website_hosts,:website_nav_items, :website_navs, :tags, :taggings].each do |tbl|
|
254
271
|
if table_exists?(tbl)
|
255
272
|
drop_table tbl
|