EXPO-15 is ready, except some server-side bugs.for reference see task text in jira

remotes/origin/1203
pavel 11 years ago
parent 124f10227c
commit cdde2323bf
  1. 19
      templates/client/blank.html
  2. 3
      templates/client/includes/calendar_button.html
  3. 4
      templates/client/includes/exposition/exposition_list.html
  4. 24
      templates/client/includes/exposition/exposition_object.html
  5. 23
      templates/client/index.html
  6. 13
      templates/client/static_client/css/main.css
  7. 10
      templates/client/static_client/js/_modules/block.common.js
  8. 3
      templates/client/static_client/js/_modules/block.exposition.list.js
  9. 87
      templates/client/static_client/js/_modules/page.exposition.object.js
  10. 74
      templates/client/static_client/js/_modules/page.index.js

@ -50,6 +50,15 @@ This template include basic anf main styles and js files,
<!-- extra styles --> <!-- extra styles -->
{% block style %} {% block style %}
{% endblock %} {% endblock %}
<script type="text/javascript">
EXPO.common.init({
addCalendarClass:"addcalendar",
removeCalendarClass:"removecalendar",
addCalendarText:"{% trans 'добавить в календарь' %}",
removeCalendarText:"{% trans 'Убрать из календаря' %}",
loginModalId:'pw-login'
});
</script>
</head> </head>
<body {% block body_class %}{% endblock %}> <body {% block body_class %}{% endblock %}>
<!--[if lt IE 8]> <!--[if lt IE 8]>
@ -169,14 +178,6 @@ This template include basic anf main styles and js files,
{% endif %} {% endif %}
{% endcomment %} {% endcomment %}
<div id="wait-ajax" class="wait-ajax" style="display:none;"><img src="{% static 'client/img/ajax-loader.gif' %}" alt=""/></div> <div id="wait-ajax" class="wait-ajax" style="display:none;"><img src="{% static 'client/img/ajax-loader.gif' %}" alt=""/></div>
<script type="text/javascript">
EXPO.common.init({
addCalendarClass:"addcalendar",
removeCalendarClass:"removecalendar",
addCalendarText:"{% trans 'добавить в календарь' %}",
removeCalendarText:"{% trans 'Убрать из календаря' %}",
loginModalId:'pw-login'
});
</script>
</body> </body>

@ -1,5 +1,6 @@
{% load i18n %} {% load i18n %}
{% load template_filters %} {% load template_filters %}
{% comment %}
{% if user.is_authenticated %} {% if user.is_authenticated %}
{% if event|in_calendar:user %} {% if event|in_calendar:user %}
<a style="display:none;" class="button blue icon-calendar addcalendar" href="{{ event.get_calendar_url }}">{% trans 'в расписание' %}</a> <a style="display:none;" class="button blue icon-calendar addcalendar" href="{{ event.get_calendar_url }}">{% trans 'в расписание' %}</a>
@ -12,4 +13,6 @@
<a class="button blue icon-calendar addcalendar" href="{{ event.get_calendar_url }}">{% trans 'в расписание' %}</a> <a class="button blue icon-calendar addcalendar" href="{{ event.get_calendar_url }}">{% trans 'в расписание' %}</a>
<a style="display:none;" class="button blue icon-calendar removecalendar" href="{{ event.get_calendar_url }}">{% trans 'из расписания' %}</a> <a style="display:none;" class="button blue icon-calendar removecalendar" href="{{ event.get_calendar_url }}">{% trans 'из расписания' %}</a>
{% endif %} {% endif %}
{% endcomment %}
<a class="button blue icon-calendar {% if obj|in_calendar:request.user %}removecalendar {% else %}addcalendar {% endif %}" href="{{ event.get_calendar_url }}">{% if obj|in_calendar:request.user %}{% trans 'Из расписания' %}{% else %}{% trans 'В расписание' %}{% endif %}</a>

@ -121,7 +121,9 @@
wrapDisabledClass:'note-wrap-disabled', wrapDisabledClass:'note-wrap-disabled',
buttonClass:'note-button', buttonClass:'note-button',
inputClass:'note-text' inputClass:'note-text'
} },
addCalendarText:"{% trans 'В расписание' %}",
removeCalendarText:"{% trans 'Из расписания' %}"
}); });
</script> </script>
{% endblock %} {% endblock %}

@ -77,7 +77,16 @@
{% with event=exposition user=user %} {% with event=exposition user=user %}
{% include 'client/includes/calendar_button.html' %} {% include 'client/includes/calendar_button.html' %}
{% endwith %} {% endwith %}
<a class="button green icon-note" href="/expo/add-note/{{ object.url }}/">{% trans 'заметка' %}</a> <div class="{% if request.user.is_authenticated%}note-wrap{% else %}note-wrap-disabled{% endif %}">
<a class="button green icon-note {% if note %}active{% endif %} note-button" href="/expo/add-note{{ obj.url }}/">{% trans 'заметка' %}</a>
<div class="note-overlay">
<form action="">
<textarea name="note_text" class="note-text"> {{ note }}</textarea>
</form>
</div>
</div>
{% if request.user.is_admin %} {% if request.user.is_admin %}
<a class="button green " href="/admin/exposition/{{ object.url }}/">{% trans 'изменить' %}</a> <a class="button green " href="/admin/exposition/{{ object.url }}/">{% trans 'изменить' %}</a>
{% endif %} {% endif %}
@ -368,7 +377,6 @@
visitButton:{ visitButton:{
class:'visit', class:'visit',
wrapId:'secondary-visit', wrapId:'secondary-visit',
user:{name:'Павел Гендельман',url:'expomap.ru'},
template:'<a href="{{ request.user.get_permanent_url }}">{{ request.user.get_full_name }}</a>', template:'<a href="{{ request.user.get_permanent_url }}">{{ request.user.get_full_name }}</a>',
visitorsListId:'visitors-list' visitorsListId:'visitors-list'
@ -378,9 +386,15 @@
wrapId:'secondary-visit', wrapId:'secondary-visit',
template:'<a href="{{ request.user.get_permanent_url }}">{{ request.user.get_full_name }}</a>', template:'<a href="{{ request.user.get_permanent_url }}">{{ request.user.get_full_name }}</a>',
visitorsListId:'visitors-list' visitorsListId:'visitors-list'
},
note:{
} wrapClass:'note-wrap',
wrapDisabledClass:'note-wrap-disabled',
buttonClass:'note-button',
inputClass:'note-text'
},
addCalendarText:"{% trans 'В расписание' %}",
removeCalendarText:"{% trans 'Из расписания' %}"
}); });
</script> </script>
{% endblock %} {% endblock %}

@ -47,10 +47,14 @@
<footer> <footer>
<div class="re-buttons"> <div class="re-buttons">
<a class="button blue icon-calendar {% if event|in_calendar:request.user %}removecalendar {% else %}addcalendar {% endif %}" href="{{ event.get_calendar_url }}">{% if event|in_calendar:request.user %}{% trans 'Убрать из календаря' %}{% else %}{% trans 'добавить в календарь' %}{% endif %}</a> <a class="button blue icon-calendar {% if event|in_calendar:request.user %}removecalendar {% else %}addcalendar {% endif %}" href="{{ event.get_calendar_url }}">{% if event|in_calendar:request.user %}{% trans 'Убрать из календаря' %}{% else %}{% trans 'добавить в календарь' %}{% endif %}</a>
<!--<a class="button blue icon-calendar removecalendar" href="{{ event.get_calendar_url }}">{% trans 'Убрать из календаря' %}</a>--> <div class="main-page {% if request.user.is_authenticated%}note-wrap{% else %}note-wrap-disabled{% endif %}">
{% if request.user.is_authentificated %} <a class="button green icon-note {% if note %}active{% endif %} note-button" href="/expo/add-note{{ obj.url }}/">{% trans 'заметка' %}</a>
<a class="button green icon-note" href="#">{% trans 'заметка' %}</a> <div class="note-overlay">
{% endif %} <form action="">
<textarea name="note_text" class="note-text"> {{ note }}</textarea>
</form>
</div>
</div>
</div> </div>
<div class="re-tags"> <div class="re-tags">
{% for tag in event.tag.all %} {% for tag in event.tag.all %}
@ -262,4 +266,15 @@
</div> </div>
</section> </section>
<script src="{% static 'client/js/_modules/page.index.js' %}"></script>
<script>
EXPO.index.init({
note:{
wrapClass:'note-wrap',
wrapDisabledClass:'note-wrap-disabled',
buttonClass:'note-button',
inputClass:'note-text'
}
});
</script>
{% endblock %} {% endblock %}

@ -12421,3 +12421,16 @@ hr + .rq-note {
margin-left: -1px; margin-left: -1px;
margin-bottom: -8px; 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;
}

@ -187,6 +187,8 @@ if (EXPO.common){
$(function () { $(function () {
$('.'+addClass+', .'+remClass).on('click', function(event){ $('.'+addClass+', .'+remClass).on('click', function(event){
addText = self.opt.addCalendarText;
remText = self.opt.removeCalendarText;
event.preventDefault(); event.preventDefault();
var $this = $(this); var $this = $(this);
var url = $this.attr('href'); var url = $this.attr('href');
@ -197,17 +199,9 @@ if (EXPO.common){
else{ else{
if(data.success){ if(data.success){
if(data.in){ if(data.in){
//if($this.hasClass(addClass)){
// $this.hide();
// $this.siblings('.removecalendar').show()
//}
$this.removeClass(addClass).addClass(remClass).text(remText); $this.removeClass(addClass).addClass(remClass).text(remText);
} }
else{ else{
//if($this.hasClass('removecalendar')){
// $this.hide();
// $this.siblings('.addcalendar').show()
//}
$this.removeClass(remClass).addClass(addClass).text(addText); $this.removeClass(remClass).addClass(addClass).text(addText);
} }

@ -70,7 +70,8 @@ if (EXPO.exposition.list){
$.fancybox.open('#pw-login'); $.fancybox.open('#pw-login');
return false; return false;
}); });
com.opt.addCalendarText = this.opt.addCalendarText;
com.opt.removeCalendarText = this.opt.removeCalendarText;
}; };
return that; return that;
}()); }());

@ -5,63 +5,47 @@ if (EXPO.exposition.object){
}else { }else {
EXPO.exposition.object = (function () { EXPO.exposition.object = (function () {
// dependencies
var com = EXPO.common;
// variables // variables
var that = {}, var that = {},
VisitButtons = function ( opt) { Note = function (it, opt) {
this.opt = opt; this.opt = opt;
this.isActive = false; this.DOMthis = it;
this.$visitorsList = $(document.getElementById(opt.visitorsListId)); this.DOMbutton = it.querySelector('.'+opt.buttonClass);
this.$secondary = $(document.getElementById(opt.wrapId)); this.DOMinput = it.querySelector('.'+opt.inputClass);
this._controller(); this.inputName = this.DOMinput.getAttribute('name');
this.url = this.DOMbutton.getAttribute('href');
},
UnVisitButtons = function (opt) {
this.opt = opt;
this.$visitorsList = $(document.getElementById(opt.visitorsListId));
this.$secondary = $(document.getElementById(opt.wrapId));
this._controller(); this._controller();
}; };
VisitButtons.prototype = { Note.prototype = {
_controller: function () { _init: function () {
var self = this;
$('.'+this.opt.class).on('click',function(){
self._setName();
$('.'+self.opt.class).hide().siblings('.button').show();
});
}, },
_setName: function () {
$('<li/>').html(this.opt.template).prependTo(this.$visitorsList);
this.$secondary.hide();
isActive = true;
}
};
UnVisitButtons.prototype = {
_controller: function () { _controller: function () {
var self = this; var self = this;
$('.'+this.opt.class).on('click',function(){ $(this.DOMinput).on('blur', function () {
self._unSetName(); self.send();
$('.'+self.opt.class).hide().siblings('.button').show();
}); });
}, $(this.DOMbutton).on('click', function () {
_unSetName: function () { return false;
var self = this;
this.$visitorsList.children().each(function () {
if($(this).html() == self.opt.template){
$(this).detach();
}
}); });
if(!this.$visitorsList.children().length){ },
this.$secondary.show(); send: function () {
}else{ var data = {},
this.$secondary.hide(); 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 = {}; //свойства по умолчанию that.opt = {}; //свойства по умолчанию
@ -79,12 +63,21 @@ if (EXPO.exposition.object){
var self = this, var self = this,
$visitorsWrap = $(document.getElementById(self.opt.visitButton.visitorsListId)), $visitorsWrap = $(document.getElementById(self.opt.visitButton.visitorsListId)),
$secondaryList = $(document.getElementById(self.opt.visitButton.wrapId)); $secondaryList = $(document.getElementById(self.opt.visitButton.wrapId));
this.notes = [];
if(!$visitorsWrap.children().length){ if(!$visitorsWrap.children().length){
$secondaryList.show(); $secondaryList.show();
} }
this.visitButtons = new VisitButtons(self.opt.visitButton); $('.'+this.opt.note.wrapClass).each(function () {
this.unVisitButtons = new UnVisitButtons(self.opt.unvisitButton); 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; return that;

@ -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;
}());
}
Loading…
Cancel
Save