Skip to content

Commit

Permalink
Merge pull request #8 from virginiacommonwealthuniversity/release/1.6.1
Browse files Browse the repository at this point in the history
Release 1.6.1_2017.03.20
  • Loading branch information
joeleisner authored Mar 20, 2017
2 parents 5c7134e + e38ad65 commit 446a5a9
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 111 deletions.
7 changes: 7 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Changelog
T4Utils 2 utilizes [GitHub's releases feature](https://github.com/blog/1547-release-your-software) for its changelogs, but this document serves as static duplicate of that content.

## [v1.6.1_2017.03.20 - publishCache Microsite Fix](https://github.com/virginiacommonwealthuniversity/T4Utils2/releases/tag/v1.6.1_2017.03.20)
This update fixes an issue with `publishCache.microsite`; This module variable is now working as intended. Here's some other updates:
* T4Utils2 is dropping support for v7.4
* The v7.4 release of 1.6.0 has been pulled for API discrepancies and errors
* Maintenance of one utility file with drastically different API calls is no longer feasible
* Build system files have been further simplified and upgraded to ES2015 (ES6)

## [v1.6.0_2017.02.24 - publishCache Module](https://github.com/virginiacommonwealthuniversity/T4Utils2/releases/tag/v1.6.0_2017.02.24)
This update brings a much needed `publishCache` module to T4Utils. Here's what you can do with it:
* `publishCache.channel` - Returns a data object containing information about the current channel
Expand Down
52 changes: 0 additions & 52 deletions gulp/build.js

This file was deleted.

6 changes: 3 additions & 3 deletions gulp/config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
dest: 'dist', /* Save the build to the destination directory */
src: 'src/*.js', /* Build all .js files at the root of the source directory */
watch: 'src/**/*.js' /* Watch all .js files throughout the source directory */
dest: 'dist',
src: 'src/*.js',
watch: 'src/**/*.js'
};
9 changes: 5 additions & 4 deletions gulp/datestamp.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// Export
module.exports = function () {
module.exports = () => {
let today = new Date(),
month = leftPad(today.getMonth() + 1),
day = leftPad(today.getDate()),
year = today.getFullYear();
return year + '.' + month + '.' + day;
function leftPad(int) {return int < 10 ? '0' + int : int;}
return `${year}.${month}.${day}`;
function leftPad(int) {
return int < 10 ? '0' + int : int;
}
};
27 changes: 18 additions & 9 deletions gulp/header.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
// Required Modules
let datestamp = require('./datestamp.js'),
header = require('gulp-header'),
pkg = require('../package.json');

module.exports = function(version) {
let banner =
module.exports = format => {
let banner,
info = {
date: datestamp()
};
switch (format) {
case 'exp':
banner =
`/**
* T4Utils 2
* @author <%= pkg.author %>
* @version <%= pkg.version %>_<%= info.date %> (<%= info.version %>)
* @version <%= pkg.version %>_<%= info.date %>
* @license <%= pkg.license %>
*/
`,
info = {
version: version,
date: datestamp()
};
`;
break;
case 'min':
banner =
`/* T4Utils2 <%= pkg.version %>_<%= info.date %> | <%= pkg.license %> | <%= pkg.author %> */
`;
break;
}
return header(banner, {pkg, info});
};
28 changes: 21 additions & 7 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
let build = require('./gulp/build'),
config = require('./gulp/config'),
let config = require('./gulp/config'),
datestamp = require('./gulp/datestamp.js'),
gulp = require('gulp'),
jsdoc = require('gulp-jsdoc3');
header = require('./gulp/header.js'),
include = require('gulp-include'),
jsdoc = require('gulp-jsdoc3'),
pkg = require('./package.json'),
rename = require('gulp-rename'),
replace = require('gulp-replace'),
uglify = require('gulp-uglify');

gulp.task('default', ['build']);

gulp.task('build', ['build-8.1', 'build-7.4']); // Build both versions of the library

build(gulp, config, '8.1'); // Build the v8 version of the library
build(gulp, config, '7.4'); // Build the v7 version of the library
gulp.task('build', () => {
return gulp.src(config.src) // Grab the source files
.pipe(include()) // Include javascript modules
.pipe(replace(/\{\{version\}\}/g, pkg.version)) // Replace {{version}} with the package.json version
.pipe(replace(/\{\{datestamp\}\}/g, datestamp())) // Replace {{datestamp}} with a YYYY.mm.dd datestamp
.pipe(header('exp')) // Inject library header
.pipe(gulp.dest(config.dest)) // Save to the destination folder
.pipe(uglify()) // Uglify the code
.pipe(header('min')) // Re-inject library header
.pipe(rename({suffix:'.min'})) // Give the filename a .min suffix
.pipe(gulp.dest(config.dest)); // Save to the destination folder
});

gulp.task('watch', function() {
gulp.watch(config.watch, ['build']); // Run the build task
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "t4-utils-2",
"version": "1.6.0",
"version": "1.6.1",
"description": "A Javascript Library of Utility Classes and Extensions for TerminalFour Programmable Layouts",
"main": "dist/8.4/T4Utils.min.js",
"author": "Joel Eisner <[email protected]>",
Expand Down
12 changes: 6 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ A Javascript library of utility classes and extensions for TerminalFour Programm

## Latest Version

### [v1.6.0_2017.02.24 - publishCache Module](https://github.com/virginiacommonwealthuniversity/T4Utils2/releases/tag/v1.6.0_2017.02.24)
This update brings a much needed `publishCache` module to T4Utils. Here's what you can do with it:
* `publishCache.channel` - Returns a data object containing information about the current channel
* `publishCache.microsite` - Returns, if at all possible, a data object containing information about the current microsite

Check the source file to see the types of information you can pull from these objects!
### [v1.6.1_2017.03.20 - publishCache Microsite Fix](https://github.com/virginiacommonwealthuniversity/T4Utils2/releases/tag/v1.6.1_2017.03.20)
This update fixes an issue with `publishCache.microsite`; This module variable is now working as intended. Here's some other updates:
* T4Utils2 is dropping support for v7.4
* The v7.4 release of 1.6.0 has been pulled for API discrepancies and errors
* Maintenance of one utility file with drastically different API calls is no longer feasible
* Build system files have been further simplified and upgraded to ES2015 (ES6)

Check out the [changelog](changelog.md) for previous release information.

Expand Down
9 changes: 0 additions & 9 deletions src/modules/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@ var T4Utils = (function (utils) {
*/
utils.version = '{{version}}_{{datestamp}}';

/**
* The version of TerminalFour this library is intended for
* @member t4
* @returns {string} the version of TerminalFour this library is intened for
* @example
* T4Utils.t4;
*/
utils.t4 = '{{t4_version}}';

/**
* Writes the specified message type to the browser console
* @member console
Expand Down
36 changes: 18 additions & 18 deletions src/modules/ordinalIndicators.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,26 +55,26 @@ T4Utils.ordinalIndicators.pageInfo = (function() {
for (var k = 0; k < cL.length; k++) {
var cP = cL[k],
ctID = cP.getTemplateID(),
uID = cP.getID();
uID = cP.getID();
for (var l = 0; l < listContentTypeIDs.length; l++) {
var contentTypeID = listContentTypeIDs[l];
if (ctID === contentTypeID.key) contentTypeID.pieces.push(uID);
}
}
// Get the current content's content-type and unique ID's
var this_ctID = '{{api:content_type_id}}',
this_uID = content.getID();
var this_ctID = content.getContentTypeID(),
this_uID = content.getID();
// For each key/pieces object...
for (var m = 0; m < listContentTypeIDs.length; m++) {
// ... create a reference, ...
var typeID = listContentTypeIDs[m];
// ... if the referenced object's key is equal to the current content's content-type ID...
if (typeID.key === this_ctID) {
// Define (of this content-type, in the scope of the entire page)...
var pieces = typeID.pieces, /* All content */
pFirst = pieces[0], /* The first piece of content */
pLength = pieces.length, /* The amount of pieces of content */
pLast = pieces[pLength - 1]; /* The last piece of content */
var pieces = typeID.pieces, /* All content */
pFirst = pieces[0], /* The first piece of content */
pLength = pieces.length, /* The amount of pieces of content */
pLast = pieces[pLength - 1]; /* The last piece of content */
// ... then assign values for pageCount, pageFirst, pageLast, and pageIndex based on the previously defined variables
pageCount = pLength;
pageFirst = pFirst === this_uID ? true : false;
Expand All @@ -94,15 +94,15 @@ T4Utils.ordinalIndicators.pageInfo = (function() {
count: pageCount, /* (Integer) The amount of content of its kind on the page */
first: pageFirst, /* (Boolean) First of its kind on the page? */
index: pageIndex, /* (Integer) Position index of its kind on the page */
last: pageLast /* (Boolean) Last of its kind on the page? */
last: pageLast /* (Boolean) Last of its kind on the page? */
};
} else {
// ... otherwise, return an object that contains null key/value pairs
return {
count: null,
first: null,
index: null,
last: null
last: null
};
}
})();
Expand Down Expand Up @@ -153,28 +153,28 @@ T4Utils.ordinalIndicators.pageLast = T4Utils.ordinalIndicators.pageInfo.last;
T4Utils.ordinalIndicators.groupInfo = (function() {
// If content is defined...
if (T4Utils.contextIsContent) {
var ctid = '{{api:content_type_id}}',
sid = section.getID(),
oCH = new ContentHierarchy(),
oCM = '{{api:ocm}}',
var ctid = content.getContentTypeID(),
sid = section.getID(),
oCH = new ContentHierarchy(),
oCM = com.terminalfour.spring.ApplicationContextProvider.getBean(com.terminalfour.content.IContentManager),
contentInSection = oCH.getContent(dbStatement, sid, 'en'),
groupFirst, groupLast;
for (var i = 0; i < contentInSection.length; i++) {
if (content.getID() === '{{api:ocm_get_id}}') {
groupFirst = i === 0 ? true : ctid !== '{{api:ocm_prev_content_type_id}}' ? true : false;
groupLast = i === contentInSection.length - 1 ? true : ctid !== '{{api:ocm_next_content_type_id}}' ? true : false;
if (content.getID() === oCM.get(contentInSection[i], 'en').getID()) {
groupFirst = i === 0 ? true : ctid !== oCM.get(contentInSection[i - 1], 'en').getContentTypeID() ? true : false;
groupLast = i === contentInSection.length - 1 ? true : ctid !== oCM.get(contentInSection[i + 1], 'en').getContentTypeID() ? true : false;
}
}
// Return an object that contains...
return {
first: groupFirst, /* (Boolean) First of its kind in a group? */
last: groupLast /* (Boolean) Last of its kind in a group? */
last: groupLast /* (Boolean) Last of its kind in a group? */
};
} else {
// ... otherwise, return an object that contains null key/value pairs
return {
first: null,
last: null
last: null
};
}
})();
Expand Down
5 changes: 3 additions & 2 deletions src/modules/publishCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ T4Utils.publishCache.channel = (function() {
*/
T4Utils.publishCache.microsite = (function() {
// Select the microsite based on the current section and its root ID and section
var microsite = publishCache.getMicroSiteFromChild(section),
var channel = publishCache.getChannel(),
microsite = publishCache.getMicroSiteFromChild(section),
isMicrosite = Boolean(microsite);
if (isMicrosite) {
var rootID = Number(microsite.getRootSectionID()),
rootSection = TreeTraversalUtils.findSection(microsite, section, rootID, language);
rootSection = TreeTraversalUtils.findSection(channel, section, rootID, language);
// Return an object that contains...
return {
baseHref: String(microsite.getBaseHref()), // (String) Base HREF for the microsite
Expand Down

0 comments on commit 446a5a9

Please sign in to comment.