-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial Development #1
Merged
Merged
Changes from 2 commits
Commits
Show all changes
61 commits
Select commit
Hold shift + click to select a range
33e48f0
[#MmLRZ2E2] [#MmLRZ2E2] [#MmLRZ2E2] Make README less opinionated, add…
localjo 327f21b
[#MmLRZ2E2] Add templates and render into demo, add gulp
localjo 79c0cfb
[#MmLRZ2E2] Add Universe Support
localjo 5376e6f
[#MmLRZ2E2] Add Messaging and Events
localjo e8b4c40
[#MmLRZ2E2] Add option to override the template
localjo 4760fdf
[#MmLRZ2E2] Add SendGrid Support
localjo 84e90a5
[#MmLRZ2E2] refactor as node module
localjo 4bc3e0f
[#MmLRZ2E2] package as UMD
localjo 6cb8dfe
[#MmLRZ2E2] add derequire
localjo 23d151e
[#MmLRZ2E2] move handlebars to dependencies instead of dev
localjo 8cc6ab6
[#MmLRZ2E2] add default options and make template BEM
localjo 897ae33
[#MmLRZ2E2] include instanceof check
localjo 1b060b8
[#MmLRZ2E2] move hbsfy transform to gulp
localjo d95e7bc
[#MmLRZ2E2] Add events API, clean up docs
localjo 419128f
[#MmLRZ2E2] update readme and simplify some things
localjo 03f114e
[#MmLRZ2E2] Add tests
localjo a9127d3
[#MmLRZ2E2] Bind events to object instance
localjo 83c0833
[#MmLRZ2E2] Update test configuration
localjo 3938c81
[#MmLRZ2E2] add mailchimp support, jquery support, and events
localjo a51f83e
[#MmLRZ2E2] add IE9 fallbacks for all services
localjo 383d295
[#MmLRZ2E2] Add Automated Mocha Tests
localjo e2f4c66
[#MmLRZ2E2] Add mocha task to gulp and make tests more DRY
localjo 379f0af
[#MmLRZ2E2] Add tests for all supported browsers
localjo 9dc885c
[#MmLRZ2E2] Add browserstack tunnel to gulp tasks
localjo 93454fd
[#MmLRZ2E2] fire event on xhr failure
localjo 2ae1cb9
[#MmLRZ2E2] use production api instead of staging
localjo 088f4ee
[#MmLRZ2E2] fix JSONP in IE9, other cleanup
localjo 5a6e78b
[#MmLRZ2E2] return success for JSONP requests
localjo 5674bcd
[#MmLRZ2E2] add check for blank submission
localjo 50ace19
[#MmLRZ2E2] change entry point to unbuilt src
localjo 2e30380
[#MmLRZ2E2] ignore built version
localjo c72d3dc
[#MmLRZ2E2] remove console log
localjo 5b8c183
[#MmLRZ2E2] remove testling badges
localjo 9683f6a
[#MmLRZ2E2] add helpful error message for empty form
localjo 17a8f0d
[#MmLRZ2E2] add template option to override template
localjo 412d6bc
[#MmLRZ2E2] simplify hbsfy require
localjo 0522ea9
[#MmLRZ2E2] add repo field, remove extra handlebars dep
localjo 369f17f
[#MmLRZ2E2] add tests for template option, rm overrideTemplate
localjo 91aa867
[#MmLRZ2E2] update default template markup
localjo ff4cd6f
[#MmLRZ2E2] remove responseElement from test
localjo 6c4a383
[#MmLRZ2E2] switch to alerter module for messaging
localjo 1725fb9
[#MmLRZ2E2] clear up private method definitions
localjo d209950
[#MmLRZ2E2] add in page mocha tests
localjo 09b07ea
[#MmLRZ2E2] improve testing workflow and write pending tests
localjo 1295b0e
[#MmLRZ2E2] add browser tests
localjo eab4133
[#MmLRZ2E2] add sinon fake server for universe and sendgrid
localjo 5b46c7e
[#MmLRZ2E2] mock JSONP responses and more
localjo 55c1d77
[#MmLRZ2E2] fix sinon XDomainRequest, clean up CORS request
localjo 7766368
[#MmLRZ2E2] remove console logs
localjo da83586
[#MmLRZ2E2] test iPhone 6 instead of 5
localjo 3593ab1
[#MmLRZ2E2] add doctype to mocha test page for ie9
localjo d969836
[#MmLRZ2E2] add event tests
localjo b1bc875
[#MmLRZ2E2] update readme
localjo 05bdb24
[#MmLRZ2E2] replace placeholder with template
localjo eafad14
[#MmLRZ2E2] add friendlier message for mocha test errors
localjo 72b7657
[#MmLRZ2E2] address review feedback
localjo 9ba64cb
[#MmLRZ2E2] address review feedback
localjo 8fb5dce
Merge branch 'MmLRZ2E2-development' of https://github.com/blocks/subs…
localjo 86a23a8
[#MmLRZ2E2] change api urls to https
localjo 4eaeffc
[#MmLRZ2E2] move hbsfy to package.json instead of gulp task
localjo d7090d9
[#MmLRZ2E2] update metadata
localjo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<html> | ||
<head> | ||
<title>Subscribe Email Demo</title> | ||
<script src="../build/subscribe-email.js"></script> | ||
</head> | ||
<body> | ||
<p>Here's a MailChimp subscribe form!</p> | ||
<div id="subscribe-form1">1</div> | ||
<p>Here's a SendGrid subscribe form!</p> | ||
<div id="subscribe-form2">2</div> | ||
<p>Here's a Universe subscribe form!</p> | ||
<div id="subscribe-form3">3</div> | ||
<script> | ||
new SubscribeEmail({ | ||
element: '#subscribe-form1', | ||
submitText: 'Sign Up', | ||
service: 'mailchimp' | ||
}); | ||
</script> | ||
<script> | ||
new SubscribeEmail({ | ||
element: '#subscribe-form2', | ||
submitText: 'Subscribe', | ||
service: 'sendgrid' | ||
}); | ||
</script> | ||
<script> | ||
new SubscribeEmail({ | ||
element: '#subscribe-form3', | ||
submitText: 'Send', | ||
service: 'universe' | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
var browserify = require('browserify'); | ||
var bundleLogger = require('./util/bundleLogger'); | ||
var gulp = require('gulp'); | ||
var handleErrors = require('./util/handleErrors'); | ||
var source = require('vinyl-source-stream'); | ||
|
||
gulp.task('browserify', function() { | ||
var bundler = browserify({ | ||
// Required watchify args | ||
cache: {}, packageCache: {}, fullPaths: true, | ||
// Specify the entry point of your app | ||
entries: ['./src/subscribe-email.js'], | ||
// Add file extentions to make optional in your requires | ||
extensions: ['.hbs'], | ||
// Enable source maps! | ||
debug: true | ||
}); | ||
|
||
var bundle = function() { | ||
// Log when bundling starts | ||
bundleLogger.start(); | ||
|
||
return bundler | ||
.bundle() | ||
// Report compile errors | ||
.on('error', handleErrors) | ||
// Use vinyl-source-stream to make the | ||
// stream gulp compatible. Specifiy the | ||
// desired output filename here. | ||
.pipe(source('subscribe-email.js')) | ||
// Specify the output destination | ||
.pipe(gulp.dest('./build/')) | ||
// Log when bundling completes! | ||
.on('end', bundleLogger.end); | ||
}; | ||
|
||
return bundle(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* bundleLogger | ||
------------ | ||
Provides gulp style logs to the bundle method in browserify.js | ||
*/ | ||
|
||
var gutil = require('gulp-util'); | ||
var prettyHrtime = require('pretty-hrtime'); | ||
var startTime; | ||
|
||
module.exports = { | ||
start: function() { | ||
startTime = process.hrtime(); | ||
gutil.log('Running', gutil.colors.green("'bundle'") + '...'); | ||
}, | ||
|
||
end: function() { | ||
var taskTime = process.hrtime(startTime); | ||
var prettyTime = prettyHrtime(taskTime); | ||
gutil.log('Finished', gutil.colors.green("'bundle'"), 'in', gutil.colors.magenta(prettyTime)); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
var notify = require("gulp-notify"); | ||
|
||
module.exports = function() { | ||
|
||
var args = Array.prototype.slice.call(arguments); | ||
|
||
// Send error to notification center with gulp-notify | ||
notify.onError({ | ||
title: "Compile Error", | ||
message: "<%= error.message %>" | ||
}).apply(this, args); | ||
|
||
// Keep gulp from hanging on this task | ||
this.emit('end'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
gulpfile.js | ||
=========== | ||
Rather than manage one giant configuration file responsible | ||
for creating multiple tasks, each task has been broken out into | ||
its own file in `/gulp`. Any file in that folder gets automatically | ||
required below. | ||
|
||
To add a new task, simply add a new task file to the `/gulp` directory. | ||
*/ | ||
var gulp = require('gulp'); | ||
var requireDir = require('require-dir'); | ||
|
||
// Require all tasks in gulp/tasks, including subfolders | ||
requireDir('./gulp', { recurse: true }); | ||
|
||
// Task groups | ||
gulp.task('default', ['build']); | ||
gulp.task('build', ['browserify']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "subscribe-email", | ||
"version": "0.0.0", | ||
"private": true, | ||
"main": "subscribe-email.js", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oops, yep. I moved that and forgot to update package.json. I'll update it with the next commit. |
||
"browserify": { | ||
"transform": [ | ||
"hbsfy" | ||
] | ||
}, | ||
"devDependencies": { | ||
"browserify": "^5.11.1", | ||
"gulp": "^3.8.7", | ||
"gulp-notify": "^1.5.1", | ||
"gulp-util": "^3.0.1", | ||
"handlebars": "1.3.x", | ||
"hbsfy": "^2.1.0", | ||
"pretty-hrtime": "^0.2.1", | ||
"require-dir": "^0.1.0", | ||
"vinyl-source-stream": "^0.1.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// This JavaScript module is exported as UMD following the pattern which can be | ||
// found here: https://github.com/umdjs/umd/blob/master/returnExports.js | ||
|
||
(function (root, factory) { | ||
if (typeof define === 'function' && define.amd) { | ||
define(['handlebars'], factory); | ||
} else if (typeof exports === 'object') { | ||
module.exports = factory(require('./templates/BEM-with-messaging.hbs')); | ||
} else { | ||
root.SubscribeEmail = factory(root.handlebars); | ||
} | ||
}(this, function (template) { | ||
|
||
this.SubscribeEmail = function(options){ | ||
var placeholder = document.querySelector(options.element); | ||
var serviceConfig = {}; | ||
switch (options.service) { | ||
case 'mailchimp': | ||
serviceConfig = { | ||
formAction: 'http://mailchimp-api.com/route', | ||
formMethod: 'POST', | ||
emailName: 'EMAIL' | ||
}; | ||
break; | ||
case 'sendgrid': | ||
serviceConfig = { | ||
formAction: 'http://sendgrid-api.com/route', | ||
formMethod: 'POST' | ||
}; | ||
break; | ||
default: | ||
serviceConfig = { | ||
formAction: '', | ||
formMethod: '' | ||
}; | ||
break; | ||
} | ||
//Merge the serviceConfig object into the template options | ||
for (var attrname in serviceConfig) { options[attrname] = serviceConfig[attrname]; } | ||
|
||
placeholder.innerHTML = template(options); | ||
}; | ||
|
||
return this.SubscribeEmail; | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<form action="{{formAction}}" method="{{formMethod}}"> | ||
<input type="email" value="" name="{{emailName}}"> | ||
<input type="submit" value="{{submitText}}" name="{{submitName}}"> | ||
</form> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe
entries
is redundant with thesource
call below, shouldn't need the extensions either, or is there another dependency other than hbsfy?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
source
call below is different thangulp.src
. It's actually callingvinyl-source-stream
: https://www.npmjs.org/package/vinyl-source-stream