bhf 0.6.30 → 0.6.31
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bhf/pagination.rb +1 -14
- data/lib/bhf.rb +0 -4
- metadata +2 -3
- data/lib/bhf/i18n.rb +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 976dfde5e8a7c82ea3f5e4b3a7cace53307756ae
|
4
|
+
data.tar.gz: 53f47faee8b830cf8dff6f3a23a48377ac407d32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a63f014fc74e673aa2fde205cc903b3ff710227925f2809e4e238c751ac97e4d12de801ea2dd78eff035b3b8ada57e7541537c89f11e7dd12528ead7fd7428a0
|
7
|
+
data.tar.gz: 1f15c6a9dd2bc8f255db56d90a2027ccb3691ae8a5a368f9a9bd8491be87bede76e34b1c03d2397e277cb3ebb5ab840ac47e414c4e64c022862daaa1bd32acbb
|
data/lib/bhf/pagination.rb
CHANGED
@@ -1,16 +1,3 @@
|
|
1
|
-
Kaminari::Helpers::Tag.class_eval do
|
2
|
-
def page_url_for(page)
|
3
|
-
if @param_name.is_a?(Array)
|
4
|
-
@params[@param_name[0]] = (@params[@param_name[0]] || {}).merge(@param_name[1] => (page <= 1 ? nil : page))
|
5
|
-
return @template.url_for @params
|
6
|
-
end
|
7
|
-
|
8
|
-
@template.url_for @params.merge(@param_name => (page <= 1 ? nil : page))
|
9
|
-
end
|
10
|
-
end
|
11
|
-
# TODO: check for support here https://github.com/amatsuda/kaminari/pull/491
|
12
|
-
|
13
|
-
|
14
1
|
module Bhf
|
15
2
|
|
16
3
|
class Pagination
|
@@ -28,7 +15,7 @@ module Bhf
|
|
28
15
|
|
29
16
|
links = if !(page_links = template.paginate(platform.objects, {
|
30
17
|
theme: 'bhf',
|
31
|
-
param_name:
|
18
|
+
param_name: "#{platform.name}[page]",
|
32
19
|
params: template.params
|
33
20
|
})).blank?
|
34
21
|
"#{load_more(platform)} #{page_links}"
|
data/lib/bhf.rb
CHANGED
@@ -29,9 +29,6 @@ module Bhf
|
|
29
29
|
end
|
30
30
|
|
31
31
|
initializer 'bhf.hooks' do
|
32
|
-
if defined?(::I18n)
|
33
|
-
::I18n.send :include, Bhf::I18nTranslationFallbackHelper
|
34
|
-
end
|
35
32
|
if defined?(::ActiveRecord)
|
36
33
|
::ActiveRecord::Base.send :include, Bhf::ActiveRecord::Object
|
37
34
|
end
|
@@ -42,7 +39,6 @@ module Bhf
|
|
42
39
|
end
|
43
40
|
end
|
44
41
|
|
45
|
-
require 'bhf/i18n'
|
46
42
|
require 'bhf/active_record/active_record'
|
47
43
|
require 'bhf/active_record/upload'
|
48
44
|
require 'bhf/mongoid/document'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bhf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.31
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Pawlik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -207,7 +207,6 @@ files:
|
|
207
207
|
- lib/bhf/active_record/upload.rb
|
208
208
|
- lib/bhf/data.rb
|
209
209
|
- lib/bhf/form.rb
|
210
|
-
- lib/bhf/i18n.rb
|
211
210
|
- lib/bhf/mongoid/document.rb
|
212
211
|
- lib/bhf/pagination.rb
|
213
212
|
- lib/bhf/platform.rb
|
data/lib/bhf/i18n.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
# TODO: get rid of this
|
2
|
-
module Bhf
|
3
|
-
module I18nTranslationFallbackHelper
|
4
|
-
def self.included(base)
|
5
|
-
base.module_eval do
|
6
|
-
class << self
|
7
|
-
def translate_with_fallback(text, options = {})
|
8
|
-
return translate_without_fallback(text, options) unless text.to_s.split('.')[0] == 'bhf'
|
9
|
-
|
10
|
-
default = options.delete(:default)
|
11
|
-
|
12
|
-
[locale, :en].each do |lookup_locale|
|
13
|
-
translation_found, translation = attempt_translation(text, options.merge(locale: lookup_locale))
|
14
|
-
return translation if translation_found
|
15
|
-
end
|
16
|
-
|
17
|
-
# Ensure 'translation missing' return is exactly the default behaviour
|
18
|
-
translate_without_fallback(text, options.merge(default: default))
|
19
|
-
end
|
20
|
-
|
21
|
-
def attempt_translation(text, options = {})
|
22
|
-
puts "Attempting translation of '#{text}' with locale '#{options[:locale]}'." if options[:debug]
|
23
|
-
translation = translate_without_fallback(text, options.merge(raise: true))
|
24
|
-
translation_found = options[:locale]
|
25
|
-
rescue I18n::MissingTranslationData
|
26
|
-
translation_found = nil
|
27
|
-
translation = "translation missing: #{options[:locale]}, #{text}"
|
28
|
-
ensure
|
29
|
-
return translation_found, translation
|
30
|
-
end
|
31
|
-
|
32
|
-
alias_method_chain :translate, :fallback
|
33
|
-
alias_method :t, :translate_with_fallback
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|