1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-03 06:55:03 +03:00

Доработка шаблонов

This commit is contained in:
Denis Shakhov 2013-07-09 15:40:06 +07:00
parent 7fd3f27e7f
commit 4490fdae1a
15 changed files with 468 additions and 294 deletions

View file

@ -12,7 +12,9 @@ ls.captcha = (function ($) {
*/
var defaults = {
// Селектор каптчи
sCaptchaSelector: '.js-form-auth-captcha'
selectors: {
captcha: '.js-form-auth-captcha'
}
};
/**
@ -21,7 +23,7 @@ ls.captcha = (function ($) {
this.init = function(options) {
this.options = $.extend({}, defaults, options);
oCaptcha = $(this.options.sCaptchaSelector);
oCaptcha = $(this.options.selectors.captcha);
// Подгружаем каптчу при открытии окна регистрации
$('[data-option-target=tab-pane-registration]').tab('option', 'onActivate', function () {

View file

@ -12,9 +12,11 @@ ls.editor = (function($) {
*/
var defaults = {
// Селекторы
sInsertImageButtonSelector: '.js-insert-image-button',
sUploadImageButtonSelector: '.js-upload-image-button',
sPreviewImageLoaderSelector: '.js-topic-preview-loader',
selectors: {
insertImageButton: '.js-insert-image-button',
uploadImageButton: '.js-upload-image-button',
previewImageLoader: '.js-topic-preview-loader',
}
};
/**
@ -28,7 +30,7 @@ ls.editor = (function($) {
this.options = $.extend({}, defaults, options);
// Вставка ссылки
$(this.options.sInsertImageButtonSelector).on('click', function (e) {
$(this.options.selectors.insertImageButton).on('click', function (e) {
var sUrl = $('#img_url').val(),
sAlign = $('#form-image-url-align').val(),
sTitle = $('#form-image-url-title').val();
@ -37,7 +39,7 @@ ls.editor = (function($) {
});
// Вставка ссылки
$(this.options.sUploadImageButtonSelector).on('click', function (e) {
$(this.options.selectors.uploadImageButton).on('click', function (e) {
var sFormId = $(this).data('form-id');
self.ajaxUploadImg(sFormId);

View file

@ -17,10 +17,12 @@ ls.topic = (function ($) {
},
// Селекторы
sPreviewImageSelector: '.js-topic-preview-image',
sPreviewImageLoaderSelector: '.js-topic-preview-loader',
sPreviewTopicTextButtonSelector: '.js-topic-preview-text-button',
sPreviewTopicTextHideButtonSelector: '.js-topic-preview-text-hide-button',
selectors: {
previewImage: '.js-topic-preview-image',
previewImageLoader: '.js-topic-preview-loader',
previewTopicTextButton: '.js-topic-preview-text-button',
previewTopicTextHideButton: '.js-topic-preview-text-hide-button',
}
};
/**
@ -34,22 +36,22 @@ ls.topic = (function ($) {
this.options = $.extend({}, defaults, options);
// Подгрузка избражений-превью
$(this.options.sPreviewImageSelector).each(function () {
$(this.options.selectors.previewImage).each(function () {
$(this).imagesLoaded(function () {
var $this = $(this),
$preview = $this.closest(self.options.sPreviewImageLoaderSelector).removeClass('loading');
$preview = $this.closest(self.options.selectors.previewImageLoader).removeClass('loading');
$this.height() < $preview.height() && $this.css('top', ($preview.height() - $this.height()) / 2 );
});
});
// Превью текста
$(this.options.sPreviewTopicTextButtonSelector).on('click', function (e) {
$(this.options.selectors.previewTopicTextButton).on('click', function (e) {
self.showPreviewText('form-topic-add', 'topic-text-preview');
});
// Закрытие превью
$(document).on('click', this.options.sPreviewTopicTextHideButtonSelector, function (e) {
$(document).on('click', this.options.selectors.previewTopicTextHideButton, function (e) {
self.hidePreviewText();
});
};

View file

@ -12,24 +12,26 @@ ls.usernote = (function($) {
*/
var defaults = {
// Роутеры
oRouters: {
routers: {
save: aRouter['profile'] + 'ajax-note-save/',
remove: aRouter['profile'] + 'ajax-note-remove/',
},
// Селекторы
sNoteSelector: '.js-user-note',
sNoteContentSelector: '.js-user-note-content',
sNoteTextSelector: '.js-user-note-text',
sNoteAddButtonSelector: '.js-user-note-add-button',
sNoteActionsSelector: '.js-user-note-actions',
sNoteEditButtonSelector: '.js-user-note-edit-button',
sNoteRemoveButtonSelector: '.js-user-note-remove-button',
selectors: {
note: '.js-user-note',
noteContent: '.js-user-note-content',
noteText: '.js-user-note-text',
noteAddButton: '.js-user-note-add-button',
noteActions: '.js-user-note-actions',
noteEditButton: '.js-user-note-edit-button',
noteRemoveButton: '.js-user-note-remove-button',
sNoteEditSelector: '.js-user-note-edit',
sNoteEditTextSelector: '.js-user-note-edit-text',
sNoteEditSaveButtonSelector: '.js-user-note-edit-save',
sNoteEditCancelButtonSelector: '.js-user-note-edit-cancel',
noteEdit: '.js-user-note-edit',
noteEditText: '.js-user-note-edit-text',
noteEditSaveButton: '.js-user-note-edit-save',
noteEditCancelButton: '.js-user-note-edit-cancel',
}
};
/**
@ -43,44 +45,44 @@ ls.usernote = (function($) {
this.options = $.extend({}, defaults, options);
// Добавление
$(this.options.sNoteSelector).each(function () {
$(this.options.selectors.note).each(function () {
var oNote = $(this);
var oVars = {
oNote: oNote,
oNoteText: oNote.find(self.options.sNoteTextSelector),
oNoteEditText: oNote.find(self.options.sNoteEditTextSelector),
oNoteContent: oNote.find(self.options.sNoteContentSelector),
oNoteEdit: oNote.find(self.options.sNoteEditSelector),
oNoteAdd: oNote.find(self.options.sNoteAddButtonSelector),
oNoteActions: oNote.find(self.options.sNoteActionsSelector),
oNoteText: oNote.find(self.options.selectors.noteText),
oNoteEditText: oNote.find(self.options.selectors.noteEditText),
oNoteContent: oNote.find(self.options.selectors.noteContent),
oNoteEdit: oNote.find(self.options.selectors.noteEdit),
oNoteAdd: oNote.find(self.options.selectors.noteAddButton),
oNoteActions: oNote.find(self.options.selectors.noteActions),
iUserId: oNote.data('user-id')
};
// Показывает форму добавления
oVars.oNote.find(self.options.sNoteAddButtonSelector).on('click', function (e) {
oVars.oNote.find(self.options.selectors.noteAddButton).on('click', function (e) {
self.showForm(oVars);
e.preventDefault();
}.bind(self));
// Отмена
oVars.oNote.find(self.options.sNoteEditCancelButtonSelector).on('click', function (e) {
oVars.oNote.find(self.options.selectors.noteEditCancelButton).on('click', function (e) {
self.hideForm(oVars);
});
// Сохранение заметки
oVars.oNote.find(self.options.sNoteEditSaveButtonSelector).on('click', function (e) {
oVars.oNote.find(self.options.selectors.noteEditSaveButton).on('click', function (e) {
self.save(oVars);
});
// Удаление заметки
oVars.oNote.find(self.options.sNoteRemoveButtonSelector).on('click', function (e) {
oVars.oNote.find(self.options.selectors.noteRemoveButton).on('click', function (e) {
self.remove(oVars);
e.preventDefault();
});
// Редактирование заметки
oVars.oNote.find(self.options.sNoteEditButtonSelector).on('click', function (e) {
oVars.oNote.find(self.options.selectors.noteEditButton).on('click', function (e) {
self.showForm(oVars);
oVars.oNoteEditText.val( $.trim(oVars.oNoteText.html()) );
e.preventDefault();
@ -122,7 +124,7 @@ ls.usernote = (function($) {
ls.hook.marker('saveBefore');
ls.ajax(this.options.oRouters.save, params, function (result) {
ls.ajax(this.options.routers.save, params, function (result) {
if (result.bStateError) {
ls.msg.error(null, result.sMsg);
} else {
@ -148,7 +150,7 @@ ls.usernote = (function($) {
ls.hook.marker('removeBefore');
ls.ajax(this.options.oRouters.remove, params, function (result) {
ls.ajax(this.options.routers.remove, params, function (result) {
if (result.bStateError) {
ls.msg.error(null, result.sMsg);
} else {

View file

@ -4,11 +4,24 @@ var ls = ls || {};
* Голосование
*/
ls.vote = (function ($) {
"use strict";
/**
* Опции
*/
this.options = {
classes: {
* Дефолтные опции
*/
var defaults = {
// Селекторы
selectors : {
vote: '.js-vote',
up: '.js-vote-up',
down: '.js-vote-down',
abstain: '.js-vote-abstain',
count: '.js-vote-count',
rating: '.js-vote-rating',
},
// Классы
classes : {
voted: 'voted',
plus: 'voted-up',
minus: 'voted-down',
@ -18,109 +31,174 @@ ls.vote = (function ($) {
zero: 'vote-count-zero',
not_voted: 'not-voted'
},
prefix_area: 'vote_area_',
prefix_total: 'vote_total_',
prefix_count: 'vote_count_',
type: {
comment: {
url: aRouter['ajax']+'vote/comment/',
url: aRouter['ajax'] + 'vote/comment/',
targetName: 'idComment'
},
topic: {
url: aRouter['ajax']+'vote/topic/',
url: aRouter['ajax'] + 'vote/topic/',
targetName: 'idTopic'
},
blog: {
url: aRouter['ajax']+'vote/blog/',
url: aRouter['ajax'] + 'vote/blog/',
targetName: 'idBlog'
},
user: {
url: aRouter['ajax']+'vote/user/',
url: aRouter['ajax'] + 'vote/user/',
targetName: 'idUser'
}
}
};
this.vote = function(idTarget, objVote, value, type) {
if (!this.options.type[type]) return false;
/**
* Инициализация
*
* @param {Object} options Опции
*/
this.init = function(options) {
var self = this;
objVote = $(objVote);
var params = {};
params['value'] = value;
params[this.options.type[type].targetName] = idTarget;
this.options = $.extend({}, defaults, options);
ls.hook.marker('voteBefore');
ls.ajax(this.options.type[type].url, params, function(result) {
var args = [idTarget, objVote, value, type, result];
this.onVote.apply(this,args);
}.bind(this));
return false;
}
$(this.options.selectors.vote).each(function () {
var oVote = $(this);
this.onVote = function(idTarget, objVote, value, type, result) {
var oVars = {
vote: oVote,
up: oVote.find(self.options.selectors.up),
down: oVote.find(self.options.selectors.down),
abstain: oVote.find(self.options.selectors.abstain),
count: oVote.find(self.options.selectors.count),
rating: oVote.find(self.options.selectors.rating),
id: oVote.data('vote-id'),
type: oVote.data('vote-type'),
};
// Плюс
oVars.up.on('click', function (e) {
self.vote(oVars.id, 1, oVars.type, oVars);
e.preventDefault();
});
// Минус
oVars.down.on('click', function (e) {
self.vote(oVars.id, -1, oVars.type, oVars);
e.preventDefault();
});
// Воздержаться
oVars.abstain.on('click', function (e) {
self.vote(oVars.id, 0, oVars.type, oVars);
e.preventDefault();
});
});
};
/**
* Голосование
*
* @param {Number} iTargetId ID объекта
* @param {Number} iValue Значение
* @param {String} sType Тип голосования
* @param {Object} oVars Переменные текущего голосования
*/
this.vote = function(iTargetId, iValue, sType, oVars) {
var self = this;
if ( ! this.options.type[sType] ) return false;
var params = {
value: iValue
};
params[this.options.type[sType].targetName] = iTargetId;
ls.hook.marker('voteBefore');
ls.ajax(this.options.type[sType].url, params, function (result) {
var args = [iTargetId, iValue, sType, oVars, result];
this.onVote.apply(this, args);
}.bind(this));
};
/**
* Коллбэк вызываемый при успешном голосовании
*
* @param {Number} iTargetId ID объекта
* @param {Number} iValue Значение
* @param {String} sType Тип голосования
* @param {Object} oVars Переменные текущего голосования
* @param {Object} result Объект возвращемый сервером
*/
this.onVote = function(iTargetId, iValue, sType, oVars, result) {
if (result.bStateError) {
ls.msg.error(null, result.sMsg);
} else {
ls.msg.notice(null, result.sMsg);
var divVoting = $('#'+this.options.prefix_area+type+'_'+idTarget);
divVoting.addClass(this.options.classes.voted);
oVars.vote
.addClass(this.options.classes.voted)
.removeClass(this.options.classes.negative + ' ' + this.options.classes.positive + ' ' + this.options.classes.not_voted + ' ' + this.options.classes.zero);
if (value > 0) {
divVoting.addClass(this.options.classes.plus);
}
if (value < 0) {
divVoting.addClass(this.options.classes.minus);
}
if (value == 0) {
divVoting.addClass(this.options.classes.voted_zero);
if (iValue > 0) {
oVars.vote.addClass(this.options.classes.plus);
} else if (iValue < 0) {
oVars.vote.addClass(this.options.classes.minus);
} else if (iValue == 0) {
oVars.vote.addClass(this.options.classes.voted_zero);
}
var divTotal = $('#'+this.options.prefix_total+type+'_'+idTarget);
var divCount = $('#'+this.options.prefix_count+type+'_'+idTarget);
if (divCount.length>0 && result.iCountVote) {
divCount.text(parseInt(result.iCountVote));
if (oVars.count.length > 0 && result.iCountVote) {
oVars.count.text(parseInt(result.iCountVote));
}
result.iRating = parseFloat(result.iRating);
divVoting.removeClass(this.options.classes.negative);
divVoting.removeClass(this.options.classes.positive);
divVoting.removeClass(this.options.classes.not_voted);
divVoting.removeClass(this.options.classes.zero);
if (result.iRating > 0) {
divVoting.addClass(this.options.classes.positive);
divTotal.text('+'+result.iRating);
}else if (result.iRating < 0) {
divVoting.addClass(this.options.classes.negative);
divTotal.text(result.iRating);
}else if (result.iRating == 0) {
divVoting.addClass(this.options.classes.zero);
divTotal.text(0);
oVars.vote.addClass(this.options.classes.positive);
oVars.rating.text('+' + result.iRating);
} else if (result.iRating < 0) {
oVars.vote.addClass(this.options.classes.negative);
oVars.rating.text(result.iRating);
} else if (result.iRating == 0) {
oVars.vote.addClass(this.options.classes.zero);
oVars.rating.text(0);
}
var method='onVote'+ls.tools.ucfirst(type);
if ($.type(this[method])=='function') {
this[method].apply(this,[idTarget, objVote, value, type, result]);
}
if (type == 'topic') {
$('#' + this.options.prefix_area + type + '_' + idTarget).addClass('js-tooltip-vote-topic').tooltip('enter');
var method = 'onVote' + ls.tools.ucfirst(sType);
if (typeof this[method] == 'function') {
this[method].apply(this, [iTargetId, iValue, sType, oVars, result]);
}
}
$(this).trigger('vote',[idTarget, objVote, value, type, result]);
}
};
/**
* Голосование за пользователя
*
* @param {Number} iTargetId ID объекта
* @param {Number} iValue Значение
* @param {String} sType Тип голосования
* @param {Object} oVars Переменные текущего голосования
* @param {Object} result Объект возвращемый сервером
*/
this.onVoteUser = function(iTargetId, iValue, sType, oVars, result) {
$('#user_skill_' + iTargetId).text(result.iSkill);
};
this.onVoteUser = function(idTarget, objVote, value, type, result) {
$('#user_skill_'+idTarget).text(result.iSkill);
}
/**
* Голосование за топик
*
* @param {Number} iTargetId ID объекта
* @param {Number} iValue Значение
* @param {String} sType Тип голосования
* @param {Object} oVars Переменные текущего голосования
* @param {Object} result Объект возвращемый сервером
*/
this.onVoteTopic = function(iTargetId, iValue, sType, oVars, result) {
oVars.vote.addClass('js-tooltip-vote-topic').tooltip('enter');
};
return this;
}).call(ls.vote || {},jQuery);

View file

@ -28,26 +28,28 @@
<div class="blog">
<header class="blog-header">
{* Голосование за блог *}
<div id="vote_area_blog_{$oBlog->getId()}" class="vote
{if $oBlog->getRating() > 0}
vote-count-positive
{elseif $oBlog->getRating() < 0}
vote-count-negative
{/if}
<div data-vote-type="blog"
data-vote-id="{$oBlog->getId()}"
class="vote js-vote
{if $oBlog->getRating() > 0}
vote-count-positive
{elseif $oBlog->getRating() < 0}
vote-count-negative
{/if}
{if $oVote}
voted
{if $oVote}
voted
{if $oVote->getDirection() > 0}
voted-up
{elseif $oVote->getDirection() < 0}
voted-down
{/if}
{/if}">
{if $oVote->getDirection() > 0}
voted-up
{elseif $oVote->getDirection() < 0}
voted-down
{/if}
{/if}">
<div class="vote-label">{$aLang.blog_rating}</div>
<a href="#" class="vote-up" onclick="return ls.vote.vote({$oBlog->getId()},this,1,'blog');"></a>
<a href="#" class="vote-down" onclick="return ls.vote.vote({$oBlog->getId()},this,-1,'blog');"></a>
<div id="vote_total_blog_{$oBlog->getId()}" class="vote-count count" title="{$aLang.blog_vote_count}: {$oBlog->getCountVote()}">{if $oBlog->getRating() > 0}+{/if}{$oBlog->getRating()}</div>
<a href="#" class="vote-up js-vote-up"></a>
<a href="#" class="vote-down js-vote-down"></a>
<div class="vote-count count js-vote-rating" title="{$aLang.blog_vote_count}: {$oBlog->getCountVote()}">{if $oBlog->getRating() > 0}+{/if}{$oBlog->getRating()}</div>
</div>
{* Аватар *}

View file

@ -156,6 +156,12 @@ jQuery(document).ready(function($){
ls.topic.init();
/**
* Vote
*/
ls.vote.init();
/**
* Photoset
*/

View file

@ -84,25 +84,27 @@
* Не выводим блок голосования в личных сообщениях и списках
*}
{if $oComment->getTargetType() != 'talk'}
<li id="vote_area_comment_{$oComment->getId()}" class="vote
{if $oComment->getRating() > 0}
vote-count-positive
{elseif $oComment->getRating() < 0}
vote-count-negative
{/if}
{if $oVote}
voted
{if $oVote->getDirection() > 0}
voted-up
{else}
voted-down
{/if}
{/if}">
<div class="vote-down" onclick="return ls.vote.vote({$oComment->getId()},this,-1,'comment');"></div>
<span class="vote-count" id="vote_total_comment_{$oComment->getId()}">{if $oComment->getRating() > 0}+{/if}{$oComment->getRating()}</span>
<div class="vote-up" onclick="return ls.vote.vote({$oComment->getId()},this,1,'comment');"></div>
<li data-vote-type="comment"
data-vote-id="{$oComment->getId()}"
class="vote js-vote
{if $oComment->getRating() > 0}
vote-count-positive
{elseif $oComment->getRating() < 0}
vote-count-negative
{/if}
{if $oVote}
voted
{if $oVote->getDirection() > 0}
voted-up
{else}
voted-down
{/if}
{/if}">
<div class="vote-down js-vote-down"></div>
<span class="vote-count js-vote-rating">{if $oComment->getRating() > 0}+{/if}{$oComment->getRating()}</span>
<div class="vote-up js-vote-up"></div>
</li>
{/if}

View file

@ -16,11 +16,28 @@
<a href="{$oUserProfile->getUserWebPath()}"><img src="{$oUserProfile->getProfileAvatarPath(48)}" alt="avatar" class="avatar" itemprop="photo" /></a>
<div id="vote_area_user_{$oUserProfile->getId()}" class="vote {if $oUserProfile->getRating()>=0}vote-count-positive{else}vote-count-negative{/if} {if $oVote} voted {if $oVote->getDirection()>0}voted-up{elseif $oVote->getDirection()<0}voted-down{/if}{/if}">
<div data-vote-type="user"
data-vote-id="{$oUserProfile->getId()}"
class="vote js-vote
{if $oUserProfile->getRating() >= 0}
vote-count-positive
{else}
vote-count-negative
{/if}
{if $oVote}
voted
{if $oVote->getDirection() > 0}
voted-up
{elseif $oVote->getDirection() < 0}
voted-down
{/if}
{/if}">
<div class="vote-label">{$aLang.user_rating}</div>
<a href="#" class="vote-up" onclick="return ls.vote.vote({$oUserProfile->getId()},this,1,'user');"></a>
<a href="#" class="vote-down" onclick="return ls.vote.vote({$oUserProfile->getId()},this,-1,'user');"></a>
<div id="vote_total_user_{$oUserProfile->getId()}" class="vote-count count" title="{$aLang.user_vote_count}: {$oUserProfile->getCountVote()}">{if $oUserProfile->getRating() > 0}+{/if}{$oUserProfile->getRating()}</div>
<a href="#" class="vote-up js-vote-up"></a>
<a href="#" class="vote-down js-vote-down"></a>
<div class="vote-count count js-vote-rating" title="{$aLang.user_vote_count}: {$oUserProfile->getCountVote()}">{if $oUserProfile->getRating() > 0}+{/if}{$oUserProfile->getRating()}</div>
</div>
<div class="strength">

View file

@ -1,18 +1,24 @@
{**
* Базовый шаблон топика
*
* @styles assets/css/topic.css
* @scripts <framework>/js/livestreet/topic.js
*}
{block name='topic_options'}{/block}
{assign var="oBlog" value=$oTopic->getBlog()}
{assign var="oUser" value=$oTopic->getUser()}
{assign var="oVote" value=$oTopic->getVote()}
{assign var="oFavourite" value=$oTopic->getFavourite()}
{$oBlog = $oTopic->getBlog()}
{$oUser = $oTopic->getUser()}
{$oVote = $oTopic->getVote()}
{$oFavourite = $oTopic->getFavourite()}
<article class="topic topic-type-{$oTopic->getType()} js-topic {if ! $bTopicList}topic-single{/if} {block name='topic_class'}{/block}" id="{block name='topic_id'}{/block}" {block name='topic_attributes'}{/block}>
{* Header *}
{**
* Хидер
*}
{block name='topic_header'}
<header class="topic-header">
{* Заголовок *}
<h1 class="topic-title word-wrap">
{if $oTopic->getPublish() == 0}
<i class="icon-file" title="{$aLang.topic_unpublish}"></i>
@ -27,6 +33,7 @@
{/if}
</h1>
{* Информация *}
<div class="topic-info">
<a href="{$oBlog->getUrlFull()}" class="topic-blog">{$oBlog->getTitle()|escape:'html'}</a>
@ -34,6 +41,7 @@
{date_format date=$oTopic->getDateAdd() format="j F Y, H:i"}
</time>
{* Управление *}
{if $oTopic->getIsAllowAction()}
<ul class="actions">
{if $oTopic->getIsAllowEdit()}
@ -41,7 +49,12 @@
{/if}
{if $oTopic->getIsAllowDelete()}
<li><a href="{router page='topic'}delete/{$oTopic->getId()}/?security_ls_key={$LIVESTREET_SECURITY_KEY}" title="{$aLang.topic_delete}" onclick="return confirm('{$aLang.topic_delete_confirm}');" class="actions-delete">{$aLang.topic_delete}</a></li>
<li>
<a href="{router page='topic'}delete/{$oTopic->getId()}/?security_ls_key={$LIVESTREET_SECURITY_KEY}"
title="{$aLang.topic_delete}"
onclick="return confirm('{$aLang.topic_delete_confirm}');"
class="actions-delete">{$aLang.topic_delete}</a>
</li>
{/if}
</ul>
{/if}
@ -52,7 +65,9 @@
{block name='topic_header_after'}{/block}
{* Content *}
{**
* Текст
*}
{block name='topic_content'}
<div class="topic-content text">
{hook run='topic_content_begin' topic=$oTopic bTopicList=$bTopicList}
@ -66,11 +81,14 @@
{block name='topic_content_after'}{/block}
{* Footer *}
{**
* Футер
*}
{block name='topic_footer'}
<footer class="topic-footer">
{block name='topic_footer_begin'}{/block}
{* Теги *}
<ul class="topic-tags js-favourite-insert-after-form js-favourite-tags-topic-{$oTopic->getId()}">
<li>{$aLang.topic_tags}:</li>
@ -96,29 +114,21 @@
{/if}
{/strip}
</ul>
{* Share block *}
<div class="popover" data-type="popover-target" id="topic_share_{$oTopic->getId()}">
<div class="popover-arrow"></div><div class="popover-arrow-inner"></div>
<div class="popover-content" data-type="popover-content">
{hookb run="topic_share" topic=$oTopic bTopicList=$bTopicList}
<div class="yashare-auto-init" data-yashareTitle="{$oTopic->getTitle()|escape:'html'}" data-yashareLink="{$oTopic->getUrl()}" data-yashareL10n="ru" data-yashareType="button" data-yashareQuickServices="yaru,vkontakte,facebook,twitter,odnoklassniki,moimir,lj,gplus"></div>
{/hookb}
</div>
</div>
{if $oVote || ($oUserCurrent && $oTopic->getUserId() == $oUserCurrent->getId()) || strtotime($oTopic->getDateAdd()) < $smarty.now-$oConfig->GetValue('acl.vote.topic.limit_time')}
{assign var="bVoteInfoShow" value=true}
{/if}
{* Информация *}
<ul class="topic-info">
<li id="vote_area_topic_{$oTopic->getId()}"
data-type="tooltip-toggle"
{* Голосование *}
{if $oVote || ($oUserCurrent && $oTopic->getUserId() == $oUserCurrent->getId()) || strtotime($oTopic->getDateAdd()) < $smarty.now-$oConfig->GetValue('acl.vote.topic.limit_time')}
{$bShowVoteInfo = true}
{/if}
<li data-type="tooltip-toggle"
data-param-i-topic-id="{$oTopic->getId()}"
data-option-url="{router page='ajax'}vote/get/info/"
class="vote
data-vote-type="topic"
data-vote-id="{$oTopic->getId()}"
class="vote js-vote
{if $oVote || ($oUserCurrent && $oTopic->getUserId() == $oUserCurrent->getId()) || strtotime($oTopic->getDateAdd()) < $smarty.now-$oConfig->GetValue('acl.vote.topic.limit_time')}
{if $oTopic->getRating() > 0}
vote-count-positive
@ -137,27 +147,33 @@
{/if}
{/if}
{if $bVoteInfoShow}js-tooltip-vote-topic{/if}">
<div class="vote-up" onclick="return ls.vote.vote({$oTopic->getId()},this,1,'topic');"></div>
<div class="vote-count" id="vote_total_topic_{$oTopic->getId()}">
{if $bVoteInfoShow}
{if $bShowVoteInfo}js-tooltip-vote-topic{/if}">
<div class="vote-up js-vote-up"></div>
<div class="vote-count js-vote-rating">
{if $bShowVoteInfo}
{if $oTopic->getRating() > 0}+{/if}{$oTopic->getRating()}
{else}
<a href="#" onclick="return ls.vote.vote({$oTopic->getId()},this,0,'topic');">?</a>
<a href="#" class="js-vote-abstain">?</a>
{/if}
</div>
<div class="vote-down" onclick="return ls.vote.vote({$oTopic->getId()},this,-1,'topic');"></div>
<div class="vote-down js-vote-down"></div>
</li>
{* Автор топика *}
<li class="topic-info-author"><a rel="author" href="{$oUser->getUserWebPath()}">{$oUser->getLogin()}</a></li>
{* Избранное *}
<li class="topic-info-favourite">
<div onclick="return ls.favourite.toggle({$oTopic->getId()},this,'topic');"
class="favourite {if $oUserCurrent && $oTopic->getIsFavourite()}active{/if}"
title="{if $oTopic->getIsFavourite()}{$aLang.talk_favourite_del}{else}{$aLang.talk_favourite_add}{/if}"></div>
<span class="favourite-count" id="fav_count_topic_{$oTopic->getId()}" {if ! $oTopic->getCountFavourite()}style="display: none"{/if}>{$oTopic->getCountFavourite()}</span>
</li>
{* Поделиться *}
<li class="topic-info-share"><a href="#" class="icon-share js-popover-default" title="{$aLang.topic_share}" data-type="popover-toggle" data-option-target="topic_share_{$oTopic->getId()}"></a></li>
{* Ссылка на комментарии *}
{if $bTopicList}
<li class="topic-info-comments">
<a href="{$oTopic->getUrl()}#comments" title="{$aLang.topic_comment_read}">{$oTopic->getCountComment()} {$oTopic->getCountComment()|declension:$aLang.comment_declension:'russian'}</a>
@ -166,12 +182,21 @@
{/if}
{block name='topic_footer_info_end'}{/block}
{hook run='topic_show_info' topic=$oTopic}
</ul>
{if !$bTopicList}
{* Всплывающий блок появляющийся при нажатии на кнопку Поделиться *}
<div class="popover" data-type="popover-target" id="topic_share_{$oTopic->getId()}">
<div class="popover-arrow"></div><div class="popover-arrow-inner"></div>
<div class="popover-content" data-type="popover-content">
{hookb run="topic_share" topic=$oTopic bTopicList=$bTopicList}
<div class="yashare-auto-init" data-yashareTitle="{$oTopic->getTitle()|escape:'html'}" data-yashareLink="{$oTopic->getUrl()}" data-yashareL10n="ru" data-yashareType="button" data-yashareQuickServices="yaru,vkontakte,facebook,twitter,odnoklassniki,moimir,lj,gplus"></div>
{/hookb}
</div>
</div>
{if ! $bTopicList}
{hook run='topic_show_end' topic=$oTopic}
{/if}

View file

@ -40,33 +40,35 @@
{/if}
</h2>
<div id="vote_area_blog_{$oBlog->getId()}" class="vote-topic
{if $oBlog->getRating() > 0}
vote-count-positive
{elseif $oBlog->getRating() < 0}
vote-count-negative
{elseif $oBlog->getRating() == 0}
vote-count-zero
{/if}
{if $oVote}
voted
{if $oVote->getDirection() > 0}
voted-up
{elseif $oVote->getDirection() < 0}
voted-down
{/if}
{else}
not-voted
{/if}
{if ($oUserCurrent && $oUserOwner->getId() == $oUserCurrent->getId())}
vote-nobuttons
{/if}">
<a href="#" class="vote-item vote-down" onclick="return ls.vote.vote({$oBlog->getId()},this,-1,'blog');"><span><i></i></span></a>
<div class="vote-item vote-count" title="{$aLang.blog_vote_count}: {$oBlog->getCountVote()}"><span id="vote_total_blog_{$oBlog->getId()}">{if $oBlog->getRating() > 0}+{/if}{$oBlog->getRating()}</span></div>
<a href="#" class="vote-item vote-up" onclick="return ls.vote.vote({$oBlog->getId()},this,1,'blog');"><span><i></i></span></a>
<div data-vote-type="blog"
data-vote-id="{$oBlog->getId()}"
class="vote-topic js-vote
{if $oBlog->getRating() > 0}
vote-count-positive
{elseif $oBlog->getRating() < 0}
vote-count-negative
{elseif $oBlog->getRating() == 0}
vote-count-zero
{/if}
{if $oVote}
voted
{if $oVote->getDirection() > 0}
voted-up
{elseif $oVote->getDirection() < 0}
voted-down
{/if}
{else}
not-voted
{/if}
{if ($oUserCurrent && $oUserOwner->getId() == $oUserCurrent->getId())}
vote-nobuttons
{/if}">
<a href="#" class="vote-item vote-down js-vote-down"><span><i></i></span></a>
<div class="vote-item vote-count" title="{$aLang.blog_vote_count}: {$oBlog->getCountVote()}"><span class="js-vote-rating">{if $oBlog->getRating() > 0}+{/if}{$oBlog->getRating()}</span></div>
<a href="#" class="vote-item vote-up js-vote-up"><span><i></i></span></a>
</div>
</div>

View file

@ -212,6 +212,12 @@ jQuery(document).ready(function($){
* Topic
*/
ls.topic.init();
/**
* Vote
*/
ls.vote.init();
// вступление в блог

View file

@ -87,29 +87,31 @@
* Не выводим блок голосования в личных сообщениях и списках
*}
{if $oComment->getTargetType() != 'talk'}
<li id="vote_area_comment_{$oComment->getId()}" class="vote
{if $oComment->getRating() > 0}
vote-count-positive
{elseif $oComment->getRating() < 0}
vote-count-negative
{/if}
{if (strtotime($oComment->getDate()) < $smarty.now - $oConfig->GetValue('acl.vote.comment.limit_time') && ! $oVote) || ($oUserCurrent && $oUserCurrent->getId() == $oUser->getId())}
vote-expired
{/if}
{if $oVote}
voted
{if $oVote->getDirection() > 0}
voted-up
{else}
voted-down
{/if}
{/if}">
<span class="vote-count" id="vote_total_comment_{$oComment->getId()}">{if $oComment->getRating() > 0}+{/if}{$oComment->getRating()}</span>
<div class="vote-down" onclick="return ls.vote.vote({$oComment->getId()},this,-1,'comment');"></div>
<div class="vote-up" onclick="return ls.vote.vote({$oComment->getId()},this,1,'comment');"></div>
<li data-vote-type="comment"
data-vote-id="{$oComment->getId()}"
class="vote js-vote
{if $oComment->getRating() > 0}
vote-count-positive
{elseif $oComment->getRating() < 0}
vote-count-negative
{/if}
{if (strtotime($oComment->getDate()) < $smarty.now - $oConfig->GetValue('acl.vote.comment.limit_time') && ! $oVote) || ($oUserCurrent && $oUserCurrent->getId() == $oUser->getId())}
vote-expired
{/if}
{if $oVote}
voted
{if $oVote->getDirection() > 0}
voted-up
{else}
voted-down
{/if}
{/if}">
<span class="vote-count js-vote-rating">{if $oComment->getRating() > 0}+{/if}{$oComment->getRating()}</span>
<div class="vote-down js-vote-down"></div>
<div class="vote-up js-vote-up"></div>
</li>
{/if}
</ul>

View file

@ -19,35 +19,37 @@
{hook run='profile_top_begin' oUserProfile=$oUserProfile}
<div class="vote-profile">
<div id="vote_area_user_{$oUserProfile->getId()}" class="vote-topic
{if $oUserProfile->getRating() > 0}
vote-count-positive
{elseif $oUserProfile->getRating() < 0}
vote-count-negative
{elseif $oUserProfile->getRating() == 0}
vote-count-zero
{/if}
{if $oVote}
voted
{if $oVote->getDirection() > 0}
voted-up
{elseif $oVote->getDirection() < 0}
voted-down
{/if}
{else}
not-voted
{/if}
{if ($oUserCurrent && $oUserProfile->getId() == $oUserCurrent->getId()) || !$oUserCurrent}
vote-nobuttons
{/if}">
<div class="vote-item vote-down" onclick="return ls.vote.vote({$oUserProfile->getId()},this,-1,'user');"><span><i></i></span></div>
<div data-vote-type="user"
data-vote-id="{$oUserProfile->getId()}"
class="vote-topic js-vote
{if $oUserProfile->getRating() > 0}
vote-count-positive
{elseif $oUserProfile->getRating() < 0}
vote-count-negative
{elseif $oUserProfile->getRating() == 0}
vote-count-zero
{/if}
{if $oVote}
voted
{if $oVote->getDirection() > 0}
voted-up
{elseif $oVote->getDirection() < 0}
voted-down
{/if}
{else}
not-voted
{/if}
{if ($oUserCurrent && $oUserProfile->getId() == $oUserCurrent->getId()) || !$oUserCurrent}
vote-nobuttons
{/if}">
<div class="vote-item vote-down js-vote-down"><span><i></i></span></div>
<div class="vote-item vote-count" title="{$aLang.user_vote_count}: {$oUserProfile->getCountVote()}">
<span id="vote_total_user_{$oUserProfile->getId()}">{if $oUserProfile->getRating() > 0}+{/if}{$oUserProfile->getRating()}</span>
<span class="js-vote-rating">{if $oUserProfile->getRating() > 0}+{/if}{$oUserProfile->getRating()}</span>
</div>
<div class="vote-item vote-up" onclick="return ls.vote.vote({$oUserProfile->getId()},this,1,'user');"><span><i></i></span></div>
<div class="vote-item vote-up js-vote-up"><span><i></i></span></div>
</div>
<div class="vote-label">{$aLang.user_rating}</div>
</div>

View file

@ -1,18 +1,24 @@
{**
* Базовый шаблон топика
*
* @styles assets/css/topic.css
* @scripts <framework>/js/livestreet/topic.js
*}
{block name='topic_options'}{/block}
{assign var="oBlog" value=$oTopic->getBlog()}
{assign var="oUser" value=$oTopic->getUser()}
{assign var="oVote" value=$oTopic->getVote()}
{assign var="oFavourite" value=$oTopic->getFavourite()}
{$oBlog = $oTopic->getBlog()}
{$oUser = $oTopic->getUser()}
{$oVote = $oTopic->getVote()}
{$oFavourite = $oTopic->getFavourite()}
<article class="topic topic-type-{$oTopic->getType()} js-topic {if ! $bTopicList}topic-single{/if} {block name='topic_class'}{/block}" id="{block name='topic_id'}{/block}" {block name='topic_attributes'}{/block}>
{* Header *}
{**
* Хидер
*}
{block name='topic_header'}
<header class="topic-header">
{* Заголовок *}
<h1 class="topic-title word-wrap">
{if $bTopicList}
<a href="{$oTopic->getUrl()}">{$oTopic->getTitle()|escape:'html'}</a>
@ -27,7 +33,7 @@
{block name='topic_icon'}{/block}
</h1>
{* Информация *}
<div class="topic-info">
<a href="{$oBlog->getUrlFull()}" class="topic-blog">{$oBlog->getTitle()|escape:'html'}</a>
@ -36,7 +42,7 @@
{/if}
</div>
{* Управление *}
{if $oTopic->getIsAllowAction()}
<ul class="topic-actions">
{if $oTopic->getIsAllowEdit()}
@ -54,7 +60,9 @@
{block name='topic_header_after'}{/block}
{* Content *}
{**
* Текст
*}
{block name='topic_content'}
<div class="topic-content text">
{hook run='topic_content_begin' topic=$oTopic bTopicList=$bTopicList}
@ -68,11 +76,14 @@
{block name='topic_content_after'}{/block}
{* Footer *}
{**
* Футер
*}
{block name='topic_footer'}
<footer class="topic-footer">
{block name='topic_footer_begin'}{/block}
{* Теги *}
<ul class="topic-tags js-favourite-insert-after-form js-favourite-tags-topic-{$oTopic->getId()}">
<li><i class="icon-synio-tags"></i></li>
@ -98,36 +109,29 @@
{/if}
{/strip}
</ul>
{* Share block *}
<div class="popover" data-type="popover-target" id="topic_share_{$oTopic->getId()}">
<div class="popover-arrow"></div><div class="popover-arrow-inner"></div>
<div class="popover-content" data-type="popover-content">
{hookb run="topic_share" topic=$oTopic bTopicList=$bTopicList}
<div class="yashare-auto-init" data-yashareTitle="{$oTopic->getTitle()|escape:'html'}" data-yashareLink="{$oTopic->getUrl()}" data-yashareL10n="ru" data-yashareType="button" data-yashareQuickServices="yaru,vkontakte,facebook,twitter,odnoklassniki,moimir,lj,gplus"></div>
{/hookb}
</div>
</div>
{if $oVote || ($oUserCurrent && $oTopic->getUserId() == $oUserCurrent->getId()) || strtotime($oTopic->getDateAdd()) < $smarty.now-$oConfig->GetValue('acl.vote.topic.limit_time')}
{assign var="bVoteInfoShow" value=true}
{/if}
{* Информация *}
<ul class="topic-info">
{* Автор топика *}
<li class="topic-info-author">
<a href="{$oUser->getUserWebPath()}"><img src="{$oUser->getProfileAvatarPath(24)}" alt="avatar" class="avatar" /></a>
<a rel="author" href="{$oUser->getUserWebPath()}">{$oUser->getLogin()}</a>
</li>
{* Дата публикации *}
<li class="topic-info-date">
<time datetime="{date_format date=$oTopic->getDateAdd() format='c'}" title="{date_format date=$oTopic->getDateAdd() format='j F Y, H:i'}">
{date_format date=$oTopic->getDateAdd() hours_back="12" minutes_back="60" now="60" day="day H:i" format="j F Y, H:i"}
</time>
</li>
{* Поделиться *}
<li class="topic-info-share js-popover-default" data-type="popover-toggle" data-option-target="topic_share_{$oTopic->getId()}">
<i class="icon-synio-share-blue" title="{$aLang.topic_share}"></i>
</li>
{* Избранное *}
<li class="topic-info-favourite" onclick="return ls.favourite.toggle({$oTopic->getId()},$('#fav_topic_{$oTopic->getId()}'),'topic');">
<i id="fav_topic_{$oTopic->getId()}"
class="favourite {if $oUserCurrent && $oTopic->getIsFavourite()}active{/if}"
@ -135,6 +139,7 @@
<span class="favourite-count" id="fav_count_topic_{$oTopic->getId()}" {if ! $oTopic->getCountFavourite()}style="display: none"{/if}>{if $oTopic->getCountFavourite()>0}{$oTopic->getCountFavourite()}{/if}</span>
</li>
{* Ссылка на комментарии *}
{if $bTopicList}
<li class="topic-info-comments">
{if $oTopic->getCountCommentNew()}
@ -159,12 +164,18 @@
{block name='topic_footer_info_end'}{/block}
{* Голосование *}
<li class="topic-info-vote">
<div id="vote_area_topic_{$oTopic->getId()}"
data-type="tooltip-toggle"
{if $oVote || ($oUserCurrent && $oTopic->getUserId() == $oUserCurrent->getId()) || strtotime($oTopic->getDateAdd()) < $smarty.now-$oConfig->GetValue('acl.vote.topic.limit_time')}
{$bShowVoteInfo = true}
{/if}
<div data-type="tooltip-toggle"
data-param-i-topic-id="{$oTopic->getId()}"
data-option-url="{router page='ajax'}vote/get/info/"
class="vote-topic
data-vote-type="topic"
data-vote-id="{$oTopic->getId()}"
class="vote-topic js-vote
{if $oVote || ($oUserCurrent && $oTopic->getUserId() == $oUserCurrent->getId()) || strtotime($oTopic->getDateAdd()) < $smarty.now-$oConfig->GetValue('acl.vote.topic.limit_time')}
{if $oTopic->getRating() > 0}
vote-count-positive
@ -201,18 +212,18 @@
vote-not-expired
{/if}
{if $bVoteInfoShow}js-tooltip-vote-topic{/if}">
<div class="vote-item vote-down" onclick="return ls.vote.vote({$oTopic->getId()},this,-1,'topic');"><span><i></i></span></div>
{if $bShowVoteInfo}js-tooltip-vote-topic{/if}">
<div class="vote-item vote-down js-vote-down"><span><i></i></span></div>
<div class="vote-item vote-count">
<span id="vote_total_topic_{$oTopic->getId()}">
{if $bVoteInfoShow}
<span class="js-vote-rating">
{if $bShowVoteInfo}
{if $oTopic->getRating() > 0}+{/if}{$oTopic->getRating()}
{else}
<i onclick="return ls.vote.vote({$oTopic->getId()},this,0,'topic');"></i>
<i class="js-vote-abstain"></i>
{/if}
</span>
</div>
<div class="vote-item vote-up" onclick="return ls.vote.vote({$oTopic->getId()},this,1,'topic');"><span><i></i></span></div>
<div class="vote-item vote-up js-vote-up"><span><i></i></span></div>
</div>
</li>
@ -220,11 +231,24 @@
{hook run='topic_show_info' topic=$oTopic}
</ul>
{* Всплывающий блок появляющийся при нажатии на кнопку Поделиться *}
<div class="popover" data-type="popover-target" id="topic_share_{$oTopic->getId()}">
<div class="popover-arrow"></div><div class="popover-arrow-inner"></div>
<div class="popover-content" data-type="popover-content">
{hookb run="topic_share" topic=$oTopic bTopicList=$bTopicList}
<div class="yashare-auto-init" data-yashareTitle="{$oTopic->getTitle()|escape:'html'}" data-yashareLink="{$oTopic->getUrl()}" data-yashareL10n="ru" data-yashareType="button" data-yashareQuickServices="yaru,vkontakte,facebook,twitter,odnoklassniki,moimir,lj,gplus"></div>
{/hookb}
</div>
</div>
{if !$bTopicList}
{if ! $bTopicList}
{hook run='topic_show_end' topic=$oTopic}
{/if}
{block name='topic_footer_end'}{/block}
</footer>
{/block}