fullstack-cms 0.1.14 → 0.1.15
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/app/controllers/admin/settings_controller.rb +2 -2
- data/app/{controllers/admin → helpers}/markdown_helper.rb +0 -0
- data/app/helpers/settings_helper.rb +1 -1
- data/app/models/setting.rb +10 -3
- data/app/views/admin/settings/_collection.html.erb +12 -0
- data/app/views/admin/settings/_form.html.erb +22 -20
- data/config/locales/it.yml +12 -1
- data/fullstack-cms.gemspec +2 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.15
|
File without changes
|
@@ -10,7 +10,7 @@ module SettingsHelper
|
|
10
10
|
namespaced_key = namespaced_key.to_s
|
11
11
|
group, key = namespaced_key.include?(namespace_separator) ? namespaced_key.split(namespace_separator) : [nil, namespaced_key]
|
12
12
|
|
13
|
-
Setting.global("#{key}", :autocreate => (opts[:autocreate].nil? ? true : opts[:autocreate]), :kind => opts[:kind], :default => value, :group => group)
|
13
|
+
Setting.global("#{key}", :autocreate => (opts[:autocreate].nil? ? true : opts[:autocreate]), :kind => opts[:kind], :default => value, :group => group, :options => opts[:options])
|
14
14
|
end
|
15
15
|
|
16
16
|
alias :setting :get_setting
|
data/app/models/setting.rb
CHANGED
@@ -49,8 +49,9 @@ class Setting < ActiveRecord::Base
|
|
49
49
|
kind = opts.delete(:kind) || :string
|
50
50
|
default = opts.delete(:default)
|
51
51
|
group = opts.delete(:group) || "global"
|
52
|
+
options = opts.delete(:options)
|
52
53
|
|
53
|
-
s = autocreate ? self.find_or_create_by_key_and_settable_id(key.to_s, nil, :kind => kind, :"#{kind}_value" => default, :group => group) : self.find_by_key_and_settable_id(key.to_s, nil)
|
54
|
+
s = autocreate ? self.find_or_create_by_key_and_settable_id(key.to_s, nil, :kind => kind, :"#{kind}_value" => default, :group => group, :options => options) : self.find_by_key_and_settable_id(key.to_s, nil)
|
54
55
|
if s
|
55
56
|
s.value || default
|
56
57
|
end
|
@@ -63,7 +64,13 @@ class Setting < ActiveRecord::Base
|
|
63
64
|
s.update_attributes(:value => value)
|
64
65
|
end
|
65
66
|
end
|
66
|
-
|
67
|
-
|
67
|
+
|
68
|
+
field :options, :text
|
69
|
+
serialize :options, Hash
|
70
|
+
|
71
|
+
# after_initialize do |record|
|
72
|
+
# record.options ||= {}
|
73
|
+
# end
|
74
|
+
|
68
75
|
end
|
69
76
|
|
@@ -8,6 +8,18 @@
|
|
8
8
|
@groups[s.group] ||= []
|
9
9
|
@groups[s.group] << s
|
10
10
|
}
|
11
|
+
|
12
|
+
@groups = @groups.to_a
|
13
|
+
|
14
|
+
@groups.sort! do |g1, g2|
|
15
|
+
if g1.first.to_s == "global"
|
16
|
+
-1
|
17
|
+
elsif g2.first.to_s == "global"
|
18
|
+
1
|
19
|
+
else
|
20
|
+
g1.first.to_s <=> g2.first.to_s
|
21
|
+
end
|
22
|
+
end
|
11
23
|
|
12
24
|
nil
|
13
25
|
%>
|
@@ -1,27 +1,29 @@
|
|
1
|
-
|
1
|
+
<% if current_resource.persisted? %>
|
2
2
|
|
3
|
-
<%= f
|
4
|
-
|
5
|
-
|
3
|
+
<%= admin_form_for [:"admin", current_resource], :html => {:multipart => true} do |f| -%>
|
4
|
+
|
5
|
+
<%= f.errors %>
|
6
6
|
|
7
|
-
<%= f.inputs do %>
|
8
|
-
<%= f.input :key %>
|
9
|
-
<%= f.input :kind, :as => "select", :collection => Setting.kinds %>
|
10
|
-
<% end -%>
|
11
|
-
|
12
|
-
<% else %>
|
13
7
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
8
|
+
<%= f.inputs do %>
|
9
|
+
<%= f.input :key, :input_html => {:readonly => true} %>
|
10
|
+
<% if current_resource.kind.to_s == "text" && current_resource.options[:markup] %>
|
11
|
+
<%= f.input :"#{current_resource.kind}_value", :label => t('fullstack.admin.value', :default => "Value"), :as => :markup %>
|
12
|
+
|
13
|
+
<% elsif current_resource.kind.to_s == "text" && current_resource.options[:simple_markup] %>
|
14
|
+
<%= f.input :"#{current_resource.kind}_value", :label => t('fullstack.admin.value', :default => "Value"), :as => :simple_markup %>
|
15
|
+
|
16
|
+
<% else %>
|
17
|
+
<%= f.input :"#{current_resource.kind}_value", :label => t('fullstack.admin.value', :default => "Value") %>
|
18
|
+
|
19
|
+
<% end %>
|
20
|
+
<% end -%>
|
18
21
|
|
19
|
-
|
22
|
+
<%= f.actions do %>
|
23
|
+
<%= f.resource_submit %>
|
24
|
+
<% end %>
|
25
|
+
|
26
|
+
<% end -%>
|
20
27
|
|
21
28
|
|
22
|
-
<%= f.actions do %>
|
23
|
-
<%= f.resource_submit %>
|
24
29
|
<% end %>
|
25
|
-
|
26
|
-
|
27
|
-
<% end -%>
|
data/config/locales/it.yml
CHANGED
@@ -2,4 +2,15 @@ it:
|
|
2
2
|
fullstack:
|
3
3
|
cms:
|
4
4
|
advanced_settings: "Impostazioni avanzate"
|
5
|
-
|
5
|
+
admin:
|
6
|
+
groups:
|
7
|
+
global: "Generale"
|
8
|
+
contacts: "Contatti"
|
9
|
+
|
10
|
+
helpers:
|
11
|
+
label:
|
12
|
+
google_analytics_code: "Codice Google Analytics"
|
13
|
+
site_description: "Descrizione del sito"
|
14
|
+
site_slogan: "Slogan"
|
15
|
+
site_title: "Titolo del sito"
|
16
|
+
value: "Valore"
|
data/fullstack-cms.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "fullstack-cms"
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.15"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["mcasimir"]
|
@@ -22,13 +22,13 @@ Gem::Specification.new do |s|
|
|
22
22
|
"Rakefile",
|
23
23
|
"TODO.md",
|
24
24
|
"VERSION",
|
25
|
-
"app/controllers/admin/markdown_helper.rb",
|
26
25
|
"app/controllers/admin/menus_controller.rb",
|
27
26
|
"app/controllers/admin/pages_controller.rb",
|
28
27
|
"app/controllers/admin/photos_controller.rb",
|
29
28
|
"app/controllers/admin/settings_controller.rb",
|
30
29
|
"app/controllers/admin/tags_controller.rb",
|
31
30
|
"app/controllers/admin/users_controller.rb",
|
31
|
+
"app/helpers/markdown_helper.rb",
|
32
32
|
"app/helpers/menus_helper.rb",
|
33
33
|
"app/helpers/mobile_helper.rb",
|
34
34
|
"app/helpers/pages_helper.rb",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fullstack-cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.15
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -232,13 +232,13 @@ files:
|
|
232
232
|
- Rakefile
|
233
233
|
- TODO.md
|
234
234
|
- VERSION
|
235
|
-
- app/controllers/admin/markdown_helper.rb
|
236
235
|
- app/controllers/admin/menus_controller.rb
|
237
236
|
- app/controllers/admin/pages_controller.rb
|
238
237
|
- app/controllers/admin/photos_controller.rb
|
239
238
|
- app/controllers/admin/settings_controller.rb
|
240
239
|
- app/controllers/admin/tags_controller.rb
|
241
240
|
- app/controllers/admin/users_controller.rb
|
241
|
+
- app/helpers/markdown_helper.rb
|
242
242
|
- app/helpers/menus_helper.rb
|
243
243
|
- app/helpers/mobile_helper.rb
|
244
244
|
- app/helpers/pages_helper.rb
|
@@ -339,7 +339,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
339
339
|
version: '0'
|
340
340
|
segments:
|
341
341
|
- 0
|
342
|
-
hash:
|
342
|
+
hash: -3413477236223765243
|
343
343
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
344
344
|
none: false
|
345
345
|
requirements:
|