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:
nac26 2011-02-05 00:07:48 +00:00
parent 79ac60c8e8
commit 82f24c5966
3 changed files with 36 additions and 39 deletions

View file

@ -50,7 +50,7 @@ public class BrowseController extends FreemarkerHttpServlet {
@Override
protected String getTitle(String siteName, VitroRequest vreq) {
return "Index to " + siteName + " Contents";
return "Index of Contents";
}
@Override
@ -72,17 +72,12 @@ public class BrowseController extends FreemarkerHttpServlet {
message = "The system is not configured correctly. Please check your logs for error messages.";
} else {
groups =vcgc.getGroups( vreq.getPortalId());
if (groups == null || groups.isEmpty()) {
message = "There are not yet any items in the system.";
}
else {
List<VClassGroupTemplateModel> vcgroups = new ArrayList<VClassGroupTemplateModel>(groups.size());
for (VClassGroup group : groups) {
vcgroups.add(new VClassGroupTemplateModel(group));
}
body.put("classGroups", vcgroups);
}
}
if (message != null) {
body.put("message", message);

View file

@ -126,6 +126,10 @@ public class FreemarkerConfigurationLoader {
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));
return config;

View file

@ -43,7 +43,6 @@ var browseByVClass = {
this.alphaIndexLinks.click(function() {
uri = $('#browse-classes li a.selected').attr('data-uri');
alpha = $(this).attr('data-alpha');
// alpha = $(this).text().substring(0, 1);
browseByVClass.getIndividuals(uri, alpha);
return false;
});
@ -57,7 +56,7 @@ var browseByVClass = {
$('.pagination li a').click(function() {
uri = $('#browse-classes li a.selected').attr('data-uri');
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);
return false;
});
@ -173,11 +172,10 @@ var browseByVClass = {
pagination += '<h3>page</h3>';
pagination += '<ul>';
$.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>';
pagination += '<li class="page'+ pages[i].text;
pagination += ' round';
pagination += '<li class="round';
// Test for active page
if ( pages[i].text == page) {
pagination += ' selected';