ecm_products 0.0.1.pre → 0.0.2.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. data/app/helpers/ecm/products/product_category_helper.rb +18 -0
  2. data/app/helpers/ecm/products/product_helper.rb +18 -0
  3. data/app/models/ecm/products/product.rb +17 -9
  4. data/app/models/ecm/products/product_category.rb +19 -2
  5. data/app/models/ecm/products/product_link.rb +20 -0
  6. data/app/views/ecm/products/product_categories/_product_category.html.erb +8 -4
  7. data/app/views/ecm/products/product_categories/_product_category_preview.html.erb +10 -0
  8. data/app/views/ecm/products/product_categories/show.html.erb +4 -2
  9. data/app/views/ecm/products/product_links/_product_link.html.erb +2 -2
  10. data/app/views/ecm/products/products/_product.html.erb +3 -8
  11. data/app/views/ecm/products/products/_product_details.html.erb +9 -10
  12. data/app/views/ecm/products/products/_product_preview.html.erb +15 -15
  13. data/config/locales/ecm.products.de.yml +1 -0
  14. data/config/locales/ecm.products.en.yml +1 -0
  15. data/config/locales/ecm.products.product.de.yml +1 -0
  16. data/config/locales/ecm.products.product.en.yml +1 -0
  17. data/config/locales/ecm.products.product_category.de.yml +2 -1
  18. data/config/locales/ecm.products.product_category.en.yml +1 -0
  19. data/config/locales/ecm.products.product_link.de.yml +1 -0
  20. data/config/locales/ecm.products.product_link.en.yml +1 -0
  21. data/db/migrate/001_create_ecm_products_product_categories.rb +7 -6
  22. data/db/migrate/002_create_ecm_products_products.rb +10 -10
  23. data/db/migrate/003_create_ecm_products_product_links.rb +3 -2
  24. data/lib/ecm/products/active_admin/ecm_products_product_categories.rb +6 -0
  25. data/lib/ecm/products/active_admin/ecm_products_product_links.rb +6 -0
  26. data/lib/ecm/products/active_admin/ecm_products_products.rb +7 -3
  27. data/lib/ecm/products/version.rb +1 -1
  28. data/lib/ecm_products.rb +1 -0
  29. data/lib/tasks/ecm_products_tasks.rake +0 -1
  30. metadata +55 -38
@@ -0,0 +1,18 @@
1
+ module Ecm::Products::ProductCategoryHelper
2
+ def render_product_category(name)
3
+ category = Ecm::Products::ProductCategory.where(:locale => I18n.locale.to_s).where(:name => name).first
4
+
5
+ output = ''
6
+
7
+ unless category.nil?
8
+ output << render(:partial => 'ecm/products/product_categories/product_category_preview', :locals => { :product_category => category})
9
+ output << tag(:hr)
10
+ end
11
+
12
+ output << link_to(ecm_products_product_categories_path, :class => 'btn list-link') do
13
+ content_tag(:i, "", :class => 'icon-list') + " " +
14
+ I18n.t('ecm.products.product_category.actions.all')
15
+ end
16
+ return output.html_safe
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ module Ecm::Products::ProductHelper
2
+ def render_product(name)
3
+ product = Ecm::Products::Product.where(:name => name).first
4
+
5
+ output = ''
6
+
7
+ unless product.nil?
8
+ output << render(:partial => 'ecm/products/products/product_preview', :locals => { :product => product, :product_counter => 0 })
9
+ output << tag(:hr)
10
+ end
11
+
12
+ output << link_to(product.ecm_products_product_category, :class => 'btn list-link') do
13
+ content_tag(:i, "", :class => 'icon-list') + " " +
14
+ product.ecm_products_product_category
15
+ end
16
+ return output.html_safe
17
+ end
18
+ end
@@ -35,7 +35,10 @@ class Ecm::Products::Product < ActiveRecord::Base
35
35
 
36
36
  # acts as list
37
37
  acts_as_list :scope => :ecm_products_product_category
38
-
38
+
39
+ # acts as markup
40
+ acts_as_markup :language => :variable, :columns => [ :long_description, :short_description ]
41
+
39
42
  # associations
40
43
  belongs_to :ecm_products_product_category,
41
44
  :class_name => Ecm::Products::ProductCategory,
@@ -49,9 +52,9 @@ class Ecm::Products::Product < ActiveRecord::Base
49
52
 
50
53
  # attributes
51
54
  attr_accessible :ecm_products_product_category_id,
52
- :locale,
53
55
  :long_description,
54
56
  :main_image,
57
+ :markup_language,
55
58
  :name,
56
59
  :position,
57
60
  :preview_image,
@@ -62,9 +65,13 @@ class Ecm::Products::Product < ActiveRecord::Base
62
65
  :slug
63
66
 
64
67
  # callbacks
68
+ after_initialize :set_defaults
65
69
  after_update :fix_updated_counters
66
70
  before_update :fix_updated_position, :if => Proc.new { |d| !position.blank? && d.ecm_products_product_category_id_changed? }
67
-
71
+
72
+ # constants
73
+ MARKUP_LANGUAGES = %w(markdown textile rdoc)
74
+
68
75
  # friendly id
69
76
  extend FriendlyId
70
77
  friendly_id :name, :use => :slugged
@@ -78,10 +85,9 @@ class Ecm::Products::Product < ActiveRecord::Base
78
85
 
79
86
  # validations
80
87
  validates :ecm_products_product_category, :presence => true
81
- validate :available_locale, :unless => Proc.new { |c| c.locale.blank? }
82
88
  validates :name, :presence => true
83
- # validates_attachment_presence :main_image
84
- # validates_attachment_presence :preview_image
89
+ validates :markup_language, :presence => true,
90
+ :inclusion => MARKUP_LANGUAGES
85
91
 
86
92
  # private methods
87
93
 
@@ -91,7 +97,9 @@ class Ecm::Products::Product < ActiveRecord::Base
91
97
  add_to_list_bottom
92
98
  end
93
99
 
94
- def available_locale
95
- I18n.available_locales.map(&:to_s).include?(self.locale)
96
- end
100
+ def set_defaults
101
+ if self.new_record?
102
+ self.markup_language ||= 'textile'
103
+ end
104
+ end
97
105
  end
@@ -2,6 +2,9 @@ class Ecm::Products::ProductCategory < ActiveRecord::Base
2
2
  # database settings
3
3
  self.table_name = 'ecm_products_product_categories'
4
4
 
5
+ # acts as markup
6
+ acts_as_markup :language => :variable, :columns => [ :long_description, :short_description ]
7
+
5
8
  # associations
6
9
  has_many :ecm_products_products,
7
10
  :class_name => Ecm::Products::Product,
@@ -15,6 +18,7 @@ class Ecm::Products::ProductCategory < ActiveRecord::Base
15
18
  :locale,
16
19
  :long_description,
17
20
  :main_image,
21
+ :markup_language,
18
22
  :name,
19
23
  :parent_id,
20
24
  :preview_image,
@@ -26,6 +30,12 @@ class Ecm::Products::ProductCategory < ActiveRecord::Base
26
30
  acts_as_nested_set
27
31
  default_scope :order => 'lft ASC'
28
32
 
33
+ # callbacks
34
+ after_initialize :set_defaults
35
+
36
+ # constants
37
+ MARKUP_LANGUAGES = %w(markdown textile rdoc)
38
+
29
39
  # friendly id
30
40
  extend FriendlyId
31
41
  friendly_id :name, :use => :slugged
@@ -38,7 +48,9 @@ class Ecm::Products::ProductCategory < ActiveRecord::Base
38
48
  validates :name, :presence => true, :uniqueness => { :scope => [ :parent_id ] }
39
49
  validates :locale, :presence => true, :if => Proc.new { |pc| pc.parent.nil? } # , :if => :root?
40
50
  validates :locale, :absence => true, :if => Proc.new { |pc| !pc.parent.nil? }
41
- validate :available_locale, :if => Proc.new { |pc| pc.locale.present? }
51
+ validate :available_locale, :if => Proc.new { |pc| pc.locale.present? }
52
+ validates :markup_language, :presence => true,
53
+ :inclusion => MARKUP_LANGUAGES
42
54
 
43
55
  # public methods
44
56
 
@@ -67,5 +79,10 @@ class Ecm::Products::ProductCategory < ActiveRecord::Base
67
79
  def available_locale
68
80
  I18n.available_locales.map(&:to_s).include?(self.locale)
69
81
  end
70
- # private
82
+
83
+ def set_defaults
84
+ if self.new_record?
85
+ self.markup_language ||= 'textile'
86
+ end
87
+ end
71
88
  end
@@ -5,6 +5,9 @@ class Ecm::Products::ProductLink < ActiveRecord::Base
5
5
  # acts as list
6
6
  acts_as_list :scope => :ecm_products_product
7
7
 
8
+ # acts as markup
9
+ acts_as_markup :language => :variable, :columns => [ :description ]
10
+
8
11
  # associations
9
12
  belongs_to :ecm_products_product,
10
13
  :class_name => Ecm::Products::Product,
@@ -13,11 +16,28 @@ class Ecm::Products::ProductLink < ActiveRecord::Base
13
16
  # attributes
14
17
  attr_accessible :description,
15
18
  :ecm_products_product_id,
19
+ :markup_language,
16
20
  :name,
17
21
  :position,
18
22
  :url
23
+
24
+ # callbacks
25
+ after_initialize :set_defaults
19
26
 
27
+ # constants
28
+ MARKUP_LANGUAGES = %w(markdown textile rdoc)
29
+
20
30
  # validations
21
31
  validates :name, :presence => true, :uniqueness => { :scope => [ :ecm_products_product_id ] }
22
32
  validates :url, :presence => true, :uniqueness => { :scope => [ :ecm_products_product_id ] }
33
+ validates :markup_language, :presence => true,
34
+ :inclusion => MARKUP_LANGUAGES
35
+
36
+ private
37
+
38
+ def set_defaults
39
+ if self.new_record?
40
+ self.markup_language ||= 'textile'
41
+ end
42
+ end
23
43
  end
@@ -5,19 +5,23 @@
5
5
  <% end %>
6
6
 
7
7
  <% unless product_category.short_description.blank? %>
8
- <p><%= product_category.short_description %></p>
8
+ <p><%= mu(product_category, :short_description) %></p>
9
9
  <% end %>
10
10
 
11
11
  <% unless product_category.long_description.blank? %>
12
- <p><%= product_category.long_description %></p>
12
+ <p><%= mu(product_category, :long_description) %></p>
13
13
  <% end %>
14
14
 
15
15
  <h2><%= Ecm::Products::ProductCategory.human_attribute_name(:ecm_products_products) %></h2>
16
16
 
17
17
  <% if product_category.ecm_products_products_count == 0 %>
18
- <%= t('ecm.products.product_category.messages.no_products_available') %>
18
+ <p><%= I18n.t('ecm.products.product_category.messages.no_products_available') %></p>
19
19
  <% else %>
20
20
  <ul class="thumbnails product-previews">
21
- <%= render :partial => 'ecm/products/products/product_preview', :collection => product_category.ecm_products_products, :as => :product %>
21
+ <% product_category.ecm_products_products.each_with_index do |product, index| %>
22
+ <li>
23
+ <%= render :partial => 'ecm/products/products/product_preview', :locals => { :product => product, :product_counter => index } %>
24
+ </li>
25
+ <% end %>
22
26
  </ul>
23
27
  <% end %>
@@ -0,0 +1,10 @@
1
+ <h2 class="product_category-name"><%= product_category.name %></h1>
2
+
3
+ <% unless product_category.short_description.blank? %>
4
+ <p><%= mu(product_category, :short_description) %></p>
5
+ <% end %>
6
+
7
+ <%= link_to product_category, :class => 'btn link-more' do %>
8
+ <i class="icon-arrow-right"></i>
9
+ <%= product_category.tree_name %>
10
+ <% end %>
@@ -1,16 +1,18 @@
1
1
  <%= render @product_category %>
2
2
 
3
+ <br />
4
+
3
5
  <% if @product_category.root? %>
4
6
 
5
7
  <%= link_to(ecm_products_product_categories_path, :class => 'back-link btn') do %>
6
- <i class="icon-arrow-left icon-white"></i>
8
+ <i class="icon-arrow-left"></i>
7
9
  <%= t('ecm.products.product_category.actions.back_to_index') %>
8
10
  <% end %>
9
11
 
10
12
  <% else %>
11
13
 
12
14
  <%= link_to(@product_category.parent, :class => 'back-link btn') do %>
13
- <i class="icon-arrow-left icon-white"></i>
15
+ <i class="icon-arrow-left"></i>
14
16
  <%= t('ecm.products.product_category.actions.back_to_parent', :name => @product_category.parent.to_s) %>
15
17
  <% end %>
16
18
 
@@ -1,11 +1,11 @@
1
1
  <h3><%= product_link.name %></h3>
2
2
 
3
3
  <p class="product_link-description">
4
- <%= product_link.description %>
4
+ <%= mu(product_link, :description) %>
5
5
  </p>
6
6
 
7
7
  <%= link_to product_link.url, :class => "product_link-url open-link external-link btn" do %>
8
- <i class="icon-info-sign icon-white"></i>
8
+ <i class="icon-info-sign"></i>
9
9
  <%= t('ecm.products.product_link.actions.visit') %>
10
10
  <% end %>
11
11
 
@@ -1,10 +1,5 @@
1
1
  <div class="product" id="product-<%= product.id %>">
2
- <h2>
3
- <% if product.locale.present? %>
4
- <span class="product-locale">[<%= product.locale %>]</span>
5
- <% end %>
6
- <span class="product-name"><%= product.name %></span>
7
- </h2>
2
+ <h2 class="product-name"><%= product.name %></h2>
8
3
  <ul>
9
4
  <li class="product-created_at"><%= Ecm::Products::Product.human_attribute_name(:created_at) %>: <%= l(product.created_at) rescue nil %></li>
10
5
  <li class="product-updated_at"><%= Ecm::Products::Product.human_attribute_name(:updated_at) %>: <%= l(product.updated_at) rescue nil %></li>
@@ -12,13 +7,13 @@
12
7
 
13
8
  <% unless product.short_description.blank? %>
14
9
  <div class="product-short_description">
15
- <p><%= product.short_description %></p>
10
+ <p><%= mu(product, :short_description) %></p>
16
11
  </div>
17
12
  <% end %>
18
13
 
19
14
  <% unless product.long_description.blank? %>
20
15
  <div class="product-long_description">
21
- <p><%= product.long_description %></p>
16
+ <p><%= mu(product, :long_description) %></p>
22
17
  </div>
23
18
  <% end %>
24
19
 
@@ -1,24 +1,23 @@
1
1
  <div class="product" id="product-<%= product.id %>">
2
- <h1>
3
- <% if product.locale.present? %>
4
- <span class="product-locale">[<%= product.locale %>]</span>
5
- <% end %>
6
- <span class="product-name"><%= product.name %></span>
7
- </h1>
2
+ <h1 class="product-name"><%= product.name %></h1>
8
3
 
9
4
  <% if product.main_image? %>
10
5
  <div class="product-main_image"><%= image_tag(product.main_image.url, :class => 'thumbnail') %></div>
11
6
  <% end %>
12
7
 
13
8
  <% if product.short_description.present? %>
14
- <div class="product-short_description"><%= product.short_description %></div>
9
+ <div class="product-short_description"><%= mu(product, :short_description) %></div>
15
10
  <% end %>
16
11
 
17
12
  <% if product.long_description.present? %>
18
- <div class="product-long_description"><%= product.long_description %></div>
13
+ <div class="product-long_description"><%= mu(product, :long_description) %></div>
19
14
  <% end %>
20
15
 
21
- <div class="product-price"><%= humanized_money_with_symbol product.price %></div>
16
+ <% if product.price.present? %>
17
+ <div class="product-price">
18
+ <p><%= Ecm::Products::Product.human_attribute_name(:price) %>: <%= humanized_money_with_symbol product.price %></p>
19
+ </div>
20
+ <% end %>
22
21
 
23
22
  <% if product.ecm_products_product_links.present? %>
24
23
  <hr />
@@ -35,6 +34,6 @@
35
34
  <hr />
36
35
 
37
36
  <%= link_to(product.ecm_products_product_category, :class => 'btn') do %>
38
- <i class="icon-arrow-left icon-white"></i>
37
+ <i class="icon-arrow-left"></i>
39
38
  <%= t('ecm.products.product.actions.back_to_category', :name => product.ecm_products_product_category) %>
40
39
  <% end %>
@@ -1,18 +1,18 @@
1
- <li>
2
- <div class="thumbnail <%= product_counter.odd? ? "even" : "odd" %>">
1
+ <div class="thumbnail <%= product_counter.odd? ? "even" : "odd" %>">
3
2
 
4
- <%= image_tag(product.preview_image.url) %>
3
+ <% if product.preview_image? %>
4
+ <%= image_tag(product.preview_image.url) %>
5
+ <% end %>
6
+
7
+ <div class="caption">
8
+ <h5><%= product.name %></h5>
9
+ <p class="short_description"><%= mu(product, :short_description) %></p>
5
10
 
6
- <div class="caption">
7
- <h5><%= product.name %></h5>
8
- <p class="short_description"><%= product.short_description %></p>
9
-
10
- <p>
11
- <%= link_to(product, :class => "more-link btn") do %>
12
- <i class="icon-info-sign icon-white"></i>
13
- <%= t('ecm.products.product.actions.more') %>
14
- <% end %>
15
- </p>
16
- </div>
11
+ <p>
12
+ <%= link_to(product, :class => "more-link btn") do %>
13
+ <i class="icon-info-sign"></i>
14
+ <%= t('ecm.products.product.actions.more') %>
15
+ <% end %>
16
+ </p>
17
17
  </div>
18
- </li>
18
+ </div>
@@ -10,6 +10,7 @@ de:
10
10
  messages:
11
11
  product_category:
12
12
  actions:
13
+ all: Alle anzeigen
13
14
  back_to_parent: Zurück zu %{name}
14
15
  back_to_index: Zurück zur Übersicht
15
16
  messages:
@@ -10,6 +10,7 @@ en:
10
10
  messages:
11
11
  product_category:
12
12
  actions:
13
+ all: show all
13
14
  back_to_parent: back to %{name}
14
15
  back_to_index: back to the index
15
16
  messages:
@@ -36,3 +36,4 @@ de:
36
36
  price_cents: Preis in Cents
37
37
  preview_image: Vorschaubild
38
38
  main_image: Hauptbild
39
+ markup_language: Markup Sprache
@@ -36,3 +36,4 @@ en:
36
36
  price_cents: price cents
37
37
  preview_image: preview image
38
38
  main_image: main image
39
+ markup_language: markup language
@@ -32,4 +32,5 @@ de:
32
32
  preview_image_file_size: Vorschaubild Dateigröße
33
33
  rgt: Rechts
34
34
  preview_image: Vorschaubild
35
- main_image: Hauptbild
35
+ main_image: Hauptbild
36
+ markup_language: Markup Sprache
@@ -33,3 +33,4 @@ en:
33
33
  rgt: right
34
34
  preview_image: preview image
35
35
  main_image: main image
36
+ markup_language: markup language
@@ -15,3 +15,4 @@ de:
15
15
  ecm_products_product_id: Produkt
16
16
  url: URL
17
17
  description: Beschreibung
18
+ markup_language: Markup Sprache
@@ -15,3 +15,4 @@ en:
15
15
  ecm_products_product_id: product
16
16
  url: url
17
17
  description: description
18
+ markup_language: markup language
@@ -5,19 +5,20 @@ class CreateEcmProductsProductCategories < ActiveRecord::Migration
5
5
  t.string :name
6
6
  t.text :short_description
7
7
  t.text :long_description
8
-
8
+ t.string :markup_language
9
+
9
10
  # associations
10
11
  t.integer :ecm_products_products_count, :default => 0, :null => false
11
-
12
+
12
13
  # awesome nested set
13
14
  t.integer :lft
14
15
  t.integer :rgt
15
16
  t.integer :parent_id
16
17
  t.integer :depth
17
-
18
+
18
19
  # friendly id
19
20
  t.string :slug
20
-
21
+
21
22
  # paperclip
22
23
  # t.attachment :preview_image
23
24
  t.string :preview_image_file_name
@@ -25,14 +26,14 @@ class CreateEcmProductsProductCategories < ActiveRecord::Migration
25
26
  t.string :preview_image_content_type
26
27
  t.timestamp :preview_image_updated_at
27
28
  t.string :preview_image_fingerprint
28
-
29
+
29
30
  # paperclip
30
31
  # t.attachment :main_image
31
32
  t.string :main_image_file_name
32
33
  t.integer :main_image_file_size
33
34
  t.string :main_image_content_type
34
35
  t.timestamp :main_image_updated_at
35
- t.string :main_image_fingerprint
36
+ t.string :main_image_fingerprint
36
37
 
37
38
  t.timestamps
38
39
  end
@@ -1,29 +1,29 @@
1
1
  class CreateEcmProductsProducts < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :ecm_products_products do |t|
4
- t.string :locale
5
4
  t.string :name
6
5
  t.text :short_description
7
6
  t.text :long_description
8
- t.boolean :price_on_application
9
-
7
+ t.string :markup_language
8
+ t.boolean :price_on_application
9
+
10
10
  # associations
11
11
  t.integer :ecm_products_product_links_count, :default => 0, :null => false
12
- t.references :ecm_products_product_category
13
-
12
+ t.references :ecm_products_product_category
13
+
14
14
  # acts as list
15
15
  t.integer :position
16
16
 
17
17
  # acts as published
18
18
  t.timestamp :published_at
19
-
19
+
20
20
  # friendly id
21
21
  t.string :slug
22
-
22
+
23
23
  # money
24
24
  t.integer :price_cents
25
25
  t.string :price_currency
26
-
26
+
27
27
  # paperclip
28
28
  # t.attachment :preview_image
29
29
  t.string :preview_image_file_name
@@ -31,14 +31,14 @@ class CreateEcmProductsProducts < ActiveRecord::Migration
31
31
  t.string :preview_image_content_type
32
32
  t.timestamp :preview_image_updated_at
33
33
  t.string :preview_image_fingerprint
34
-
34
+
35
35
  # paperclip
36
36
  # t.attachment :main_image
37
37
  t.string :main_image_file_name
38
38
  t.integer :main_image_file_size
39
39
  t.string :main_image_content_type
40
40
  t.timestamp :main_image_updated_at
41
- t.string :main_image_fingerprint
41
+ t.string :main_image_fingerprint
42
42
 
43
43
  t.timestamps
44
44
  end
@@ -4,10 +4,11 @@ class CreateEcmProductsProductLinks < ActiveRecord::Migration
4
4
  t.string :name
5
5
  t.string :url
6
6
  t.text :description
7
-
7
+ t.string :markup_language
8
+
8
9
  # associations
9
10
  t.references :ecm_products_product
10
-
11
+
11
12
  # acts as list
12
13
  t.integer :position
13
14
 
@@ -12,6 +12,11 @@
12
12
  f.input :preview_image, :as => :file, :hint => f.template.image_tag(f.object.preview_image.url(:medium_thumb))
13
13
  f.input :main_image, :as => :file, :hint => f.template.image_tag(f.object.main_image.url(:medium_thumb))
14
14
  end
15
+
16
+ f.inputs do
17
+ f.input :markup_language, :as => :select, :collection => Ecm::Products::ProductCategory::MARKUP_LANGUAGES
18
+ end
19
+
15
20
  f.actions
16
21
  end
17
22
 
@@ -38,6 +43,7 @@
38
43
  row :parent
39
44
  row :name
40
45
  row :ecm_products_products_count
46
+ row :markup_language
41
47
  row :created_at
42
48
  row :updated_at
43
49
  end
@@ -9,6 +9,11 @@
9
9
  f.input :url
10
10
  f.input :description
11
11
  end
12
+
13
+ f.inputs do
14
+ f.input :markup_language, :as => :select, :collection => Ecm::Products::ProductLink::MARKUP_LANGUAGES
15
+ end
16
+
12
17
  f.actions
13
18
  end
14
19
 
@@ -28,6 +33,7 @@
28
33
  row :url do |pl|
29
34
  link_to(pl.url, pl.url)
30
35
  end
36
+ row :markup_language
31
37
  row :created_at
32
38
  row :updated_at
33
39
  end
@@ -5,7 +5,6 @@
5
5
  form :html => { :enctype => "multipart/form-data" } do |f|
6
6
  f.inputs do
7
7
  f.input :ecm_products_product_category
8
- f.input :locale, :as => :select, :collection => I18n.available_locales.map(&:to_s)
9
8
  f.input :name
10
9
  f.input :short_description
11
10
  f.input :long_description
@@ -15,6 +14,11 @@
15
14
  f.input :preview_image, :as => :file
16
15
  f.input :main_image, :as => :file
17
16
  end
17
+
18
+ f.inputs do
19
+ f.input :markup_language, :as => :select, :collection => Ecm::Products::Product::MARKUP_LANGUAGES
20
+ end
21
+
18
22
  f.actions
19
23
  end
20
24
 
@@ -23,8 +27,7 @@
23
27
  column :preview_image do |p|
24
28
  link_to(image_tag(p.preview_image.url(:medium_thumb)), [:admin, p])
25
29
  end
26
- column :ecm_products_product_category
27
- column :locale
30
+ column :ecm_products_product_category
28
31
  column :name
29
32
  column :short_description
30
33
  column :created_at
@@ -43,6 +46,7 @@
43
46
  row :price
44
47
  row :price_on_application
45
48
  row :published_at
49
+ row :markup_language
46
50
  row :created_at
47
51
  row :updated_at
48
52
  end
@@ -1,5 +1,5 @@
1
1
  module ECM
2
2
  module Products
3
- VERSION = "0.0.1.pre"
3
+ VERSION = "0.0.2.pre"
4
4
  end
5
5
  end
data/lib/ecm_products.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'active_admin-awesome_nested_set'
2
2
  require 'acts_as_list'
3
3
  # require 'acts_as_published'
4
+ require 'acts_as_markup'
4
5
  require 'awesome_nested_set'
5
6
  require 'awesome_nested_set-tools'
6
7
  require 'friendly_id'
@@ -48,7 +48,6 @@ namespace :ecm_products do
48
48
  product_categories = Ecm::Products::ProductCategory.all
49
49
  100.times do
50
50
  Ecm::Products::Product.create! do |p|
51
- p.locale = I18n.available_locales.choice.to_s
52
51
  p.name = Faker::Product.product_name
53
52
  p.short_description = Faker::Lorem.paragraph(rand(2))
54
53
  p.long_description = Faker::Lorem.paragraph(rand(10))
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecm_products
3
3
  version: !ruby/object:Gem::Version
4
- hash: 961915968
4
+ hash: 961915980
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
9
+ - 2
10
10
  - pre
11
- version: 0.0.1.pre
11
+ version: 0.0.2.pre
12
12
  platform: ruby
13
13
  authors:
14
14
  - Roberto Vasquez Angel
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-08-08 00:00:00 Z
19
+ date: 2012-08-27 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: rails
@@ -79,7 +79,7 @@ dependencies:
79
79
  type: :runtime
80
80
  version_requirements: *id004
81
81
  - !ruby/object:Gem::Dependency
82
- name: awesome_nested_set
82
+ name: acts_as_markup
83
83
  prerelease: false
84
84
  requirement: &id005 !ruby/object:Gem::Requirement
85
85
  none: false
@@ -93,7 +93,7 @@ dependencies:
93
93
  type: :runtime
94
94
  version_requirements: *id005
95
95
  - !ruby/object:Gem::Dependency
96
- name: awesome_nested_set-tools
96
+ name: awesome_nested_set
97
97
  prerelease: false
98
98
  requirement: &id006 !ruby/object:Gem::Requirement
99
99
  none: false
@@ -107,7 +107,7 @@ dependencies:
107
107
  type: :runtime
108
108
  version_requirements: *id006
109
109
  - !ruby/object:Gem::Dependency
110
- name: friendly_id
110
+ name: awesome_nested_set-tools
111
111
  prerelease: false
112
112
  requirement: &id007 !ruby/object:Gem::Requirement
113
113
  none: false
@@ -121,7 +121,7 @@ dependencies:
121
121
  type: :runtime
122
122
  version_requirements: *id007
123
123
  - !ruby/object:Gem::Dependency
124
- name: money-rails
124
+ name: friendly_id
125
125
  prerelease: false
126
126
  requirement: &id008 !ruby/object:Gem::Requirement
127
127
  none: false
@@ -135,9 +135,23 @@ dependencies:
135
135
  type: :runtime
136
136
  version_requirements: *id008
137
137
  - !ruby/object:Gem::Dependency
138
- name: paperclip
138
+ name: money-rails
139
139
  prerelease: false
140
140
  requirement: &id009 !ruby/object:Gem::Requirement
141
+ none: false
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ hash: 3
146
+ segments:
147
+ - 0
148
+ version: "0"
149
+ type: :runtime
150
+ version_requirements: *id009
151
+ - !ruby/object:Gem::Dependency
152
+ name: paperclip
153
+ prerelease: false
154
+ requirement: &id010 !ruby/object:Gem::Requirement
141
155
  none: false
142
156
  requirements:
143
157
  - - ~>
@@ -148,11 +162,11 @@ dependencies:
148
162
  - 7
149
163
  version: "2.7"
150
164
  type: :runtime
151
- version_requirements: *id009
165
+ version_requirements: *id010
152
166
  - !ruby/object:Gem::Dependency
153
167
  name: rails_tools-absence_validator
154
168
  prerelease: false
155
- requirement: &id010 !ruby/object:Gem::Requirement
169
+ requirement: &id011 !ruby/object:Gem::Requirement
156
170
  none: false
157
171
  requirements:
158
172
  - - ~>
@@ -164,11 +178,11 @@ dependencies:
164
178
  - 1
165
179
  version: 0.0.1
166
180
  type: :runtime
167
- version_requirements: *id010
181
+ version_requirements: *id011
168
182
  - !ruby/object:Gem::Dependency
169
183
  name: sqlite3
170
184
  prerelease: false
171
- requirement: &id011 !ruby/object:Gem::Requirement
185
+ requirement: &id012 !ruby/object:Gem::Requirement
172
186
  none: false
173
187
  requirements:
174
188
  - - ">="
@@ -178,11 +192,11 @@ dependencies:
178
192
  - 0
179
193
  version: "0"
180
194
  type: :development
181
- version_requirements: *id011
195
+ version_requirements: *id012
182
196
  - !ruby/object:Gem::Dependency
183
197
  name: thin
184
198
  prerelease: false
185
- requirement: &id012 !ruby/object:Gem::Requirement
199
+ requirement: &id013 !ruby/object:Gem::Requirement
186
200
  none: false
187
201
  requirements:
188
202
  - - ">="
@@ -192,11 +206,11 @@ dependencies:
192
206
  - 0
193
207
  version: "0"
194
208
  type: :development
195
- version_requirements: *id012
209
+ version_requirements: *id013
196
210
  - !ruby/object:Gem::Dependency
197
211
  name: yard
198
212
  prerelease: false
199
- requirement: &id013 !ruby/object:Gem::Requirement
213
+ requirement: &id014 !ruby/object:Gem::Requirement
200
214
  none: false
201
215
  requirements:
202
216
  - - ">="
@@ -206,11 +220,11 @@ dependencies:
206
220
  - 0
207
221
  version: "0"
208
222
  type: :development
209
- version_requirements: *id013
223
+ version_requirements: *id014
210
224
  - !ruby/object:Gem::Dependency
211
225
  name: sass-rails
212
226
  prerelease: false
213
- requirement: &id014 !ruby/object:Gem::Requirement
227
+ requirement: &id015 !ruby/object:Gem::Requirement
214
228
  none: false
215
229
  requirements:
216
230
  - - ">="
@@ -220,11 +234,11 @@ dependencies:
220
234
  - 0
221
235
  version: "0"
222
236
  type: :development
223
- version_requirements: *id014
237
+ version_requirements: *id015
224
238
  - !ruby/object:Gem::Dependency
225
239
  name: coffee-rails
226
240
  prerelease: false
227
- requirement: &id015 !ruby/object:Gem::Requirement
241
+ requirement: &id016 !ruby/object:Gem::Requirement
228
242
  none: false
229
243
  requirements:
230
244
  - - ">="
@@ -234,11 +248,11 @@ dependencies:
234
248
  - 0
235
249
  version: "0"
236
250
  type: :development
237
- version_requirements: *id015
251
+ version_requirements: *id016
238
252
  - !ruby/object:Gem::Dependency
239
253
  name: capybara
240
254
  prerelease: false
241
- requirement: &id016 !ruby/object:Gem::Requirement
255
+ requirement: &id017 !ruby/object:Gem::Requirement
242
256
  none: false
243
257
  requirements:
244
258
  - - ">="
@@ -248,11 +262,11 @@ dependencies:
248
262
  - 0
249
263
  version: "0"
250
264
  type: :development
251
- version_requirements: *id016
265
+ version_requirements: *id017
252
266
  - !ruby/object:Gem::Dependency
253
267
  name: rspec-rails
254
268
  prerelease: false
255
- requirement: &id017 !ruby/object:Gem::Requirement
269
+ requirement: &id018 !ruby/object:Gem::Requirement
256
270
  none: false
257
271
  requirements:
258
272
  - - ~>
@@ -263,11 +277,11 @@ dependencies:
263
277
  - 0
264
278
  version: "2.0"
265
279
  type: :development
266
- version_requirements: *id017
280
+ version_requirements: *id018
267
281
  - !ruby/object:Gem::Dependency
268
282
  name: factory_girl_rails
269
283
  prerelease: false
270
- requirement: &id018 !ruby/object:Gem::Requirement
284
+ requirement: &id019 !ruby/object:Gem::Requirement
271
285
  none: false
272
286
  requirements:
273
287
  - - ~>
@@ -278,11 +292,11 @@ dependencies:
278
292
  - 0
279
293
  version: "1.0"
280
294
  type: :development
281
- version_requirements: *id018
295
+ version_requirements: *id019
282
296
  - !ruby/object:Gem::Dependency
283
297
  name: ffaker
284
298
  prerelease: false
285
- requirement: &id019 !ruby/object:Gem::Requirement
299
+ requirement: &id020 !ruby/object:Gem::Requirement
286
300
  none: false
287
301
  requirements:
288
302
  - - ">="
@@ -292,11 +306,11 @@ dependencies:
292
306
  - 0
293
307
  version: "0"
294
308
  type: :development
295
- version_requirements: *id019
309
+ version_requirements: *id020
296
310
  - !ruby/object:Gem::Dependency
297
311
  name: guard-rspec
298
312
  prerelease: false
299
- requirement: &id020 !ruby/object:Gem::Requirement
313
+ requirement: &id021 !ruby/object:Gem::Requirement
300
314
  none: false
301
315
  requirements:
302
316
  - - ">="
@@ -306,11 +320,11 @@ dependencies:
306
320
  - 0
307
321
  version: "0"
308
322
  type: :development
309
- version_requirements: *id020
323
+ version_requirements: *id021
310
324
  - !ruby/object:Gem::Dependency
311
325
  name: guard-bundler
312
326
  prerelease: false
313
- requirement: &id021 !ruby/object:Gem::Requirement
327
+ requirement: &id022 !ruby/object:Gem::Requirement
314
328
  none: false
315
329
  requirements:
316
330
  - - ">="
@@ -320,11 +334,11 @@ dependencies:
320
334
  - 0
321
335
  version: "0"
322
336
  type: :development
323
- version_requirements: *id021
337
+ version_requirements: *id022
324
338
  - !ruby/object:Gem::Dependency
325
339
  name: shoulda-matchers
326
340
  prerelease: false
327
- requirement: &id022 !ruby/object:Gem::Requirement
341
+ requirement: &id023 !ruby/object:Gem::Requirement
328
342
  none: false
329
343
  requirements:
330
344
  - - ">="
@@ -334,11 +348,11 @@ dependencies:
334
348
  - 0
335
349
  version: "0"
336
350
  type: :development
337
- version_requirements: *id022
351
+ version_requirements: *id023
338
352
  - !ruby/object:Gem::Dependency
339
353
  name: forgery
340
354
  prerelease: false
341
- requirement: &id023 !ruby/object:Gem::Requirement
355
+ requirement: &id024 !ruby/object:Gem::Requirement
342
356
  none: false
343
357
  requirements:
344
358
  - - "="
@@ -350,7 +364,7 @@ dependencies:
350
364
  - 0
351
365
  version: 0.5.0
352
366
  type: :development
353
- version_requirements: *id023
367
+ version_requirements: *id024
354
368
  description: Product management for active admin.
355
369
  email:
356
370
  - roberto@vasquez-angel.de
@@ -363,9 +377,12 @@ extra_rdoc_files: []
363
377
  files:
364
378
  - app/controllers/ecm/products/products_controller.rb
365
379
  - app/controllers/ecm/products/product_categories_controller.rb
380
+ - app/helpers/ecm/products/product_category_helper.rb
381
+ - app/helpers/ecm/products/product_helper.rb
366
382
  - app/views/ecm/products/product_categories/_product_category.html.erb
367
383
  - app/views/ecm/products/product_categories/show.html.erb
368
384
  - app/views/ecm/products/product_categories/index.html.erb
385
+ - app/views/ecm/products/product_categories/_product_category_preview.html.erb
369
386
  - app/views/ecm/products/product_links/_product_link.html.erb
370
387
  - app/views/ecm/products/products/_product_details.html.erb
371
388
  - app/views/ecm/products/products/show.html.erb