items are now done and pictures resize on serverside automagically
This commit is contained in:
@@ -2,4 +2,13 @@ class MultiMediaDescription < ActiveRecord::Base
|
|||||||
belongs_to :item
|
belongs_to :item
|
||||||
belongs_to :media_type
|
belongs_to :media_type
|
||||||
|
|
||||||
|
|
||||||
|
def attributes
|
||||||
|
super.merge('resized_url' => self.resized_url)
|
||||||
|
end
|
||||||
|
|
||||||
|
def resized_url
|
||||||
|
url.gsub('/upload/v','/upload/c_lpad,h_170,w_226/v')
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ var ItemList = React.createClass({
|
|||||||
return (
|
return (
|
||||||
<div className="row-fluid">
|
<div className="row-fluid">
|
||||||
<div className="span10">
|
<div className="span10">
|
||||||
<ul className="item_list">
|
<div style={{marginTop: 35, padding: '0 25px'}} className="row">
|
||||||
{items}
|
{items}
|
||||||
</ul>
|
</div>
|
||||||
{this.getPages()}
|
{this.getPages()}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -11,22 +11,36 @@ var SingleItem = React.createClass({
|
|||||||
var self = this;
|
var self = this;
|
||||||
var itemClick = this.itemClick;
|
var itemClick = this.itemClick;
|
||||||
var firstImage = this.props.item.get('multi_media_descriptions')[0];
|
var firstImage = this.props.item.get('multi_media_descriptions')[0];
|
||||||
firstImage = firstImage || { url: "https://res.cloudinary.com/lfvt7ps2n/image/upload/c_crop,g_center,w_300/v1421732950/http_www.asms.ru_bitrix_templates_main_images_nophoto_irnofq.png" } ;
|
firstImage = firstImage || { resized_url: "https://res.cloudinary.com/lfvt7ps2n/image/upload/c_fit,h_172,w_226/v1421732950/http_www.asms.ru_bitrix_templates_main_images_nophoto_irnofq.png" } ;
|
||||||
if (hidePrice) {
|
if (hidePrice) {
|
||||||
return (
|
return (
|
||||||
<div className="single_item" onClick={itemClick}>
|
<div className="col-lg-2 col-md-2 col-sm-3 col-xs-6">
|
||||||
<img src={firstImage.url} className="item_list_image" />
|
<div className="productbox">
|
||||||
<h1> { this.props.item.get('name') }</h1>
|
<img className="img-responsive" src={firstImage.url} alt="product image" />
|
||||||
</div>
|
<div>
|
||||||
|
|
||||||
|
<p>{ this.props.item.get('brand') ? this.props.item.get('brand').name : '' }{ this.props.item.get('name') }</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return (
|
return (
|
||||||
<div className="single_item" onClick={itemClick}>
|
|
||||||
<img src={firstImage.url} className="item_list_image" />
|
<div className="col-lg-2 col-md-2 col-sm-3 col-xs-6" onClick={itemClick}>
|
||||||
<h1> { this.props.item.get('name') }</h1>
|
<div className="productbox">
|
||||||
<div>{ this.props.item.get('brand')? this.props.item.get('brand').name : '' } </div>
|
<img className="img-responsive" src={firstImage.resized_url} alt="product image" />
|
||||||
<div> { this.props.item.get('list_price') } KM </div>
|
<div>
|
||||||
|
<div>
|
||||||
|
|
||||||
|
<p>{ this.props.item.get('brand') ? this.props.item.get('brand').name : '' }{ this.props.item.get('name') }</p>
|
||||||
|
<h4> { this.props.item.get('list_price') } KM </h4>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ background: none;
|
|||||||
}
|
}
|
||||||
|
|
||||||
.productbox{
|
.productbox{
|
||||||
|
cursor: pointer;
|
||||||
-moz-box-shadow: 1px 4px 25px #000000;
|
-moz-box-shadow: 1px 4px 25px #000000;
|
||||||
-webkit-box-shadow: 1px 4px 25px #000000;
|
-webkit-box-shadow: 1px 4px 25px #000000;
|
||||||
box-shadow: 1px 4px 25px #000000;
|
box-shadow: 1px 4px 25px #000000;
|
||||||
@@ -138,7 +139,7 @@ text-decoration: underline;
|
|||||||
|
|
||||||
}
|
}
|
||||||
.productbox div span{
|
.productbox div span{
|
||||||
color:#06c3c3;
|
color: black;
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ var fetchItemWithDetails = function() {
|
|||||||
item.fetch({
|
item.fetch({
|
||||||
success: function() {
|
success: function() {
|
||||||
_images = (_itemWithDetails.get("multi_media_descriptions") || []).map(function(mmd) {
|
_images = (_itemWithDetails.get("multi_media_descriptions") || []).map(function(mmd) {
|
||||||
return mmd.url;
|
return mmd.resized_url;
|
||||||
});
|
});
|
||||||
_count = _images.length;
|
_count = _images.length;
|
||||||
_currentImage = 0;
|
_currentImage = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user