padrino-contrib 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of padrino-contrib might be problematic. Click here for more details.
@@ -24,14 +24,20 @@ module Padrino
|
|
24
24
|
def switch_to_lang(lang)
|
25
25
|
request.path_info.sub(/\/#{I18n.locale}/, "/#{lang}") if options.locales.include?(lang)
|
26
26
|
end
|
27
|
+
|
28
|
+
def url(*args)
|
29
|
+
"/#{I18n.locale}#{super}"
|
30
|
+
end
|
27
31
|
end # Helpers
|
28
32
|
|
29
33
|
def self.registered(app)
|
30
34
|
app.helpers Padrino::Contrib::AutoLocale::Helpers
|
31
35
|
app.set :locales, [:en]
|
32
36
|
app.before do
|
33
|
-
if request.path_info =~ /^\/(#{options.locales.join('|')})
|
37
|
+
if request.path_info =~ /^\/(#{options.locales.join('|')})(?=\/|$)/
|
34
38
|
I18n.locale = $1.to_sym
|
39
|
+
request.path_info.sub!(/^\/(#{$1})\/?/) { $2 || '' }
|
40
|
+
request.path_info.replace('/') if request.path_info.empty?
|
35
41
|
else
|
36
42
|
I18n.locale = options.locales.first
|
37
43
|
end
|
@@ -23,8 +23,8 @@ module Padrino
|
|
23
23
|
|
24
24
|
def search(text, options={})
|
25
25
|
if text
|
26
|
-
re
|
27
|
-
where = search_fields.map { |field| "this.#{field}.match(#{re})" }.join(" || ")
|
26
|
+
re = Regexp.new(Regexp.escape(text), 'i')
|
27
|
+
where = search_fields.map { |field| "this.#{field}.match(#{re.inspect})" }.join(" || ")
|
28
28
|
options.merge!("$where" => where)
|
29
29
|
end
|
30
30
|
options.delete(:paginate) ? paginate(options) : all(options)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: padrino-contrib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 25
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Padrino Team
|
@@ -18,7 +18,7 @@ autorequire:
|
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
20
|
|
21
|
-
date:
|
21
|
+
date: 2011-01-26 00:00:00 +01:00
|
22
22
|
default_executable:
|
23
23
|
dependencies: []
|
24
24
|
|
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
77
|
requirements: []
|
78
78
|
|
79
79
|
rubyforge_project: padrino-contrib
|
80
|
-
rubygems_version: 1.
|
80
|
+
rubygems_version: 1.4.2
|
81
81
|
signing_key:
|
82
82
|
specification_version: 3
|
83
83
|
summary: Contributed plugins and utilities for Padrino Framework
|