padrino-contrib 0.1.12 → 0.1.13
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,6 +24,7 @@ module Padrino
|
|
24
24
|
app.set :exceptions_to, "errors@localhost.local" unless app.respond_to?(:exceptions_to)
|
25
25
|
app.set :exceptions_from, "foo@bar.local" unless app.respond_to?(:exceptions_from)
|
26
26
|
app.set :exceptions_layout, :layout unless app.respond_to?(:exceptions_layout)
|
27
|
+
app.set :exceptions_views, app.views unless app.respond_to?(:exceptions_views)
|
27
28
|
app.set :redmine, {} unless app.respond_to?(:redmine)
|
28
29
|
app.error 500 do
|
29
30
|
boom = env['sinatra.error']
|
@@ -42,12 +43,12 @@ module Padrino
|
|
42
43
|
end
|
43
44
|
response.status = 500
|
44
45
|
content_type 'text/html', :charset => "utf-8"
|
45
|
-
render settings.exceptions_page, :layout => settings.exceptions_layout
|
46
|
+
render settings.exceptions_page, :layout => settings.exceptions_layout, :views => settings.exceptions_views
|
46
47
|
end
|
47
48
|
app.error 404 do
|
48
49
|
response.status = 404
|
49
50
|
content_type 'text/html', :charset => "utf-8"
|
50
|
-
render settings.exceptions_page, :layout => settings.exceptions_layout
|
51
|
+
render settings.exceptions_page, :layout => settings.exceptions_layout, :views => settings.exceptions_views
|
51
52
|
end
|
52
53
|
end # self.registered
|
53
54
|
end # ExceptionNotifier
|
@@ -22,7 +22,7 @@ module Padrino
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def javascript_include_tag_jquery(options={})
|
25
|
-
libs = ["http://ajax.googleapis.com/ajax/libs/jquery
|
25
|
+
libs = ["http://ajax.googleapis.com/ajax/libs/jquery/#{options[:version] || '1.7.1'}/jquery.min.js"]
|
26
26
|
|
27
27
|
if options.delete(:ui)
|
28
28
|
libs << "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.min.js"
|
@@ -17,8 +17,8 @@ module Padrino
|
|
17
17
|
module ClassMethods
|
18
18
|
def has_i18n_permalink(field, options={})
|
19
19
|
include InstanceMethods
|
20
|
-
|
21
|
-
|
20
|
+
@@_i18n_permalink_field = field
|
21
|
+
@@_i18n_permalink_langs = options.delete(:langs)
|
22
22
|
before_save :generate_i18n_permalinks
|
23
23
|
i18n_permalink_langs.each do |lang|
|
24
24
|
validates_uniqueness_of :"#{field}_#{lang}", options
|
@@ -26,6 +26,7 @@ module Padrino
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def i18n_permalink_for(name)
|
29
|
+
require 'iconv' unless defined?(Iconv)
|
29
30
|
name = Iconv.iconv('ascii//translit//IGNORE', 'utf-8', name).to_s
|
30
31
|
name.gsub!(/\W+/, ' ') # non-words to space
|
31
32
|
name.strip!
|
@@ -35,11 +36,11 @@ module Padrino
|
|
35
36
|
end
|
36
37
|
|
37
38
|
def i18n_permalink_field
|
38
|
-
|
39
|
+
@@_i18n_permalink_field
|
39
40
|
end
|
40
41
|
|
41
42
|
def i18n_permalink_langs
|
42
|
-
|
43
|
+
@@_i18n_permalink_langs
|
43
44
|
end
|
44
45
|
end
|
45
46
|
|
@@ -50,8 +51,8 @@ module Padrino
|
|
50
51
|
|
51
52
|
protected
|
52
53
|
def generate_i18n_permalinks
|
53
|
-
|
54
|
-
self.send(:"permalink_#{lang}=",
|
54
|
+
singleton_class.i18n_permalink_langs.each do |lang|
|
55
|
+
self.send(:"permalink_#{lang}=", singleton_class.i18n_permalink_for(read_attribute(:"#{singleton_class.i18n_permalink_field}_#{lang}")))
|
55
56
|
end
|
56
57
|
end
|
57
58
|
end # InstanceMethods
|
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:
|
4
|
+
hash: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 13
|
10
|
+
version: 0.1.13
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Davide D'Agostino
|
@@ -17,8 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date:
|
21
|
-
default_executable:
|
20
|
+
date: 2012-02-14 00:00:00 Z
|
22
21
|
dependencies: []
|
23
22
|
|
24
23
|
description: Contributed plugins and utilities for the Padrino Ruby Web Framework
|
@@ -52,7 +51,6 @@ files:
|
|
52
51
|
- padrino-contrib.gemspec
|
53
52
|
- spec/autoload_spec.rb
|
54
53
|
- spec/spec_helper.rb
|
55
|
-
has_rdoc: true
|
56
54
|
homepage: http://www.padrinorb.com
|
57
55
|
licenses: []
|
58
56
|
|
@@ -82,10 +80,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
80
|
requirements: []
|
83
81
|
|
84
82
|
rubyforge_project: padrino-contrib
|
85
|
-
rubygems_version: 1.
|
83
|
+
rubygems_version: 1.8.15
|
86
84
|
signing_key:
|
87
85
|
specification_version: 3
|
88
86
|
summary: Contributed plugins and utilities for Padrino Framework
|
89
87
|
test_files:
|
90
88
|
- spec/autoload_spec.rb
|
91
89
|
- spec/spec_helper.rb
|
90
|
+
has_rdoc:
|