Skip to content

Commit

Permalink
Merge pull request #40 from larissa/sniffer
Browse files Browse the repository at this point in the history
Sniffer fix and improvements
  • Loading branch information
brauliobo committed Apr 15, 2015
2 parents 2eb4857 + b24866b commit ff035d2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions app/models/product_category.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ class ProductCategory < Category
:joins => :products,
:conditions => ['products.profile_id = ?', enterprise.id]
}}
scope :by_environment, lambda { |environment| {
:conditions => ['environment_id = ?', environment.id]
}}
scope :unique_by_level, lambda { |level| {
:select => "DISTINCT ON (filtered_category) split_part(path, '/', #{level}) AS filtered_category, categories.*"
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ def edit
end

def product_categories
scope = environment.categories.where("type = 'ProductCategory'")
scope = ProductCategory.by_environment(environment)
@categories = find_by_contents(:product_categories, @profile, scope, params[:q], {:per_page => 10, :page => 1})[:results]

render :json => @categories.map{ |i| {:id => i.id, :name => i.name} }
end

def product_category_search
scope = environment.categories.where("type = 'ProductCategory'")
scope = ProductCategory.by_environment(environment)
@categories = find_by_contents(:product_categories, @profile, scope, params[:term], {:per_page => 10, :page => 1})[:results]

render :json => @categories.map{ |pc| {:value => pc.id, :label => pc.name} }
Expand Down
6 changes: 6 additions & 0 deletions plugins/sniffer/public/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
padding-left: 10%;
padding-top: 12px;
text-shadow: 0 2px white, 2px 0 white, 0 -2px white, -2px 0 white;
background-color: transparent;
float: left;
-webkit-user-select: none;
-moz-user-select: none;
Expand Down Expand Up @@ -364,6 +365,9 @@ body.action-sniffer_plugin_myprofile-search #profile-footer {
font-size: 110%;
padding-bottom: 5px;
color: #956841;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
#sniffer-search-wrap .infoBox .sniffer-balloon .enterprise-categories a {
color: #956841;
Expand All @@ -384,6 +388,8 @@ body.action-sniffer_plugin_myprofile-search #profile-footer {
#sniffer-search-wrap .infoBox .offers-or-needs .products {
padding: 2px 5px;
color: #253409;
max-height: 100px;
overflow: auto;
}

#sniffer-search-wrap .infoBox .offers-or-needs .products.empty {
Expand Down

0 comments on commit ff035d2

Please sign in to comment.