1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-26 11:40:48 +03:00

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

* Доработаны опросы
* Доработаны заметки
* Мелкие исправления
This commit is contained in:
Denis Shakhov 2013-07-08 11:42:49 +07:00
parent b812c5180f
commit 9ef9642ab0
34 changed files with 598 additions and 326 deletions

View file

@ -1,68 +1,176 @@
/**
* Опросы
*/
var ls = ls || {};
/**
* Опросы
*/
ls.poll = (function ($) {
/**
* Дефолтные опции
*/
var defaults = {
// Роутер голосования
sRouterVoteUrl: aRouter['ajax'] + 'vote/question/',
// Максимальное кол-во вариантов ответов
iMaxItems: 20,
// Селекторы добавления опроса
sAddSelector: '.js-poll-add',
sAddListSelector: '.js-poll-add-list',
sAddItemSelector: '.js-poll-add-item',
sAddItemRemoveSelector: '.js-poll-add-item-remove',
sAddItemInputSelector: '.js-poll-add-item-input',
sAddButtonSelector: '.js-poll-add-button',
// Селекторы опроса
sPollSelector: '.js-poll',
sPollListSelector: '.js-poll-list',
sPollItemSelector: '.js-poll-item',
sPollItemOptionSelector: '.js-poll-item-option',
sPollButtonVoteSelector: '.js-poll-button-vote',
sPollButtonAbstainSelector: '.js-poll-button-abstain',
// Селекторы результата опроса
sPollResultSelector: '.js-poll-result',
sPollResultItemSelector: '.js-poll-result-item',
sPollResultButtonSortSelector: '.js-poll-result-button-sort',
// Html варианта ответа
sAddItemHtml: '<li class="poll-add-item js-poll-add-item">' +
'<input type="text" name="answer[]" class="poll-add-item-input js-poll-add-item-input">' +
'<i class="icon-remove poll-add-item-remove js-poll-add-item-remove" title="' + ls.lang.get('delete') + '"></i>' +
'</li>',
};
/**
* Инициализация
*
* @param {Object} options Опции
*/
this.init = function(options) {
var self = this;
this.options = $.extend({}, defaults, options);
// Добавление
$(this.options.sAddSelector).each(function () {
var oPollAdd = $(this);
// Добавление варианта
oPollAdd.find(self.options.sAddButtonSelector).on('click', function () {
self.addItem(oPollAdd);
}.bind(self));
// Добавление варианта по нажатию Ctrl + Enter
oPollAdd.on('keyup', self.options.sAddItemInputSelector, function (e) {
var key = e.keyCode || e.which;
if (e.ctrlKey && key == 13) {
self.addItem(oPollAdd);
}
});
// Удаление
oPollAdd.on('click', self.options.sAddItemRemoveSelector, function () {
self.removeItem(this);
});
});
// Голосование
$(this.options.sPollSelector).each(function () {
var oPoll = $(this),
iPollId = oPoll.data('poll-id');
// Голосование за вариант
oPoll.find(self.options.sPollButtonVoteSelector).on('click', function () {
var iCheckedItemId = oPoll.find(self.options.sPollItemOptionSelector + ':checked').val();
if (iCheckedItemId) {
self.vote(iPollId, iCheckedItemId);
} else {
return false;
}
});
// Воздержаться
oPoll.find(self.options.sPollButtonAbstainSelector).on('click', function () {
self.vote(iPollId, -1);
});
// Воздержаться
oPoll.on('click', self.options.sPollResultButtonSortSelector, function () {
self.toggleSort(oPoll);
});
});
};
/**
* Добавляет вариант ответа
*
* @param {Object} oPollAdd Блок добавления опроса
*/
this.addItem = function(oPollAdd) {
if(oPollAdd.find(this.options.sAddItemSelector).length == this.options.iMaxItems) {
ls.msg.error(null, ls.lang.get('topic_question_create_answers_error_max'));
return false;
}
var self = this,
oNewItem = $(this.options.sAddItemHtml);
oPollAdd.find(this.options.sAddListSelector).append(oNewItem);
oNewItem.find('input[type=text]').focus();
};
/**
* Голосование в опросе
*/
this.vote = function(idTopic, idAnswer) {
var url = aRouter['ajax']+'vote/question/';
var params = {idTopic: idTopic, idAnswer: idAnswer};
* Удаляет вариант ответа
*
* @param {Number} oRemoveButton Кнопка удаления
*/
this.removeItem = function(oRemoveButton) {
$(oRemoveButton).closest(this.options.sAddItemSelector).remove();
};
/**
* Голосование в опросе
*
* @param {Number} iPollId ID опроса
* @param {Number} iItemId ID выбранного пункта
*/
this.vote = function(iPollId, iItemId) {
var oParams = {
idTopic: iPollId,
idAnswer: iItemId
};
ls.hook.marker('voteBefore');
ls.ajax(url, params, function(result) {
ls.ajax(this.options.sRouterVoteUrl, oParams, function(result) {
if (result.bStateError) {
ls.msg.error(null, result.sMsg);
} else {
var oPoll = $('[data-poll-id=' + iPollId + ']');
oPoll.html(result.sText);
ls.msg.notice(null, result.sMsg);
var area = $('#topic_question_area_'+idTopic);
ls.hook.marker('voteDisplayBefore');
area.html(result.sText);
ls.hook.run('ls_pool_vote_after',[idTopic, idAnswer,result],area);
ls.hook.run('ls_pool_vote_after', [iPollId, iItemId, result], oPoll);
}
});
};
/**
* Добавляет вариант ответа
*/
this.addAnswer = function() {
if($("#question_list li").length == 20) {
ls.msg.error(null, ls.lang.get('topic_question_create_answers_error_max'));
return false;
}
var newItem = $("#question_list li:first-child").clone();
newItem.find('a').remove();
var removeAnchor = $('<a href="#"/>').text(ls.lang.get('delete')).click(function(e){
e.preventDefault();
return this.removeAnswer(e.target);
}.bind(this));
newItem.appendTo("#question_list").append(removeAnchor);
newItem.find('input').val('');
ls.hook.run('ls_pool_add_answer_after',[removeAnchor],newItem);
};
/**
* Удаляет вариант ответа
*/
this.removeAnswer = function(obj) {
$(obj).parent("li").remove();
return false;
};
/**
* Сортировка результатов
*
* @param {Object} obj Кнопка сортировки
* @param {Number} iTopicId ID опроса
* @param {Object} oPoll Блок опроса
*/
this.toggleSortResult = function(oButton, iTopicId) {
var oButton = $(oButton),
oPoll = $('#poll-result-' + iTopicId),
aItems = oPoll.find('li'),
sSortType = oButton.hasClass('active') ? 'poll-item-pos' : 'poll-item-count';
this.toggleSort = function(oPoll) {
var oButton = oPoll.find(this.options.sPollResultButtonSortSelector),
oPollResult = oPoll.find(this.options.sPollResultSelector),
aItems = oPollResult.find(this.options.sPollResultItemSelector),
sSortType = oButton.hasClass('active') ? 'poll-item-pos' : 'poll-item-count';
aItems.sort(function (a, b) {
a = $(a).data(sSortType);
@ -78,7 +186,7 @@ ls.poll = (function ($) {
});
oButton.toggleClass('active');
oPoll.empty().append(aItems);
oPollResult.empty().append(aItems);
};
return this;

View file

@ -1,69 +1,165 @@
/**
* Заметки
*/
var ls = ls || {};
ls.usernote =( function ($) {
ls.usernote = (function($) {
"use strict";
this.sText='';
/**
* Дефолтные опции
*/
var defaults = {
// Роутеры
oRouters: {
save: aRouter['profile'] + 'ajax-note-save/',
remove: aRouter['profile'] + 'ajax-note-remove/',
},
this.showForm = function(sText) {
$('#usernote-button-add').hide();
$('#usernote-note').hide();
$('#usernote-form').show();
if (this.sText) {
$('#usernote-form-text').html(this.sText);
} else {
$('#usernote-form-text').val('');
}
$('#usernote-form-text').focus();
return false;
// Селекторы
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',
sNoteEditSelector: '.js-user-note-edit',
sNoteEditTextSelector: '.js-user-note-edit-text',
sNoteEditSaveButtonSelector: '.js-user-note-edit-save',
sNoteEditCancelButtonSelector: '.js-user-note-edit-cancel',
};
this.hideForm = function() {
$('#usernote-form').hide();
if (this.sText) {
this.showNote();
} else {
$('#usernote-button-add').show();
}
return false;
/**
* Инициализация
*
* @param {Object} options Опции
*/
this.init = function(options) {
var self = this;
this.options = $.extend({}, defaults, options);
// Добавление
$(this.options.sNoteSelector).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),
iUserId: oNote.data('user-id')
};
// Показывает форму добавления
oVars.oNote.find(self.options.sNoteAddButtonSelector).on('click', function (e) {
self.showForm(oVars);
e.preventDefault();
}.bind(self));
// Отмена
oVars.oNote.find(self.options.sNoteEditCancelButtonSelector).on('click', function (e) {
self.hideForm(oVars);
});
// Сохранение заметки
oVars.oNote.find(self.options.sNoteEditSaveButtonSelector).on('click', function (e) {
self.save(oVars);
});
// Удаление заметки
oVars.oNote.find(self.options.sNoteRemoveButtonSelector).on('click', function (e) {
self.remove(oVars);
e.preventDefault();
});
// Редактирование заметки
oVars.oNote.find(self.options.sNoteEditButtonSelector).on('click', function (e) {
self.showForm(oVars);
oVars.oNoteEditText.val( $.trim(oVars.oNoteText.html()) );
e.preventDefault();
});
});
};
this.save = function(iUserId) {
var url = aRouter['profile']+'ajax-note-save/';
var params = {iUserId: iUserId, text: $('#usernote-form-text').val()};
/**
* Показывает форму редактирования
*
* @param {Object} oVars Общие переменные
*/
this.showForm = function(oVars) {
oVars.oNoteContent.hide();
oVars.oNoteEdit.show();
oVars.oNoteEditText.val( $.trim(oVars.oNoteText.html()) ).focus();
};
/**
* Скрывает форму редактирования
*
* @param {Object} oVars Общие переменные
*/
this.hideForm = function(oVars) {
oVars.oNoteContent.show();
oVars.oNoteEdit.hide();
};
/**
* Сохраняет заметку
*
* @param {Object} oVars Общие переменные
*/
this.save = function(oVars) {
var params = {
iUserId: oVars.iUserId,
text: oVars.oNoteEditText.val()
};
ls.hook.marker('saveBefore');
ls.ajax(url, params, function(result) {
ls.ajax(this.options.oRouters.save, params, function (result) {
if (result.bStateError) {
ls.msg.error(null, result.sMsg);
} else {
this.sText=result.sText;
this.showNote();
oVars.oNoteText.html(result.sText).show();
oVars.oNoteAdd.hide();
oVars.oNoteActions.show();
this.hideForm(oVars);
ls.hook.run('ls_usernote_save_after',[params, result]);
}
}.bind(this));
return false;
};
this.showNote = function() {
$('#usernote-form').hide();
$('#usernote-note').show();
$('#usernote-note-text').html(this.sText);
};
/**
* Удаление заметки
*
* @param {Object} oVars Общие переменные
*/
this.remove = function(oVars) {
var params = {
iUserId: oVars.iUserId
};
this.remove = function(iUserId) {
var url = aRouter['profile']+'ajax-note-remove/';
var params = {iUserId: iUserId};
ls.hook.marker('removeBefore');
ls.ajax(url, params, function(result) {
ls.ajax(this.options.oRouters.remove, params, function (result) {
if (result.bStateError) {
ls.msg.error(null, result.sMsg);
} else {
$('#usernote-note').hide();
$('#usernote-button-add').show();
this.sText='';
oVars.oNoteText.empty().hide();
oVars.oNoteAdd.show();
oVars.oNoteActions.hide();
this.hideForm(oVars);
ls.hook.run('ls_usernote_remove_after',[params, result]);
}
}.bind(this));
return false;
};
return this;

View file

@ -304,12 +304,12 @@ return array(
'topic_question_title' => 'Опросы',
'topic_question_title_edit' => 'Редактирование опроса',
'topic_question_title_create' => 'Добавление опроса',
'topic_question_vote' => 'голосовать',
'topic_question_vote' => 'Голосовать',
'topic_question_vote_ok' => 'Ваш голос учтен.',
'topic_question_vote_already' => 'Ваш голос уже учтен!',
'topic_question_vote_result' => 'Проголосовало',
'topic_question_vote_result_sort' => 'Включить\выключить сортировку',
'topic_question_abstain' => 'воздержаться',
'topic_question_abstain' => 'Воздержаться',
'topic_question_abstain_result' => 'Воздержалось',
'topic_question_create' => 'Создание топика-опроса',
'topic_question_edit' => 'Редактирование топика-опроса',

View file

@ -4,7 +4,7 @@
* bCloseBlog true если блог закрытый
*
* @styles css/blog.css
* @scripts _framework_/js/livestreet/blog.js
* @scripts <framework>/js/livestreet/blog.js
*}
{extends file='layouts/layout.base.tpl'}

View file

@ -2,6 +2,7 @@
* Создание топика-опроса
*
* @styles css/topic.css
* @scripts <framework>/js/livestreet/poll.js
*}
{extends file='forms/form.add.topic.base.tpl'}
@ -10,25 +11,28 @@
{block name='add_topic_type'}question{/block}
{block name='add_topic_form_text_before'}
<div class="poll-add">
<label>{$aLang.topic_question_create_answers}:</label>
<div class="poll-add js-poll-add">
<h3 class="h6">{$aLang.topic_question_create_answers}</h3>
<ul class="poll-add-list" id="question_list">
<ul class="poll-add-list js-poll-add-list">
{if count($_aRequest.answer) >= 2}
{foreach from=$_aRequest.answer item=sAnswer key=i}
<li>
<input type="text" value="{$sAnswer}" name="answer[]" class="width-300" {if $bEditDisabled}disabled{/if} />
{if !$bEditDisabled and $i>1} <a href="#" onClick="return ls.poll.removeAnswer(this);">{$aLang.topic_question_create_answers_delete}</a>{/if}
<li class="poll-add-item js-poll-add-item">
<input type="text" value="{$sAnswer}" name="answer[]" class="poll-add-item-input js-poll-add-item-input" {if $bEditDisabled}disabled{/if} />
{if ! $bEditDisabled and $i > 1}
<i class="icon-remove poll-add-item-remove js-poll-add-item-remove" title="{$aLang.topic_question_create_answers_delete}"></i>
{/if}
</li>
{/foreach}
{else}
<li><input type="text" value="" name="answer[]" class="width-300" {if $bEditDisabled}disabled{/if} /></li>
<li><input type="text" value="" name="answer[]" class="width-300" {if $bEditDisabled}disabled{/if} /></li>
<li class="poll-add-item js-poll-add-item"><input type="text" name="answer[]" class="poll-add-item-input js-poll-add-item-input" {if $bEditDisabled}disabled{/if} /></li>
<li class="poll-add-item js-poll-add-item"><input type="text" name="answer[]" class="poll-add-item-input js-poll-add-item-input" {if $bEditDisabled}disabled{/if} /></li>
{/if}
</ul>
{if ! $bEditDisabled}
<a href="#" onclick="ls.poll.addAnswer(); return false;" class="link-dotted">{$aLang.topic_question_create_answers_add}</a>
<button type="button" class="button button-primary js-poll-add-button" title="[Ctrl + Enter]">{$aLang.topic_question_create_answers_add}</button>
{/if}
</div>
{/block}

View file

@ -92,9 +92,7 @@
* @type profile note
* @file blocks/block.profileNote.tpl
*/
.block-type-profile-note { background: #F1F7AF; border: 1px solid #E1EA83; padding: 15px; }
.block-type-profile-note p { margin-bottom: 10px; }
.block-type-profile-note .actions { margin-bottom: 0; }
.block-type-profile-note { border: none; padding: 0; }
/**
* @type profile nav

View file

@ -13,18 +13,6 @@
.avatar-edit label { margin-top: 10px; }
/**
* Создание топика-опроса
*
* @file actions/ActionQuestion/add.tpl
*/
.poll-add { padding: 15px 20px; margin-bottom: 20px; background: #f7f7f7; }
.poll-add-list { margin-bottom: 15px; }
.poll-add-list li { margin-bottom: 5px; }
.poll-add-list li input[type="text"] { margin-right: 10px; }
/**
* Справка по разметке редактора
*

View file

@ -0,0 +1,43 @@
/**
* Опросы
*
* @template topics/topic.question.tpl
*/
.poll { margin-bottom: 15px; background: #fafafa; padding: 15px; }
.poll-list { margin-bottom: 20px; margin-left: 0; list-style-type: none; }
.poll-item { margin-bottom: 10px; }
.poll-item:last-child { margin-bottom: 0; }
.poll-item label { display: inline; }
/**
* Результат опроса
*
* @template topics/poll_result.tpl
*/
.poll-result { margin-bottom: 10px; padding: 15px 15px 0; background: #fff; border: 1px solid #eee; }
.poll-result-item { margin-bottom: 20px; overflow: hidden; zoom: 1; }
.poll-result-item-count { float: left; width: 50px; text-align: right; padding-right: 15px; }
.poll-result-item-count strong { display: block; }
.poll-result-item-count span { color: #aaa; }
.poll-result-item-chart { padding-left: 65px; }
.poll-result-item-bar { height: 10px; margin-top: 5px; background: #ccc; overflow: hidden; border-radius: 2px; }
.poll-result-item-most .poll-result-item-bar { background: #60CC4E; }
.poll-result-total { color: #aaa; margin-left: 10px; }
/**
* Создание опроса
*
* @template actions/ActionQuestion/add.tpl
*/
.poll-add { padding: 20px; margin-bottom: 20px; background: #f7f7f7; }
.poll-add-list { margin-bottom: 15px; }
.poll-add-item { margin-bottom: 10px; padding-right: 25px; position: relative; }
.poll-add-item-input { width: 100%; }
.poll-add-item-remove { position: absolute; top: 7px; right: 0; cursor: pointer; }

View file

@ -35,4 +35,13 @@
.profile-page-header { font-size: 12px; font-weight: bold; margin-bottom: 20px; background: #f5f5f5; border-top: 1px solid #eee; color: #555; padding: 5px 10px 6px; }
.profile-info-about { padding: 20px; margin-bottom: 30px; background: #f7f7f7; color: #000; }
.profile-info-about { padding: 20px; margin-bottom: 30px; background: #f7f7f7; color: #000; }
/**
* Заметка
*
* @template blocks/block.profileNote.tpl
*/
.user-note { background: #F1F7AF; border: 1px solid #E1EA83; padding: 15px; }
.user-note .user-note-text { margin-bottom: 10px; }
.user-note .actions { margin-bottom: 0; }

View file

@ -90,32 +90,6 @@
.topic-footer .topic-info li.topic-info-comments a:hover { text-decoration: underline; }
/**
* Топик опрос
*
* @type question
* @file topics/topic.question.tpl
* @file topics/question_result.tpl
*/
.poll { margin-bottom: 15px; background: #fafafa; padding: 15px; }
.poll .poll-vote { margin-bottom: 20px; margin-left: 0; list-style-type: none; }
.poll .poll-vote li { margin-bottom: 10px; }
.poll .poll-vote li:last-child { margin-bottom: 0; }
.poll .poll-vote li label { display: inline; }
.poll .poll-vote li input { position: relative; top: 1px; margin-right: 2px; }
.poll .poll-result { margin-bottom: 10px; margin-left: 0; list-style-type: none; padding: 15px 15px 0; background: #fff; border: 1px solid #eee; }
.poll .poll-result li { margin-bottom: 20px; }
.poll .poll-result li dl { overflow: hidden; zoom: 1; }
.poll .poll-result li dl dt { float: left; width: 50px; text-align: right; padding-right: 15px; }
.poll .poll-result li dl dt span { color: #aaa; }
.poll .poll-result li dl dd { padding-left: 65px; }
.poll .poll-result li dl dd div { height: 10px; margin-top: 5px; background: #ccc; overflow: hidden; border-radius: 2px; }
.poll .poll-result li.most dl dd div { background: #60CC4E; }
.poll .poll-total { color: #aaa; margin-left: 10px; }
/**
* Топик фотосет
*
@ -124,6 +98,7 @@
*/
.topic.topic-type-photoset .topic-content { margin-bottom: 25px; }
/**
* Топик ссылка
*
@ -133,6 +108,7 @@
.topic-url { margin-bottom: 30px; }
.topic-url a { background: #eee; border-radius: 3px; padding: 3px 10px 4px; text-decoration: none; }
/**
* Предпросмотр топика
*
@ -142,6 +118,7 @@
.topic-preview .profile-page-header { border-top: 1px solid #ddd; }
.topic-preview .topic { margin-bottom: 20px; }
/**
* Личное сообщение
* TODO: Move to talk.css

View file

@ -130,6 +130,18 @@ jQuery(document).ready(function($){
* Talk
*/
ls.talk.init();
/**
* Poll
*/
ls.poll.init();
/**
* User Note
*/
ls.usernote.init();
// Хук конца инициализации javascript-составляющих шаблона

View file

@ -11,33 +11,31 @@
{$bBlockNotShow = true}
{/if}
{/block}
{block name='block_type'}profile-note{/block}
{block name='block_content_after'}
{if $oUserNote}
<script type="text/javascript">
ls.usernote.sText = {json var = $oUserNote->getText()};
</script>
{/if}
<div class="user-note js-user-note" data-user-id="{$oUserProfile->getId()}">
<div class="user-note-content js-user-note-content">
<p class="user-note-text js-user-note-text" {if ! $oUserNote}style="display: none"{/if}>
{if $oUserNote}
{$oUserNote->getText()}
{/if}
</p>
<ul class="actions user-note-actions js-user-note-actions" {if ! $oUserNote}style="display: none;"{/if}>
<li><a href="#" class="link-dotted js-user-note-edit-button">{$aLang.user_note_form_edit}</a></li>
<li><a href="#" class="link-dotted js-user-note-remove-button">{$aLang.user_note_form_delete}</a></li>
</ul>
<div id="usernote-note" class="profile-note" {if !$oUserNote}style="display: none;"{/if}>
<p id="usernote-note-text">
{if $oUserNote}
{$oUserNote->getText()}
{/if}
</p>
<ul class="actions">
<li><a href="#" onclick="return ls.usernote.showForm();" class="link-dotted">{$aLang.user_note_form_edit}</a></li>
<li><a href="#" onclick="return ls.usernote.remove({$oUserProfile->getId()});" class="link-dotted">{$aLang.user_note_form_delete}</a></li>
</ul>
</div>
<a href="#" class="link-dotted js-user-note-add-button" {if $oUserNote}style="display:none;"{/if}>{$aLang.user_note_add}</a>
</div>
<div id="usernote-form" style="display: none;">
<p><textarea rows="4" cols="20" id="usernote-form-text" class="input-text input-width-full"></textarea></p>
<button type="submit" onclick="return ls.usernote.save({$oUserProfile->getId()});" class="button button-primary">{$aLang.user_note_form_save}</button>
<button type="submit" onclick="return ls.usernote.hideForm();" class="button">{$aLang.user_note_form_cancel}</button>
<div class="js-user-note-edit" style="display: none;">
<textarea rows="4" cols="20" class="width-full mb-15 js-user-note-edit-text"></textarea>
<button type="submit" class="button button-primary js-user-note-edit-save">{$aLang.user_note_form_save}</button>
<button type="submit" class="button js-user-note-edit-cancel">{$aLang.user_note_form_cancel}</button>
</div>
</div>
<a href="#" onclick="return ls.usernote.showForm();" id="usernote-button-add" class="link-dotted" {if $oUserNote}style="display:none;"{/if}>{$aLang.user_note_add}</a>
{/block}

View file

@ -65,7 +65,7 @@
<script>
ls.lang.load({json var = $aLangJs});
ls.lang.load({lang_load name="blog,talk_favourite_add,talk_favourite_del"});
ls.lang.load({lang_load name="blog, talk_favourite_add, talk_favourite_del, topic_question_create_answers_error_max"});
ls.registry.set('comment_max_tree', {json var=$oConfig->Get('module.comment.max_tree')});
ls.registry.set('block_stream_show_tip', {json var=$oConfig->Get('block.stream.show_tip')});

View file

@ -50,6 +50,7 @@ $config['head']['default']['css'] = array_merge(Config::Get('head.default.css'),
"___path.static.assets___/css/activity.css",
"___path.static.assets___/css/admin.css",
"___path.static.assets___/css/toolbar.css",
"___path.static.assets___/css/poll.css",
"___path.static.skin___/themes/___view.theme___/style.css",
"___path.static.assets___/css/print.css",
));

View file

@ -1,30 +1,32 @@
{**
* Результат опроса
*
* @styles css/topic.css
* @styles assets/css/poll.css
* @scripts <framework>/js/livestreet/poll.js
*}
<ul class="poll-result" id="poll-result-{$oTopic->getId()}">
<ul class="poll-result js-poll-result">
{$iPollItemsCount = count($oTopic->getQuestionAnswers())}
{foreach from=$oTopic->getQuestionAnswers() key=key item=aAnswer name=poll}
<li {if $oTopic->getQuestionAnswerMax() == $aAnswer.count}class="most"{/if}
<li class="poll-result-item {if $oTopic->getQuestionAnswerMax() == $aAnswer.count}poll-result-item-most{/if} js-poll-result-item"
data-poll-item-count="{$aAnswer.count}"
data-poll-item-pos="{$iPollItemsCount - $smarty.foreach.poll.index - 1}">
<dl>
<dt>
<strong>{$oTopic->getQuestionAnswerPercent($key)}%</strong><br />
<span>({$aAnswer.count})</span>
</dt>
<dd>{$aAnswer.text|escape:'html'}<div style="width: {$oTopic->getQuestionAnswerPercent($key)}%;" ></div></dd>
</dl>
<div class="poll-result-item-count">
<strong>{$oTopic->getQuestionAnswerPercent($key)}%</strong>
<span>({$aAnswer.count})</span>
</div>
<div class="poll-result-item-chart">
<div class="poll-result-item-label">{$aAnswer.text|escape:'html'}</div>
<div class="poll-result-item-bar" style="width: {$oTopic->getQuestionAnswerPercent($key)}%;" ></div>
</div>
</li>
{/foreach}
</ul>
{* Кнопка сортировки *}
<button class="button button-icon" title="{$aLang.topic_question_vote_result_sort}" onclick="return ls.poll.toggleSortResult(this, {$oTopic->getId()});"><i class="icon-align-left"></i></button>
<button class="button button-icon js-poll-result-button-sort" title="{$aLang.topic_question_vote_result_sort}"><i class="icon-align-left"></i></button>
<span class="poll-total poll-total-result">{$aLang.topic_question_vote_result}: {$oTopic->getQuestionCountVote()} | {$aLang.topic_question_abstain_result}: {$oTopic->getQuestionCountVoteAbstain()}</span>
<span class="poll-result-total">{$aLang.topic_question_vote_result}: {$oTopic->getQuestionCountVote()} | {$aLang.topic_question_abstain_result}: {$oTopic->getQuestionCountVoteAbstain()}</span>

View file

@ -2,24 +2,22 @@
* Топик опрос
*
* @styles css/topic.css
* @scripts <framework>/js/livestreet/poll.js
*}
{extends file='topics/topic_base.tpl'}
{block name='topic_header_after'}
<div id="topic_question_area_{$oTopic->getId()}" class="poll">
{if !$oTopic->getUserQuestionIsVote()}
<ul class="poll-vote">
{foreach from=$oTopic->getQuestionAnswers() key=key item=aAnswer}
<li><label><input type="radio" id="topic_answer_{$oTopic->getId()}_{$key}" name="topic_answer_{$oTopic->getId()}" value="{$key}" onchange="jQuery('#topic_answer_{$oTopic->getId()}_value').val(jQuery(this).val());" /> {$aAnswer.text|escape:'html'}</label></li>
<div class="poll js-poll" data-poll-id="{$oTopic->getId()}">
{if ! $oTopic->getUserQuestionIsVote()}
<ul class="poll-list js-poll-list">
{foreach from=$oTopic->getQuestionAnswers() key=iItemId item=aAnswer}
<li class="poll-item js-poll-item"><label><input type="radio" name="poll-{$oTopic->getId()}" value="{$iItemId}" class="js-poll-item-option" /> {$aAnswer.text|escape:'html'}</label></li>
{/foreach}
</ul>
<button type="submit" onclick="ls.poll.vote({$oTopic->getId()},jQuery('#topic_answer_{$oTopic->getId()}_value').val());" class="button button-primary">{$aLang.topic_question_vote}</button>
<button type="submit" onclick="ls.poll.vote({$oTopic->getId()},-1)" class="button">{$aLang.topic_question_abstain}</button>
<input type="hidden" id="topic_answer_{$oTopic->getId()}_value" value="-1" />
<button type="submit" class="button button-primary js-poll-button-vote">{$aLang.topic_question_vote}</button>
<button type="submit" class="button js-poll-button-abstain">{$aLang.topic_question_abstain}</button>
{else}
{include file='topics/poll_result.tpl'}
{/if}

View file

@ -2,6 +2,7 @@
* Создание топика-опроса
*
* @styles css/topic.css
* @scripts <framework>/js/livestreet/poll.js
*}
{extends file='forms/form.add.topic.base.tpl'}
@ -10,24 +11,28 @@
{block name='add_topic_type'}question{/block}
{block name='add_topic_form_text_before'}
<div class="poll-add">
<label>{$aLang.topic_question_create_answers}:</label>
<ul class="poll-add-list" id="question_list">
<div class="poll-add js-poll-add">
<h3 class="h6">{$aLang.topic_question_create_answers}</h3>
<ul class="poll-add-list js-poll-add-list">
{if count($_aRequest.answer) >= 2}
{foreach from=$_aRequest.answer item=sAnswer key=i}
<li>
<input type="text" value="{$sAnswer}" name="answer[]" class="width-300" {if $bEditDisabled}disabled{/if} />
{if !$bEditDisabled and $i>1} <a href="#" class="icon-synio-remove" onClick="return ls.poll.removeAnswer(this);"></a>{/if}
<li class="poll-add-item js-poll-add-item">
<input type="text" value="{$sAnswer}" name="answer[]" class="poll-add-item-input js-poll-add-item-input" {if $bEditDisabled}disabled{/if} />
{if ! $bEditDisabled and $i > 1}
<i class="icon-synio-remove poll-add-item-remove js-poll-add-item-remove" title="{$aLang.topic_question_create_answers_delete}"></i>
{/if}
</li>
{/foreach}
{else}
<li><input type="text" value="" name="answer[]" class="width-300" {if $bEditDisabled}disabled{/if} /></li>
<li><input type="text" value="" name="answer[]" class="width-300" {if $bEditDisabled}disabled{/if} /></li>
<li class="poll-add-item js-poll-add-item"><input type="text" name="answer[]" class="poll-add-item-input js-poll-add-item-input" {if $bEditDisabled}disabled{/if} /></li>
<li class="poll-add-item js-poll-add-item"><input type="text" name="answer[]" class="poll-add-item-input js-poll-add-item-input" {if $bEditDisabled}disabled{/if} /></li>
{/if}
</ul>
{if ! $bEditDisabled}
<button type="button" onclick="ls.poll.addAnswer(); return false;" class="button">{$aLang.topic_question_create_answers_add}</button>
<button type="button" class="button button-primary js-poll-add-button" title="[Ctrl + Enter]">{$aLang.topic_question_create_answers_add}</button>
{/if}
</div>
{/block}

View file

@ -96,7 +96,7 @@ h1, h2, h3, h4, h5, h6 { font-family: 'PT Sans', Arial, sans-serif; }
*/
#footer .copyright { float: right; width: 255px; }
#footer .copyright .design-by { overflow: hidden; line-height: 15px; margin-top: 30px; }
#footer .copyright .design-by img { float: left; margin-right: 10px; margin-top: 3px; }
#footer .copyright .design-by .icon-xeoart { float: left; margin-right: 10px; margin-top: 3px; }
#footer .copyright .design-by div { font-size: 10px; color: #8b9191; margin-top: 1px; }
#footer a { color: #000; }
#footer a:hover { color: #333; }

View file

@ -119,15 +119,18 @@
* @type profile note
* @file blocks/block.profileNote.tpl
*/
.block-type-profile-note { border: none; margin-bottom: 0; }
.block-type-profile-note .block-content { border: 2px solid #ffe25d; padding: 15px; border-radius: 5px; }
.block-type-profile-note p { margin-bottom: 10px; }
.block-type-profile-note .actions { margin-bottom: 0; font-size: 11px; }
.block-type-profile-note .actions a { color: #275ec2; border-color: #275ec2; }
.block-type-profile-note .actions a:hover { color: #f00; border-color: #f00; }
.block-type-profile-note { border: none; margin-bottom: 0; }
/**
* @type profile nav
* @file blocks/block.profileNav.tpl
*/
.block.block-type-profile-nav { padding: 0; background: none; border: none; }
/**
* @type profile actions
* @file blocks/block.profileActions.tpl
*/
.block.block-type-profile-actions { border: none; }
.block.block-type-profile-actions .block-content { padding: 0 0 0 30px; }
.block.block-type-profile-actions ul li { margin-bottom: 5px; font-size: 11px; }

View file

@ -19,6 +19,14 @@
}
.button:hover { background: #f0f2f5; color: #434343; }
.button:active,
.button.active {
background: #edf8fd;
color: #628fa5;
box-shadow: inset 0 1px 2px #b4d5e2;
border-color: #D1ECF7;
}
a.button { padding-top: 4px; }
.button i { top: 1px; }
@ -78,6 +86,14 @@ a.button-large { padding-top: 7px; }
}
.button-primary:hover { background: #2abcfe; color: #fff; }
.button-primary:active,
.button-primary.active {
background: #2abcfe;
color: #fff;
box-shadow: inset 0 2px 3px rgba(0,0,0,.1);
border-color: #27ace8;
}
/* Button Write */
.button.button-write,

View file

@ -102,18 +102,6 @@ dl.form-item dd { float: left; width: 250px; }
.avatar-edit label { margin-top: 10px; }
/**
* Создание топика-опроса
*
* @file actions/ActionQuestion/add.tpl
*/
.poll-add { padding: 15px 20px; margin-bottom: 20px; background: #F1F7FD; }
.poll-add-list { margin-bottom: 15px; }
.poll-add-list li { margin-bottom: 5px; }
.poll-add-list li input[type="text"] { margin-right: 5px; }
/**
* Справка по разметке редактора
*

View file

@ -221,6 +221,9 @@
.icon-synio-vote-info-zero { width: 16px; height: 16px; background-position: -99px -71px; }
.icon-synio-vote-info-view { width: 16px; height: 16px; background-position: -179px -39px; }
.icon-poll-sort { width: 11px; height: 11px; background: url(../images/icons/poll-sort.png) 0 0 no-repeat; }
.icon-xeoart { width: 87px; height: 25px; background: url(../images/icons/xeoart.png) 0 0 no-repeat; }

View file

@ -0,0 +1,57 @@
/**
* Опросы
*
* @template topics/topic.question.tpl
*/
.poll { margin-bottom: 15px; }
.poll-list { margin-bottom: 20px; margin-left: 0; list-style-type: none; }
.poll-item { margin-bottom: 10px; }
.poll-item:last-child { margin-bottom: 0; }
.poll-item label { display: inline; }
/**
* Результат опроса
*
* @template topics/poll_result.tpl
*/
.poll-result { margin-bottom: 10px; }
.poll-result-item { margin-bottom: 20px; overflow: hidden; zoom: 1; }
.poll-result-item-count { float: left; width: 65px; }
.poll-result-item-count strong { display: block; }
.poll-result-item-count span { font-size: 11px; color: #aaa; }
.poll-result-item-chart { padding-left: 80px; }
.poll-result-item-bar { height: 7px; margin-top: 3px; background: #ccc; overflow: hidden; border-radius: 4px; }
.poll-result-item-most .poll-result-item-count { color: #12aaeb; }
.poll-result-item-most .poll-result-item-bar {
background: #1999e2;
background: -moz-linear-gradient(top, #25dcfc 0%, #198bdd 70%, #38d1f7 100%);
background: -webkit-gradient(left top, left bottom, color-stop(0%, #25dcfc), color-stop(70%, #198bdd), color-stop(100%, #38d1f7));
background: -webkit-linear-gradient(top, #25dcfc 0%, #198bdd 70%, #38d1f7 100%);
background: -o-linear-gradient(top, #25dcfc 0%, #198bdd 70%, #38d1f7 100%);
background: -ms-linear-gradient(top, #25dcfc 0%, #198bdd 70%, #38d1f7 100%);
background: linear-gradient(to bottom, #25dcfc 0%, #198bdd 70%, #38d1f7 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#25dcfc', endColorstr='#38d1f7', GradientType=0 );
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2);
box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.poll-result-total { position: relative; color: #818189; font-size: 11px; line-height: 16px; padding-left: 80px; }
.poll-result-total .button { position: absolute; top: 2px; left: 0; cursor: pointer; }
.poll-result-total .button.active .icon-poll-sort { background-image: url(../images/icons/poll-sort-active.png); }
/**
* Создание опроса
*
* @template actions/ActionQuestion/add.tpl
*/
.poll-add { padding: 20px; margin-bottom: 20px; background: #F1F7FD; }
.poll-add-list { margin-bottom: 15px; }
.poll-add-item { margin-bottom: 10px; padding-right: 30px; position: relative; }
.poll-add-item-input { width: 100%; }
.poll-add-item-remove { position: absolute; top: 2px; right: 0; cursor: pointer; }

View file

@ -49,4 +49,13 @@
.profile-contact-list { margin-bottom: 50px; }
.profile-contact-list li { margin-bottom: 5px; padding-left: 21px; position: relative; }
.profile-contact-list li i { position: absolute; top: 2px; left: 0; }
.profile-contact-list li i { position: absolute; top: 2px; left: 0; }
/**
* Заметка
*
* @template blocks/block.profileNote.tpl
*/
.user-note { border: 2px solid #ffe25d; padding: 15px; border-radius: 5px; }
.user-note .user-note-text { margin-bottom: 10px; }
.user-note .actions { margin-bottom: 0; font-size: 11px; }

View file

@ -127,46 +127,6 @@
.topic-footer .topic-info li.topic-info-favourite:hover .favourite { background-position: 0 -51px; }
/**
* Топик опрос
*
* @type question
* @file topics/topic.question.tpl
* @file topics/question_result.tpl
*/
.poll { margin-bottom: 15px; }
.poll .poll-vote { margin-bottom: 20px; margin-left: 0; list-style-type: none; }
.poll .poll-vote li { margin-bottom: 10px; }
.poll .poll-vote li:last-child { margin-bottom: 0; }
.poll .poll-vote li label { display: inline; }
.poll .poll-vote li input { position: relative; top: 1px; margin-right: 2px; }
.poll .poll-result { margin-bottom: 10px; list-style-type: none; background: #fff; overflow: hidden; }
.poll .poll-result li { margin-bottom: 20px; }
.poll .poll-result li dl { overflow: hidden; zoom: 1; }
.poll .poll-result li dl dt { float: left; width: 80px; }
.poll .poll-result li dl dt span { font-size: 11px; color: #aaa; }
.poll .poll-result li dl dd { padding-left: 80px; }
.poll .poll-result li dl dd div { height: 7px; margin-top: 3px; background: #ccc; overflow: hidden; border-radius: 4px; }
.poll .poll-result li.most dl dd div {
background: #1999e2;
background: -moz-linear-gradient(top, #25dcfc 0%, #198bdd 70%, #38d1f7 100%);
background: -webkit-gradient(left top, left bottom, color-stop(0%, #25dcfc), color-stop(70%, #198bdd), color-stop(100%, #38d1f7));
background: -webkit-linear-gradient(top, #25dcfc 0%, #198bdd 70%, #38d1f7 100%);
background: -o-linear-gradient(top, #25dcfc 0%, #198bdd 70%, #38d1f7 100%);
background: -ms-linear-gradient(top, #25dcfc 0%, #198bdd 70%, #38d1f7 100%);
background: linear-gradient(to bottom, #25dcfc 0%, #198bdd 70%, #38d1f7 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#25dcfc', endColorstr='#38d1f7', GradientType=0 );
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2);
box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.poll .poll-result li.most dl dt { color: #12aaeb; }
.poll .poll-total { position: relative; color: #818189; font-size: 11px; line-height: 16px; padding-left: 80px; margin-bottom: 30px; }
.poll .poll-total .poll-sort { position: absolute; top: 2px; left: 0; width: 23px; height: 23px; background: url(../images/icons-synio.png) -161px 0 no-repeat; cursor: pointer; }
.poll .poll-total .poll-sort.active { background-position: -184px 0; }
/**
* Топик фотосет
*

Binary file not shown.

After

Width:  |  Height:  |  Size: 969 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 969 B

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -172,6 +172,23 @@ jQuery(document).ready(function($){
* Captcha
*/
ls.captcha.init();
/**
* User Note
*/
ls.usernote.init();
/**
* Poll
*/
ls.poll.init({
sAddItemHtml: '<li class="poll-add-item js-poll-add-item">' +
'<input type="text" name="answer[]" class="poll-add-item-input js-poll-add-item-input">' +
'<i class="icon-synio-remove poll-add-item-remove js-poll-add-item-remove" title="' + ls.lang.get('delete') + '"></i>' +
'</li>',
});
// вступление в блог
@ -217,16 +234,6 @@ jQuery(document).ready(function($){
$(this).remove();
});
// опрос
ls.hook.add('ls_pool_add_answer_after',function(removeAnchor){
var removeAnchor = $('<a href="#" class="icon-synio-remove" />').attr('title', ls.lang.get('delete')).click(function(e){
e.preventDefault();
return this.removeAnswer(e.target);
}.bind(ls.poll));
$(this).find('a').remove();
$(this).append(removeAnchor);
});
// регистрация
ls.hook.add('ls_user_validate_registration_fields_after',function(aFields, sForm, result){
$.each(aFields,function(i,aField){

View file

@ -11,33 +11,31 @@
{$bBlockNotShow = true}
{/if}
{/block}
{block name='block_type'}profile-note{/block}
{block name='block_content'}
{if $oUserNote}
<script type="text/javascript">
ls.usernote.sText = {json var = $oUserNote->getText()};
</script>
{/if}
<div class="user-note js-user-note" data-user-id="{$oUserProfile->getId()}">
<div class="user-note-content js-user-note-content">
<p class="user-note-text js-user-note-text" {if ! $oUserNote}style="display: none"{/if}>
{if $oUserNote}
{$oUserNote->getText()}
{/if}
</p>
<ul class="actions user-note-actions js-user-note-actions" {if ! $oUserNote}style="display: none;"{/if}>
<li><a href="#" class="link-dotted js-user-note-edit-button">{$aLang.user_note_form_edit}</a></li>
<li><a href="#" class="link-dotted js-user-note-remove-button">{$aLang.user_note_form_delete}</a></li>
</ul>
<div id="usernote-note" class="profile-note" {if !$oUserNote}style="display: none;"{/if}>
<p id="usernote-note-text">
{if $oUserNote}
{$oUserNote->getText()}
{/if}
</p>
<ul class="actions">
<li><a href="#" onclick="return ls.usernote.showForm();" class="link-dotted">{$aLang.user_note_form_edit}</a></li>
<li><a href="#" onclick="return ls.usernote.remove({$oUserProfile->getId()});" class="link-dotted">{$aLang.user_note_form_delete}</a></li>
</ul>
</div>
<a href="#" class="link-dotted js-user-note-add-button" {if $oUserNote}style="display:none;"{/if}>{$aLang.user_note_add}</a>
</div>
<div id="usernote-form" style="display: none;">
<p><textarea rows="4" cols="20" id="usernote-form-text" class="input-text input-width-full"></textarea></p>
<button type="submit" onclick="return ls.usernote.save({$oUserProfile->getId()});" class="button button-primary">{$aLang.user_note_form_save}</button>
<button type="submit" onclick="return ls.usernote.hideForm();" class="button">{$aLang.user_note_form_cancel}</button>
<div class="js-user-note-edit" style="display: none;">
<textarea rows="4" cols="20" class="width-full mb-15 js-user-note-edit-text"></textarea>
<button type="submit" class="button button-primary js-user-note-edit-save">{$aLang.user_note_form_save}</button>
<button type="submit" class="button js-user-note-edit-cancel">{$aLang.user_note_form_cancel}</button>
</div>
</div>
<a href="#" onclick="return ls.usernote.showForm();" id="usernote-button-add" class="link-dotted" {if $oUserNote}style="display:none;"{/if}>{$aLang.user_note_add}</a>
{/block}

View file

@ -67,7 +67,7 @@
<script>
ls.lang.load({json var = $aLangJs});
ls.lang.load({lang_load name="blog,talk_favourite_add,talk_favourite_del"});
ls.lang.load({lang_load name="blog, talk_favourite_add, talk_favourite_del, topic_question_create_answers_error_max"});
ls.registry.set('comment_max_tree', {json var=$oConfig->Get('module.comment.max_tree')});
ls.registry.set('block_stream_show_tip', {json var=$oConfig->Get('block.stream.show_tip')});
@ -332,7 +332,7 @@
{hook run='copyright'}
<div class="design-by">
<img src="{cfg name='path.static.assets'}/images/xeoart.png" alt="xeoart" />
<i class="icon-xeoart"></i>
Design by <a href="http://xeoart.com">xeoart</a>
<div>2012</div>
</div>

View file

@ -71,6 +71,7 @@ $config['head']['default']['css'] = array_merge(Config::Get('head.default.css'),
"___path.static.assets___/css/wall.css",
"___path.static.assets___/css/activity.css",
"___path.static.assets___/css/admin.css",
"___path.static.assets___/css/poll.css",
"___path.static.skin___/themes/___view.theme___/style.css",
"___path.static.assets___/css/print.css",
));

View file

@ -1,33 +1,35 @@
{**
* Результат опроса
*
* @styles css/topic.css
* @styles assets/css/poll.css
* @scripts <framework>/js/livestreet/poll.js
*}
<ul class="poll-result" id="poll-result-{$oTopic->getId()}">
<ul class="poll-result js-poll-result">
{$iPollItemsCount = count($oTopic->getQuestionAnswers())}
{foreach from=$oTopic->getQuestionAnswers() key=key item=aAnswer name=poll}
<li {if $oTopic->getQuestionAnswerMax() == $aAnswer.count}class="most"{/if}
<li class="poll-result-item {if $oTopic->getQuestionAnswerMax() == $aAnswer.count}poll-result-item-most{/if} js-poll-result-item"
data-poll-item-count="{$aAnswer.count}"
data-poll-item-pos="{$iPollItemsCount - $smarty.foreach.poll.index - 1}">
<dl>
<dt>
<strong>{$oTopic->getQuestionAnswerPercent($key)}%</strong><br />
<span>({$aAnswer.count})</span>
</dt>
<dd>{$aAnswer.text|escape:'html'}<div style="width: {$oTopic->getQuestionAnswerPercent($key)}%;" ></div></dd>
</dl>
<div class="poll-result-item-count">
<strong>{$oTopic->getQuestionAnswerPercent($key)}%</strong>
<span>({$aAnswer.count})</span>
</div>
<div class="poll-result-item-chart">
<div class="poll-result-item-label">{$aAnswer.text|escape:'html'}</div>
<div class="poll-result-item-bar" style="width: {$oTopic->getQuestionAnswerPercent($key)}%;" ></div>
</div>
</li>
{/foreach}
</ul>
<div class="poll-total">
<div class="poll-result-total">
{* Кнопка сортировки *}
<i class="poll-sort" title="{$aLang.topic_question_vote_result_sort}" onclick="return ls.poll.toggleSortResult(this, {$oTopic->getId()});"></i>
<button class="button button-small button-icon js-poll-result-button-sort" title="{$aLang.topic_question_vote_result_sort}"><i class="icon-poll-sort"></i></button>
{$aLang.topic_question_vote_result} &mdash; {$oTopic->getQuestionCountVote()}<br />
{$aLang.topic_question_abstain_result} &mdash; {$oTopic->getQuestionCountVoteAbstain()}

View file

@ -2,33 +2,22 @@
* Топик опрос
*
* @styles css/topic.css
* @scripts <framework>/js/livestreet/poll.js
*}
{extends file='topics/topic_base.tpl'}
{block name='topic_header_after'}
<div id="topic_question_area_{$oTopic->getId()}" class="poll">
{if !$oTopic->getUserQuestionIsVote()}
<ul class="poll-vote">
{foreach from=$oTopic->getQuestionAnswers() key=key item=aAnswer}
<li>
<label>
<input type="radio"
id="topic_answer_{$oTopic->getId()}_{$key}"
name="topic_answer_{$oTopic->getId()}"
value="{$key}"
onchange="jQuery('#topic_answer_{$oTopic->getId()}_value').val(jQuery(this).val());" />
{$aAnswer.text|escape:'html'}
</label>
</li>
<div class="poll js-poll" data-poll-id="{$oTopic->getId()}">
{if ! $oTopic->getUserQuestionIsVote()}
<ul class="poll-list js-poll-list">
{foreach from=$oTopic->getQuestionAnswers() key=iItemId item=aAnswer}
<li class="poll-item js-poll-item"><label><input type="radio" name="poll-{$oTopic->getId()}" value="{$iItemId}" class="js-poll-item-option" /> {$aAnswer.text|escape:'html'}</label></li>
{/foreach}
</ul>
<button type="submit" onclick="ls.poll.vote({$oTopic->getId()},jQuery('#topic_answer_{$oTopic->getId()}_value').val());" class="button button-primary">{$aLang.topic_question_vote}</button>
<button type="submit" onclick="ls.poll.vote({$oTopic->getId()},-1)" class="button">{$aLang.topic_question_abstain}</button>
<input type="hidden" id="topic_answer_{$oTopic->getId()}_value" value="-1" />
<button type="submit" class="button button-primary js-poll-button-vote">{$aLang.topic_question_vote}</button>
<button type="submit" class="button js-poll-button-abstain">{$aLang.topic_question_abstain}</button>
{else}
{include file='topics/poll_result.tpl'}
{/if}