diff --git a/config/application.rb b/config/application.rb new file mode 100644 index 00000000..fe4c8dd6 --- /dev/null +++ b/config/application.rb @@ -0,0 +1,49 @@ +require File.expand_path('../boot', __FILE__) + +require "action_controller/railtie" +require "action_mailer/railtie" +require "active_resource/railtie" +require "mongoid/railtie" + +# Auto-require default libraries and those for the current Rails environment. +Bundler.require :default, Rails.env + +module Locomotive + class Application < Rails::Application + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + + # Add additional load paths for your own custom dirs + # config.load_paths += %W( #{config.root}/extras ) + config.autoload_paths += %W( #{config.root}/app/models/extensions #{config.root}/app/models/extensions/site #{config.root}/app/models/extensions/page #{config.root}/app/models/extensions/asset #{config.root}/app/cells/admin) + + # Only load the plugins named here, in the order given (default is alphabetical). + # :all can be used as a placeholder for all plugins not explicitly named + # config.plugins = [ :exception_notification, :ssl_requirement, :all ] + + # Activate observers that should always be running + # config.active_record.observers = :cacher, :garbage_collector, :forum_observer + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + # config.time_zone = 'Central Time (US & Canada)' + + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')] + # config.i18n.default_locale = :de + + # Configure generators values. Many other options are available, be sure to check the documentation. + # config.generators do |g| + # g.orm :active_record + # g.template_engine :erb + # g.test_framework :test_unit, :fixture => true + # end + + # Configure the default encoding used in templates for Ruby 1.9. + config.encoding = "utf-8" + + # Configure sensitive parameters which will be filtered from the log file. + config.filter_parameters << :password + end +end \ No newline at end of file diff --git a/config/initializers/carrierwave.rb b/config/initializers/carrierwave.rb new file mode 100644 index 00000000..23f689b6 --- /dev/null +++ b/config/initializers/carrierwave.rb @@ -0,0 +1,38 @@ +require 'locomotive' + +# TODO: Make this store to RAILS_ROOT/permanent + +# On bushido, the app directory is destroyed on every update, so everything is lost. +# The only place this doesn't happen is the RAILS_ROOT/permanent folder. +# Also, RAILS_ROOT/permanent/store is symlinked to RAILS_ROOT/public/store on every update, +# so store your publicly-accessible files here (e.g. templates, etc.) + +CarrierWave.configure do |config| + + config.cache_dir = File.join(Rails.root, 'tmp', 'uploads') + + case Rails.env.to_sym + + when :development + config.storage = :file + config.root = File.join(Rails.root, 'public') + + when :production + if Locomotive.bushido? + config.storage = :file + config.root = File.join(Rails.root, 'public') + config.store_dir = 'store' + else + config.storage = :s3 + config.s3_access_key_id = ENV['S3_KEY_ID'] + config.s3_secret_access_key = ENV['S3_SECRET_KEY'] + config.s3_bucket = ENV['S3_BUCKET'] + # config.s3_cname = 'ENV['S3_CNAME'] + + # settings for the local filesystem + # config.storage = :file + # config.root = File.join(Rails.root, 'public') + end + end + +end unless Locomotive.engine? diff --git a/config/initializers/locomotive.rb b/config/initializers/locomotive.rb new file mode 100644 index 00000000..c61fb70d --- /dev/null +++ b/config/initializers/locomotive.rb @@ -0,0 +1,82 @@ +require File.dirname(__FILE__) + '/../../lib/locomotive.rb' + +Locomotive.configure do |config| + + # A single locomotive instance can serve one single site or many. + # If you want to run many different websites, you will have to specify + # your own domain name (ex: locomotivehosting.com). + # + # Ex: + # config.multi_sites do |multi_sites| + # # each new website you add will have a default entry based on a subdomain + # # and the multi_site_domain value (ex: website_1.locomotivehosting.com). + # multi_sites.domain = 'example.com' #'myhostingplatform.com' + # + # # define the reserved subdomains + # # Ex: + # multi_sites.reserved_subdomains = %w(www admin email blog webmail mail support help site sites) + # end + config.multi_sites = false + + # configure the hosting target for the production environment. Locomotive can be installed in: + # - your own server + # - Heroku (you need to create an account in this case) + # - Bushi.do (see the bushi.do website for more explanations) + # + # the possible options are: server, heroku, bushido or auto (default) + # if you select 'auto', Locomotive will look after specific ENV variables to check + # the matching platform (Heroku and Bushido set their own ENV variables). + # + config.hosting = :auto + + # In case you host Locomotive in Heroku, the engine uses the heroku api to add / remove domains. + # there are 2 ways of passing heroku credentials to Locomotive + # - from ENV variables: HEROKU_LOGIN & HEROKU_PASSWORD + # - from this file, see the example below and uncomment it if needed + # config.heroku = { + # :login => '', + # :password => '' + # } + + # Locomotive uses the DelayedJob gem for the site import module. + # In case you want to deploy to Heroku, you will have to pay for an extra dyno. + # If you do not mind about importing theme without DelayedJob, disable it. + # + # Warning: this option is not used if you deploy on bushi.do and we set automatically the value to true. + config.delayed_job = false + + # configure how many items we display in sub menu in the "Contents" section. + # config.lastest_items_nb = 5 + + # default locale (for now, only en, de, fr, pt-BR and it are supported) + config.default_locale = :en + + # tell if logs are enabled. Useful for debug purpose. + config.enable_logs = true + + # Configure the e-mail address which will be shown in the DeviseMailer, NotificationMailer, ...etc + # if you do not put the domain name in the email, Locomotive will take the default domain name depending + # on your deployment target (server, Heroku, Bushido, ...etc) + # + # Ex: + # config.mailer_sender = 'support' + # # => 'support@heroku.com' (Heroku), 'support@bushi.do' (Bushido), 'support@example.com' (Dev) or 'support@' (Multi-sites) + config.mailer_sender = 'support' + + # allow apps using the engine to add their own Liquid drops, variables and similar available + # in Liquid templates, extending the assigns used while rendering. + # follow the Dependency Injection pattern + # config.context_assign_extensions = {} + + # Rack-cache settings, mainly used for the inline resizing image module. Default options: + # config.rack_cache = { + # :verbose => true, + # :metastore => URI.encode("file:#{Rails.root}/tmp/dragonfly/cache/meta"), # URI encoded in case of spaces + # :entitystore => URI.encode("file:#{Rails.root}/tmp/dragonfly/cache/body") + # } + # If you do want to disable it for good, just use the following syntax + # config.rack_cache = false + # + # Note: by default, rack/cache is disabled in the Heroku platform + +end unless Locomotive.engine? || Rails.env.test? diff --git a/config/locales/carrierwave.ru.yml b/config/locales/carrierwave.ru.yml new file mode 100644 index 00000000..bea94f7a --- /dev/null +++ b/config/locales/carrierwave.ru.yml @@ -0,0 +1,4 @@ +ru: + carrierwave: + errors: + integrity: 'не допустимый тип файла.' diff --git a/config/locales/flash.ru.yml b/config/locales/flash.ru.yml new file mode 100644 index 00000000..ae1c1a3a --- /dev/null +++ b/config/locales/flash.ru.yml @@ -0,0 +1,106 @@ +ru: + flash: + admin: + pages: + create: + notice: "Страница успешно создана." + alert: "Страница не создана." + update: + notice: "Страница успешно обновлена." + alert: "Страница не обновлена." + sort: + notice: "Страницы успешно отсортированы." + destroy: + notice: "Страницы успешно удалены." + + contents: + create: + notice: "Контент успешно создан." + alert: "Контент не создан." + update: + notice: "Контент успешно обновлен." + alert: "Контент не обновлен." + sort: + notice: "Содержимое успешно отсортировано." + destroy: + notice: "Содержимое успешно удалено." + + content_types: + create: + notice: "Модель успешно создана." + alert: "Модель не создана." + update: + notice: "Модель успешно обновлена." + alert: "Модель не обновлена." + destroy: + notice: "Модель успешно удалена." + + current_site: + update: + notice: "Мой сайт успешно обновлен." + alert: "Мой сайт не обновлен." + + snippets: + create: + notice: "Сниппет успешно создан." + alert: "Сниппет не создан." + update: + notice: "Сниппет успешно обновлен." + alert: "Сниппет не обновлен." + destroy: + notice: "Сниппет успешно удален." + + accounts: + create: + notice: "Аккаунт успешно создан." + alert: "Аккаунт не создан." + + my_account: + update: + notice: "Мой аккаунт успешно обновлен." + alert: "Мой аккаунт не обновлен." + + sites: + create: + notice: "Сайт успешно создан." + alert: "Сайт не создан." + destroy: + notice: "Сайт успешно удален." + + memberships: + create: + notice: "Учетная запись успешно создана." + alert: "Учетная запись не создана." + already_created: "Учетная запись уже добавлена в текущий сайт." + + assets: + create: + notice: "Файл успешно создан." + alert: "Файл не создан." + update: + notice: "Файл успешно обновлен." + alert: "Файл не обновлен." + + theme_assets: + create: + notice: "Файл успешно создан." + alert: "Файл не создан." + update: + notice: "Файл успешно обновлен." + alert: "Файл не обновлен." + destroy: + notice: "Файл успешно удален." + + custom_fields: + update: + alert: "Поле не обновлено" + + cross_domain_sessions: + create: + alert: "Вам необходимо войти" + + import: + create: + done: "Ваш сайт успешно обновлен" + notice: "Ваш сайт обновляется" + alert: "Импорт не завершен." diff --git a/lib/locomotive/configuration.rb b/lib/locomotive/configuration.rb index 60b7c177..db6b344e 100644 --- a/lib/locomotive/configuration.rb +++ b/lib/locomotive/configuration.rb @@ -7,7 +7,7 @@ module Locomotive :reserved_subdomains => %w{www admin email blog webmail mail support help site sites}, # :forbidden_paths => %w{layouts snippets stylesheets javascripts assets admin system api}, :reserved_slugs => %w{stylesheets javascripts assets admin images api pages edit}, - :locales => %w{en de fr pt-BR it nl es}, + :locales => %w{en de fr pt-BR it nl es ru}, :cookie_key => '_locomotive_session', :enable_logs => false, :hosting => :auto,