locomotive_cms 0.0.4.beta5 → 0.0.4.beta7
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +12 -10
- data/app/controllers/admin/api_contents_controller.rb +10 -1
- data/app/controllers/admin/base_controller.rb +2 -2
- data/app/controllers/admin/cross_domain_sessions_controller.rb +7 -4
- data/app/controllers/admin/current_sites_controller.rb +2 -0
- data/app/controllers/admin/imports_controller.rb +8 -27
- data/app/controllers/admin/installation_controller.rb +79 -0
- data/app/controllers/admin/passwords_controller.rb +2 -2
- data/app/controllers/admin/sessions_controller.rb +2 -2
- data/app/controllers/admin/sites_controller.rb +2 -0
- data/app/controllers/application_controller.rb +1 -1
- data/app/helpers/admin/assets_helper.rb +0 -6
- data/app/helpers/admin/{login_helper.rb → box_helper.rb} +7 -3
- data/app/helpers/admin/custom_fields_helper.rb +2 -2
- data/app/models/asset_collection.rb +10 -0
- data/app/models/content_instance.rb +19 -0
- data/app/models/content_type.rb +20 -2
- data/app/models/extensions/page/tree.rb +4 -6
- data/app/models/site.rb +11 -3
- data/app/uploaders/theme_asset_uploader.rb +1 -1
- data/app/views/admin/asset_collections/edit.html.haml +2 -2
- data/app/views/admin/asset_collections/new.html.haml +1 -1
- data/app/views/admin/assets/_form.html.haml +2 -2
- data/app/views/admin/content_types/_form.html.haml +2 -2
- data/app/views/admin/content_types/new.html.haml +1 -1
- data/app/views/admin/contents/_form.html.haml +2 -2
- data/app/views/admin/contents/index.html.haml +1 -1
- data/app/views/admin/cross_domain_sessions/new.html.haml +1 -1
- data/app/views/admin/current_sites/_form.html.haml +3 -3
- data/app/views/admin/current_sites/edit.html.haml +1 -1
- data/app/views/admin/errors/no_page.html.haml +1 -0
- data/app/views/admin/errors/no_site.html.haml +1 -0
- data/app/views/admin/imports/new.html.haml +11 -0
- data/app/views/admin/imports/show.html.haml +1 -1
- data/app/views/admin/installation/step_1.html.haml +24 -0
- data/app/views/admin/installation/step_2.html.haml +26 -0
- data/app/views/admin/installation/step_3.html.haml +23 -0
- data/app/views/{layouts/admin → admin/layouts}/application.html.haml +0 -0
- data/app/views/admin/layouts/box.html.haml +21 -0
- data/app/views/admin/layouts/error.html.haml +1 -0
- data/app/views/admin/my_accounts/edit.html.haml +1 -1
- data/app/views/admin/pages/_form.html.haml +2 -3
- data/app/views/admin/pages/index.html.haml +1 -1
- data/app/views/admin/passwords/edit.html.haml +2 -2
- data/app/views/admin/passwords/new.html.haml +2 -2
- data/app/views/admin/sessions/new.html.haml +2 -2
- data/app/views/admin/shared/_head.html.haml +4 -5
- data/app/views/admin/sites/_form.html.haml +3 -3
- data/app/views/admin/snippets/_form.html.haml +2 -2
- data/app/views/admin/theme_assets/_form.html.haml +2 -2
- data/app/views/admin/theme_assets/index.html.haml +1 -1
- data/config/application.rb +1 -3
- data/config/assets.yml +94 -0
- data/config/environments/development.rb +0 -5
- data/config/environments/production.rb +1 -3
- data/config/environments/test.rb +1 -5
- data/config/initializers/carrierwave.rb +17 -0
- data/config/initializers/locomotive.rb +12 -0
- data/config/locales/admin_ui_en.yml +33 -1
- data/config/locales/admin_ui_fr.yml +34 -1
- data/config/locales/flash.en.yml +1 -0
- data/config/locales/flash.fr.yml +1 -0
- data/config/mongoid.yml +2 -2
- data/config/routes.rb +6 -1
- data/lib/generators/locomotive/install/install_generator.rb +18 -10
- data/lib/generators/locomotive/install/templates/README +23 -13
- data/lib/generators/locomotive/install/templates/locomotive.rb +13 -1
- data/lib/locomotive/carrierwave.rb +1 -0
- data/lib/locomotive/configuration.rb +3 -1
- data/lib/locomotive/custom_fields.rb +0 -1
- data/lib/locomotive/engine.rb +12 -9
- data/lib/locomotive/import/asset_collections.rb +40 -8
- data/lib/locomotive/import/assets.rb +20 -12
- data/lib/locomotive/import/base.rb +46 -0
- data/lib/locomotive/import/content_types.rb +51 -15
- data/lib/locomotive/import/job.rb +59 -15
- data/lib/locomotive/import/logger.rb +13 -0
- data/lib/locomotive/import/pages.rb +64 -25
- data/lib/locomotive/import/site.rb +3 -5
- data/lib/locomotive/import/snippets.rb +6 -8
- data/lib/locomotive/import.rb +2 -0
- data/lib/locomotive/liquid/drops/asset_collections.rb +4 -4
- data/lib/locomotive/liquid/drops/contents.rb +21 -16
- data/lib/locomotive/liquid/filters/html.rb +9 -6
- data/lib/locomotive/liquid/tags/nav.rb +18 -5
- data/lib/locomotive/liquid/tags/paginate.rb +3 -3
- data/lib/locomotive/misc_form_builder.rb +2 -7
- data/lib/locomotive/render.rb +9 -3
- data/lib/locomotive/routing/site_dispatcher.rb +8 -6
- data/lib/locomotive/version.rb +1 -1
- data/public/images/admin/box/buttons/right_bg.png +0 -0
- data/public/javascripts/admin/aloha/VERSION.txt +1 -1
- data/public/javascripts/admin/aloha/aloha-nodeps.js +140 -101
- data/public/javascripts/admin/aloha/aloha.js +193 -105
- data/public/javascripts/admin/aloha/css/aloha.css +65 -4
- data/public/javascripts/admin/aloha/deps/prettyPhoto/resources/css/prettyPhoto.css +2 -2
- data/public/javascripts/admin/aloha/i18n/de.dict +2 -0
- data/public/javascripts/admin/aloha/i18n/en.dict +2 -0
- data/public/javascripts/admin/aloha/i18n/pl.dict +5 -0
- data/public/javascripts/admin/aloha/images/base.png +0 -0
- data/public/javascripts/admin/aloha/images/base_big.png +0 -0
- data/public/javascripts/admin/aloha/images/base_multi.png +0 -0
- data/public/javascripts/admin/aloha/images/fade_in.png +0 -0
- data/public/javascripts/admin/aloha/images/fade_out.png +0 -0
- data/public/javascripts/admin/aloha/images/gentics_logo.png +0 -0
- data/public/javascripts/admin/aloha/images/grabhandle.png +0 -0
- data/public/javascripts/admin/aloha/images/maximize.png +0 -0
- data/public/javascripts/admin/aloha/images/pin.png +0 -0
- data/public/javascripts/admin/aloha/images/removeformat.png +0 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/examples/triSports.css +86 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/examples/triSports.html +44 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/i18n/de.dict +4 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/i18n/en.dict +4 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/i18n/fr.dict +4 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/plugin.js +1 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/product.js +1 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/2xu-wetsuit.jpg +0 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/asics-noosa.jpg +0 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/fivefingers-kso.jpg +0 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/kuota-kueen-k.jpg +0 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/mizuno-wave-musha2.jpg +0 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/product.css +69 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/product_button.gif +0 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/simplon-mrt.jpg +0 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/trek-fuel-ex.jpg +0 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/trisports.jpg +0 -0
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.plugins.Product/resources/zoggs-predator.jpg +0 -0
- data/public/javascripts/admin/aloha/plugins/{com.example.aloha.DummySave → com.example.aloha.plugins.Save}/i18n/de.dict +0 -0
- data/public/javascripts/admin/aloha/plugins/{com.example.aloha.DummySave → com.example.aloha.plugins.Save}/i18n/en.dict +0 -0
- data/public/javascripts/admin/aloha/plugins/{com.example.aloha.DummySave → com.example.aloha.plugins.Save}/i18n/fi.dict +0 -0
- data/public/javascripts/admin/aloha/plugins/{com.example.aloha.DummySave → com.example.aloha.plugins.Save}/i18n/fr.dict +0 -0
- data/public/javascripts/admin/aloha/plugins/{com.example.aloha.DummySave → com.example.aloha.plugins.Save}/i18n/it.dict +0 -0
- data/public/javascripts/admin/aloha/plugins/{com.example.aloha.DummySave → com.example.aloha.plugins.Save}/plugin.js +0 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Abbr/examples/AlohaAbbr.css +48 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Abbr/examples/AlohaAbbr.html +69 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Abbr/i18n/de.dict +4 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Abbr/i18n/en.dict +4 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Abbr/plugin.js +7 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Format/i18n/pl.dict +30 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Format/plugin.js +1 -1
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.HighlightEditables/plugin.js +1 -1
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/LinkList.js +7 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/delicious.js +7 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/i18n/pl.dict +4 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/plugin.js +1 -1
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/css/LinkChecker.css +14 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/examples/AlohaLinkChecker.css +49 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/examples/AlohaLinkChecker.html +82 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/i18n/en.dict +27 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/plugin.js +7 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.LinkChecker/proxy.php +235 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.List/plugin.js +1 -1
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Paste/plugin.js +7 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Paste/wordpastehandler.js +7 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.TOC/i18n/de.dict +1 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.TOC/i18n/en.dict +1 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.TOC/plugin.js +1 -1
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/i18n/de.dict +2 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/i18n/en.dict +2 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/i18n/pl.dict +12 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/plugin.js +1 -1
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/resources/table.css +28 -110
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/resources/wai_green.png +0 -0
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Table/resources/wai_red.png +0 -0
- data/public/javascripts/admin/asset_collections.js +11 -7
- data/public/javascripts/admin/contents.js +3 -1
- data/public/javascripts/admin/site.js +9 -3
- data/public/javascripts/admin/snippets.js +1 -1
- data/public/stylesheets/admin/box.css +5 -0
- data/public/stylesheets/admin/formtastic_changes.css +5 -1
- data/public/stylesheets/admin/inline_editor.css +22 -5
- data/public/stylesheets/admin/installation.css +50 -0
- data/public/stylesheets/admin/layout.css +9 -0
- metadata +176 -127
- data/app/controllers/home_controller.rb +0 -7
- data/app/views/admin/snippets/index.html.haml +0 -15
- data/app/views/home/show.html.haml +0 -4
- data/app/views/layouts/admin/box.html.haml +0 -19
- data/app/views/layouts/application.html.haml +0 -7
- data/lib/generators/locomotive/copy_assets/copy_assets_generator.rb +0 -14
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/de.dict +0 -2
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/en.dict +0 -2
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/eo.dict +0 -2
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/fi.dict +0 -2
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/fr.dict +0 -2
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/i18n/it.dict +0 -2
- data/public/javascripts/admin/aloha/plugins/com.example.aloha.DummyDC/plugin.js +0 -7
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/de.dict +0 -20
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/en.dict +0 -20
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/eo.dict +0 -16
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/fi.dict +0 -20
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/fr.dict +0 -16
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/i18n/it.dict +0 -20
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.GCN/plugin.js +0 -7
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/css/jquery.autocomplete.css +0 -48
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/deps/jquery.autocomplete.js +0 -1
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/ressource.js +0 -7
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/ressourcedummy.js +0 -7
- data/public/javascripts/admin/aloha/plugins/com.gentics.aloha.plugins.Link/ressourceregistry.js +0 -7
- data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Loader/plugin.js +0 -1
- data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Person/i18n/en.dict +0 -2
- data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Person/i18n/fi.dict +0 -2
- data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Person/i18n/fr.dict +0 -2
- data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Person/person.css +0 -3
- data/public/javascripts/admin/aloha/plugins/eu.iksproject.plugins.Person/plugin.js +0 -1
- data/public/javascripts/admin/aloha/plugins/simpletable/plugin.js.deactivated +0 -2330
data/Gemfile
CHANGED
@@ -8,8 +8,9 @@ gem 'warden'
|
|
8
8
|
gem 'devise', '= 1.1.3'
|
9
9
|
|
10
10
|
gem 'mongoid', '2.0.0.beta.19'
|
11
|
-
gem 'bson_ext', '1.1.
|
11
|
+
gem 'bson_ext', '1.1.5'
|
12
12
|
gem 'locomotive_mongoid_acts_as_tree', '0.1.5.1', :require => 'mongoid_acts_as_tree'
|
13
|
+
gem 'will_paginate'
|
13
14
|
|
14
15
|
gem 'haml', '= 3.0.18'
|
15
16
|
gem 'locomotive_liquid', '2.2.2', :require => 'liquid'
|
@@ -26,29 +27,30 @@ gem 'actionmailer-with-request'
|
|
26
27
|
gem 'heroku'
|
27
28
|
gem 'httparty', '>= 0.6.1'
|
28
29
|
gem 'RedCloth'
|
29
|
-
gem 'delayed_job', '2.1.
|
30
|
-
gem 'delayed_job_mongoid', '1.0.
|
30
|
+
gem 'delayed_job', '2.1.2'
|
31
|
+
gem 'delayed_job_mongoid', '1.0.1'
|
31
32
|
gem 'rubyzip'
|
33
|
+
gem 'jammit-s3'
|
32
34
|
|
33
35
|
# The rest of the dependencies are for use when in the locomotive dev environment
|
34
36
|
|
35
37
|
group :development do
|
36
|
-
# Using
|
37
|
-
gem '
|
38
|
-
gem 'cgi_multipart_eof_fix'
|
39
|
-
gem 'fastthread'
|
38
|
+
# Using unicorn_rails instead of webrick (default server)
|
39
|
+
gem 'unicorn'
|
40
40
|
end
|
41
41
|
|
42
42
|
group :test, :development do
|
43
|
-
gem
|
43
|
+
gem "ruby-debug", :platforms => :mri_18
|
44
|
+
gem "ruby-debug19", :platforms => :mri_19
|
44
45
|
end
|
45
46
|
|
46
47
|
group :test do
|
47
48
|
gem 'autotest'
|
49
|
+
gem 'ZenTest'
|
48
50
|
gem 'growl-glue'
|
49
|
-
gem 'rspec-rails', '
|
51
|
+
gem 'rspec-rails', '2.3.1'
|
50
52
|
gem 'factory_girl_rails'
|
51
|
-
gem 'pickle'
|
53
|
+
gem 'pickle'
|
52
54
|
gem 'capybara'
|
53
55
|
|
54
56
|
gem 'database_cleaner'
|
@@ -13,8 +13,17 @@ module Admin
|
|
13
13
|
respond_to do |format|
|
14
14
|
if @content.save
|
15
15
|
format.json { render :json => { :content => @content } }
|
16
|
+
format.html do
|
17
|
+
flash[@content_type.slug.singularize] = @content.aliased_attributes
|
18
|
+
redirect_to params[:success_callback]
|
19
|
+
end
|
16
20
|
else
|
17
21
|
format.json { render :json => { :content => @content, :errors => @content.errors } }
|
22
|
+
format.html do
|
23
|
+
flash[@content_type.slug.singularize] = @content.aliased_attributes
|
24
|
+
flash['errors'] = @content.errors_to_hash
|
25
|
+
redirect_to params[:error_callback]
|
26
|
+
end
|
18
27
|
end
|
19
28
|
end
|
20
29
|
end
|
@@ -23,7 +32,7 @@ module Admin
|
|
23
32
|
|
24
33
|
def set_content_type
|
25
34
|
@content_type = current_site.content_types.where(:slug => params[:slug]).first
|
26
|
-
render :json => { :error => 'Api not enabled'} and return false unless @content_type.api_enabled
|
35
|
+
render :json => { :error => 'Api not enabled' } and return false unless @content_type.api_enabled
|
27
36
|
end
|
28
37
|
|
29
38
|
end
|
@@ -3,7 +3,7 @@ module Admin
|
|
3
3
|
|
4
4
|
include Locomotive::Routing::SiteDispatcher
|
5
5
|
|
6
|
-
layout 'admin/application'
|
6
|
+
layout '/admin/layouts/application'
|
7
7
|
|
8
8
|
before_filter :authenticate_admin!
|
9
9
|
|
@@ -49,7 +49,7 @@ module Admin
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def set_locale
|
52
|
-
I18n.locale = current_admin.locale
|
52
|
+
I18n.locale = current_admin.locale rescue Locomotive.config.default_locale
|
53
53
|
end
|
54
54
|
|
55
55
|
end
|
@@ -1,19 +1,22 @@
|
|
1
1
|
module Admin
|
2
2
|
class CrossDomainSessionsController < BaseController
|
3
3
|
|
4
|
-
layout 'admin/box'
|
4
|
+
layout '/admin/layouts/box'
|
5
5
|
|
6
6
|
skip_before_filter :verify_authenticity_token
|
7
7
|
|
8
8
|
skip_before_filter :validate_site_membership
|
9
9
|
|
10
|
-
skip_before_filter :set_locale, :only => :create
|
11
|
-
|
12
10
|
before_filter :authenticate_admin!, :only => :new
|
13
11
|
|
14
12
|
def new
|
15
13
|
if site = current_admin.sites.detect { |s| s._id.to_s == params[:target_id] }
|
16
|
-
|
14
|
+
if Rails.env == 'development'
|
15
|
+
@target = site.full_subdomain
|
16
|
+
else
|
17
|
+
@target = site.domains_without_subdomain.first || site.full_subdomain
|
18
|
+
end
|
19
|
+
|
17
20
|
current_admin.reset_switch_site_token!
|
18
21
|
else
|
19
22
|
redirect_to admin_pages_path
|
@@ -17,22 +17,21 @@ module Admin
|
|
17
17
|
:failed => @job && @job.last_error.present?
|
18
18
|
} }
|
19
19
|
end
|
20
|
-
|
21
20
|
end
|
22
21
|
|
23
22
|
def new; end
|
24
23
|
|
25
24
|
def create
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
25
|
+
begin
|
26
|
+
Locomotive::Import::Job.run!(params[:zipfile], current_site, {
|
27
|
+
:samples => Boolean.set(params[:samples]),
|
28
|
+
:reset => Boolean.set(params[:reset])
|
29
|
+
})
|
31
30
|
|
32
|
-
flash[:notice] = t(
|
31
|
+
flash[:notice] = t("flash.admin.imports.create.#{Locomotive.config.delayed_job ? 'notice' : 'done'}")
|
33
32
|
|
34
|
-
redirect_to admin_import_url
|
35
|
-
|
33
|
+
redirect_to Locomotive.config.delayed_job ? admin_import_url : new_admin_import_url
|
34
|
+
rescue
|
36
35
|
@error = t('errors.messages.invalid_theme_file')
|
37
36
|
flash[:alert] = t('flash.admin.imports.create.alert')
|
38
37
|
|
@@ -40,23 +39,5 @@ module Admin
|
|
40
39
|
end
|
41
40
|
end
|
42
41
|
|
43
|
-
protected
|
44
|
-
|
45
|
-
def store_zipfile!
|
46
|
-
return nil if params[:zipfile].blank?
|
47
|
-
|
48
|
-
file = CarrierWave::SanitizedFile.new(params[:zipfile])
|
49
|
-
|
50
|
-
uploader = ThemeUploader.new(current_site)
|
51
|
-
|
52
|
-
begin
|
53
|
-
uploader.store!(file)
|
54
|
-
rescue CarrierWave::IntegrityError
|
55
|
-
return nil
|
56
|
-
end
|
57
|
-
|
58
|
-
uploader.identifier
|
59
|
-
end
|
60
|
-
|
61
42
|
end
|
62
43
|
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
module Admin
|
2
|
+
class InstallationController < BaseController
|
3
|
+
|
4
|
+
layout '/admin/layouts/box'
|
5
|
+
|
6
|
+
skip_before_filter :require_site
|
7
|
+
|
8
|
+
skip_before_filter :authenticate_admin!
|
9
|
+
|
10
|
+
skip_before_filter :verify_authenticity_token
|
11
|
+
|
12
|
+
skip_before_filter :validate_site_membership
|
13
|
+
|
14
|
+
before_filter :is_step_already_done?
|
15
|
+
|
16
|
+
before_filter :allow_installation?
|
17
|
+
|
18
|
+
def show
|
19
|
+
request.get? ? self.handle_get : self.handle_post
|
20
|
+
end
|
21
|
+
|
22
|
+
protected
|
23
|
+
|
24
|
+
def handle_get
|
25
|
+
case params[:step].to_i
|
26
|
+
when 2 then @account = Account.new
|
27
|
+
when 3 then @site = Site.new
|
28
|
+
end
|
29
|
+
render "step_#{params[:step]}"
|
30
|
+
end
|
31
|
+
|
32
|
+
def handle_post
|
33
|
+
case params[:step].to_i
|
34
|
+
when 2 # create account
|
35
|
+
@account = Account.create(params[:account])
|
36
|
+
if @account.valid?
|
37
|
+
redirect_to admin_installation_step_url(3)
|
38
|
+
else
|
39
|
+
render 'step_2'
|
40
|
+
end
|
41
|
+
when 3 # create site
|
42
|
+
@site = Site.new(params[:site])
|
43
|
+
@site.memberships.build :account => Account.first, :admin => true
|
44
|
+
@site.save
|
45
|
+
|
46
|
+
if @site.valid?
|
47
|
+
begin
|
48
|
+
unless params[:zipfile].blank?
|
49
|
+
Locomotive::Import::Job.run!(params[:zipfile], @site, { :samples => true })
|
50
|
+
end
|
51
|
+
rescue Exception => e
|
52
|
+
logger.error "Import failed because of #{e.message}"
|
53
|
+
end
|
54
|
+
|
55
|
+
redirect_to admin_session_url(:host => Site.first.domains.first, :port => request.port)
|
56
|
+
else
|
57
|
+
render 'step_3'
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def is_step_already_done?
|
63
|
+
case params[:step].to_i
|
64
|
+
when 2 # already an account in db
|
65
|
+
if Account.count > 0
|
66
|
+
@step_done = t('admin.installation.step_2.done', Account.first.attributes)
|
67
|
+
render 'step_2' and return false
|
68
|
+
end
|
69
|
+
else
|
70
|
+
true
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def allow_installation?
|
75
|
+
redirect_to admin_pages_url if Site.count > 0 && Account.count > 0
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
@@ -6,6 +6,6 @@ class ApplicationController < ActionController::Base
|
|
6
6
|
# rescue_from Exception, :with => :render_error
|
7
7
|
#
|
8
8
|
# def render_error
|
9
|
-
# render :template => "/admin/errors/500", :layout => 'admin/box', :status => 500
|
9
|
+
# render :template => "/admin/errors/500", :layout => '/admin/layouts/box', :status => 500
|
10
10
|
# end
|
11
11
|
end
|
@@ -12,10 +12,4 @@ module Admin::AssetsHelper
|
|
12
12
|
asset.new_record? || asset.stylesheet? || asset.javascript?
|
13
13
|
end
|
14
14
|
|
15
|
-
def image_picker_include_tags
|
16
|
-
html = javascript_include_tag 'admin/plugins/json2', 'admin/plugins/scrollTo', 'admin/plugins/codemirror/codemirror', 'admin/plugins/fancybox', 'admin/plugins/plupload/plupload.full', 'admin/plugins/imagepicker'
|
17
|
-
html += stylesheet_link_tag 'admin/plugins/fancybox', 'admin/fancybox_changes'
|
18
|
-
html
|
19
|
-
end
|
20
|
-
|
21
15
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
module Admin::
|
1
|
+
module Admin::BoxHelper
|
2
2
|
|
3
|
-
def
|
3
|
+
def box_flash_message
|
4
4
|
if not flash.empty?
|
5
5
|
content_tag :div, flash.values.first,
|
6
6
|
:id => "flash-#{flash.keys.first}",
|
@@ -10,8 +10,12 @@ module Admin::LoginHelper
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
13
|
+
def box_button_tag(label)
|
14
14
|
content_tag(:button, content_tag(:span, label), :type => 'submit', :class => 'button')
|
15
15
|
end
|
16
16
|
|
17
|
+
def next_installation_step_link(step = 1, label = nil)
|
18
|
+
link_to(content_tag(:span, label || t('admin.installation.common.next')), admin_installation_step_url(step), :class => 'button')
|
19
|
+
end
|
20
|
+
|
17
21
|
end
|
@@ -7,7 +7,7 @@ module Admin::CustomFieldsHelper
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def options_for_order_by(content_type, collection_name)
|
10
|
-
options = %w{updated_at _position_in_list}.map do |type|
|
10
|
+
options = %w{created_at updated_at _position_in_list}.map do |type|
|
11
11
|
[t("admin.content_types.form.order_by.#{type.gsub(/^_/, '')}"), type]
|
12
12
|
end
|
13
13
|
options + options_for_highlighted_field(content_type, collection_name)
|
@@ -16,7 +16,7 @@ module Admin::CustomFieldsHelper
|
|
16
16
|
def options_for_highlighted_field(content_type, collection_name)
|
17
17
|
custom_fields_collection_name = "ordered_#{collection_name.singularize}_custom_fields".to_sym
|
18
18
|
collection = content_type.send(custom_fields_collection_name)
|
19
|
-
collection.delete_if { |f| f.label == 'field name' }
|
19
|
+
collection.delete_if { |f| f.label == 'field name' || f.kind == 'file' }
|
20
20
|
collection.map { |field| [field.label, field._name] }
|
21
21
|
end
|
22
22
|
|
@@ -18,6 +18,7 @@ class AssetCollection
|
|
18
18
|
## callbacks ##
|
19
19
|
before_validation :normalize_slug
|
20
20
|
before_save :store_asset_positions!
|
21
|
+
after_destroy :remove_uploaded_files
|
21
22
|
|
22
23
|
## validations ##
|
23
24
|
validates_presence_of :site, :name, :slug
|
@@ -68,4 +69,13 @@ class AssetCollection
|
|
68
69
|
end
|
69
70
|
end
|
70
71
|
end
|
72
|
+
|
73
|
+
def remove_uploaded_files # callbacks are not called on each asset so we do it manually
|
74
|
+
self.assets.each do |asset|
|
75
|
+
self.asset_custom_fields.each do |field|
|
76
|
+
asset.send(:"remove_#{field._name}!") if field.kind == 'file'
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
71
81
|
end
|
@@ -28,6 +28,7 @@ class ContentInstance
|
|
28
28
|
## methods ##
|
29
29
|
|
30
30
|
alias :visible? :_visible?
|
31
|
+
alias :_permalink :_slug
|
31
32
|
|
32
33
|
def site_id # needed by the uploader of custom fields
|
33
34
|
self.content_type.site_id
|
@@ -37,6 +38,24 @@ class ContentInstance
|
|
37
38
|
self._visible || self._visible.nil?
|
38
39
|
end
|
39
40
|
|
41
|
+
def aliased_attributes # TODO: move it to the custom_fields gem
|
42
|
+
hash = { :created_at => self.created_at, :updated_at => self.updated_at }
|
43
|
+
|
44
|
+
self.custom_fields.each do |field|
|
45
|
+
case field.kind
|
46
|
+
when 'file' then hash[field._alias] = self.send(field._name.to_sym).url
|
47
|
+
else
|
48
|
+
hash[field._alias] = self.send(field._name.to_sym)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
hash
|
53
|
+
end
|
54
|
+
|
55
|
+
def errors_to_hash
|
56
|
+
Hash.new.replace(self.errors)
|
57
|
+
end
|
58
|
+
|
40
59
|
def to_liquid
|
41
60
|
Locomotive::Liquid::Drops::Content.new(self)
|
42
61
|
end
|
data/app/models/content_type.rb
CHANGED
@@ -25,6 +25,7 @@ class ContentType
|
|
25
25
|
## callbacks ##
|
26
26
|
before_validation :normalize_slug
|
27
27
|
before_save :set_default_values
|
28
|
+
after_destroy :remove_uploaded_files
|
28
29
|
|
29
30
|
## validations ##
|
30
31
|
validates_presence_of :site, :name, :slug
|
@@ -62,7 +63,16 @@ class ContentType
|
|
62
63
|
(if conditions.nil? || conditions.empty?
|
63
64
|
self.contents
|
64
65
|
else
|
65
|
-
|
66
|
+
conditions_with_names = {}
|
67
|
+
|
68
|
+
conditions.each do |key, value|
|
69
|
+
# convert alias (key) to name
|
70
|
+
field = self.content_custom_fields.detect { |f| f._alias == key }
|
71
|
+
|
72
|
+
conditions_with_names[field._name.to_sym] = value
|
73
|
+
end
|
74
|
+
|
75
|
+
self.contents.where(conditions_with_names)
|
66
76
|
end).sort { |a, b| (a.send(column) || 0) <=> (b.send(column) || 0) }
|
67
77
|
end
|
68
78
|
|
@@ -84,7 +94,7 @@ class ContentType
|
|
84
94
|
protected
|
85
95
|
|
86
96
|
def set_default_values
|
87
|
-
self.order_by ||= '
|
97
|
+
self.order_by ||= 'created_at'
|
88
98
|
self.highlighted_field_name ||= self.content_custom_fields.first._name
|
89
99
|
end
|
90
100
|
|
@@ -93,4 +103,12 @@ class ContentType
|
|
93
103
|
self.slug.slugify! if self.slug.present?
|
94
104
|
end
|
95
105
|
|
106
|
+
def remove_uploaded_files # callbacks are not called on each content so we do it manually
|
107
|
+
self.contents.each do |content|
|
108
|
+
self.content_custom_fields.each do |field|
|
109
|
+
content.send(:"remove_#{field._name}!") if field.kind == 'file'
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
96
114
|
end
|
@@ -31,7 +31,7 @@ module Models
|
|
31
31
|
|
32
32
|
def sort_children!(ids)
|
33
33
|
ids.each_with_index do |id, position|
|
34
|
-
child = self.children.detect { |p| p._id == id }
|
34
|
+
child = self.children.detect { |p| p._id == BSON::ObjectId(id) }
|
35
35
|
child.position = position
|
36
36
|
child.save
|
37
37
|
end
|
@@ -44,10 +44,7 @@ module Models
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def hacked_descendants
|
47
|
-
|
48
|
-
_new_record_var = self.instance_variable_get(:@new_record)
|
49
|
-
_new_record = _new_record_var != false
|
50
|
-
return [] if _new_record
|
47
|
+
return [] if new_record?
|
51
48
|
self.class.all_in(path_field => [self._id]).order_by tree_order
|
52
49
|
end
|
53
50
|
|
@@ -56,6 +53,7 @@ module Models
|
|
56
53
|
def change_parent
|
57
54
|
if self.parent_id_changed?
|
58
55
|
self.fix_position(false)
|
56
|
+
self.position = nil # make it move to bottom
|
59
57
|
self.add_to_list_bottom
|
60
58
|
self.instance_variable_set :@_will_move, true
|
61
59
|
end
|
@@ -81,7 +79,7 @@ module Models
|
|
81
79
|
end
|
82
80
|
|
83
81
|
def add_to_list_bottom
|
84
|
-
self.position
|
82
|
+
self.position ||= (::Page.where(:_id.ne => self._id).and(:parent_id => self.parent_id).max(:position) || 0) + 1
|
85
83
|
end
|
86
84
|
|
87
85
|
def remove_from_list
|
data/app/models/site.rb
CHANGED
@@ -40,6 +40,10 @@ class Site
|
|
40
40
|
|
41
41
|
## methods ##
|
42
42
|
|
43
|
+
def domains=(array)
|
44
|
+
array = [] if array.blank?; super(array)
|
45
|
+
end
|
46
|
+
|
43
47
|
def accounts
|
44
48
|
Account.criteria.in(:_id => self.memberships.collect(&:account_id))
|
45
49
|
end
|
@@ -50,15 +54,19 @@ class Site
|
|
50
54
|
|
51
55
|
def add_subdomain_to_domains
|
52
56
|
self.domains ||= []
|
53
|
-
(self.domains <<
|
57
|
+
(self.domains << self.full_subdomain).uniq!
|
54
58
|
end
|
55
59
|
|
56
60
|
def domains_without_subdomain
|
57
|
-
(self.domains || []) - [
|
61
|
+
(self.domains || []) - [self.full_subdomain]
|
58
62
|
end
|
59
63
|
|
60
64
|
def domains_with_subdomain
|
61
|
-
((self.domains || []) + [
|
65
|
+
((self.domains || []) + [self.full_subdomain]).uniq
|
66
|
+
end
|
67
|
+
|
68
|
+
def full_subdomain
|
69
|
+
"#{self.subdomain}.#{Locomotive.config.default_domain}"
|
62
70
|
end
|
63
71
|
|
64
72
|
def to_liquid
|
@@ -1,8 +1,8 @@
|
|
1
1
|
- title link_to(@asset_collection.name.blank? ? @asset_collection.name_was : @asset_collection.name, '#', :rel => 'asset_collection_name', :title => t('.ask_for_name'), :class => 'editable')
|
2
2
|
|
3
3
|
- content_for :head do
|
4
|
-
=
|
5
|
-
=
|
4
|
+
= include_javascripts :asset_collections
|
5
|
+
= include_stylesheets :fancybox
|
6
6
|
|
7
7
|
- content_for :submenu do
|
8
8
|
= render 'admin/shared/menu/assets'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
- content_for :head do
|
2
|
-
=
|
3
|
-
=
|
2
|
+
= include_javascripts :edit_custom_fields, :assets
|
3
|
+
= include_stylesheets :custom_fields
|
4
4
|
|
5
5
|
= f.inputs :name => :information do
|
6
6
|
= f.input :name
|
@@ -1,6 +1,6 @@
|
|
1
1
|
- content_for :head do
|
2
|
-
=
|
3
|
-
=
|
2
|
+
= include_javascripts :custom_fields
|
3
|
+
= include_stylesheets :fancybox
|
4
4
|
|
5
5
|
= f.inputs :name => :information do
|
6
6
|
= f.input :name
|
@@ -1,5 +1,5 @@
|
|
1
1
|
- content_for :head do
|
2
|
-
=
|
3
|
-
=
|
2
|
+
= include_javascripts :edit_custom_fields, :contents
|
3
|
+
= include_stylesheets :fancybox
|
4
4
|
|
5
5
|
= render 'admin/custom_fields/custom_form', :form => f, :title => :attributes, :parent => @content_type
|
@@ -1,5 +1,5 @@
|
|
1
1
|
- content_for :head do
|
2
|
-
=
|
2
|
+
= include_javascripts :site
|
3
3
|
|
4
4
|
= f.foldable_inputs :name => :information, :style => "#{'display: none' unless @site.new_record?}" do
|
5
5
|
= f.input :name, :required => false
|
@@ -23,7 +23,7 @@
|
|
23
23
|
%li{ :class => "item added #{'last' if index == @site.domains.size - 1}"}
|
24
24
|
%em
|
25
25
|
http://
|
26
|
-
= text_field_tag '
|
26
|
+
= text_field_tag 'site[domains][]', name, :class => 'string label void domain'
|
27
27
|
|
28
28
|
= error_on_domain(@site, name)
|
29
29
|
%span.actions
|
@@ -32,7 +32,7 @@
|
|
32
32
|
%li.item.template
|
33
33
|
%em
|
34
34
|
http://
|
35
|
-
= text_field_tag 'label', t('formtastic.hints.site.domain_name'), :class => 'string label void'
|
35
|
+
= text_field_tag 'label', t('formtastic.hints.site.domain_name'), :class => 'string label void domain'
|
36
36
|
|
37
37
|
%span.actions
|
38
38
|
= link_to image_tag('admin/form/icons/trash.png'), '#', :class => 'remove first', :confirm => t('admin.messages.confirm')
|