Commit df6d28640a93c933b8d2866546306a1a968e1cdf
1 parent
07f9167d
Exists in
master
and in
22 other branches
Including a link to the start of the catalog on catalog categories left block
Showing
4 changed files
with
17 additions
and
4 deletions
Show diff stats
app/models/enterprise.rb
| @@ -185,4 +185,8 @@ class Enterprise < Organization | @@ -185,4 +185,8 @@ class Enterprise < Organization | ||
| 185 | Scrap.find_by_sql("SELECT id, updated_at, 'Scrap' AS klass FROM scraps WHERE scraps.receiver_id = #{self.id} AND scraps.scrap_id IS NULL UNION SELECT id, updated_at, 'ActionTracker::Record' AS klass FROM action_tracker WHERE action_tracker.target_id = #{self.id} UNION SELECT action_tracker.id, action_tracker.updated_at, 'ActionTracker::Record' AS klass FROM action_tracker INNER JOIN articles ON action_tracker.target_id = articles.id WHERE articles.profile_id = #{self.id} AND action_tracker.target_type = 'Article' ORDER BY action_tracker.updated_at DESC") | 185 | Scrap.find_by_sql("SELECT id, updated_at, 'Scrap' AS klass FROM scraps WHERE scraps.receiver_id = #{self.id} AND scraps.scrap_id IS NULL UNION SELECT id, updated_at, 'ActionTracker::Record' AS klass FROM action_tracker WHERE action_tracker.target_id = #{self.id} UNION SELECT action_tracker.id, action_tracker.updated_at, 'ActionTracker::Record' AS klass FROM action_tracker INNER JOIN articles ON action_tracker.target_id = articles.id WHERE articles.profile_id = #{self.id} AND action_tracker.target_type = 'Article' ORDER BY action_tracker.updated_at DESC") |
| 186 | end | 186 | end |
| 187 | 187 | ||
| 188 | + def catalog_url | ||
| 189 | + { :profile => identifier, :controller => 'catalog'} | ||
| 190 | + end | ||
| 191 | + | ||
| 188 | end | 192 | end |
app/views/catalog/index.rhtml
| @@ -7,7 +7,8 @@ | @@ -7,7 +7,8 @@ | ||
| 7 | 7 | ||
| 8 | <div class='l-sidebar-left-bar'> | 8 | <div class='l-sidebar-left-bar'> |
| 9 | <ul> | 9 | <ul> |
| 10 | - <%= content_tag('li', link_to(_('Enterprise homepage'), profile.public_profile_url), :id => 'catalog-categories-homepage-link') %> | 10 | + <%= content_tag('li', link_to(_('Enterprise homepage'), profile.public_profile_url), :class => 'catalog-categories-link') %> |
| 11 | + <%= content_tag('li', link_to(_('Catalog start'), profile.catalog_url), :class => 'catalog-categories-link') %> | ||
| 11 | <% if @categories.present? %> | 12 | <% if @categories.present? %> |
| 12 | <% @categories.each do |category| %> | 13 | <% @categories.each do |category| %> |
| 13 | <%= category_link(category) %> | 14 | <%= category_link(category) %> |
public/stylesheets/application.css
| @@ -2723,7 +2723,7 @@ div#activation_enterprise label, div#activation_enterprise input, div#activation | @@ -2723,7 +2723,7 @@ div#activation_enterprise label, div#activation_enterprise input, div#activation | ||
| 2723 | padding-bottom: 0.5em; | 2723 | padding-bottom: 0.5em; |
| 2724 | } | 2724 | } |
| 2725 | 2725 | ||
| 2726 | -#catalog-categories-homepage-link { | 2726 | +.l-sidebar-left-bar .catalog-categories-link { |
| 2727 | background-color: #d3d7cf; | 2727 | background-color: #d3d7cf; |
| 2728 | font-weight: bold; | 2728 | font-weight: bold; |
| 2729 | height: 28px; | 2729 | height: 28px; |
| @@ -2733,12 +2733,12 @@ div#activation_enterprise label, div#activation_enterprise input, div#activation | @@ -2733,12 +2733,12 @@ div#activation_enterprise label, div#activation_enterprise input, div#activation | ||
| 2733 | } | 2733 | } |
| 2734 | 2734 | ||
| 2735 | 2735 | ||
| 2736 | -#catalog-categories-homepage-link:hover { | 2736 | +.l-sidebar-left-bar .catalog-categories-link:hover { |
| 2737 | background-color: #babdb6; | 2737 | background-color: #babdb6; |
| 2738 | } | 2738 | } |
| 2739 | 2739 | ||
| 2740 | 2740 | ||
| 2741 | -#catalog-categories-homepage-link a{ | 2741 | +.l-sidebar-left-bar .catalog-categories-link a{ |
| 2742 | display: inline-block; | 2742 | display: inline-block; |
| 2743 | height: 100%; | 2743 | height: 100%; |
| 2744 | width: 100%; | 2744 | width: 100%; |
test/unit/enterprise_test.rb
| @@ -523,4 +523,12 @@ class EnterpriseTest < ActiveSupport::TestCase | @@ -523,4 +523,12 @@ class EnterpriseTest < ActiveSupport::TestCase | ||
| 523 | assert_not_includes enterprise.activities.map { |a| a.klass.constantize.find(a.id) }, article.activity | 523 | assert_not_includes enterprise.activities.map { |a| a.klass.constantize.find(a.id) }, article.activity |
| 524 | end | 524 | end |
| 525 | 525 | ||
| 526 | + should 'provide URL to catalog area' do | ||
| 527 | + environment = create_environment('mycolivre.net') | ||
| 528 | + enterprise = build(Enterprise, :identifier => 'testprofile', :environment_id => create_environment('mycolivre.net').id) | ||
| 529 | + | ||
| 530 | + assert_equal({:profile => enterprise.identifier, :controller => 'catalog'}, enterprise.catalog_url) | ||
| 531 | + end | ||
| 532 | + | ||
| 533 | + | ||
| 526 | end | 534 | end |