META-INF.resources.article.small_image.jsp Maven / Gradle / Ivy
<%--
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>
<%@ include file="/init.jsp" %>
<%
JournalArticle article = journalDisplayContext.getArticle();
boolean smallImage = BeanParamUtil.getBoolean(article, request, "smallImage");
boolean changeStructure = GetterUtil.getBoolean(request.getAttribute("edit_article.jsp-changeStructure"));
%>
<%
JournalFileUploadsConfiguration journalFileUploadsConfiguration = (JournalFileUploadsConfiguration)request.getAttribute(JournalFileUploadsConfiguration.class.getName());
%>
<%
String[] imageExtensions = journalFileUploadsConfiguration.imageExtensions();
%>
<%= HtmlUtil.escape(StringUtil.merge(imageExtensions, ", ")) %>.
<%
long imageMaxSize = journalFileUploadsConfiguration.smallImageMaxSize();
%>
" key="preview" />" class="img-responsive lfr-journal-small-image-preview" src="<%= HtmlUtil.escapeAttribute(article.getArticleImageURL(themeDisplay)) %>" />
var container = A.one('# smallImageContainer');
var types = container.all('.lfr-journal-small-image-type');
var values = container.all('.lfr-journal-small-image-value');
var selectSmallImageType = function(index) {
types.attr('checked', false);
types.item(index).attr('checked', true);
values.attr('disabled', true);
values.item(index).attr('disabled', false);
};
container.delegate(
'change',
function(event) {
var index = types.indexOf(event.currentTarget);
selectSmallImageType(index);
},
'.lfr-journal-small-image-type'
);
new A.Toggler(
{
animated: true,
content: '# smallImageContainer .lfr-journal-small-image-content',
expanded: <%= smallImage %>,
header: '# smallImageContainer .lfr-journal-small-image-header',
on: {
animatingChange: function(event) {
var instance = this;
var expanded = !instance.get('expanded');
A.one('# useSmallImage').attr('checked', expanded);
if (expanded) {
types.each(
function(item, index) {
if (item.get('checked')) {
values.item(index).attr('disabled', false);
}
}
);
}
else {
values.attr('disabled', true);
}
}
}
}
);
// LPS-51306
setTimeout(
function() {
selectSmallImageType('<%= ((article != null) && Validator.isNotNull(article.getSmallImageURL())) ? 0 : 1 %>');
},
0
);