Registrar refactor fixes

This commit is contained in:
Priit Tark 2015-04-10 10:58:51 +03:00
parent d09855bc6d
commit 9bb20365c9
15 changed files with 46 additions and 57 deletions

View file

@ -1,2 +0,0 @@
module CurrentUserHelper
end

View file

@ -1,29 +0,0 @@
module Depp
module ApplicationHelper
def unstable_env
return nil if Rails.env.production?
Rails.env
end
def env_style
return '' if unstable_env.nil?
"background-image: url(#{image_path("depp/bg-#{unstable_env}.png")});"
end
def ident_for(contact)
case contact.ident_type
when 'birthday'
"#{contact.ident} [#{contact.ident_type}]"
else
"#{contact.ident} [#{contact.ident_country_code} #{contact.ident_type}]"
end
end
def pagination_details
params[:page] ||= 1
limit = ENV['depp_records_on_page'] || 20
offset = ((params[:page].to_i - 1) * limit.to_i)
[limit, offset]
end
end
end

View file

@ -0,0 +1,15 @@
module Registrar
module ApplicationHelper
def env_style
return '' if unstable_env.nil?
"background-image: url(#{image_path("registrar/bg-#{unstable_env}.png")});"
end
def pagination_details
params[:page] ||= 1
limit = ENV['depp_records_on_page'] || 20
offset = ((params[:page].to_i - 1) * limit.to_i)
[limit, offset]
end
end
end