NIHVIVO-2040 Added data-page attribute on pagination links and removed pageX class since they're no longer needed. This makes it easier to reliably handle multiple digit page numbers without jumping through hoops. Can't rely on .text() do to the "more..." pattern.
This commit is contained in:
parent
79ac60c8e8
commit
82f24c5966
3 changed files with 36 additions and 39 deletions
|
@ -50,7 +50,7 @@ public class BrowseController extends FreemarkerHttpServlet {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getTitle(String siteName, VitroRequest vreq) {
|
protected String getTitle(String siteName, VitroRequest vreq) {
|
||||||
return "Index to " + siteName + " Contents";
|
return "Index of Contents";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -60,34 +60,29 @@ public class BrowseController extends FreemarkerHttpServlet {
|
||||||
String message = null;
|
String message = null;
|
||||||
String templateName = TEMPLATE_DEFAULT;
|
String templateName = TEMPLATE_DEFAULT;
|
||||||
|
|
||||||
if( vreq.getParameter("clearcache") != null ) //mainly for debugging
|
if ( vreq.getParameter("clearcache") != null ) //mainly for debugging
|
||||||
clearGroupCache();
|
clearGroupCache();
|
||||||
|
|
||||||
int portalId = vreq.getPortalId();
|
int portalId = vreq.getPortalId();
|
||||||
|
|
||||||
List<VClassGroup> groups = null;
|
List<VClassGroup> groups = null;
|
||||||
VClassGroupCache vcgc = VClassGroupCache.getVClassGroupCache(getServletContext());
|
VClassGroupCache vcgc = VClassGroupCache.getVClassGroupCache(getServletContext());
|
||||||
if( vcgc == null ){
|
if ( vcgc == null ) {
|
||||||
log.error("Could not get VClassGroupCache");
|
log.error("Could not get VClassGroupCache");
|
||||||
message = "The system is not configured correctly. Please check your logs for error messages.";
|
message = "The system is not configured correctly. Please check your logs for error messages.";
|
||||||
}else{
|
} else {
|
||||||
groups =vcgc.getGroups( vreq.getPortalId());
|
groups =vcgc.getGroups( vreq.getPortalId());
|
||||||
if (groups == null || groups.isEmpty()) {
|
List<VClassGroupTemplateModel> vcgroups = new ArrayList<VClassGroupTemplateModel>(groups.size());
|
||||||
message = "There are not yet any items in the system.";
|
for (VClassGroup group : groups) {
|
||||||
|
vcgroups.add(new VClassGroupTemplateModel(group));
|
||||||
}
|
}
|
||||||
else {
|
body.put("classGroups", vcgroups);
|
||||||
List<VClassGroupTemplateModel> vcgroups = new ArrayList<VClassGroupTemplateModel>(groups.size());
|
}
|
||||||
for (VClassGroup group : groups) {
|
|
||||||
vcgroups.add(new VClassGroupTemplateModel(group));
|
|
||||||
}
|
|
||||||
body.put("classGroups", vcgroups);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (message != null) {
|
if (message != null) {
|
||||||
body.put("message", message);
|
body.put("message", message);
|
||||||
templateName = Template.TITLED_MESSAGE.toString();
|
templateName = Template.TITLED_MESSAGE.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new TemplateResponseValues(templateName, body);
|
return new TemplateResponseValues(templateName, body);
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,6 +126,10 @@ public class FreemarkerConfigurationLoader {
|
||||||
log.error("Error setting value for url_escaping_charset.");
|
log.error("Error setting value for url_escaping_charset.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// auto include setup.ftl which allows for globals to be easily defined in a template that's always included
|
||||||
|
// used primarily to setup ${bodyClasses} for now
|
||||||
|
config.addAutoInclude("pageSetup.ftl");
|
||||||
|
|
||||||
config.setTemplateLoader(getTemplateLoader(config, themeDir));
|
config.setTemplateLoader(getTemplateLoader(config, themeDir));
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
|
|
|
@ -43,7 +43,6 @@ var browseByVClass = {
|
||||||
this.alphaIndexLinks.click(function() {
|
this.alphaIndexLinks.click(function() {
|
||||||
uri = $('#browse-classes li a.selected').attr('data-uri');
|
uri = $('#browse-classes li a.selected').attr('data-uri');
|
||||||
alpha = $(this).attr('data-alpha');
|
alpha = $(this).attr('data-alpha');
|
||||||
// alpha = $(this).text().substring(0, 1);
|
|
||||||
browseByVClass.getIndividuals(uri, alpha);
|
browseByVClass.getIndividuals(uri, alpha);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
@ -57,7 +56,7 @@ var browseByVClass = {
|
||||||
$('.pagination li a').click(function() {
|
$('.pagination li a').click(function() {
|
||||||
uri = $('#browse-classes li a.selected').attr('data-uri');
|
uri = $('#browse-classes li a.selected').attr('data-uri');
|
||||||
alpha = $('#alpha-browse-individuals li a.selected').attr('data-alpha');
|
alpha = $('#alpha-browse-individuals li a.selected').attr('data-alpha');
|
||||||
page = $(this).attr('class').substring(4,5);
|
page = $(this).attr('data-page');
|
||||||
browseByVClass.getIndividuals(uri, alpha, page);
|
browseByVClass.getIndividuals(uri, alpha, page);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
@ -173,11 +172,10 @@ var browseByVClass = {
|
||||||
pagination += '<h3>page</h3>';
|
pagination += '<h3>page</h3>';
|
||||||
pagination += '<ul>';
|
pagination += '<ul>';
|
||||||
$.each(pages, function(i, item) {
|
$.each(pages, function(i, item) {
|
||||||
anchorOpen = '<a class="page'+ pages[i].text +' round" href="#" title="View page '+ pages[i].text +' of the results">';
|
anchorOpen = '<a class="round" href="#" title="View page '+ pages[i].text +' of the results" data-page="'+ pages[i].index +'">';
|
||||||
anchorClose = '</a>';
|
anchorClose = '</a>';
|
||||||
|
|
||||||
pagination += '<li class="page'+ pages[i].text;
|
pagination += '<li class="round';
|
||||||
pagination += ' round';
|
|
||||||
// Test for active page
|
// Test for active page
|
||||||
if ( pages[i].text == page) {
|
if ( pages[i].text == page) {
|
||||||
pagination += ' selected';
|
pagination += ' selected';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue