fullstack-cms 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/Gemfile.lock +6 -7
- data/VERSION +1 -1
- data/app/controllers/admin/menus_controller.rb +8 -2
- data/app/controllers/admin/pages_controller.rb +6 -1
- data/app/controllers/admin/settings_controller.rb +26 -0
- data/app/helpers/menus_helper.rb +72 -6
- data/app/helpers/settings_helper.rb +5 -4
- data/app/models/menu.rb +6 -5
- data/app/models/setting.rb +31 -9
- data/app/views/admin/menus/_collection.html.erb +27 -0
- data/app/views/admin/pages/_collection.html.erb +23 -14
- data/app/views/admin/settings/_collection.html.erb +48 -29
- data/app/views/admin/settings/_form.html.erb +1 -0
- data/config/locales/it.yml +2 -0
- data/fullstack-cms.gemspec +7 -6
- data/lib/fullstack/cms/configuration.rb +83 -16
- data/lib/fullstack/cms/engine.rb +3 -1
- data/lib/generators/fullstack/cms/templates/rails/app/views/site/_footer.html.erb +8 -1
- data/lib/generators/fullstack/cms/templates/rails/app/views/site/_google_analytics.html.erb +1 -1
- data/lib/generators/fullstack/cms/templates/rails/app/views/site/_head.html.erb +2 -3
- data/lib/generators/fullstack/cms/templates/rails/config/fullstack.rb +51 -0
- metadata +7 -6
- data/lib/generators/fullstack/cms/templates/rails/config/initializers/fullstack.rb +0 -20
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -20,7 +20,7 @@ GEM
|
|
20
20
|
rack-cache (~> 1.2)
|
21
21
|
rack-test (~> 0.6.1)
|
22
22
|
sprockets (~> 2.1.3)
|
23
|
-
active_record_schema (0.5.
|
23
|
+
active_record_schema (0.5.13)
|
24
24
|
rails
|
25
25
|
activemodel (3.2.8)
|
26
26
|
activesupport (= 3.2.8)
|
@@ -66,7 +66,7 @@ GEM
|
|
66
66
|
railties (~> 3.0)
|
67
67
|
thor (~> 0.14)
|
68
68
|
chronic (0.6.7)
|
69
|
-
ckeditor (3.7.
|
69
|
+
ckeditor (3.7.3)
|
70
70
|
mime-types
|
71
71
|
orm_adapter
|
72
72
|
cocaine (0.2.1)
|
@@ -126,7 +126,7 @@ GEM
|
|
126
126
|
remotipart
|
127
127
|
resource-presentation-helpers
|
128
128
|
squeel
|
129
|
-
fullstack-admin (0.1.
|
129
|
+
fullstack-admin (0.1.42)
|
130
130
|
bootstrap-datepicker-rails
|
131
131
|
bootstrap-helpers
|
132
132
|
bootstrap-wysihtml5-rails
|
@@ -165,10 +165,9 @@ GEM
|
|
165
165
|
railties (>= 3.1.0, < 5.0)
|
166
166
|
thor (~> 0.14)
|
167
167
|
json (1.7.4)
|
168
|
-
kaminari (0.
|
168
|
+
kaminari (0.14.0)
|
169
169
|
actionpack (>= 3.0.0)
|
170
170
|
activesupport (>= 3.0.0)
|
171
|
-
railties (>= 3.0.0)
|
172
171
|
kaminari-i18n (0.1.3)
|
173
172
|
rails
|
174
173
|
less (2.2.1)
|
@@ -262,7 +261,7 @@ GEM
|
|
262
261
|
hike (~> 1.2)
|
263
262
|
rack (~> 1.0)
|
264
263
|
tilt (~> 1.1, != 1.3.0)
|
265
|
-
squeel (1.0.
|
264
|
+
squeel (1.0.11)
|
266
265
|
activerecord (~> 3.0)
|
267
266
|
activesupport (~> 3.0)
|
268
267
|
polyamorous (~> 0.5.0)
|
@@ -290,7 +289,7 @@ DEPENDENCIES
|
|
290
289
|
ars-permalink
|
291
290
|
awesome_nested_set
|
292
291
|
bluecloth
|
293
|
-
fullstack-admin (~> 0.1.
|
292
|
+
fullstack-admin (~> 0.1.42)
|
294
293
|
has-attached
|
295
294
|
jeweler
|
296
295
|
rails_i18n_gettext
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.6
|
@@ -2,8 +2,14 @@ class Admin::MenusController < Admin::BaseController
|
|
2
2
|
respond_to :html, :js
|
3
3
|
|
4
4
|
def index
|
5
|
-
@
|
6
|
-
@menus =
|
5
|
+
@skip_filter = true
|
6
|
+
@menus = Menu.order(:uid)
|
7
|
+
|
8
|
+
if Fullstack::Cms.localized?
|
9
|
+
@menus = @menus.where(:locale => params[:locale])
|
10
|
+
@locale = params[:locale]
|
11
|
+
end
|
12
|
+
|
7
13
|
end
|
8
14
|
|
9
15
|
def new
|
@@ -2,7 +2,12 @@ class Admin::PagesController < Admin::BaseController
|
|
2
2
|
respond_to :html, :js
|
3
3
|
|
4
4
|
def index
|
5
|
-
@pages = Page.
|
5
|
+
@pages = Page.order("created_at")
|
6
|
+
if Fullstack::Cms.localized?
|
7
|
+
@pages = @pages.where(:locale => params[:locale])
|
8
|
+
@locale = params[:locale]
|
9
|
+
end
|
10
|
+
|
6
11
|
@skip_filter = true
|
7
12
|
end
|
8
13
|
|
@@ -4,6 +4,32 @@ class Admin::SettingsController < Admin::BaseController
|
|
4
4
|
def index
|
5
5
|
@skip_filter = true
|
6
6
|
@settings = Setting.order("key")
|
7
|
+
|
8
|
+
if Fullstack::Cms.localized?
|
9
|
+
@settings = @settings.where(:locale => params[:locale])
|
10
|
+
@locale = params[:locale]
|
11
|
+
end
|
12
|
+
|
13
|
+
@groups = {}
|
14
|
+
|
15
|
+
@settings.each {|s|
|
16
|
+
@groups[s.group] ||= []
|
17
|
+
@groups[s.group] << s
|
18
|
+
}
|
19
|
+
|
20
|
+
|
21
|
+
@groups = @groups.to_a
|
22
|
+
|
23
|
+
@groups.sort! do |g1, g2|
|
24
|
+
if g1.first.to_s == "global"
|
25
|
+
-1
|
26
|
+
elsif g2.first.to_s == "global"
|
27
|
+
1
|
28
|
+
else
|
29
|
+
g1.first.to_s <=> g2.first.to_s
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
7
33
|
end
|
8
34
|
|
9
35
|
def new
|
data/app/helpers/menus_helper.rb
CHANGED
@@ -1,14 +1,55 @@
|
|
1
1
|
module MenusHelper
|
2
|
+
|
3
|
+
def menu(uid, options = {}, &block)
|
4
|
+
options.reverse_merge({:locale => Fullstack::Cms.localized, :wrap => true})
|
5
|
+
locale = options.delete(:locale)
|
6
|
+
wrap = options.delete(:wrap)
|
7
|
+
wrapper_options = options.delete(:wrapper_html) || {}
|
8
|
+
link_options = options.delete(:link_html) || {}
|
9
|
+
|
10
|
+
menu = fetch_menu!(uid, locale)
|
11
|
+
|
12
|
+
if wrap
|
13
|
+
content_tag :ul, wrapper_options, false do
|
14
|
+
menu_links_for(menu, link_options)
|
15
|
+
end
|
16
|
+
else
|
17
|
+
menu_links_for(menu, link_options)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
def menu_link(link, options = {})
|
23
|
+
options.reverse_merge({:rel => link.nofollow ? "nofollow" : nil})
|
24
|
+
link_to(link.label, menu_link_url(link), options)
|
25
|
+
end
|
26
|
+
|
27
|
+
def menu_link_url(link)
|
28
|
+
link.url.present? ? CGI::escape(link.url) : (link.linked ? page_path_for(link.linked) : "#")
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
# ======================
|
33
|
+
# = Deprecated Methods =
|
34
|
+
# ======================
|
35
|
+
|
36
|
+
def link_url(link)
|
37
|
+
ActiveSupport::Deprecation.warn("This method is deprecated use 'menu_link_url(link)' instead")
|
38
|
+
menu_link_url(link)
|
39
|
+
end
|
2
40
|
|
3
41
|
def find_or_create_menu(uid, locale = nil)
|
42
|
+
ActiveSupport::Deprecation.warn("This method is deprecated use 'menu(uid, :locale => locale_name)' instead")
|
4
43
|
if locale
|
5
44
|
Menu.find_or_create_by_uid_and_locale(uid, locale.to_s, :name => "#{uid}".gsub("-", "_").humanize)
|
6
45
|
else
|
7
46
|
Menu.find_or_create_by_uid(uid, :name => "#{uid}".gsub("-", "_").humanize)
|
8
47
|
end
|
9
48
|
end
|
10
|
-
|
49
|
+
|
11
50
|
def nav_items_for(uid, locale = nil)
|
51
|
+
ActiveSupport::Deprecation.warn("This method is deprecated use 'menu(uid, :locale => locale_name, :wrap => false)' instead")
|
52
|
+
|
12
53
|
menu = find_or_create_menu(uid, locale)
|
13
54
|
html = ""
|
14
55
|
|
@@ -24,13 +65,38 @@ module MenusHelper
|
|
24
65
|
end
|
25
66
|
|
26
67
|
def render_menu(uid, options = nil, &block)
|
68
|
+
ActiveSupport::Deprecation.warn("This method is deprecated use 'menu(uid, :locale => locale_name)' instead")
|
27
69
|
content_tag :ul, nav_items_for(uid, &block), options, false
|
28
|
-
end
|
29
|
-
|
30
|
-
|
31
|
-
def link_url(link)
|
32
|
-
link.url.present? ? CGI::escape(link.url) : (link.linked ? page_path_for(link.linked) : "#")
|
33
70
|
end
|
34
71
|
|
72
|
+
# ===================
|
73
|
+
# = Private Methods =
|
74
|
+
# ===================
|
75
|
+
|
76
|
+
def menu_links_for(menu, link_options = {})
|
77
|
+
|
78
|
+
menu.links.each do |link|
|
79
|
+
unless block_given?
|
80
|
+
html << menu_link(link, link_options)
|
81
|
+
else
|
82
|
+
html << yield(link)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
35
87
|
|
88
|
+
def fetch_menu!(uid, locale)
|
89
|
+
|
90
|
+
query = Menu.where(:uid => uid.to_s)
|
91
|
+
if locale
|
92
|
+
query = query.where(:locale => locale.to_s)
|
93
|
+
end
|
94
|
+
menu = query.first
|
95
|
+
raise "Menu '#{uid}' not found for locale '#{locale}'" if menu.nil?
|
96
|
+
|
97
|
+
menu
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
|
36
102
|
end
|
@@ -2,7 +2,7 @@ module SettingsHelper
|
|
2
2
|
|
3
3
|
# eg.
|
4
4
|
# setting("blog/per_page", 20, :kind => :integer)
|
5
|
-
def
|
5
|
+
def setting(namespaced_key, *args)
|
6
6
|
namespace_separator = "/"
|
7
7
|
|
8
8
|
opts = args.extract_options!
|
@@ -10,10 +10,11 @@ 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 =>
|
13
|
+
s = Setting.global("#{key}", :autocreate => false, :default => value, :group => group, :options => opts[:options], :locale => opts[:locale])
|
14
|
+
|
14
15
|
end
|
15
|
-
|
16
|
-
alias :
|
16
|
+
|
17
|
+
alias :get_setting :setting
|
17
18
|
|
18
19
|
end
|
19
20
|
|
data/app/models/menu.rb
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
class Menu < ActiveRecord::Base
|
2
2
|
include Uid
|
3
3
|
include Localized if Fullstack::Cms.config.localize
|
4
|
-
|
5
|
-
field :name, :string
|
6
4
|
|
7
5
|
has_many :links, :as => :link_owner, :dependent => :delete_all, :order=>'position ASC'
|
8
6
|
accepts_nested_attributes_for :links, :allow_destroy => true
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
|
8
|
+
|
9
|
+
alias_attribute :name, :uid
|
10
|
+
def name
|
11
|
+
I18n.t("fullstack.cms.menus.#{uid}", :default => uid.to_s.humanize)
|
12
|
+
end
|
12
13
|
|
13
14
|
timestamps
|
14
15
|
end
|
data/app/models/setting.rb
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
class Setting < ActiveRecord::Base
|
2
|
+
|
3
|
+
class SettingNotFound < StandardError
|
4
|
+
end
|
5
|
+
|
2
6
|
belongs_to :settable, :polymorphic => true
|
3
7
|
|
8
|
+
include Localized
|
4
9
|
validates_presence_of :key, :kind
|
5
|
-
validates :key, :uniqueness => {:scope => [:settable_id, :settable_type]}
|
10
|
+
validates :key, :uniqueness => {:scope => [:settable_id, :settable_type, :locale]}
|
6
11
|
|
7
12
|
field :key
|
8
13
|
index :key
|
@@ -45,16 +50,33 @@ class Setting < ActiveRecord::Base
|
|
45
50
|
# eg. Setting.global("site-name")
|
46
51
|
|
47
52
|
def self.global(key, opts = {})
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
+
key = key.to_s
|
54
|
+
autocreate = opts.delete(:autocreate)
|
55
|
+
kind = opts.delete(:kind) || :string
|
56
|
+
default = opts.delete(:default)
|
57
|
+
group = (opts.delete(:group) || "global").to_s
|
58
|
+
options = opts.delete(:options)
|
59
|
+
locale = opts.delete(:locale).try(:to_s)
|
53
60
|
|
54
|
-
|
55
|
-
|
56
|
-
|
61
|
+
query = where(:key => key, :group => group, :settable_id => nil)
|
62
|
+
|
63
|
+
if locale
|
64
|
+
query = query.where(:locale => locale)
|
57
65
|
end
|
66
|
+
|
67
|
+
setting = query.first || ( autocreate && create(
|
68
|
+
:key => key,
|
69
|
+
:locale => locale,
|
70
|
+
:kind => kind,
|
71
|
+
:"#{kind}_value" => default,
|
72
|
+
:group => group,
|
73
|
+
:options => options
|
74
|
+
)
|
75
|
+
)
|
76
|
+
|
77
|
+
raise SettingNotFound.new("Setting `#{[group, key].join('/')}` not found for locale `#{locale || 'any'}`") if !setting
|
78
|
+
setting.value || default
|
79
|
+
|
58
80
|
end
|
59
81
|
|
60
82
|
def self.update_global(key, value)
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<% if Fullstack::Cms.localized? %>
|
2
|
+
|
3
|
+
<%= nav :class => "nav-pills" do %>
|
4
|
+
|
5
|
+
<%= content_tag :li, :class => (:active if @locale.blank?) do %>
|
6
|
+
<%= link_to t("fullstack.cms.commons", :default => "Commons"), request.path %>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<% I18n.available_locales.each do |locale| %>
|
10
|
+
<%= content_tag :li, :class => (:active if @locale == locale.to_s) do %>
|
11
|
+
<%= link_to t("locale_names.#{locale}", :default => "#{locale}".humanize), "?locale=#{locale}" %>
|
12
|
+
<% end %>
|
13
|
+
<% end %>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<table class="table table-bordered table-striped">
|
19
|
+
<tr><th><%= t('fullstack.admin.resources.menus', :default => "Menus") %></th><th><%= t('fullstack.admin.actions', :default => "Actions") %></th></tr>
|
20
|
+
<% @menus.each do |content| %>
|
21
|
+
<tr><td>
|
22
|
+
<%= content.name %>
|
23
|
+
</td>
|
24
|
+
<td><%= default_collection_actions_for(content) %></td>
|
25
|
+
</tr>
|
26
|
+
<% end %>
|
27
|
+
</table>
|
@@ -1,17 +1,26 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
1
|
+
<% if Fullstack::Cms.localized? %>
|
2
|
+
|
3
|
+
<%= nav :class => "nav-pills" do %>
|
4
|
+
|
5
|
+
<%= content_tag :li, :class => (:active if @locale.blank?) do %>
|
6
|
+
<%= link_to t("fullstack.cms.commons", :default => "Commons"), request.path %>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<% I18n.available_locales.each do |locale| %>
|
10
|
+
<%= content_tag :li, :class => (:active if @locale == locale.to_s) do %>
|
11
|
+
<%= link_to t("locale_names.#{locale}", :default => "#{locale}".humanize), "?locale=#{locale}" %>
|
12
|
+
<% end %>
|
13
|
+
<% end %>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<% end %>
|
17
|
+
|
14
18
|
|
15
|
-
|
19
|
+
<ul class="nav">
|
20
|
+
<% @pages.roots.each do |root| %>
|
21
|
+
<% Page.each_with_level(root.self_and_descendants) do |page, level| %>
|
22
|
+
<%= nav_item page.name, edit_admin_page_path(page), :icon => (page.root? ? "home" : "file"), :style => "line-height: 36px; padding-left:#{20 * level}px" %>
|
16
23
|
<% end %>
|
17
24
|
<% end %>
|
25
|
+
</ul>
|
26
|
+
|
@@ -1,39 +1,58 @@
|
|
1
1
|
<% if Setting.any? %>
|
2
2
|
|
3
|
-
<%
|
3
|
+
<% if Fullstack::Cms.localized? %>
|
4
|
+
|
5
|
+
<%= nav :class => "nav-pills" do %>
|
6
|
+
|
7
|
+
<%= content_tag :li, :class => (:active if @locale.blank?) do %>
|
8
|
+
<%= link_to t("fullstack.cms.commons", :default => "Commons"), request.path %>
|
9
|
+
<% end %>
|
4
10
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
+
<% I18n.available_locales.each do |locale| %>
|
12
|
+
<%= content_tag :li, :class => (:active if @locale == locale.to_s) do %>
|
13
|
+
<%= link_to t("locale_names.#{locale}", :default => "#{locale}".humanize), "?locale=#{locale}" %>
|
14
|
+
<% end %>
|
15
|
+
<% end %>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<% end %>
|
11
19
|
|
12
|
-
|
20
|
+
<%= tabs :class => "tabs-left" do |t| %>
|
21
|
+
|
22
|
+
<% @groups.each do |g,settings| %>
|
23
|
+
<%= t.pane t(g, :scope => "fullstack.admin.groups", :default => g.to_s.humanize) do %>
|
24
|
+
|
25
|
+
|
26
|
+
<table class="table table-striped table-bordered">
|
27
|
+
<% settings.each do |stg| %>
|
28
|
+
|
29
|
+
<tr>
|
30
|
+
<th style="width: 20%">
|
31
|
+
<%= link_to t(stg.key, :scope => "helpers.label", :default => stg.key.to_s.humanize), [:edit, :admin, stg] %>
|
32
|
+
</th>
|
33
|
+
<td style="width: 10%">
|
34
|
+
<%= locale ? t("locale_names.#{locale}", :default => "#{locale}".humanize) : "-" %>
|
35
|
+
</td>
|
36
|
+
<td>
|
37
|
+
<% if stg.value %>
|
38
|
+
<%= truncate stg.options[:markup] ? "#markup" : "#{stg.value}" %>
|
39
|
+
<% else %>
|
40
|
+
(<%= t('fullstack.cms.empty', :default => "Empty") %>)
|
41
|
+
<% end %>
|
42
|
+
</td>
|
43
|
+
</tr>
|
44
|
+
|
45
|
+
<% end %>
|
46
|
+
</table>
|
47
|
+
|
48
|
+
|
13
49
|
|
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
|
23
|
-
|
24
|
-
nil
|
25
|
-
%>
|
26
|
-
|
27
|
-
<%= tabs do |t| %>
|
28
|
-
|
29
|
-
<% @groups.each do |g,settings| %>
|
30
|
-
<%= t.pane t(g, :scope => "fullstack.admin.groups", :default => g.to_s.humanize) do %>
|
31
|
-
<% settings.each do |stg| %>
|
32
|
-
<p><%= link_to t(stg.key, :scope => "helpers.label", :default => stg.key.to_s.humanize), [:edit, :admin, stg] %></p>
|
33
50
|
<% end %>
|
34
51
|
<% end %>
|
35
|
-
<% end %>
|
36
52
|
|
37
|
-
<% end %>
|
53
|
+
<% end %>
|
38
54
|
|
39
55
|
<% end %>
|
56
|
+
|
57
|
+
|
58
|
+
|
@@ -6,6 +6,7 @@
|
|
6
6
|
|
7
7
|
|
8
8
|
<%= f.inputs do %>
|
9
|
+
<%= f.input :locale, :input_html => {:readonly => true} %>
|
9
10
|
<%= f.input :key, :input_html => {:readonly => true} %>
|
10
11
|
<% if current_resource.kind.to_s == "text" && current_resource.options[:markup] %>
|
11
12
|
<%= f.input :"#{current_resource.kind}_value", :label => t('fullstack.admin.value', :default => "Value"), :as => :markup %>
|
data/config/locales/it.yml
CHANGED
data/fullstack-cms.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "fullstack-cms"
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["mcasimir"]
|
12
|
-
s.date = "2012-09-
|
12
|
+
s.date = "2012-09-04"
|
13
13
|
s.description = "CMS system built on fullstack"
|
14
14
|
s.email = "maurizio.cas@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -58,6 +58,7 @@ Gem::Specification.new do |s|
|
|
58
58
|
"app/views/admin/linkables/_fields.html.erb",
|
59
59
|
"app/views/admin/linkables/fields.js.coffee",
|
60
60
|
"app/views/admin/links/_associated_fields.html.erb",
|
61
|
+
"app/views/admin/menus/_collection.html.erb",
|
61
62
|
"app/views/admin/pages/_collection.html.erb",
|
62
63
|
"app/views/admin/pages/_form.html.erb",
|
63
64
|
"app/views/admin/photos/_photo.html.erb",
|
@@ -101,9 +102,9 @@ Gem::Specification.new do |s|
|
|
101
102
|
"lib/generators/fullstack/cms/templates/rails/app/views/site/_nav.html.erb",
|
102
103
|
"lib/generators/fullstack/cms/templates/rails/app/views/site/_share_buttons_big.html.erb",
|
103
104
|
"lib/generators/fullstack/cms/templates/rails/app/views/site/site/home.html.erb",
|
105
|
+
"lib/generators/fullstack/cms/templates/rails/config/fullstack.rb",
|
104
106
|
"lib/generators/fullstack/cms/templates/rails/config/initializers/devise_controller.rb",
|
105
107
|
"lib/generators/fullstack/cms/templates/rails/config/initializers/devise_mailer.rb",
|
106
|
-
"lib/generators/fullstack/cms/templates/rails/config/initializers/fullstack.rb",
|
107
108
|
"lib/generators/fullstack/cms/templates/rails/config/initializers/sitemap.rb",
|
108
109
|
"lib/generators/fullstack/cms/templates/rails/config/schedule.rb",
|
109
110
|
"lib/generators/fullstack/cms/templates/rails/config/sitemap.rb.tt",
|
@@ -132,7 +133,7 @@ Gem::Specification.new do |s|
|
|
132
133
|
s.specification_version = 3
|
133
134
|
|
134
135
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
135
|
-
s.add_runtime_dependency(%q<fullstack-admin>, ["~> 0.1.
|
136
|
+
s.add_runtime_dependency(%q<fullstack-admin>, ["~> 0.1.42"])
|
136
137
|
s.add_runtime_dependency(%q<ars-permalink>, [">= 0"])
|
137
138
|
s.add_runtime_dependency(%q<has-attached>, [">= 0"])
|
138
139
|
s.add_runtime_dependency(%q<acts-as-taggable-on>, [">= 0"])
|
@@ -145,7 +146,7 @@ Gem::Specification.new do |s|
|
|
145
146
|
s.add_runtime_dependency(%q<bluecloth>, [">= 0"])
|
146
147
|
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
147
148
|
else
|
148
|
-
s.add_dependency(%q<fullstack-admin>, ["~> 0.1.
|
149
|
+
s.add_dependency(%q<fullstack-admin>, ["~> 0.1.42"])
|
149
150
|
s.add_dependency(%q<ars-permalink>, [">= 0"])
|
150
151
|
s.add_dependency(%q<has-attached>, [">= 0"])
|
151
152
|
s.add_dependency(%q<acts-as-taggable-on>, [">= 0"])
|
@@ -159,7 +160,7 @@ Gem::Specification.new do |s|
|
|
159
160
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
160
161
|
end
|
161
162
|
else
|
162
|
-
s.add_dependency(%q<fullstack-admin>, ["~> 0.1.
|
163
|
+
s.add_dependency(%q<fullstack-admin>, ["~> 0.1.42"])
|
163
164
|
s.add_dependency(%q<ars-permalink>, [">= 0"])
|
164
165
|
s.add_dependency(%q<has-attached>, [">= 0"])
|
165
166
|
s.add_dependency(%q<acts-as-taggable-on>, [">= 0"])
|
@@ -1,24 +1,91 @@
|
|
1
|
-
require 'ostruct'
|
2
|
-
|
3
1
|
module Fullstack
|
4
2
|
module Cms
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
3
|
+
|
4
|
+
class Configuration
|
5
|
+
attr_writer :linkables, :localized
|
6
|
+
|
7
|
+
def default_locale
|
8
|
+
"#{I18n.default_locale}" || "en"
|
9
|
+
end
|
10
|
+
|
11
|
+
def localized
|
12
|
+
@localized.nil? ? true : @localized
|
13
|
+
end
|
14
|
+
alias :localize :localized
|
15
|
+
alias :localized? :localized
|
16
|
+
|
17
|
+
|
18
|
+
def linkables
|
19
|
+
@linkables || []
|
20
|
+
end
|
21
|
+
|
22
|
+
def resources(&block)
|
23
|
+
Fullstack::Admin.resources(&block)
|
24
|
+
end
|
25
|
+
|
26
|
+
# config.menu( 'main', :localized => true )
|
27
|
+
#
|
28
|
+
# ...
|
29
|
+
# menu( 'main', :locale => I18n.locale )
|
30
|
+
# menu_items( 'main', :locale => I18n.locale )
|
31
|
+
#
|
32
|
+
#
|
33
|
+
#
|
34
|
+
def menu(uid, options = {})
|
35
|
+
return nil unless Menu.table_exists?
|
36
|
+
options = options.reverse_merge({:localized => localized?})
|
37
|
+
localized_menu = options.delete(:localized)
|
38
|
+
|
39
|
+
if localized_menu && localized? # ignores the option if CMS is not localized
|
40
|
+
I18n.available_locales.each do |locale|
|
41
|
+
m = Menu.find_or_create_by_uid_and_locale(uid.to_s, locale.to_s)
|
42
|
+
raise m.errors.full_messages.join("\n") if m.errors.any?
|
43
|
+
|
44
|
+
end
|
45
|
+
else
|
46
|
+
m = Menu.find_or_create_by_uid(uid.to_s)
|
47
|
+
raise m.errors.full_messages.join("\n") if m.errors.any?
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# config.setting('description', :kind => :text, :localized => true, :group => group)
|
53
|
+
# setting('website/description', :locale => I18n.locale)
|
54
|
+
#
|
55
|
+
def setting(key, options = {})
|
56
|
+
return nil unless Setting.table_exists?
|
57
|
+
|
58
|
+
options = options.reverse_merge({ :localized => localized? }).merge({ :autocreate => true })
|
59
|
+
localized_setting = options.delete(:localized)
|
60
|
+
|
61
|
+
if localized_setting && localized? # ignores the option if CMS is not localized
|
62
|
+
I18n.available_locales.each do |locale|
|
63
|
+
Setting.global(key.to_s, options.merge(:locale => locale.to_s))
|
64
|
+
end
|
65
|
+
else
|
66
|
+
Setting.global(key.to_s, options)
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
end
|
71
|
+
|
14
72
|
end
|
15
|
-
|
73
|
+
|
74
|
+
|
75
|
+
class << self
|
76
|
+
|
77
|
+
def config
|
78
|
+
@config ||= ::Fullstack::Cms::Configuration.new
|
79
|
+
end
|
16
80
|
|
17
|
-
|
18
|
-
|
19
|
-
|
81
|
+
def configure
|
82
|
+
yield(config)
|
83
|
+
config
|
84
|
+
end
|
85
|
+
|
86
|
+
delegate :linkables, :localized, :localized?, :resources, :to => :config
|
87
|
+
|
20
88
|
end
|
21
|
-
module_function :configure
|
22
89
|
|
23
90
|
end
|
24
91
|
end
|
data/lib/fullstack/cms/engine.rb
CHANGED
@@ -1,3 +1,10 @@
|
|
1
1
|
<footer class="footer">
|
2
|
-
|
2
|
+
<address>
|
3
|
+
<strong><%= setting(:title) %></strong>
|
4
|
+
<p><%= simple_format setting("contacts/address") %></p>
|
5
|
+
<p><%= link_to setting("contacts/email"), "mailto:#{setting("contacts/email")}"%><br/>
|
6
|
+
<%= setting("contacts/phone") %>
|
7
|
+
</p>
|
8
|
+
|
9
|
+
</address>
|
3
10
|
</footer>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<script>
|
2
|
-
var _gaq=[['_setAccount','<%=
|
2
|
+
var _gaq=[['_setAccount','<%= setting("google_analytics_code", "UA-xxxxxx-x") %>'],['_trackPageview']];
|
3
3
|
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
|
4
4
|
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
|
5
5
|
s.parentNode.insertBefore(g,s)}(document,'script'));
|
@@ -3,9 +3,8 @@
|
|
3
3
|
<%= yield :meta %>
|
4
4
|
<% else %>
|
5
5
|
<%
|
6
|
-
site_title = get_setting(:
|
7
|
-
site_description = get_setting(:
|
8
|
-
site_slogan = get_setting(:site_slogan) || Settings.app.slogan
|
6
|
+
site_title = get_setting(:title, Settings.app.title)
|
7
|
+
site_description = get_setting(:description, Settings.app.slogan)
|
9
8
|
%>
|
10
9
|
|
11
10
|
<% if home? %>
|
@@ -0,0 +1,51 @@
|
|
1
|
+
Fullstack::Cms.configure do |config|
|
2
|
+
|
3
|
+
# =============
|
4
|
+
# = Resources =
|
5
|
+
# =============
|
6
|
+
|
7
|
+
config.resources do |admin|
|
8
|
+
admin.group :website do |g|
|
9
|
+
g.resource :pages
|
10
|
+
g.resource :menus
|
11
|
+
g.resource :settings
|
12
|
+
end
|
13
|
+
|
14
|
+
admin.group :contents do |g|
|
15
|
+
g.resource :texts
|
16
|
+
g.resource :prices
|
17
|
+
end
|
18
|
+
|
19
|
+
admin.group :users do |g|
|
20
|
+
g.resource :users
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# =============
|
25
|
+
# = Linkables =
|
26
|
+
# =============
|
27
|
+
|
28
|
+
config.linkables = %w(pages texts)
|
29
|
+
|
30
|
+
# =========
|
31
|
+
# = Menus =
|
32
|
+
# =========
|
33
|
+
|
34
|
+
config.menu(:main)
|
35
|
+
|
36
|
+
# ============
|
37
|
+
# = Settings =
|
38
|
+
# ============
|
39
|
+
|
40
|
+
config.setting(:google_analytics_code, :localized => false)
|
41
|
+
config.setting(:facebook_app_id, :localized => false)
|
42
|
+
|
43
|
+
config.setting(:title)
|
44
|
+
config.setting(:slogan)
|
45
|
+
config.setting(:description, :text)
|
46
|
+
|
47
|
+
config.setting(:address, :text, :group => :contacts)
|
48
|
+
config.setting(:phone, :group => :contacts)
|
49
|
+
config.setting(:email, :group => :contacts)
|
50
|
+
|
51
|
+
end
|
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.2.
|
4
|
+
version: 0.2.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fullstack-admin
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.1.
|
21
|
+
version: 0.1.42
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.1.
|
29
|
+
version: 0.1.42
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: ars-permalink
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -252,6 +252,7 @@ files:
|
|
252
252
|
- app/views/admin/linkables/_fields.html.erb
|
253
253
|
- app/views/admin/linkables/fields.js.coffee
|
254
254
|
- app/views/admin/links/_associated_fields.html.erb
|
255
|
+
- app/views/admin/menus/_collection.html.erb
|
255
256
|
- app/views/admin/pages/_collection.html.erb
|
256
257
|
- app/views/admin/pages/_form.html.erb
|
257
258
|
- app/views/admin/photos/_photo.html.erb
|
@@ -295,9 +296,9 @@ files:
|
|
295
296
|
- lib/generators/fullstack/cms/templates/rails/app/views/site/_nav.html.erb
|
296
297
|
- lib/generators/fullstack/cms/templates/rails/app/views/site/_share_buttons_big.html.erb
|
297
298
|
- lib/generators/fullstack/cms/templates/rails/app/views/site/site/home.html.erb
|
299
|
+
- lib/generators/fullstack/cms/templates/rails/config/fullstack.rb
|
298
300
|
- lib/generators/fullstack/cms/templates/rails/config/initializers/devise_controller.rb
|
299
301
|
- lib/generators/fullstack/cms/templates/rails/config/initializers/devise_mailer.rb
|
300
|
-
- lib/generators/fullstack/cms/templates/rails/config/initializers/fullstack.rb
|
301
302
|
- lib/generators/fullstack/cms/templates/rails/config/initializers/sitemap.rb
|
302
303
|
- lib/generators/fullstack/cms/templates/rails/config/schedule.rb
|
303
304
|
- lib/generators/fullstack/cms/templates/rails/config/sitemap.rb.tt
|
@@ -330,7 +331,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
330
331
|
version: '0'
|
331
332
|
segments:
|
332
333
|
- 0
|
333
|
-
hash:
|
334
|
+
hash: 12527057176936080
|
334
335
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
335
336
|
none: false
|
336
337
|
requirements:
|
@@ -1,20 +0,0 @@
|
|
1
|
-
Fullstack::Admin.resources do |admin|
|
2
|
-
|
3
|
-
admin.group :website do |g|
|
4
|
-
g.resource :pages
|
5
|
-
g.resource :menus
|
6
|
-
g.resource :settings
|
7
|
-
end
|
8
|
-
|
9
|
-
admin.group :contents do |g|
|
10
|
-
end
|
11
|
-
|
12
|
-
admin.group :users do |g|
|
13
|
-
g.resource :users
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
|
18
|
-
Fullstack::Cms.configure do |config|
|
19
|
-
config.linkables = %w(pages)
|
20
|
-
end
|