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:
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>
--><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"?>
<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">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_3" default="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="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" />
</component>
</project>
\ No newline at end of file
source 'https://rubygems.org'
gem 'rails', '4.2.5.1'
gem 'rails', '4.2.7.1'
gem 'mysql2'
gem 'uglifier', '>= 1.3.0'
gem 'sass-rails', '~> 5.0'
......@@ -32,7 +32,7 @@ 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', '~> 3.6.1'
gem 'capistrano-faster-assets', '~> 1.0'
gem 'capistrano-bundler'
gem 'capistrano-rvm'
......
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)
actionmailer (4.2.7.1)
actionpack (= 4.2.7.1)
actionview (= 4.2.7.1)
activejob (= 4.2.7.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)
actionpack (4.2.7.1)
actionview (= 4.2.7.1)
activesupport (= 4.2.7.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)
actionview (4.2.7.1)
activesupport (= 4.2.7.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)
activejob (4.2.7.1)
activesupport (= 4.2.7.1)
globalid (>= 0.3.0)
activemodel (4.2.5.1)
activesupport (= 4.2.5.1)
activemodel (4.2.7.1)
activesupport (= 4.2.7.1)
builder (~> 3.1)
activerecord (4.2.5.1)
activemodel (= 4.2.5.1)
activesupport (= 4.2.5.1)
activerecord (4.2.7.1)
activemodel (= 4.2.7.1)
activesupport (= 4.2.7.1)
arel (~> 6.0)
activesupport (4.2.5.1)
activesupport (4.2.7.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)
acts_as_list (0.8.2)
activerecord (>= 3.0)
airbrussh (1.1.1)
sshkit (>= 1.6.1, != 1.7.0)
arel (6.0.3)
autoprefixer-rails (6.3.6)
autoprefixer-rails (6.5.4)
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)
bootstrap-sass (3.3.7)
autoprefixer-rails (>= 5.2.1)
sass (>= 3.3.4)
bootstrap-will_paginate (0.0.10)
......@@ -53,27 +55,31 @@ GEM
bootstrap3-datetimepicker-rails (4.15.35)
momentjs-rails (>= 2.8.1)
builder (3.2.2)
capistrano (3.4.0)
capistrano (3.6.1)
airbrussh (>= 1.0.0)
capistrano-harrow
i18n
rake (>= 10.0.0)
sshkit (~> 1.3)
capistrano-bundler (1.1.4)
sshkit (>= 1.9.0)
capistrano-bundler (1.2.0)
capistrano (~> 3.1)
sshkit (~> 1.2)
capistrano-faster-assets (1.0.2)
capistrano (>= 3.1)
capistrano-rails (1.1.6)
capistrano-harrow (0.5.3)
capistrano-rails (1.2.0)
capistrano (~> 3.1)
capistrano-bundler (~> 1.1)
capistrano-rvm (0.1.2)
capistrano (~> 3.0)
sshkit (~> 1.2)
carrierwave (0.11.0)
carrierwave (0.11.2)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
json (>= 1.7)
mime-types (>= 1.16)
ckeditor (4.1.6)
mimemagic (>= 0.3.0)
ckeditor (4.2.2)
cocaine
orm_adapter (~> 0.5.0)
climate_control (0.0.3)
......@@ -86,23 +92,22 @@ GEM
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.10.0)
coffee-script-source (1.12.2)
commonjs (0.2.7)
concurrent-ruby (1.0.1)
concurrent-ruby (1.0.3)
debug_inspector (0.0.2)
devise (3.5.6)
devise (4.2.0)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5)
railties (>= 4.1.0, < 5.1)
responders
thread_safe (~> 0.1)
warden (~> 1.2.3)
devise-i18n (1.0.1)
devise-i18n (1.1.1)
erubis (2.7.0)
execjs (2.6.0)
font-awesome-rails (4.6.0.0)
execjs (2.7.0)
font-awesome-rails (4.7.0.1)
railties (>= 3.2, < 5.1)
globalid (0.3.6)
globalid (0.3.7)
activesupport (>= 4.1.0)
haml (4.0.7)
tilt
......@@ -118,19 +123,19 @@ GEM
nokogiri (~> 1.6.0)
ruby_parser (~> 3.5)
i18n (0.7.0)
jbuilder (2.4.1)
jbuilder (2.6.1)
activesupport (>= 3.0.0, < 5.1)
multi_json (~> 1.2)
jquery-rails (4.1.1)
jquery-rails (4.2.1)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
jquery-ui-rails (5.0.5)
jquery-ui-rails (6.0.1)
railties (>= 3.2.16)
json (1.8.3)
less (2.6.0)
commonjs (~> 0.2.7)
less-rails (2.7.1)
less-rails (2.8.0)
actionpack (>= 4.0)
less (~> 2.6.0)
sprockets (> 2, < 4)
......@@ -139,39 +144,40 @@ GEM
nokogiri (>= 1.5.9)
mail (2.6.4)
mime-types (>= 1.16, < 4)
mime-types (3.0)
mime-types (3.1)
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)
mime-types-data (3.2016.0521)
mimemagic (0.3.2)
mini_magick (4.6.0)
mini_portile2 (2.1.0)
minitest (5.10.1)
momentjs-rails (2.15.1)
railties (>= 3.1)
multi_json (1.11.2)
mysql2 (0.4.3-x64-mingw32)
mysql2 (0.4.3-x86-mingw32)
multi_json (1.12.1)
mysql2 (0.4.5-x64-mingw32)
mysql2 (0.4.5-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)
net-ssh (3.2.0)
nokogiri (1.6.8.1-x64-mingw32)
mini_portile2 (~> 2.1.0)
nokogiri (1.6.8.1-x86-mingw32)
mini_portile2 (~> 2.1.0)
orm_adapter (0.5.0)
rack (1.6.4)
rack (1.6.5)
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)
rails (4.2.7.1)
actionmailer (= 4.2.7.1)
actionpack (= 4.2.7.1)
actionview (= 4.2.7.1)
activejob (= 4.2.7.1)
activemodel (= 4.2.7.1)
activerecord (= 4.2.7.1)
activesupport (= 4.2.7.1)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.5.1)
railties (= 4.2.7.1)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
......@@ -181,47 +187,47 @@ GEM
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)
railties (4.2.7.1)
actionpack (= 4.2.7.1)
activesupport (= 4.2.7.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)
rake (12.0.0)
rdoc (4.3.0)
responders (2.3.0)
railties (>= 4.2.0, < 5.1)
ruby_parser (3.8.1)
ruby_parser (3.8.3)
sexp_processor (~> 4.1)
sass (3.4.22)
sass-rails (5.0.4)
railties (>= 4.0.0, < 5.0)
sass-rails (5.0.6)
railties (>= 4.0.0, < 6)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
sdoc (0.4.1)
sdoc (0.4.2)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
sexp_processor (4.7.0)
simple_form (3.2.1)
simple_form (3.3.1)
actionpack (> 4, < 5.1)
activemodel (> 4, < 5.1)
sprockets (3.6.0)
sprockets (3.7.0)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.0.4)
sprockets-rails (3.2.0)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sshkit (1.9.0)
sshkit (1.11.5)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
thor (0.19.1)
thor (0.19.4)
thread_safe (0.3.5)
tilt (2.0.2)
turbolinks (2.5.3)
coffee-rails
tilt (2.0.5)
turbolinks (5.0.1)
turbolinks-source (~> 5)
turbolinks-source (5.0.0)
twitter-bootstrap-rails (3.2.2)
actionpack (>= 3.1)
execjs (>= 2.2.2, >= 2.2)
......@@ -229,9 +235,9 @@ GEM
railties (>= 3.1)
tzinfo (1.2.2)
thread_safe (~> 0.1)
tzinfo-data (1.2016.3)
tzinfo-data (1.2016.10)
tzinfo (>= 1.0.0)
uglifier (3.0.0)
uglifier (3.0.4)
execjs (>= 0.3.0, < 3)
warden (1.2.6)
rack (>= 1.0)
......@@ -240,7 +246,7 @@ GEM
binding_of_caller (>= 0.7.2)
railties (>= 4.0)
sprockets-rails (>= 2.0, < 4.0)
will_paginate (3.1.0)
will_paginate (3.1.5)
PLATFORMS
x64-mingw32
......@@ -251,7 +257,7 @@ DEPENDENCIES
bootstrap-sass (~> 3.3.4)
bootstrap-will_paginate
bootstrap3-datetimepicker-rails (~> 4.15.35)
capistrano (~> 3.4)
capistrano (~> 3.6.1)
capistrano-bundler
capistrano-faster-assets (~> 1.0)
capistrano-rails
......@@ -270,7 +276,7 @@ DEPENDENCIES
momentjs-rails (>= 2.9.0)
mysql2
nested_form
rails (= 4.2.5.1)
rails (= 4.2.7.1)
sass-rails (~> 5.0)
sdoc (~> 0.4.0)
simple_form
......@@ -282,4 +288,4 @@ DEPENDENCIES
will_paginate
BUNDLED WITH
1.11.2
1.13.6
//= require jquery-ui/sortable
//= require jquery-ui/widgets/sortable
//= require turbolinks
//= require jquery_nested_form
//= require moment
......
window.linksPanelShowed = false
$(document).on 'ready page:load', ->
$(document).on 'ready page:load turbolinks:load', ->
if window.linksPanelShowed
$('#links_panel').css left: 0
......
$(document).on 'ready page:load', ->
$(document).on 'ready page:load turbolinks:load', ->
init_datetime_picker($('.datetime_picker'))
init_date_picker($('.date_picker'))
......
$(document).on 'ready page:load', ->
$(document).on 'ready page:load turbolinks:load', ->
$('table.editable_rows').each ->
initEditableRows(this)
initCreation(this)
......@@ -18,7 +18,9 @@ initEditableRows = (table) ->
$.ajax
type: $button.data('method')
url: $button.attr('href') + '.json'
success: () -> $row.remove()
success: () ->
$row.remove()
dispatchChangeEvent($table, 'delete')
error: (data) -> setErrors($row, data)
initRowEditing = ($editButton) ->
......@@ -28,7 +30,7 @@ initEditableRows = (table) ->
initControls($controlsCell)
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
event.preventDefault()
save()
......@@ -39,25 +41,47 @@ initEditableRows = (table) ->
save = () ->
clearErrors($row)
data = {}
$row.find('td[data]').each ->
data = {id: $row.data('id')}
$row.find('td[data], td[data-name]').each ->
$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[$table.data('resource')] = data
$.ajax
type: "PUT"
url: window.location.href + "/#{$row.data('id')}.json"
data: ajaxData
success: () -> restoreRow(true)
success: () ->
restoreRow(true)
dispatchChangeEvent($table, 'update')
error: (data) -> setErrors($row, data)
restoreRow = (updated) ->
$controlsCell.html(orygControlHtml)
$row.find('td[data]').each ->
$row.find('td[data], td[data-name]').each ->
$cell = $(this)
$input = $cell.find('input')
$cell.html(if updated then $input.val() else $input.data('undo'))
$input = $cell.find('input, select')
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) ->
event.preventDefault()
......@@ -69,7 +93,7 @@ initCreation = (table) ->
$row = $createButton.closest('tr')
initInputs($row)
$row.find('td[data]').keypress (event) ->
$row.find('td[data], td[data-name]').keypress (event) ->
if event.which == 13
event.preventDefault()
create()
......@@ -83,7 +107,10 @@ initCreation = (table) ->
data = {}
$row.find('td[data]').each ->
$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[$table.data('resource')] = data
$.ajax
......@@ -95,20 +122,36 @@ initCreation = (table) ->
$table.find('tbody').html(newTableBody)
$row.find('input:text').val('')
initEditableRows(table)
dispatchChangeEvent($table, 'create')
error: (data) -> setErrors($row, data)
initInputs = ($row) ->
$row.find('td[data]').each ->
$row.find('td[data], td[data-name]').each ->
$cell = $(this)
value = $cell.html()
$cell.html("<input data-undo='#{value}' value='#{value}'><span class='has-error'/>")
$cell.data('undo', $cell.html())
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) ->
$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('')
$row.find("td[data] span, td[data-name] span").html('')
setErrors = ($row, data) ->
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').change -> refresh_menu_item_fieldset($(this))
......@@ -7,7 +7,7 @@ refresh_menu_item_fieldset = (item) ->
$('#path_fields').hide()
$('#page_fields').hide()
$('#link_fields').show()
else if item.val() == 'page'
else if item.val() == 'page' || item.val() == 'anchor'
$('#path_fields').hide()
$('#page_fields').show()
$('#link_fields').hide()
......
$(document).on 'ready page:load', ->
$(document).on 'ready page:load turbolinks:load', ->
if $('.sort_icon').length
init_sortable('tbody', 'tr')
......
#= require jquery-ui/draggable
#= require jquery-ui/resizable
#= require jquery-ui/widgets/draggable
#= require jquery-ui/widgets/resizable
$ ->
$('#blocks_controls').draggable()
......
$(document).on 'ready page:load', ->
$(document).on 'ready page:load turbolinks:load', ->
initContactUsMessage()
refreshLandingHeader()
......
$(document).on 'ready page:load', ->
$(document).on 'ready page:load turbolinks:load', ->
$(".box_sandwich").click ->
if $('.mobile_menu').hasClass('menu_open')
closeMobileMenu()
......
$(document).on 'ready page:load', ->
$(document).on 'ready page:load turbolinks:load', ->
$('.box_search .search_action').click (e) ->
$('.box_search form').submit()
......
$(document).on 'ready page:load', ->
$(document).on 'ready page:load turbolinks:load', ->
$("a[rel~=popover], .has-popover").popover()
$("a[rel~=tooltip], .has-tooltip").tooltip()
/*
*= require bootstrap-datetimepicker
*= require_directory ./admin
*= require_tree ./admin
*= 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 {
//
// color: #333;
......@@ -31,11 +37,6 @@
// }
//}
//
//div {
// &.field, &.actions {
// margin-bottom: 10px;
// }
//}
//
//#notice {
// 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
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)
@accounts = paginated tabular_filter.add_keys_replacements({email: 'accounts.email', on_hold: 'accounts.on_hold',
admin: 'if(administrators.id is not null, 1, 0)'}).apply(Account.with_admins.order :email)
end
def new
@account = Account.new
end
def show
......@@ -12,6 +16,19 @@ class AccountsController < AdminController
def edit
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
respond_to do |format|
if @account.update(account_params)
......@@ -25,11 +42,16 @@ class AccountsController < AdminController
end
def destroy
redirect_to accounts_url
end
def vacancy
redirect_to accounts_path(vacancy: Vacancy.find(params[:id]).name)
respond_to do |format|
if @account.administrator.nil? || @account.on_hold? || Administrator.active.count > 1
@account.destroy
format.html { redirect_to accounts_url, notice: 'Account was successfully destroyed.' }
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
private
......@@ -58,6 +80,7 @@ class AccountsController < AdminController
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)
params.require(:account).permit(:email, :wallet_address, :on_hold, :referrer_id, :subscribed, :admin,
:password, :password_confirmation)
end
end
......@@ -211,7 +211,7 @@ class TabularFilter
end
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'
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
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
class SettingsController < AdminController
before_action :set_setting, only: [:update, :destroy, :image_form]
# GET /settings
# GET /settings.json
def index
@settings = Setting.init.all
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 }
else
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 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
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable
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
# def self.from_omniauth(auth, current_user, ip_address, referrer_id = nil)
......@@ -36,4 +47,20 @@ class Account < ActiveRecord::Base
# 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
class Administrator < ActiveRecord::Base
include Accounted
scope :active, -> { joins(:account).merge Account.active }
end
class Image < ActiveRecord::Base
mount_uploader :data, ImageUploader
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'
title: {default: 'Blank site', format: :string},
description: {default: 'New blank site - it is stub for future site!', format: :string},
keywords: {default: '', format: :string},
favicon: {default: nil, format: :image},
gse_id: {default: '007392588842326689376:3onw-lza4mc', format: :string},
google_analytics_id: {default: 'UA-63039804-12', format: :string}
}
def self.init
DEFAULTS.keys.each { |name| get(name) }
DEFAULTS.keys.each { |name| get(name)[:default] }
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)
setting.update(value: DEFAULTS[name.to_sym][:default]) if setting.new_record?
setting
end
def self.title
@@title ||= get(:title)
@@title ||= get(:title).real_value
end
def self.description
@@description ||= get(:description)
@@description ||= get(:description).real_value
end
def self.keywords
@@keywords ||= get(:keywords)
@@keywords ||= get(:keywords).real_value
end
def self.favicon
@@favicon ||= get(:favicon).real_value
end
def self.gse_id
@@gse_id ||= get(:gse_id)
@@gse_id ||= get(:gse_id).real_value
end
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
private
......
......@@ -4,6 +4,7 @@
= f.input :password_confirmation
= f.input :subscribed
= f.input :on_hold
= f.input :admin, as: :boolean
= 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
.page-header.refresh_pagination
%h1
= model_class.model_name.human(count: 2)
.pull-right
= link_to 'Newsletter', new_newsletter_path(params), class: 'btn btn-default'
.filtered_pagination
- newsletter_params = tabular_filter.condition.present? ? {newsletter: {recipient_filter: tabular_filter.condition}} : nil
= link_to 'Newsletter', new_newsletter_path(newsletter_params), class: 'btn btn-default'
= 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(:admin)
%th= model_class.human_attribute_name(:created_at)
%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
%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= t "humanizers.bool.#{account.subscribed}"
%td= t "humanizers.bool.#{account.on_hold}"
%td= t "humanizers.bool.#{account.administrator.present?}"
%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
......@@ -32,3 +33,4 @@
class: 'btn btn-xs btn-danger' do
%i.fa.fa-trash
= link_to t('helpers.links.new'), new_account_path, class: 'btn btn-primary'
......@@ -10,10 +10,13 @@
= @account.updated_at
%p
%strong= model_class.human_attribute_name(:subscribed) + ':'
= @account.subscribed
= t "humanizers.bool.#{@account.subscribed}"
%p
%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
%strong= model_class.human_attribute_name(:reset_password_token) + ':'
= @account.reset_password_token
......
.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}"))
%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}")
-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}")
= simple_form_for @image do |f|
= f.file_field :data, accept: 'image/*'
......@@ -4,7 +4,7 @@
%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:site_name', content: 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:type', content: content_for?(:og_type) ? yield(:og_type) : 'website' }
......@@ -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-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'
= favicon_link_tag Setting.favicon.data_url || '/favicon.ico', :rel => 'shortcut icon'
= csrf_meta_tags
-if Rails.env.production? && Setting.google_analytics_id
......
......@@ -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-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'
= favicon_link_tag Setting.favicon.data_url || '/favicon.ico', :rel => 'shortcut icon'
= javascript_include_tag 'shared'
= javascript_include_tag 'ckeditor/init'
= 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 @@
= 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
= 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
= 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
= f.input :link
#page_fields
......
......@@ -18,10 +18,10 @@
%td.sort_icon
.fa.fa-arrows-v
%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= page.url_id
%td= page.enabled
%td= t "humanizers.bool.#{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
......
......@@ -7,21 +7,24 @@
= @page.title
%p
%strong= model_class.human_attribute_name(:enabled) + ':'
= @page.enabled
= t "humanizers.bool.#{@page.enabled}"
%p
%strong= model_class.human_attribute_name(:url_id) + ':'
= @page.url_id
%p
%strong= model_class.human_attribute_name(:mode) + ':'
= @page.mode
= t "activerecord.attributes.page.modes.#{@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
= link_to t("activerecord.attributes.page.links.#{@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) + ':'
......
- model_class = Setting
= title(t 'activerecord.models.setting.few')
.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}
%thead
%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(:value)
%th=t '.actions', :default => t("helpers.actions")
%th.text-right=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
%tr{data:{id: setting.id}}
%td.hidden-xs=localize_datetime setting.updated_at
%td= t "settings.#{setting.name}"
%td{data: generate_setting_data(setting)}= setting.formatted_value
%td.actions
= link_to edit_setting_path(setting), class: 'btn btn-default btn-xs edit' do
%i.fa.fa-edit
This diff is collapsed.
# config valid only for current version of Capistrano
lock '3.4.0'
lock '3.6.1'
# DEPLOY
set :application, 'haba_plastics'
......
......@@ -262,4 +262,9 @@ Devise.setup do |config|
# 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'
#configure devise layouts
Rails.application.config.to_prepare do
Devise::RegistrationsController.layout proc { |controller| account_signed_in? ? 'admin' : 'devise' }
end
end
......@@ -5,6 +5,8 @@ en:
login: Login
email: Email
password: Password
password_confirmation: Password confirmation
current_password: Current password
account: Account
identifier: Identifier
updated_at: Updated at
......@@ -15,6 +17,8 @@ en:
image: Image
description: Description
subject: Subject
title: Title
keywords: Keywords
meta_keywords: Keywords
meta_description: Description
positions: Positions
......@@ -90,9 +94,10 @@ en:
enabled: Active
mode: Mode
modes:
anchor: Anchor page
page: Page
path: Internal link
link: External link
page: Page
links:
main: Home page
contact_us: Contact us
......@@ -106,12 +111,19 @@ en:
blocks:
apply_changes: Apply changes?
locale:
uk: Укр
ru: Рус
en: Eng
de: Ger
humanizers:
access:
allowed: Allowed
prohibited: Prohibited
'true': Allowed
'false': Prohibited
bool:
'false': Prohibited
'true': Allowed
locale:
en: Eng
ru: "Рус"
uk: "Укр"
info_box:
title: Plastic and aesthetic surgery
......
......@@ -5,6 +5,8 @@ ru:
login: Логин
email: Електронный адрес
password: Пароль
password_confirmation: Подтверждение пароля
current_password: Текущий пароль
account: Учетная запись
identifier: Идентификатор
updated_at: Обновлено
......@@ -15,6 +17,8 @@ ru:
image: Изображение
description: Описание
subject: Тема
title: Заглавие
keywords: Ключевые слова
meta_keywords: Ключевые слова
meta_description: Описание
positions: Позиции
......@@ -90,9 +94,10 @@ ru:
enabled: Активная
mode: Режим
modes:
anchor: Якорная страница
page: Страница
path: Внутренняя ссылка
link: Внешняя ссылка
page: Страница
links:
main: Домашняя страница
contact_us: Написать нам
......@@ -354,12 +359,19 @@ ru:
blocks:
apply_changes: Применить изменения?
locale:
uk: Укр
ru: Рус
en: Eng
de: Ger
humanizers:
access:
allowed: "Разрешено"
prohibited: "Запрещено"
'true': "Разрешено"
'false': "Запрещено"
bool:
'false': "Нет"
'true': "Да"
locale:
en: Eng
ru: "Рус"
uk: "Укр"
info_box:
title: Пластическая и эстетическая хирургия
......
......@@ -5,6 +5,8 @@ uk:
login: Логін
email: Електронна адреса
password: Пароль
password_confirmation: Підтвердження паролю
current_password: Поточний пароль
account: Обліковий запис
identifier: Ідентифікатор
updated_at: Оновлено
......@@ -15,6 +17,8 @@ uk:
image: Зображення
description: Опис
subject: Тема
title: Заголовок
keywords: Ключові слова
meta_keywords: Ключові слова
meta_description: Опис
positions: Позиції
......@@ -90,9 +94,10 @@ uk:
enabled: Активна
mode: Режим
modes:
anchor: Якірна сторінка
page: Сторінка
path: Внутрішнє посилання
link: Зовнішнє посилання
page: Сторінка
links:
main: Домашня сторінка
contact_us: Написати нам
......@@ -354,12 +359,19 @@ uk:
blocks:
apply_changes: Застосувати зміни?
locale:
uk: Укр
ru: Рус
en: Eng
de: Ger
humanizers:
access:
allowed: "Дозволeно"
prohibited: "Заборонено"
'true': "Дозволeно"
'false': "Заборонено"
bool:
'false': "Ні"
'true': "Так"
locale:
en: Eng
ru: "Рус"
uk: "Укр"
info_box:
title: Пластична та естетична хірургія
......
......@@ -6,14 +6,8 @@ Rails.application.routes.draw 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 :images, only: [:show, :edit, :update]
resources :accounts
resources :newsletters
controller :newsletters do
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 @@
#
# 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|
t.string "email", limit: 255, default: "", null: false
......@@ -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", "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|
t.string "subject", limit: 255
t.text "text", limit: 65535
......
......@@ -192,7 +192,7 @@ module ActiveTranslation
end
end
def reload
def reload(*args)
super
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
end
class ActionController::TestCase
include Devise::TestHelpers
include Devise::Test::ControllerHelpers
def setup
# @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