|
@@ -1,5 +1,6 @@
|
|
import FessJQuery from 'jquery';
|
|
import FessJQuery from 'jquery';
|
|
import formTemplate from '!handlebars-loader!./templates/fess-form.hbs';
|
|
import formTemplate from '!handlebars-loader!./templates/fess-form.hbs';
|
|
|
|
+import formOnlyTemplate from '!handlebars-loader!./templates/fess-form-only.hbs';
|
|
import resultTemplate from '!handlebars-loader!./templates/fess-result.hbs';
|
|
import resultTemplate from '!handlebars-loader!./templates/fess-result.hbs';
|
|
import noResultTemplate from '!handlebars-loader!./templates/fess-no-result.hbs';
|
|
import noResultTemplate from '!handlebars-loader!./templates/fess-no-result.hbs';
|
|
|
|
|
|
@@ -31,7 +32,7 @@ export default class {
|
|
$fessFormWrapper.addClass('fessWrapper');
|
|
$fessFormWrapper.addClass('fessWrapper');
|
|
|
|
|
|
var $fessFormOnly = FessJQuery('<div/>');
|
|
var $fessFormOnly = FessJQuery('<div/>');
|
|
- $fessFormOnly.addClass('fessForm');
|
|
|
|
|
|
+ $fessFormOnly.addClass('fessFormOnly');
|
|
$fessFormWrapper.append($fessFormOnly);
|
|
$fessFormWrapper.append($fessFormOnly);
|
|
|
|
|
|
FessJQuery('fess\\:search-form-only').replaceWith($fessFormWrapper);
|
|
FessJQuery('fess\\:search-form-only').replaceWith($fessFormWrapper);
|
|
@@ -50,10 +51,18 @@ export default class {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- renderForm() {
|
|
|
|
|
|
+ renderForm(searchPagePath) {
|
|
var $fessForm = FessJQuery('.fessWrapper .fessForm');
|
|
var $fessForm = FessJQuery('.fessWrapper .fessForm');
|
|
- var html = formTemplate(this.css);
|
|
|
|
- $fessForm.html(this.FessMessages.render(html, {}));
|
|
|
|
|
|
+ var $fessFormOnly = FessJQuery('.fessWrapper .fessFormOnly');
|
|
|
|
+ if ($fessForm.length > 0) {
|
|
|
|
+ var html = formTemplate();
|
|
|
|
+ $fessForm.html(this.FessMessages.render(html, {}));
|
|
|
|
+ }
|
|
|
|
+ if ($fessFormOnly.length > 0) {
|
|
|
|
+ var html = formOnlyTemplate();
|
|
|
|
+ $fessFormOnly.html(this.FessMessages.render(html, {}));
|
|
|
|
+ FessJQuery('.fessWrapper .fessFormOnly form').attr('action', searchPagePath);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
renderResult(contextPath, response, params) {
|
|
renderResult(contextPath, response, params) {
|
|
@@ -63,7 +72,11 @@ export default class {
|
|
$fessResult.html(this.FessMessages.render(html, response));
|
|
$fessResult.html(this.FessMessages.render(html, response));
|
|
var $pagination = this._createPagination(response.record_count, response.page_size, response.page_number, params);
|
|
var $pagination = this._createPagination(response.record_count, response.page_size, response.page_number, params);
|
|
FessJQuery('.fessWrapper .paginationNav').append($pagination);
|
|
FessJQuery('.fessWrapper .paginationNav').append($pagination);
|
|
- FessJQuery('.fessWrapper select.sort').val(params.sort);
|
|
|
|
|
|
+ if (FessJQuery('.fessWrapper .fessForm').length > 0) {
|
|
|
|
+ FessJQuery('.fessWrapper select.sort').val(params.sort);
|
|
|
|
+ } else {
|
|
|
|
+ FessJQuery('.fessWrapper .fessResult table .order').css('display', 'none');
|
|
|
|
+ }
|
|
this._loadThumbnail(contextPath);
|
|
this._loadThumbnail(contextPath);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -84,7 +97,7 @@ export default class {
|
|
}
|
|
}
|
|
|
|
|
|
var paginationInfo = (function(){
|
|
var paginationInfo = (function(){
|
|
- var allPageNum = Math.floor(recordCount / pageSize) + 1;
|
|
|
|
|
|
+ var allPageNum = Math.floor((recordCount - 1) / pageSize) + 1;
|
|
var info = {};
|
|
var info = {};
|
|
info.current = currentPage;
|
|
info.current = currentPage;
|
|
info.min = (currentPage - 5) > 0 ? currentPage - 5 : 1;
|
|
info.min = (currentPage - 5) > 0 ? currentPage - 5 : 1;
|
|
@@ -139,27 +152,27 @@ export default class {
|
|
_loadThumbnail(contextPath) {
|
|
_loadThumbnail(contextPath) {
|
|
var $cls = this;
|
|
var $cls = this;
|
|
var loadImage = function(img, url, limit) {
|
|
var loadImage = function(img, url, limit) {
|
|
- var imgData = new Image();
|
|
|
|
- imgData.onload = function() {
|
|
|
|
- FessJQuery(img).css('background-image', '');
|
|
|
|
- FessJQuery(img).attr('src', url);
|
|
|
|
- };
|
|
|
|
- imgData.onerror = function() {
|
|
|
|
- if (limit > 0) {
|
|
|
|
- setTimeout(function() {
|
|
|
|
- loadImage(img, url, --limit);
|
|
|
|
- }, $cls.IMG_LOADING_DELAY);
|
|
|
|
- } else {
|
|
|
|
- FessJQuery(img).attr('src', contextPath + "/images/noimage.png");
|
|
|
|
- }
|
|
|
|
- imgData = null;
|
|
|
|
- };
|
|
|
|
- imgData.src = url;
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- FessJQuery('img.thumbnail').each(function() {
|
|
|
|
- FessJQuery(this).css('background-image', 'url("' + contextPath + '/images/loading.gif")');
|
|
|
|
- loadImage(this, FessJQuery(this).attr('data-src'), $cls.IMG_LOADING_MAX);
|
|
|
|
- });
|
|
|
|
|
|
+ var imgData = new Image();
|
|
|
|
+ imgData.onload = function() {
|
|
|
|
+ FessJQuery(img).css('background-image', '');
|
|
|
|
+ FessJQuery(img).attr('src', url);
|
|
|
|
+ };
|
|
|
|
+ imgData.onerror = function() {
|
|
|
|
+ if (limit > 0) {
|
|
|
|
+ setTimeout(function() {
|
|
|
|
+ loadImage(img, url, --limit);
|
|
|
|
+ }, $cls.IMG_LOADING_DELAY);
|
|
|
|
+ } else {
|
|
|
|
+ FessJQuery(img).parent().css('display', 'none');
|
|
|
|
+ }
|
|
|
|
+ imgData = null;
|
|
|
|
+ };
|
|
|
|
+ imgData.src = url;
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ FessJQuery('.fessWrapper .fessResult img.thumbnail').each(function() {
|
|
|
|
+ FessJQuery(this).css('background-image', 'url("' + contextPath + '/images/loading.gif")');
|
|
|
|
+ loadImage(this, FessJQuery(this).attr('data-src'), $cls.IMG_LOADING_MAX);
|
|
|
|
+ });
|
|
}
|
|
}
|
|
}
|
|
}
|