mirror of
https://github.com/thumbsup/thumbsup
synced 2024-11-05 12:01:04 +00:00
Enable --albums-from = [ folders | date ] and --albums-date-format
This commit is contained in:
parent
b64843a8a1
commit
7c0fb8a3bf
@ -8,7 +8,7 @@ var Album = require('./album');
|
||||
// e.g. "YYYY-MM" or "YYYY/MMMM" for nested albums
|
||||
exports.albums = function(collection, opts) {
|
||||
opts = _.defaults(opts, {
|
||||
grouping: 'YYYY-MMMM'
|
||||
grouping: opts.albumsDateFormat || 'YYYY-MMMM'
|
||||
});
|
||||
var groups = {};
|
||||
// put all files in the right albums
|
||||
|
@ -15,15 +15,21 @@ var DIR_TEMPLATES = path.join(__dirname, '..', '..', 'templates');
|
||||
|
||||
exports.build = function(collection, opts, callback) {
|
||||
|
||||
// set the download link to the right place
|
||||
// create the right renderer (theme, download path, etc...)
|
||||
var renderer = template.create(opts);
|
||||
|
||||
function website(callback) {
|
||||
// top-level album for the home page
|
||||
var home = new Album('Home');
|
||||
home.filename = opts.index || 'index';
|
||||
// create folder albums
|
||||
home.albums = byFolder.albums(collection, {});
|
||||
// create albums
|
||||
if (opts.albumsFrom === 'folders') {
|
||||
home.albums = byFolder.albums(collection, opts);
|
||||
} else if (opts.albumsFrom === 'date') {
|
||||
home.albums = byDate.albums(collection, opts);
|
||||
} else {
|
||||
throw 'Invalid <albumsFrom> option';
|
||||
}
|
||||
home.finalize();
|
||||
// create top level gallery
|
||||
var gallery = {
|
||||
|
Loading…
Reference in New Issue
Block a user