spree-cms 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/admin/content_categories_controller.rb +4 -0
- data/app/controllers/admin/content_category_localizations_controller.rb +30 -0
- data/app/controllers/admin/content_part_localizations_controller.rb +36 -0
- data/app/controllers/cms/aliases_controller.rb +20 -0
- data/app/controllers/cms/content_categories_controller.rb +9 -0
- data/app/controllers/cms/content_parts_controller.rb +8 -0
- data/app/models/content_category.rb +1 -0
- data/app/models/content_category_localization.rb +8 -0
- data/app/models/content_image.rb +3 -3
- data/app/models/content_part.rb +4 -3
- data/app/models/content_part_localization.rb +54 -0
- data/app/views/admin/content_categories/edit.html.erb +17 -0
- data/app/views/admin/content_categories/index.html.erb +1 -1
- data/app/views/admin/content_category_localizations/_form.html.erb +11 -0
- data/app/views/admin/content_category_localizations/_index.html.erb +16 -0
- data/app/views/admin/content_category_localizations/edit.html.erb +8 -0
- data/app/views/admin/content_category_localizations/new.html.erb +8 -0
- data/app/views/admin/content_part_localizations/_form.html.erb +52 -0
- data/app/views/admin/content_part_localizations/_index.html.erb +16 -0
- data/app/views/admin/content_part_localizations/edit.html.erb +8 -0
- data/app/views/admin/content_part_localizations/new.html.erb +8 -0
- data/app/views/admin/content_parts/edit.html.erb +3 -1
- data/app/views/admin/content_parts/new.html.erb +1 -1
- data/app/views/cms/content_categories/_content_category_default.html.erb +3 -0
- data/app/views/cms/content_categories/show.html.erb +19 -0
- data/app/views/cms/content_parts/_content_part_default.html.erb +8 -0
- data/app/views/cms/content_parts/show.html.erb +2 -0
- data/config/locales/de.content_categories.yml +2 -0
- data/config/locales/de.content_parts.yml +2 -0
- data/config/routes.rb +10 -20
- data/db/migrate/0007_create_content_part_localizations.rb +19 -0
- data/db/migrate/0008_create_content_categorie_localizations.rb +15 -0
- data/db/migrate/0009_make_content_image_polymorph.rb +26 -0
- data/lib/cms.rb +2 -2
- metadata +32 -3
@@ -6,6 +6,10 @@ class Admin::ContentCategoriesController < Admin::BaseController
|
|
6
6
|
@new_category = ContentCategory.new
|
7
7
|
end
|
8
8
|
|
9
|
+
edit.before do
|
10
|
+
@content_category = ContentCategory.find(params[:id])
|
11
|
+
end
|
12
|
+
|
9
13
|
create do
|
10
14
|
wants.html { redirect_to admin_content_categories_path }
|
11
15
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class Admin::ContentCategoryLocalizationsController < Admin::BaseController
|
2
|
+
resource_controller :belongs_to => :content_category
|
3
|
+
|
4
|
+
new_action.before do
|
5
|
+
@content_category = ContentCategory.find(params[:content_category_id])
|
6
|
+
@content_category_localization = @content_category.localizations.new
|
7
|
+
end
|
8
|
+
|
9
|
+
create.before do
|
10
|
+
@content_category = ContentCategory.find(params[:content_category_id])
|
11
|
+
@content_category_localization.content_category = @content_category
|
12
|
+
end
|
13
|
+
|
14
|
+
destroy.before do
|
15
|
+
@content_category = ContentCategory.find(params[:content_category_id])
|
16
|
+
end
|
17
|
+
|
18
|
+
update.before do
|
19
|
+
@content_category = ContentCategory.find(params[:content_category_id])
|
20
|
+
end
|
21
|
+
|
22
|
+
edit.before do
|
23
|
+
@content_category = ContentCategory.find(params[:content_category_id])
|
24
|
+
@content_category_localization = @content_category.localizations.find(params[:id])
|
25
|
+
end
|
26
|
+
|
27
|
+
create.wants.html { redirect_to edit_admin_content_category_path(@content_category) }
|
28
|
+
update.wants.html { redirect_to edit_admin_content_category_path(@content_category) }
|
29
|
+
destroy.wants.html { redirect_to edit_admin_content_category_path(@content_category) }
|
30
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class Admin::ContentPartLocalizationsController < Admin::BaseController
|
2
|
+
resource_controller :belongs_to => :content_category
|
3
|
+
|
4
|
+
new_action.before do
|
5
|
+
@content_part = ContentPart.find(params[:content_part_id])
|
6
|
+
@content_part_localization = @content_part.localizations.new
|
7
|
+
end
|
8
|
+
|
9
|
+
create.before do
|
10
|
+
@content_part = ContentPart.find(params[:content_part_id])
|
11
|
+
@content_part_localization.content_part = @content_part
|
12
|
+
end
|
13
|
+
|
14
|
+
destroy.before do
|
15
|
+
@content_part = ContentPart.find(params[:content_part_id])
|
16
|
+
end
|
17
|
+
|
18
|
+
update.before do
|
19
|
+
@content_part = ContentPart.find(params[:content_part_id])
|
20
|
+
end
|
21
|
+
|
22
|
+
edit.before do
|
23
|
+
@content_part = ContentPart.find(params[:content_part_id])
|
24
|
+
@content_part_localization = @content_part.localizations.find(params[:id])
|
25
|
+
end
|
26
|
+
|
27
|
+
create.wants.html { redirect_to edit_admin_content_category_content_part_path(@content_part.category, @content_part) }
|
28
|
+
update.wants.html { redirect_to edit_admin_content_category_content_part_path(@content_part.category, @content_part) }
|
29
|
+
destroy.wants.html { redirect_to edit_admin_content_category_content_part_path(@content_part.category, @content_part) }
|
30
|
+
|
31
|
+
#protected
|
32
|
+
#
|
33
|
+
#def parent_association
|
34
|
+
# @parent_association ||= parent_object.content_parts
|
35
|
+
#end
|
36
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# dynamically do the permalink -> content_part or content_category routing
|
2
|
+
class Cms::AliasesController < ApplicationController
|
3
|
+
def show
|
4
|
+
|
5
|
+
category = ContentCategory.find_by_permalink(params[:name])
|
6
|
+
part = ContentPart.find_by_permalink(params[:name])
|
7
|
+
|
8
|
+
if category
|
9
|
+
render_component(:controller => "content_category",
|
10
|
+
:action => "show",
|
11
|
+
:id => category.id)
|
12
|
+
elsif part
|
13
|
+
render_component(:controller => "content_part",
|
14
|
+
:action => "show",
|
15
|
+
:id => part.id)
|
16
|
+
else
|
17
|
+
render :file => "#{RAILS_ROOT}/public/404.html", :status => :not_found
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -5,6 +5,7 @@ class ContentCategory < ActiveRecord::Base
|
|
5
5
|
before_save :update_permalink
|
6
6
|
|
7
7
|
has_many :content_parts, :foreign_key => 'category_id', :dependent => :nullify
|
8
|
+
has_many :localizations, :class_name => "ContentCategoryLocalization", :dependent => :destroy
|
8
9
|
|
9
10
|
named_scope :by_name, lambda { |name| { :conditions => { :name => name}}}
|
10
11
|
|
data/app/models/content_image.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
class ContentImage < ActiveRecord::Base
|
2
2
|
|
3
|
-
belongs_to :content_part
|
3
|
+
belongs_to :content_part, :polymorphic => true
|
4
4
|
|
5
|
-
belongs_to :content_part_as_overlay_image, :foreign_key => 'content_part_as_overlay_id'
|
5
|
+
belongs_to :content_part_as_overlay_image, :foreign_key => 'content_part_as_overlay_id', :polymorphic => true
|
6
6
|
|
7
7
|
has_attached_file :image,
|
8
8
|
:styles => { :medium => "167x250>" }
|
9
9
|
|
10
|
-
end
|
10
|
+
end
|
data/app/models/content_part.rb
CHANGED
@@ -6,10 +6,11 @@ class ContentPart < ActiveRecord::Base
|
|
6
6
|
|
7
7
|
belongs_to :user
|
8
8
|
belongs_to :category, :class_name => 'ContentCategory', :foreign_key => 'category_id'
|
9
|
+
has_many :localizations, :class_name => "ContentPartLocalization", :dependent => :destroy
|
9
10
|
|
10
11
|
# for use as a post/summary post in conjunction with the excerpt
|
11
|
-
has_one :image, :class_name => 'ContentImage', :dependent => :destroy
|
12
|
-
has_one :image_overlay, :foreign_key => "content_part_as_overlay_id", :class_name => 'ContentImage', :dependent => :destroy
|
12
|
+
has_one :image, :class_name => 'ContentImage', :dependent => :destroy, :as => :content_part
|
13
|
+
has_one :image_overlay, :foreign_key => "content_part_as_overlay_id", :class_name => 'ContentImage', :dependent => :destroy, :as => :content_part_as_overlay
|
13
14
|
|
14
15
|
default_scope :order => 'weight ASC, created_at DESC'
|
15
16
|
|
@@ -55,4 +56,4 @@ class ContentPart < ActiveRecord::Base
|
|
55
56
|
""
|
56
57
|
end
|
57
58
|
end
|
58
|
-
end
|
59
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
class ContentPartLocalization < ActiveRecord::Base
|
2
|
+
|
3
|
+
validates_presence_of :title, :body, :body_raw
|
4
|
+
validates_uniqueness_of :permalink
|
5
|
+
|
6
|
+
belongs_to :content_part
|
7
|
+
|
8
|
+
# for use as a post/summary post in conjunction with the excerpt
|
9
|
+
has_one :image, :class_name => 'ContentImage', :dependent => :destroy, :as => :content_part
|
10
|
+
has_one :image_overlay, :foreign_key => "content_part_as_overlay_id", :class_name => 'ContentImage', :dependent => :destroy, :as => :content_part_as_overlay_image
|
11
|
+
|
12
|
+
before_validation :process_body, :create_permalink
|
13
|
+
|
14
|
+
protected
|
15
|
+
|
16
|
+
def create_permalink
|
17
|
+
# do not update permalinks automatically. Ever.
|
18
|
+
return unless self.permalink.blank?
|
19
|
+
|
20
|
+
self.permalink = self.title.parameterize
|
21
|
+
|
22
|
+
if self.permalink.blank?
|
23
|
+
self.permalink = Digest::SHA1.hexdigest("fubar-#{Time.now.to_s}")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def process_body
|
28
|
+
self.body = self.body_raw
|
29
|
+
end
|
30
|
+
|
31
|
+
def image_path=(image)
|
32
|
+
self.build_image :image => image
|
33
|
+
end
|
34
|
+
|
35
|
+
def image_path
|
36
|
+
if self.image && self.image.image
|
37
|
+
self.image.image.url
|
38
|
+
else
|
39
|
+
""
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def image_overlay_path=(image)
|
44
|
+
self.build_image_overlay :image => image
|
45
|
+
end
|
46
|
+
|
47
|
+
def image_overlay_path
|
48
|
+
if self.image_overlay && self.image_overlay.image
|
49
|
+
self.image_overlay.image.url
|
50
|
+
else
|
51
|
+
""
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<% form_for @content_category, :url => admin_content_category_path(@content_category) do |f| %>
|
2
|
+
<%= f.field_container :name do %>
|
3
|
+
<%= f.label :name %>
|
4
|
+
<%= f.text_field :name %>
|
5
|
+
<% end %>
|
6
|
+
<%= f.field_container :show_image do %>
|
7
|
+
<%= f.label :show_image %>
|
8
|
+
<%= f.check_box :show_image %>
|
9
|
+
<% end %>
|
10
|
+
<%= f.field_container :paginated do %>
|
11
|
+
<%= f.label :paginated %>
|
12
|
+
<%= f.check_box :paginated %>
|
13
|
+
<% end %>
|
14
|
+
<%= f.submit %>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<%= render :partial => 'admin/content_category_localizations/index', :object => @content_category %>
|
@@ -27,7 +27,7 @@
|
|
27
27
|
<td><%= category.show_image %></td>
|
28
28
|
<td><%= category.paginated %></td>
|
29
29
|
<td><%= category.content_parts.count %></td>
|
30
|
-
<td><%= link_to "Destroy", admin_content_category_path(category), :method => :delete, :confirm => "Are you sure?"%></td>
|
30
|
+
<td><%= link_to "Edit", edit_admin_content_category_path(category) %> | <%= link_to "Destroy", admin_content_category_path(category), :method => :delete, :confirm => "Are you sure?"%></td>
|
31
31
|
</tr>
|
32
32
|
</tbody>
|
33
33
|
<% end %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%= form.hidden_field :content_category_id %>
|
2
|
+
|
3
|
+
<%= form.field_container :language do %>
|
4
|
+
<%= form.label :language %>
|
5
|
+
<%= form.text_field :language %><br/>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<%= form.field_container :name do %>
|
9
|
+
<%= form.label :name %>
|
10
|
+
<%= form.text_field :name %><br/>
|
11
|
+
<% end %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<h2>Localizations</h2>
|
2
|
+
|
3
|
+
<%= link_to "New Localization", new_admin_content_category_localization_path(index) %>
|
4
|
+
|
5
|
+
<table>
|
6
|
+
<tr>
|
7
|
+
<th>Language</th>
|
8
|
+
<th></th>
|
9
|
+
</tr>
|
10
|
+
<% index.localizations.each do |localization| %>
|
11
|
+
<tr>
|
12
|
+
<td><%= localization.language %></td>
|
13
|
+
<td><%= link_to "edit", edit_admin_content_category_localization_path(index, localization) %> | <%= link_to "Destroy", admin_content_category_localization_path(index, localization), :method => :delete, :confirm => "Are you sure?"%></td>
|
14
|
+
</tr>
|
15
|
+
<% end %>
|
16
|
+
</table>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%= render :partial => 'admin/content_parts/sub_menu' %>
|
2
|
+
|
3
|
+
<% form_for @content_category_localization, :url => admin_content_category_localization_path(@content_category, @content_category_localization) do |f| %>
|
4
|
+
<%= render :partial => 'form', :object => f %>
|
5
|
+
<%= f.submit %>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<%= link_to "back", edit_admin_content_category_path(@content_category) %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%= render :partial => 'admin/content_parts/sub_menu' %>
|
2
|
+
|
3
|
+
<% form_for @content_category_localization, :url => admin_content_category_localizations_path(@content_category) do |f| %>
|
4
|
+
<%= render :partial => 'form', :object => f %>
|
5
|
+
<%= f.submit %>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<%= link_to "back", edit_admin_content_category_path(@content_category) %>
|
@@ -0,0 +1,52 @@
|
|
1
|
+
<%= form.hidden_field :content_part_id %>
|
2
|
+
|
3
|
+
<%= form.field_container :language do %>
|
4
|
+
<%= form.label :language %>
|
5
|
+
<%= form.text_field :language %><br/>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<%= form.field_container :title do %>
|
9
|
+
<%= form.label :title %>
|
10
|
+
<%= form.text_field :title %><br/>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<%= form.field_container :image do %>
|
14
|
+
|
15
|
+
<% if @content_part_localization.image %>
|
16
|
+
<%= image_tag @content_part_localization.image.image.url(:medium) %>
|
17
|
+
|
18
|
+
<p>
|
19
|
+
<%= form.label :image %>
|
20
|
+
<%= form.file_field :image_path %>
|
21
|
+
</p>
|
22
|
+
<% else %>
|
23
|
+
<%= form.label :image %>
|
24
|
+
<%= form.file_field :image_path %>
|
25
|
+
<% end %>
|
26
|
+
<% end %>
|
27
|
+
|
28
|
+
|
29
|
+
<%= form.field_container :image_overlay do %>
|
30
|
+
|
31
|
+
<% if @content_part_localization.image_overlay %>
|
32
|
+
<%= image_tag @content_part_localization.image_overlay.image.url(:medium) %>
|
33
|
+
|
34
|
+
<p>
|
35
|
+
<%= form.label :image_overlay %>
|
36
|
+
<%= form.file_field :image_overlay_path %>
|
37
|
+
</p>
|
38
|
+
<% else %>
|
39
|
+
<%= form.label :image_overlay %>
|
40
|
+
<%= form.file_field :image_overlay_path %>
|
41
|
+
<% end %>
|
42
|
+
<% end %>
|
43
|
+
|
44
|
+
<%= form.field_container :excerpt do %>
|
45
|
+
<%= form.label :excerpt %>
|
46
|
+
<%= form.text_area :excerpt%><br/>
|
47
|
+
<% end %>
|
48
|
+
|
49
|
+
<% form.field_container :body_raw do %>
|
50
|
+
<%= form.label :body_raw %>
|
51
|
+
<%= form.text_area :body_raw%><br/>
|
52
|
+
<% end %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<h2>Localizations</h2>
|
2
|
+
|
3
|
+
<%= link_to "New Localization", new_admin_content_category_content_part_localization_path(index.category, index) %>
|
4
|
+
|
5
|
+
<table>
|
6
|
+
<tr>
|
7
|
+
<th>Language</th>
|
8
|
+
<th></th>
|
9
|
+
</tr>
|
10
|
+
<% index.localizations.each do |localization| %>
|
11
|
+
<tr>
|
12
|
+
<td><%= localization.language %></td>
|
13
|
+
<td><%= link_to "edit", edit_admin_content_category_content_part_localization_path(index.category, index, localization) %> | <%= link_to "Destroy", admin_content_category_content_part_localization_path(index.category, index, localization), :method => :delete, :confirm => "Are you sure?"%></td>
|
14
|
+
</tr>
|
15
|
+
<% end %>
|
16
|
+
</table>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%= render :partial => 'admin/content_parts/sub_menu' %>
|
2
|
+
|
3
|
+
<% form_for @content_part_localization, :url => admin_content_category_content_part_localization_path(@content_part.category, @content_part, @content_part_localization), :html => { :multipart => true } do |f| %>
|
4
|
+
<%= render :partial => 'form', :object => f %>
|
5
|
+
<%= f.submit %>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<%= link_to "back", edit_admin_content_category_content_part_path(@content_part.category, @content_part) %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%= render :partial => 'admin/content_parts/sub_menu' %>
|
2
|
+
|
3
|
+
<% form_for @content_part_localization, :url => admin_content_category_content_part_localizations_path(@content_part.category, @content_part), :html => { :multipart => true } do |f| %>
|
4
|
+
<%= render :partial => 'form', :object => f %>
|
5
|
+
<%= f.submit %>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<%= link_to "back", edit_admin_content_category_content_part_path(@content_part.category, @content_part) %>
|
@@ -3,4 +3,6 @@
|
|
3
3
|
<% form_for @content_part, :url => admin_content_category_content_part_path(@content_category, @content_part), :html => { :multipart => true } do |f| %>
|
4
4
|
<%= render :partial => 'form', :object => f %>
|
5
5
|
<%= f.submit %>
|
6
|
-
<% end %>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<%= render :partial => 'admin/content_part_localizations/index', :object => @content_part %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= render :partial => 'sub_menu' %>
|
1
|
+
<%= render :partial => 'admin/content_parts/sub_menu' %>
|
2
2
|
|
3
3
|
<% form_for @content_part, :url => admin_content_category_content_parts_path(@content_category), :html => { :multipart => true } do |f| %>
|
4
4
|
<%= render :partial => 'form', :object => f %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<h1><%= @contentCategory.name %></h1>
|
2
|
+
<table cellspacing="0" cellpading="0" border="0">
|
3
|
+
<% @contentParts.each do |part| %>
|
4
|
+
<tr>
|
5
|
+
<td style="padding-bottom: 20px;">
|
6
|
+
<% if !part.image.nil? %>
|
7
|
+
<%= image_tag part.image.image.url %>
|
8
|
+
<% end %>
|
9
|
+
</td>
|
10
|
+
<td style="vertical-align: top; padding-left: 15px; text-align: justify;">
|
11
|
+
<h2><%= part.title.upcase %></h2>
|
12
|
+
<%=raw part.excerpt %>
|
13
|
+
<div style="text-align: right;">
|
14
|
+
<%= link_to 'Mehr...', '/' + part.permalink, {:class => 'more'} %>
|
15
|
+
</div>
|
16
|
+
</td>
|
17
|
+
</tr>
|
18
|
+
<% end %>
|
19
|
+
</table>
|
data/config/routes.rb
CHANGED
@@ -1,28 +1,18 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
|
+
# wow, that's way too deeply nested
|
2
3
|
namespace :admin do
|
3
4
|
resources :content_images
|
4
5
|
resources :content_categories do
|
5
|
-
resources :
|
6
|
+
resources :content_category_localizations, :as => 'localizations'
|
7
|
+
resources :content_parts do
|
8
|
+
resources :content_part_localizations, :as => 'localizations'
|
9
|
+
end
|
6
10
|
end
|
7
11
|
end
|
8
12
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
+
namespace :cms do
|
14
|
+
resources :content_part
|
15
|
+
resources :content_catgory
|
16
|
+
match ':name' => "aliases#show"
|
13
17
|
end
|
14
|
-
|
15
|
-
ContentPart.all.each do |part|
|
16
|
-
if !part.permalink.nil?
|
17
|
-
match '' + part.permalink => 'ContentPart#show', :defaults => { :id => part.id }
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
#map.resources :posts #, :as => Spree::Config[:cms_permalink]
|
26
|
-
#map.resources :pages
|
27
|
-
|
28
|
-
# I'd prefer /<category> instead of /blog/posts/<category>
|
18
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class CreateContentPartLocalizations < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :content_part_localizations do |t|
|
4
|
+
t.text :title
|
5
|
+
t.text :body
|
6
|
+
t.text :body_raw
|
7
|
+
t.text :excerpt
|
8
|
+
t.text :permalink
|
9
|
+
t.integer :content_part_id
|
10
|
+
t.text :language
|
11
|
+
|
12
|
+
t.timestamps
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.down
|
17
|
+
drop_table :content_part_localizations
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateContentCategorieLocalizations < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :content_category_localizations do |t|
|
4
|
+
t.text :name, :null => false
|
5
|
+
t.text :language
|
6
|
+
t.integer :content_category_id
|
7
|
+
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.down
|
13
|
+
drop_table :content_category_localizations
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class MakeContentImagePolymorph < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
add_column :content_images, :content_part_as_overlay_type, :string
|
4
|
+
add_column :content_images, :content_part_type, :string
|
5
|
+
|
6
|
+
# also convert exisiting data to the new scheme
|
7
|
+
ContentImage.all.each do |image|
|
8
|
+
if !image.content_part_id.blank?
|
9
|
+
image.content_part = ContentPart.find(image.content_part_id)
|
10
|
+
end
|
11
|
+
|
12
|
+
if !image.content_part_as_overlay_id.blank?
|
13
|
+
cp = ContentPart.find(image.content_part_as_overlay_id)
|
14
|
+
cp.image_overlay = image
|
15
|
+
cp.save!
|
16
|
+
end
|
17
|
+
|
18
|
+
image.save!
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.down
|
23
|
+
remove_column :content_parts, :content_part_as_overlay_type
|
24
|
+
remove_column :content_parts, :content_part_type
|
25
|
+
end
|
26
|
+
end
|
data/lib/cms.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spree_core'
|
2
2
|
require 'cms_hooks'
|
3
3
|
|
4
|
-
module Cms
|
4
|
+
module Cms
|
5
5
|
class Engine < Rails::Engine
|
6
6
|
|
7
7
|
config.autoload_paths += %W(#{config.root}/lib)
|
@@ -14,4 +14,4 @@ module Cms
|
|
14
14
|
|
15
15
|
config.to_prepare &method(:activate).to_proc
|
16
16
|
end
|
17
|
-
end
|
17
|
+
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree-cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
|
-
-
|
8
|
+
- 2
|
8
9
|
- 0
|
9
|
-
version: 0.
|
10
|
+
version: 0.2.0
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Andreas Happe
|
@@ -14,7 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2011-
|
18
|
+
date: 2011-05-30 00:00:00 +02:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
@@ -25,6 +26,7 @@ dependencies:
|
|
25
26
|
requirements:
|
26
27
|
- - ">="
|
27
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 187
|
28
30
|
segments:
|
29
31
|
- 0
|
30
32
|
- 40
|
@@ -48,20 +50,36 @@ files:
|
|
48
50
|
- lib/tasks/cms.rake
|
49
51
|
- lib/tasks/install.rake
|
50
52
|
- app/controllers/admin/content_categories_controller.rb
|
53
|
+
- app/controllers/admin/content_category_localizations_controller.rb
|
51
54
|
- app/controllers/admin/content_images_controller.rb
|
55
|
+
- app/controllers/admin/content_part_localizations_controller.rb
|
52
56
|
- app/controllers/admin/content_parts_controller.rb
|
57
|
+
- app/controllers/cms/aliases_controller.rb
|
58
|
+
- app/controllers/cms/content_categories_controller.rb
|
59
|
+
- app/controllers/cms/content_parts_controller.rb
|
53
60
|
- app/controllers/content_category_controller.rb
|
54
61
|
- app/controllers/content_part_controller.rb
|
55
62
|
- app/helpers/cms_helpers.rb
|
56
63
|
- app/models/content_category.rb
|
64
|
+
- app/models/content_category_localization.rb
|
57
65
|
- app/models/content_file.rb
|
58
66
|
- app/models/content_image.rb
|
59
67
|
- app/models/content_part.rb
|
68
|
+
- app/models/content_part_localization.rb
|
60
69
|
- app/views/admin/content_categories/_content_category.html.erb
|
70
|
+
- app/views/admin/content_categories/edit.html.erb
|
61
71
|
- app/views/admin/content_categories/index.html.erb
|
62
72
|
- app/views/admin/content_categories/show.html.erb
|
73
|
+
- app/views/admin/content_category_localizations/_form.html.erb
|
74
|
+
- app/views/admin/content_category_localizations/_index.html.erb
|
75
|
+
- app/views/admin/content_category_localizations/edit.html.erb
|
76
|
+
- app/views/admin/content_category_localizations/new.html.erb
|
63
77
|
- app/views/admin/content_images/file_browser.html.erb
|
64
78
|
- app/views/admin/content_images/index.html.erb
|
79
|
+
- app/views/admin/content_part_localizations/_form.html.erb
|
80
|
+
- app/views/admin/content_part_localizations/_index.html.erb
|
81
|
+
- app/views/admin/content_part_localizations/edit.html.erb
|
82
|
+
- app/views/admin/content_part_localizations/new.html.erb
|
65
83
|
- app/views/admin/content_parts/_content_part.html.erb
|
66
84
|
- app/views/admin/content_parts/_form.html.erb
|
67
85
|
- app/views/admin/content_parts/_sub_menu.html.erb
|
@@ -69,6 +87,10 @@ files:
|
|
69
87
|
- app/views/admin/content_parts/index.html.erb
|
70
88
|
- app/views/admin/content_parts/new.html.erb
|
71
89
|
- app/views/admin/shared/_ckeditor.html.erb
|
90
|
+
- app/views/cms/content_categories/_content_category_default.html.erb
|
91
|
+
- app/views/cms/content_categories/show.html.erb
|
92
|
+
- app/views/cms/content_parts/_content_part_default.html.erb
|
93
|
+
- app/views/cms/content_parts/show.html.erb
|
72
94
|
- app/views/content_categories/_content_category_default.html.erb
|
73
95
|
- app/views/content_category/show.html.erb
|
74
96
|
- app/views/content_part/show.html.erb
|
@@ -80,6 +102,9 @@ files:
|
|
80
102
|
- db/migrate/0004_add_permalink_to_content_categories.rb
|
81
103
|
- db/migrate/0005_add_overlay_image_id_to_content_parts.rb
|
82
104
|
- db/migrate/0006_add_name_and_alt_to_content_images.rb
|
105
|
+
- db/migrate/0007_create_content_part_localizations.rb
|
106
|
+
- db/migrate/0008_create_content_categorie_localizations.rb
|
107
|
+
- db/migrate/0009_make_content_image_polymorph.rb
|
83
108
|
- public/ckeditor/adapters/jquery.js
|
84
109
|
- public/ckeditor/ckeditor.js
|
85
110
|
- public/ckeditor/ckeditor_basic.js
|
@@ -290,6 +315,8 @@ files:
|
|
290
315
|
- public/ckeditor/skins/v2/skin.js
|
291
316
|
- public/ckeditor/skins/v2/templates.css
|
292
317
|
- public/ckeditor/themes/default/theme.js
|
318
|
+
- config/locales/de.content_categories.yml
|
319
|
+
- config/locales/de.content_parts.yml
|
293
320
|
- config/locales/en.content_categories.yml
|
294
321
|
- config/locales/en.content_parts.yml
|
295
322
|
- config/routes.rb
|
@@ -308,6 +335,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
308
335
|
requirements:
|
309
336
|
- - ">="
|
310
337
|
- !ruby/object:Gem::Version
|
338
|
+
hash: 57
|
311
339
|
segments:
|
312
340
|
- 1
|
313
341
|
- 8
|
@@ -318,6 +346,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
318
346
|
requirements:
|
319
347
|
- - ">="
|
320
348
|
- !ruby/object:Gem::Version
|
349
|
+
hash: 3
|
321
350
|
segments:
|
322
351
|
- 0
|
323
352
|
version: "0"
|