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 -->
{% block style %}
{% endblock %}
<script type="text/javascript">
EXPO.common.init({
addCalendarClass:"addcalendar",
removeCalendarClass:"removecalendar",
addCalendarText:"{% trans 'добавить в календарь' %}",
removeCalendarText:"{% trans 'Убрать из календаря' %}",
loginModalId:'pw-login'
});
</script>
</head>
<body {% block body_class %}{% endblock %}>
<!--[if lt IE 8]>
@ -169,14 +178,6 @@ This template include basic anf main styles and js files,
{% endif %}
{% endcomment %}
<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>

@ -1,5 +1,6 @@
{% load i18n %}
{% load template_filters %}
{% comment %}
{% if user.is_authenticated %}
{% if event|in_calendar:user %}
<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 style="display:none;" class="button blue icon-calendar removecalendar" href="{{ event.get_calendar_url }}">{% trans 'из расписания' %}</a>
{% 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',
buttonClass:'note-button',
inputClass:'note-text'
}
},
addCalendarText:"{% trans 'В расписание' %}",
removeCalendarText:"{% trans 'Из расписания' %}"
});
</script>
{% endblock %}

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

@ -47,10 +47,14 @@
<footer>
<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 removecalendar" href="{{ event.get_calendar_url }}">{% trans 'Убрать из календаря' %}</a>-->
{% if request.user.is_authentificated %}
<a class="button green icon-note" href="#">{% trans 'заметка' %}</a>
{% endif %}
<div class="main-page {% 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>
</div>
<div class="re-tags">
{% for tag in event.tag.all %}
@ -262,4 +266,15 @@
</div>
</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 %}

@ -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;
}

@ -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);
}

@ -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;
}());

@ -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 () {
$('<li/>').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;

@ -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