radiant-tools-extension 0.3 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/radiant_tools/admin_locale.rb +17 -0
- data/lib/radiant_tools/asset_helpers_tags.rb +19 -3
- data/lib/radiant_tools/config.rb +4 -4
- data/lib/radiant_tools/enforce_admin.rb +14 -0
- data/lib/radiant_tools/redis_radiant_store.rb +2 -0
- data/lib/radiant_tools/visibility.rb +9 -0
- data/lib/radiant_tools.rb +1 -1
- data/tools.gemspec +1 -1
- metadata +7 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3
|
1
|
+
0.3.1
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module RadiantTools::AdminLocale
|
2
|
+
def self.init
|
3
|
+
ApplicationController.class_eval do
|
4
|
+
|
5
|
+
def set_user_locale_with_admin
|
6
|
+
if params[:controller].starts_with? 'admin/'
|
7
|
+
set_user_locale_without_admin
|
8
|
+
else
|
9
|
+
I18n.locale = I18n.default_locale
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
alias_method_chain :set_user_locale, :admin
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -32,7 +32,7 @@ module RadiantTools::AssetHelpersTags
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
|
35
|
+
template.send("path_to_#{name}".to_sym, value).inspect
|
36
36
|
end
|
37
37
|
|
38
38
|
desc %{
|
@@ -40,7 +40,7 @@ module RadiantTools::AssetHelpersTags
|
|
40
40
|
<pre><code><r:stylesheet name="stylesheet.css" [media="print"]/></code></pre>
|
41
41
|
}
|
42
42
|
tag "stylesheet" do |tag|
|
43
|
-
|
43
|
+
template.send :stylesheet_link_tag, tag.attr.delete(:name), tag.attr
|
44
44
|
end
|
45
45
|
|
46
46
|
desc %{
|
@@ -48,7 +48,23 @@ module RadiantTools::AssetHelpersTags
|
|
48
48
|
<pre><code><r:javascript name="app.js" [async]/></code></pre>
|
49
49
|
}
|
50
50
|
tag "javascript" do |tag|
|
51
|
-
|
51
|
+
template.send :javascript_include_tag, tag.attr.delete(:name), tag.attr
|
52
52
|
end
|
53
53
|
|
54
|
+
desc %{
|
55
|
+
*Usage:*
|
56
|
+
<pre><code><r:image [name="mage.png"] [field="Small image"]/></code></pre>
|
57
|
+
}
|
58
|
+
tag "image" do |tag|
|
59
|
+
if field_name = tag.attr.delete(:field).presence
|
60
|
+
field = tag.locals.page.field(field_name)
|
61
|
+
name = field.content.presence if field
|
62
|
+
else
|
63
|
+
name = tag.attr.delete(:name).presence
|
64
|
+
end
|
65
|
+
template.send :image_tag, name, tag.attr if name
|
66
|
+
end
|
67
|
+
|
68
|
+
delegate :teplate, :to => :response, :allow_nil => true
|
69
|
+
|
54
70
|
end
|
data/lib/radiant_tools/config.rb
CHANGED
@@ -3,15 +3,15 @@ module RadiantTools
|
|
3
3
|
def self.update(config)
|
4
4
|
config.gem 'rack-rewrite'
|
5
5
|
|
6
|
-
require 'rack-rewrite'
|
7
|
-
|
6
|
+
require 'rack-rewrite'
|
7
|
+
|
8
8
|
config.middleware.insert_before(Rack::Lock, Rack::Rewrite) do
|
9
9
|
r301 %r{^\/(.+?)(?:\/)(\?.+)$}, '/$1$2', :method => 'GET' # redirect action/?query to just action?query
|
10
10
|
r301 %r{^\/([^?]+[^\/])$}, '/$1/', :method => 'GET', :not => /^\/admin\// # add trailing slash instead of removing it
|
11
11
|
end
|
12
12
|
|
13
|
-
config.gem
|
14
|
-
config.gem
|
13
|
+
config.gem 'rack-cache'
|
14
|
+
config.gem 'redis-store'
|
15
15
|
|
16
16
|
config.middleware.use ::Radiant::Cache,
|
17
17
|
:metastore => "redis://#{REDIS}/meta_store",
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module RadiantTools::EnforceAdmin
|
2
|
+
def self.init
|
3
|
+
[Admin::ResourceController, Admin::ConfigurationController].each do |klass|
|
4
|
+
klass.class_eval do
|
5
|
+
prepend_before_filter :enforce_admin!
|
6
|
+
|
7
|
+
protected
|
8
|
+
def enforce_admin!
|
9
|
+
return redirect_to logout_url unless current_user && current_user.admin?
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -17,6 +17,8 @@ module RadiantTools::RedisRadiantStore
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
+
require 'redis-store' unless defined?(Rack::Cache::MetaStore::Redis)
|
21
|
+
|
20
22
|
[Rack::Cache::MetaStore::Redis, Rack::Cache::EntityStore::Redis].each do |klass|
|
21
23
|
klass.class_eval do
|
22
24
|
def initialize(server, options = {})
|
data/lib/radiant_tools.rb
CHANGED
data/tools.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
|
17
17
|
#s.rubyforge_project = "radiant_tools"
|
18
18
|
s.add_dependency 'rack-rewrite', '~> 1.1.0'
|
19
|
-
s.add_dependency 'radiant', '
|
19
|
+
s.add_dependency 'radiant', '>= 0.9.0'
|
20
20
|
|
21
21
|
s.files = `git ls-files`.split("\n")
|
22
22
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: radiant-tools-extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version:
|
5
|
+
version: 0.3.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- mikz
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-05-18 00:00:00 +02:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
requirement: &id002 !ruby/object:Gem::Requirement
|
31
31
|
none: false
|
32
32
|
requirements:
|
33
|
-
- -
|
33
|
+
- - ">="
|
34
34
|
- !ruby/object:Gem::Version
|
35
35
|
version: 0.9.0
|
36
36
|
type: :runtime
|
@@ -58,8 +58,10 @@ files:
|
|
58
58
|
- features/support/env.rb
|
59
59
|
- features/support/paths.rb
|
60
60
|
- lib/radiant_tools.rb
|
61
|
+
- lib/radiant_tools/admin_locale.rb
|
61
62
|
- lib/radiant_tools/asset_helpers_tags.rb
|
62
63
|
- lib/radiant_tools/config.rb
|
64
|
+
- lib/radiant_tools/enforce_admin.rb
|
63
65
|
- lib/radiant_tools/i18n_tags.rb
|
64
66
|
- lib/radiant_tools/i18n_tags/archive_title_tags.rb
|
65
67
|
- lib/radiant_tools/i18n_tags/date_tags.rb
|
@@ -67,6 +69,7 @@ files:
|
|
67
69
|
- lib/radiant_tools/reverse_breadcrumbs_tags.rb
|
68
70
|
- lib/radiant_tools/tag_attributes.rb
|
69
71
|
- lib/radiant_tools/version.rb
|
72
|
+
- lib/radiant_tools/visibility.rb
|
70
73
|
- lib/tasks/radiant_tools_extension_tasks.rake
|
71
74
|
- spec/lib/asset_helpers_spec.rb
|
72
75
|
- spec/lib/i18n_spec.rb
|
@@ -99,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
102
|
requirements: []
|
100
103
|
|
101
104
|
rubyforge_project:
|
102
|
-
rubygems_version: 1.6.
|
105
|
+
rubygems_version: 1.6.2
|
103
106
|
signing_key:
|
104
107
|
specification_version: 3
|
105
108
|
summary: Various tools (method, tags) for Radiant projects
|