def cycle!
Logger.info 'Cycling Started...'
packages = yaml_load.unshift(package)
Logger.info "packages.count: #{packages.count}"
excess = packages.count - keep.to_i
Logger.info "excess: #{excess}"
if excess > 0
packages.pop(excess).each do |pkg|
Logger.info "pkg.time: #{pkg.time}"
begin
Logger.info "pkg.no_cycle: #{pkg.no_cycle}"
remove!(pkg) unless pkg.no_cycle
rescue => err
Logger.warn Error.wrap(err, <<-EOS)
There was a problem removing the following package:
Trigger: #{pkg.trigger} :: Dated: #{pkg.time}
Package included the following #{ pkg.filenames.count } file(s):
#{ pkg.filenames.join("\n") }
EOS
end
end
end
yaml_save(packages)
end
[2018/02/15 10:12:26][info] Storing '/var/www/site/backup/2018.02.15.10.12.02/backup.tar.enc'...
[2018/02/15 10:12:27][info] Cycling Started...
[2018/02/15 10:12:27][info] packages.count: 1
[2018/02/15 10:12:27][info] excess: -14
[2018/02/15 10:12:27][info] Storage::Local Finished!
[2018/02/15 10:12:27][info] Cleaning up the package files...
Commands:
backup check # Check for configuration errors or warnings
backup generate:config # Generates the main Backup configuration file
backup generate:model -t, --trigger=TRIGGER # Generates a Backup model file.
backup help [COMMAND] # Describe available commands or one specific...
backup perform -t, --triggers, --trigger=TRIGGER # Performs the backup for the specified trigg...
backup version # Display installed Backup version
Generated configuration file: '/home/deployer/Backup/config.rb'.
# Check for configuration errors or warnings
[2015/12/01 10:45:45][info] Configuration Check Succeeded.
@import 'compass'
@import "compass/utilities/sprites"
$icons-layout:smart
@import "grey/icons/*.png"
@include all-icons-sprites
...
label.boolean.checked:after
@include icons-sprite(ok)
SimpleForm spends a lot of time for trying to translate hints and placeholders for inputs
placeholder: false, hint: false
где только можно. Получил ускорение с 6 секунд до 780ms. get '/настройки', :to=> 'cabinet/user#edit', :as => :edit_user
get '/настройки/:tab', :to=> 'cabinet/user#edit', :as => :edit_user
%h1= @page_title = "Настройки профиля"
- if params[:tab] == "основные"
- @tab = :common
- elsif params[:tab] == "география"
- @tab = :geo
- elsif params[:tab] == "уведомления"
- @tab = :notify
- elsif params[:tab] == "интерфейс"
- @tab = :interface
- else
- @tab = :common
= render partial: "/cabinet/settings/tabs"
= simple_form_for current_user, :url => update_user_path, :html => {:multipart => true} do |f|
- if @tab == :common
= render partial: "/cabinet/settings/form_common", locals: {f: f}
- if @tab == :geo
= render partial: "/cabinet/settings/form_geo", locals: {f: f}
- if @tab == :notify
= render partial: "/cabinet/settings/form_notify", locals: {f: f}
- if @tab == :interface
= render partial: "/cabinet/settings/form_interface", locals: {f: f}
= f.button :submit, "Сохранить изменения"
= hidden_field_tag :tab, params[:tab]
def update
bla(bla(bla))
redirect_to edit_user_path
end
def update
bla(bla(bla))
redirect_to edit_user_path(:tab=>params[:tab])
end
def category_details
@item = Item.new
@item.category = params[:id]
render 'details_form', layout: false
end
<%= simple_form_for @adv do |f| %>
логика, которая в зависимости от @item.category, генерит нужные поля с помощью хелперов simple_form
<% end %>
<i>JavaScript:</i>
$('#поле с выбором категории').change(function(){
$('#item_details').empty();
$.get('/cabinet/category/'+$(this).val()+'/details_form', {},
function(data){
$(data).children("[type != hidden]").appendTo('#item_details');
}
);
});
<% cities = City.all.map{|city| [city.name, city.id]}%>
<%= select_tag(:city_id, options_for_select(cities)) %>
<% for city in cities %>
<%= select_tag("district_id_"+city[1].to_s,
options_for_select(District.where(:city_id => city[1]).map{|d| [d.name, d.id]})) %>
<% end %>
<script>
$("[name ^= district_id]").hide();
$("[name = district_id_1]").show();
$("[name = city_id]").change(function(){
cur_district = $("[name = 'adv[district_id]']");
cur_district.attr("name",cur_district.attr("id"));
$("[name ^= district_id]").hide();
$("[name = district_id_"+$(this).val()+"]").
attr("name","adv[district_id]").show();
});
</script>