Commit 91ad6ff6 authored by cp's avatar cp

initial

git-svn-id: http://svn.sp-service.com.ua/svnroot/svn/base_site/trunk@2 d975c5f9-4e99-4c31-b122-d878075b96d9
parent 80fbd953
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'
# Ignore bundler config.
/.bundle
# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal
# Ignore all logfiles and tempfiles.
/log/*
!/log/.keep
/tmp
<?xml version="1.0" encoding="UTF-8"?>
<Settings><!--This file was automatically generated by Ruby plugin.
You are allowed to:
1. Reorder generators
2. Remove generators
3. Add installed generators
To add new installed generators automatically delete this file and reload the project.
--><GeneratorsGroup><Generator name="active_record:devise" /><Generator name="assets" /><Generator name="bootstrap:install" /><Generator name="bootstrap:layout" /><Generator name="bootstrap:partial" /><Generator name="bootstrap:themed" /><Generator name="ckeditor:install" /><Generator name="ckeditor:pundit_policy" /><Generator name="coffee:assets" /><Generator name="controller" /><Generator name="devise" /><Generator name="devise:controllers" /><Generator name="devise:install" /><Generator name="devise:views" /><Generator name="devise:views:i18n_templates" /><Generator name="devise:views:locale" /><Generator name="erb:controller" /><Generator name="erb:mailer" /><Generator name="erb:scaffold" /><Generator name="generator" /><Generator name="haml:application_layout" /><Generator name="helper" /><Generator name="integration_test" /><Generator name="jbuilder" /><Generator name="job" /><Generator name="js:assets" /><Generator name="less:assets" /><Generator name="mailer" /><Generator name="migration" /><Generator name="model" /><Generator name="mongoid:devise" /><Generator name="nested_form:install" /><Generator name="resource" /><Generator name="responders:install" /><Generator name="responders_controller" /><Generator name="scaffold" /><Generator name="scaffold_controller" /><Generator name="simple_form:install" /><Generator name="task" /><Generator name="test_unit:generator" /><Generator name="test_unit:job" /><Generator name="test_unit:plugin" /><Generator name="uploader" /></GeneratorsGroup></Settings>
<?xml version="1.0" encoding="UTF-8"?>
<Settings><!--This file was automatically generated by Ruby plugin.
You are allowed to:
1. Remove rake task
2. Add existing rake tasks
To add existing rake tasks automatically delete this file and reload the project.
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="List versions of all Rails frameworks and the environment" fullCmd="about" taksId="about" /><RakeGroup description="" fullCmd="" taksId="assets"><RakeTask description="Remove old compiled assets" fullCmd="assets:clean[keep]" taksId="clean[keep]" /><RakeTask description="Remove compiled assets" fullCmd="assets:clobber" taksId="clobber" /><RakeTask description="Load asset compile environment" fullCmd="assets:environment" taksId="environment" /><RakeTask description="Compile all the assets named in config.assets.precompile" fullCmd="assets:precompile" taksId="precompile" /><RakeTask description="" fullCmd="assets:clean" taksId="clean" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="cache_digests"><RakeTask description="Lookup first-level dependencies for TEMPLATE (like messages/show or comments/_comment.html)" fullCmd="cache_digests:dependencies" taksId="dependencies" /><RakeTask description="Lookup nested dependencies for TEMPLATE (like messages/show or comments/_comment.html)" fullCmd="cache_digests:nested_dependencies" taksId="nested_dependencies" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="ckeditor"><RakeTask description="Create nondigest versions of all ckeditor digest assets" fullCmd="ckeditor:nondigest" taksId="nondigest" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="db"><RakeTask description="Creates the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:create:all to create all databases in the config)" fullCmd="db:create" taksId="create" /><RakeTask description="Drops the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:drop:all to drop all databases in the config)" fullCmd="db:drop" taksId="drop" /><RakeGroup description="" fullCmd="" taksId="fixtures"><RakeTask description="Load fixtures into the current environment's database" fullCmd="db:fixtures:load" taksId="load" /><RakeTask description="" fullCmd="db:fixtures:identify" taksId="identify" /></RakeGroup><RakeTask description="Migrate the database (options: VERSION=x, VERBOSE=false, SCOPE=blog)" fullCmd="db:migrate" taksId="migrate" /><RakeGroup description="" fullCmd="" taksId="migrate"><RakeTask description="Display status of migrations" fullCmd="db:migrate:status" taksId="status" /><RakeTask description="" fullCmd="db:migrate:down" taksId="down" /><RakeTask description="" fullCmd="db:migrate:redo" taksId="redo" /><RakeTask description="" fullCmd="db:migrate:reset" taksId="reset" /><RakeTask description="" fullCmd="db:migrate:up" taksId="up" /></RakeGroup><RakeTask description="Rolls the schema back to the previous version (specify steps w/ STEP=n)" fullCmd="db:rollback" taksId="rollback" /><RakeGroup description="" fullCmd="" taksId="schema"><RakeGroup description="" fullCmd="" taksId="cache"><RakeTask description="Clear a db/schema_cache.dump file" fullCmd="db:schema:cache:clear" taksId="clear" /><RakeTask description="Create a db/schema_cache.dump file" fullCmd="db:schema:cache:dump" taksId="dump" /></RakeGroup><RakeTask description="Create a db/schema.rb file that is portable against any DB supported by AR" fullCmd="db:schema:dump" taksId="dump" /><RakeTask description="Load a schema.rb file into the database" fullCmd="db:schema:load" taksId="load" /><RakeTask description="" fullCmd="db:schema:load_if_ruby" taksId="load_if_ruby" /></RakeGroup><RakeTask description="Load the seed data from db/seeds.rb" fullCmd="db:seed" taksId="seed" /><RakeTask description="Create the database, load the schema, and initialize with the seed data (use db:reset to also drop the database first)" fullCmd="db:setup" taksId="setup" /><RakeGroup description="" fullCmd="" taksId="structure"><RakeTask description="Dump the database structure to db/structure.sql" fullCmd="db:structure:dump" taksId="dump" /><RakeTask description="Recreate the databases from the structure.sql file" fullCmd="db:structure:load" taksId="load" /><RakeTask description="" fullCmd="db:structure:load_if_sql" taksId="load_if_sql" /></RakeGroup><RakeTask description="Retrieves the current schema version number" fullCmd="db:version" taksId="version" /><RakeTask description="" fullCmd="db:_dump" taksId="_dump" /><RakeTask description="" fullCmd="db:abort_if_pending_migrations" taksId="abort_if_pending_migrations" /><RakeTask description="" fullCmd="db:charset" taksId="charset" /><RakeTask description="" fullCmd="db:collation" taksId="collation" /><RakeGroup description="" fullCmd="" taksId="create"><RakeTask description="" fullCmd="db:create:all" taksId="all" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="drop"><RakeTask description="" fullCmd="db:drop:all" taksId="all" /></RakeGroup><RakeTask description="" fullCmd="db:forward" taksId="forward" /><RakeTask description="" fullCmd="db:load_config" taksId="load_config" /><RakeTask description="" fullCmd="db:purge" taksId="purge" /><RakeGroup description="" fullCmd="" taksId="purge"><RakeTask description="" fullCmd="db:purge:all" taksId="all" /></RakeGroup><RakeTask description="" fullCmd="db:reset" taksId="reset" /><RakeGroup description="" fullCmd="" taksId="test"><RakeTask description="" fullCmd="db:test:clone" taksId="clone" /><RakeTask description="" fullCmd="db:test:clone_schema" taksId="clone_schema" /><RakeTask description="" fullCmd="db:test:clone_structure" taksId="clone_structure" /><RakeTask description="" fullCmd="db:test:deprecated" taksId="deprecated" /><RakeTask description="" fullCmd="db:test:load" taksId="load" /><RakeTask description="" fullCmd="db:test:load_schema" taksId="load_schema" /><RakeTask description="" fullCmd="db:test:load_structure" taksId="load_structure" /><RakeTask description="" fullCmd="db:test:prepare" taksId="prepare" /><RakeTask description="" fullCmd="db:test:purge" taksId="purge" /></RakeGroup></RakeGroup><RakeGroup description="" fullCmd="" taksId="doc"><RakeTask description="Generate docs for the app -- also available doc:rails, doc:guides (options: TEMPLATE=/rdoc-template.rb, TITLE=&quot;Custom Title&quot;)" fullCmd="doc:app" taksId="app" /><RakeTask description="" fullCmd="doc:clobber" taksId="clobber" /><RakeTask description="" fullCmd="doc:clobber_app" taksId="clobber_app" /><RakeTask description="" fullCmd="doc:clobber_rails" taksId="clobber_rails" /><RakeTask description="" fullCmd="doc:guides" taksId="guides" /><RakeTask description="" fullCmd="doc:rails" taksId="rails" /><RakeTask description="" fullCmd="doc:reapp" taksId="reapp" /><RakeTask description="" fullCmd="doc:rerails" taksId="rerails" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="haml"><RakeTask description="Convert html.erb to html.haml each file in app/views" fullCmd="haml:erb2haml" taksId="erb2haml" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="log"><RakeTask description="Truncates all *.log files in log/ to zero bytes (specify which logs with LOGS=test,development)" fullCmd="log:clear" taksId="clear" /></RakeGroup><RakeTask description="Prints out your Rack middleware stack" fullCmd="middleware" taksId="middleware" /><RakeTask description="Enumerate all annotations (use notes:optimize, :fixme, :todo for focus)" fullCmd="notes" taksId="notes" /><RakeGroup description="" fullCmd="" taksId="notes"><RakeTask description="Enumerate a custom annotation, specify with ANNOTATION=CUSTOM" fullCmd="notes:custom" taksId="custom" /><RakeTask description="" fullCmd="notes:fixme" taksId="fixme" /><RakeTask description="" fullCmd="notes:optimize" taksId="optimize" /><RakeTask description="" fullCmd="notes:todo" taksId="todo" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="rails"><RakeTask description="Applies the template supplied by LOCATION=(/path/to/template) or URL" fullCmd="rails:template" taksId="template" /><RakeTask description="Update configs and some other initially generated files (or use just update:configs or update:bin)" fullCmd="rails:update" taksId="update" /><RakeGroup description="" fullCmd="" taksId="templates"><RakeTask description="" fullCmd="rails:templates:copy" taksId="copy" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="update"><RakeTask description="" fullCmd="rails:update:bin" taksId="bin" /><RakeTask description="" fullCmd="rails:update:configs" taksId="configs" /></RakeGroup></RakeGroup><RakeTask description="Print out all defined routes in match order, with names" fullCmd="routes" taksId="routes" /><RakeTask description="Generate a cryptographically secure secret key (this is typically used to generate a secret for cookie sessions)" fullCmd="secret" taksId="secret" /><RakeTask description="Report code statistics (KLOCs, etc) from the application or engine" fullCmd="stats" taksId="stats" /><RakeTask description="Runs all tests in test folder" fullCmd="test" taksId="test" /><RakeGroup description="" fullCmd="" taksId="test"><RakeTask description="Run tests quickly by merging all types and not resetting db" fullCmd="test:all" taksId="all" /><RakeGroup description="" fullCmd="" taksId="all"><RakeTask description="Run tests quickly, but also reset db" fullCmd="test:all:db" taksId="db" /></RakeGroup><RakeTask description="Run tests quickly, but also reset db" fullCmd="test:db" taksId="db" /><RakeTask description="" fullCmd="test:controllers" taksId="controllers" /><RakeTask description="" fullCmd="test:deprecate_all" taksId="deprecate_all" /><RakeTask description="" fullCmd="test:functionals" taksId="functionals" /><RakeTask description="" fullCmd="test:generators" taksId="generators" /><RakeTask description="" fullCmd="test:helpers" taksId="helpers" /><RakeTask description="" fullCmd="test:integration" taksId="integration" /><RakeTask description="" fullCmd="test:jobs" taksId="jobs" /><RakeTask description="" fullCmd="test:mailers" taksId="mailers" /><RakeTask description="" fullCmd="test:models" taksId="models" /><RakeTask description="" fullCmd="test:prepare" taksId="prepare" /><RakeTask description="" fullCmd="test:run" taksId="run" /><RakeTask description="" fullCmd="test:single" taksId="single" /><RakeTask description="" fullCmd="test:units" taksId="units" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="time"><RakeGroup description="" fullCmd="" taksId="zones"><RakeTask description="Displays all time zones, also available: time:zones:us, time:zones:local -- filter with OFFSET parameter, e.g., OFFSET=-6" fullCmd="time:zones:all" taksId="all" /><RakeTask description="" fullCmd="time:zones:local" taksId="local" /><RakeTask description="" fullCmd="time:zones:us" taksId="us" /></RakeGroup></RakeGroup><RakeGroup description="" fullCmd="" taksId="tmp"><RakeTask description="Clear session, cache, and socket files from tmp/ (narrow w/ tmp:sessions:clear, tmp:cache:clear, tmp:sockets:clear)" fullCmd="tmp:clear" taksId="clear" /><RakeTask description="Creates tmp directories for sessions, cache, sockets, and pids" fullCmd="tmp:create" taksId="create" /><RakeGroup description="" fullCmd="" taksId="cache"><RakeTask description="" fullCmd="tmp:cache:clear" taksId="clear" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="pids"><RakeTask description="" fullCmd="tmp:pids:clear" taksId="clear" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="sessions"><RakeTask description="" fullCmd="tmp:sessions:clear" taksId="clear" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="sockets"><RakeTask description="" fullCmd="tmp:sockets:clear" taksId="clear" /></RakeGroup></RakeGroup><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="doc" taksId="doc" /><RakeTask description="" fullCmd="doc/app" taksId="doc/app" /><RakeTask description="" fullCmd="doc/app/created.rid" taksId="doc/app/created.rid" /><RakeTask description="" fullCmd="file" taksId="file" /><RakeTask description="" fullCmd="environment" taksId="environment" /><RakeTask description="" fullCmd="html" taksId="html" /><RakeTask description="" fullCmd="html/created.rid" taksId="html/created.rid" /><RakeGroup description="" fullCmd="" taksId="railties"><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="" fullCmd="railties:install:migrations" taksId="migrations" /></RakeGroup></RakeGroup><RakeTask description="" fullCmd="tmp" taksId="tmp" /><RakeTask description="" fullCmd="tmp/cache" taksId="tmp/cache" /><RakeTask description="" fullCmd="tmp/cache/assets" taksId="tmp/cache/assets" /><RakeTask description="" fullCmd="tmp/cache/assets/development" taksId="tmp/cache/assets/development" /><RakeTask description="" fullCmd="tmp/cache/assets/production" taksId="tmp/cache/assets/production" /><RakeTask description="" fullCmd="tmp/cache/assets/test" taksId="tmp/cache/assets/test" /><RakeTask description="" fullCmd="tmp/pids" taksId="tmp/pids" /><RakeTask description="" fullCmd="tmp/sessions" taksId="tmp/sessions" /><RakeTask description="" fullCmd="tmp/sockets" taksId="tmp/sockets" /></RakeGroup></Settings>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
<entry name="!?*.aj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>
\ No newline at end of file
<component name="CopyrightManager">
<settings default="" />
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="PROJECT" charset="UTF-8" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_3" default="false" assert-keyword="false" jdk-15="false" project-jdk-name="ruby-2.1.5-p273" project-jdk-type="RUBY_SDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
<component name="SvnBranchConfigurationManager">
<option name="mySupportsUserInfoFilter" value="true" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/base_site.iml" filepath="$PROJECT_DIR$/base_site.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="svn" />
</component>
</project>
\ No newline at end of file
ruby-2.1.5
\ No newline at end of file
# Load DSL and set up stages
require 'capistrano/setup'
# Include default deployment tasks
require 'capistrano/deploy'
# https://github.com/capistrano/rvm
require 'capistrano/rvm'
# https://github.com/capistrano/bundler
require 'capistrano/bundler'
# require 'capistrano/rails'
require 'capistrano/rails'
require 'capistrano/faster_assets'
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
# Invoke staging as default
# Rake::Task[:staging].invoke
\ No newline at end of file
source 'https://rubygems.org'
gem 'rails', '4.2.5.1'
gem 'mysql2'
gem 'uglifier', '>= 1.3.0'
gem 'sass-rails', '~> 5.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'twitter-bootstrap-rails'
gem 'bootstrap-sass', '~> 3.3.4'
gem 'haml-rails'
gem 'devise'
gem 'devise-i18n'
gem 'ckeditor'
gem 'carrierwave'
gem 'mini_magick'
gem 'simple_form'
gem 'nested_form'
gem 'font-awesome-rails'
gem 'jquery-ui-rails'
gem 'acts_as_list'
gem 'will_paginate'
gem 'bootstrap-will_paginate'
gem 'momentjs-rails', '>= 2.9.0'
gem 'bootstrap3-datetimepicker-rails', '~> 4.15.35'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'tzinfo-data', platforms: [:mingw, :mswin, :jruby]
group :development do
gem 'web-console', '~> 2.0'
gem 'capistrano', '~> 3.4'
gem 'capistrano-faster-assets', '~> 1.0'
gem 'capistrano-bundler'
gem 'capistrano-rvm'
gem 'capistrano-rails'
end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.2.5.1)
actionpack (= 4.2.5.1)
actionview (= 4.2.5.1)
activejob (= 4.2.5.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.5.1)
actionview (= 4.2.5.1)
activesupport (= 4.2.5.1)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.5.1)
activesupport (= 4.2.5.1)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
activejob (4.2.5.1)
activesupport (= 4.2.5.1)
globalid (>= 0.3.0)
activemodel (4.2.5.1)
activesupport (= 4.2.5.1)
builder (~> 3.1)
activerecord (4.2.5.1)
activemodel (= 4.2.5.1)
activesupport (= 4.2.5.1)
arel (~> 6.0)
activesupport (4.2.5.1)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
acts_as_list (0.7.2)
activerecord (>= 3.0)
arel (6.0.3)
autoprefixer-rails (6.3.6)
execjs
bcrypt (3.1.11-x64-mingw32)
bcrypt (3.1.11-x86-mingw32)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
bootstrap-sass (3.3.6)
autoprefixer-rails (>= 5.2.1)
sass (>= 3.3.4)
bootstrap-will_paginate (0.0.10)
will_paginate
bootstrap3-datetimepicker-rails (4.15.35)
momentjs-rails (>= 2.8.1)
builder (3.2.2)
capistrano (3.4.0)
i18n
rake (>= 10.0.0)
sshkit (~> 1.3)
capistrano-bundler (1.1.4)
capistrano (~> 3.1)
sshkit (~> 1.2)
capistrano-faster-assets (1.0.2)
capistrano (>= 3.1)
capistrano-rails (1.1.6)
capistrano (~> 3.1)
capistrano-bundler (~> 1.1)
capistrano-rvm (0.1.2)
capistrano (~> 3.0)
sshkit (~> 1.2)
carrierwave (0.11.0)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
json (>= 1.7)
mime-types (>= 1.16)
ckeditor (4.1.6)
cocaine
orm_adapter (~> 0.5.0)
climate_control (0.0.3)
activesupport (>= 3.0)
cocaine (0.5.8)
climate_control (>= 0.0.3, < 1.0)
coffee-rails (4.1.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.1.x)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.10.0)
commonjs (0.2.7)
concurrent-ruby (1.0.1)
debug_inspector (0.0.2)
devise (3.5.6)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5)
responders
thread_safe (~> 0.1)
warden (~> 1.2.3)
devise-i18n (1.0.1)
erubis (2.7.0)
execjs (2.6.0)
font-awesome-rails (4.6.0.0)
railties (>= 3.2, < 5.1)
globalid (0.3.6)
activesupport (>= 4.1.0)
haml (4.0.7)
tilt
haml-rails (0.9.0)
actionpack (>= 4.0.1)
activesupport (>= 4.0.1)
haml (>= 4.0.6, < 5.0)
html2haml (>= 1.0.1)
railties (>= 4.0.1)
html2haml (2.0.0)
erubis (~> 2.7.0)
haml (~> 4.0.0)
nokogiri (~> 1.6.0)
ruby_parser (~> 3.5)
i18n (0.7.0)
jbuilder (2.4.1)
activesupport (>= 3.0.0, < 5.1)
multi_json (~> 1.2)
jquery-rails (4.1.1)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
jquery-ui-rails (5.0.5)
railties (>= 3.2.16)
json (1.8.3)
less (2.6.0)
commonjs (~> 0.2.7)
less-rails (2.7.1)
actionpack (>= 4.0)
less (~> 2.6.0)
sprockets (> 2, < 4)
tilt
loofah (2.0.3)
nokogiri (>= 1.5.9)
mail (2.6.4)
mime-types (>= 1.16, < 4)
mime-types (3.0)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0221)
mini_magick (4.5.1)
mini_portile2 (2.0.0)
minitest (5.8.4)
momentjs-rails (2.11.0)
railties (>= 3.1)
multi_json (1.11.2)
mysql2 (0.4.3-x64-mingw32)
mysql2 (0.4.3-x86-mingw32)
nested_form (0.3.2)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-ssh (3.1.1)
nokogiri (1.6.7.2-x64-mingw32)
mini_portile2 (~> 2.0.0.rc2)
nokogiri (1.6.7.2-x86-mingw32)
mini_portile2 (~> 2.0.0.rc2)
orm_adapter (0.5.0)
rack (1.6.4)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.2.5.1)
actionmailer (= 4.2.5.1)
actionpack (= 4.2.5.1)
actionview (= 4.2.5.1)
activejob (= 4.2.5.1)
activemodel (= 4.2.5.1)
activerecord (= 4.2.5.1)
activesupport (= 4.2.5.1)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.5.1)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.7)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
railties (4.2.5.1)
actionpack (= 4.2.5.1)
activesupport (= 4.2.5.1)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (11.1.2)
rdoc (4.2.2)
json (~> 1.4)
responders (2.1.2)
railties (>= 4.2.0, < 5.1)
ruby_parser (3.8.1)
sexp_processor (~> 4.1)
sass (3.4.22)
sass-rails (5.0.4)
railties (>= 4.0.0, < 5.0)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
sdoc (0.4.1)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
sexp_processor (4.7.0)
simple_form (3.2.1)
actionpack (> 4, < 5.1)
activemodel (> 4, < 5.1)
sprockets (3.6.0)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.0.4)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sshkit (1.9.0)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
thor (0.19.1)
thread_safe (0.3.5)
tilt (2.0.2)
turbolinks (2.5.3)
coffee-rails
twitter-bootstrap-rails (3.2.2)
actionpack (>= 3.1)
execjs (>= 2.2.2, >= 2.2)
less-rails (>= 2.5.0)
railties (>= 3.1)
tzinfo (1.2.2)
thread_safe (~> 0.1)
tzinfo-data (1.2016.3)
tzinfo (>= 1.0.0)
uglifier (3.0.0)
execjs (>= 0.3.0, < 3)
warden (1.2.6)
rack (>= 1.0)
web-console (2.3.0)
activemodel (>= 4.0)
binding_of_caller (>= 0.7.2)
railties (>= 4.0)
sprockets-rails (>= 2.0, < 4.0)
will_paginate (3.1.0)
PLATFORMS
x64-mingw32
x86-mingw32
DEPENDENCIES
acts_as_list
bootstrap-sass (~> 3.3.4)
bootstrap-will_paginate
bootstrap3-datetimepicker-rails (~> 4.15.35)
capistrano (~> 3.4)
capistrano-bundler
capistrano-faster-assets (~> 1.0)
capistrano-rails
capistrano-rvm
carrierwave
ckeditor
coffee-rails (~> 4.1.0)
devise
devise-i18n
font-awesome-rails
haml-rails
jbuilder (~> 2.0)
jquery-rails
jquery-ui-rails
mini_magick
momentjs-rails (>= 2.9.0)
mysql2
nested_form
rails (= 4.2.5.1)
sass-rails (~> 5.0)
sdoc (~> 0.4.0)
simple_form
turbolinks
twitter-bootstrap-rails
tzinfo-data
uglifier (>= 1.3.0)
web-console (~> 2.0)
will_paginate
BUNDLED WITH
1.11.2
== README
This README would normally document whatever steps are necessary to get the
application up and running.
Things you may want to cover:
* Ruby version
* System dependencies
* Configuration
* Database creation
* Database initialization
* How to run the test suite
* Services (job queues, cache servers, search engines, etc.)
* Deployment instructions
* ...
Please feel free to use a different markup language if you do not plan to run
<tt>rake doc:app</tt>.
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
Rails.application.load_tasks
//= require jquery-ui/sortable
//= require turbolinks
//= require jquery_nested_form
//= require moment
//= require bootstrap-datetimepicker
//= require_tree ./admin
window.linksPanelShowed = false
$(document).on 'ready page:load', ->
if window.linksPanelShowed
$('#links_panel').css left: 0
$(document).on 'mouseover click', '#links_panel', ->
unless window.linksPanelShowed
$linksPanel = $(this)
$linksPanel.animate {left: 0}, 100, ->
$linksPanel.find('.handle i').removeClass('fa-chevron-circle-right').addClass('fa-chevron-circle-left')
window.linksPanelShowed = true
$(document).on 'mouseleave', '#links_panel', ->
$linksPanel = $(this)
$linksPanel.animate {left: 10 - $linksPanel.width()}, 250, ->
$linksPanel.find('.handle i').removeClass('fa-chevron-circle-left').addClass('fa-chevron-circle-right')
window.linksPanelShowed = false
$(document).on 'click', '#links_panel .handle', ->
$linksPanel = $('#links_panel')
$linksPanel.animate {left: 10 - $linksPanel.width()}, 250, ->
$linksPanel.find('.handle i').removeClass('fa-chevron-circle-left').addClass('fa-chevron-circle-right')
window.linksPanelShowed = false
$(document).on 'ready page:load', ->
init_datetime_picker($('.datetime_picker'))
init_date_picker($('.date_picker'))
@init_datetime_picker = (element) ->
element.datetimepicker locale: $('html').attr('lang'), format: 'YYYY-MM-DD HH:mm', useCurrent: false
@init_date_picker = (element) ->
element.datetimepicker locale: $('html').attr('lang'), format: 'YYYY-MM-DD', useCurrent: false
\ No newline at end of file
class @CurrentPath
constructor: () ->
@path = $(location).attr('href').replace(/https?:\/\/[^\/]+/i, "")
replace_param: (param, value) ->
regex = new RegExp('(' + param + '[^&?]*).', 'g')
@path = @path.replace(regex, param + '=' + value)
this
remove_param: (param) ->
regex = new RegExp('(' + param + '[^&?]*).', 'g')
@path = @path.replace(regex, '').replace(/[?&]+$/, '')
this
get_path: () ->
@path
$(document).on 'ready page:load', ->
$('table.editable_rows').each ->
initEditableRows(this)
initCreation(this)
initEditableRows = (table) ->
$table = $(table)
$table.find('a.edit').click (event) ->
event.preventDefault()
initRowEditing($(this))
$table.find('a.destroy').click (event) ->
event.preventDefault()
event.stopPropagation()
$button = $(this)
confirmation = $button.data('confirm')
if !confirmation or confirm(confirmation)
$row = $button.closest('tr')
$.ajax
type: $button.data('method')
url: $button.attr('href') + '.json'
success: () -> $row.remove()
error: (data) -> setErrors($row, data)
initRowEditing = ($editButton) ->
$controlsCell = $editButton.parent('td')
$row = $controlsCell.parent('tr')
orygControlHtml = $controlsCell.find('a').detach()
initControls($controlsCell)
initInputs($row)
$row.find('td[data] input').keypress (event) ->
if event.which == 13
event.preventDefault()
save()
$controlsCell.find('.save').click (event) ->
event.preventDefault()
save()
save = () ->
clearErrors($row)
data = {}
$row.find('td[data]').each ->
$cell = $(this)
data[$cell.attr('data')] = $cell.find('input').val()
ajaxData = {}
ajaxData[$table.data('resource')] = data
$.ajax
type: "PUT"
url: window.location.href + "/#{$row.data('id')}.json"
data: ajaxData
success: () -> restoreRow(true)
error: (data) -> setErrors($row, data)
restoreRow = (updated) ->
$controlsCell.html(orygControlHtml)
$row.find('td[data]').each ->
$cell = $(this)
$input = $cell.find('input')
$cell.html(if updated then $input.val() else $input.data('undo'))
$controlsCell.find('.cancel').click (event) ->
event.preventDefault()
restoreRow(false)
initCreation = (table) ->
$table = $(table)
$createButton = $table.find('a.create')
$row = $createButton.closest('tr')
initInputs($row)
$row.find('td[data]').keypress (event) ->
if event.which == 13
event.preventDefault()
create()
$createButton.click (event) ->
event.preventDefault()
create()
create = () ->
clearErrors($row)
data = {}
$row.find('td[data]').each ->
$cell = $(this)
data[$cell.attr('data')] = $cell.find('input').val()
ajaxData = {}
ajaxData[$table.data('resource')] = data
$.ajax
type: "POST"
url: window.location.href
data: ajaxData
success: (data) ->
newTableBody = $("<div>#{data}</div>").find('table.editable_rows tbody').html()
$table.find('tbody').html(newTableBody)
$row.find('input:text').val('')
initEditableRows(table)
error: (data) -> setErrors($row, data)
initInputs = ($row) ->
$row.find('td[data]').each ->
$cell = $(this)
value = $cell.html()
$cell.html("<input data-undo='#{value}' value='#{value}'><span class='has-error'/>")
initControls = ($cell) ->
$cell.html("<a class='btn btn-primary btn-xs save' href='#'><i class='fa fa-check'/></a> <a class='btn btn-default btn-xs cancel' href='#'><i class='fa fa-remove'/></a>")
clearErrors = ($row) ->
$row.find("td[data] span").html('')
setErrors = ($row, data) ->
for k,v of data.responseJSON
$row.find("td[data='#{k}'] span").html(v.join())
HISTORY_ID = 'tabular_filter'
$ ->
$(document).on 'change focusout', 'tr#filters .filter', filterChanged
$(document).on 'click', 'tr#filters .clear_tabular_filters', clearFilters
filterChanged = ->
refreshTable($(this).parents('table'))
clearFilters = (e) ->
e.preventDefault()
table = $(this).closest('table')
table.find('tr#filters .filter').val('')
refreshTable(table)
refreshTable = (table) ->
path = new CurrentPath(table.closest('.popup_window').attr('data-path')).remove_param('tf').remove_param('page').get_path()
$.ajax path,
data: filtersHash(table),
asynchronous: true
evalScripts: true
method: "get"
success: (data, textStatus, jqXHR) ->
tableBody = $(data).find('tbody').html()
paginate = $(data).find('.refresh_pagination').html()
refreshData(table, tableBody, paginate)
if table.closest('.popup_window').length
table.closest('.popup_window').attr('data-path', this.url)
else
history.pushState({id: HISTORY_ID, tbody: tableBody, paginate: paginate, filters: filtersHistory()}, null, this.url);
$(window).on 'popstate', () ->
if history.state && history.state.id == HISTORY_ID
refreshData(filteredTable(), history.state.tbody, history.state.paginate)
i = 0
$('table thead tr#filters .filter').each ->
$(this).val(history.state.filters[i++])
filteredTable = (data = 'body') ->
$(data).find('table thead tr#filters').closest('table')
filtersHash = (table) ->
filters = {}
filtersRow = table.find('tr#filters')
filtersRow.find('.filter').each () ->
value = $(this).val()
mode = ''
if value
if $(this).hasClass("date_picker")
mode = 'd'
else if $(this).hasClass("boolean")
mode = 'b'
filters["tf#{mode}_#{$(this).attr('id')}"] = value
filters
refreshData = (table, tbody, paginate) ->
table.find('tbody').html(tbody);
$('.refresh_pagination').html(paginate)
#$(window).resize(); #!!!special for med with its fixed tables!!!
filtersHistory = ->
filters = []
$('table thead tr#filters .filter').each ->
filters.push($(this).val())
filters
\ No newline at end of file
$ ->
newsletter_progress = $('#newsletter_progress')
if newsletter_progress.length > 0
send_emails()
send_emails = () ->
$.getJSON window.location.href, {}, (newsletter) ->
$('#newsletter_progress').css('width', 100*newsletter.processed_id/newsletter.last_id + '%');
if newsletter.processed_id < newsletter.last_id
send_emails()
else
$('.page-header h1').html('Sending of newsletter is complete.')
$('#sending_complete').show()
$(document).on 'ready page:load', ->
$('#page_mode').each -> refresh_menu_item_fieldset($(this))
$('#page_mode').change -> refresh_menu_item_fieldset($(this))
refresh_menu_item_fieldset = (item) ->
if item.val() == 'link'
$('#path_fields').hide()
$('#page_fields').hide()
$('#link_fields').show()
else if item.val() == 'page'
$('#path_fields').hide()
$('#page_fields').show()
$('#link_fields').hide()
else
$('#path_fields').show()
$('#page_fields').hide()
$('#link_fields').hide()
$(document).on 'ready page:load', ->
if $('.sort_icon').length
init_sortable('tbody', 'tr')
init_sortable = (container_selector, item_selector, axis = 'y', handle_selector = '.sort_icon') ->
$(container_selector).sortable(
items: item_selector
handle: handle_selector
axis: axis
stop: (event, ui) ->
position = $(ui.item).index() + 1
$.ajax({
type: "PUT"
url: window.location.href + "/#{$(ui.item).data('id')}"
data: {position: position}
});
).disableSelection()
//= require_tree ./admin_front
\ No newline at end of file
#= require jquery-ui/draggable
#= require jquery-ui/resizable
$ ->
$('#blocks_controls').draggable()
$(document).on "click", '.block', ->
createInput(this)
createInput = (block) ->
window.currentBlock = block
window.blocksControlsDisplay = $('#blocks_controls').css('display')
$('#blocks_controls').hide()
key = $(block).attr('class').match(/block_key_\w+/)[0].replace(/block_key_/, '')
$.get "/#{$('html').attr('lang')}/admin/blocks/#{key}/edit", (data) ->
$('#block_editor').remove()
$("<div id='block_editor'></div>").appendTo('body').draggable().resizable().css(blockRect())
.animate
top: $(window).height() * 0.2
left: $(window).width() * 0.2
height: $(window).height() * 0.6
width: $(window).width() * 0.6
, 250
, ->
$(data).appendTo('#block_editor')
resizeTextArea()
$('#block_editor textarea').each ->
$textArea = $(this)
$textArea.val($(block).html()) unless $textArea.val()
$textArea.val($textArea.val().replace(/\s+/gi, " ").replace(/<br\s*[\/]?>|<\/p\s*>\s*/gi, "\n").replace(/<p>\s*/gi, ""))
$(document).on "resize", "#block_editor", (e) ->
resizeTextArea()
resizeTextArea = ->
$('#block_editor textarea').height($('#block_editor').height() - 100)
blockRect = ->
top: $(window.currentBlock).offset().top - window.scrollY
left: $(window.currentBlock).offset().left - window.scrollX
height: $(window.currentBlock).height()
width: $(window.currentBlock).width()
$(document).on "mousemove", "#block_editor a", (e) ->
e.stopImmediatePropagation()
$(document).on "wheel", "#block_editor", (e) ->
e.stopImmediatePropagation()
e.target.type == 'textarea'
# e.target.scroll(e)
false
# e.preventDefault()
$(document).on "click", "#cancel_block_editing", (e) ->
$('#block_editor').animate
opacity: 0
top: $('#block_editor').position().top + 0.25 * $('#block_editor').height()
left: $('#block_editor').position().left + 0.25 * $('#block_editor').width()
height: 0.5 * $('#block_editor').height()
width: 0.5 * $('#block_editor').width()
, 250
, ->
$('#block_editor').remove()
$('#blocks_controls').css(display: window.blocksControlsDisplay)
e.preventDefault()
false
$(document).on "click", "#apply_block_editing", (e) ->
$('#block_editor').animate blockRect(), 250, ->
$('#block_editor form').submit()
$('#block_editor').remove()
e.preventDefault()
false
CKEDITOR.editorConfig = function (config) {
config.filebrowserBrowseUrl = "/admin/ckeditor/attachment_files";
config.filebrowserFlashBrowseUrl = "/admin/ckeditor/attachment_files";
config.filebrowserFlashUploadUrl = "/admin/ckeditor/attachment_files";
config.filebrowserImageBrowseLinkUrl = "/admin/ckeditor/pictures";
config.filebrowserImageBrowseUrl = "/admin/ckeditor/pictures";
config.filebrowserImageUploadUrl = "/admin/ckeditor/pictures";
config.filebrowserUploadUrl = "/admin/ckeditor/attachment_files";
//read more here: http://docs.ckeditor.com/#!/api/CKEDITOR.config
config.extraPlugins = 'toolbarswitch,apply';
config.removePlugins = 'about,a11yhelp,dialogadvtab,templates,newpage,pagebreak,wsc,forms';
config.toolbar_minToolbar =
[
{name: 'document', items: ['Apply', 'Cancel']},
{name: 'basicstyles', items: ['Bold', 'Italic']},
//{name: 'links', items: ['Link', 'Unlink']},
{name: 'paragraph', items: ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock']},
{name: 'tools', items: ['Toolbarswitch']}
];
config.toolbar_maxToolbar =
[
{name: 'document', items: ['Source', '-', 'Apply', 'Cancel']},
{
name: 'clipboard',
groups: ['clipboard', 'undo'],
items: ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo']
},
{
name: 'editing',
groups: ['find', 'selection', 'spellchecker'],
items: ['Find', 'Replace', '-', 'SelectAll', '-', 'Scayt']
},
{name: 'insert', items: ['Image', 'Flash', 'Table', 'HorizontalRule', 'SpecialChar', 'Smiley', 'Iframe']},
{name: 'links', items: ['Link', 'Unlink', 'Anchor']},
'/',
{name: 'styles', items: ['Styles', 'Format', 'Font', 'FontSize']},
{
name: 'basicstyles',
groups: ['basicstyles', 'cleanup'],
items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat']
},
{name: 'colors', items: ['TextColor', 'BGColor']},
{
name: 'paragraph',
groups: ['list', 'indent', 'blocks', 'align', 'bidi'],
items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl']
},
{name: 'tools', items: ['ShowBlocks', 'Toolbarswitch']}
];
config.toolbar = 'minToolbar';
config.smallToolbar = 'minToolbar';
config.maximizedToolbar = 'maxToolbar';
config.allowedContent = true;
return true;
};
/*
Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'apply', 'en', {
apply: 'Apply',
cancel: 'Cancel'
});
/*
Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'apply', 'ru', {
apply: 'Применить',
cancel: 'Отменить'
});
/*
Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'apply', 'uk', {
apply: 'Застосувати',
cancel: 'Скасувати'
});
CKEDITOR.plugins.add('apply', {
requires: ['button', 'toolbar', 'maximize'],
lang: 'en,ru,uk', // %REMOVE_LINE_CORE%
icons: 'apply,cancel', // %REMOVE_LINE_CORE%
hidpi: true, // %REMOVE_LINE_CORE%
init: function (editor) {
if (typeof(window.applyCKEditorChanges) != "function") return;
function close(discard_changes) {
if (editor.commands.maximize.state == 1) {
editor.commands.maximize.exec();
}
editor.destroy(discard_changes);
if (typeof(window.applyCloseCKEditor) == "function") {
window.applyCloseCKEditor(Object.keys(CKEDITOR.instances).length);
}
}
var lang = editor.lang;
var applyFunction = {
exec: function (editor) {
close(false);
window.applyCKEditorChanges(editor.getData());
}
};
var cancelFunction = {
exec: function (editor) {
close(true);
}
};
var applyCommand = editor.addCommand('apply', applyFunction);
applyCommand.modes = {wysiwyg: 1, source: 1};
applyCommand.canUndo = false;
applyCommand.readOnly = 1;
editor.ui.addButton && editor.ui.addButton('Apply', {
label: lang.apply.apply,
command: 'apply',
toolbar: 'document,0'
});
var cancelCommand = editor.addCommand('cancel', cancelFunction);
cancelCommand.modes = {wysiwyg: 1, source: 1};
cancelCommand.canUndo = false;
cancelCommand.readOnly = 1;
editor.ui.addButton && editor.ui.addButton('Cancel', {
label: lang.apply.cancel,
command: 'cancel',
toolbar: 'document,1'
});
}
});
/*
Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'toolbarswitch', 'en', {
toolbarswitch: 'Maximize and switch toolbar'
});
/*
Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'toolbarswitch', 'ru', {
toolbarswitch: 'Увеличить и переключить панель инструментов'
});
/*
Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'toolbarswitch', 'uk', {
toolbarswitch: 'Збільшити і переключити панель інструментів'
});
/**
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Plugin that changes the toolbar and maximizes the editor
* for the big toolbar.
*
* You need a custom config to define the small and big toolbars.
* Also the maximize plug-in is needed but not the maximize button.
* For this plugin you should use the 'Toolbarswitch' button instead.
*
* CKEDITOR.replace('sometextcomponentname', {
* customConfig: '/...custom_ckeditor_config.js'
* toolbar: 'yoursmalltoolbarname',
* smallToolbar: 'yoursmalltoolbarname',
* maximizedToolbar: 'yourbigtoolbarname' });
*
* Requires:
* - Maximize plugin. But not the button that goes with it.
* - All toolbars used in the ckeditor instance have to use the 'Toolbarswitch' button instead.
* - A custom config to define the small and big toolbars.
* - jQuery
*/
function switchMe(editor, callback) {
var origCustomConfig = editor.config.customConfig;
var origContentCss = editor.config.contentsCss;
var origExtraPlugins = editor.config.extraPlugins;
var origToolbar = editor.config.toolbar;
var origSmallToolbar = editor.config.smallToolbar;
var origMaximizedToolbar = editor.config.maximizedToolbar;
var newToolbar;
//if (editor.commands.maximize.state == 2) {
if (origToolbar == origSmallToolbar) {
newToolbar = origMaximizedToolbar;
} else {
newToolbar = origSmallToolbar;
}
// Remember editing data before getting rid of the old editor
var oldEditorData = editor.getData();
var domElement = editor.element.$;
// Remove old editor and the DOM elements, else you get two editors
//var id = domElement.id;
editor.destroy(true);
CKEDITOR.replace(domElement, {
customConfig: origCustomConfig,
contentsCss: origContentCss,
toolbar: newToolbar,
smallToolbar: origSmallToolbar,
maximizedToolbar: origMaximizedToolbar,
extraPlugins: origExtraPlugins,
on: {
instanceReady: function (e) {
// Restore old editing data
if (typeof(oldEditorData) != "undefined") {
e.editor.setData(oldEditorData);
}
if (callback) {
callback.call(null, e);
}
}
}
});
}
CKEDITOR.plugins.add('toolbarswitch', {
requires: ['button', 'toolbar', 'maximize'],
lang: 'en,ru,uk', // %REMOVE_LINE_CORE%
icons: 'toolbarswitch', // %REMOVE_LINE_CORE%
hidpi: true, // %REMOVE_LINE_CORE%
init: function (editor) {
var lang = editor.lang;
var commandFunction = {
exec: function (editor) {
if (editor.config.toolbar == editor.config.maximizedToolbar) {
// For switching to the small toolbar first minimize
editor.commands.maximize.exec();
switchMe(editor, function (e) {
var newEditor = e.editor;
newEditor.fire('triggerResize');
});
} else {
switchMe(editor, function (e) {
var newEditor = e.editor;
newEditor.commands.maximize.exec();
newEditor.fire('triggerResize');
newEditor.commands.toolbarswitch.setState(CKEDITOR.TRISTATE_ON);
});
}
}
};
var command = editor.addCommand('toolbarswitch', commandFunction);
command.modes = {wysiwyg: 1, source: 1};
command.canUndo = false;
command.readOnly = 1;
editor.ui.addButton('Toolbarswitch', {
label: lang.toolbarswitch.toolbarswitch,
command: 'toolbarswitch',
toolbar: 'tools,10'
});
}
});
//= require_tree ./front
$(document).on 'ready page:load', ->
initContactUsMessage()
refreshLandingHeader()
initContactUsMessage = () ->
$('.contact_us_form #contact_message').each ->
$this = $(this)
$this.keypress (event) ->
characters_left = $this.data('characters') - $this.val().length
if characters_left <= 0
event.preventDefault()
$this.keyup () -> updateCharactersLeft()
updateCharactersLeft = () ->
characters_left = $this.data('characters') - $this.val().length
$this.closest('form').find('.characters_left').html(Math.max(characters_left, 0))
updateCharactersLeft()
$(window).scroll -> refreshLandingHeader()
refreshLandingHeader = ->
$header = $('#landing_header')
containerHeight = $header.find('.container').height()
$header.css top: if window.pageYOffset > containerHeight then -containerHeight else -window.pageYOffset
$(document).on 'click', '.zoomed_image', (e) ->
$('#cloned_zoomed_image').remove();
originalLeft = $(this).offset().left - window.pageXOffset;
originalTop = $(this).offset().top - window.pageYOffset;
originalWidth = $(this).width();
clonedImg = $(this).clone()
$(clonedImg).attr(id: 'cloned_zoomed_image', class: '');
$(clonedImg).css(top: originalTop, left: originalLeft, position: 'fixed', 'z-index': 21);
$(clonedImg).width(originalWidth);
$('body').prepend(clonedImg)
$(clonedImg).click () ->
$(clonedImg).animate width: originalWidth, left: originalLeft, top: originalTop
, 300, () -> $(clonedImg).remove()
max = 0.95
coef = $(clonedImg).width() / $(clonedImg).height()
w = $(window).height()*max * coef
if $(clonedImg).width() > $(clonedImg).height() && $(window).width()*max*coef < $(window).height()
w = $(window).width()*max
$('#cloned_zoomed_image').animate
width: w
left: ($(window).width() - w) / 2
top: ($(window).height() - w * $(this).height() / $(this).width() ) / 2
opacity: 1
, 300
e.preventDefault()
false
$(document).on 'ready page:load', ->
$(".box_sandwich").click ->
if $('.mobile_menu').hasClass('menu_open')
closeMobileMenu()
else
openMobileMenu()
$(document).on 'click', ".mobile_menu a", (e) ->
closeMobileMenu()
closeMobileMenu = () ->
console.log('close')
$('.sandwich').removeClass "close_sandwich"
$('.mobile_menu').removeClass "menu_open"
openMobileMenu = () ->
console.log('open')
$('.sandwich').addClass "close_sandwich"
$('.mobile_menu').addClass "menu_open"
$(document).on 'ready page:load', ->
$('.box_search .search_action').click (e) ->
$('.box_search form').submit()
@google_search = (query) ->
google.search.cse.element.render({gname: 'google_search', div: 'search_results'});
console.log('rendered google search');
if query
google.search.cse.element.getElement("google_search").execute(query);
console.log("search for \"#{query}\"");
gcseCallback = ->
if $('#search_results').length
console.log("search box found")
query = $('#search_results').data('query')
if (document.readyState == 'complete')
google_search(query)
else
google.setOnLoadCallback ->
google_search(query)
, true
window.__gcse = {
parsetags: 'explicit',
callback: gcseCallback
};
$(document).on 'click', "a[href*='#']:not([href^='#'])", (e) ->
if location.hostname == this.hostname
target = $(this.hash)
target = if target.length then target else $('[name=' + this.hash.slice(1) + ']')
if target.length
$('html,body').animate {scrollTop: target.offset().top - $('#landing_header .nav_menu:not(.mobile_menu):visible').height()}, 500
e.preventDefault()
false
$(document).on 'click', "a[href='#{location.pathname}']", (e) ->
$('html,body').animate {scrollTop: 0}, 500
e.preventDefault()
false
//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
//= require_tree ./shared
$(document).on 'ready page:load', ->
$("a[rel~=popover], .has-popover").popover()
$("a[rel~=tooltip], .has-tooltip").tooltip()
/*
*= require bootstrap-datetimepicker
*= require_directory ./admin
*= require_self
*/
html
height: 100%
body.admin-body
padding-top: 70px
height: 100%
.yield-container
overflow-y: auto
height: 100%
.yield-column
padding: 0 10px 20px 90px
footer
position: fixed
bottom: 0
right: 25px
color: #b2b2b8
p
margin: 0
#links_panel
position: fixed
width: 300px
padding: 0 20px
left: -250px
height: calc(100% - 85px)
z-index: 2
div
height: 100%
overflow-y: auto
ul li
a
padding: 2px 15px
&.selected
margin-left: 0
margin-right: -5px
border-left: #808080 outset 5px
.handle
position: absolute
top: calc(50% - 12px)
left: 265px
color: darkgrey
&:hover
color: #347bb7
cursor: pointer
.page-header
margin: 0 0 5px
h1
margin-top: 0
margin-bottom: 0
font-size: 24px
.form-horizontal .form-group
margin-left: 0
margin-right: 0
//body {
//
// color: #333;
// font-family: verdana, arial, helvetica, sans-serif;
// font-size: 13px;
// line-height: 18px;
//}
//
//p, ol, ul, td {
// font-family: verdana, arial, helvetica, sans-serif;
// font-size: 13px;
// line-height: 18px;
//}
//
//pre {
//// background-color: #eee;
// padding: 10px;
// font-size: 11px;
//}
//
//a {
// color: #000;
//
// &:visited {
// color: #666;
// }
//
// &:hover {
// color: #fff;
//// background-color: #000;
// }
//}
//
//div {
// &.field, &.actions {
// margin-bottom: 10px;
// }
//}
//
//#notice {
// color: green;
//}
//
//.field_with_errors {
// padding: 2px;
// background-color: red;
// display: table;
//}
////
//#error_explanation {
// width: 450px;
// border: 2px solid red;
// padding: 7px;
// padding-bottom: 0;
// margin-bottom: 20px;
// background-color: #f0f0f0;
//
// h2 {
// text-align: left;
// font-weight: bold;
// padding: 5px 5px 5px 15px;
// font-size: 12px;
// margin: -7px;
// margin-bottom: 0px;
// background-color: #c00;
// color: #fff;
// }
//
// ul li {
// font-size: 12px;
// list-style: square;
// }
//}
//
//.pagination {
// margin: 0;
//}
.sort_icon
width: 15px
cursor: pointer
\ No newline at end of file
table.editable_rows
td input
width: 100%
margin: -2px 0
td span.has-error
color: #a94442
@import "bootstrap-sprockets"
@import "bootstrap"
#filters
input
width: 100%
padding: 2px
select
width: 100%
padding: 3px
.clear_btn
text-align: center
display: inline-block
cursor: pointer
margin: 0 5px
color: black
font-weight: normal
font-size: 16px
font-family: FontAwesome
padding: 1px 8px
&:before
content: '\f00d'
&:hover, &:focus, &:active
color: red
background: rgba(0, 0, 0, 0.16)
border-radius: 3px
text-decoration: none
/*
*= require_tree ./admin_front
*/
\ No newline at end of file
//= require jquery-ui/resizable
//= require jquery-ui/draggable
@import "shared/mixin";
.block {
&:hover {
outline: 1px dashed;
outline-offset: -1px;
cursor: pointer;
opacity: 0.7;
}
}
#blocks_controls {
position: fixed;
margin: 10px;
padding: 5px;
width: 260px;
background: rgba(255, 255, 255, 0.8);
@include box-shadow(1px 1px 3px 3px rgba(44, 44, 44, 0.63));
@include border-radius(5px);
z-index: 20;
.caption {
font-size: 18px;
padding: 5px;
cursor: move;
}
a {
padding: 3px;
&.apply {
color: green;
&:hover {
color: lime;
}
}
&.cancel {
color: #d90000;
&:hover {
color: #ff4600;
}
}
}
}
#block_editor {
z-index: 20;
position: fixed;
width: 60%;
height: 60%;
left: 20%;
top: 20%;
padding: 10px;
background: white;
@include box-shadow(1px 1px 3px 3px rgba(44, 44, 44, 0.63));
@include border-radius(4px);
div {
margin: 0;
padding: 0;
}
textarea {
margin-bottom: 10px;
height: 228px;
resize: none;
overflow-y: auto;
border-top: none;
}
label {
display: none;
}
}
\ No newline at end of file
/*
*= require_directory ./front
*= require_self
*/
input
outline: none
&:hover, &:focus, &:active
outline: none
a
text-decoration: none
&:hover, &:focus, &:active, &:visited
text-decoration: none
ul
padding: 0
margin: 0
li
list-style: none
@import "shared/color"
@import "shared/mixin"
body
@media (min-width: 768px)
padding-top: 120px
header
position: fixed
top: 0
left: 0
width: 100%
height: 150px
z-index: 17
@media (max-width: 767px)
padding: 10px
position: relative
height: 40px
nav
position: relative
text-align: center
background: $main
background: -moz-linear-gradient(0deg, $main 30%, $second 93%)
background: -webkit-linear-gradient(0deg, $main 30%, $second 93%)
background: linear-gradient(0deg, $main 30%, $second 93%)
background-image: -ms-linear-gradient(0deg, $main 30%, $second 93%)
background-image: linear-gradient(0deg, $main 30%, $second 93%)
+box-shadow_2(2px 2px 5px -1px rgba(0,0,0,1), inset 0px 0px 15px 12px rgba(154, 154, 154, 0.19))
padding: 2px 0
.nav_menu
display: flex
justify-content: center
a
margin: 0 10px
line-height: 1.5
color: $white
font-weight: bold
font-size: 16px
padding: 5px 10px
border: 2px solid transparent
+border-radius(5px)
+transition(all .2s ease)
&:hover
border: 2px solid
color: $orange !important
+box-shadow(1px 1px 5px -1px black)
&:active
+box-shadow(none)
background: $main
background: -moz-linear-gradient(-180deg, $second 0%, $main 100%)
background: -webkit-linear-gradient(-180deg, $second 0%, $main 100%)
background: linear-gradient(-180deg, $second 0%, $main 100%)
background-image: -ms-linear-gradient(-180deg, $second 0%, $main 100%)
background-image: linear-gradient(-180deg, $second 0%, $main 100%)
&:visited
color: white
.contact_box
margin-top: 10%
.info_box
h1, h4
margin: 10px 0
h4
display: inline-block
border-bottom: 2px solid $main
color: $black
padding: 5px 20px
@media (max-width: 990px)
font-size: 14px
margin-top: 20px
h1
color: $main
font-weight: bold
@media (max-width: 990px )
font-size: 24px
margin: 0
.info-block
height: 59px
display: table
div
display: table-cell
vertical-align: middle
p
margin: 0
.language_box
position: absolute
top: 6px
right: 30px
.navbar-btn
margin: 0
.style_lang
background: none
color: $white
font-weight: bold !important
border: 2px solid white
padding: 5px 10px
margin: 0
&:hover
background: $white
color: $main
.dropdown-menu
text-align: center
width: 100px !important
padding: 5px 0
.dropdown-menu>.active>a
background: $main
\ No newline at end of file
@import "shared/color"
.border
border: 1px solid black
.c_green
color: $main
.s_10
font-size: 10px
.line_1
line-height: 1
.without_padding
padding-left: 0 !important
padding-right: 0 !important
.mob_back
@media (max-width: 767px)
background-color: rgba(white, .4)
@import "shared/color"
@import "shared/mixin"
.mobile_menu
position: relative
top: 0
z-index: 100
display: none
border-top: 2px solid rgba($main, .21)
border-bottom: 2px solid rgba($main, .11)
+box-shadow(inset 0 0 8px -5px black)
text-align: center
background: white
.nav_menu
a
color: $main
border: 2px solid $main
+border-radius(5px)
padding: 2px 10px
.menu_open
display: block !important
.box_sandwich
.sandwich
position: absolute
top: 20px
right: 10px
cursor: pointer
+width_height(30px, 5px)
+border-radius(2px)
background: $main
z-index: 101
&:before, &:after
position: absolute
content: ''
+width_height(30px, 5px )
+border-radius(2px)
&:before
top: -8px
left: 0
background: $main
&:after
top: 8px
left: 0
background: $main
.close_sandwich
&:after, &:before
background: $main
background: white
&:after
top: 0
+transform(rotate(-45deg))
&:before
+transform(rotate(45deg))
top: 0
\ No newline at end of file
@import "shared/color"
.h_style
padding: 0 15px
border-bottom: 4px solid white
color: $main
font-weight: bold
margin-top: 60px
font-size: 60px
.h_style_no_border
padding: 0 15px
color: $main
font-weight: bold
margin-top: 60px
font-size: 60px
\ No newline at end of file
/*
*= require_directory ./shared
*= require_self
*= require font-awesome
*/
//$green: #479724
$white: white
$black: #2A2A2A
$main: #67912f
$second: #c8f241
//$orange: #F6AE2D
$orange: #F7E565
\ No newline at end of file
////standart_veritables
$default_transition: all .2s ease
=transition($transition)
transition: $transition
-webkit-transition: $transition
-moz-transition: $transition
-o-transition: $transition
=box-shadow($box-shadow)
box-shadow: $box-shadow
-webkit-box-shadow: $box-shadow
-moz-box-shadow: $box-shadow
-o-box-shadow: $box-shadow
-ms-box-shadow: $box-shadow
= box-shadow_2($sha_1, $sha_2)
box-shadow: $sha_1, $sha_2
-webkit-box-shadow: $sha_1, $sha_2
-moz-box-shadow: $sha_1, $sha_2
-o-box-shadow: $sha_1, $sha_2
-ms-box-shadow: $sha_1, $sha_2
=border-radius($border-radius)
border-radius: $border-radius
-webkit-border-radius: $border-radius
-moz-border-radius: $border-radius
//border_box, content_box
=box-sizing($box_sizing)
-webkit-box-sizing: $box_sizing
-moz-box-sizing: $box_sizing
box-sizing: $box_sizing
=user_select($user_select)
-webkit-user-select: $user_select
-moz-user-select: $user_select
-ms-user-select: $user_select
user-select: $user_select
=transform($transform)
transform: $transform
-webkit-transform: $transform
-moz-transform: $transform
-o-transform: $transform
-ms-transform: $transform
=transform_2($transform_double_1, $transform_double_2)
transform: $transform_double_1 $transform_double_2
-webkit-transform: $transform_double_1 $transform_double_2
-moz-transform: $transform_double_1 $transform_double_2
-o-transform: $transform_double_1 $transform_double_2
-ms-transform: $transform_double_1 $transform_double_2
=transform_3( $transform_triple_1, $transform_triple_2, $transform_triple_3)
transform: $transform_triple_1 $transform_triple_2 $transform_triple_3
-webkit-transform: $transform_triple_1 $transform_triple_2 $transform_triple_3
-moz-transform: $transform_triple_1 $transform_triple_2 $transform_triple_3
-o-transform: $transform_triple_1 $transform_triple_2 $transform_triple_3
-ms-transform: $transform_triple_1 $transform_triple_2 $transform_triple_3
=ul_li($display, $vertical)
display: $display
vertical-align: $vertical
///////////////////////////////////////////////
=double_shadow($color)
+box-shadow((0 1px 0 lighten($color, 10%) inset, 0 -1px 0 darken($color, 10%) inset))
=hover-style($color)
&:hover
background: lighten($color, 3%)
= width_height($width, $height)
width: $width
height: $height
=appearance($appearance)
-webkit-appearance: $appearance
-moz-appearance: $appearance
appearance: $appearance
=transition_delay($transition_sub_1, $transition_sub_2 )
transition-delay: $transition_sub_1, $transition_sub_2
-o-transition-delay: $transition_sub_1, $transition_sub_2
-moz-transition-delay: $transition_sub_1, $transition_sub_2
-webkit-transition-delay: $transition_sub_1, $transition_sub_2
=transition_delay_single($transition_sub_1 )
transition-delay: $transition_sub_1
-o-transition-delay: $transition_sub_1
-moz-transition-delay: $transition_sub_1
-webkit-transition-delay: $transition_sub_1
=transition_2($tra_1, $tra_2)
transition: $tra_1, $tra_2
-webkit-transition: $tra_1, $tra_2
-moz-transition: $tra_1, $tra_2
-ms-transition: $tra_1, $tra_2
-o-transition: $tra_1, $tra_2
= animation_delay($animation_delay)
-webkit-animation-delay: $animation_delay
-moz-animation-delay: $animation_delay
-ms-animation-delay: $animation_delay
animation-delay: $animation_delay
=animation($content)
animation: $content
-webkit-animation: $content
-moz-animation: $content
-o-animation: $content
=keyframe($name)
@keyframes #{$name}
@content
@-moz-keyframes #{$name}
@content
@-webkit-keyframes #{$name}
@content
@-o-keyframes #{$name}
@content
=text-shadow($text_shadow)
text-shadow: $text_shadow
=transform_origin($origin-x, $origin-y)
-webkit-transform-origin: $origin-x, $origin-y
-moz-transform-origin: $origin-x, $origin-y
-o-transform-origin: $origin-x, $origin-y
-ms-transform-origin: $origin-x, $origin-y
transform-origin: $origin-x, $origin-y
=border($top, $bottom, $left, $right)
border-top-color: $top !important
border-bottom-color: $bottom !important
border-left-color: $left !important
border-right-color: $right !important
=position_center($position, $top, $left)
position: $position
top: $top
left: $left
+transform(translate(-50%, -50%))
=vertical_align($height)
&:before
content: ''
display: inline-block
vertical-align: middle
height: $height
width: .1px
=vertical_align_without_veritable()
&:before
content: ''
display: inline-block
vertical-align: middle
width: .1px
= clearfix()
&:before,&:after
content: ''
display: table
&:after
clear: both
= opacity($opacity)
opacity: $opacity
$opacity-ie: $opacity * 100
filter: alpha(opacity = $opacity-ie)
= link_settings($link, $visited, $hover, $active)
&:link
color: $link
&:visited
color: $visited
&:hover
color: $hover
&:active
color: $active
= normal_box($s)
width: $s
height: $s
line-height: $s
= perspective($size)
perspective: $size
-webkit-perspective: $size
-moz-perspective: $size
= letter-spacing($letter-spacing)
-webkit-letter-spacing: $letter-spacing
-moz-letter-spacing: $letter-spacing
-ms-letter-spacing: $letter-spacing
-o-letter-spacing: $letter-spacing
letter-spacing: $letter-spacing
/*
=require twitter-bootstrap-static/bootstrap
Use Font Awesome icons (default)
To use Glyphicons sprites instead of Font Awesome, replace with "require twitter-bootstrap-static/sprites"
=require twitter-bootstrap-static/fontawesome
*/
class AccountsController < AdminController
before_action :set_account, only: [:show, :edit, :update, :destroy]
def index
@accounts = paginated tabular_filter.add_keys_replacements({email: 'accounts.email', on_hold: 'accounts.on_hold'}).
apply(select_accounts.order 'email', :email)
end
def show
end
def edit
end
def update
respond_to do |format|
if @account.update(account_params)
format.html { redirect_to @account, notice: 'Account was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @account.errors, status: :unprocessable_entity }
end
end
end
def destroy
redirect_to accounts_url
end
def vacancy
redirect_to accounts_path(vacancy: Vacancy.find(params[:id]).name)
end
private
def select_accounts
if params.has_key? :vacancy
@title = params[:vacancy].pluralize.humanize
Account.where(vacancy: Vacancy.find_by(name: params[:vacancy]))
elsif params.has_key? :referrer
referrer = Account.find(params[:referrer])
@title = "Referrals of #{referrer.email}"
paginate Account.where(referrer: referrer)
else
Account.all
end
end
# Use callbacks to share common setup or constraints between actions.
def set_account
@account = Account.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def account_params
if params[:account][:password].blank?
params[:account][:password] = nil
params[:account][:password_confirmation] = nil
end
params.require(:account).permit(:email, :wallet_address, :on_hold, :referrer_id, :subscribed, :password, :password_confirmation)
end
end
class AdminController < ApplicationController
def index
# console
end
def paginated(scope)
scope.paginate(page: params[:page], per_page: 20)
end
helper_method :tabular_filter
def tabular_filter
@tabular_filter ||= TabularFilter.new(params)
end
end
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :check_administrator, unless: :devise_controller?
before_filter :set_locale
helper_method :current_url_for_locale
def current_url_for_locale(locale)
request.get? ? url_for(params.merge(locale: locale)) : url_for(locale: locale)
end
protected
def check_administrator
if current_account.nil?
authenticate_account!
elsif current_account.administrator.nil?
redirect_to root_url, alert: 'You have not enough rights to do it!'
end
end
def extract_best_locale
if request.env['HTTP_ACCEPT_LANGUAGE']
return request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first || I18n.default_locale
end
I18n.default_locale
end
def set_locale
ActionMailer::Base.default_url_options = {:host => request.host_with_port}
params[:locale] = extract_best_locale if params[:locale].nil?
if I18n.available_locales.include?(params[:locale].to_sym)
current_account.update(locale: params[:locale]) if current_account && current_account.locale != params[:locale]
I18n.locale = params[:locale]
else
flash.now[:notice] = "#{params[:locale]} translation not available"
logger.error flash.now[:notice]
end
end
def self.default_url_options(options={})
options.merge({locale: I18n.locale})
end
end
class BlocksController < AdminController
before_action :set_block, only: [:edit, :update]
layout false
def edit
end
def update
replace_line_breaks
update_block_by_version
respond_to do |format|
format.js
end
end
def apply
BlockVersion.by_admin(current_account).last.activate
respond_to do |format|
format.js { render nothing: true, status: 200 }
format.html { redirect_to :back }
end
end
def cancel
last_block_version = BlockVersion.by_admin(current_account).last
if last_block_version.present? and !last_block_version.active
last_block_version.blocks.destroy_all
end
respond_to do |format|
format.js { render nothing: true, status: 200 }
format.html { redirect_to :back }
end
end
private
def set_block
@block = Block.last_for_admin(params[:id], current_account)
end
def block_params
params.require(:block).permit(:key, localed_attr(:text))
end
def replace_line_breaks
locales.each do |locale|
split_text = params[:block]["text_#{locale}"].split(/\r\n|\n\r|\r|\n/)
params[:block]["text_#{locale}"] = split_text.map {|p| p.blank? ? '<br>' : "<p>#{p}</p>"}.join
end
end
def update_block_by_version
full_params = block_params
full_params[:key] = params[:id]
if @block.block_version.active?
block_version = BlockVersion.find_or_create_by(account: current_account, active: false)
@block = Block.new(key: params[:id], block_version: block_version)
@prev_block = Block.active.by_key(params[:id]).last
if @prev_block
@prev_block.text_phrase.translations.each do |translation|
full_params["text_#{translation.locale}"] = translation.text if translation.locale != I18n.locale.to_s
end
end
end
@block.update(full_params)
end
end
module Sortable
extend ActiveSupport::Concern
included do
before_action :update_position, only: :update
end
def update_position
if params.has_key?(:position)
item = controller_name.classify.constantize.find(params[:id])
item.insert_at(params[:position].to_i)
render nothing: true, status: :ok
false
end
end
end
\ No newline at end of file
class TabularFilter
include ActionView::Helpers
def initialize(params)
filters_params = params.select{|key| key.to_s.match(/tf.?_.+/)}
@filters = Hash[filters_params.map{|k,v| [k.to_s.match(/tf.?_(.+)/)[1],{value: v, mode: k.to_s.match(/tf(.?)_.+/)[1]}]}]
@keys_replacements = {}
@joins = {}
end
def translations(*translated_columns)
relations Hash[translated_columns.map { |c| [c, '.:t'] }]
end
def relations(args)
# EXAMPLE: {manager: 'accounts.name', client: 'accounts.name', ware: 'wares.name:t', name: '.:t'}
args.keys.each do |key|
value = args[key].split('.')
table_name = value[0]
join_table_name = key.to_s.pluralize
column_params = value[1].split(':')
column_name = column_params[0]
translatable = false
if column_params.length > 1 && column_params[1]=='t'
translatable = true
join_table_name += "_#{column_name}_translations"
end
@joins[key] = {table_name: table_name, join_table_name: join_table_name, column: key, join_column: column_name,
translatable: translatable}
add_keys_replacements(key => "#{join_table_name}.#{translatable ? 'text' : column_name}")
end
self
end
def add_keys_replacements(keys)
@keys_replacements.merge! keys
self
end
def apply(scope, args = {})
decode_apply_args(args)
@table_name = scope.table.name
active? ? add_joins(scope).where(condition).uniq : scope
end
def decode_apply_args(args)
@skip = []
if args.has_key? :skip
if args[:skip].is_a? Array
args[:skip].each { |value| @skip << value }
else
@skip << args[:skip].to_sym
end
end
end
def add_joins(scope)
@joins.each do |key, join_data|
next if @skip.include? key.to_sym
jt_column = join_data[:join_column]
jt_name = join_data[:join_table_name]
if jt_column.empty?
jt_column = join_data[:column]
jt = @table_name
column = 'id'
else
jt = join_data[:table_name]
column = join_data[:column].to_s + '_id'
end
if join_data[:translatable]
scope = scope.
joins "LEFT JOIN phrase_containers `#{jt}_containers` ON `#{jt}_containers`.`translatable_id` = `#{@table_name}`.`#{column}` AND `#{jt}_containers`.`translatable_type`='#{jt.classify}' AND `#{jt}_containers`.`attribute_name`='#{jt_column}'",
"LEFT JOIN `phrases` `#{jt}_phrases` ON `#{jt}_phrases`.`id` = `#{jt}_containers`.`phrase_id`",
"LEFT JOIN `translations` `#{jt_name}` ON `#{jt_name}`.`phrase_id` = `#{jt}_phrases`.`id` AND `#{jt_name}`.`locale` = '#{I18n.locale}'"
else
scope = scope.
joins "LEFT JOIN `#{jt}` `#{jt_name}` ON `#{jt_name}`.`id` = `#{@table_name}`.`#{column}`"
end
end
scope
end
def condition
condition = ''
@filters.keys.each do |key|
return 'false' if @skip.include? key.to_sym
condition << ' and ' unless condition.blank?
condition << key_condition(key)
end
condition
end
def key_condition(key)
@key = key
condition = ''
sub_keys = key.split(':').map(&:to_sym).map { |k| @keys_replacements.include?(k) ? @keys_replacements[k] : k }
(0..sub_keys.length - 1).each do
condition << ' or ' unless condition.blank?
condition << current_keys_condition(sub_keys)
sub_keys << sub_keys.shift
end
"(#{condition})"
end
def current_keys_condition(keys)
condition = ''
values = @filters[@key][:value].split(' ')
(0..values.length - 1).each do
condition << ' or ' unless condition.blank?
condition << current_values_condition(keys, values)
values << values.shift
end
condition
end
def current_values_condition(keys, values)
condition = ''
(0..[values.length, keys.length].min - 1).each do |i|
condition << ' and ' unless condition.blank?
condition << value_condition(keys[i], values[i])
end
"(#{condition})"
end
#noinspection RubyAssignmentExpressionInConditionalInspection
def value_condition(key, value)
col_name = key.to_s
col_name = "#{@table_name}.#{col_name}" if col_name.gsub(/\./).count == 0
case @filters[@key][:mode]
when 'd'
date = value.to_datetime
"(#{col_name} BETWEEN '#{date.beginning_of_day.to_s(:db)}' AND '#{date.end_of_day.to_s(:db)}')"
when 'b'
value == '1' ? "(#{col_name} = 1)" : "(#{col_name} = 0 OR #{col_name} IS NULL)"
else
if value == '!*'
return "(#{col_name} is null or #{col_name}='')"
elsif value == '*'
return "(#{col_name} is not null and #{col_name}<>'')"
elsif match = /^(==)(\d*.\d*)$/.match(value)
return "(#{col_name}=#{match[2]})"
elsif match = /^(<>)(\d*.\d*)$/.match(value)
return "(#{col_name}!=#{match[2]})"
elsif match = /^(!=|[><=])(\d*.\d*)$/.match(value)
return "(#{col_name}#{match[1]}#{match[2]})"
end
"#{col_name} like '%#{value}%'"
end
end
def active?
!@filters.empty?
end
def empty?
@filters.empty?
end
def row_helper(*args)
out = "<tr id='filters'>"
put = true
args = args[0] if args[0].is_a? Array
args.each_with_index do |param, i|
param = 1 if param == '-' || param == ''
if param.is_a? Integer
if i == args.size - 1
if block_given?
out << "<th class='actions' colspan='#{param}'>#{yield}</th>"
else
out << "<th class='actions' colspan='#{param}'>#{link_to '', '?', class: 'clear_btn clear_tabular_filters',
title: t('helpers.links.clear', default: 'Clear')}</th>"
end
else
out << "<th colspan='#{param}'></th>" if put
end
put = true
elsif !!param == param
put = param
elsif param.is_a? Hash
param.keys.each do |key|
out << generate_control(param[key], key) if put
end
else
param_parts = param.to_s.split(':')
type = param_parts.length > 1 ? param_parts[1].to_sym : :text
out << generate_control(type, param_parts[0]) if put
put = true
end
end
out << '</tr>'
out.html_safe
end
private
def generate_control(type, param)
case type
when :text, :string, :as_text, :as_string
"<th>#{field_helper param}</th>"
when :bool, :boolean, :as_bool, :as_boolean
"<th>#{yes_no_helper param}</th>"
when :date, :as_date
"<th>#{date_helper param}</th>"
else
'<th></th>'
end
end
def field_helper(attr)
text_field_tag attr, value_for(attr), class: 'filter'
end
def yes_no_helper(attr)
select_tag attr, options_for_select([[t(:yes), 1], [t(:no), 0]], value_for(attr)),
include_blank: true, class: 'filter boolean'
end
def date_helper(attr)
text_field_tag attr, value_for(attr), class: 'filter date_picker'
end
def value_for(attr)
@filters.has_key?(attr) ? @filters[attr][:value] : ''
end
end
class FrontController < ApplicationController
skip_before_action :check_administrator
def index
@pages = Page.active.anchors
end
def page
@page = Page.find_by(url_id: params[:id]) || Page.find(params[:id])
end
end
class NewslettersController < AdminController
before_action :set_newsletter, only: [:show, :edit, :update, :destroy, :sending, :resend]
# GET /newsletters
# GET /newsletters.json
def index
@newsletters = Newsletter.all
end
# GET /newsletters/1
# GET /newsletters/1.json
def show
end
# GET /newsletters/new
def new
@newsletter = params.has_key?(:newsletter) ? Newsletter.new(newsletter_params) : Newsletter.new
end
# GET /newsletters/1/edit
def edit
end
# POST /newsletters
# POST /newsletters.json
def create
@newsletter = Newsletter.new(newsletter_params)
respond_to do |format|
if @newsletter.save
format.html { redirect_to @newsletter, notice: 'Newsletter was successfully created.' }
format.json { render :show, status: :created, location: @newsletter }
else
format.html { render :new }
format.json { render json: @newsletter.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /newsletters/1
# PATCH/PUT /newsletters/1.json
def update
respond_to do |format|
if @newsletter.update(newsletter_params)
format.html { redirect_to @newsletter, notice: 'Newsletter was successfully updated.' }
format.json { render :show, status: :ok, location: @newsletter }
else
format.html { render :edit }
format.json { render json: @newsletter.errors, status: :unprocessable_entity }
end
end
end
# DELETE /newsletters/1
# DELETE /newsletters/1.json
def destroy
@newsletter.destroy
respond_to do |format|
format.html { redirect_to newsletters_url, notice: 'Newsletter was successfully destroyed.' }
format.json { head :no_content }
end
end
def resend
@newsletter.update(last_id: nil)
redirect_to send_newsletter_url
end
def sending
if @newsletter.last_id.nil?
init_newsletter
elsif @newsletter.processed_id < @newsletter.last_id
sending_newsletter
end
end
private
def init_newsletter
@newsletter.update(last_id: filtered_accounts.last.id, processed_id: 0)
end
def filtered_accounts
Account.where(subscribed: true).for_filter.where(@newsletter.recipient_filter).order(:id)
end
def sending_newsletter
@accounts = filtered_accounts.where('accounts.id > ?', @newsletter.processed_id).first(100)
begin
FrontMailer.newsletter(@newsletter.text_for_request(request), @accounts.map(&:email), @newsletter.subject).deliver_now
rescue Exception => error
Rails.logger.error("Error on send newsletter to #{error.message}")
end
params = {processed_id: @accounts.last.id}
if @accounts.last.id >= @newsletter.last_id
params[:processed_at] = DateTime.current
params[:last_id] = @accounts.last.id
end
@newsletter.update(params)
end
# Use callbacks to share common setup or constraints between actions.
def set_newsletter
@newsletter = Newsletter.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def newsletter_params
params.require(:newsletter).permit(:subject, :text, :date, :recipient_filter)
end
end
class PagesController < AdminController
before_action :set_page, only: [:show, :edit, :update, :destroy]
include Sortable
# GET /pages
def index
@pages = Page.all
end
# GET /pages/1
def show
end
# GET /pages/new
def new
@page = Page.new
end
# GET /pages/1/edit
def edit
end
# POST /pages
# POST /pages.json
def create
@page = Page.new(page_params)
respond_to do |format|
if @page.save
format.html { redirect_to @page, notice: 'Page was successfully created.' }
else
format.html { render :new }
end
end
end
# PATCH/PUT /pages/1
# PATCH/PUT /pages/1.json
def update
respond_to do |format|
if @page.update(page_params)
format.html { redirect_to @page, notice: 'Page was successfully updated.' }
else
format.html { render :edit }
end
end
end
# DELETE /pages/1
# DELETE /pages/1.json
def destroy
@page.destroy
respond_to do |format|
format.html { redirect_to pages_url, notice: 'Page was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_page
@page = Page.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def page_params
params.require(:page).permit(localed_attr(:title), :position, :mode, (:path if params[:page][:mode] == 'path'),
(:link if params[:page][:mode] == 'link'), localed_attr(:body), :url_id, :enabled, :keywords, localed_attr(:description))
end
end
class SettingsController < AdminController
before_action :set_setting, only: [:update, :destroy]
# GET /settings
# GET /settings.json
def index
@settings = Setting.init.all
end
# POST /settings
# POST /settings.json
def create
@setting = Setting.new(setting_params)
respond_to do |format|
if @setting.save
format.html { redirect_to settings_url, notice: 'Setting was successfully created.' }
else
format.json { render json: @setting.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /settings/1
# PATCH/PUT /settings/1.json
def update
respond_to do |format|
if @setting.update(setting_params)
format.html { redirect_to settings_url, notice: 'Setting was successfully updated.' }
format.json { render json: {}, status: :ok, location: @tag }
else
format.html { render :edit }
format.json { render json: @setting.errors, status: :unprocessable_entity }
end
end
end
# DELETE /settings/1
# DELETE /settings/1.json
def destroy
@setting.destroy
respond_to do |format|
format.html { redirect_to settings_url, notice: 'Setting was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_setting
@setting = Setting.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def setting_params
params.require(:setting).permit(:value)
end
end
module AdminHelper
def current_admin_path
if params['controller'] == 'admin' && params['action'] == 'index'
link_to t('activerecord.attributes.page.links.admin_area'), admin_index_path, class: 'navbar-brand'
else
link_to t("activerecord.models.#{controller_name.sub('Controller', '').singularize.downcase}.few"),
controller_path, class: 'navbar-brand'
end
end
end
module ApplicationHelper
def truncate_html(html, length, &block)
truncate html.nil? ? '' : sanitize(html, tags: {}).squish , length: length, separator: ' ', &block
end
def is_administrator?
current_account.present? && current_account.administrator.present?
end
def show_amount(amount)
"#{((amount || 0) * Bank::SATOSHI_COEFF).round} <strong>SATOSHI</strong>".html_safe
end
def to_d digits_after_dot, value
if value.present?
"%.#{digits_after_dot}f" % value
else
value
end
end
def localize_datetime(date)
"#{l date.to_date} #{date.strftime('%H:%M:%S')}" if date.present?
end
def timer_timeslot(seconds)
[60, 60, 1000].map { |count| seconds, n = seconds.divmod(count); n.to_s.rjust(2, '0') }.reverse.join(':')
end
def humanize_timeslot(seconds)
[[60, 'second'], [60, 'minute'], [24, 'hour'], [1000, 'day']].map { |count, name|
if seconds > 0
seconds, n = seconds.divmod(count)
n > 0 ? pluralize(n.to_i, name) : nil
end
}.compact.reverse.join(', ')
end
end
module BlocksHelper
def block_tag(key, options=nil, &block)
text = block_given? ? capture(&block) : nil
if account_signed_in?
b = Block.last_for_admin(key, current_account, text)
else
b = Block.last(key, text)
end
b.apply_options(options).html
end
def blocks_changing_allowed?
account_signed_in? && current_account.administrator.present?
end
def blocks_changed?
last_version = BlockVersion.by_admin(current_account).last
blocks_changing_allowed? and last_version.present? and !last_version.active and last_version.blocks.present?
end
end
module CertificatesHelper
end
module FrontHelper
def title(title)
content_for :title do
[title, Setting.title].compact.join(' | ')
end
end
def description(description)
content_for :description do
description.present? ? description : Setting.description
end
end
def keywords(keywords)
content_for :keywords do
keywords.present? ? keywords : Setting.keywords
end
end
def og_image(value)
content_for(:og_image) { full_path value }
end
def og_type(value)
content_for(:og_type) { value }
end
def og_url(value)
content_for(:og_url) { value }
end
def full_path(path)
"#{request.protocol + request.host_with_port + path.to_s}"
end
def recently_rated?(rate_data)
rate_data && Time.now.to_i - rate_data['rated_at'] < 86400 #- 24 hours
end
def balance
"#{(current_account ? current_account.reload.balance * Bank::SATOSHI_COEFF : 0).to_i} s"
end
def today_played_games
current_account.operating_date == Date.today ? current_account.played_games : 0
end
def expected_revenue
left_days > 0 ? Setting.all_days_bonus : Setting.one_day_bonus
end
def left_days
account = current_account
continuous_days = account.operating_date && account.operating_date >= Date.yesterday ? account.continuous_days : 0
left_days = Setting.days_for_bonus - continuous_days
[left_days, 0].max
end
end
module PagesHelper
def link_to_page(page)
link_to(page.title, page_url_for(page), target: (:_blank if page.mode == 'link')).html_safe
end
def page_url_for(page)
if page.mode == 'page'
front_page_path(page.url)
elsif page.mode == 'anchor'
root_path anchor: "page_#{page.url}"
elsif page.mode == 'path'
send Page.links[page.link.to_sym]
else
page.link
end
end
end
module ServicesHelper
end
class ApplicationMailer < ActionMailer::Base
default from: "support@worldofrps.com"
layout 'mailer'
end
class FrontMailer < ApplicationMailer
# layout false, only: [:newsletter]
# layout false, :only => 'newsletter'
def welcome(account)
mail to: account.email, subject: 'Welcome to World Of RPS!'
end
def withdraw_accepted(account)
@subject = 'World Of RPS Informer'
mail to: account.email, subject: @subject
end
def withdraw_completed(account)
@subject = 'World Of RPS Informer'
mail to: account.email, subject: @subject
end
def newsletter(text, recipients, subject='World Of RPS Informer')
@subject = subject
@text = text
@_action_has_layout = false
mail bcc: recipients, subject: subject
end
end
class Account < ActiveRecord::Base
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable
has_one :administrator
# after_create :send_welcome_mail
# def self.from_omniauth(auth, current_user, ip_address, referrer_id = nil)
# authorization = SocialAuthorization.where(:provider => auth.provider, :uid => auth.uid.to_s).first_or_initialize
# if authorization.account.blank?
# account = current_user.nil? ? Account.where(email: auth["info"]["email"]).first : current_user
# if account.blank?
# account = Account.new
# account.ip_address = ip_address
# account.password = @password = Devise.friendly_token[0, 10]
# account.email = auth.info.email
# account.referrer_id = referrer_id
# # account.confirmed_at = Time.now
# account.save
# end
# authorization.username = auth.info.name
# authorization.account = account
# authorization.save
# end
# authorization.account
# end
def caption
email
end
# def send_welcome_mail
# if current_sign_in_ip.present?
# Thread.new do
# FrontMailer.welcome(self).deliver_now
# end
# end
# end
end
class Administrator < ActiveRecord::Base
include Accounted
end
class Block < ActiveRecord::Base
belongs_to :block_version
validates :block_version, presence: true
attr_translatable :text
scope :by_key, -> (key) { where(key: key) }
scope :active, -> { joins(:block_version).where('block_versions.active' => true) }
def self.last(key, default_text = nil)
block = Block.active.by_key(key).last
block = Block.new(key: key, text: default_text) if block.nil?
block.prepare
end
def self.last_for_admin(key, admin, default_text = nil)
block = Block.by_key(key).joins(:block_version).
where('block_versions.active=? or block_versions.account_id=?', true, admin).last
if block.nil?
block_version = BlockVersion.where(account: admin).last
if block_version.nil? or block_version.active?
block_version = BlockVersion.create(account: admin, active: false)
end
block = Block.new(key: key, block_version: block_version, text: default_text)
end
block.prepare
end
def prepare
@text = text.present? ? text : key.to_s.humanize
@tag = :div
@tag_options = []
@tag_class = "block block_key_#{key}"
self
end
def apply_options(options)
if options.is_a? Hash
options.each_pair do |key, value|
if key.to_sym == :class
apply_class_options value
elsif key.to_sym == :tag
@tag = value.to_sym
else
@tag_options.append "#{key}='#{value}'"
end
end
else
apply_class_options options
end
self
end
def apply_class_options(options)
if options.is_a? Array
@tag_class += ' ' + options.join(' ')
elsif options.present?
@tag_class += ' ' + options.to_s
end
end
def html
@tag_options.append "class='#{@tag_class}'"
@tag_options.append 'data-container' if tag_container?
"<#{@tag} #{@tag_options.join(' ')}>#{tag_container? ? html_text : plain_text}</#{@tag}>".html_safe
end
def html_text
(text || @text).html_safe
end
def plain_text
ActionView::Base.full_sanitizer.sanitize(text || @text)
end
private
def tag_container?
@tag != :p && @tag != :span
end
end
class BlockVersion < ActiveRecord::Base
has_many :blocks, dependent: :destroy
belongs_to :account, class_name: Rails.configuration.x.active_translation.admin_class_name || 'Account'
validates :account, presence: true
scope :active, -> { where(active: true) }
scope :inactive, -> { where(active: [false, nil]) }
scope :by_admin, -> (admin) { where(account: admin) }
def activate
update_attributes(active: true)
end
end
class Ckeditor::Asset < ActiveRecord::Base
include Ckeditor::Orm::ActiveRecord::AssetBase
delegate :url, :current_path, :content_type, :to => :data
validates_presence_of :data
end
class Ckeditor::AttachmentFile < Ckeditor::Asset
mount_uploader :data, CkeditorAttachmentFileUploader, :mount_on => :data_file_name
def url_thumb
@url_thumb ||= Ckeditor::Utils.filethumb(filename)
end
end
class Ckeditor::Picture < Ckeditor::Asset
mount_uploader :data, CkeditorPictureUploader, :mount_on => :data_file_name
def url_content
url(:content)
end
end
module Accounted
extend ActiveSupport::Concern
included do
validates :account, presence: true
scope :by_account, ->(account) { where("#{self.table_name}.account_id = ?", account.id) }
belongs_to :account
end
end
\ No newline at end of file
class Newsletter < ActiveRecord::Base
def text_for_request(request)
text.gsub(/src\s*=\s*"\s*\//, 'src="' + request.protocol + request.host_with_port + '/')
end
end
class Page < ActiveRecord::Base
acts_as_list
attr_translatable! :title
attr_translatable :body, :description
default_scope { order(:position) }
scope :active, -> { where(enabled: true) }
scope :pages, -> { where(mode: :page) }
scope :anchors, -> { where(mode: :anchor) }
def path
link
end
def path=(value)
self.link = value
end
def url
url_id || id
end
def self.modes
%w(path link page anchor)
end
def self.links
{
main: :root_path,
contact_us: :contact_us_path
}
end
def self.find_by_url(url_id)
Page.find_by(url_id: url_id) || Page.find_by(id: url_id)
end
end
class Phrase < ActiveRecord::Base
has_many :translations, dependent: :destroy
has_many :phrase_containers
accepts_nested_attributes_for :translations
after_create :create_translations
after_save :update_translations
def text(*args)
set_params_by_args *args
value = nil
if texts_cache.has_key? @locale
value = texts_cache[@locale]
else
translation = get_translation
value = translation.text if translation
end
if value.blank? and @seek_closest_locale
translation = get_closest_translation
if translation and translation.text.present?
if translation.locale == @locale
value = texts_cache[@locale] = translation.text
else
value = @show_symbol ? "#{translation.locale.upcase}: #{translation.text}" : translation.text
end
end
end
@locale = nil
value
end
def text=(text)
set_params_by_args
translation = get_or_build_translation
translation.text = text
changed_translations[@locale] = translation
texts_cache[@locale] = text
@locale = nil
end
def texts_cache
@texts ||= {}
end
def reload
texts_cache.clear
super
end
def update_translations
changed_translations.values.each &:save
changed_translations.clear
end
def locale=(locale)
@locale = locale.to_s
end
def get_closest_translation
if changed_translations.empty?
translations.not_blank.localed(@locale).first
# translations.localed(@locale).first
else
all_translations = changed_translations.clone
translations.each do |t|
if all_translations[t.locale].blank? and t.text.present?
all_translations[t.locale] = t
end
# all_translations[t.locale] = t unless all_translations.has_key?(t.locale)
end
closest_locales_for(@locale).each do |l|
return all_translations[l] if all_translations[l] and all_translations[l].text.present?
end
nil
end
end
def empty?
any_translation = get_any_translation
any_translation.nil? or not any_translation.text.present?
end
def completed?
(locales - translations.map(&:locale)).empty?
end
def get_translation(locale = nil)
locale ||= @locale
changed_translations[locale] || translations.find_by(locale: locale)
end
private
def set_params_by_args(*args)
if args && args[0] && (args[0].is_a? Hash)
@locale = args[0][:locale].to_s if args[0].has_key? :locale
@show_symbol = args[0][:symbol] if args[0].has_key? :symbol
end
@seek_closest_locale = @locale.nil?
@locale ||= I18n.locale.to_s
end
def closest_locales_for(locale)
([locale] + (locales - [locale]))
end
def get_or_build_translation
get_translation || translations.build(locale: @locale)
end
def get_any_translation
changed_translations.values.first || (translations.where.not(text: ['', nil]).first unless new_record?)
end
def create_translations
changed_translations.values.each { |t| t.update phrase_id: id }
changed_translations.clear
end
def changed_translations
@changed_translations ||= {}
end
end
class PhraseContainer < ActiveRecord::Base
belongs_to :phrase
belongs_to :translatable, polymorphic: true
validates :translatable, presence: true
scope :for, ->(translatable, attribute_name) { where(translatable: translatable, attribute_name: attribute_name) }
before_save do
phrase.save
end
before_destroy do
if phrase.present? && phrase.phrase_containers.count == 1
phrase.destroy
end
end
def empty?
phrase.nil? || phrase.empty?
end
def text(*args)
value = phrase.text(*args)
@locale = nil
value
end
def text=(text)
@locale ||= I18n.locale.to_s
if phrase.nil?
# build_phrase(locale: @locale, text: text) unless set_phrase_by_translation(text)
build_phrase(locale: @locale, text: text)
else
change_phrase(text)
end
@locale = nil
end
def locale=(locale)
@locale = locale.to_s
end
private
# def set_phrase_by_translation(text)
# translation = Translation.by_locale(@locale).where.not(phrase_id: nil).find_by(text: text)
# if translation
# self.phrase = translation.phrase
# true
# else
# false
# end
# end
def change_phrase(text)
# if phrase.phrase_containers.count < 2 || phrase.get_translation(@locale).nil?
phrase.locale, phrase.text = @locale, text
# else
# suitable_phrase = find_best_suitable_phrase(text)
# if suitable_phrase.present?
# take_new_phrase(suitable_phrase)
# else
# build_new_phrase(text)
# end
# end
end
# def find_best_suitable_phrase(text)
# max_translations_found = 0
# best_suitable_phrase = nil
# Translation.by_locale(@locale).where.not(phrase_id: nil, text:['', nil]).where(text: text).each do |some_translation|
# some_phrase = some_translation.phrase
# current_translations_count = 0
# (locales - [@locale]).each do |locale|
# t = phrase.get_translation(locale)
# if t and t.text.present?
# current_translations_count += some_phrase.translations.find_by(text: t.text, locale: t.locale).present? ? 1:-1
# end
# end
# if current_translations_count > max_translations_found
# best_suitable_phrase = some_phrase
# max_translations_found = current_translations_count
# end
# end
# best_suitable_phrase
# end
# def take_new_phrase(new_phrase)
# locales.each do |locale|
# t = phrase.get_translation(locale)
# if t and new_phrase.translations.where.not(text: ['', nil]).find_by(locale: t.locale).nil?
# new_phrase.locale = locale
# new_phrase.text = t.text
# end
# end
# self.phrase = new_phrase
# end
# def build_new_phrase(text)
# old_phrase = phrase
# build_phrase
# locales.each do |locale|
# phrase.locale = locale
# if @locale == locale
# phrase.text = text
# else
# t = old_phrase.get_translation(locale)
# phrase.text = t.text if t and t.text.present?
# end
# end
# phrase
# end
end
# noinspection RubyClassVariableUsageInspection
class Setting < ActiveRecord::Base
validates :name, presence: true, uniqueness: true
validates :value, presence: true
before_update :reset_setting_variable
default_scope { order :name }
DEFAULTS = {
site_name: 'Personal site',
title: 'Personal site',
description: 'Site of your dreams.',
keywords: 'site, personal site, own site',
gse_id: '007392588842326689376:3onw-lza4mc',
google_analytics_id: 'UA-63039804-12'
}
def self.init
DEFAULTS.keys.each { |name| get(name) }
self
end
def self.get(name)
setting = find_or_initialize_by(name: name)
setting.update(value: DEFAULTS[name.to_sym]) if setting.new_record?
setting.value
end
def self.site_name
@@site_name ||= get(:site_name)
end
def self.title
@@title ||= get(:title)
end
def self.description
@@description ||= get(:description)
end
def self.keywords
@@keywords ||= get(:keywords)
end
def self.gse_id
@@gse_id ||= get(:gse_id)
end
def self.google_analytics_id
@@google_analytics_id ||= get(:google_analytics_id)
end
private
def reset_setting_variable
self.class.class_variable_set "@@#{name}", nil
end
end
class Translation < ActiveRecord::Base
belongs_to :phrase
validates :phrase, presence: true, unless: :new_record?
scope :by_locale, ->(*locale) { where(locale: (locale.nil? || locale.compact.join.empty?) ? I18n.locale : locale) }
scope :with_phrase_containers, -> { joins(phrase: :phrase_containers) }
scope :for, ->(translatable, attribute_name) do
with_phrase_containers.merge(PhraseContainer.for(translatable, attribute_name))
end
scope :localed, ->(*locale) do
if locale.nil?
locale = [I18n.locale.to_s]
elsif locale.is_a? Array
locale = locale.compact.join.empty? ? [I18n.locale.to_s] : locale.compact.map(&:to_s)
else
locale = [locale.to_s]
end
ordered_locales = locale + (locales - locale)
order(ordered_locales.map { |l| "`translations`.`locale` = '#{l}' DESC" }.join(', '))
end
scope :not_blank, -> { where.not(text: [nil, '']) }
end
# encoding: utf-8
class CkeditorAttachmentFileUploader < CarrierWave::Uploader::Base
include Ckeditor::Backend::CarrierWave
# Include RMagick or ImageScience support:
# include CarrierWave::RMagick
# include CarrierWave::MiniMagick
# include CarrierWave::ImageScience
# Choose what kind of storage to use for this uploader:
storage :file
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
"uploads/ckeditor/attachments/#{model.id}"
end
# Provide a default URL as a default if there hasn't been a file uploaded:
# def default_url
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
# end
# Process files as they are uploaded:
# process :scale => [200, 300]
#
# def scale(width, height)
# # do something
# end
# Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this:
def extension_white_list
Ckeditor.attachment_file_types
end
end
# encoding: utf-8
class CkeditorPictureUploader < CarrierWave::Uploader::Base
include Ckeditor::Backend::CarrierWave
# Include RMagick or ImageScience support:
# include CarrierWave::RMagick
include CarrierWave::MiniMagick
# include CarrierWave::ImageScience
# Choose what kind of storage to use for this uploader:
storage :file
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
"uploads/ckeditor/pictures/#{model.id}"
end
# Provide a default URL as a default if there hasn't been a file uploaded:
# def default_url
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
# end
# Process files as they are uploaded:
# process :scale => [200, 300]
#
# def scale(width, height)
# # do something
# end
process :read_dimensions
# Create different versions of your uploaded files:
version :thumb do
process :resize_to_fill => [118, 100]
end
version :content do
process :resize_to_limit => [800, 800]
end
# Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this:
def extension_white_list
Ckeditor.image_file_types
end
end
# encoding: utf-8
class ImageUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
# include CarrierWave::RMagick
include CarrierWave::MiniMagick
# Choose what kind of storage to use for this uploader:
storage :file
# storage :fog
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
# Provide a default URL as a default if there hasn't been a file uploaded:
# def default_url
# # For Rails 3.1+ asset pipeline compatibility:
# # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
#
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
# end
# Process files as they are uploaded:
process :resize_to_limit => [800, 800]
#
# def scale(width, height)
# # do something
# end
# Create different versions of your uploaded files:
version :thumb do
process :resize_to_fit => [128, 128]
end
version :small_thumb, from_version: :thumb do
process resize_to_fill: [32, 32]
end
# Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this:
# def extension_white_list
# %w(jpg jpeg gif png)
# end
# Override the filename of the uploaded files:
# Avoid using model.id or version_name here, see uploader/store.rb for details.
# def filename
# "something.jpg" if original_filename
# end
end
= simple_form_for @account, :html => { :class => 'form-horizontal' } do |f|
= f.input :email
= f.input :password, label: 'Password (put only if want to change)'
= f.input :password_confirmation
= f.input :subscribed
= f.input :on_hold
= f.button :submit, :class => 'btn-primary'
= link_to t('.cancel', :default => t("helpers.links.cancel")), accounts_path, :class => 'btn btn-default'
- model_class = Account
.page-header
%h1=t '.title', :default => [:'helpers.titles.edit', 'Edit %{model}'], :model => model_class.model_name.human.titleize
= render :partial => "form"
- model_class = Account
.page-header
%h1
= model_class.model_name.human(count: 2)
.pull-right
= link_to 'Newsletter', new_newsletter_path(params), class: 'btn btn-default'
.filtered_pagination
= will_paginate @accounts
- params = @tabular_filter.condition.present? ? {newsletter: {recipient_filter: @tabular_filter.condition}} : nil
%table.table.table-striped.filtered_table
%thead
%tr
%th= model_class.human_attribute_name(:email)
%th= model_class.human_attribute_name(:subscribed)
%th= model_class.human_attribute_name(:on_hold)
%th= model_class.human_attribute_name(:created_at)
%th= t 'helpers.actions'
= tabular_filter.row_helper ['email', {subscribed: :bool}, {on_hold: :bool}, '-', '-'] do
-link_to '?', class: 'btn btn-default btn-xs' do
%i.fa.fa-close
%tbody
- @accounts.each do |account|
%tr
%td= link_to account.email, account_path(account)
%td= account.subscribed
%td= account.on_hold
%td=localize_datetime account.created_at
%td.actions
= link_to edit_account_path(account), title: 'Edit', class: 'btn btn-default btn-xs' do
%i.fa.fa-edit
= link_to account_path(account), method: :delete, data: {confirm: 'Are you sure?'}, title: 'Destroy',
class: 'btn btn-xs btn-danger' do
%i.fa.fa-trash
- model_class = Account
.page-header
%h1=t '.title', :default => [:'helpers.titles.new', 'New %{model}'], :model => model_class.model_name.human.titleize
= render :partial => "form"
- model_class = Account
.page-header
%h1=model_class.model_name.human.titleize
%p
%strong= model_class.human_attribute_name(:email) + ':'
= @account.email
%p
%strong= model_class.human_attribute_name(:updated_at) + ':'
= @account.updated_at
%p
%strong= model_class.human_attribute_name(:subscribed) + ':'
= @account.subscribed
%p
%strong= model_class.human_attribute_name(:on_hold) + ':'
= @account.on_hold
%p
%strong= model_class.human_attribute_name(:reset_password_token) + ':'
= @account.reset_password_token
%p
%strong= model_class.human_attribute_name(:reset_password_sent_at) + ':'
= @account.reset_password_sent_at
%p
%strong= model_class.human_attribute_name(:current_sign_in_at) + ':'
= @account.current_sign_in_at
%p
%strong= model_class.human_attribute_name(:last_sign_in_at) + ':'
= @account.last_sign_in_at
%p
%strong= model_class.human_attribute_name(:current_sign_in_ip) + ':'
= @account.current_sign_in_ip
%p
%strong= model_class.human_attribute_name(:last_sign_in_ip) + ':'
= @account.last_sign_in_ip
%br
= link_to t('.back', :default => t("helpers.links.back")), accounts_path, :class => 'btn btn-default'
= link_to t('.edit', :default => t("helpers.links.edit")), edit_account_path(@account), :class => 'btn btn-default'
= link_to t('.destroy', :default => t("helpers.links.destroy")), account_path(@account), :method => "delete", :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) }, :class => 'btn btn-danger'
.row
.col-sm-12.col-xs-12
%div{class: ('tab-content' if locales.count > 1)}
-locales.each do |locale|
.tab-pane{class: ["#{locale}_tab", locale == I18n.locale.to_s ? 'active' : nil].compact.join(' ')}
-attributes.each do |input_type, attribute_names|
-attribute_names = [attribute_names] unless attribute_names.is_a?(Array)
-attribute_names.each do |attribute_name|
%div{class: "localized_#{attribute_name}"}
-if input_type.to_s == 'cktext_area'
%br
=f.cktext_area "#{attribute_name}_#{locale}", ckeditor: {language: I18n.locale}
=f.error "#{attribute_name}_#{locale}"
-elsif input_type.to_s == 'text_area'
=f.input "#{attribute_name}_#{locale}", as: :text, input_html: {rows: 4}, label: t("attributes.#{attribute_name}")
-else
=f.send(input_type.to_sym, "#{attribute_name}_#{locale}".to_sym, label: t("attributes.#{attribute_name}"))
.row
.col-sm-12.col-xs-12
-if locales.count > 1
%ul.nav.nav-tabs
-locales.each do |locale|
%li{class: ('active' if locale == I18n.locale.to_s)}
%a{data: {toggle: 'tab'}, href: ".#{locale}_tab"}= t("locale.#{locale}")
=render 'active_translation/localed_tabs'
=render 'active_translation/localed_inputs', f: f, attributes: attributes
.row
.col-xs-12.text-center
= t('activerecord.attributes.page.links.admin_area')
\ No newline at end of file
#blocks_controls{style: ('display: none;' unless blocks_changed?)}
%span.caption= t('blocks.apply_changes')
= link_to blocks_apply_path, method: :post, class: 'apply', title: 'Apply blocks changes' do
%i.fa.fa-2x.fa-check-circle-o
= link_to blocks_cancel_path, method: :post, class: 'cancel', title: 'Cancel blocks changes' do
%i.fa.fa-2x.fa-times-circle-o
\ No newline at end of file
= simple_form_for @block, url: update_block_path(@block.key), method: :patch, remote: true, html: { class: 'form-horizontal' } do |f|
= render 'active_translation/localed_tabs_and_inputs', f: f, attributes: {text_area: :text}
= link_to t('helpers.links.ok'), '#', class: 'btn btn-primary', id: :apply_block_editing
= link_to t('helpers.links.cancel'), '#', class: 'btn btn-default', id: :cancel_block_editing
$(".block.block_key_<%=j @block.key %>").each(function() {
$block = $(this);
$block.html($block.data('container') != undefined ? "<%=j @block.html_text %>" : "<%=j @block.plain_text %>");
});
$controls = $('#blocks_controls');
<% if blocks_changed? %>
$controls.show();
<% else %>
$controls.hide();
<% end %>
-@pages.each do |page|
.anchor{id: "page_#{page.url}"}
.container
.row
.col-xs-12.text-center
%h2= page.title
.container
.row
.col-xs-12
= page.body.html_safe
-title(@page.title)
#page
.row
.col-lg-12
=@page.body.to_s.html_safe
\ No newline at end of file
%meta(charset="utf-8")
%meta(http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1")
%title= content_for?(:title) ? yield(:title) : Setting.title
%meta{name: 'description', content: content_for?(:description) ? yield(:description) : Setting.description}
%meta{name: 'keywords', content: content_for?(:keywords) ? yield(:keywords) : Setting.keywords }
%meta{property: 'og:site_name', content: Setting.site_name }
%meta{property: 'og:title', content: content_for?(:title) ? yield(:title) : Setting.title }
%meta{property: 'og:description', content: content_for?(:description) ? yield(:description) : Setting.description }
%meta{property: 'og:type', content: content_for?(:og_type) ? yield(:og_type) : 'website' }
%meta{property: 'og:url', content: content_for?(:og_url) ? yield(:og_url) : request.original_url }
%meta{property: 'og:image', content: content_for?(:og_image) ? yield(:og_image) : image_url('logo.png') }
= favicon_link_tag 'apple-touch-icon-144x144-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '144x144'
= favicon_link_tag 'apple-touch-icon-114x114-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '114x114'
= favicon_link_tag 'apple-touch-icon-72x72-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '72x72'
= favicon_link_tag 'apple-touch-icon-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png'
= favicon_link_tag '/favicon.png', :rel => 'shortcut icon'
= csrf_meta_tags
-if Rails.env.production? && Setting.google_analytics_id
:javascript
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', "#{Setting.google_analytics_id}", 'auto');
ga('send', 'pageview');
\ No newline at end of file
- if locales.count > 1
%li.navbar-btn.dropdown#language_selector
%button.btn.btn-default.btn-sm.style_lang.dropdown-toggle(id="language_selector" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false")
= t("locale.#{I18n.locale}")
%b.caret
%ul.dropdown-menu.pull-right(aria-labelledby="language_selector")
-locales.each do |locale|
%li{class: ('active' if I18n.locale == locale.to_sym)}= link_to t("locale.#{locale}"),
current_url_for_locale(locale), data: { no_turbolink: true }
.nav_menu
-Page.active.each do |page|
.navbar-btn{class: (:active if current_page? page_url_for(page))}
= link_to_page page
!!! 5
%html{lang: I18n.locale}
%head
%meta(charset="utf-8")
%meta(http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1")
%meta(name="viewport" content="width=device-width, initial-scale=1.0")
%title= content_for?(:title) ? yield(:title) : 'Admin area'
= csrf_meta_tags
/ Le HTML5 shim, for IE6-8 support of HTML elements
/[if lt IE 9]
= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js"
= stylesheet_link_tag 'shared', :media => "all"
= stylesheet_link_tag 'admin', :media => "all"
= favicon_link_tag 'apple-touch-icon-144x144-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '144x144'
= favicon_link_tag 'apple-touch-icon-114x114-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '114x114'
= favicon_link_tag 'apple-touch-icon-72x72-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '72x72'
= favicon_link_tag 'apple-touch-icon-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png'
= favicon_link_tag '/favicon.png', :rel => 'shortcut icon'
= javascript_include_tag 'shared'
= javascript_include_tag 'ckeditor/init'
= javascript_include_tag 'admin'
%body.admin-body
.navbar.navbar-default.navbar-fixed-top
.container-fluid
%button.navbar-toggle(type="button" data-toggle="collapse" data-target=".navbar-responsive-collapse")
%span.icon-bar
%span.icon-bar
%span.icon-bar
%a.navbar-brand(href="#{admin_path}" data-no-turbolink)= t('activerecord.attributes.page.links.admin_root')
%a.navbar-brand >
-#%a.navbar-brand#current_admin_path(href="#{admin_path}") Admin root
= current_admin_path.html_safe
.navbar-collapse.collapse.navbar-responsive-collapse.navbar-right
%ul.nav.navbar-nav
%li.navbar-text= t('helpers.titles.logged_in_as')
%li.navbar-btn.dropdown
%button.btn.btn-default.btn-sm.dropdown-toggle(id="sign_in_menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false")
= current_account.email
%b.caret
%ul.dropdown-menu.dropdown-menu-right(aria-labelledby="sign_in_menu")
%li= link_to t('helpers.links.change_password'), edit_account_registration_path, data: { no_turbolink: true }
%li= link_to t('helpers.links.sign_out'), destroy_account_session_path, method: :delete
=render 'layouts/language_selector'
.container-fluid.yield-container
.row
.col-xs-0
#links_panel
.well.sidebar-nav
%ul.nav.nav-list
%li{class: (:selected if params['controller'] == 'admin' && params['action'] == 'index')}= link_to t('activerecord.attributes.page.links.admin_area'), admin_index_path
%li{class: (:selected if controller.is_a? AccountsController)}= link_to t('activerecord.models.account.few'), accounts_path
%li{class: (:selected if controller.is_a? PagesController)}= link_to t('activerecord.models.page.few'), pages_path
%li{class: (:selected if controller.is_a? NewslettersController)}= link_to t('activerecord.models.newsletter.few'), newsletters_path
%li{class: (:selected if controller.is_a? SettingsController)}= link_to t('activerecord.models.setting.few'), settings_path
%li= link_to t('helpers.links.front'), root_path, target: :_blank
.handle
%i.fa.fa-chevron-circle-right.fa-2x
.col-xs-12.yield-column
= bootstrap_flash
= yield
%footer
%p &copy; SPS Company 2016
!!! 5
%html{lang: I18n.locale}
%head
= render 'layouts/front_meta'
%meta(name="viewport" content="width=device-width, initial-scale=1.0")
%script{:src => "http://maps.googleapis.com/maps/api/js?key=AIzaSyDY0kkJiTPVd2U7aTOAwhc9ySH6oHxOIYM"}
/ Le HTML5 shim, for IE6-8 support of HTML elements
/[if lt IE 9]
= javascript_include_tag '//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js'
= stylesheet_link_tag 'shared', :media => "all"
= stylesheet_link_tag 'front', :media => "all"
= javascript_include_tag 'shared'
= javascript_include_tag '//imasdk.googleapis.com/js/sdkloader/ima3.js'
= javascript_include_tag 'front'
- if current_account && current_account.administrator
= stylesheet_link_tag 'admin_front', :media => "all"
= javascript_include_tag 'ckeditor/init'
= javascript_include_tag 'admin_front'
%body
.mob_back
%header#landing_header
.info_box
.container
.row
.col-sm-6.col-xs-12.text-center
= block_tag :site_name, tag: :h1
.col-sm-6.text-right.hidden-xs
.row
.col-sm-6.text-center.info-block
= block_tag :contacts
.col-sm-6.text-center.info-block
= block_tag :summary
.box_sandwich.visible-xs
.sandwich
.mobile_menu.panel-group
= render 'layouts/menu'
%nav.hidden-xs
= render 'layouts/menu'
%ul.language_box
=render 'layouts/language_selector'
- if current_account && current_account.administrator
=render 'blocks/blocks_controls'
#yield_content
= bootstrap_flash
= yield
=javascript_include_tag "http://cse.google.com/cse.js?cx=#{Setting.gse_id};" if Setting.gse_id.present?
= simple_form_for @newsletter, :html => { :class => 'form-horizontal' } do |f|
= render 'recipients_info', recipient_filter: @newsletter.recipient_filter
= f.input :recipient_filter, as: :hidden
= f.input :subject
= f.cktext_area :text, ckeditor: {language: I18n.locale}
%br
= f.button :submit, :class => 'btn-primary'
= link_to t('.cancel', :default => t("helpers.links.cancel")), newsletters_path, :class => 'btn btn-default'
%p
- if @newsletter.recipient_filter.present?
%strong Recipient filter:
= @newsletter.recipient_filter
%br
%strong Number of recipient:
= Account.where(subscribed: true).where(@newsletter.recipient_filter).count
- model_class = Newsletter
.page-header
%h1=t '.title', :default => [:'helpers.titles.edit', 'Edit %{model}'], :model => model_class.model_name.human.titleize
= render :partial => 'form'
- model_class = Newsletter
.page-header
%h1=t '.title', :default => model_class.model_name.human(count: 2)
%table.table.table-striped
%thead
%tr
%th= model_class.human_attribute_name(:id)
%th= model_class.human_attribute_name(:subject)
%th= model_class.human_attribute_name(:text)
%th= model_class.human_attribute_name(:processed_at)
%th= model_class.human_attribute_name(:created_at)
%th=t '.actions', :default => t("helpers.actions")
%tbody
- @newsletters.each do |newsletter|
%tr
%td= link_to newsletter.id, newsletter_path(newsletter)
%td= link_to newsletter.subject, newsletter_path(newsletter)
%td= link_to sanitize(newsletter.text, tags: {}).first(250), newsletter_path(newsletter)
%td= newsletter.processed_at
%td= newsletter.created_at
%td.actions
= link_to edit_newsletter_path(newsletter), title: 'Edit', :class => 'btn btn-default btn-xs' do
%i.fa.fa-edit
= link_to newsletter_path(newsletter), method: :delete, data: {confirm: 'Are you sure?'}, title: 'Destroy',
class: 'btn btn-xs btn-danger' do
%i.fa.fa-trash
= link_to t('.new', :default => t("helpers.links.new")), new_newsletter_path, :class => 'btn btn-primary'
- model_class = Newsletter
.page-header
%h1=t '.title', :default => [:'helpers.titles.new', 'New %{model}'], :model => model_class.model_name.human.titleize
= render :partial => "form"
.page-header
%h1
Newsletter is sending now, please don't close this page.
.progress.progress-bar-striped.active
#newsletter_progress.progress-bar{'aria-valuemax' => '100', 'aria-valuemin' => '0', 'aria-valuenow' => '0', role: 'progressbar', style: 'width: 0%;'}
#sending_complete{style: 'display: none;'}
= link_to t('.back', :default => t("helpers.links.back")), newsletters_path, :class => 'btn btn-default'
json.extract! @newsletter, :id, :last_id, :processed_id
- model_class = Newsletter
.page-header
%h1=t '.title', :default => model_class.model_name.human.titleize
= render 'recipients_info'
%p
%strong= model_class.human_attribute_name(:subject) + ':'
%br
= @newsletter.subject
%p
%strong= model_class.human_attribute_name(:Message) + ':'
%br
= FrontMailer.newsletter(@newsletter.text_for_request(request), [], @newsletter.subject).body.to_s.html_safe
%p
%strong= model_class.human_attribute_name(:processed_at) + ':'
%br
= @newsletter.processed_at
= link_to t('.back', :default => t("helpers.links.back")), newsletters_path, :class => 'btn btn-default'
= link_to t('.edit', :default => t("helpers.links.edit")), edit_newsletter_path(@newsletter), :class => 'btn btn-default'
= link_to t('.destroy', :default => t("helpers.links.destroy")), newsletter_path(@newsletter), :method => "delete", :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) }, :class => 'btn btn-danger'
- if @newsletter.last_id.nil?
= link_to 'Send', send_newsletter_path(@newsletter), :data => { confirm: 'Start sending, are you sure?' }, :class => 'btn btn-danger'
- elsif @newsletter.processed_id < @newsletter.last_id
= link_to 'Continue sending', send_newsletter_path(@newsletter), :class => 'btn btn-danger'
= link_to 'Resend', resend_newsletter_path(@newsletter), :data => { confirm: 'Send again, are you sure?' }, class: 'btn btn-danger'
- else
= link_to 'Resend', resend_newsletter_path(@newsletter), :data => { confirm: 'Send again, are you sure?' }, class: 'btn btn-danger'
= simple_form_for @page, :html => { :class => 'form-horizontal' } do |f|
= render 'active_translation/localed_tabs_and_inputs', f: f, attributes: {input: :title}
= f.input :enabled
= f.input :url_id
= f.input :mode, as: :select, collection: Page.modes.map{|m| [m, m.to_sym]}, include_blank: false
#path_fields
= f.input :path, as: :select, collection: Page.links.keys.map{|k| [k, k]}, include_blank: false
#link_fields
= f.input :link
#page_fields
=render 'active_translation/localed_inputs', f: f, attributes: {cktext_area: :body, input: :description}
= f.input :keywords
= f.button :submit, :class => 'btn-primary'
= link_to t('.cancel', :default => t("helpers.links.cancel")), pages_path, :class => 'btn btn-default'
- model_class = Page
.page-header
%h1=t '.title', :default => [:'helpers.titles.edit', 'Edit %{model}'], :model => model_class.model_name.human.titleize
= render :partial => "form"
- model_class = Page
.page-header
%h1= model_class.model_name.human(count: 2)
%table.table.table-striped
%thead
%tr
%th
%th= model_class.human_attribute_name(:title)
%th= model_class.human_attribute_name(:mode)
%th= model_class.human_attribute_name(:body)
%th= model_class.human_attribute_name(:url_id)
%th= model_class.human_attribute_name(:enabled)
%th= model_class.human_attribute_name(:created_at)
%th=t 'helpers.actions'
%tbody
- @pages.each do |page|
%tr.sort_item{data: {id: page.id}}
%td.sort_icon
.fa.fa-arrows-v
%td= link_to page.title, page_path(page)
%td= page.mode
%td= truncate_html page.body, 100
%td= page.url_id
%td= page.enabled
%td=localize_datetime page.created_at
%td.actions
= link_to edit_page_path(page), title: 'Edit', class: 'btn btn-default btn-xs' do
%i.fa.fa-edit
= link_to page_path(page), method: :delete, data: {confirm: 'Are you sure?'}, title: 'Destroy',
class: 'btn btn-xs btn-danger' do
%i.fa.fa-trash
= link_to t('helpers.links.new'), new_page_path, class: 'btn btn-primary'
- model_class = Page
.page-header
%h1=t '.title', :default => [:'helpers.titles.new', 'New %{model}'], :model => model_class.model_name.human.titleize
= render :partial => "form"
- model_class = Page
.page-header
%h1= model_class.model_name.human.titleize
%p
%strong= model_class.human_attribute_name(:title) + ':'
= @page.title
%p
%strong= model_class.human_attribute_name(:enabled) + ':'
= @page.enabled
%p
%strong= model_class.human_attribute_name(:url_id) + ':'
= @page.url_id
%p
%strong= model_class.human_attribute_name(:mode) + ':'
= @page.mode
-if @page.mode == 'path'
%p
%strong= model_class.human_attribute_name(:link) + ':'
= link_to @page.link, send(Page.links[@page.link.to_sym]), target: :_blank
-elsif @page.mode == 'link'
%p
%strong= model_class.human_attribute_name(:link) + ':'
= link_to @page.link, @page.link, target: :_blank
-else
%p
%strong= model_class.human_attribute_name(:body) + ':'
%br
= @page.body.to_s.html_safe
%p
%strong= model_class.human_attribute_name(:keywords) + ':'
%br
= @page.keywords
%p
%strong= model_class.human_attribute_name(:description) + ':'
%br
= @page.description
= link_to t('helpers.links.back'), pages_path, :class => 'btn btn-default'
= link_to t('helpers.links.edit'), edit_page_path(@page), class: 'btn btn-default'
= link_to t('helpers.links.destroy'), page_path(@page), method: 'delete', data: { confirm: t('helpers.links.confirm') }, class: 'btn btn-danger'
- model_class = Setting
.page-header
%h1=t '.title', :default => model_class.model_name.human(count: 2)
%table.table.table-striped.editable_rows{'data-resource' => model_class.name.underscore}
%thead
%tr
%th= model_class.human_attribute_name(:updated_at)
%th= model_class.human_attribute_name(:name)
%th= model_class.human_attribute_name(:value)
%th=t '.actions', :default => t("helpers.actions")
%tbody
- @settings.each do |setting|
%tr{'data-id' => setting.id}
%td=localize_datetime setting.updated_at
%td= setting.name.humanize
%td{data: :value}= setting.value
%td.actions
= link_to edit_setting_path(setting), class: 'btn btn-default btn-xs edit' do
%i.fa.fa-edit
<?xml version="1.0" encoding="UTF-8"?>
<module type="RUBY_MODULE" version="4">
<component name="FacetManager">
<facet type="RailsFacetType" name="Ruby on Rails">
<configuration>
<RAILS_FACET_CONFIG_ID NAME="RAILS_FACET_SUPPORT_REMOVED" VALUE="false" />
<RAILS_FACET_CONFIG_ID NAME="RAILS_TESTS_SOURCES_PATCHED" VALUE="true" />
<RAILS_FACET_CONFIG_ID NAME="RAILS_FACET_APPLICATION_ROOT" VALUE="$MODULE_DIR$" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/.bundle" />
<excludeFolder url="file://$MODULE_DIR$/components" />
<excludeFolder url="file://$MODULE_DIR$/public/system" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
<excludeFolder url="file://$MODULE_DIR$/vendor/bundle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="actionmailer (v4.2.5.1, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="actionpack (v4.2.5.1, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="actionview (v4.2.5.1, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="activejob (v4.2.5.1, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="activemodel (v4.2.5.1, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="activerecord (v4.2.5.1, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="activesupport (v4.2.5.1, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="acts_as_list (v0.7.2, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="arel (v6.0.3, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="autoprefixer-rails (v6.3.6, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="bcrypt (v3.1.11, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="binding_of_caller (v0.7.2, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="bootstrap-sass (v3.3.6, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="bootstrap-will_paginate (v0.0.10, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="bootstrap3-datetimepicker-rails (v4.15.35, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="builder (v3.2.2, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.11.2, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="capistrano (v3.4.0, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="capistrano-bundler (v1.1.4, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="capistrano-faster-assets (v1.0.2, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="capistrano-rails (v1.1.6, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="capistrano-rvm (v0.1.2, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="carrierwave (v0.11.0, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="ckeditor (v4.1.6, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="climate_control (v0.0.3, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="cocaine (v0.5.8, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="coffee-rails (v4.1.1, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="coffee-script (v2.4.1, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="coffee-script-source (v1.10.0, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="commonjs (v0.2.7, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.0.1, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="debug_inspector (v0.0.2, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="devise (v3.5.6, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="devise-i18n (v1.0.1, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="erubis (v2.7.0, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="execjs (v2.6.0, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="font-awesome-rails (v4.6.0.0, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="globalid (v0.3.6, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="haml (v4.0.7, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="haml-rails (v0.9.0, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="html2haml (v2.0.0, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="i18n (v0.7.0, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="jbuilder (v2.4.1, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="jquery-rails (v4.1.1, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="jquery-ui-rails (v5.0.5, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="json (v1.8.3, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="less (v2.6.0, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="less-rails (v2.7.1, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="loofah (v2.0.3, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="mail (v2.6.4, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="mime-types (v3.0, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="mime-types-data (v3.2016.0221, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="mini_magick (v4.5.1, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="mini_portile2 (v2.0.0, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.8.4, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="momentjs-rails (v2.11.0, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="multi_json (v1.11.2, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="mysql2 (v0.4.3, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="nested_form (v0.3.2, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="net-scp (v1.2.1, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="net-ssh (v3.1.1, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.6.7.2, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="orm_adapter (v0.5.0, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rack (v1.6.4, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rack-test (v0.6.3, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rails (v4.2.5.1, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rails-deprecated_sanitizer (v1.0.3, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rails-dom-testing (v1.0.7, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rails-html-sanitizer (v1.0.3, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="railties (v4.2.5.1, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rake (v11.1.2, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rdoc (v4.2.2, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="responders (v2.1.2, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="ruby_parser (v3.8.1, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="sass (v3.4.22, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="sass-rails (v5.0.4, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="sdoc (v0.4.1, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="sexp_processor (v4.7.0, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="simple_form (v3.2.1, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="sprockets (v3.6.0, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="sprockets-rails (v3.0.4, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="sshkit (v1.9.0, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="thor (v0.19.1, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.5, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="tilt (v2.0.2, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="turbolinks (v2.5.3, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="twitter-bootstrap-rails (v3.2.2, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v1.2.2, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="tzinfo-data (v1.2016.3, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="uglifier (v3.0.0, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="warden (v1.2.6, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="web-console (v2.3.0, ruby-2.1.5-p273) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="will_paginate (v3.1.0, ruby-2.1.5-p273) [gem]" level="application" />
</component>
<component name="RModuleSettingsStorage">
<LOAD_PATH number="0" />
<I18N_FOLDERS number="1" string0="$MODULE_DIR$/config/locales" />
</component>
</module>
\ No newline at end of file
#!/usr/bin/env ruby.exe
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
load Gem.bin_path('bundler', 'bundle')
#!/usr/bin/env ruby.exe
APP_PATH = File.expand_path('../../config/application', __FILE__)
require_relative '../config/boot'
require 'rails/commands'
#!/usr/bin/env ruby.exe
require_relative '../config/boot'
require 'rake'
Rake.application.run
#!/usr/bin/env ruby.exe
require 'pathname'
# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
Dir.chdir APP_ROOT do
# This script is a starting point to setup your application.
# Add necessary setup steps to this file:
puts "== Installing dependencies =="
system "gem install bundler --conservative"
system "bundle check || bundle install"
# puts "\n== Copying sample files =="
# unless File.exist?("config/database.yml")
# system "cp config/database.yml.sample config/database.yml"
# end
puts "\n== Preparing database =="
system "bin/rake db:setup"
puts "\n== Removing old logs and tempfiles =="
system "rm -f log/*"
system "rm -rf tmp/cache"
puts "\n== Restarting application server =="
system "touch tmp/restart.txt"
end
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Rails.application
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Stellar
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.
# 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 = 'Kyiv'
# 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}').to_s]
config.i18n.default_locale = :uk
# Do not swallow errors in after_commit/after_rollback callbacks.
config.active_record.raise_in_transactional_callbacks = true
end
end
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' # Set up gems listed in the Gemfile.
default: &default
adapter: mysql2
encoding: utf8
reconnect: false
pool: 5
host: localhost
development:
<<: *default
database: base_sites_development
username: devuser
password: devpassword
test:
<<: *default
database: base_sites_test
username: devuser
password: devpassword
production:
<<: *default
database: base_sites
username: spserviceuser
password: spservicepassword
# config valid only for current version of Capistrano
lock '3.4.0'
# DEPLOY
set :application, 'haba_plastics'
# set :deploy_to, '/var/www/amaox' # Default deploy_to directory is /var/www/my_app_name
set :scm, :svn
set :repo_url, 'http://svn.sp-service.com.ua/svnroot/svn/haba_plastics/trunk'
# set :format, :pretty # Default value for :format is :pretty
# set :log_level, :debug # Default value for :log_level is :debug
# set :pty, true # Default value for :pty is false
# set :linked_files, fetch(:linked_files, []).push('config/vacancies.yml') # Default is []
set :linked_dirs, fetch(:linked_dirs, []).push('log', 'public/uploads', 'files') # Default is []
# set :default_env, { path: "/opt/ruby/bin:$PATH" } # Default value for default_env is {}
# set :keep_releases, 5 # Default value for keep_releases is 5
# RVM
# set :rvm_type, :user # Defaults to: :auto
set :rvm_ruby_version, '2.1.5' # Defaults to: 'default'
# set :rvm_custom_path, '~/.rvm' # only needed if not detected
# RAILS
set :rails_env, 'production' # If the environment differs from the stage name
# set :migration_role, 'migrator' # Defaults to 'db'
# set :conditionally_migrate, true # Defaults to false. If true, it's skip migration if files in db/migrate not modified
# set :assets_roles, [:web, :app] # Defaults to [:web]
# BUNDLER
# In order to the bundler install gems to default directory otherwise it will be create gems folder in project directory
set :bundle_path, -> {}
set :bundle_flags, '--system --quiet'
# WHENEVER
# set :whenever_environment, -> { fetch(:stage) }
# set :whenever_identifier, -> { "#{fetch(:application)}_#{fetch(:stage)}" }
puts "Started deploy in #{fetch(:stage)} mode!"
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app) do
execute "mkdir -p #{File.join(current_path, 'tmp')}; touch #{File.join(current_path, 'tmp', 'restart.txt')}"
end
end
desc 'Reload the database with seed data'
task :seed do
on roles(:app) do
within "#{current_path}" do
with rails_env: :production do
execute :rake, "db:seed"
end
end
end
end
desc 'Tail production log'
task :tail_log do
on roles(:app) do
trap('INT') { puts 'Interupted'; exit 0; }
execute "tail -f #{shared_path}/log/production.log" do |channel, stream, data|
puts # for an extra line break before the host name
puts "#{channel[:host]}: #{data}"
break if stream == :err
end
end
end
after 'deploy:publishing', 'deploy:restart'
after :restart, :x_bin_rails do
on roles(:web), in: :groups, limit: 3, wait: 10 do
within release_path do
execute :chmod, "u+x bin/rails"
end
end
end
after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
# Here we can do anything such as:
# within release_path do
# execute :rake, 'cache:clear'
# end
end
end
end
server 'storage.sp-service.com.u', user: 'deploy', roles: %w{app db web}
# set :rvm_custom_path, '/usr/local/rvm' # only needed if not detected
server 'storage.sp-service.com.ua', user: 'deploy', roles: %w{app db web}
# Load the Rails application.
require File.expand_path('../application', __FILE__)
# Initialize the Rails application.
Rails.application.initialize!
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = false
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true
# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Enable Rack::Cache to put a simple HTTP cache in front of your application
# Add `rack-cache` to your Gemfile before enabling this.
# For large-scale production use, consider using a caching reverse proxy like
# NGINX, varnish or squid.
# config.action_dispatch.rack_cache = true
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :debug
# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
end
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
# Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false
# Configure static file server for tests with Cache-Control for performance.
config.serve_static_files = true
config.static_cache_control = 'public, max-age=3600'
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
# Randomize the order test cases are executed.
config.active_support.test_order = :random
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end
#encoding: utf-8
require 'active_translation/active_translation'
LANGUAGES = [
%w(Ukrainian uk),
%w(English en)
# %w(Deutsch de)
]
def locales
@locales ||= LANGUAGES.map{|l| l[1]}
end
def localed_attr(attr)
locales.map {|l| "#{attr.to_s}_#{l}".to_sym} << attr
end
Rails.application.config.i18n.available_locales = locales
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path
# Rails.application.config.assets.paths << Emoji.images_path
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# Rails.application.config.assets.precompile += %w( search.js )
Rails.application.config.assets.precompile += %w(ckeditor/* shared.js admin.js front.js)
Rails.application.config.assets.precompile += %w(shared.css admin.css front.css)
Rails.application.config.assets.precompile += %w(admin_front.js admin_front.css)
Rails.application.config.assets.precompile += %w(.svg .eot .woff .ttf )
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers!
# Use this hook to configure ckeditor
Ckeditor.setup do |config|
# ==> ORM configuration
# Load and configure the ORM. Supports :active_record (default), :mongo_mapper and
# :mongoid (bson_ext recommended) by default. Other ORMs may be
# available as additional gems.
require "ckeditor/orm/active_record"
# Allowed image file types for upload.
# Set to nil or [] (empty array) for all file types
# By default: %w(jpg jpeg png gif tiff)
# config.image_file_types = ["jpg", "jpeg", "png", "gif", "tiff"]
# Allowed attachment file types for upload.
# Set to nil or [] (empty array) for all file types
# By default: %w(doc docx xls odt ods pdf rar zip tar tar.gz swf)
# config.attachment_file_types = ["doc", "docx", "xls", "odt", "ods", "pdf", "rar", "zip", "tar", "swf"]
# Setup authorization to be run as a before filter
# By default: there is no authorization.
# config.authorize_with :cancan
# Asset model classes
# config.picture_model { Ckeditor::Picture }
# config.attachment_file_model { Ckeditor::AttachmentFile }
# Paginate assets
# By default: 24
# config.default_per_page = 24
# Customize ckeditor assets path
# By default: nil
# config.asset_path = "http://www.example.com/assets/ckeditor/"
# To reduce the asset precompilation time, you can limit plugins and/or languages to those you need:
# By default: nil (no limit)
# config.assets_languages = ['en', 'uk']
# config.assets_plugins = ['image', 'smiley']
end
# Be sure to restart your server when you modify this file.
Rails.application.config.action_dispatch.cookies_serializer = :json
# Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render invalid all existing
# confirmation, reset password and unlock tokens in the database.
# Devise will use the `secret_key_base` on Rails 4+ applications as its `secret_key`
# by default. You can change it below and use your own secret key.
config.secret_key = '3e4cafacb13e0b16028deb0c6c4e531af0ae4ddafc6c2998be687f7c42e7935c7a618b2d299df236a7696142f594c78f2f2f0894552d1ddbf91ef75bb09211eb'
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class
# with default "from" parameter.
config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
# Configure the class responsible to send e-mails.
# config.mailer = 'Devise::Mailer'
# ==> ORM configuration
# Load and configure the ORM. Supports :active_record (default) and
# :mongoid (bson_ext recommended) by default. Other ORMs may be
# available as additional gems.
require 'devise/orm/active_record'
# ==> Configuration for any authentication mechanism
# Configure which keys are used when authenticating a user. The default is
# just :email. You can configure it to use [:username, :subdomain], so for
# authenticating a user, both parameters are required. Remember that those
# parameters are used only when authenticating and not when retrieving from
# session. If you need permissions, you should implement that in a before filter.
# You can also supply a hash where the value is a boolean determining whether
# or not authentication should be aborted when the value is not present.
# config.authentication_keys = [:email]
# Configure parameters from the request object used for authentication. Each entry
# given should be a request method and it will automatically be passed to the
# find_for_authentication method and considered in your model lookup. For instance,
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
# The same considerations mentioned for authentication_keys also apply to request_keys.
# config.request_keys = []
# Configure which authentication keys should be case-insensitive.
# These keys will be downcased upon creating or modifying a user and when used
# to authenticate or find a user. Default is :email.
config.case_insensitive_keys = [:email]
# Configure which authentication keys should have whitespace stripped.
# These keys will have whitespace before and after removed upon creating or
# modifying a user and when used to authenticate or find a user. Default is :email.
config.strip_whitespace_keys = [:email]
# Tell if authentication through request.params is enabled. True by default.
# It can be set to an array that will enable params authentication only for the
# given strategies, for example, `config.params_authenticatable = [:database]` will
# enable it only for database (email + password) authentication.
# config.params_authenticatable = true
# Tell if authentication through HTTP Auth is enabled. False by default.
# It can be set to an array that will enable http authentication only for the
# given strategies, for example, `config.http_authenticatable = [:database]` will
# enable it only for database authentication. The supported strategies are:
# :database = Support basic authentication with authentication key + password
# config.http_authenticatable = false
# If 401 status code should be returned for AJAX requests. True by default.
# config.http_authenticatable_on_xhr = true
# The realm used in Http Basic Authentication. 'Application' by default.
# config.http_authentication_realm = 'Application'
# It will change confirmation, password recovery and other workflows
# to behave the same regardless if the e-mail provided was right or wrong.
# Does not affect registerable.
# config.paranoid = true
# By default Devise will store the user in session. You can skip storage for
# particular strategies by setting this option.
# Notice that if you are skipping storage for all authentication paths, you
# may want to disable generating routes to Devise's sessions controller by
# passing skip: :sessions to `devise_for` in your config/routes.rb
config.skip_session_storage = [:http_auth]
# By default, Devise cleans up the CSRF token on authentication to
# avoid CSRF token fixation attacks. This means that, when using AJAX
# requests for sign in and sign up, you need to get a new CSRF token
# from the server. You can disable this option at your own risk.
# config.clean_up_csrf_token_on_authentication = true
# ==> Configuration for :database_authenticatable
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
# using other encryptors, it sets how many times you want the password re-encrypted.
#
# Limiting the stretches to just one in testing will increase the performance of
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
# a value less than 10 in other environments. Note that, for bcrypt (the default
# encryptor), the cost increases exponentially with the number of stretches (e.g.
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
config.stretches = Rails.env.test? ? 1 : 10
# Setup a pepper to generate the encrypted password.
# config.pepper = '4d3b48fa3c9542fc2a2efa8a1794a6de6c755429e9a8213d2900f702bd25c58b9caef7689e8430cbf007680daf9955019e002feb8ef65ff3d6616b8309af3350'
# ==> Configuration for :confirmable
# A period that the user is allowed to access the website even without
# confirming their account. For instance, if set to 2.days, the user will be
# able to access the website for two days without confirming their account,
# access will be blocked just in the third day. Default is 0.days, meaning
# the user cannot access the website without confirming their account.
# config.allow_unconfirmed_access_for = 2.days
# A period that the user is allowed to confirm their account before their
# token becomes invalid. For example, if set to 3.days, the user can confirm
# their account within 3 days after the mail was sent, but on the fourth day
# their account can't be confirmed with the token any more.
# Default is nil, meaning there is no restriction on how long a user can take
# before confirming their account.
# config.confirm_within = 3.days
# If true, requires any email changes to be confirmed (exactly the same way as
# initial account confirmation) to be applied. Requires additional unconfirmed_email
# db field (see migrations). Until confirmed, new email is stored in
# unconfirmed_email column, and copied to email column on successful confirmation.
config.reconfirmable = true
# Defines which key will be used when confirming an account
# config.confirmation_keys = [:email]
# ==> Configuration for :rememberable
# The time the user will be remembered without asking for credentials again.
# config.remember_for = 2.weeks
# Invalidates all the remember me tokens when the user signs out.
config.expire_all_remember_me_on_sign_out = true
# If true, extends the user's remember period when remembered via cookie.
# config.extend_remember_period = false
# Options to be passed to the created cookie. For instance, you can set
# secure: true in order to force SSL only cookies.
# config.rememberable_options = {}
# ==> Configuration for :validatable
# Range for password length.
config.password_length = 8..72
# Email regex used to validate email formats. It simply asserts that
# one (and only one) @ exists in the given string. This is mainly
# to give user feedback and not to assert the e-mail validity.
# config.email_regexp = /\A[^@]+@[^@]+\z/
# ==> Configuration for :timeoutable
# The time you want to timeout the user session without activity. After this
# time the user will be asked for credentials again. Default is 30 minutes.
# config.timeout_in = 30.minutes
# If true, expires auth token on session timeout.
# config.expire_auth_token_on_timeout = false
# ==> Configuration for :lockable
# Defines which strategy will be used to lock an account.
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
# :none = No lock strategy. You should handle locking by yourself.
# config.lock_strategy = :failed_attempts
# Defines which key will be used when locking and unlocking an account
# config.unlock_keys = [:email]
# Defines which strategy will be used to unlock an account.
# :email = Sends an unlock link to the user email
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
# :both = Enables both strategies
# :none = No unlock strategy. You should handle unlocking by yourself.
# config.unlock_strategy = :both
# Number of authentication tries before locking an account if lock_strategy
# is failed attempts.
# config.maximum_attempts = 20
# Time interval to unlock the account if :time is enabled as unlock_strategy.
# config.unlock_in = 1.hour
# Warn on the last attempt before the account is locked.
# config.last_attempt_warning = true
# ==> Configuration for :recoverable
#
# Defines which key will be used when recovering the password for an account
# config.reset_password_keys = [:email]
# Time interval you can reset your password with a reset password key.
# Don't put a too small interval or your users won't have the time to
# change their passwords.
config.reset_password_within = 6.hours
# When set to false, does not sign a user in automatically after their password is
# reset. Defaults to true, so a user is signed in automatically after a reset.
# config.sign_in_after_reset_password = true
# ==> Configuration for :encryptable
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy
# REST_AUTH_SITE_KEY to pepper).
#
# Require the `devise-encryptable` gem when using anything other than bcrypt
# config.encryptor = :sha512
# ==> Scopes configuration
# Turn scoped views on. Before rendering "sessions/new", it will first check for
# "users/sessions/new". It's turned off by default because it's slower if you
# are using only default views.
# config.scoped_views = false
# Configure the default scope given to Warden. By default it's the first
# devise role declared in your routes (usually :user).
# config.default_scope = :user
# Set this configuration to false if you want /users/sign_out to sign out
# only the current scope. By default, Devise signs out all scopes.
# config.sign_out_all_scopes = true
# ==> Navigation configuration
# Lists the formats that should be treated as navigational. Formats like
# :html, should redirect to the sign in page when the user does not have
# access, but formats like :xml or :json, should return 401.
#
# If you have any extra navigational formats, like :iphone or :mobile, you
# should add them to the navigational formats lists.
#
# The "*/*" below is required to match Internet Explorer requests.
# config.navigational_formats = ['*/*', :html]
# The default HTTP method used to sign out a resource. Default is :delete.
config.sign_out_via = :delete
# ==> OmniAuth
# Add a new OmniAuth provider. Check the wiki for more information on setting
# up on your models and hooks.
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
# ==> Warden configuration
# If you want to use other strategies, that are not supported by Devise, or
# change the failure app, you can configure them inside the config.warden block.
#
# config.warden do |manager|
# manager.intercept_401 = false
# manager.default_strategies(scope: :user).unshift :some_external_strategy
# end
# ==> Mountable engine configurations
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
# is mountable, there are some extra configurations to be taken into account.
# The following options are available, assuming the engine is mounted as:
#
# mount MyEngine, at: '/my_engine'
#
# The router that invoked `devise_for`, in the example above, would be:
# config.router_name = :my_engine
#
# When using OmniAuth, Devise cannot automatically set OmniAuth path,
# so you need to do it manually. For the users scope, it would be:
# config.omniauth_path_prefix = '/my_engine/users/auth'
end
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password]
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end
# These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym 'RESTful'
# end
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_stellar_session'
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
# Wrappers are used by the form builder to generate a
# complete input. You can remove any component from the
# wrapper, change the order or even add your own to the
# stack. The options given below are used to wrap the
# whole input.
config.wrappers :default, class: :input,
hint_class: :field_with_hint, error_class: :field_with_errors do |b|
## Extensions enabled by default
# Any of these extensions can be disabled for a
# given input by passing: `f.input EXTENSION_NAME => false`.
# You can make any of these extensions optional by
# renaming `b.use` to `b.optional`.
# Determines whether to use HTML5 (:email, :url, ...)
# and required attributes
b.use :html5
# Calculates placeholders automatically from I18n
# You can also pass a string as f.input placeholder: "Placeholder"
b.use :placeholder
## Optional extensions
# They are disabled unless you pass `f.input EXTENSION_NAME => true`
# to the input. If so, they will retrieve the values from the model
# if any exists. If you want to enable any of those
# extensions by default, you can change `b.optional` to `b.use`.
# Calculates maxlength from length validations for string inputs
b.optional :maxlength
# Calculates pattern from format validations for string inputs
b.optional :pattern
# Calculates min and max from length validations for numeric inputs
b.optional :min_max
# Calculates readonly automatically from readonly attributes
b.optional :readonly
## Inputs
b.use :label_input
b.use :hint, wrap_with: { tag: :span, class: :hint }
b.use :error, wrap_with: { tag: :span, class: :error }
## full_messages_for
# If you want to display the full error message for the attribute, you can
# use the component :full_error, like:
#
# b.use :full_error, wrap_with: { tag: :span, class: :error }
end
# The default wrapper to be used by the FormBuilder.
config.default_wrapper = :default
# Define the way to render check boxes / radio buttons with labels.
# Defaults to :nested for bootstrap config.
# inline: input + label
# nested: label > input
config.boolean_style = :nested
# Default class for buttons
config.button_class = 'btn'
# Method used to tidy up errors. Specify any Rails Array method.
# :first lists the first message for each field.
# Use :to_sentence to list all errors for each field.
# config.error_method = :first
# Default tag used for error notification helper.
config.error_notification_tag = :div
# CSS class to add for error notification helper.
config.error_notification_class = 'error_notification'
# ID to add for error notification helper.
# config.error_notification_id = nil
# Series of attempts to detect a default label method for collection.
# config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
# Series of attempts to detect a default value method for collection.
# config.collection_value_methods = [ :id, :to_s ]
# You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
# config.collection_wrapper_tag = nil
# You can define the class to use on all collection wrappers. Defaulting to none.
# config.collection_wrapper_class = nil
# You can wrap each item in a collection of radio/check boxes with a tag,
# defaulting to :span. Please note that when using :boolean_style = :nested,
# SimpleForm will force this option to be a label.
# config.item_wrapper_tag = :span
# You can define a class to use in all item wrappers. Defaulting to none.
# config.item_wrapper_class = nil
# How the label text should be generated altogether with the required text.
# config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" }
# You can define the class to use on all labels. Default is nil.
# config.label_class = nil
# You can define the default class to be used on forms. Can be overriden
# with `html: { :class }`. Defaulting to none.
# config.default_form_class = nil
# You can define which elements should obtain additional classes
# config.generate_additional_classes_for = [:wrapper, :label, :input]
# Whether attributes are required by default (or not). Default is true.
# config.required_by_default = true
# Tell browsers whether to use the native HTML5 validations (novalidate form option).
# These validations are enabled in SimpleForm's internal config but disabled by default
# in this configuration, which is recommended due to some quirks from different browsers.
# To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
# change this configuration to true.
config.browser_validations = false
# Collection of methods to detect if a file type was given.
# config.file_methods = [ :mounted_as, :file?, :public_filename ]
# Custom mappings for input types. This should be a hash containing a regexp
# to match as key, and the input type that will be used when the field name
# matches the regexp as value.
# config.input_mappings = { /count/ => :integer }
# Custom wrappers for input types. This should be a hash containing an input
# type as key and the wrapper that will be used for all inputs with specified type.
# config.wrapper_mappings = { string: :prepend }
# Namespaces where SimpleForm should look for custom input classes that
# override default inputs.
# config.custom_inputs_namespaces << "CustomInputs"
# Default priority for time_zone inputs.
# config.time_zone_priority = nil
# Default priority for country inputs.
# config.country_priority = nil
# When false, do not use translations for labels.
# config.translate_labels = true
# Automatically discover new inputs in Rails' autoload path.
# config.inputs_discovery = true
# Cache SimpleForm inputs discovery
# config.cache_discovery = !Rails.env.development?
# Default class for inputs
# config.input_class = nil
# Define the default class of the input wrapper of the boolean input.
config.boolean_label_class = 'checkbox'
# Defines if the default input wrapper class should be included in radio
# collection wrappers.
# config.include_default_input_wrapper_class = true
# Defines which i18n scope will be used in Simple Form.
# config.i18n_scope = 'simple_form'
end
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
config.error_notification_class = 'alert alert-danger'
config.button_class = 'btn btn-default'
config.boolean_label_class = nil
config.wrappers :registration, tag: 'div', class: 'registration', error_class: 'has-error' do |b|
b.use :html5
b.use :placeholder
b.optional :maxlength
b.optional :pattern
b.optional :min_max
b.optional :readonly
b.use :label, class: 'reg_label'
b.use :input, class: 'reg_input'
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
end
config.wrappers :contact_us, tag: 'div', class: 'contact_us', error_class: 'has-error' do |b|
b.use :html5
b.use :placeholder
b.optional :maxlength
b.optional :pattern
b.optional :min_max
b.optional :readonly
b.use :label, class: 'contact_us_label col-sm-4.col-xs-12'
b.use :input, class: 'contact_us_input col-sm-8 col-xs-12'
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
end
config.wrappers :vertical_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
b.use :html5
b.use :placeholder
b.optional :maxlength
b.optional :pattern
b.optional :min_max
b.optional :readonly
b.use :label, class: 'control-label'
b.use :input, class: 'form-control'
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
end
config.wrappers :contact_us, tag: 'div', class: 'contact_us', error_class: 'contact_us_has-error' do |b|
b.use :html5
b.use :placeholder
b.optional :maxlength
b.optional :pattern
b.optional :min_max
b.optional :readonly
b.use :label, class: 'contact_us_label col-sm-3 col-xs-12'
b.use :input, class: 'contact_us_input col-sm-9 col-xs-12'
b.use :error, wrap_with: { tag: 'span', class: 'contact_us_help-block ' }
b.use :hint, wrap_with: { tag: 'p', class: 'contact_us_help-block ' }
end
config.wrappers :vertical_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
b.use :html5
b.use :placeholder
b.optional :maxlength
b.optional :readonly
b.use :label, class: 'control-label'
b.use :input
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
end
config.wrappers :vertical_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
b.use :html5
b.optional :readonly
b.wrapper tag: 'div', class: 'checkbox' do |ba|
ba.use :label_input
end
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
end
config.wrappers :vertical_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
b.use :html5
b.optional :readonly
b.use :label, class: 'control-label'
b.use :input
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
end
config.wrappers :horizontal_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
b.use :html5
b.use :placeholder
b.optional :maxlength
b.optional :pattern
b.optional :min_max
b.optional :readonly
b.use :label, class: 'col-sm-3 control-label'
b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
ba.use :input, class: 'form-control'
ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
end
end
config.wrappers :horizontal_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
b.use :html5
b.use :placeholder
b.optional :maxlength
b.optional :readonly
b.use :label, class: 'col-sm-3 control-label'
b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
ba.use :input
ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
end
end
config.wrappers :horizontal_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
b.use :html5
b.optional :readonly
b.wrapper tag: 'div', class: 'col-sm-offset-3 col-sm-9' do |wr|
wr.wrapper tag: 'div', class: 'checkbox' do |ba|
ba.use :label_input, class: 'col-sm-9'
end
wr.use :error, wrap_with: { tag: 'span', class: 'help-block' }
wr.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
end
end
config.wrappers :horizontal_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
b.use :html5
b.optional :readonly
b.use :label, class: 'col-sm-3 control-label'
b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
ba.use :input
ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
end
end
config.wrappers :inline_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
b.use :html5
b.use :placeholder
b.optional :maxlength
b.optional :pattern
b.optional :min_max
b.optional :readonly
b.use :label, class: 'sr-only'
b.use :input, class: 'form-control'
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
end
# Wrappers for forms and inputs using the Bootstrap toolkit.
# Check the Bootstrap docs (http://getbootstrap.com)
# to learn about the different styles for forms and inputs,
# buttons and other elements.
config.default_wrapper = :vertical_form
config.wrapper_mappings = {
check_boxes: :vertical_radio_and_checkboxes,
radio_buttons: :vertical_radio_and_checkboxes,
file: :vertical_file_input,
boolean: :vertical_boolean,
}
end
# Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
end
# To enable root element in JSON for ActiveRecord objects.
# ActiveSupport.on_load(:active_record) do
# self.include_root_in_json = true
# end
# Sample localization file for English. Add more files in this directory for other locales.
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
en:
breadcrumbs:
application:
root: "Index"
pages:
pages: "Pages"
helpers:
actions: "Actions"
links:
back: "Back"
cancel: "Cancel"
confirm: "Are you sure?"
destroy: "Delete"
new: "New"
edit: "Edit"
apply: "Apply"
ok: "OK"
change_password: "Change password"
sign_out: "Sign out"
titles:
edit: "Edit %{model}"
save: "Save %{model}"
new: "New %{model}"
delete: "Delete %{model}"
logged_in_as: "Logged in as:"
en:
attributes:
id: Id
name: Name
login: Login
email: Email
password: Password
account: Account
identifier: Identifier
updated_at: Updated at
created_at: Created at
date: Date
number: Number
type: Type
image: Image
description: Description
subject: Subject
meta_keywords: Keywords
meta_description: Description
positions: Positions
processed_at: Processed at
text: Text
url_id: URL identifier
subscribed: Subscribed
on_hold: On hold
value: Value
activerecord:
models:
account:
one: Account
few: Accounts
many: Accounts
other: Accounts
administrator:
one: Administrator
few: Administrators
many: Administrators
other: Administrators
block:
one: Block
few: Blocks
many: Blocks
other: Blocks
certificate:
one: Certificate
few: Certificates
many: Certificates
other: Certificates
page:
one: Page
few: Pages
many: Pages
other: Pages
service:
one: Service
few: Services
many: Services
other: Services
setting:
one: Setting
few: Settings
many: Settings
other: Settings
social_network_link:
one: Social network link
few: Social network links
many: Social network links
other: Social network links
email:
one: Email
few: Emails
many: Emails
other: Emails
newsletter:
one: Newsletter
few: Newsletters
many: Newsletters
other: Newsletters
attributes:
account:
admin: Administrator
login: Login
email: Email
name: Name
last_name: Last name
middle_name: Middle name
page:
title: Title
body: Page body
enabled: Active
mode: Mode
modes:
path: Internal link
link: External link
page: Page
links:
main: Home page
contact_us: Contact us
admin_root: Admin
admin_area: Admin area
date:
formats:
default: ! '%d.%m.%Y'
long: ! '%d %B %Y'
short: ! '%d %b'
blocks:
apply_changes: Apply changes?
locale:
uk: Укр
ru: Рус
en: Eng
de: Ger
info_box:
title: Plastic and aesthetic surgery
hospital: 8th Communal Clinical Hospital
department: Centre thermal injuries and plastic surgery
doctor_name: Dr. Taras Khaba
about_me: About me
certificates: Certificates
services: Services
contacts: Contacts
helpers:
links:
front: "Site preview"
# Sample localization file for English. Add more files in this directory for other locales.
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
ru:
breadcrumbs:
application:
root: "Главная"
pages:
pages: "Страницы"
helpers:
actions: "Действия"
links:
back: "Назад"
cancel: "Отменить"
confirm: "Вы уверены?"
destroy: "Удалить"
new: "Создать"
edit: "Редактировать"
apply: "Применить"
ok: "Хорошо"
change_password: "Изменить пароль"
sign_out: "Выйти"
titles:
edit: "Редактировать %{model}"
save: "Сохранить %{model}"
new: "Создать %{model}"
delete: "Удалить %{model}"
logged_in_as: "Вы вошли как:"
ru:
attributes:
id: Код
name: Название
login: Логин
email: Електронный адрес
password: Пароль
account: Учетная запись
identifier: Идентификатор
updated_at: Обновлено
created_at: Создано
date: Дата
number: Номер
type: Тип
image: Изображение
description: Описание
subject: Тема
meta_keywords: Ключевые слова
meta_description: Описание
positions: Позиции
processed_at: Обработано
text: Текст
url_id: Идентификатор ссылки
subscribed: Получает рассылку
on_hold: На удерживании
value: Значение
activerecord:
models:
account:
one: Учетная запись
few: Учетные записи
many: Учетных записей
other: Учетные записи
administrator:
one: Администратор
few: Администраторы
many: Администраторов
other: Администраторы
block:
one: Блок
few: Блоки
many: Блоки
other: Блоки
certificate:
one: Сертификат
few: Сертификаты
many: Сертификатов
other: Сертификаты
page:
one: Страница
few: Страницы
many: Страниц
other: Страницы
service:
one: Услуга
few: Услуги
many: Услуг
other: Услуги
setting:
one: Настройка
few: Настройки
many: Настройок
other: Настройки
social_network_link:
one: Ссылка на социальную сеть
few: Ссылок на социальную сеть
many: Ссылки на социальную сеть
other: Ссылки на социальную сеть
email:
one: Электронное письмо
few: Электронные письма
many: Электронных писем
other: Электронные письма
newsletter:
one: Рассылка
few: Рассылки
many: Рассылок
other: Рассылки
attributes:
account:
admin: Администратор
login: Логин
email: Електронный адрес
name: Імя
last_name: Фамилия
middle_name: Отчество
page:
title: Название страницы
body: Тело страницы
enabled: Активная
mode: Режим
modes:
path: Внутренняя ссылка
link: Внешняя ссылка
page: Страница
links:
main: Домашняя страница
contact_us: Написать нам
admin_root: Адмінка
admin_area: Панель администратора
errors:
models:
messages:
accepted: необходимо подтвердить
confirmation: не совпадает с подтверждением
empty: не может быть пустым
equal_to: может иметь только значение, равное %{count}
even: может иметь только непарное значение
exclusion: имеет зарезервированное значение
greater_than: может иметь значение больше чем %{count}
invalid: имеет неверное значение
less_than: может иметь значение меньше чем %{count}
less_than_or_equal_to: может иметь значение меньше или равное %{count}
not_a_number: не является числом
not_an_integer: не является целым числом
odd: может иметь только парное значение
record_invalid: ! "Возникли ошибки: %{errors}"
taken: уже существует
greater_than_or_equal_to: может иметь значение большее или равное %{count}
greater_than: "должно бить больше %{count}"
blank: не может отсутствовать
inclusion: имеет непредсказуемое значение
cannot_change_warehouse: "Невозможно изменить слад"
invalid_format: Неправильный формат
output_ware_documents_are_present: "есть подчиненные расходные документы"
client_card_present: присутствует, удалить невозможно
not_a_number: не является числом
too_long:
few: слишком большая длина (не может быть больше чем %{count} символы)
many: слишком большая длина (не может быть больше чем %{count} символов)
one: слишком большая длина (не может быть больше чем %{count} символ)
other: слишком большая длина (не может быть больше чем %{count} символов)
too_short:
few: нодостаточной длины (не может быть меньше %{count} символы)
many: нодостаточной длины (не может быть меньше %{count} символов)
one: нодостаточной длины (не может быть меньше %{count} символа)
other: нодостаточной длины (не может быть меньше %{count} символов)
wrong_length:
few: неверной длины (может быть длиной ровно %{count} символы)
many: неверной длины (может быть длиной ровно %{count} символов)
one: неверной длины (может быть длиной ровно %{count} символ)
other: неверной длины (может быть длиной ровно %{count} символов)
template:
body: "Возникли следующие проблеми:"
header:
few: "%{model}: сохранение не состоялось из-за %{count} ошибок"
many: "%{model}: сохранение не состоялось из-за %{count} ошибок"
one: "%{model}: сохранение не состоялось из-за %{count} ошибки"
other: "%{model}: сохранение не состоялось из-за %{count} ошибок"
date:
abbr_day_names:
- Нд
- Пн
- Вт
- Ср
- Чт
- Пт
- Сб
abbr_month_names:
-
- января
- февраля
- марта
- апреля
- мая
- июля
- июня
- августа
- сентября
- октября
- ноября
- декабря
day_names:
- воскресенье
- понедельник
- вторник
- среда
- четверг
- пятница
- суббота
formats:
default: ! '%d.%m.%Y'
long: ! '%d %B %Y'
short: ! '%d %b'
month_names:
-
- января
- февраля
- марта
- апреля
- мая
- июля
- июня
- августа
- сентября
- октября
- ноября
- декабря
order:
- :day
- :month
- :year
datetime:
distance_in_words:
about_x_hours:
few: около %{count} часов
many: около %{count} часов
one: около %{count} часа
other: около %{count} часов
about_x_months:
few: около %{count} месяцев
many: около %{count} месяцев
one: около %{count} месяца
other: около %{count} месяцев
about_x_years:
few: около %{count} лет
many: около %{count} лет
one: около %{count} года
other: около %{count} лет
almost_x_years:
one: почти %{count} год
few: почти %{count} года
many: почти %{count} лет
other: почти %{count} лет
half_a_minute: меньше минуты
less_than_x_minutes:
few: меньше %{count} минут
many: меньше %{count} минут
one: меньше %{count} минуты
other: меньше %{count} минут
less_than_x_seconds:
few: меньше %{count} секунд
many: меньше %{count} секунд
one: меньше %{count} секунды
other: меньше %{count} секунд
over_x_years:
few: больше %{count} лет
many: больше %{count} лет
one: больше %{count} года
other: больше %{count} лет
x_days:
few: ! '%{count} дня'
many: ! '%{count} дней'
one: ! '%{count} день'
other: ! '%{count} дня'
x_minutes:
few: ! '%{count} минуты'
many: ! '%{count} минут'
one: ! '%{count} минуту'
other: ! '%{count} минуты'
x_months:
few: ! '%{count} месяца'
many: ! '%{count} месяцев'
one: ! '%{count} месяц'
other: ! '%{count} месяца'
x_seconds:
few: ! '%{count} секунды'
many: ! '%{count} секунд'
one: ! '%{count} секунда'
other: ! '%{count} секунды'
prompts:
day: Дней
hour: Часов
minute: Минут
month: Месяцев
second: Секунд
year: Лет
number:
currency:
format:
delimiter: " "
format: "%n %u"
precision: 2
separator: ","
significant: false
strip_insignificant_zeros: false
unit: грн.
format:
delimiter: " "
precision: 3
separator: ","
significant: false
strip_insignificant_zeros: false
human:
decimal_units:
format: "%n %u"
units:
billion:
few: миллиарда
many: миллиардов
one: миллиард
other: миллиардов
million:
few: милиона
many: милионов
one: милион
other: милионов
quadrillion:
few: квадрильйона
many: квадрильйонов
one: квадрильйон
other: квадрильйонов
thousand:
few: тысячи
many: тысяч
one: тысяча
other: тысяч
trillion:
few: триллиона
many: триллионов
one: триллион
other: триллионов
unit: ""
format:
delimiter: ""
precision: 1
significant: false
strip_insignificant_zeros: false
storage_units:
format: "%n %u"
units:
byte:
few: байта
many: байт
one: байт
other: байта
gb: ГБ
kb: КБ
mb: МБ
tb: ТБ
percentage:
format:
delimiter: ""
precision:
format:
delimiter: ""
support:
array:
last_word_connector: " и "
two_words_connector: " и "
words_connector: ", "
time:
formats:
default: "%a, %d %b %Y, %H:%M:%S %z"
long: "%d %B %Y, %H:%M"
short: "%d %b, %H:%M"
pm: вечора
am: ранку
blocks:
apply_changes: Применить изменения?
locale:
uk: Укр
ru: Рус
en: Eng
de: Ger
info_box:
title: Пластическая и эстетическая хирургия
hospital: Коммунальная 8-я клиническая больница
department: Центр термической травмы и пластической хирургии
doctor_name: Хаба Тарас Петрович
about_me: Обо мне
certificates: Сертификаты
services: Услуги
contacts: Контакты
helpers:
links:
front: "Просмотр сайта"
en:
simple_form:
"yes": 'Yes'
"no": 'No'
required:
text: 'required'
mark: '*'
# You can uncomment the line below if you need to overwrite the whole required html.
# When using html, text and mark won't be used.
# html: '<abbr title="required">*</abbr>'
error_notification:
default_message: "Please review the problems below:"
# Examples
# labels:
# defaults:
# password: 'Password'
# user:
# new:
# email: 'E-mail to sign in.'
# edit:
# email: 'E-mail.'
# hints:
# defaults:
# username: 'User name to sign in.'
# password: 'No special characters, please.'
# include_blanks:
# defaults:
# age: 'Rather not say'
# prompts:
# defaults:
# age: 'Select your age'
ru:
simple_form:
"yes": 'Да'
"no": 'Нет'
required:
text: 'обязательный'
mark: '*'
# You can uncomment the line below if you need to overwrite the whole required html.
# When using html, text and mark won't be used.
# html: '<abbr title="required">*</abbr>'
error_notification:
default_message: "Пожалуйста, просмотрите следующие проблемы:"
# Examples
# labels:
# defaults:
# password: 'Password'
# user:
# new:
# email: 'E-mail to sign in.'
# edit:
# email: 'E-mail.'
# hints:
# defaults:
# username: 'User name to sign in.'
# password: 'No special characters, please.'
# include_blanks:
# defaults:
# age: 'Rather not say'
# prompts:
# defaults:
# age: 'Select your age'
uk:
simple_form:
"yes": 'Так'
"no": 'Ні'
required:
text: 'вимагається'
mark: '*'
# You can uncomment the line below if you need to overwrite the whole required html.
# When using html, text and mark won't be used.
# html: '<abbr title="required">*</abbr>'
error_notification:
default_message: "Будь ласка, перегляньте наступні проблеми:"
# Examples
# labels:
# defaults:
# password: 'Password'
# user:
# new:
# email: 'E-mail to sign in.'
# edit:
# email: 'E-mail.'
# hints:
# defaults:
# username: 'User name to sign in.'
# password: 'No special characters, please.'
# include_blanks:
# defaults:
# age: 'Rather not say'
# prompts:
# defaults:
# age: 'Select your age'
# Sample localization file for English. Add more files in this directory for other locales.
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
uk:
breadcrumbs:
application:
root: "Головна"
pages:
pages: "Сторінки"
helpers:
actions: "Дії"
links:
back: "Назад"
cancel: "Скасувати"
confirm: "Ви впевнені?"
destroy: "Видалити"
new: "Створити"
edit: "Редагувати"
apply: "Застосовувати"
ok: "Гаразд"
change_password: "Змінити пароль"
sign_out: "Вийти"
titles:
edit: "Редагувати %{model}"
save: "Зберегти %{model}"
new: "Створити %{model}"
delete: "Видалити %{model}"
logged_in_as: "Ви увійшли як:"
uk:
attributes:
id: Код
name: Назва
login: Логін
email: Електронна адреса
password: Пароль
account: Обліковий запис
identifier: Ідентифікатор
updated_at: Оновлено
created_at: Створено
date: Дата
number: Номер
type: Тип
image: Зображення
description: Опис
subject: Тема
meta_keywords: Ключові слова
meta_description: Опис
positions: Позиції
processed_at: Опрацьовано
text: Текст
url_id: Ідентифікатор посилання
subscribed: Отримує розсилку
on_hold: На утриманні
value: Значення
activerecord:
models:
account:
one: Обліковий запис
few: Облікові записи
many: Облікові записів
other: Облікові записи
administrator:
one: Адміністратор
few: Адміністратори
many: Адміністраторів
other: Адміністратори
block:
one: Блок
few: Блоки
many: Блоки
other: Блоки
certificate:
one: Сертифікат
few: Сертифікати
many: Сертифікатів
other: Сертифікати
page:
one: Сторінка
few: Сторінки
many: Сторінок
other: Сторінки
service:
one: Послуга
few: Послуги
many: Послуг
other: Послуги
setting:
one: Налаштування
few: Налаштування
many: Налаштувань
other: Налаштування
social_network_link:
one: Посилання на соціальну мережу
few: Посилань на соціальну мережу
many: Посилання на соціальну мережу
other: Посилання на соціальну мережу
email:
one: Електронний лист
few: Електронні листи
many: Електроннх листів
other: Електронні листи
newsletter:
one: Розсилка
few: Розсилки
many: Розсилок
other: Розсилки
attributes:
account:
admin: Адміністратор
login: Логін
email: Електронна адреса
name: Ім'я
last_name: Прізвище
middle_name: По батькові
page:
title: Назва сторінки
body: Тіло сторінки
enabled: Активна
mode: Режим
modes:
path: Внутрішнє посилання
link: Зовнішнє посилання
page: Сторінка
links:
main: Домашня сторінка
contact_us: Написати нам
admin_root: Адмінка
admin_area: Панель адміністратора
errors:
models:
messages:
accepted: необхідно підтвердити
confirmation: не співпадає з підтвердженням
empty: не може бути порожнім
equal_to: може мати лише значення, рівне %{count}
even: може мати лише непарне значення
exclusion: має зарезервоване значення
greater_than: може мати значення більше %{count}
invalid: має невірне значення
less_than: може мати значення менше чим %{count}
less_than_or_equal_to: може мати значення менше чи рівне %{count}
not_a_number: не являється числом
not_an_integer: не являється цілим числом
odd: може мати лише парне значення
record_invalid: ! 'Виникли помилки: %{errors}'
taken: Вже існує
greater_than_or_equal_to: Може мати значення більше чи рівне %{count}
greater_than: "Повинно бути більше %{count}"
blank: Не може бути відсутнім
inclusion: Має непередбачуване значення
not_a_number: Не являється числом
cannot_change_warehouse: Неможливо змінити склад
invalid_format: Неправильний формат
output_ware_documents_are_present: "присутні підлеглі розхідні документи"
client_card_present: присутня, видалити неможливо
too_long:
few: надто велика довжина (не може бути більше чим %{count} символи)
many: надто велика довжина (не може бути більше чим %{count} символи)
one: надто велика довжина (не може бути більше чим %{count} символ)
other: надто велика довжина (не може бути більше чим %{count} символу)
too_short:
few: нодостатньої довжини (не може бути менше %{count} символів)
many: нодостатньої довжини (не може бути менше %{count} символів)
one: нодостатньої довжини (не може бути менше %{count} символу)
other: нодостатньої довжини (не може бути менше %{count} символів)
wrong_length:
few: невірної довжини (може бути довжиною рівно %{count} символи)
many: невірної довжини (може бути довжиною рівно %{count} символів)
one: невірної довжини (може бути довжиною рівно %{count} символ)
other: невірної довжини (може бути довжиною рівно %{count} символу)
template:
body: 'Виникли наступні проблеми:'
header:
few: '%{model}: збереження не відбулося через %{count} помилок'
many: '%{model}: збереження не відбулося через %{count} помилок'
one: '%{model}: збереження не відбулося через %{count} помилку'
other: '%{model}: збереження не відбулося через %{count} помилок'
date:
abbr_day_names:
- Нд
- Пн
- Вт
- Ср
- Чт
- Пт
- Сб
abbr_month_names:
-
- січня
- лютого
- березня
- квітня
- травня
- червня
- липня
- серпня
- вересня
- жовтня
- листопада
- грудня
day_names:
- неділя
- понеділок
- вівторок
- середа
- четвер
- п'ятница
- субота
formats:
default: ! '%d.%m.%Y'
long: ! '%d %B %Y'
short: ! '%d %b'
month_names:
-
- січня
- лютого
- березня
- квітня
- травня
- червня
- липня
- серпня
- вересня
- жовтня
- листопада
- грудня
order:
- :day
- :month
- :year
datetime:
distance_in_words:
about_x_hours:
few: близько %{count} годин
many: близько %{count} годин
one: близько %{count} години
other: близько %{count} години
about_x_months:
few: близько %{count} місяців
many: близько %{count} місяців
one: близько %{count} місяця
other: близько %{count} місяця
about_x_years:
few: близько %{count} років
many: близько %{count} років
one: близько %{count} року
other: близько %{count} років
almost_x_years:
one: майже 1 рік
few: майже %{count} року
many: майже %{count} років
other: майже %{count} років
half_a_minute: менше хвилини
less_than_x_minutes:
few: менше %{count} хвилин
many: менше %{count} хвилин
one: менше %{count} хвилини
other: менше %{count} хвилини
less_than_x_seconds:
few: менше %{count} секунд
many: менше %{count} секунд
one: менше %{count} секунди
other: менше %{count} секунди
over_x_years:
few: більше %{count} років
many: більше %{count} років
one: більше %{count} року
other: більше %{count} років
x_days:
few: ! '%{count} дня'
many: ! '%{count} днів'
one: ! '%{count} день'
other: ! '%{count} дня'
x_minutes:
few: ! '%{count} хвилини'
many: ! '%{count} хвилин'
one: ! '%{count} хвилину'
other: ! '%{count} хвилини'
x_months:
few: ! '%{count} місяця'
many: ! '%{count} місяців'
one: ! '%{count} місяц'
other: ! '%{count} місяця'
x_seconds:
few: ! '%{count} секунди'
many: ! '%{count} секунд'
one: ! '%{count} секунда'
other: ! '%{count} секунди'
prompts:
day: День
hour: Годин
minute: Хвилин
month: Місяць
second: Секунд
year: Ріків
number:
currency:
format:
delimiter: ' '
format: '%n %u'
precision: 2
separator: ','
significant: false
strip_insignificant_zeros: false
unit: грн.
format:
delimiter: ' '
precision: 3
separator: ','
significant: false
strip_insignificant_zeros: false
human:
decimal_units:
format: '%n %u'
units:
billion:
few: мільярдів
many: мільярдів
one: мільярдів
other: мільярдів
million:
few: мільйонів
many: мільйонів
one: мільйон
other: мільйонів
quadrillion:
few: квадрільйонів
many: квадрільйонів
one: квадрільйон
other: квадрільйонів
thousand:
few: тисяч
many: тисяч
one: тисяча
other: тисяч
trillion:
few: трильйонів
many: трильйонів
one: трильйон
other: трильйонів
unit: ''
format:
delimiter: ''
precision: 1
significant: false
strip_insignificant_zeros: false
storage_units:
format: '%n %u'
units:
byte:
few: байту
many: байт
one: байт
other: байту
gb: ГБ
kb: КБ
mb: МБ
tb: ТБ
percentage:
format:
delimiter: ''
precision:
format:
delimiter: ''
support:
array:
last_word_connector: ' і '
two_words_connector: ' і '
words_connector: ', '
time:
formats:
default: '%a, %d %b %Y, %H:%M:%S %z'
long: ! '%d %B %Y'
short: '%d %b, %H:%M'
pm: вечора
am: ранку
blocks:
apply_changes: Застосувати зміни?
locale:
uk: Укр
ru: Рус
en: Eng
de: Ger
info_box:
title: Пластична та естетична хірургія
hospital: Комунальна 8-ма клінічна лікарня
department: Центр Термічної травми та пластичної хірургії
doctor_name: Хаба Тарас Петрович
about_me: Про мене
certificates: Сертифікати
services: Послуги
contacts: Контакти
helpers:
links:
front: "Перегляд сайту"
Rails.application.routes.draw do
scope '(:locale)', {locale: Regexp.new(locales.join '|')} do
devise_for :accounts
scope '/admin' do
mount Ckeditor::Engine => '/ckeditor'
resources :pages
resources :settings, only: [:index, :edit, :update]
controller :accounts do
get 'accounts' => :index, as: 'accounts'
get 'account/:id' => :show, as: 'account'
get 'account/:id/edit' => :edit, as: 'edit_account'
patch 'account/:id' => :update
end
resources :newsletters
controller :newsletters do
get 'newsletters/:id/send' => :sending, as: 'send_newsletter'
get 'newsletters/:id/resend' => :resend, as: 'resend_newsletter'
end
controller :admin do
get '/' => :index, as: :admin_index
end
controller :blocks do
post 'blocks/apply' => :apply
post 'blocks/cancel' => :cancel
patch 'blocks/:id/' => :update, as: :update_block
get 'blocks/:id/edit' => :edit
end
root 'pages#index', as: :admin
end
get '/' => 'front#index'
get 'pages/:id' => 'front#page', as: :front_page
root 'front#index'
end
end
# Be sure to restart your server when you modify this file.
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
# You can use `rake secret` to generate a secure secret key.
# Make sure the secrets in this file are kept private
# if you're sharing your code publicly.
development:
secret_key_base: 131a0967dd145c8199cb4d109570ea8f417d41d9e339cb005a6638535f08e7004cbf1823f03f9b93a14df3dcf67fa84decdea0ada8298226da8e3161b2466979
test:
secret_key_base: 3e8261c71d235168cca1d58f99529b2ec3f4d8ca319de079e9b19749585d7956f406ab5ffc3d1434155861ebcb62540f37eff704e3ebca8862758490630e00b3
# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
class DeviseCreateAccounts < ActiveRecord::Migration
def change
create_table(:accounts) do |t|
## Database authenticatable
t.string :email, null: false, default: ''
t.string :encrypted_password, null: false, default: ''
t.decimal :balance, precision: 8, scale: 2, null:false, default: 0
t.boolean :on_hold, null: false, default: false
t.boolean :subscribed, null: false, default: true
t.string :locale, null: false, default: :en
## Recoverable
t.string :reset_password_token
t.datetime :reset_password_sent_at
## Rememberable
t.datetime :remember_created_at
## Trackable
t.integer :sign_in_count, default: 0, null: false
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.string :current_sign_in_ip
t.string :last_sign_in_ip
## Confirmable
t.string :confirmation_token
t.datetime :confirmed_at
t.datetime :confirmation_sent_at
t.string :unconfirmed_email # Only if using reconfirmable
## Lockable
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
# t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at
t.timestamps null: false
end
add_index :accounts, :email, unique: true
add_index :accounts, :reset_password_token, unique: true
add_index :accounts, :on_hold
add_index :accounts, :subscribed
add_index :accounts, :locale
add_index :accounts, :confirmation_token, unique: true
# add_index :accounts, :unlock_token, unique: true
end
end
class CreateAdministrators < ActiveRecord::Migration
def change
create_table :administrators do |t|
t.integer :account_id, null: false
t.timestamps null: false
end
add_index :administrators, :account_id
end
end
class CreateActiveTranslation < ActiveRecord::Migration
def change
create_table :translations do |t|
t.string :locale, index: true
t.text :text
t.integer :phrase_id, index: true
t.timestamps null: false
end
add_index :translations, :text, length: {:text => 255}
create_table :phrases do |t|
t.timestamps null: false
end
create_table :phrase_containers do |t|
t.integer :translatable_id
t.string :translatable_type
t.string :attribute_name, index: true
t.integer :phrase_id, index: true
end
add_index :phrase_containers, [:translatable_id, :translatable_type]
end
end
class CreateNewsletters < ActiveRecord::Migration
def change
create_table :newsletters do |t|
t.string :subject
t.text :text
t.integer :last_id
t.integer :processed_id
t.datetime :processed_at
t.text :recipient_filter
t.timestamps null: false
end
end
end
class CreateBlocks < ActiveRecord::Migration
def change
create_table :blocks do |t|
t.string :key
t.integer :block_version_id
t.timestamps
end
add_index :blocks, :key
add_index :blocks, :block_version_id
end
end
class CreateBlockVersions < ActiveRecord::Migration
def change
create_table :block_versions do |t|
t.integer :account_id
t.boolean :active
t.timestamps
end
add_index :block_versions, :active
add_index :block_versions, :account_id
end
end
class CreatePages < ActiveRecord::Migration
def change
create_table :pages do |t|
# t.string :title
t.string :mode
t.string :link
# t.text :body
t.string :url_id
t.integer :position
t.boolean :enabled
t.text :keywords
# t.text :description
t.timestamps null: false
end
add_index :pages, :position
add_index :pages, :url_id
end
end
class CreateSettings < ActiveRecord::Migration
def change
create_table :settings do |t|
t.string :name
t.text :value
t.timestamps null: false
end
add_index :settings, :name, unique: true
end
end
class CreateCkeditorAssets < ActiveRecord::Migration
def self.up
create_table :ckeditor_assets do |t|
t.string :data_file_name, :null => false
t.string :data_content_type
t.integer :data_file_size
t.integer :assetable_id
t.string :assetable_type, :limit => 30
t.string :type, :limit => 30
# Uncomment it to save images dimensions, if your need it
t.integer :width
t.integer :height
t.timestamps null: false
end
add_index "ckeditor_assets", ["assetable_type", "type", "assetable_id"], :name => "idx_ckeditor_assetable_type"
add_index "ckeditor_assets", ["assetable_type", "assetable_id"], :name => "idx_ckeditor_assetable"
end
def self.down
drop_table :ckeditor_assets
end
end
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20160302111301) do
create_table "accounts", force: :cascade do |t|
t.string "email", limit: 255, default: "", null: false
t.string "encrypted_password", limit: 255, default: "", null: false
t.decimal "balance", precision: 8, scale: 2, default: 0.0, null: false
t.boolean "on_hold", default: false, null: false
t.boolean "subscribed", default: true, null: false
t.string "locale", limit: 255, default: "en", null: false
t.string "reset_password_token", limit: 255
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", limit: 4, default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip", limit: 255
t.string "last_sign_in_ip", limit: 255
t.string "confirmation_token", limit: 255
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.string "unconfirmed_email", limit: 255
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "accounts", ["confirmation_token"], name: "index_accounts_on_confirmation_token", unique: true, using: :btree
add_index "accounts", ["email"], name: "index_accounts_on_email", unique: true, using: :btree
add_index "accounts", ["locale"], name: "index_accounts_on_locale", using: :btree
add_index "accounts", ["on_hold"], name: "index_accounts_on_on_hold", using: :btree
add_index "accounts", ["reset_password_token"], name: "index_accounts_on_reset_password_token", unique: true, using: :btree
add_index "accounts", ["subscribed"], name: "index_accounts_on_subscribed", using: :btree
create_table "administrators", force: :cascade do |t|
t.integer "account_id", limit: 4, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "administrators", ["account_id"], name: "index_administrators_on_account_id", using: :btree
create_table "block_versions", force: :cascade do |t|
t.integer "account_id", limit: 4
t.boolean "active"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "block_versions", ["account_id"], name: "index_block_versions_on_account_id", using: :btree
add_index "block_versions", ["active"], name: "index_block_versions_on_active", using: :btree
create_table "blocks", force: :cascade do |t|
t.string "key", limit: 255
t.integer "block_version_id", limit: 4
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "blocks", ["block_version_id"], name: "index_blocks_on_block_version_id", using: :btree
add_index "blocks", ["key"], name: "index_blocks_on_key", using: :btree
create_table "ckeditor_assets", force: :cascade do |t|
t.string "data_file_name", limit: 255, null: false
t.string "data_content_type", limit: 255
t.integer "data_file_size", limit: 4
t.integer "assetable_id", limit: 4
t.string "assetable_type", limit: 30
t.string "type", limit: 30
t.integer "width", limit: 4
t.integer "height", limit: 4
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "ckeditor_assets", ["assetable_type", "assetable_id"], name: "idx_ckeditor_assetable", using: :btree
add_index "ckeditor_assets", ["assetable_type", "type", "assetable_id"], name: "idx_ckeditor_assetable_type", using: :btree
create_table "newsletters", force: :cascade do |t|
t.string "subject", limit: 255
t.text "text", limit: 65535
t.integer "last_id", limit: 4
t.integer "processed_id", limit: 4
t.datetime "processed_at"
t.text "recipient_filter", limit: 65535
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "pages", force: :cascade do |t|
t.string "mode", limit: 255
t.string "link", limit: 255
t.string "url_id", limit: 255
t.integer "position", limit: 4
t.boolean "enabled"
t.text "keywords", limit: 65535
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "pages", ["position"], name: "index_pages_on_position", using: :btree
add_index "pages", ["url_id"], name: "index_pages_on_url_id", using: :btree
create_table "phrase_containers", force: :cascade do |t|
t.integer "translatable_id", limit: 4
t.string "translatable_type", limit: 255
t.string "attribute_name", limit: 255
t.integer "phrase_id", limit: 4
end
add_index "phrase_containers", ["attribute_name"], name: "index_phrase_containers_on_attribute_name", using: :btree
add_index "phrase_containers", ["phrase_id"], name: "index_phrase_containers_on_phrase_id", using: :btree
add_index "phrase_containers", ["translatable_id", "translatable_type"], name: "index_phrase_containers_on_translatable_id_and_translatable_type", using: :btree
create_table "phrases", force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "settings", force: :cascade do |t|
t.string "name", limit: 255
t.text "value", limit: 65535
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "settings", ["name"], name: "index_settings_on_name", unique: true, using: :btree
create_table "translations", force: :cascade do |t|
t.string "locale", limit: 255
t.text "text", limit: 65535
t.integer "phrase_id", limit: 4
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "translations", ["locale"], name: "index_translations_on_locale", using: :btree
add_index "translations", ["phrase_id"], name: "index_translations_on_phrase_id", using: :btree
add_index "translations", ["text"], name: "index_translations_on_text", length: {"text"=>255}, using: :btree
end
def get_image(name)
File.open(File.join(Rails.root, "/db/image_seeds/#{name}"))
end
Account.delete_all
admin = Account.create(email: 'admin@example.com', password: 'asdasdasd', password_confirmation: 'asdasdasd')
Administrator.delete_all
Administrator.create account: admin
Page.delete_all
Page.create title: 'Home', mode: :path, position: 1, enabled: true, link: 'main'
Page.create title: 'About', mode: :anchor, position: 2, enabled: true, url_id: 'about', body: %{
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus lobortis elit nec efficitur dictum. Maecenas at
varius neque, non semper turpis. Cras rutrum eget ante eu iaculis. Nulla pulvinar ut eros eget lobortis. Suspendisse
ac rutrum lorem. Sed interdum diam non eros placerat rhoncus. Nullam dui sapien, mattis vitae venenatis at, tempor sit
amet turpis. Aliquam eu odio vel ante dignissim rutrum ac eu massa. Fusce tincidunt ipsum eget dolor fermentum sodales.
Nam vehicula ligula quis mollis laoreet.</p>
<p>Curabitur ac luctus urna. Donec id enim et mauris rutrum interdum. Sed interdum aliquet mauris ac auctor. Praesent
vel commodo nulla. In hac habitasse platea dictumst. Quisque eu ligula est. Sed bibendum turpis eget felis condimentum,
finibus ullamcorper lorem laoreet. Morbi venenatis leo nec aliquam tincidunt. In commodo mollis magna. Donec sagittis
molestie nunc a efficitur.</p>
<p>Aenean quis consequat ex. Donec et volutpat arcu. Mauris congue purus et nibh hendrerit scelerisque. Curabitur a
laoreet augue. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas quis
viverra risus, ac scelerisque neque. Aenean ex leo, vulputate et magna et, bibendum auctor risus. Mauris in pulvinar
lacus. Curabitur eget dolor malesuada, tincidunt ipsum ut, vulputate risus. Aliquam nec magna nec orci finibus posuere
non a arcu. Vestibulum eget cursus velit. Proin arcu dui, rutrum quis blandit nec, vehicula sit amet est. Proin nec
nisl rhoncus, molestie ex vel, fringilla felis. Praesent feugiat tempus mi, at vulputate justo pharetra non.</p>
<p>Praesent sem felis, ultricies non scelerisque ac, tempor eget nunc. In imperdiet feugiat leo, ac posuere dolor
pharetra nec. Cras porta justo quis ex mollis tempor eget eu nunc. Vivamus ullamcorper lacus et volutpat molestie.
Nulla feugiat purus vitae euismod facilisis. Aenean ut tortor turpis. Interdum et malesuada fames ac ante ipsum primis
in faucibus.</p>
<p>Ut tortor urna, sodales sed vehicula quis, tempor vel dui. Nam pulvinar aliquet diam, a malesuada enim mattis in.
Nullam sapien magna, consequat ac lacus ac, ultricies sollicitudin ligula. Etiam laoreet vulputate nunc ut pharetra.
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In commodo mattis tellus,
in gravida ligula tempor eu. Sed et urna quis mi pharetra luctus ut id enim. Vivamus vitae nulla eros. In vestibulum
mattis elementum. </p>}
Page.create title: 'Information', mode: :anchor, position: 3, enabled: true, url_id: 'info', body: %{
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus lobortis elit nec efficitur dictum. Maecenas at
varius neque, non semper turpis. Cras rutrum eget ante eu iaculis. Nulla pulvinar ut eros eget lobortis. Suspendisse
ac rutrum lorem. Sed interdum diam non eros placerat rhoncus. Nullam dui sapien, mattis vitae venenatis at, tempor sit
amet turpis. Aliquam eu odio vel ante dignissim rutrum ac eu massa. Fusce tincidunt ipsum eget dolor fermentum sodales.
Nam vehicula ligula quis mollis laoreet.</p>
<p>Curabitur ac luctus urna. Donec id enim et mauris rutrum interdum. Sed interdum aliquet mauris ac auctor. Praesent
vel commodo nulla. In hac habitasse platea dictumst. Quisque eu ligula est. Sed bibendum turpis eget felis condimentum,
finibus ullamcorper lorem laoreet. Morbi venenatis leo nec aliquam tincidunt. In commodo mollis magna. Donec sagittis
molestie nunc a efficitur.</p>
<p>Aenean quis consequat ex. Donec et volutpat arcu. Mauris congue purus et nibh hendrerit scelerisque. Curabitur a
laoreet augue. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas quis
viverra risus, ac scelerisque neque. Aenean ex leo, vulputate et magna et, bibendum auctor risus. Mauris in pulvinar
lacus. Curabitur eget dolor malesuada, tincidunt ipsum ut, vulputate risus. Aliquam nec magna nec orci finibus posuere
non a arcu. Vestibulum eget cursus velit. Proin arcu dui, rutrum quis blandit nec, vehicula sit amet est. Proin nec
nisl rhoncus, molestie ex vel, fringilla felis. Praesent feugiat tempus mi, at vulputate justo pharetra non.</p>
<p>Praesent sem felis, ultricies non scelerisque ac, tempor eget nunc. In imperdiet feugiat leo, ac posuere dolor
pharetra nec. Cras porta justo quis ex mollis tempor eget eu nunc. Vivamus ullamcorper lacus et volutpat molestie.
Nulla feugiat purus vitae euismod facilisis. Aenean ut tortor turpis. Interdum et malesuada fames ac ante ipsum primis
in faucibus.</p>
<p>Ut tortor urna, sodales sed vehicula quis, tempor vel dui. Nam pulvinar aliquet diam, a malesuada enim mattis in.
Nullam sapien magna, consequat ac lacus ac, ultricies sollicitudin ligula. Etiam laoreet vulputate nunc ut pharetra.
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In commodo mattis tellus,
in gravida ligula tempor eu. Sed et urna quis mi pharetra luctus ut id enim. Vivamus vitae nulla eros. In vestibulum
mattis elementum. </p>}
Page.create title: 'Privacy Policy', mode: :anchor, position: 4, enabled: true, url_id: 'privacy', body: %{
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus lobortis elit nec efficitur dictum. Maecenas at
varius neque, non semper turpis. Cras rutrum eget ante eu iaculis. Nulla pulvinar ut eros eget lobortis. Suspendisse
ac rutrum lorem. Sed interdum diam non eros placerat rhoncus. Nullam dui sapien, mattis vitae venenatis at, tempor sit
amet turpis. Aliquam eu odio vel ante dignissim rutrum ac eu massa. Fusce tincidunt ipsum eget dolor fermentum sodales.
Nam vehicula ligula quis mollis laoreet.</p>
<p>Curabitur ac luctus urna. Donec id enim et mauris rutrum interdum. Sed interdum aliquet mauris ac auctor. Praesent
vel commodo nulla. In hac habitasse platea dictumst. Quisque eu ligula est. Sed bibendum turpis eget felis condimentum,
finibus ullamcorper lorem laoreet. Morbi venenatis leo nec aliquam tincidunt. In commodo mollis magna. Donec sagittis
molestie nunc a efficitur.</p>
<p>Aenean quis consequat ex. Donec et volutpat arcu. Mauris congue purus et nibh hendrerit scelerisque. Curabitur a
laoreet augue. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas quis
viverra risus, ac scelerisque neque. Aenean ex leo, vulputate et magna et, bibendum auctor risus. Mauris in pulvinar
lacus. Curabitur eget dolor malesuada, tincidunt ipsum ut, vulputate risus. Aliquam nec magna nec orci finibus posuere
non a arcu. Vestibulum eget cursus velit. Proin arcu dui, rutrum quis blandit nec, vehicula sit amet est. Proin nec
nisl rhoncus, molestie ex vel, fringilla felis. Praesent feugiat tempus mi, at vulputate justo pharetra non.</p>
<p>Praesent sem felis, ultricies non scelerisque ac, tempor eget nunc. In imperdiet feugiat leo, ac posuere dolor
pharetra nec. Cras porta justo quis ex mollis tempor eget eu nunc. Vivamus ullamcorper lacus et volutpat molestie.
Nulla feugiat purus vitae euismod facilisis. Aenean ut tortor turpis. Interdum et malesuada fames ac ante ipsum primis
in faucibus.</p>
<p>Ut tortor urna, sodales sed vehicula quis, tempor vel dui. Nam pulvinar aliquet diam, a malesuada enim mattis in.
Nullam sapien magna, consequat ac lacus ac, ultricies sollicitudin ligula. Etiam laoreet vulputate nunc ut pharetra.
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In commodo mattis tellus,
in gravida ligula tempor eu. Sed et urna quis mi pharetra luctus ut id enim. Vivamus vitae nulla eros. In vestibulum
mattis elementum. </p>}
Page.create title: 'Contacts', mode: :anchor, position: 5, enabled: true, url_id: 'contacts', body: %{
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus lobortis elit nec efficitur dictum. Maecenas at
varius neque, non semper turpis. Cras rutrum eget ante eu iaculis. Nulla pulvinar ut eros eget lobortis. Suspendisse
ac rutrum lorem. Sed interdum diam non eros placerat rhoncus. Nullam dui sapien, mattis vitae venenatis at, tempor sit
amet turpis. Aliquam eu odio vel ante dignissim rutrum ac eu massa. Fusce tincidunt ipsum eget dolor fermentum sodales.
Nam vehicula ligula quis mollis laoreet.</p>
<p>Curabitur ac luctus urna. Donec id enim et mauris rutrum interdum. Sed interdum aliquet mauris ac auctor. Praesent
vel commodo nulla. In hac habitasse platea dictumst. Quisque eu ligula est. Sed bibendum turpis eget felis condimentum,
finibus ullamcorper lorem laoreet. Morbi venenatis leo nec aliquam tincidunt. In commodo mollis magna. Donec sagittis
molestie nunc a efficitur.</p>
<p>Aenean quis consequat ex. Donec et volutpat arcu. Mauris congue purus et nibh hendrerit scelerisque. Curabitur a
laoreet augue. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas quis
viverra risus, ac scelerisque neque. Aenean ex leo, vulputate et magna et, bibendum auctor risus. Mauris in pulvinar
lacus. Curabitur eget dolor malesuada, tincidunt ipsum ut, vulputate risus. Aliquam nec magna nec orci finibus posuere
non a arcu. Vestibulum eget cursus velit. Proin arcu dui, rutrum quis blandit nec, vehicula sit amet est. Proin nec
nisl rhoncus, molestie ex vel, fringilla felis. Praesent feugiat tempus mi, at vulputate justo pharetra non.</p>
<p>Praesent sem felis, ultricies non scelerisque ac, tempor eget nunc. In imperdiet feugiat leo, ac posuere dolor
pharetra nec. Cras porta justo quis ex mollis tempor eget eu nunc. Vivamus ullamcorper lacus et volutpat molestie.
Nulla feugiat purus vitae euismod facilisis. Aenean ut tortor turpis. Interdum et malesuada fames ac ante ipsum primis
in faucibus.</p>
<p>Ut tortor urna, sodales sed vehicula quis, tempor vel dui. Nam pulvinar aliquet diam, a malesuada enim mattis in.
Nullam sapien magna, consequat ac lacus ac, ultricies sollicitudin ligula. Etiam laoreet vulputate nunc ut pharetra.
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In commodo mattis tellus,
in gravida ligula tempor eu. Sed et urna quis mi pharetra luctus ut id enim. Vivamus vitae nulla eros. In vestibulum
mattis elementum. </p>}
Page.create title: 'Page', mode: :page, position: 6, enabled: true, url_id: 'page', body: %{
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus lobortis elit nec efficitur dictum. Maecenas at
varius neque, non semper turpis. Cras rutrum eget ante eu iaculis. Nulla pulvinar ut eros eget lobortis. Suspendisse
ac rutrum lorem. Sed interdum diam non eros placerat rhoncus. Nullam dui sapien, mattis vitae venenatis at, tempor sit
amet turpis. Aliquam eu odio vel ante dignissim rutrum ac eu massa. Fusce tincidunt ipsum eget dolor fermentum sodales.
Nam vehicula ligula quis mollis laoreet.</p>
<p>Curabitur ac luctus urna. Donec id enim et mauris rutrum interdum. Sed interdum aliquet mauris ac auctor. Praesent
vel commodo nulla. In hac habitasse platea dictumst. Quisque eu ligula est. Sed bibendum turpis eget felis condimentum,
finibus ullamcorper lorem laoreet. Morbi venenatis leo nec aliquam tincidunt. In commodo mollis magna. Donec sagittis
molestie nunc a efficitur.</p>
<p>Aenean quis consequat ex. Donec et volutpat arcu. Mauris congue purus et nibh hendrerit scelerisque. Curabitur a
laoreet augue. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas quis
viverra risus, ac scelerisque neque. Aenean ex leo, vulputate et magna et, bibendum auctor risus. Mauris in pulvinar
lacus. Curabitur eget dolor malesuada, tincidunt ipsum ut, vulputate risus. Aliquam nec magna nec orci finibus posuere
non a arcu. Vestibulum eget cursus velit. Proin arcu dui, rutrum quis blandit nec, vehicula sit amet est. Proin nec
nisl rhoncus, molestie ex vel, fringilla felis. Praesent feugiat tempus mi, at vulputate justo pharetra non.</p>
<p>Praesent sem felis, ultricies non scelerisque ac, tempor eget nunc. In imperdiet feugiat leo, ac posuere dolor
pharetra nec. Cras porta justo quis ex mollis tempor eget eu nunc. Vivamus ullamcorper lacus et volutpat molestie.
Nulla feugiat purus vitae euismod facilisis. Aenean ut tortor turpis. Interdum et malesuada fames ac ante ipsum primis
in faucibus.</p>
<p>Ut tortor urna, sodales sed vehicula quis, tempor vel dui. Nam pulvinar aliquet diam, a malesuada enim mattis in.
Nullam sapien magna, consequat ac lacus ac, ultricies sollicitudin ligula. Etiam laoreet vulputate nunc ut pharetra.
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In commodo mattis tellus,
in gravida ligula tempor eu. Sed et urna quis mi pharetra luctus ut id enim. Vivamus vitae nulla eros. In vestibulum
mattis elementum. </p>}
Page.create title: 'SP Studio', mode: 'link', position: 7, enabled: true, url_id: 'sps',
link: 'http://studio.sp-service.com.ua'
Setting.delete_all
module ActiveTranslation
extend ActiveSupport::Concern
module QueryMethods
class WhereChain < ::ActiveRecord::QueryMethods::WhereChain
def not(opts, *rest)
if parsed = @scope.clone.parse_translated_conditions(opts)
@scope.join_translations.where.not(parsed, *rest)
else
super
end
end
end
def count(*args)
if (select_values.present?)
spawn.except(:select).count(*args)
else
super(*args)
end
end
def where(opts = :chain, *rest)
if opts == :chain
WhereChain.new(spawn)
elsif parsed = parse_translated_conditions(opts)
join_translations(super(parsed, *rest))
else
super
end
end
def exists?(conditions = :none)
if parsed = parse_translated_conditions(conditions)
with_translation.exists?(parsed)
else
super
end
end
def parse_translated_conditions(opts)
if opts.is_a?(Hash) && respond_to?(:translated_attribute_names) && (keys = opts.symbolize_keys.keys & translated_attribute_names).present?
opts = opts.dup
keys.each { |key| opts[translated_column_name(key)] = opts.delete(key) || opts.delete(key.to_s) }
opts
end
end
def join_translations(relation = self)
relation.with_translation
end
end
module ClassMethods
def init_translated_attributes
return if defined? translated_attribute_names
class_attribute :translated_attribute_names
self.translated_attribute_names = []
end
def translated_column_name(name)
"#{name}_translations.text"
end
def with_translated_attribute(name, value, locales = nil)
#locales ||= [:uk]
#with_translation.where(
# translated_column_name(name) => value,
# translated_column_name(:locale) => Array(locales).map(&:to_s)
#)
with_translation.where(translated_column_name(name) => value)
end
def with_translation
with_this_translation(I18n.locale)
end
def attr_translatable!(*attr_names)
@presence = true
attr_translatable(*attr_names)
end
def attr_translatable(*attr_names)
init_translated_attributes
attr_names-= translated_attribute_names
if attr_names.present?
# self.instance_eval %{attr_accessible :#{attr_names.join(', :')}}
attr_names.each do |attr_name|
build_attribute_extras(attr_name)
create_attr_accessor(attr_name)
validate_attr(attr_name) if @presence
translated_attribute_names << attr_name
after_save do
phrase_container = send("#{attr_name}_phrase_container")
if phrase_container
if phrase_container.changed?
phrase_container.save
else
phrase_container.phrase.save if phrase_container.phrase
end
end
end
end
rebuild_translations_scope()
end
@presence = false
end
private
# Override the default relation method in order to return a subclass
# of ActiveRecord::Relation with custom finder methods for translated
# attributes.
def relation
super.extending!(QueryMethods)
end
def build_attribute_extras(attr_name)
phrase_container_name = "#{attr_name}_phrase_container"
phrase_name = "#{attr_name}_phrase"
translations_name = "#{attr_name}_translations"
has_one phrase_container_name.to_sym, -> { where attribute_name: attr_name }, as: :translatable,
class_name: 'PhraseContainer', dependent: :destroy
has_one phrase_name.to_sym, class_name: 'Phrase', through: phrase_container_name.to_sym, source: :phrase
has_many translations_name.to_sym, class_name: 'Translation', through: phrase_name.to_sym, source: :translations
(@translations_columns ||= []) << "#{translations_name}.text as #{attr_name}, #{translations_name}.locale as #{attr_name}_locale"
(@join_expressions ||= []) << %{
left join phrase_containers #{phrase_container_name} on
#{phrase_container_name}.translatable_id=#{table_name}.id
and #{phrase_container_name}.translatable_type='#{model_name}'
and #{phrase_container_name}.attribute_name='#{attr_name}'
left join phrases #{phrase_name} on #{phrase_name}.id=#{phrase_container_name}.phrase_id
left join translations #{translations_name} on #{translations_name}.phrase_id=#{phrase_name}.id
}.delete("\n").squeeze(' ')
end
def rebuild_translations_scope
scope :with_translations, -> { joins(@join_expressions.join(' ')).select("#{table_name}.*, #{@translations_columns.join(',')}") }
scope :with_this_translation, ->(locale) {
expressions = @join_expressions.map do |expression|
"#{expression} and #{expression.scan(/on\s+(\w+)\./).last.first}.locale='#{locale}'"
end
joins(expressions.join(' ')).select("#{table_name}.*, #{@translations_columns.join(',')}")
}
end
def create_attr_accessor(attr_name)
phrase_container_name = "#{attr_name}_phrase_container".to_sym
define_method(:"#{attr_name}=") do |value|
@locale ||= I18n.locale.to_s
container = self.send(phrase_container_name)
if container.nil?
if new_record?
self.send("build_#{phrase_container_name}".to_sym, locale: @locale, text: value)
else
self.send("create_#{phrase_container_name}".to_sym, locale: @locale, text: value)
end
else
container.locale, container.text = @locale, value
end
self.updated_at = current_time_from_proper_timezone
@locale = nil
end
define_method(attr_name) do |*args|
value = nil
phrase_container = send(phrase_container_name)
if phrase_container
params = args && (args[0].is_a? Hash) ? args[0] : {}
params[:locale] = @locale if @locale
value = phrase_container.text(params)
end
@locale = nil
value
end
alias_method :"#{attr_name}_before_type_cast", attr_name
end
def validate_attr(attr_name)
validate do
attr = send attr_name
if attr.nil? or attr.empty?
error_text = I18n.t('activerecord.errors.messages.blank')
errors.add attr_name, error_text
I18n.available_locales.each {|l| errors.add "#{attr_name}_#{l}", error_text}
end
end
end
end
def reload
super
end
def method_missing(m, *args, &block)
match_data = m.to_s.match /^(\w+)_(\w\w\w?)(=?)$/
if match_data
@locale = match_data[2]
send(match_data[1]+match_data[3], args[0])
else
super
end
end
def attributes
if defined? translated_attribute_names
translated_attributes = translated_attribute_names.inject({}) do |translated_attributes, attr_name|
translated_attributes.merge(attr_name.to_s => send(attr_name))
end
super.merge(translated_attributes)
else
super
end
end
end
ActiveRecord::Base.include(ActiveTranslation)
= form_for @<%= resource_name %>, html: { class: "form form-horizontal <%= resource_name %>" } do |f|
<%- columns.each do |column| -%>
.form-group
= f.label :<%= column.name.scan(/_id$/).present? && ActiveRecord::Base.connection.column_exists?(column.name.gsub(/_id$/, '').tableize, :id) ? column.name.gsub(/_id$/, '') : column.name %>, class: 'control-label col-lg-2'
.col-lg-10
= f.<%= column.field_type %> :<%= column.name %>, class: 'form-control', required: true
= f.error_span(:<%= column.name %>)
<%- end -%>
.form-group
.col-lg-offset-2.col-lg-10
= f.submit nil, class: 'btn btn-primary'
= link_to t('helpers.links.cancel'), <%= controller_routing_path %>_path, class: 'btn btn-default'
- model_class = <%= resource_name.classify %>
.page-header
%h1=t 'helpers.titles.edit', :model => model_class.model_name.human
= render :partial => 'form'
- model_class = <%= resource_name.classify %>
.page-header
%h1=t model_class.model_name.human(count: 2)
%table.table.table-striped
%thead
%tr
<%- unless ActiveRecord::Base.connection.column_exists?(resource_name.tableize, :name) -%>
%th= model_class.human_attribute_name(:id)
<%- end -%>
<%- columns.each do |column| -%>
%th= model_class.human_attribute_name(:<%= column.name.scan(/_id$/).present? && ActiveRecord::Base.connection.column_exists?(column.name.gsub(/_id$/, '').tableize, :id) ? column.name.gsub(/_id$/, '') : column.name %>)
<%- end -%>
%th= model_class.human_attribute_name(:created_at)
%th=t 'helpers.actions'
%tbody
- @<%= plural_resource_name %>.each do |<%= resource_name %>|
%tr
<%- unless ActiveRecord::Base.connection.column_exists?(resource_name.tableize, :name) -%>
%td= link_to <%= resource_name %>.id, <%= singular_controller_routing_path %>_path(<%= resource_name %>)
<%- end -%>
<%- columns.each do |column| -%>
<%- if column.name == 'name' -%>
%td= link_to <%= resource_name %>.<%= column.name %>, <%= singular_controller_routing_path %>_path(<%= resource_name %>)
<%- elsif column.name.scan(/_id$/).present? && ActiveRecord::Base.connection.column_exists?(column.name.gsub(/_id$/, '').tableize, :id) -%>
%td= link_to <%= resource_name %>.<%= column.name.gsub /_id$/, '' %>.<%= ActiveRecord::Base.connection.column_exists?(column.name.gsub(/_id$/, '').tableize, :name) ? 'name' : 'id' %>, <%= resource_name %>.<%= column.name.gsub /_id$/, '' %> if <%= resource_name %>.<%= column.name.gsub /_id$/, '' %>.present?
<%- else -%>
%td= <%= resource_name %>.<%= column.name %>
<%- end -%>
<%- end -%>
%td=localize_datetime <%= resource_name %>.created_at
%td.actions
= link_to edit_<%= singular_controller_routing_path %>_path(<%= resource_name %>), title: t('helpers.links.edit'), class: 'btn btn-default btn-xs' do
%i.fa.fa-edit
= link_to <%= singular_controller_routing_path %>_path(<%= resource_name %>), method: :delete, data: {confirm: t('helpers.links.confirm')}, title: t('helpers.links.destroy'),
class: 'btn btn-xs btn-danger' do
%i.fa.fa-trash
= link_to t('helpers.links.new'), new_<%= singular_controller_routing_path %>_path, class: 'btn btn-primary'
- model_class = <%= resource_name.classify %>
.page-header
%h1=t 'helpers.titles.new', :model => model_class.model_name.human
= render :partial => 'form'
- model_class = <%= resource_name.classify %>
.page-header
%h1= model_class.model_name.human.titleize
<%- columns.each do |column| -%>
%p
%strong= model_class.human_attribute_name(:<%= column.name.scan(/_id$/).present? && ActiveRecord::Base.connection.column_exists?(column.name.gsub(/_id$/, '').tableize, :id) ? column.name.gsub(/_id$/, '') : column.name %>) + ':'
<%- if column.type == 'text' -%>
%br
<%- end -%>
<%- if column.name.scan(/_id$/).present? && ActiveRecord::Base.connection.column_exists?(column.name.gsub(/_id$/, '').tableize, :id) -%>
= link_to @<%= resource_name %>.<%= column.name.gsub /_id$/, '' %>.<%= ActiveRecord::Base.connection.column_exists?(column.name.gsub(/_id$/, '').tableize, :name) ? 'name' : 'id' %>, @<%= resource_name %>.<%= column.name.gsub /_id$/, '' %> if @<%= resource_name %>.<%= column.name.gsub /_id$/, '' %>.present?
<%- else -%>
= @<%= resource_name %>.<%= column.name %>
<%- end -%>
<%- end -%>
= link_to t('helpers.links.back'), <%= controller_routing_path %>_path, class: 'btn btn-default'
= link_to t('helpers.links.edit'), edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), class: 'btn btn-default'
= link_to t('helpers.links.destroy'), <%= singular_controller_routing_path %>_path(@<%= resource_name %>), method: :delete, data: { confirm: t('helpers.links.confirm') }, class: 'btn btn-danger'
= simple_form_for @<%= resource_name %>, html: { class: 'form-horizontal' } do |f|
<%- columns.each do |column| -%>
<%- if column.name.scan(/_id$/).present? && ActiveRecord::Base.connection.column_exists?(column.name.gsub(/_id$/, '').tableize, :id) -%>
= f.association :<%= column.name.gsub /_id$/, '' %>
<%- else -%>
= f.input :<%= column.name %>
<%- end -%>
<%- end -%>
<%- if ::SimpleForm::FormBuilder.instance_methods.include?(:wrapped_button) -%>
= f.button :wrapped, cancel: <%= controller_routing_path %>_path
<%- else -%>
= f.button :submit, class: 'btn-primary'
= link_to t('helpers.links.cancel'), <%= controller_routing_path %>_path, class: 'btn btn-default'
<%- end -%>
= simple_form_for(@<%= singular_table_name %>) do |f|
= f.error_notification
.form-inputs
<%- attributes.each do |attribute| -%>
= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %>
<%- end -%>
.form-actions
= f.button :submit
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
<!DOCTYPE html>
<html>
<head>
<title>The page you were looking for doesn't exist (404)</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style>
body {
background-color: #EFEFEF;
color: #2E2F30;
text-align: center;
font-family: arial, sans-serif;
margin: 0;
}
div.dialog {
width: 95%;
max-width: 33em;
margin: 4em auto 0;
}
div.dialog > div {
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #BBB;
border-top: #B00100 solid 4px;
border-top-left-radius: 9px;
border-top-right-radius: 9px;
background-color: white;
padding: 7px 12% 0;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
h1 {
font-size: 100%;
color: #730E15;
line-height: 1.5em;
}
div.dialog > p {
margin: 0 0 1em;
padding: 1em;
background-color: #F7F7F7;
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #999;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-top-color: #DADADA;
color: #666;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
</style>
</head>
<body>
<!-- This file lives in public/404.html -->
<div class="dialog">
<div>
<h1>The page you were looking for doesn't exist.</h1>
<p>You may have mistyped the address or the page may have moved.</p>
</div>
<p>If you are the application owner check the logs for more information.</p>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>The change you wanted was rejected (422)</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style>
body {
background-color: #EFEFEF;
color: #2E2F30;
text-align: center;
font-family: arial, sans-serif;
margin: 0;
}
div.dialog {
width: 95%;
max-width: 33em;
margin: 4em auto 0;
}
div.dialog > div {
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #BBB;
border-top: #B00100 solid 4px;
border-top-left-radius: 9px;
border-top-right-radius: 9px;
background-color: white;
padding: 7px 12% 0;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
h1 {
font-size: 100%;
color: #730E15;
line-height: 1.5em;
}
div.dialog > p {
margin: 0 0 1em;
padding: 1em;
background-color: #F7F7F7;
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #999;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-top-color: #DADADA;
color: #666;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
</style>
</head>
<body>
<!-- This file lives in public/422.html -->
<div class="dialog">
<div>
<h1>The change you wanted was rejected.</h1>
<p>Maybe you tried to change something you didn't have access to.</p>
</div>
<p>If you are the application owner check the logs for more information.</p>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>We're sorry, but something went wrong (500)</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style>
body {
background-color: #EFEFEF;
color: #2E2F30;
text-align: center;
font-family: arial, sans-serif;
margin: 0;
}
div.dialog {
width: 95%;
max-width: 33em;
margin: 4em auto 0;
}
div.dialog > div {
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #BBB;
border-top: #B00100 solid 4px;
border-top-left-radius: 9px;
border-top-right-radius: 9px;
background-color: white;
padding: 7px 12% 0;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
h1 {
font-size: 100%;
color: #730E15;
line-height: 1.5em;
}
div.dialog > p {
margin: 0 0 1em;
padding: 1em;
background-color: #F7F7F7;
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #999;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-top-color: #DADADA;
color: #666;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
</style>
</head>
<body>
<!-- This file lives in public/500.html -->
<div class="dialog">
<div>
<h1>We're sorry, but something went wrong.</h1>
</div>
<p>If you are the application owner check the logs for more information.</p>
</div>
</body>
</html>
# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
#
# To ban all spiders from the entire site uncomment the next two lines:
# User-agent: *
# Disallow: /
require 'test_helper'
class AccountsControllerTest < ActionController::TestCase
test 'should get index' do
get :index
assert_response :success
end
test 'should do not get index' do
account = accounts(:two)
assert_nil account.administrator
sign_in account
get :index
assert_redirected_to root_url
end
test 'should get show' do
get :show, id: accounts(:one)
assert_response :success
end
test 'should get edit' do
get :edit, id: accounts(:one)
assert_response :success
end
end
require 'test_helper'
class AdminControllerTest < ActionController::TestCase
test 'should get index' do
get :index
assert_response :success
end
test 'should do not get index' do
account = accounts(:two)
assert_nil account.administrator
sign_in account
get :index
assert_redirected_to root_url
end
end
require 'test_helper'
class FrontControllerTest < ActionController::TestCase
test 'should get index' do
get :index
assert_response :success
end
test 'should get page' do
get :page, id: pages(:one).url_id
assert_response :success
end
end
require 'test_helper'
class PagesControllerTest < ActionController::TestCase
setup do
@page = pages(:one)
end
test 'should get index' do
get :index
assert_response :success
assert_not_nil assigns(:pages)
end
test 'should do not get index' do
account = accounts(:two)
assert_nil account.administrator
sign_in account
get :index
assert_redirected_to root_url
end
test 'should get new' do
get :new
assert_response :success
end
test 'should create page' do
assert_difference('Page.count') do
post :create, page: { body: @page.body, description: @page.description, enabled: @page.enabled,
keywords: @page.keywords, link: @page.link, mode: @page.mode, url_id: 'test',
position: @page.position, title: 'New page' }
end
assert_redirected_to page_path(assigns(:page))
end
test 'should show page' do
get :show, id: @page
assert_response :success
end
test 'should get edit' do
get :edit, id: @page
assert_response :success
end
test 'should update page' do
patch :update, id: @page, page: { body: @page.body, description: @page.description, enabled: @page.enabled,
keywords: @page.keywords, link: @page.link, mode: @page.mode, title: 'Existing page' }
assert_redirected_to page_path(assigns(:page))
end
test 'should destroy page' do
assert_difference('Page.count', -1) do
delete :destroy, id: @page
end
assert_redirected_to pages_path
end
end
require 'test_helper'
class SettingsControllerTest < ActionController::TestCase
setup do
@setting = settings(:one)
end
test 'should get index' do
get :index
assert_response :success
assert_not_nil assigns(:settings)
end
test 'should update setting' do
patch :update, id: @setting, setting: { name: @setting.name, value: @setting.value }
assert_redirected_to settings_path
end
end
one:
email: 'admin@example.com'
on_hold: false
subscribed: true
two:
email: 'two@example.com'
on_hold: false
subscribed: true
three:
email: 'three@example.com'
on_hold: false
subscribed: true
one:
subject: MyString
text: MyText
two:
subject: MyString
text: MyText
one:
mode: page
link: MyString
position: 1
enabled: false
keywords: MyText
url_id: page-1
two:
mode: page
link: MyString
position: 2
enabled: false
keywords: MyText
url_id: page-2
one:
name: setting1
value: value
two:
name: setting2
value: 1
require 'test_helper'
class AccountTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
require 'test_helper'
class AdministratorTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
require 'test_helper'
class NewsletterTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
require 'test_helper'
class PageTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
require 'test_helper'
class SettingTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
# Add more helper methods to be used by all tests here...
end
class ActionController::TestCase
include Devise::TestHelpers
def setup
# @request.env["devise.mapping"] = Devise.mappings[:admin]
sign_in accounts(:one)
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment