- <%= txt2html product.description %>
-
- <% else %>
-
- <% end %>
-
-<% end %>
-
-
+<%= display_products_list @profile, @products %>
diff --git a/public/stylesheets/controller_catalog.css b/public/stylesheets/controller_catalog.css
index 0985b18..d9e075e 100644
--- a/public/stylesheets/controller_catalog.css
+++ b/public/stylesheets/controller_catalog.css
@@ -1,81 +1 @@
-
-/* * * List Products * * * * * * * * * * * * */
-
-#product_list {
- margin: 0px;
- padding: 0px;
-}
-
-#product_list ul {
- margin: 0px;
- padding: 0px;
-}
-
-#content #product_list li {
- margin: 0px;
- padding: 0px;
- list-style: none;
-}
-
-#content #product_list li.product {
- border: 1px solid #888;
- margin-bottom: 10px;
- padding: 5px 10px;
-}
-
-#product_list .product-pic {
- display: block;
- width: 64px;
- height: 64px;
- background-repeat: no-repeat;
- background-position: 50% 50%;
- float: left;
- margin-right: 15px;
- position: relative; /* work arround msie bug */
-}
-
-#product_list .product-pic span {
- display: none;
-}
-
-#content #product_list h3 {
- margin: 0px;
- padding: 0px;
- font-size: 120%;
-}
-.msie #content #product_list h3 {
- margin-top: -15px;
-}
-#product_list h3 a {
- text-decoration: none;
-}
-
-#product_list .product_category {
- font-size: 11px;
-}
-
-#product_list .description {
- clear: left;
- font-size: 11px;
- text-align: justify;
- padding: 5px 10px 0px 10px;
-}
-.msie #product_list .description {
- padding: 5px 10px 10px 10px;
-}
-
-/* * * Show Product * * * * * * * * * * * * */
-
-#show_product .product-pic {
- float: left;
- margin-right: 15px;
- border: 1px solid #444;
- padding: 2px;
- background: #FFF;
-}
-
-#show_product .product_category {
- padding-top: 10px;
- clear: left;
-}
-
+@import url('products.css');
diff --git a/public/stylesheets/controller_content_viewer.css b/public/stylesheets/controller_content_viewer.css
index b1ffec3..d6e3169 100644
--- a/public/stylesheets/controller_content_viewer.css
+++ b/public/stylesheets/controller_content_viewer.css
@@ -1,3 +1,5 @@
+@import url('products.css');
+
/************* enterprise homepage style *****************/
div.event-info {
diff --git a/public/stylesheets/products.css b/public/stylesheets/products.css
new file mode 100644
index 0000000..530285c
--- /dev/null
+++ b/public/stylesheets/products.css
@@ -0,0 +1,80 @@
+/* * * List Products * * * * * * * * * * * * */
+
+#product_list {
+ margin: 0px;
+ padding: 0px;
+}
+
+#product_list ul {
+ margin: 0px;
+ padding: 0px;
+}
+
+#content #product_list li {
+ margin: 0px;
+ padding: 0px;
+ list-style: none;
+}
+
+#content #product_list li.product {
+ border: 1px solid #888;
+ margin-bottom: 10px;
+ padding: 5px 10px;
+}
+
+#product_list .product-pic {
+ display: block;
+ width: 64px;
+ height: 64px;
+ background-repeat: no-repeat;
+ background-position: 50% 50%;
+ float: left;
+ margin-right: 15px;
+ position: relative; /* work arround msie bug */
+}
+
+#product_list .product-pic span {
+ display: none;
+}
+
+#content #product_list h3 {
+ margin: 0px;
+ padding: 0px;
+ font-size: 120%;
+}
+.msie #content #product_list h3 {
+ margin-top: -15px;
+}
+#product_list h3 a {
+ text-decoration: none;
+}
+
+#product_list .product_category {
+ font-size: 11px;
+}
+
+#product_list .description {
+ clear: left;
+ font-size: 11px;
+ text-align: justify;
+ padding: 5px 10px 0px 10px;
+}
+.msie #product_list .description {
+ padding: 5px 10px 10px 10px;
+}
+
+/* * * Show Product * * * * * * * * * * * * */
+
+#show_product .product-pic {
+ float: left;
+ margin-right: 15px;
+ border: 1px solid #444;
+ padding: 2px;
+ background: #FFF;
+}
+
+#show_product .product_category {
+ padding-top: 10px;
+ clear: left;
+}
+
diff --git a/test/unit/application_helper_test.rb b/test/unit/application_helper_test.rb
index beec812..e6a71c8 100644
--- a/test/unit/application_helper_test.rb
+++ b/test/unit/application_helper_test.rb
@@ -62,9 +62,11 @@ class ApplicationHelperTest < Test::Unit::TestCase
cat = mock
cat.expects(:path).returns('my-category/my-subcatagory')
cat.expects(:full_name).returns('category name')
+ cat.expects(:environment).returns(Environment.default)
+ Environment.any_instance.expects(:default_hostname).returns('example.com')
result = "/cat/my-category/my-subcatagory"
- expects(:link_to).with('category name', :controller => 'search', :action => 'category_index', :category_path => ['my-category', 'my-subcatagory']).returns(result)
+ expects(:link_to).with('category name', :controller => 'search', :action => 'category_index', :category_path => ['my-category', 'my-subcatagory'], :host => 'example.com').returns(result)
assert_same result, link_to_category(cat)
end
diff --git a/test/unit/enterprise_homepage_test.rb b/test/unit/enterprise_homepage_test.rb
index 8008ec0..4026127 100644
--- a/test/unit/enterprise_homepage_test.rb
+++ b/test/unit/enterprise_homepage_test.rb
@@ -24,4 +24,33 @@ class EnterpriseHomepageTest < Test::Unit::TestCase
assert_match /5555 5555/, result
end
+ should 'display products list' do
+ ent = Enterprise.create!(:identifier => 'test_enterprise', :name => 'Test enteprise')
+ prod = ent.products.create!(:name => 'Product test')
+ a = EnterpriseHomepage.new(:name => 'article homepage')
+ ent.articles << a
+ result = a.to_html
+ assert_match /Product test/, result
+ end
+
+ should 'not display products list if environment do not let' do
+ e = Environment.default
+ e.enable('disable_products_for_enterprises')
+ e.save!
+ ent = Enterprise.create!(:identifier => 'test_enterprise', :name => 'Test enteprise', :environment => e)
+ prod = ent.products.create!(:name => 'Product test')
+ a = EnterpriseHomepage.new(:name => 'article homepage')
+ ent.articles << a
+ result = a.to_html
+ assert_no_match /Product test/, result
+ end
+
+ should 'display link to product' do
+ ent = Enterprise.create!(:identifier => 'test_enterprise', :name => 'Test enteprise')
+ prod = ent.products.create!(:name => 'Product test')
+ a = EnterpriseHomepage.new(:name => 'article homepage')
+ ent.articles << a
+ result = a.to_html
+ assert_match /catalog\/test_enterprise\/#{prod.id}/, result
+ end
end
--
libgit2 0.21.2