From cdde2323bf9a3e2e11be49f0b5f5600d9caffd4b Mon Sep 17 00:00:00 2001 From: pavel Date: Sun, 21 Dec 2014 11:18:57 +0000 Subject: [PATCH] EXPO-15 is ready, except some server-side bugs.for reference see task text in jira --- templates/client/blank.html | 19 ++-- .../client/includes/calendar_button.html | 3 + .../includes/exposition/exposition_list.html | 4 +- .../exposition/exposition_object.html | 24 +++-- templates/client/index.html | 23 ++++- templates/client/static_client/css/main.css | 13 +++ .../static_client/js/_modules/block.common.js | 10 +-- .../js/_modules/block.exposition.list.js | 3 +- .../js/_modules/page.exposition.object.js | 87 +++++++++---------- .../static_client/js/_modules/page.index.js | 74 ++++++++++++++++ 10 files changed, 185 insertions(+), 75 deletions(-) create mode 100644 templates/client/static_client/js/_modules/page.index.js diff --git a/templates/client/blank.html b/templates/client/blank.html index a5d71206..4798acf0 100644 --- a/templates/client/blank.html +++ b/templates/client/blank.html @@ -50,6 +50,15 @@ This template include basic anf main styles and js files, {% block style %} {% endblock %} + - {% if request.user.is_authentificated %} - {% trans 'заметка' %} - {% endif %} +
+ {% trans 'заметка' %} +
+
+ +
+
+
{% for tag in event.tag.all %} @@ -262,4 +266,15 @@
+ + {% endblock %} diff --git a/templates/client/static_client/css/main.css b/templates/client/static_client/css/main.css index 89513ce9..90f3d073 100644 --- a/templates/client/static_client/css/main.css +++ b/templates/client/static_client/css/main.css @@ -12421,3 +12421,16 @@ hr + .rq-note { margin-left: -1px; margin-bottom: -8px; } + +/******************************\ +# edit note overlay on /main page +\******************************/ + + + .main-page.note-wrap .note-overlay{ + bottom: 0; + margin-bottom: 26px; + } + .main-page.note-wrap:hover .note-button:after{ + margin-bottom: 22px; + } \ No newline at end of file diff --git a/templates/client/static_client/js/_modules/block.common.js b/templates/client/static_client/js/_modules/block.common.js index 511449a2..85c0dd6c 100644 --- a/templates/client/static_client/js/_modules/block.common.js +++ b/templates/client/static_client/js/_modules/block.common.js @@ -187,6 +187,8 @@ if (EXPO.common){ $(function () { $('.'+addClass+', .'+remClass).on('click', function(event){ + addText = self.opt.addCalendarText; + remText = self.opt.removeCalendarText; event.preventDefault(); var $this = $(this); var url = $this.attr('href'); @@ -197,17 +199,9 @@ if (EXPO.common){ else{ if(data.success){ if(data.in){ - //if($this.hasClass(addClass)){ - // $this.hide(); - // $this.siblings('.removecalendar').show() - //} $this.removeClass(addClass).addClass(remClass).text(remText); } else{ - //if($this.hasClass('removecalendar')){ - // $this.hide(); - // $this.siblings('.addcalendar').show() - //} $this.removeClass(remClass).addClass(addClass).text(addText); } diff --git a/templates/client/static_client/js/_modules/block.exposition.list.js b/templates/client/static_client/js/_modules/block.exposition.list.js index 962a46bc..e98f7d87 100644 --- a/templates/client/static_client/js/_modules/block.exposition.list.js +++ b/templates/client/static_client/js/_modules/block.exposition.list.js @@ -70,7 +70,8 @@ if (EXPO.exposition.list){ $.fancybox.open('#pw-login'); return false; }); - + com.opt.addCalendarText = this.opt.addCalendarText; + com.opt.removeCalendarText = this.opt.removeCalendarText; }; return that; }()); diff --git a/templates/client/static_client/js/_modules/page.exposition.object.js b/templates/client/static_client/js/_modules/page.exposition.object.js index 37f163e4..630b547b 100644 --- a/templates/client/static_client/js/_modules/page.exposition.object.js +++ b/templates/client/static_client/js/_modules/page.exposition.object.js @@ -5,63 +5,47 @@ if (EXPO.exposition.object){ }else { EXPO.exposition.object = (function () { +// dependencies + var com = EXPO.common; // variables var that = {}, - VisitButtons = function ( opt) { + Note = function (it, opt) { this.opt = opt; - this.isActive = false; - this.$visitorsList = $(document.getElementById(opt.visitorsListId)); - this.$secondary = $(document.getElementById(opt.wrapId)); - this._controller(); - - }, - UnVisitButtons = function (opt) { - this.opt = opt; - this.$visitorsList = $(document.getElementById(opt.visitorsListId)); - this.$secondary = $(document.getElementById(opt.wrapId)); + this.DOMthis = it; + this.DOMbutton = it.querySelector('.'+opt.buttonClass); + this.DOMinput = it.querySelector('.'+opt.inputClass); + this.inputName = this.DOMinput.getAttribute('name'); + this.url = this.DOMbutton.getAttribute('href'); this._controller(); }; - VisitButtons.prototype = { - _controller: function () { - var self = this; - $('.'+this.opt.class).on('click',function(){ - self._setName(); - $('.'+self.opt.class).hide().siblings('.button').show(); + Note.prototype = { + _init: function () { - - }); }, - _setName: function () { - $('
  • ').html(this.opt.template).prependTo(this.$visitorsList); - this.$secondary.hide(); - isActive = true; - } - }; - UnVisitButtons.prototype = { _controller: function () { var self = this; - $('.'+this.opt.class).on('click',function(){ - self._unSetName(); - $('.'+self.opt.class).hide().siblings('.button').show(); - - + $(this.DOMinput).on('blur', function () { + self.send(); }); - }, - _unSetName: function () { - var self = this; - this.$visitorsList.children().each(function () { - if($(this).html() == self.opt.template){ - $(this).detach(); - - } + $(this.DOMbutton).on('click', function () { + return false; }); - if(!this.$visitorsList.children().length){ - this.$secondary.show(); - }else{ - this.$secondary.hide(); + }, + send: function () { + var data = {}, + response, + self = this, + handler = function (data) { + if (data.success){ + console.log('ok'); + $(self.DOMbutton).addClass('active'); + }else{ + console.log('data not send'); + } - } - isActive = true; + }; + data[this.inputName] = this.DOMinput.value; + response = com.getRequest(data,this.url,handler); } }; that.opt = {}; //свойства по умолчанию @@ -79,12 +63,21 @@ if (EXPO.exposition.object){ var self = this, $visitorsWrap = $(document.getElementById(self.opt.visitButton.visitorsListId)), $secondaryList = $(document.getElementById(self.opt.visitButton.wrapId)); + this.notes = []; if(!$visitorsWrap.children().length){ $secondaryList.show(); } - this.visitButtons = new VisitButtons(self.opt.visitButton); - this.unVisitButtons = new UnVisitButtons(self.opt.unvisitButton); + $('.'+this.opt.note.wrapClass).each(function () { + var note = new Note(this,self.opt.note); + self.notes.push(note); + }); + $('.'+this.opt.note.wrapDisabledClass).on('click', function () { + $.fancybox.open('#pw-login'); + return false; + }); + com.opt.addCalendarText = this.opt.addCalendarText; + com.opt.removeCalendarText = this.opt.removeCalendarText; }; return that; diff --git a/templates/client/static_client/js/_modules/page.index.js b/templates/client/static_client/js/_modules/page.index.js new file mode 100644 index 00000000..bc5725a2 --- /dev/null +++ b/templates/client/static_client/js/_modules/page.index.js @@ -0,0 +1,74 @@ +var EXPO = EXPO || {}; //isolated namespace +if (EXPO.index) { + console.warn('WARNING: EXPO.eventsFeed is already defined!'); +} else { + EXPO.index = (function () { + // variables + var that = {}; + + //default module setting + that.opt = {}; + //dependence's + var com = EXPO.common; + //private + var Note = function (it, opt) { + this.opt = opt; + this.DOMthis = it; + this.DOMbutton = it.querySelector('.'+opt.buttonClass); + this.DOMinput = it.querySelector('.'+opt.inputClass); + this.inputName = this.DOMinput.getAttribute('name'); + this.url = this.DOMbutton.getAttribute('href'); + this._controller(); + }; + Note.prototype = { + _init: function () { + + }, + _controller: function () { + var self = this; + $(this.DOMinput).on('blur', function () { + self.send(); + }); + $(this.DOMbutton).on('click', function () { + return false; + }); + }, + send: function () { + var data = {}, + response, + self = this, + handler = function (data) { + if (data.success){ + console.log('ok'); + $(self.DOMbutton).addClass('active'); + }else{ + console.log('data not send'); + } + + }; + data[this.inputName] = this.DOMinput.value; + response = com.getRequest(data,this.url,handler); + } + }; + + /////////////////////////// + //инициализация общих свойств + that.init = function (options) { + // settings extending + $.extend(this.opt, options); + // begin of initialization + var self = this; + this.notes = []; + $('.'+this.opt.note.wrapClass).each(function () { + var note = new Note(this,self.opt.note); + self.notes.push(note); + }); + $('.'+this.opt.note.wrapDisabledClass).on('click', function () { + $.fancybox.open('#pw-login'); + return false; + }); + + }; + return that; + }()); +}