settr 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/settr/settings_controller.rb +1 -1
- data/app/helpers/settr/settings_helper.rb +5 -0
- data/app/models/settr_setting.rb +2 -0
- data/app/views/settr/settings/_setting.html.erb +2 -2
- data/lib/generators/settr/install_generator.rb +1 -2
- data/lib/settr.rb +12 -10
- data/lib/settr/version.rb +2 -2
- data/settr.gemspec +4 -4
- data/test/dummy/config/initializers/settr.rb +8 -0
- metadata +19 -17
data/app/models/settr_setting.rb
CHANGED
@@ -25,14 +25,14 @@
|
|
25
25
|
<option value="<%= option %>" <%= 'selected' if object.value == option %> ><%= t("settr.#{object.key}.#{option}") %></option>
|
26
26
|
<% end %>
|
27
27
|
</select>
|
28
|
-
<% end %>
|
28
|
+
<% end %>
|
29
29
|
</div>
|
30
30
|
<% end %>
|
31
31
|
<% else %>
|
32
32
|
<%= content_tag "h#{level}" do %>
|
33
33
|
<%= t("settr.#{key}._title") %>
|
34
34
|
<% end if level > 0 %>
|
35
|
-
<% object.sort_by{|
|
35
|
+
<% object.sort_by{|x, y| "#{y.is_a?(Hash) ? hash_depth(y) : 0} #{x}"}.each do |k, v| %>
|
36
36
|
<%= render :partial => 'setting', :locals => {:object => v, :level => level + 1, :key => "#{key}.#{k}"} %>
|
37
37
|
<% end %>
|
38
38
|
<div class="horizontal_line grey"></div>
|
data/lib/settr.rb
CHANGED
@@ -20,7 +20,7 @@ class Settr
|
|
20
20
|
cattr_accessor :form_class
|
21
21
|
@@form_class
|
22
22
|
|
23
|
-
#links
|
23
|
+
# links
|
24
24
|
cattr_accessor :link_class
|
25
25
|
@@link_class
|
26
26
|
|
@@ -67,17 +67,19 @@ class Settr
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
70
|
+
[:all, :alterable].each do |method|
|
71
|
+
self.define_singleton_method(method) do
|
72
|
+
SettrSetting.send(method).inject({}) do |h, s|
|
73
|
+
kk = s.key.split(".")
|
74
|
+
hh = h
|
75
|
+
kk.each_with_index do |k, i|
|
76
|
+
hh[k] ||= (i == kk.count-1 ? s : {})
|
77
|
+
hh = hh[k]
|
78
|
+
end
|
79
|
+
h
|
77
80
|
end
|
78
|
-
h
|
79
81
|
end
|
80
|
-
end
|
82
|
+
end
|
81
83
|
end
|
82
84
|
|
83
85
|
require 'settr/version'
|
data/lib/settr/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
class Settr
|
2
|
-
VERSION = "0.1.
|
3
|
-
end
|
2
|
+
VERSION = "0.1.2"
|
3
|
+
end
|
data/settr.gemspec
CHANGED
@@ -16,8 +16,8 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.files = `git ls-files`.split("\n")
|
17
17
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
18
|
|
19
|
-
s.add_dependency 'rails',
|
20
|
-
s.add_dependency 'jquery-rails'
|
21
|
-
s.add_dependency 'sass-rails'
|
22
|
-
s.add_dependency 'simple_form',
|
19
|
+
s.add_dependency 'rails', '> 3.1'
|
20
|
+
s.add_dependency 'jquery-rails', '> 1.0'
|
21
|
+
s.add_dependency 'sass-rails', '> 3.1'
|
22
|
+
s.add_dependency 'simple_form', '> 1.5'
|
23
23
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: settr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,52 +9,52 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &70363482946140 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ! '>'
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: '3.1'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70363482946140
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: jquery-rails
|
27
|
-
requirement: &
|
27
|
+
requirement: &70363482945640 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
|
-
- - ! '
|
30
|
+
- - ! '>'
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '0'
|
32
|
+
version: '1.0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70363482945640
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: sass-rails
|
38
|
-
requirement: &
|
38
|
+
requirement: &70363482945180 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
|
-
- - ! '
|
41
|
+
- - ! '>'
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: '
|
43
|
+
version: '3.1'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70363482945180
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: simple_form
|
49
|
-
requirement: &
|
49
|
+
requirement: &70363482944700 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ! '>'
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.5'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70363482944700
|
58
58
|
description: Settr is a hierarchical key-value based storage for configuration settings
|
59
59
|
in Rails apps
|
60
60
|
email:
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- test/dummy/config/initializers/mime_types.rb
|
119
119
|
- test/dummy/config/initializers/secret_token.rb
|
120
120
|
- test/dummy/config/initializers/session_store.rb
|
121
|
+
- test/dummy/config/initializers/settr.rb
|
121
122
|
- test/dummy/config/initializers/wrap_parameters.rb
|
122
123
|
- test/dummy/config/locales/de.yml
|
123
124
|
- test/dummy/config/locales/en.yml
|
@@ -162,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
163
|
version: '0'
|
163
164
|
requirements: []
|
164
165
|
rubyforge_project: settr
|
165
|
-
rubygems_version: 1.8.
|
166
|
+
rubygems_version: 1.8.10
|
166
167
|
signing_key:
|
167
168
|
specification_version: 3
|
168
169
|
summary: hierarchical key-value based storage for configuration settings in Rails
|
@@ -193,6 +194,7 @@ test_files:
|
|
193
194
|
- test/dummy/config/initializers/mime_types.rb
|
194
195
|
- test/dummy/config/initializers/secret_token.rb
|
195
196
|
- test/dummy/config/initializers/session_store.rb
|
197
|
+
- test/dummy/config/initializers/settr.rb
|
196
198
|
- test/dummy/config/initializers/wrap_parameters.rb
|
197
199
|
- test/dummy/config/locales/de.yml
|
198
200
|
- test/dummy/config/locales/en.yml
|