fullstack-cms 0.1.14 → 0.1.15

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.14
1
+ 0.1.15
@@ -2,8 +2,8 @@ class Admin::SettingsController < Admin::BaseController
2
2
  respond_to :html, :js
3
3
 
4
4
  def index
5
- @search = Setting.search(params[:search])
6
- @settings = @search.page(params[:page] || 1)
5
+ @skip_filter = true
6
+ @settings = Setting.order("key")
7
7
  end
8
8
 
9
9
  def new
@@ -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
@@ -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
- <%= admin_form_for [:"admin", current_resource], :html => {:multipart => true} do |f| -%>
1
+ <% if current_resource.persisted? %>
2
2
 
3
- <%= f.errors %>
4
-
5
- <% if current_resource.new_record? %>
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
- <%= f.inputs do %>
15
- <%= f.input :key, :input_html => {:readonly => true} %>
16
- <%= f.input :"#{current_resource.kind}_value" %>
17
- <% end -%>
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
- <% end %>
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 -%>
@@ -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"
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "fullstack-cms"
8
- s.version = "0.1.14"
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.14
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: 963209439689046501
342
+ hash: -3413477236223765243
343
343
  required_rubygems_version: !ruby/object:Gem::Requirement
344
344
  none: false
345
345
  requirements: