Commit c3b6b53d authored by cp's avatar cp

some bugs fixed and many visual improvements added

git-svn-id: http://svn.sp-service.com.ua/svnroot/svn/base_site/trunk@4 d975c5f9-4e99-4c31-b122-d878075b96d9
parent c274e1e0
...@@ -5,4 +5,4 @@ You are allowed to: ...@@ -5,4 +5,4 @@ You are allowed to:
2. Remove generators 2. Remove generators
3. Add installed generators 3. Add installed generators
To add new installed generators automatically delete this file and reload the project. 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> --><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:i18n:locale" /><Generator name="devise:i18n:views" /><Generator name="devise:install" /><Generator name="devise:views" /><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>
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ProjectLevelVcsManager" settingsEditedManually="false"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_3" default="false" project-jdk-name="ruby-2.1.5-p273" project-jdk-type="RUBY_SDK">
<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" /> <output url="file://$PROJECT_DIR$/out" />
</component> </component>
<component name="SvnBranchConfigurationManager"> <component name="SvnBranchConfigurationManager">
<option name="myConfigurationMap">
<map>
<entry key="$PROJECT_DIR$">
<value>
<SvnBranchConfiguration>
<option name="branchUrls">
<list>
<option value="https://svn.sp-service.com.ua/svnroot/svn/base_site/branches" />
<option value="https://svn.sp-service.com.ua/svnroot/svn/base_site/tags" />
</list>
</option>
<option name="trunkUrl" value="https://svn.sp-service.com.ua/svnroot/svn/base_site/trunk" />
</SvnBranchConfiguration>
</value>
</entry>
</map>
</option>
<option name="mySupportsUserInfoFilter" value="true" /> <option name="mySupportsUserInfoFilter" value="true" />
</component> </component>
</project> </project>
\ No newline at end of file
source 'https://rubygems.org' source 'https://rubygems.org'
gem 'rails', '4.2.5.1' gem 'rails', '4.2.7.1'
gem 'mysql2' gem 'mysql2'
gem 'uglifier', '>= 1.3.0' gem 'uglifier', '>= 1.3.0'
gem 'sass-rails', '~> 5.0' gem 'sass-rails', '~> 5.0'
...@@ -32,7 +32,7 @@ gem 'sdoc', '~> 0.4.0', group: :doc ...@@ -32,7 +32,7 @@ gem 'sdoc', '~> 0.4.0', group: :doc
gem 'tzinfo-data', platforms: [:mingw, :mswin, :jruby] gem 'tzinfo-data', platforms: [:mingw, :mswin, :jruby]
group :development do group :development do
gem 'web-console', '~> 2.0' gem 'web-console', '~> 2.0'
gem 'capistrano', '~> 3.4' gem 'capistrano', '~> 3.6.1'
gem 'capistrano-faster-assets', '~> 1.0' gem 'capistrano-faster-assets', '~> 1.0'
gem 'capistrano-bundler' gem 'capistrano-bundler'
gem 'capistrano-rvm' gem 'capistrano-rvm'
......
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actionmailer (4.2.5.1) actionmailer (4.2.7.1)
actionpack (= 4.2.5.1) actionpack (= 4.2.7.1)
actionview (= 4.2.5.1) actionview (= 4.2.7.1)
activejob (= 4.2.5.1) activejob (= 4.2.7.1)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5) rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.5.1) actionpack (4.2.7.1)
actionview (= 4.2.5.1) actionview (= 4.2.7.1)
activesupport (= 4.2.5.1) activesupport (= 4.2.7.1)
rack (~> 1.6) rack (~> 1.6)
rack-test (~> 0.6.2) rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5) rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.5.1) actionview (4.2.7.1)
activesupport (= 4.2.5.1) activesupport (= 4.2.7.1)
builder (~> 3.1) builder (~> 3.1)
erubis (~> 2.7.0) erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5) rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.0.2)
activejob (4.2.5.1) activejob (4.2.7.1)
activesupport (= 4.2.5.1) activesupport (= 4.2.7.1)
globalid (>= 0.3.0) globalid (>= 0.3.0)
activemodel (4.2.5.1) activemodel (4.2.7.1)
activesupport (= 4.2.5.1) activesupport (= 4.2.7.1)
builder (~> 3.1) builder (~> 3.1)
activerecord (4.2.5.1) activerecord (4.2.7.1)
activemodel (= 4.2.5.1) activemodel (= 4.2.7.1)
activesupport (= 4.2.5.1) activesupport (= 4.2.7.1)
arel (~> 6.0) arel (~> 6.0)
activesupport (4.2.5.1) activesupport (4.2.7.1)
i18n (~> 0.7) i18n (~> 0.7)
json (~> 1.7, >= 1.7.7) json (~> 1.7, >= 1.7.7)
minitest (~> 5.1) minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4) thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1) tzinfo (~> 1.1)
acts_as_list (0.7.2) acts_as_list (0.8.2)
activerecord (>= 3.0) activerecord (>= 3.0)
airbrussh (1.1.1)
sshkit (>= 1.6.1, != 1.7.0)
arel (6.0.3) arel (6.0.3)
autoprefixer-rails (6.3.6) autoprefixer-rails (6.5.4)
execjs execjs
bcrypt (3.1.11-x64-mingw32) bcrypt (3.1.11-x64-mingw32)
bcrypt (3.1.11-x86-mingw32) bcrypt (3.1.11-x86-mingw32)
binding_of_caller (0.7.2) binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1) debug_inspector (>= 0.0.1)
bootstrap-sass (3.3.6) bootstrap-sass (3.3.7)
autoprefixer-rails (>= 5.2.1) autoprefixer-rails (>= 5.2.1)
sass (>= 3.3.4) sass (>= 3.3.4)
bootstrap-will_paginate (0.0.10) bootstrap-will_paginate (0.0.10)
...@@ -53,27 +55,31 @@ GEM ...@@ -53,27 +55,31 @@ GEM
bootstrap3-datetimepicker-rails (4.15.35) bootstrap3-datetimepicker-rails (4.15.35)
momentjs-rails (>= 2.8.1) momentjs-rails (>= 2.8.1)
builder (3.2.2) builder (3.2.2)
capistrano (3.4.0) capistrano (3.6.1)
airbrussh (>= 1.0.0)
capistrano-harrow
i18n i18n
rake (>= 10.0.0) rake (>= 10.0.0)
sshkit (~> 1.3) sshkit (>= 1.9.0)
capistrano-bundler (1.1.4) capistrano-bundler (1.2.0)
capistrano (~> 3.1) capistrano (~> 3.1)
sshkit (~> 1.2) sshkit (~> 1.2)
capistrano-faster-assets (1.0.2) capistrano-faster-assets (1.0.2)
capistrano (>= 3.1) capistrano (>= 3.1)
capistrano-rails (1.1.6) capistrano-harrow (0.5.3)
capistrano-rails (1.2.0)
capistrano (~> 3.1) capistrano (~> 3.1)
capistrano-bundler (~> 1.1) capistrano-bundler (~> 1.1)
capistrano-rvm (0.1.2) capistrano-rvm (0.1.2)
capistrano (~> 3.0) capistrano (~> 3.0)
sshkit (~> 1.2) sshkit (~> 1.2)
carrierwave (0.11.0) carrierwave (0.11.2)
activemodel (>= 3.2.0) activemodel (>= 3.2.0)
activesupport (>= 3.2.0) activesupport (>= 3.2.0)
json (>= 1.7) json (>= 1.7)
mime-types (>= 1.16) mime-types (>= 1.16)
ckeditor (4.1.6) mimemagic (>= 0.3.0)
ckeditor (4.2.2)
cocaine cocaine
orm_adapter (~> 0.5.0) orm_adapter (~> 0.5.0)
climate_control (0.0.3) climate_control (0.0.3)
...@@ -86,23 +92,22 @@ GEM ...@@ -86,23 +92,22 @@ GEM
coffee-script (2.4.1) coffee-script (2.4.1)
coffee-script-source coffee-script-source
execjs execjs
coffee-script-source (1.10.0) coffee-script-source (1.12.2)
commonjs (0.2.7) commonjs (0.2.7)
concurrent-ruby (1.0.1) concurrent-ruby (1.0.3)
debug_inspector (0.0.2) debug_inspector (0.0.2)
devise (3.5.6) devise (4.2.0)
bcrypt (~> 3.0) bcrypt (~> 3.0)
orm_adapter (~> 0.1) orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5) railties (>= 4.1.0, < 5.1)
responders responders
thread_safe (~> 0.1)
warden (~> 1.2.3) warden (~> 1.2.3)
devise-i18n (1.0.1) devise-i18n (1.1.1)
erubis (2.7.0) erubis (2.7.0)
execjs (2.6.0) execjs (2.7.0)
font-awesome-rails (4.6.0.0) font-awesome-rails (4.7.0.1)
railties (>= 3.2, < 5.1) railties (>= 3.2, < 5.1)
globalid (0.3.6) globalid (0.3.7)
activesupport (>= 4.1.0) activesupport (>= 4.1.0)
haml (4.0.7) haml (4.0.7)
tilt tilt
...@@ -118,19 +123,19 @@ GEM ...@@ -118,19 +123,19 @@ GEM
nokogiri (~> 1.6.0) nokogiri (~> 1.6.0)
ruby_parser (~> 3.5) ruby_parser (~> 3.5)
i18n (0.7.0) i18n (0.7.0)
jbuilder (2.4.1) jbuilder (2.6.1)
activesupport (>= 3.0.0, < 5.1) activesupport (>= 3.0.0, < 5.1)
multi_json (~> 1.2) multi_json (~> 1.2)
jquery-rails (4.1.1) jquery-rails (4.2.1)
rails-dom-testing (>= 1, < 3) rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0) railties (>= 4.2.0)
thor (>= 0.14, < 2.0) thor (>= 0.14, < 2.0)
jquery-ui-rails (5.0.5) jquery-ui-rails (6.0.1)
railties (>= 3.2.16) railties (>= 3.2.16)
json (1.8.3) json (1.8.3)
less (2.6.0) less (2.6.0)
commonjs (~> 0.2.7) commonjs (~> 0.2.7)
less-rails (2.7.1) less-rails (2.8.0)
actionpack (>= 4.0) actionpack (>= 4.0)
less (~> 2.6.0) less (~> 2.6.0)
sprockets (> 2, < 4) sprockets (> 2, < 4)
...@@ -139,39 +144,40 @@ GEM ...@@ -139,39 +144,40 @@ GEM
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
mail (2.6.4) mail (2.6.4)
mime-types (>= 1.16, < 4) mime-types (>= 1.16, < 4)
mime-types (3.0) mime-types (3.1)
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
mime-types-data (3.2016.0221) mime-types-data (3.2016.0521)
mini_magick (4.5.1) mimemagic (0.3.2)
mini_portile2 (2.0.0) mini_magick (4.6.0)
minitest (5.8.4) mini_portile2 (2.1.0)
momentjs-rails (2.11.0) minitest (5.10.1)
momentjs-rails (2.15.1)
railties (>= 3.1) railties (>= 3.1)
multi_json (1.11.2) multi_json (1.12.1)
mysql2 (0.4.3-x64-mingw32) mysql2 (0.4.5-x64-mingw32)
mysql2 (0.4.3-x86-mingw32) mysql2 (0.4.5-x86-mingw32)
nested_form (0.3.2) nested_form (0.3.2)
net-scp (1.2.1) net-scp (1.2.1)
net-ssh (>= 2.6.5) net-ssh (>= 2.6.5)
net-ssh (3.1.1) net-ssh (3.2.0)
nokogiri (1.6.7.2-x64-mingw32) nokogiri (1.6.8.1-x64-mingw32)
mini_portile2 (~> 2.0.0.rc2) mini_portile2 (~> 2.1.0)
nokogiri (1.6.7.2-x86-mingw32) nokogiri (1.6.8.1-x86-mingw32)
mini_portile2 (~> 2.0.0.rc2) mini_portile2 (~> 2.1.0)
orm_adapter (0.5.0) orm_adapter (0.5.0)
rack (1.6.4) rack (1.6.5)
rack-test (0.6.3) rack-test (0.6.3)
rack (>= 1.0) rack (>= 1.0)
rails (4.2.5.1) rails (4.2.7.1)
actionmailer (= 4.2.5.1) actionmailer (= 4.2.7.1)
actionpack (= 4.2.5.1) actionpack (= 4.2.7.1)
actionview (= 4.2.5.1) actionview (= 4.2.7.1)
activejob (= 4.2.5.1) activejob (= 4.2.7.1)
activemodel (= 4.2.5.1) activemodel (= 4.2.7.1)
activerecord (= 4.2.5.1) activerecord (= 4.2.7.1)
activesupport (= 4.2.5.1) activesupport (= 4.2.7.1)
bundler (>= 1.3.0, < 2.0) bundler (>= 1.3.0, < 2.0)
railties (= 4.2.5.1) railties (= 4.2.7.1)
sprockets-rails sprockets-rails
rails-deprecated_sanitizer (1.0.3) rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha) activesupport (>= 4.2.0.alpha)
...@@ -181,47 +187,47 @@ GEM ...@@ -181,47 +187,47 @@ GEM
rails-deprecated_sanitizer (>= 1.0.1) rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.3) rails-html-sanitizer (1.0.3)
loofah (~> 2.0) loofah (~> 2.0)
railties (4.2.5.1) railties (4.2.7.1)
actionpack (= 4.2.5.1) actionpack (= 4.2.7.1)
activesupport (= 4.2.5.1) activesupport (= 4.2.7.1)
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0) thor (>= 0.18.1, < 2.0)
rake (11.1.2) rake (12.0.0)
rdoc (4.2.2) rdoc (4.3.0)
json (~> 1.4) responders (2.3.0)
responders (2.1.2)
railties (>= 4.2.0, < 5.1) railties (>= 4.2.0, < 5.1)
ruby_parser (3.8.1) ruby_parser (3.8.3)
sexp_processor (~> 4.1) sexp_processor (~> 4.1)
sass (3.4.22) sass (3.4.22)
sass-rails (5.0.4) sass-rails (5.0.6)
railties (>= 4.0.0, < 5.0) railties (>= 4.0.0, < 6)
sass (~> 3.1) sass (~> 3.1)
sprockets (>= 2.8, < 4.0) sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0) sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3) tilt (>= 1.1, < 3)
sdoc (0.4.1) sdoc (0.4.2)
json (~> 1.7, >= 1.7.7) json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0) rdoc (~> 4.0)
sexp_processor (4.7.0) sexp_processor (4.7.0)
simple_form (3.2.1) simple_form (3.3.1)
actionpack (> 4, < 5.1) actionpack (> 4, < 5.1)
activemodel (> 4, < 5.1) activemodel (> 4, < 5.1)
sprockets (3.6.0) sprockets (3.7.0)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
rack (> 1, < 3) rack (> 1, < 3)
sprockets-rails (3.0.4) sprockets-rails (3.2.0)
actionpack (>= 4.0) actionpack (>= 4.0)
activesupport (>= 4.0) activesupport (>= 4.0)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
sshkit (1.9.0) sshkit (1.11.5)
net-scp (>= 1.1.2) net-scp (>= 1.1.2)
net-ssh (>= 2.8.0) net-ssh (>= 2.8.0)
thor (0.19.1) thor (0.19.4)
thread_safe (0.3.5) thread_safe (0.3.5)
tilt (2.0.2) tilt (2.0.5)
turbolinks (2.5.3) turbolinks (5.0.1)
coffee-rails turbolinks-source (~> 5)
turbolinks-source (5.0.0)
twitter-bootstrap-rails (3.2.2) twitter-bootstrap-rails (3.2.2)
actionpack (>= 3.1) actionpack (>= 3.1)
execjs (>= 2.2.2, >= 2.2) execjs (>= 2.2.2, >= 2.2)
...@@ -229,9 +235,9 @@ GEM ...@@ -229,9 +235,9 @@ GEM
railties (>= 3.1) railties (>= 3.1)
tzinfo (1.2.2) tzinfo (1.2.2)
thread_safe (~> 0.1) thread_safe (~> 0.1)
tzinfo-data (1.2016.3) tzinfo-data (1.2016.10)
tzinfo (>= 1.0.0) tzinfo (>= 1.0.0)
uglifier (3.0.0) uglifier (3.0.4)
execjs (>= 0.3.0, < 3) execjs (>= 0.3.0, < 3)
warden (1.2.6) warden (1.2.6)
rack (>= 1.0) rack (>= 1.0)
...@@ -240,7 +246,7 @@ GEM ...@@ -240,7 +246,7 @@ GEM
binding_of_caller (>= 0.7.2) binding_of_caller (>= 0.7.2)
railties (>= 4.0) railties (>= 4.0)
sprockets-rails (>= 2.0, < 4.0) sprockets-rails (>= 2.0, < 4.0)
will_paginate (3.1.0) will_paginate (3.1.5)
PLATFORMS PLATFORMS
x64-mingw32 x64-mingw32
...@@ -251,7 +257,7 @@ DEPENDENCIES ...@@ -251,7 +257,7 @@ DEPENDENCIES
bootstrap-sass (~> 3.3.4) bootstrap-sass (~> 3.3.4)
bootstrap-will_paginate bootstrap-will_paginate
bootstrap3-datetimepicker-rails (~> 4.15.35) bootstrap3-datetimepicker-rails (~> 4.15.35)
capistrano (~> 3.4) capistrano (~> 3.6.1)
capistrano-bundler capistrano-bundler
capistrano-faster-assets (~> 1.0) capistrano-faster-assets (~> 1.0)
capistrano-rails capistrano-rails
...@@ -270,7 +276,7 @@ DEPENDENCIES ...@@ -270,7 +276,7 @@ DEPENDENCIES
momentjs-rails (>= 2.9.0) momentjs-rails (>= 2.9.0)
mysql2 mysql2
nested_form nested_form
rails (= 4.2.5.1) rails (= 4.2.7.1)
sass-rails (~> 5.0) sass-rails (~> 5.0)
sdoc (~> 0.4.0) sdoc (~> 0.4.0)
simple_form simple_form
...@@ -282,4 +288,4 @@ DEPENDENCIES ...@@ -282,4 +288,4 @@ DEPENDENCIES
will_paginate will_paginate
BUNDLED WITH BUNDLED WITH
1.11.2 1.13.6
//= require jquery-ui/sortable //= require jquery-ui/widgets/sortable
//= require turbolinks //= require turbolinks
//= require jquery_nested_form //= require jquery_nested_form
//= require moment //= require moment
......
window.linksPanelShowed = false window.linksPanelShowed = false
$(document).on 'ready page:load', -> $(document).on 'ready page:load turbolinks:load', ->
if window.linksPanelShowed if window.linksPanelShowed
$('#links_panel').css left: 0 $('#links_panel').css left: 0
......
$(document).on 'ready page:load', -> $(document).on 'ready page:load turbolinks:load', ->
init_datetime_picker($('.datetime_picker')) init_datetime_picker($('.datetime_picker'))
init_date_picker($('.date_picker')) init_date_picker($('.date_picker'))
......
$(document).on 'ready page:load', -> $(document).on 'ready page:load turbolinks:load', ->
$('table.editable_rows').each -> $('table.editable_rows').each ->
initEditableRows(this) initEditableRows(this)
initCreation(this) initCreation(this)
...@@ -18,7 +18,9 @@ initEditableRows = (table) -> ...@@ -18,7 +18,9 @@ initEditableRows = (table) ->
$.ajax $.ajax
type: $button.data('method') type: $button.data('method')
url: $button.attr('href') + '.json' url: $button.attr('href') + '.json'
success: () -> $row.remove() success: () ->
$row.remove()
dispatchChangeEvent($table, 'delete')
error: (data) -> setErrors($row, data) error: (data) -> setErrors($row, data)
initRowEditing = ($editButton) -> initRowEditing = ($editButton) ->
...@@ -28,7 +30,7 @@ initEditableRows = (table) -> ...@@ -28,7 +30,7 @@ initEditableRows = (table) ->
initControls($controlsCell) initControls($controlsCell)
initInputs($row) initInputs($row)
$row.find('td[data] input').keypress (event) -> $row.find('td[data] input, td[data-name] input, td[data-name] select').keypress (event) ->
if event.which == 13 if event.which == 13
event.preventDefault() event.preventDefault()
save() save()
...@@ -39,25 +41,47 @@ initEditableRows = (table) -> ...@@ -39,25 +41,47 @@ initEditableRows = (table) ->
save = () -> save = () ->
clearErrors($row) clearErrors($row)
data = {} data = {id: $row.data('id')}
$row.find('td[data]').each -> $row.find('td[data], td[data-name]').each ->
$cell = $(this) $cell = $(this)
data[$cell.attr('data')] = $cell.find('input').val() name = if $cell.attr('data') then 'data' else 'data-name'
if $cell.data('image')
$form = $cell.find('form')
$.ajax
type: $form.attr('method')
url: $form.attr('action')
data: new FormData($form[0])
processData: false
contentType: false
success: (data, textStatus, jqXHR) ->
$cell.html(data)
else
data[$cell.attr(name)] = $cell.find('input, select').val()
ajaxData = {} ajaxData = {}
ajaxData[$table.data('resource')] = data ajaxData[$table.data('resource')] = data
$.ajax $.ajax
type: "PUT" type: "PUT"
url: window.location.href + "/#{$row.data('id')}.json" url: window.location.href + "/#{$row.data('id')}.json"
data: ajaxData data: ajaxData
success: () -> restoreRow(true) success: () ->
restoreRow(true)
dispatchChangeEvent($table, 'update')
error: (data) -> setErrors($row, data) error: (data) -> setErrors($row, data)
restoreRow = (updated) -> restoreRow = (updated) ->
$controlsCell.html(orygControlHtml) $controlsCell.html(orygControlHtml)
$row.find('td[data]').each -> $row.find('td[data], td[data-name]').each ->
$cell = $(this) $cell = $(this)
$input = $cell.find('input') $input = $cell.find('input, select')
$cell.html(if updated then $input.val() else $input.data('undo')) if updated
if $cell.find('form').length == 0
if $input.prop('tagName') == 'SELECT'
$cell.html($input.find("option[value=#{$input.val()}]").html())
else
$cell.html($input.val())
else
$cell.html($cell.data('undo'))
$controlsCell.find('.cancel').click (event) -> $controlsCell.find('.cancel').click (event) ->
event.preventDefault() event.preventDefault()
...@@ -69,7 +93,7 @@ initCreation = (table) -> ...@@ -69,7 +93,7 @@ initCreation = (table) ->
$row = $createButton.closest('tr') $row = $createButton.closest('tr')
initInputs($row) initInputs($row)
$row.find('td[data]').keypress (event) -> $row.find('td[data], td[data-name]').keypress (event) ->
if event.which == 13 if event.which == 13
event.preventDefault() event.preventDefault()
create() create()
...@@ -83,7 +107,10 @@ initCreation = (table) -> ...@@ -83,7 +107,10 @@ initCreation = (table) ->
data = {} data = {}
$row.find('td[data]').each -> $row.find('td[data]').each ->
$cell = $(this) $cell = $(this)
data[$cell.attr('data')] = $cell.find('input').val() data[$cell.attr('data')] = $cell.find('input, select').val()
$row.find('td[data-name]').each ->
$cell = $(this)
data[$cell.attr('data-name')] = $cell.find('input, select').val()
ajaxData = {} ajaxData = {}
ajaxData[$table.data('resource')] = data ajaxData[$table.data('resource')] = data
$.ajax $.ajax
...@@ -95,20 +122,36 @@ initCreation = (table) -> ...@@ -95,20 +122,36 @@ initCreation = (table) ->
$table.find('tbody').html(newTableBody) $table.find('tbody').html(newTableBody)
$row.find('input:text').val('') $row.find('input:text').val('')
initEditableRows(table) initEditableRows(table)
dispatchChangeEvent($table, 'create')
error: (data) -> setErrors($row, data) error: (data) -> setErrors($row, data)
initInputs = ($row) -> initInputs = ($row) ->
$row.find('td[data]').each -> $row.find('td[data], td[data-name]').each ->
$cell = $(this) $cell = $(this)
value = $cell.html() $cell.data('undo', $cell.html())
$cell.html("<input data-undo='#{value}' value='#{value}'><span class='has-error'/>") if $cell.data('select')
value = $cell.html()
$cell.html("<select>#{$cell.data('select')}</select><span class='has-error'/>")
$select = $cell.find('select')
$select.val($select.find("option:contains(#{value})").val())
else if $cell.data('image')
$cell.html("#{$cell.data('image')}</input><span class='has-error'/>")
else
value = $cell.html()
$cell.html("<input value='#{value}'><span class='has-error'/>")
initControls = ($cell) -> 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>") $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) -> clearErrors = ($row) ->
$row.find("td[data] span").html('') $row.find("td[data] span, td[data-name] span").html('')
setErrors = ($row, data) -> setErrors = ($row, data) ->
for k,v of data.responseJSON for k,v of data.responseJSON
$row.find("td[data='#{k}'] span").html(v.join()) $row.find("td[data='#{k}'] span, td[data-name='#{k}'] span").html(v.join())
dispatchChangeEvent = ($table, type) ->
window.dispatchEvent new CustomEvent('editable_table_changed', detail: {resource: $table.data('resource'), type: type})
selectFromData = (data, query) ->
jQuery("<div>#{data}</div>").find(query)
\ No newline at end of file
$(document).on 'ready page:load', -> $(document).on 'ready page:load turbolinks:load', ->
$('#page_mode').each -> refresh_menu_item_fieldset($(this)) $('#page_mode').each -> refresh_menu_item_fieldset($(this))
$('#page_mode').change -> refresh_menu_item_fieldset($(this)) $('#page_mode').change -> refresh_menu_item_fieldset($(this))
...@@ -7,7 +7,7 @@ refresh_menu_item_fieldset = (item) -> ...@@ -7,7 +7,7 @@ refresh_menu_item_fieldset = (item) ->
$('#path_fields').hide() $('#path_fields').hide()
$('#page_fields').hide() $('#page_fields').hide()
$('#link_fields').show() $('#link_fields').show()
else if item.val() == 'page' else if item.val() == 'page' || item.val() == 'anchor'
$('#path_fields').hide() $('#path_fields').hide()
$('#page_fields').show() $('#page_fields').show()
$('#link_fields').hide() $('#link_fields').hide()
......
$(document).on 'ready page:load', -> $(document).on 'ready page:load turbolinks:load', ->
if $('.sort_icon').length if $('.sort_icon').length
init_sortable('tbody', 'tr') init_sortable('tbody', 'tr')
......
#= require jquery-ui/draggable #= require jquery-ui/widgets/draggable
#= require jquery-ui/resizable #= require jquery-ui/widgets/resizable
$ -> $ ->
$('#blocks_controls').draggable() $('#blocks_controls').draggable()
......
$(document).on 'ready page:load', -> $(document).on 'ready page:load turbolinks:load', ->
initContactUsMessage() initContactUsMessage()
refreshLandingHeader() refreshLandingHeader()
......
$(document).on 'ready page:load', -> $(document).on 'ready page:load turbolinks:load', ->
$(".box_sandwich").click -> $(".box_sandwich").click ->
if $('.mobile_menu').hasClass('menu_open') if $('.mobile_menu').hasClass('menu_open')
closeMobileMenu() closeMobileMenu()
......
$(document).on 'ready page:load', -> $(document).on 'ready page:load turbolinks:load', ->
$('.box_search .search_action').click (e) -> $('.box_search .search_action').click (e) ->
$('.box_search form').submit() $('.box_search form').submit()
......
$(document).on 'ready page:load', -> $(document).on 'ready page:load turbolinks:load', ->
$("a[rel~=popover], .has-popover").popover() $("a[rel~=popover], .has-popover").popover()
$("a[rel~=tooltip], .has-tooltip").tooltip() $("a[rel~=tooltip], .has-tooltip").tooltip()
/* /*
*= require bootstrap-datetimepicker *= require bootstrap-datetimepicker
*= require_directory ./admin *= require_tree ./admin
*= require_self *= require_self
*/ */
table.editable_rows {
td {
input {
width: 100%;
margin: -2px 0;
}
select {
width: 100%;
padding: 2px 0;
margin: -2px 0;
}
img {
margin-top: -5px;
margin-bottom: -5px;
max-height: 32px;
max-width: 100%
}
}
td span.has-error {
color: #a94442;
}
}
div {
&.field, &.actions {
margin-bottom: 10px;
}
}
//body { //body {
// //
// color: #333; // color: #333;
...@@ -31,11 +37,6 @@ ...@@ -31,11 +37,6 @@
// } // }
//} //}
// //
//div {
// &.field, &.actions {
// margin-bottom: 10px;
// }
//}
// //
//#notice { //#notice {
// color: green; // color: green;
......
body.devise {
padding: 20px;
text-align: center;
.remember {
display: inline-block;
vertical-align: middle;
}
.form-group {
width: 220px;
margin: 0 auto 10px;
}
input[type=email], input[type=password], div:not(.remember) > label:first-child {
margin: 0 2px 0;
width: 220px;
text-align: left;
}
a {
line-height: 1.5;
}
input[type=submit] {
max-width: 200px;
white-space: normal;
margin-top: 10px;
margin-bottom: 20px;
}
.logo img {
max-width: 80%;
max-height: 100px;
}
}
\ No newline at end of file
...@@ -2,8 +2,12 @@ class AccountsController < AdminController ...@@ -2,8 +2,12 @@ class AccountsController < AdminController
before_action :set_account, only: [:show, :edit, :update, :destroy] before_action :set_account, only: [:show, :edit, :update, :destroy]
def index def index
@accounts = paginated tabular_filter.add_keys_replacements({email: 'accounts.email', on_hold: 'accounts.on_hold'}). @accounts = paginated tabular_filter.add_keys_replacements({email: 'accounts.email', on_hold: 'accounts.on_hold',
apply(select_accounts.order 'email', :email) admin: 'if(administrators.id is not null, 1, 0)'}).apply(Account.with_admins.order :email)
end
def new
@account = Account.new
end end
def show def show
...@@ -12,6 +16,19 @@ class AccountsController < AdminController ...@@ -12,6 +16,19 @@ class AccountsController < AdminController
def edit def edit
end end
def create
@account = Account.new(account_params)
respond_to do |format|
if @account.save
format.html { redirect_to @account, notice: 'Account was successfully created.' }
format.json { render :show, status: :created, location: @account }
else
format.html { render :new }
format.json { render json: @account.errors, status: :unprocessable_entity }
end
end
end
def update def update
respond_to do |format| respond_to do |format|
if @account.update(account_params) if @account.update(account_params)
...@@ -25,11 +42,16 @@ class AccountsController < AdminController ...@@ -25,11 +42,16 @@ class AccountsController < AdminController
end end
def destroy def destroy
redirect_to accounts_url respond_to do |format|
end if @account.administrator.nil? || @account.on_hold? || Administrator.active.count > 1
@account.destroy
def vacancy format.html { redirect_to accounts_url, notice: 'Account was successfully destroyed.' }
redirect_to accounts_path(vacancy: Vacancy.find(params[:id]).name) format.json { head :no_content }
else
format.html { redirect_to accounts_url, alert: 'You cannot destroy last active admin.' }
format.json { head :no_content }
end
end
end end
private private
...@@ -58,6 +80,7 @@ class AccountsController < AdminController ...@@ -58,6 +80,7 @@ class AccountsController < AdminController
params[:account][:password] = nil params[:account][:password] = nil
params[:account][:password_confirmation] = nil params[:account][:password_confirmation] = nil
end end
params.require(:account).permit(:email, :wallet_address, :on_hold, :referrer_id, :subscribed, :password, :password_confirmation) params.require(:account).permit(:email, :wallet_address, :on_hold, :referrer_id, :subscribed, :admin,
:password, :password_confirmation)
end end
end end
...@@ -211,7 +211,7 @@ class TabularFilter ...@@ -211,7 +211,7 @@ class TabularFilter
end end
def yes_no_helper(attr) def yes_no_helper(attr)
select_tag attr, options_for_select([[t(:yes), 1], [t(:no), 0]], value_for(attr)), select_tag attr, options_for_select([[t('humanizers.bool.true'), 1], [t('humanizers.bool.false'), 0]], value_for(attr)),
include_blank: true, class: 'filter boolean' include_blank: true, class: 'filter boolean'
end end
......
class ImagesController < ApplicationController
before_action :set_image
layout false
def show
render_image
end
def edit
end
def update
if @image.update image_params
render_image
else
render nothing: true, status: :internal_server_error
end
end
private
def render_image
render html: "<img src='#{@image.data_url}'/>".html_safe, status: :ok
end
# Use callbacks to share common setup or constraints between actions.
def set_image
@image = Image.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def image_params
params[:image] = {remove_data: true} if params[:image].nil?
params.require(:image).permit(:data, :remove_data)
end
end
class SettingsController < AdminController class SettingsController < AdminController
before_action :set_setting, only: [:update, :destroy] before_action :set_setting, only: [:update, :destroy, :image_form]
# GET /settings # GET /settings
# GET /settings.json # GET /settings.json
def index def index
@settings = Setting.init.all @settings = Setting.init.all
end end
# POST /settings # PATCH/PUT /settings/1
# POST /settings.json # PATCH/PUT /settings/1.json
def create def update
@setting = Setting.new(setting_params) respond_to do |format|
if @setting.update(setting_params)
respond_to do |format| format.html { redirect_to settings_url, notice: 'Setting was successfully updated.' }
if @setting.save format.json { render json: {}, status: :ok }
format.html { redirect_to settings_url, notice: 'Setting was successfully created.' } else
else format.json { render json: @setting.errors, status: :unprocessable_entity }
format.json { render json: @setting.errors, status: :unprocessable_entity } end
end end
end end
end
# DELETE /settings/1
# PATCH/PUT /settings/1 # DELETE /settings/1.json
# PATCH/PUT /settings/1.json def destroy
def update @setting.destroy
respond_to do |format| respond_to do |format|
if @setting.update(setting_params) format.html { redirect_to settings_url, notice: 'Setting was successfully destroyed.' }
format.html { redirect_to settings_url, notice: 'Setting was successfully updated.' } format.json { head :no_content }
format.json { render json: {}, status: :ok, location: @tag } end
else end
format.html { render :edit }
format.json { render json: @setting.errors, status: :unprocessable_entity } private
end # Use callbacks to share common setup or constraints between actions.
end def set_setting
end @setting = Setting.find(params[:id])
end
# DELETE /settings/1
# DELETE /settings/1.json # Never trust parameters from the scary internet, only allow the white list through.
def destroy def setting_params
@setting.destroy params.require(:setting).permit(:value)
respond_to do |format| end
format.html { redirect_to settings_url, notice: 'Setting was successfully destroyed.' }
format.json { head :no_content } end
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 SettingsHelper
def generate_setting_data(setting)
data = {name: :value}
case setting.format
when :image
form = simple_form_for setting.real_value do |f|
f.file_field :data, accept: 'image/*'
end
data.merge!({image: form})
when :bool
select_data = options_for_select([[t('no'), 0], [t('yes'), 1]])
data.merge!({select: select_data})
else
nil
end
data
end
end
...@@ -2,6 +2,17 @@ class Account < ActiveRecord::Base ...@@ -2,6 +2,17 @@ class Account < ActiveRecord::Base
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable
has_one :administrator has_one :administrator
scope :with_admins, -> { joins('left join administrators on accounts.id = administrators.account_id') }
scope :active, -> { where(on_hold: false) }
after_create do
create_administrator if @should_be_admin
end
def active_for_authentication?
super and not self.on_hold?
end
# after_create :send_welcome_mail # after_create :send_welcome_mail
# def self.from_omniauth(auth, current_user, ip_address, referrer_id = nil) # def self.from_omniauth(auth, current_user, ip_address, referrer_id = nil)
...@@ -36,4 +47,20 @@ class Account < ActiveRecord::Base ...@@ -36,4 +47,20 @@ class Account < ActiveRecord::Base
# end # end
# end # end
def admin
administrator.present?
end
def admin=(value)
if value.to_i > 0
if new_record?
@should_be_admin = true
else
create_administrator if administrator.nil?
end
else
administrator.destroy if administrator.present?
end
end
end end
class Administrator < ActiveRecord::Base class Administrator < ActiveRecord::Base
include Accounted include Accounted
scope :active, -> { joins(:account).merge Account.active }
end end
class Image < ActiveRecord::Base
mount_uploader :data, ImageUploader
end
# noinspection RubyClassVariableUsageInspection # noinspection RubyClassVariableUsageInspection
class Setting < ActiveRecord::Base class Setting < ActiveRecord::Base
validates :name, presence: true, uniqueness: true validates :name, presence: true, uniqueness: true
validates :value, presence: true
before_update :reset_setting_variable before_update :reset_setting_variable
default_scope { order :name } default_scope { order :name }
DEFAULTS = { DEFAULTS = {
site_name: 'Personal site', title: {default: 'Blank site', format: :string},
title: 'Personal site', description: {default: 'New blank site - it is stub for future site!', format: :string},
description: 'Site of your dreams.', keywords: {default: '', format: :string},
keywords: 'site, personal site, own site', favicon: {default: nil, format: :image},
gse_id: '007392588842326689376:3onw-lza4mc', gse_id: {default: '007392588842326689376:3onw-lza4mc', format: :string},
google_analytics_id: 'UA-63039804-12' google_analytics_id: {default: 'UA-63039804-12', format: :string}
} }
def self.init def self.init
DEFAULTS.keys.each { |name| get(name) } DEFAULTS.keys.each { |name| get(name)[:default] }
self self
end end
def self.get(name) def self.get(name)
setting = find_or_initialize_by(name: name) setting = find_or_initialize_by(name: name)
setting.update(value: DEFAULTS[name.to_sym]) if setting.new_record? setting.update(value: DEFAULTS[name.to_sym][:default]) if setting.new_record?
setting.value setting
end
def self.site_name
@@site_name ||= get(:site_name)
end end
def self.title def self.title
@@title ||= get(:title) @@title ||= get(:title).real_value
end end
def self.description def self.description
@@description ||= get(:description) @@description ||= get(:description).real_value
end end
def self.keywords def self.keywords
@@keywords ||= get(:keywords) @@keywords ||= get(:keywords).real_value
end
def self.favicon
@@favicon ||= get(:favicon).real_value
end end
def self.gse_id def self.gse_id
@@gse_id ||= get(:gse_id) @@gse_id ||= get(:gse_id).real_value
end end
def self.google_analytics_id def self.google_analytics_id
@@google_analytics_id ||= get(:google_analytics_id) @@google_analytics_id ||= get(:google_analytics_id).real_value
end
def real_value
case format
when :image
image = Image.find_by(id: value)
unless image
image = Image.create
update value: image.id
end
image
when :int
value.to_i
when :bool
value.to_i > 0
when :array
value.split
when :hash
Hash[*value.split(/,\s*/).map{|s| p = s.split(/:\s*/); [p[0].to_sym, p[1]]}.flatten]
else
value
end
end
def formatted_value
case format
when :int
value.to_i
when :bool
I18n.t("humanizers.bool.#{real_value}")
when :image
"<img src='#{real_value.data_url}'/>".html_safe
else
value
end
end
def format
setting_default = DEFAULTS[name.to_sym]
setting_default ? setting_default[:format] : nil
end end
private private
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
= f.input :password_confirmation = f.input :password_confirmation
= f.input :subscribed = f.input :subscribed
= f.input :on_hold = f.input :on_hold
= f.input :admin, as: :boolean
= f.button :submit, :class => 'btn-primary' = f.button :submit, :class => 'btn-primary'
= link_to t('.cancel', :default => t("helpers.links.cancel")), accounts_path, :class => 'btn btn-default' = link_to t('.cancel', :default => t("helpers.links.cancel")), accounts_path, :class => 'btn btn-default'
- model_class = Account - model_class = Account
.page-header .page-header.refresh_pagination
%h1 %h1
= model_class.model_name.human(count: 2) = model_class.model_name.human(count: 2)
.pull-right .pull-right
= link_to 'Newsletter', new_newsletter_path(params), class: 'btn btn-default' - newsletter_params = tabular_filter.condition.present? ? {newsletter: {recipient_filter: tabular_filter.condition}} : nil
.filtered_pagination = link_to 'Newsletter', new_newsletter_path(newsletter_params), class: 'btn btn-default'
= will_paginate @accounts = will_paginate @accounts
- params = @tabular_filter.condition.present? ? {newsletter: {recipient_filter: @tabular_filter.condition}} : nil
%table.table.table-striped.filtered_table %table.table.table-striped.filtered_table
%thead %thead
%tr %tr
%th= model_class.human_attribute_name(:email) %th= model_class.human_attribute_name(:email)
%th= model_class.human_attribute_name(:subscribed) %th= model_class.human_attribute_name(:subscribed)
%th= model_class.human_attribute_name(:on_hold) %th= model_class.human_attribute_name(:on_hold)
%th= model_class.human_attribute_name(:admin)
%th= model_class.human_attribute_name(:created_at) %th= model_class.human_attribute_name(:created_at)
%th= t 'helpers.actions' %th= t 'helpers.actions'
= tabular_filter.row_helper ['email', {subscribed: :bool}, {on_hold: :bool}, '-', '-'] do = tabular_filter.row_helper ['email', {subscribed: :bool}, {on_hold: :bool}, {admin: :bool}, '-', '-'] do
-link_to '?', class: 'btn btn-default btn-xs' do -link_to '?', class: 'btn btn-default btn-xs' do
%i.fa.fa-close %i.fa.fa-close
%tbody %tbody
- @accounts.each do |account| - @accounts.each do |account|
%tr %tr
%td= link_to account.email, account_path(account) %td= link_to account.email, account_path(account)
%td= account.subscribed %td= t "humanizers.bool.#{account.subscribed}"
%td= account.on_hold %td= t "humanizers.bool.#{account.on_hold}"
%td=localize_datetime account.created_at %td= t "humanizers.bool.#{account.administrator.present?}"
%td= localize_datetime account.created_at
%td.actions %td.actions
= link_to edit_account_path(account), title: 'Edit', class: 'btn btn-default btn-xs' do = link_to edit_account_path(account), title: 'Edit', class: 'btn btn-default btn-xs' do
%i.fa.fa-edit %i.fa.fa-edit
...@@ -32,3 +33,4 @@ ...@@ -32,3 +33,4 @@
class: 'btn btn-xs btn-danger' do class: 'btn btn-xs btn-danger' do
%i.fa.fa-trash %i.fa.fa-trash
= link_to t('helpers.links.new'), new_account_path, class: 'btn btn-primary'
...@@ -10,10 +10,13 @@ ...@@ -10,10 +10,13 @@
= @account.updated_at = @account.updated_at
%p %p
%strong= model_class.human_attribute_name(:subscribed) + ':' %strong= model_class.human_attribute_name(:subscribed) + ':'
= @account.subscribed = t "humanizers.bool.#{@account.subscribed}"
%p %p
%strong= model_class.human_attribute_name(:on_hold) + ':' %strong= model_class.human_attribute_name(:on_hold) + ':'
= @account.on_hold = t "humanizers.bool.#{@account.on_hold}"
%p
%strong= model_class.human_attribute_name(:admin) + ':'
= t "humanizers.bool.#{@account.administrator.present?}"
%p %p
%strong= model_class.human_attribute_name(:reset_password_token) + ':' %strong= model_class.human_attribute_name(:reset_password_token) + ':'
= @account.reset_password_token = @account.reset_password_token
......
.row %div{class: ('tab-content' if locales.count > 1)}
.col-sm-12.col-xs-12 -locales.each do |locale|
%div{class: ('tab-content' if locales.count > 1)} .tab-pane{class: ["#{locale}_tab", locale == I18n.locale.to_s ? 'active' : nil].compact.join(' ')}
-locales.each do |locale| -attributes.each do |input_type, attribute_names|
.tab-pane{class: ["#{locale}_tab", locale == I18n.locale.to_s ? 'active' : nil].compact.join(' ')} -attribute_names = [attribute_names] unless attribute_names.is_a?(Array)
-attributes.each do |input_type, attribute_names| -attribute_names.each do |attribute_name|
-attribute_names = [attribute_names] unless attribute_names.is_a?(Array) %div{class: "localized_#{attribute_name}"}
-attribute_names.each do |attribute_name| -if input_type.to_s == 'cktext_area'
%div{class: "localized_#{attribute_name}"} %br
-if input_type.to_s == 'cktext_area' =f.cktext_area "#{attribute_name}_#{locale}", ckeditor: {language: I18n.locale}
%br =f.error "#{attribute_name}_#{locale}"
=f.cktext_area "#{attribute_name}_#{locale}", ckeditor: {language: I18n.locale} -elsif input_type.to_s == 'text_area'
=f.error "#{attribute_name}_#{locale}" =f.input "#{attribute_name}_#{locale}", as: :text, input_html: {rows: 4}, label: t("attributes.#{attribute_name}")
-elsif input_type.to_s == 'text_area' -else
=f.input "#{attribute_name}_#{locale}", as: :text, input_html: {rows: 4}, label: t("attributes.#{attribute_name}") =f.send(input_type.to_sym, "#{attribute_name}_#{locale}".to_sym, label: t("attributes.#{attribute_name}"))
-else
=f.send(input_type.to_sym, "#{attribute_name}_#{locale}".to_sym, label: t("attributes.#{attribute_name}"))
.row -if locales.count > 1
.col-sm-12.col-xs-12 %ul.nav.nav-tabs
-if locales.count > 1 -locales.each do |locale|
%ul.nav.nav-tabs %li{class: ('active' if locale == I18n.locale.to_s)}
-locales.each do |locale| %a{data: {toggle: 'tab'}, href: ".#{locale}_tab"}= t("locale.#{locale}")
%li{class: ('active' if locale == I18n.locale.to_s)}
%a{data: {toggle: 'tab'}, href: ".#{locale}_tab"}= t("locale.#{locale}")
= simple_form_for @image do |f|
= f.file_field :data, accept: 'image/*'
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
%title= content_for?(:title) ? yield(:title) : Setting.title %title= content_for?(:title) ? yield(:title) : Setting.title
%meta{name: 'description', content: content_for?(:description) ? yield(:description) : Setting.description} %meta{name: 'description', content: content_for?(:description) ? yield(:description) : Setting.description}
%meta{name: 'keywords', content: content_for?(:keywords) ? yield(:keywords) : Setting.keywords } %meta{name: 'keywords', content: content_for?(:keywords) ? yield(:keywords) : Setting.keywords }
%meta{property: 'og:site_name', content: Setting.site_name } %meta{property: 'og:site_name', content: Setting.title }
%meta{property: 'og:title', content: content_for?(:title) ? yield(:title) : Setting.title } %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: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:type', content: content_for?(:og_type) ? yield(:og_type) : 'website' }
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
= 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-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-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 'apple-touch-icon-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png'
= favicon_link_tag '/favicon.png', :rel => 'shortcut icon' = favicon_link_tag Setting.favicon.data_url || '/favicon.ico', :rel => 'shortcut icon'
= csrf_meta_tags = csrf_meta_tags
-if Rails.env.production? && Setting.google_analytics_id -if Rails.env.production? && Setting.google_analytics_id
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
= 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-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-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 'apple-touch-icon-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png'
= favicon_link_tag '/favicon.png', :rel => 'shortcut icon' = favicon_link_tag Setting.favicon.data_url || '/favicon.ico', :rel => 'shortcut icon'
= javascript_include_tag 'shared' = javascript_include_tag 'shared'
= javascript_include_tag 'ckeditor/init' = javascript_include_tag 'ckeditor/init'
= javascript_include_tag 'admin' = javascript_include_tag 'admin'
......
!!! 5
%html(lang="en")
%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")
%meta(name="turbolinks-cache-control" content="no-cache")
= render 'layouts/front_meta'
= 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"
= 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'
= javascript_include_tag 'shared'
%body.devise
.container-fluid
.row
.col-lg-1.hidden-md
.col-lg-10.col-md-12
= bootstrap_flash
= yield
.col-lg-1.hidden-md
-#%footer
-# %a{href: 'http://studio.sp-service.com.ua', target: :_blank} &copy; SP Studio 2016
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
= render 'active_translation/localed_tabs_and_inputs', f: f, attributes: {input: :title} = render 'active_translation/localed_tabs_and_inputs', f: f, attributes: {input: :title}
= f.input :enabled = f.input :enabled
= f.input :url_id = f.input :url_id
= f.input :mode, as: :select, collection: Page.modes.map{|m| [m, m.to_sym]}, include_blank: false = f.input :mode, as: :select, collection: Page.modes.map{|m| [ t("activerecord.attributes.page.modes.#{m}") , m.to_sym]}.sort, include_blank: false
#path_fields #path_fields
= f.input :path, as: :select, collection: Page.links.keys.map{|k| [k, k]}, include_blank: false = f.input :path, as: :select, collection: Page.links.keys.map{|l| [t("activerecord.attributes.page.links.#{l}"), l]}.sort, include_blank: false
#link_fields #link_fields
= f.input :link = f.input :link
#page_fields #page_fields
......
...@@ -18,10 +18,10 @@ ...@@ -18,10 +18,10 @@
%td.sort_icon %td.sort_icon
.fa.fa-arrows-v .fa.fa-arrows-v
%td= link_to page.title, page_path(page) %td= link_to page.title, page_path(page)
%td= page.mode %td= t "activerecord.attributes.page.modes.#{page.mode}"
%td= truncate_html page.body, 100 %td= truncate_html page.body, 100
%td= page.url_id %td= page.url_id
%td= page.enabled %td= t "humanizers.bool.#{page.enabled}"
%td=localize_datetime page.created_at %td=localize_datetime page.created_at
%td.actions %td.actions
= link_to edit_page_path(page), title: 'Edit', class: 'btn btn-default btn-xs' do = link_to edit_page_path(page), title: 'Edit', class: 'btn btn-default btn-xs' do
......
...@@ -7,21 +7,24 @@ ...@@ -7,21 +7,24 @@
= @page.title = @page.title
%p %p
%strong= model_class.human_attribute_name(:enabled) + ':' %strong= model_class.human_attribute_name(:enabled) + ':'
= @page.enabled = t "humanizers.bool.#{@page.enabled}"
%p %p
%strong= model_class.human_attribute_name(:url_id) + ':' %strong= model_class.human_attribute_name(:url_id) + ':'
= @page.url_id = @page.url_id
%p %p
%strong= model_class.human_attribute_name(:mode) + ':' %strong= model_class.human_attribute_name(:mode) + ':'
= @page.mode = t "activerecord.attributes.page.modes.#{@page.mode}"
-if @page.mode == 'path' -if @page.mode == 'path'
%p %p
%strong= model_class.human_attribute_name(:link) + ':' %strong= model_class.human_attribute_name(:link) + ':'
= link_to @page.link, send(Page.links[@page.link.to_sym]), target: :_blank = link_to t("activerecord.attributes.page.links.#{@page.link}"), send(Page.links[@page.link.to_sym]), target: :_blank
-elsif @page.mode == 'link' -elsif @page.mode == 'link'
%p %p
%strong= model_class.human_attribute_name(:link) + ':' %strong= model_class.human_attribute_name(:link) + ':'
= link_to @page.link, @page.link, target: :_blank = link_to @page.link, @page.link, target: :_blank
-else -else
%p %p
%strong= model_class.human_attribute_name(:body) + ':' %strong= model_class.human_attribute_name(:body) + ':'
......
- model_class = Setting - model_class = Setting
= title(t 'activerecord.models.setting.few')
.page-header .page-header
%h1=t '.title', :default => model_class.model_name.human(count: 2) %h1=t 'activerecord.models.setting.few'
%table.table.table-striped.editable_rows{'data-resource' => model_class.name.underscore} %table.table.table-striped.editable_rows{'data-resource' => model_class.name.underscore}
%thead %thead
%tr %tr
%th= model_class.human_attribute_name(:updated_at) %th.hidden-xs= model_class.human_attribute_name(:updated_at)
%th= model_class.human_attribute_name(:name) %th= model_class.human_attribute_name(:name)
%th= model_class.human_attribute_name(:value) %th= model_class.human_attribute_name(:value)
%th=t '.actions', :default => t("helpers.actions") %th.text-right=t 'helpers.actions'
%tbody %tbody
- @settings.each do |setting| - @settings.each do |setting|
%tr{'data-id' => setting.id} %tr{data:{id: setting.id}}
%td=localize_datetime setting.updated_at %td.hidden-xs=localize_datetime setting.updated_at
%td= setting.name.humanize %td= t "settings.#{setting.name}"
%td{data: :value}= setting.value %td{data: generate_setting_data(setting)}= setting.formatted_value
%td.actions %td.actions
= link_to edit_setting_path(setting), class: 'btn btn-default btn-xs edit' do = link_to edit_setting_path(setting), class: 'btn btn-default btn-xs edit' do
%i.fa.fa-edit %i.fa.fa-edit
This diff is collapsed.
# config valid only for current version of Capistrano # config valid only for current version of Capistrano
lock '3.4.0' lock '3.6.1'
# DEPLOY # DEPLOY
set :application, 'haba_plastics' set :application, 'haba_plastics'
......
...@@ -262,4 +262,9 @@ Devise.setup do |config| ...@@ -262,4 +262,9 @@ Devise.setup do |config|
# When using OmniAuth, Devise cannot automatically set OmniAuth path, # When using OmniAuth, Devise cannot automatically set OmniAuth path,
# so you need to do it manually. For the users scope, it would be: # so you need to do it manually. For the users scope, it would be:
# config.omniauth_path_prefix = '/my_engine/users/auth' # config.omniauth_path_prefix = '/my_engine/users/auth'
#configure devise layouts
Rails.application.config.to_prepare do
Devise::RegistrationsController.layout proc { |controller| account_signed_in? ? 'admin' : 'devise' }
end
end end
...@@ -5,6 +5,8 @@ en: ...@@ -5,6 +5,8 @@ en:
login: Login login: Login
email: Email email: Email
password: Password password: Password
password_confirmation: Password confirmation
current_password: Current password
account: Account account: Account
identifier: Identifier identifier: Identifier
updated_at: Updated at updated_at: Updated at
...@@ -15,6 +17,8 @@ en: ...@@ -15,6 +17,8 @@ en:
image: Image image: Image
description: Description description: Description
subject: Subject subject: Subject
title: Title
keywords: Keywords
meta_keywords: Keywords meta_keywords: Keywords
meta_description: Description meta_description: Description
positions: Positions positions: Positions
...@@ -90,9 +94,10 @@ en: ...@@ -90,9 +94,10 @@ en:
enabled: Active enabled: Active
mode: Mode mode: Mode
modes: modes:
anchor: Anchor page
page: Page
path: Internal link path: Internal link
link: External link link: External link
page: Page
links: links:
main: Home page main: Home page
contact_us: Contact us contact_us: Contact us
...@@ -106,12 +111,19 @@ en: ...@@ -106,12 +111,19 @@ en:
blocks: blocks:
apply_changes: Apply changes? apply_changes: Apply changes?
humanizers:
locale: access:
uk: Укр allowed: Allowed
ru: Рус prohibited: Prohibited
en: Eng 'true': Allowed
de: Ger 'false': Prohibited
bool:
'false': Prohibited
'true': Allowed
locale:
en: Eng
ru: "Рус"
uk: "Укр"
info_box: info_box:
title: Plastic and aesthetic surgery title: Plastic and aesthetic surgery
......
...@@ -5,6 +5,8 @@ ru: ...@@ -5,6 +5,8 @@ ru:
login: Логин login: Логин
email: Електронный адрес email: Електронный адрес
password: Пароль password: Пароль
password_confirmation: Подтверждение пароля
current_password: Текущий пароль
account: Учетная запись account: Учетная запись
identifier: Идентификатор identifier: Идентификатор
updated_at: Обновлено updated_at: Обновлено
...@@ -15,6 +17,8 @@ ru: ...@@ -15,6 +17,8 @@ ru:
image: Изображение image: Изображение
description: Описание description: Описание
subject: Тема subject: Тема
title: Заглавие
keywords: Ключевые слова
meta_keywords: Ключевые слова meta_keywords: Ключевые слова
meta_description: Описание meta_description: Описание
positions: Позиции positions: Позиции
...@@ -90,9 +94,10 @@ ru: ...@@ -90,9 +94,10 @@ ru:
enabled: Активная enabled: Активная
mode: Режим mode: Режим
modes: modes:
anchor: Якорная страница
page: Страница
path: Внутренняя ссылка path: Внутренняя ссылка
link: Внешняя ссылка link: Внешняя ссылка
page: Страница
links: links:
main: Домашняя страница main: Домашняя страница
contact_us: Написать нам contact_us: Написать нам
...@@ -354,12 +359,19 @@ ru: ...@@ -354,12 +359,19 @@ ru:
blocks: blocks:
apply_changes: Применить изменения? apply_changes: Применить изменения?
humanizers:
locale: access:
uk: Укр allowed: "Разрешено"
ru: Рус prohibited: "Запрещено"
en: Eng 'true': "Разрешено"
de: Ger 'false': "Запрещено"
bool:
'false': "Нет"
'true': "Да"
locale:
en: Eng
ru: "Рус"
uk: "Укр"
info_box: info_box:
title: Пластическая и эстетическая хирургия title: Пластическая и эстетическая хирургия
......
...@@ -5,6 +5,8 @@ uk: ...@@ -5,6 +5,8 @@ uk:
login: Логін login: Логін
email: Електронна адреса email: Електронна адреса
password: Пароль password: Пароль
password_confirmation: Підтвердження паролю
current_password: Поточний пароль
account: Обліковий запис account: Обліковий запис
identifier: Ідентифікатор identifier: Ідентифікатор
updated_at: Оновлено updated_at: Оновлено
...@@ -15,6 +17,8 @@ uk: ...@@ -15,6 +17,8 @@ uk:
image: Зображення image: Зображення
description: Опис description: Опис
subject: Тема subject: Тема
title: Заголовок
keywords: Ключові слова
meta_keywords: Ключові слова meta_keywords: Ключові слова
meta_description: Опис meta_description: Опис
positions: Позиції positions: Позиції
...@@ -90,9 +94,10 @@ uk: ...@@ -90,9 +94,10 @@ uk:
enabled: Активна enabled: Активна
mode: Режим mode: Режим
modes: modes:
anchor: Якірна сторінка
page: Сторінка
path: Внутрішнє посилання path: Внутрішнє посилання
link: Зовнішнє посилання link: Зовнішнє посилання
page: Сторінка
links: links:
main: Домашня сторінка main: Домашня сторінка
contact_us: Написати нам contact_us: Написати нам
...@@ -354,12 +359,19 @@ uk: ...@@ -354,12 +359,19 @@ uk:
blocks: blocks:
apply_changes: Застосувати зміни? apply_changes: Застосувати зміни?
humanizers:
locale: access:
uk: Укр allowed: "Дозволeно"
ru: Рус prohibited: "Заборонено"
en: Eng 'true': "Дозволeно"
de: Ger 'false': "Заборонено"
bool:
'false': "Ні"
'true': "Так"
locale:
en: Eng
ru: "Рус"
uk: "Укр"
info_box: info_box:
title: Пластична та естетична хірургія title: Пластична та естетична хірургія
......
...@@ -6,14 +6,8 @@ Rails.application.routes.draw do ...@@ -6,14 +6,8 @@ Rails.application.routes.draw do
mount Ckeditor::Engine => '/ckeditor' mount Ckeditor::Engine => '/ckeditor'
resources :pages resources :pages
resources :settings, only: [:index, :edit, :update] resources :settings, only: [:index, :edit, :update]
resources :images, only: [:show, :edit, :update]
controller :accounts do resources :accounts
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 resources :newsletters
controller :newsletters do controller :newsletters do
get 'newsletters/:id/send' => :sending, as: 'send_newsletter' get 'newsletters/:id/send' => :sending, as: 'send_newsletter'
......
class CreateImages < ActiveRecord::Migration
def change
create_table :images do |t|
t.string :data
t.timestamps null: false
end
end
end
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20160302111301) do ActiveRecord::Schema.define(version: 20160826182357) do
create_table "accounts", force: :cascade do |t| create_table "accounts", force: :cascade do |t|
t.string "email", limit: 255, default: "", null: false t.string "email", limit: 255, default: "", null: false
...@@ -87,6 +87,12 @@ ActiveRecord::Schema.define(version: 20160302111301) do ...@@ -87,6 +87,12 @@ ActiveRecord::Schema.define(version: 20160302111301) do
add_index "ckeditor_assets", ["assetable_type", "assetable_id"], name: "idx_ckeditor_assetable", using: :btree 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 add_index "ckeditor_assets", ["assetable_type", "type", "assetable_id"], name: "idx_ckeditor_assetable_type", using: :btree
create_table "images", force: :cascade do |t|
t.string "data", limit: 255
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "newsletters", force: :cascade do |t| create_table "newsletters", force: :cascade do |t|
t.string "subject", limit: 255 t.string "subject", limit: 255
t.text "text", limit: 65535 t.text "text", limit: 65535
......
...@@ -192,7 +192,7 @@ module ActiveTranslation ...@@ -192,7 +192,7 @@ module ActiveTranslation
end end
end end
def reload def reload(*args)
super super
end end
......
No preview for this file type
require 'test_helper'
class ImagesControllerTest < ActionController::TestCase
def setup
sign_in accounts(:one)
@image = images(:one)
end
test 'should show image' do
get :show, id: @image
assert_response :success
end
test 'should get edit' do
get :edit, id: @image
assert_response :success
end
test 'should update user' do
patch :update, id: @image, image: {data: ''}
assert_response :success
end
end
one:
data: MyString
two:
data: MyString
require 'test_helper'
class ImageTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
...@@ -10,7 +10,7 @@ class ActiveSupport::TestCase ...@@ -10,7 +10,7 @@ class ActiveSupport::TestCase
end end
class ActionController::TestCase class ActionController::TestCase
include Devise::TestHelpers include Devise::Test::ControllerHelpers
def setup def setup
# @request.env["devise.mapping"] = Devise.mappings[:admin] # @request.env["devise.mapping"] = Devise.mappings[:admin]
......
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