mm-1631 - Fixing image previewer bug

Этот коммит содержится в:
Asaad Mahmood
2015-07-21 16:47:08 +05:00
родитель a820b67468
Коммит 4b7fda14ba
3 изменённых файлов: 13 добавлений и 4 удалений

Просмотреть файл

@@ -234,7 +234,7 @@ module.exports = React.createClass({
}, },
render: function() { render: function() {
var server_error = this.state.server_error ? <div className='form-group has-error'><label className='control-label'>{ this.state.server_error }</label></div> : null; var server_error = this.state.server_error ? <div className='has-error'><label className='control-label'>{ this.state.server_error }</label></div> : null;
var post_error = this.state.post_error ? <label className='control-label'>{this.state.post_error}</label> : null; var post_error = this.state.post_error ? <label className='control-label'>{this.state.post_error}</label> : null;
var limit_error = this.state.limit_error ? <div className='has-error'><label className='control-label'>{this.state.limit_error}</label></div> : null; var limit_error = this.state.limit_error ? <div className='has-error'><label className='control-label'>{this.state.limit_error}</label></div> : null;

Просмотреть файл

@@ -25,7 +25,11 @@ module.exports = React.createClass({
this.setState({ imgId: nextProps.startId }); this.setState({ imgId: nextProps.startId });
}, },
loadImage: function(id) { loadImage: function(id) {
if (this.state.loaded[id] || this.state.images[id]) return; var imgHeight = $(window).height()-100;
if (this.state.loaded[id] || this.state.images[id]){
$('.modal .modal-image .image-wrapper img').css("max-height",imgHeight);
return;
};
var src = ""; var src = "";
if (this.props.imgCount > 0) { if (this.props.imgCount > 0) {
@@ -48,6 +52,7 @@ module.exports = React.createClass({
var loaded = self.state.loaded; var loaded = self.state.loaded;
loaded[imgid] = true; loaded[imgid] = true;
self.setState({ loaded: loaded }); self.setState({ loaded: loaded });
$(self.refs.image.getDOMNode()).css("max-height",imgHeight);
}; };
}(id); }(id);
var images = this.state.images; var images = this.state.images;
@@ -56,10 +61,8 @@ module.exports = React.createClass({
}, },
componentDidUpdate: function() { componentDidUpdate: function() {
if (this.refs.image) { if (this.refs.image) {
var height = $(window).height()-100;
if (this.state.loaded[this.state.imgId]) { if (this.state.loaded[this.state.imgId]) {
$(this.refs.imageWrap.getDOMNode()).removeClass("default"); $(this.refs.imageWrap.getDOMNode()).removeClass("default");
$(this.refs.image.getDOMNode()).css("max-height",height);
} }
} }
}, },

Просмотреть файл

@@ -187,6 +187,12 @@ body.ios {
.post-create-footer { .post-create-footer {
@include clearfix; @include clearfix;
padding: 0; padding: 0;
.has-error {
.control-label {
font-weight: normal;
margin-bottom: 0;
}
}
.msg-typing { .msg-typing {
min-height: 20px; min-height: 20px;
line-height: 18px; line-height: 18px;