mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-30 21:45:01 +03:00
Мелкие доработки и исправления
This commit is contained in:
parent
40abb7aa97
commit
1dd4c315dd
|
@ -79,10 +79,10 @@ ls.favourite = (function ($) {
|
|||
if ( ! this.options.type[data.type] ) return false;
|
||||
|
||||
var params = {
|
||||
type: ! data.toggle.hasClass(ls.options.classes.states.active),
|
||||
type: ! data.element.hasClass(ls.options.classes.states.active),
|
||||
id: data.targetId
|
||||
};
|
||||
|
||||
|
||||
ls.hook.marker('toggleBefore');
|
||||
|
||||
ls.ajax.load(this.options.type[data.type].url, params, function(result) {
|
||||
|
@ -91,13 +91,13 @@ ls.favourite = (function ($) {
|
|||
} else {
|
||||
ls.msg.notice(null, result.sMsg);
|
||||
|
||||
data.toggle.removeClass(ls.options.classes.states.active);
|
||||
data.element.removeClass(ls.options.classes.states.active);
|
||||
|
||||
if (result.bState) {
|
||||
data.toggle.addClass(ls.options.classes.states.active).attr('title', ls.lang.get('favourite.remove'));
|
||||
data.element.addClass(ls.options.classes.states.active).attr('title', ls.lang.get('favourite.remove'));
|
||||
ls.tags && ls.tags.showPersonalTags(data.type, data.targetId);
|
||||
} else {
|
||||
data.toggle.attr('title', ls.lang.get('favourite.add'));
|
||||
data.element.attr('title', ls.lang.get('favourite.add'));
|
||||
ls.tags && ls.tags.hidePersonalTags(data.type, data.targetId);
|
||||
}
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ ls.media = (function ($) {
|
|||
}.bind(this));
|
||||
|
||||
// Инициализация фоторамы при предпросмотре
|
||||
ls.hook.inject([ls.utilities,'textPreview'], function() {
|
||||
ls.hook.inject([ls.utils,'textPreview'], function() {
|
||||
$('.fotorama').fotorama();
|
||||
},'textPreviewDisplayAfter');
|
||||
|
||||
|
|
|
@ -11,14 +11,29 @@
|
|||
var ls = ls || {};
|
||||
|
||||
ls.user = (function ($) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Дефолтные опции
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
var _defaults = {
|
||||
urls: {
|
||||
follow: aRouter['stream'] + 'ajaxadduser/',
|
||||
unfollow: aRouter['stream'] + 'ajaxremoveuser/'
|
||||
}
|
||||
};
|
||||
|
||||
this.jcropImage = null;
|
||||
|
||||
/**
|
||||
* Инициализация
|
||||
*/
|
||||
this.init = function() {
|
||||
var self = this;
|
||||
this.init = function(options) {
|
||||
var _this = this;
|
||||
|
||||
this.options = $.extend({}, _defaults, options);
|
||||
|
||||
/* Авторизация */
|
||||
ls.ajax.form(aRouter.login + 'ajax-login', '.js-form-login', function (result, status, xhr, form) {
|
||||
|
@ -68,17 +83,9 @@ ls.user = (function ($) {
|
|||
var oElement = $(this);
|
||||
|
||||
if (oElement.hasClass(ls.options.classes.states.active)) {
|
||||
// Удаляем
|
||||
ls.user_list_add.remove('activity', null, oElement.data('user-id'), function (oResponse, iUserId) {
|
||||
oElement.removeClass(ls.options.classes.states.active).text(ls.lang.get('profile_user_follow'));
|
||||
});
|
||||
_this.unfollow(oElement, oElement.data('user-id'));
|
||||
} else {
|
||||
// Добавляем
|
||||
ls.user_list_add.add('activity', null, oElement.data('user-id'), {
|
||||
add_success: function (oResponse) {
|
||||
oElement.addClass(ls.options.classes.states.active).text(ls.lang.get('profile_user_unfollow'));
|
||||
}
|
||||
});
|
||||
_this.follow(oElement, oElement.data('user-login'));
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
@ -108,16 +115,16 @@ ls.user = (function ($) {
|
|||
|
||||
// Загрузка фотографии в профиль
|
||||
$('.js-ajax-user-photo-upload').on('change', function () {
|
||||
self.uploadProfilePhoto($(this));
|
||||
_this.uploadProfilePhoto($(this));
|
||||
});
|
||||
// Удаление фотографии профиля
|
||||
$('.js-ajax-user-photo-upload-remove').on('click', function () {
|
||||
self.removeProfilePhoto($(this).data('userId'));
|
||||
_this.removeProfilePhoto($(this).data('userId'));
|
||||
return false;
|
||||
});
|
||||
// Изменения аватара
|
||||
$('.js-ajax-user-avatar-change').on('click', function () {
|
||||
self.changeProfileAvatar($(this).data('userId'));
|
||||
_this.changeProfileAvatar($(this).data('userId'));
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
@ -182,81 +189,32 @@ ls.user = (function ($) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Поиск пользователей по началу логина
|
||||
* Подписка на пользователя
|
||||
*/
|
||||
this.searchUsersByPrefix = function(sPrefix,obj) {
|
||||
obj=$(obj);
|
||||
var url = aRouter['people']+'ajax-search/';
|
||||
var params = {user_login: sPrefix, isPrefix: 1};
|
||||
$('#search-user-login').addClass('loader');
|
||||
|
||||
ls.hook.marker('searchUsersByPrefixBefore');
|
||||
ls.ajax.load(url, params, function(result){
|
||||
$('#search-user-login').removeClass('loader');
|
||||
$('#user-prefix-filter').find('.active').removeClass('active');
|
||||
obj.parent().addClass('active');
|
||||
if (result.bStateError) {
|
||||
$('#users-list-search').hide();
|
||||
$('#users-list-original').show();
|
||||
} else {
|
||||
$('#users-list-original').hide();
|
||||
$('#users-list-search').html(result.sText).show();
|
||||
ls.hook.run('ls_user_search_users_by_prefix_after',[sPrefix, obj, result]);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
this.follow = function(oElement, sUserLogin) {
|
||||
ls.ajax.load(this.options.urls.follow, { aUserList: [ sUserLogin ] }, function(oResponse) {
|
||||
oElement.addClass(ls.options.classes.states.active).text( ls.lang.get('profile_user_unfollow') );
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
/**
|
||||
* Подписка
|
||||
* Отписаться от пользователя
|
||||
*/
|
||||
this.followToggle = function(obj, iUserId) {
|
||||
if ($(obj).hasClass('followed')) {
|
||||
ls.stream.unsubscribe(iUserId);
|
||||
$(obj).toggleClass('followed').text(ls.lang.get('profile_user_follow'));
|
||||
} else {
|
||||
ls.stream.subscribe(iUserId);
|
||||
$(obj).toggleClass('followed').text(ls.lang.get('profile_user_unfollow'));
|
||||
}
|
||||
return false;
|
||||
this.unfollow = function(oElement, iUserId) {
|
||||
ls.ajax.load(this.options.urls.unfollow, { iUserId: iUserId }, function(oResponse) {
|
||||
oElement.removeClass(ls.options.classes.states.active).text( ls.lang.get('profile_user_follow') );
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
/**
|
||||
* Поиск пользователей
|
||||
* Добавляет жалобу
|
||||
*/
|
||||
this.searchUsers = function(sFormSelector) {
|
||||
var url = aRouter['people']+'ajax-search/',
|
||||
oInputSearch = $(sFormSelector).find('input'),
|
||||
oOriginalContainer = $('#users-list-original'),
|
||||
oSearchContainer = $('#users-list-search');
|
||||
|
||||
oInputSearch.addClass(ls.options.classes.states.loading);
|
||||
|
||||
ls.hook.marker('searchUsersBefore');
|
||||
|
||||
ls.ajax.submit(url, sFormSelector, function(result) {
|
||||
oInputSearch.removeClass(ls.options.classes.states.loading);
|
||||
|
||||
if (result.bShowOriginal) {
|
||||
oSearchContainer.hide();
|
||||
oOriginalContainer.show();
|
||||
} else {
|
||||
oOriginalContainer.hide();
|
||||
oSearchContainer.html(result.sText).show();
|
||||
|
||||
ls.hook.run('ls_user_search_users_after', [sFormSelector, result]);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
this.addComplaint = function(form) {
|
||||
ls.ajax.submit(aRouter.profile+'ajax-complaint-add/', form, function(result){
|
||||
this.addComplaint = function(oForm) {
|
||||
ls.ajax.submit(aRouter.profile + 'ajax-complaint-add/', oForm, function(result) {
|
||||
$('#modal-complaint-user').modal('hide');
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
this.uploadProfilePhoto = function(input) {
|
||||
var form = $('<form method="post" enctype="multipart/form-data"></form>').hide().appendTo('body');
|
||||
input.clone(true).insertAfter(input);
|
||||
|
@ -293,7 +251,7 @@ ls.user = (function ($) {
|
|||
};
|
||||
|
||||
this.changeProfileAvatar = function(idUser) {
|
||||
var self = this;
|
||||
var _this = this;
|
||||
ls.modal.load(aRouter.ajax+'modal/image-crop/', {image_src: $('.js-ajax-user-photo-image').attr('src') }, {
|
||||
aftershow: function() {
|
||||
this.jcropImage && this.jcropImage.destroy();
|
||||
|
@ -304,7 +262,7 @@ ls.user = (function ($) {
|
|||
});
|
||||
|
||||
$('.js-image-crop').Jcrop({ minSize: [32, 32], aspectRatio: 1 }, function () {
|
||||
self.jcropImage = this;
|
||||
_this.jcropImage = this;
|
||||
var w=$('.js-image-crop').innerWidth();
|
||||
var h=$('.js-image-crop').innerHeight();
|
||||
|
||||
|
@ -318,7 +276,7 @@ ls.user = (function ($) {
|
|||
$('.js-ajax-image-crop-submit').on('click',function() {
|
||||
var params={
|
||||
user_id: idUser,
|
||||
size: self.jcropImage.tellSelect(),
|
||||
size: _this.jcropImage.tellSelect(),
|
||||
canvas_width: $('.js-image-crop').innerWidth()
|
||||
}
|
||||
ls.ajax.load(aRouter.settings+'ajax-change-avatar/', params, function(result) {
|
||||
|
@ -336,4 +294,4 @@ ls.user = (function ($) {
|
|||
};
|
||||
|
||||
return this;
|
||||
}).call(ls.user || {},jQuery);
|
||||
}).call(ls.user || {}, jQuery);
|
||||
|
|
|
@ -1,174 +1,157 @@
|
|||
/**
|
||||
* Заметки
|
||||
*
|
||||
*
|
||||
* @module ls/usernote
|
||||
*
|
||||
*
|
||||
* @license GNU General Public License, version 2
|
||||
* @copyright 2013 OOO "ЛС-СОФТ" {@link http://livestreetcms.com}
|
||||
* @author Denis Shakhov <denis.shakhov@gmail.com>
|
||||
*/
|
||||
|
||||
var ls = ls || {};
|
||||
|
||||
ls.usernote = (function($) {
|
||||
(function($) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Дефолтные опции
|
||||
*/
|
||||
var defaults = {
|
||||
// Роутеры
|
||||
routers: {
|
||||
save: aRouter['profile'] + 'ajax-note-save/',
|
||||
remove: aRouter['profile'] + 'ajax-note-remove/'
|
||||
$.widget( "livestreet.usernote", {
|
||||
/**
|
||||
* Дефолтные опции
|
||||
*/
|
||||
options: {
|
||||
// Ссылки
|
||||
urls: {
|
||||
save: aRouter['profile'] + 'ajax-note-save/',
|
||||
remove: aRouter['profile'] + 'ajax-note-remove/'
|
||||
},
|
||||
|
||||
// Селекторы
|
||||
selectors: {
|
||||
body: '.js-user-note-body',
|
||||
text: '.js-user-note-text',
|
||||
add: '.js-user-note-add',
|
||||
actions: '.js-user-note-actions',
|
||||
actions_edit: '.js-user-note-actions-edit',
|
||||
actions_remove: '.js-user-note-actions-remove',
|
||||
|
||||
form: '.js-user-note-form',
|
||||
form_text: '.js-user-note-form-text',
|
||||
form_save: '.js-user-note-form-save',
|
||||
form_cancel: '.js-user-note-form-cancel'
|
||||
}
|
||||
},
|
||||
|
||||
// Селекторы
|
||||
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',
|
||||
/**
|
||||
* Конструктор
|
||||
*
|
||||
* @constructor
|
||||
* @private
|
||||
*/
|
||||
_create: function () {
|
||||
var _this = this;
|
||||
|
||||
noteEdit: '.js-user-note-edit',
|
||||
noteEditText: '.js-user-note-edit-text',
|
||||
noteEditSaveButton: '.js-user-note-edit-save',
|
||||
noteEditCancelButton: '.js-user-note-edit-cancel'
|
||||
}
|
||||
};
|
||||
this.options = $.extend({}, this.options, ls.utils.getDataOptions(this.element, this.widgetName));
|
||||
|
||||
/**
|
||||
* Инициализация
|
||||
*
|
||||
* @param {Object} options Опции
|
||||
*/
|
||||
this.init = function(options) {
|
||||
var self = this;
|
||||
// Получаем аякс параметры
|
||||
this.params = ls.utils.getDataOptions(this.element, 'param');
|
||||
|
||||
this.options = $.extend({}, defaults, options);
|
||||
// Получаем элементы
|
||||
this.elements = {};
|
||||
this.elements.container = this.element;
|
||||
|
||||
// Добавление
|
||||
$(this.options.selectors.note).each(function () {
|
||||
var oNote = $(this);
|
||||
this.elements.body = this.elements.container.find(this.options.selectors.body);
|
||||
this.elements.text = this.elements.body.find(this.options.selectors.text);
|
||||
this.elements.add = this.elements.body.find(this.options.selectors.add);
|
||||
this.elements.actions = this.elements.body.find(this.options.selectors.actions);
|
||||
this.elements.actions_edit = this.elements.actions.find(this.options.selectors.actions_edit);
|
||||
this.elements.actions_remove = this.elements.actions.find(this.options.selectors.actions_remove);
|
||||
|
||||
var oVars = {
|
||||
oNote: oNote,
|
||||
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')
|
||||
this.elements.form = this.elements.container.find(this.options.selectors.form);
|
||||
this.elements.form_text = this.elements.form.find(this.options.selectors.form_text);
|
||||
this.elements.form_save = this.elements.form.find(this.options.selectors.form_save);
|
||||
this.elements.form_cancel = this.elements.form.find(this.options.selectors.form_cancel);
|
||||
|
||||
// Добавление
|
||||
this.elements.add.on('click', function (e) {
|
||||
_this.showForm();
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
// Редактирование
|
||||
this.elements.actions_edit.on('click', function (e) {
|
||||
_this.showForm();
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
// Отмена редактирования
|
||||
this.elements.form_cancel.on('click', this.hideForm.bind(this));
|
||||
|
||||
// Удаление
|
||||
this.elements.actions_remove.on('click', function (e) {
|
||||
_this.remove();
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
// Сохранение
|
||||
this.elements.form.on('submit', function (e) {
|
||||
_this.save();
|
||||
e.preventDefault();
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Показывает форму редактирования
|
||||
*/
|
||||
showForm: function() {
|
||||
this.elements.body.hide();
|
||||
this.elements.form.show();
|
||||
this.elements.form_text.val( $.trim(this.elements.text.html()) ).select();
|
||||
},
|
||||
|
||||
/**
|
||||
* Скрывает форму редактирования
|
||||
*/
|
||||
hideForm: function() {
|
||||
this.elements.body.show();
|
||||
this.elements.form.hide();
|
||||
},
|
||||
|
||||
/**
|
||||
* Сохраняет заметку
|
||||
*/
|
||||
save: function() {
|
||||
var oParams = {
|
||||
text: this.elements.form_text.val()
|
||||
};
|
||||
|
||||
// Показывает форму добавления
|
||||
oVars.oNote.find(self.options.selectors.noteAddButton).on('click', function (e) {
|
||||
self.showForm(oVars);
|
||||
e.preventDefault();
|
||||
}.bind(self));
|
||||
oParams = $.extend({}, oParams, this.params);
|
||||
|
||||
// Отмена
|
||||
oVars.oNote.find(self.options.selectors.noteEditCancelButton).on('click', function (e) {
|
||||
self.hideForm(oVars);
|
||||
});
|
||||
ls.utils.formLock(this.elements.form);
|
||||
|
||||
// Сохранение заметки
|
||||
oVars.oNote.find(self.options.selectors.noteEditSaveButton).on('click', function (e) {
|
||||
self.save(oVars);
|
||||
});
|
||||
ls.ajax.load(this.options.urls.save, oParams, function (oResponse) {
|
||||
ls.utils.formUnlock(this.elements.form);
|
||||
|
||||
// Удаление заметки
|
||||
oVars.oNote.find(self.options.selectors.noteRemoveButton).on('click', function (e) {
|
||||
self.remove(oVars);
|
||||
e.preventDefault();
|
||||
});
|
||||
if (oResponse.bStateError) {
|
||||
ls.msg.error(null, oResponse.sMsg);
|
||||
} else {
|
||||
this.elements.text.html(oResponse.sText).show();
|
||||
this.elements.add.hide();
|
||||
this.elements.actions.show();
|
||||
this.hideForm();
|
||||
}
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
// Редактирование заметки
|
||||
oVars.oNote.find(self.options.selectors.noteEditButton).on('click', function (e) {
|
||||
self.showForm(oVars);
|
||||
oVars.oNoteEditText.val( $.trim(oVars.oNoteText.html()) );
|
||||
e.preventDefault();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Показывает форму редактирования
|
||||
*
|
||||
* @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.load(this.options.routers.save, params, function (result) {
|
||||
if (result.bStateError) {
|
||||
ls.msg.error(null, result.sMsg);
|
||||
} else {
|
||||
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));
|
||||
};
|
||||
|
||||
/**
|
||||
* Удаление заметки
|
||||
*
|
||||
* @param {Object} oVars Общие переменные
|
||||
*/
|
||||
this.remove = function(oVars) {
|
||||
var params = {
|
||||
iUserId: oVars.iUserId
|
||||
};
|
||||
|
||||
ls.hook.marker('removeBefore');
|
||||
|
||||
ls.ajax.load(this.options.routers.remove, params, function (result) {
|
||||
if (result.bStateError) {
|
||||
ls.msg.error(null, result.sMsg);
|
||||
} else {
|
||||
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 this;
|
||||
}).call(ls.usernote || {},jQuery);
|
||||
/**
|
||||
* Удаление заметки
|
||||
*/
|
||||
remove: function() {
|
||||
ls.ajax.load(this.options.urls.remove, this.params, function (oResponse) {
|
||||
if (oResponse.bStateError) {
|
||||
ls.msg.error(null, oResponse.sMsg);
|
||||
} else {
|
||||
this.elements.text.empty().hide();
|
||||
this.elements.add.show();
|
||||
this.elements.actions.hide();
|
||||
}
|
||||
}.bind(this));
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
|
@ -1,35 +1,64 @@
|
|||
{**
|
||||
* Уведомления
|
||||
*
|
||||
* @param string $sAlertTitle Заголовок
|
||||
* @param string $sAlertStyle Стиль уведомления (error, info и т.д.), по умолчанию - success
|
||||
* @param string $sAlertAttributes Дополнительные атрибуты основного блока
|
||||
* @param string $sAlertClasses Дополнительные классы
|
||||
* @param boolean $bAlertVisible Показывать или нет уведомление, по умолчанию - true
|
||||
* @param boolean $bAlertClose Показывать или нет кнопку закрытия, по умолчанию - false
|
||||
* @param mixed $mAlerts Массив либо строка с текстом уведомления
|
||||
* @param string $sAlertTitle Заголовок
|
||||
* @param mixed $mAlerts Массив либо строка с текстом уведомления
|
||||
* @param string $sAlertMods (success) Модификаторы (error, info и т.д.)
|
||||
* @param string $sAlertAttributes Дополнительные атрибуты основного блока
|
||||
* @param string $sAlertClasses Дополнительные классы
|
||||
* @param bool $bAlertVisible (true) Показывать или нет уведомление
|
||||
* @param bool $bAlertClose (true) Показывать или нет кнопку закрытия
|
||||
*
|
||||
* @styles <framework>/css/alerts.css
|
||||
*}
|
||||
|
||||
<div class="alert alert-{if $sAlertStyle}{$sAlertStyle}{else}success{/if} js-alert {$sAlertClasses}"
|
||||
{if isset($bAlertVisible) && $bAlertVisible == false}style="display: none"{/if}
|
||||
{$sAlertAttributes}>
|
||||
{* Название компонента *}
|
||||
{$_sComponentName = 'alert'}
|
||||
|
||||
{* Дефолтный модификатор *}
|
||||
{$_sComponentDefaultMod = 'success'}
|
||||
|
||||
{* Строка которой разделяются имя компонента и модификатор *}
|
||||
{$_sModifierDelimiter = '--'}
|
||||
|
||||
{* Временный костыль *}
|
||||
{$sAlertMods = $sAlertStyle}
|
||||
|
||||
{* Формируем модификаторы *}
|
||||
{$aMods = " "|explode:($sAlertMods|default:$_sComponentDefaultMod|strip)}
|
||||
|
||||
{foreach $aMods as $sMod}
|
||||
{if $sMod}
|
||||
{$sResultMods = "$sResultMods $_sComponentName$_sModifierDelimiter$sMod"}
|
||||
{/if}
|
||||
{/foreach}
|
||||
|
||||
|
||||
{* Уведомление *}
|
||||
<div class="{$_sComponentName} {$sResultMods} {$sAlertClasses} js-{$_sComponentName}" {if ! $bAlertVisible|default:true}style="display: none"{/if} {$sAlertAttributes}>
|
||||
{* Заголовок *}
|
||||
{if $sAlertTitle}
|
||||
<h4 class="alert--title">{$sAlertTitle}</h4>
|
||||
<h4 class="{$_sComponentName}-title">{$sAlertTitle}</h4>
|
||||
{/if}
|
||||
|
||||
{* Кнопка закрытия *}
|
||||
{if $bAlertClose}
|
||||
<div class="alert--close" data-type="alert-close">×</div>
|
||||
<div class="{$_sComponentName}-close" data-type="alert-close">×</div>
|
||||
{/if}
|
||||
|
||||
<div class="alert--body">
|
||||
{* Контент *}
|
||||
<div class="{$_sComponentName}-body">
|
||||
{block name='alert_body'}
|
||||
{if is_array($mAlerts)}
|
||||
<ul class="alert--list">
|
||||
<ul class="{$_sComponentName}-list">
|
||||
{foreach $mAlerts as $aAlert}
|
||||
<li class="alert--list--item">{if $aAlert.title}<strong>{$aAlert.title}</strong>:{/if} {$aAlert.msg}</li>
|
||||
<li class="{$_sComponentName}-list-item">
|
||||
{if $aAlert.title}
|
||||
<strong>{$aAlert.title}</strong>:
|
||||
{/if}
|
||||
|
||||
{$aAlert.msg}
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{else}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* Общие стили
|
||||
*
|
||||
*
|
||||
* @license GNU General Public License, version 2
|
||||
* @copyright 2013 OOO "ЛС-СОФТ" {@link http://livestreetcms.com}
|
||||
* @author Denis Shakhov <denis.shakhov@gmail.com>
|
||||
|
@ -13,22 +13,24 @@
|
|||
* @template favourite.tpl
|
||||
*/
|
||||
.favourite { cursor: pointer; display: inline-block; }
|
||||
.favourite-toggle {
|
||||
display: inline-block;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
vertical-align: text-top;
|
||||
background: url(../images/icons.png) -96px 0 no-repeat;
|
||||
opacity: .3;
|
||||
.favourite:hover { opacity: .8; filter: alpha(opacity=80); }
|
||||
|
||||
.favourite-toggle {
|
||||
display: inline-block;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
vertical-align: text-top;
|
||||
background: url(../images/icons.png) -96px 0 no-repeat;
|
||||
opacity: .3;
|
||||
filter: alpha(opacity=30);
|
||||
}
|
||||
.favourite-toggle.active { opacity: 1; filter: alpha(opacity=100); }
|
||||
.favourite:hover { opacity: .8; filter: alpha(opacity=80); }
|
||||
.favourite.active .favourite-toggle { opacity: 1; filter: alpha(opacity=100); }
|
||||
|
||||
.favourite-count { margin-left: 0; font-weight: bold; }
|
||||
|
||||
|
||||
/**
|
||||
* Пагинация
|
||||
* Пагинация
|
||||
*
|
||||
* @template pagination.tpl
|
||||
* @template comments/comment_pagination.tpl
|
||||
|
@ -47,14 +49,11 @@
|
|||
|
||||
|
||||
/**
|
||||
* Экшнбар
|
||||
* Экшнбар
|
||||
*/
|
||||
.actionbar { background: #fafafa; border: 1px solid #eee; margin-bottom: 2px; }
|
||||
.actionbar-item { float: left; white-space: nowrap; }
|
||||
.actionbar-item-link { float: left; padding: 10px 15px; color: #333; }
|
||||
.actionbar-item-link:hover { text-decoration: none; background: #eee; color: #000; }
|
||||
.actionbar-item-link.link-dotted { border-color: #f00; }
|
||||
.actionbar-item-link.link-dotted:hover { border-color: #06e; color: #06e; text-decoration: none; }
|
||||
.actionbar { background: #fafafa; padding: 10px 10px 0; margin-bottom: 10px; }
|
||||
.actionbar-item { float: left; white-space: nowrap; margin-right: 10px; }
|
||||
.actionbar-item-link { margin-bottom: 10px; }
|
||||
|
||||
|
||||
/**
|
||||
|
@ -69,7 +68,7 @@
|
|||
|
||||
|
||||
/**
|
||||
* Item List
|
||||
* Item List
|
||||
*/
|
||||
.item-list { }
|
||||
.item-list li { min-height: 51px; padding: 17px 15px 20px 80px; border-top: 1px solid #eee; position: relative; zoom: 1; background: #fff; }
|
||||
|
@ -109,8 +108,8 @@
|
|||
|
||||
|
||||
/**
|
||||
* Список пользователей
|
||||
*
|
||||
* Список пользователей
|
||||
*
|
||||
* @template user_list_avatar.tpl
|
||||
*/
|
||||
.user-list-avatar { overflow: hidden; zoom: 1; }
|
||||
|
@ -128,6 +127,7 @@
|
|||
.user-list-small-item { background: #fafafa; padding: 10px 55px 10px 10px; margin-bottom: 1px; position: relative; }
|
||||
.user-list-small-item:last-child { margin-bottom: 0; }
|
||||
.user-list-small-item input { vertical-align: middle; }
|
||||
.user-list-small-item.selected { background: #ffc; }
|
||||
|
||||
.user-list-small-item-actions { position: absolute; top: 50%; right: 13px; margin-top: -8px; }
|
||||
.user-list-small-item-actions li { cursor: pointer; opacity: .7; }
|
||||
|
@ -203,7 +203,7 @@
|
|||
|
||||
|
||||
/**
|
||||
* Облако тегов
|
||||
* Облако тегов
|
||||
*/
|
||||
.tag-cloud { width: 100%; }
|
||||
|
||||
|
@ -226,10 +226,12 @@
|
|||
/**
|
||||
* Заметка
|
||||
*/
|
||||
.user-note { background: #F1F7AF; padding: 20px; margin-bottom: 15px; }
|
||||
.user-note:last-child { margin-bottom: 0; }
|
||||
.user-note-actions { margin: 10px 0 0 0; overflow: hidden; }
|
||||
.user-note-actions li { float: left; margin-right: 15px; }
|
||||
.user-note { background: #F1F7AF; padding: 20px; margin-bottom: 15px; }
|
||||
.user-note:last-child { margin-bottom: 0; }
|
||||
.user-note-actions { margin: 10px 0 0 0; overflow: hidden; }
|
||||
.user-note-actions li { float: left; margin-right: 15px; }
|
||||
.user-note-form .form-field { margin-bottom: 15px; }
|
||||
.user-note-form-text { height: 5em; }
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,20 +3,34 @@
|
|||
*
|
||||
* @param object $oFavouriteObject Объект сущности
|
||||
* @param string $sFavouriteType Название сущности (blog, topic и т.д.)
|
||||
* @param string $oUserCurrent Текущий залогиненый пользователь
|
||||
* @param string $sFavouriteClasses
|
||||
* @param string $sFavouriteAttributes
|
||||
* @param string $oUserCurrent Текущий залогиненый пользователь
|
||||
*
|
||||
* @styles assets/css/common.css
|
||||
* @scripts <common>/js/favourite.js
|
||||
*}
|
||||
|
||||
{$bFavouriteIsActive = $oFavouriteObject->getIsFavourite()}
|
||||
{$iFavouriteCount = $oFavouriteObject->getCountFavourite()}
|
||||
{* Название компонента *}
|
||||
{$_sComponentName = 'favourite'}
|
||||
|
||||
<div class="favourite js-favourite" data-favourite-type="{$sFavouriteType}" data-favourite-id="{$oFavouriteObject->getId()}">
|
||||
<div class="favourite-toggle {if $oUserCurrent && $bFavouriteIsActive}active{/if} js-favourite-toggle"
|
||||
title="{if $bFavouriteIsActive}{$aLang.favourite.remove}{else}{$aLang.favourite.add}{/if}"></div>
|
||||
{* True если объект находится в избранном *}
|
||||
{$bIsActive = $oUserCurrent && $oFavouriteObject->getIsFavourite()}
|
||||
|
||||
{if isset($iFavouriteCount)}
|
||||
<span class="favourite-count js-favourite-count" {if $iFavouriteCount == 0}style="display: none;"{/if}>{$iFavouriteCount}</span>
|
||||
{* Кол-во объектов в избранном *}
|
||||
{$iCount = $oFavouriteObject->getCountFavourite()}
|
||||
|
||||
<div class="{$_sComponentName} js-{$_sComponentName} {if $bIsActive}active{/if} {$sFavouriteClasses}"
|
||||
data-favourite-type="{$sFavouriteType}"
|
||||
data-favourite-id="{$oFavouriteObject->getId()}"
|
||||
{$sFavouriteAttributes}>
|
||||
|
||||
{* Кнопка добавления/удаления из избранного *}
|
||||
<div class="{$_sComponentName}-toggle js-{$_sComponentName}-toggle"
|
||||
title="{($bIsActive) ? $aLang.$_sComponentName.remove : $aLang.$_sComponentName.add}"></div>
|
||||
|
||||
{* Кол-во объектов в избранном *}
|
||||
{if isset($iCount)}
|
||||
<span class="{$_sComponentName}-count js-{$_sComponentName}-count" {if ! $iCount}style="display: none;"{/if}>{$iCount}</span>
|
||||
{/if}
|
||||
</div>
|
|
@ -3,39 +3,48 @@
|
|||
*
|
||||
* @param object $oUserNote Заметка
|
||||
* @param integer $iUserNoteId ID сущности
|
||||
* @param boolean $bUserNoteEditable Можно редактировать заметку или нет
|
||||
* @param string $sUserNoteClasses Дополнительные классы
|
||||
* @param boolean $bUserNoteEditable Можно редактировать заметку или нет
|
||||
* @param string $sUserNoteClasses Дополнительные классы
|
||||
*
|
||||
* @styles <common>/css/common.css
|
||||
* @styles assets/css/common.css
|
||||
* @scripts <common>/js/usernote.js
|
||||
*}
|
||||
|
||||
{* Название компонента *}
|
||||
{$_sComponentName = 'user-note'}
|
||||
|
||||
{* Установка дефолтных значений *}
|
||||
{$bUserNoteEditable = $bUserNoteEditable|default:true}
|
||||
|
||||
<div class="user-note js-user-note {$sUserNoteClasses}" data-user-id="{$iUserNoteId}">
|
||||
<div class="user-note-content js-user-note-content">
|
||||
<p class="user-note-text js-user-note-text" {if ! $oUserNote}style="display: none"{/if}>
|
||||
<div class="{$_sComponentName} js-{$_sComponentName} {$sUserNoteClasses}" data-param-i-user-id="{$iUserNoteId}" {$sUserNoteAttributes}>
|
||||
{* Заметка *}
|
||||
<div class="{$_sComponentName}-body js-{$_sComponentName}-body">
|
||||
{* Текст *}
|
||||
<p class="{$_sComponentName}-text js-{$_sComponentName}-text" {if ! $oUserNote}style="display: none"{/if}>
|
||||
{if $oUserNote}
|
||||
{$oUserNote->getText()}
|
||||
{/if}
|
||||
</p>
|
||||
|
||||
|
||||
{* Действия *}
|
||||
{if $bUserNoteEditable}
|
||||
<ul class="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.common.edit}</a></li>
|
||||
<li><a href="#" class="link-dotted js-user-note-remove-button">{$aLang.common.remove}</a></li>
|
||||
<ul class="{$_sComponentName}-actions js-{$_sComponentName}-actions" {if ! $oUserNote}style="display: none;"{/if}>
|
||||
<li><a href="#" class="link-dotted js-{$_sComponentName}-actions-edit">{$aLang.common.edit}</a></li>
|
||||
<li><a href="#" class="link-dotted js-{$_sComponentName}-actions-remove">{$aLang.common.remove}</a></li>
|
||||
</ul>
|
||||
|
||||
<a href="#" class="link-dotted js-user-note-add-button" {if $oUserNote}style="display:none;"{/if}>{$aLang.user_note.add}</a>
|
||||
{* Добавить *}
|
||||
<a href="#" class="link-dotted {$_sComponentName}-add js-{$_sComponentName}-add" {if $oUserNote}style="display:none;"{/if}>{$aLang.user_note.add}</a>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{* Форма редактирования *}
|
||||
{if $bUserNoteEditable}
|
||||
<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>
|
||||
<form class="{$_sComponentName}-form js-{$_sComponentName}-form" style="display: none;">
|
||||
{include 'forms/fields/form.field.textarea.tpl' sFieldClasses="width-full $_sComponentName-form-text js-$_sComponentName-form-text"}
|
||||
|
||||
<button type="submit" class="button button-primary js-user-note-edit-save">{$aLang.common.save}</button>
|
||||
<button type="submit" class="button js-user-note-edit-cancel">{$aLang.common.cancel}</button>
|
||||
</div>
|
||||
{include 'forms/fields/form.field.button.tpl' sFieldStyle='primary' sFieldClasses="js-$_sComponentName-form-save" sFieldText=$aLang.common.save}
|
||||
{include 'forms/fields/form.field.button.tpl' sFieldType='button' sFieldClasses="js-$_sComponentName-form-cancel" sFieldText=$aLang.common.cancel}
|
||||
</form>
|
||||
{/if}
|
||||
</div>
|
Loading…
Reference in a new issue