X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/07689901a9bf30daeccf8a1ceb7193fe771eb3ac..8132fc186eb0c5fd02c86828c3a4735754296d02:/redakcja/static/js/wiki_img/view_editor_motifs.js diff --git a/redakcja/static/js/wiki_img/view_editor_motifs.js b/redakcja/static/js/wiki_img/view_editor_motifs.js index 7ce96650..ad60c229 100644 --- a/redakcja/static/js/wiki_img/view_editor_motifs.js +++ b/redakcja/static/js/wiki_img/view_editor_motifs.js @@ -7,7 +7,9 @@ options.callback = function(){ var self = this; - self.$tag_name = $('#motifs-editor #tag-name'); + self.$tag_name = $('#motifs-editor .tag-name'); + self.$toolbar = $('#motifs-editor .toolbar'); + self.$scrolled = $('#motifs-editor .scrolled'); withThemes(function(canonThemes){ self.$tag_name.autocomplete(canonThemes, { autoFill: true, @@ -17,7 +19,7 @@ }); }) - self.$objects_list = $('#motifs-editor #objects-list'); + self.$objects_list = $('#motifs-editor .objects-list'); self.x1 = null; self.x2 = null; @@ -26,13 +28,14 @@ if (!CurrentDocument.readonly) { self.ias = $('#motifs-editor img.area-selectable').imgAreaSelect({ handles: true, onSelectEnd: self._fillCoords(self), instance: true }); - $('#motifs-editor #add').click(self._addObject(self)); + $('#motifs-editor .add').click(self._addObject(self)); $('.delete', self.$objects_list).live('click', function() { $(this).prev().trigger('click'); if (window.confirm("Czy na pewno chcesz usunąć ten motyw?")) { $(this).prev().remove(); $(this).remove(); + self._refreshLayout(); } self._resetSelection(); return false; @@ -70,6 +73,9 @@ self.ias.setOptions({ hide: true }); } + MotifsPerspective.prototype._refreshLayout = function() { + this.$scrolled.css({top: this.$toolbar.height()}); + }; MotifsPerspective.prototype._push = function(name, x1, y1, x2, y2) { var $e = $('') @@ -77,7 +83,8 @@ if (x1 !== null) $e.data('coords', [x1, y1, x2, y2]); this.$objects_list.append($e); - this.$objects_list.append('(x)'); + this.$objects_list.append('(x) '); + this._refreshLayout(); } @@ -117,7 +124,7 @@ var self = this; this.$objects_list.children().remove(); - $.each(this.doc.getImageItems('motyw'), function(i, e) { + $.each(this.doc.getImageItems('theme'), function(i, e) { self._push.apply(self, e); }); @@ -140,7 +147,7 @@ args.unshift($(e).text()); motifs.push(args); }) - self.doc.setImageItems('motyw', motifs); + self.doc.setImageItems('theme', motifs); this.ias.setOptions({disable: true, hide: true});