bunch of minor fixes
This commit is contained in:
@@ -2,4 +2,18 @@ class Category < ActiveRecord::Base
|
|||||||
has_many :sub_categories
|
has_many :sub_categories
|
||||||
has_many :filter_criterias, as: :owner
|
has_many :filter_criterias, as: :owner
|
||||||
belongs_to :section
|
belongs_to :section
|
||||||
|
|
||||||
|
rails_admin do
|
||||||
|
object_label_method do
|
||||||
|
:custom_cat_name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def custom_cat_name
|
||||||
|
return self.name if not self.section
|
||||||
|
|
||||||
|
section = self.section.name
|
||||||
|
"#{section} -> #{self.name}"
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,4 +6,9 @@ class FilterCriteria < ActiveRecord::Base
|
|||||||
def owner_type=(class_name)
|
def owner_type=(class_name)
|
||||||
super(class_name.constantize.base_class.to_s)
|
super(class_name.constantize.base_class.to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def type_enum
|
||||||
|
# Do not select any value, or add any blank field. RailsAdmin will do it for you.
|
||||||
|
[['Multi select', 1], ['Single select', 2]]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,3 +1,16 @@
|
|||||||
class FilterCriteriaValue < ActiveRecord::Base
|
class FilterCriteriaValue < ActiveRecord::Base
|
||||||
belongs_to :filter_criteria
|
belongs_to :filter_criteria
|
||||||
|
|
||||||
|
rails_admin do
|
||||||
|
object_label_method do
|
||||||
|
:custom_name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def custom_name
|
||||||
|
filter_title = self.filter_criteria.title if self.filter_criteria
|
||||||
|
|
||||||
|
"#{filter_title} - #{self.filter_text},#{self.filter_value}"
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,8 +9,11 @@ class SubCategory < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def custom_subcat_name
|
def custom_subcat_name
|
||||||
|
return self.name if not self.category
|
||||||
|
|
||||||
cat = self.category.name
|
cat = self.category.name
|
||||||
section = self.category.section.name
|
section = self.category.section.name
|
||||||
|
|
||||||
"#{section} -> #{cat} -> #{self.name}"
|
"#{section} -> #{cat} -> #{self.name}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ var ByCategory = React.createClass({
|
|||||||
componentWillReceiveProps: function() {
|
componentWillReceiveProps: function() {
|
||||||
var categoryId = this.getParams().id;
|
var categoryId = this.getParams().id;
|
||||||
|
|
||||||
|
this.filter = this.getQuery();
|
||||||
this.setState({
|
this.setState({
|
||||||
filter: this.filter
|
filter: this.filter
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ var RootApp = React.createClass({
|
|||||||
<div className="container">
|
<div className="container">
|
||||||
|
|
||||||
<div className='page-header'>
|
<div className='page-header'>
|
||||||
<h1 className="main-heading"><a href="#">Ribica.ba</a></h1> <CartIcon />
|
<h1 className="main-heading"><a href="#" style={{color: "#cd3071"}}>ribica.ba</a></h1> <CartIcon />
|
||||||
</div>
|
</div>
|
||||||
<div className='row'>
|
<div className='row'>
|
||||||
<div className='col-md-12' id='header'>
|
<div className='col-md-12' id='header'>
|
||||||
|
|||||||
Reference in New Issue
Block a user