},
modelDataChanged: function(property, value)
- {
- if( property == 'data')
- {
- this.render();
- this.gotoPage(this.currentPage);
- }
+ {
+ console.log(this.model.get('state'), value, value.length);
+ if ((this.model.get('state') == 'synced') && (value.length == 0)) {
+ console.log('tutaj');
+ this.render('image-gallery-empty-template');
+ } else {
+ this.render();
+ this.gotoPage(this.currentPage);
+ }
},
gotoPage: function(index)
modelStateChanged: function(property, value) {
if (value == 'loading') {
- // this.freeze('Ładowanie...');
+ this.freeze('Ładowanie...');
} else {
+ if ((value == 'synced') && (this.model.get('data').length == 0)) {
+ this.render('image-gallery-empty-template');
+ }
this.unfreeze();
}
},
mousedown(this.pageDragStart.bind(this));
},
- render: function()
+ render: function(template)
{
if(!this.model) return;
if(this.$zoomResetButton) this.$zoomResetButton.unbind();
/* render */
- this._super();
+ this._super(template);
/* fetch important parts */
this.$pageListRoot = $('.image-gallery-page-list', this.element);
$(this.element).bind('resize', this._resizeHandler);
},
- render: function() {
+ render: function(template) {
console.log('rendering:', this._className);
- this.element.html(render_template(this.template, this));
+ this.element.html(render_template(template || this.template, this));
},
frozen: function() {
</div>
</script>
+ <script type="text/html" charset="utf-8" id="image-gallery-empty-template">
+ <div class="image-gallery-empty-template">
+ Galeria jest pusta
+ </div>
+ </script>
+
<script type="text/html" charset="utf-8" id="button-toolbar-view-template">
<div class="buttontoolbarview panel-toolbar">
<div class="buttontoolbarview-tabs toolbar-tabs-container toolbar-buttons-container">