Skip to content

Commit

Permalink
Merge and use button instead of anchor.
Browse files Browse the repository at this point in the history
- Add usage of button tag instead of anchor
- Update test
- Add tests to demonstrate additional classes
- Merge pull request [by niftylettuce and romanmt]
  • Loading branch information
JasonGiedymin committed Jul 1, 2012
1 parent 0ace87f commit 1b97ad1
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 34 deletions.
7 changes: 7 additions & 0 deletions History.md
Original file line number Original file line Diff line number Diff line change
@@ -1,3 +1,10 @@
0.1.0 / 2012-07-01
==================
* Use button (<button>) instead of from anchor (<a>)
* Update tests
* Add tests to demonstrate additional classes
* Merge pull request [by niftylettuce and romanmt]

0.0.9 / 2012-06-14 0.0.9 / 2012-06-14
================== ==================
* Update dev dependencies * Update dev dependencies
Expand Down
4 changes: 2 additions & 2 deletions index.coffee
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = (req, res) ->
len = types.length len = types.length


if !len if !len
return '' return '<div id=\"messages\"></div>';


buf.push('<div id="messages">') buf.push('<div id="messages">')


Expand All @@ -19,7 +19,7 @@ module.exports = (req, res) ->
for j in [0...msgs.length] for j in [0...msgs.length]
msg = msgs[j] msg = msgs[j]
buf.push("<div class=\"alert alert-#{type}\">") buf.push("<div class=\"alert alert-#{type}\">")
buf.push("<a class=\"close\" data-dismiss=\"alert\">&times;</a>") buf.push("<button class=\"close\" data-dismiss=\"alert\">&times;</button>")
buf.push(msg) buf.push(msg)
buf.push("</div>") buf.push("</div>")
buf.push("</div>") buf.push("</div>")
Expand Down
54 changes: 30 additions & 24 deletions index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions package.json
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
, "description": "Express flash notification message rendering compatible with Twitter's Bootstrap v2.0+. Based on TJ Holowaychuk's express-messages." , "description": "Express flash notification message rendering compatible with Twitter's Bootstrap v2.0+. Based on TJ Holowaychuk's express-messages."
, "version": "0.1.0" , "version": "0.1.0"
, "author": "Jason Giedymin <jasong@apache.org>" , "author": "Jason Giedymin <jasong@apache.org>"
, "contributors": [
{ "name": "Nick Baugh", "email": "niftylettuce@gmail.com" }
]
, "keywords": ["express", "bootstrap", "flash"] , "keywords": ["express", "bootstrap", "flash"]
, "repository": "git://github.com/JasonGiedymin/express-messages-bootstrap" , "repository": "git://github.com/JasonGiedymin/express-messages-bootstrap"
, "main": "index" , "main": "index"
Expand Down
55 changes: 50 additions & 5 deletions test/messages.test.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ module.exports = {
req.flash('warning', 'This is a warning.'); req.flash('warning', 'This is a warning.');
req.flash('success', 'This is success.'); req.flash('success', 'This is success.');


req.flash('error fade in', 'This is an error.');
req.flash('info fade in', 'This is an info.');
req.flash('warning fade in', 'This is a warning.');
req.flash('success fade in', 'This is success.');

req.flash('error i-like-big-names-and-i-cannot-lie fight', 'This is an error.');
req.flash('info i-like-big-names-and-i-cannot-lie for-your-right', 'This is an info.');
req.flash('warning i-like-big-names-and-i-cannot-lie to', 'This is a warning.');
req.flash('success i-like-big-names-and-i-cannot-lie paaaaartay', 'This is success.');

res.render('messages.ejs', { res.render('messages.ejs', {
layout: false layout: false
}); });
Expand All @@ -36,21 +46,56 @@ module.exports = {
var html = [ var html = [
'<div id="messages">' '<div id="messages">'
,'<div class="alert alert-error">' ,'<div class="alert alert-error">'
,'<a class="close" data-dismiss="alert">&times;</a>' ,'<button class="close" data-dismiss="alert">&times;</button>'
,'This is an error.' ,'This is an error.'
,'</div>' ,'</div>'
,'<div class="alert alert-info">' ,'<div class="alert alert-info">'
,'<a class="close" data-dismiss="alert">&times;</a>' ,'<button class="close" data-dismiss="alert">&times;</button>'
,'This is an info.' ,'This is an info.'
,'</div>' ,'</div>'
,'<div class="alert alert-warning">' ,'<div class="alert alert-warning">'
,'<a class="close" data-dismiss="alert">&times;</a>' ,'<button class="close" data-dismiss="alert">&times;</button>'
,'This is a warning.' ,'This is a warning.'
,'</div>' ,'</div>'
,'<div class="alert alert-success">' ,'<div class="alert alert-success">'
,'<a class="close" data-dismiss="alert">&times;</a>' ,'<button class="close" data-dismiss="alert">&times;</button>'
,'This is success.'
,'</div>'

,'<div class="alert alert-error fade in">'
,'<button class="close" data-dismiss="alert">&times;</button>'
,'This is an error.'
,'</div>'
,'<div class="alert alert-info fade in">'
,'<button class="close" data-dismiss="alert">&times;</button>'
,'This is an info.'
,'</div>'
,'<div class="alert alert-warning fade in">'
,'<button class="close" data-dismiss="alert">&times;</button>'
,'This is a warning.'
,'</div>'
,'<div class="alert alert-success fade in">'
,'<button class="close" data-dismiss="alert">&times;</button>'
,'This is success.' ,'This is success.'
,'</div>' ,'</div>'

,'<div class="alert alert-error i-like-big-names-and-i-cannot-lie fight">'
,'<button class="close" data-dismiss="alert">&times;</button>'
,'This is an error.'
,'</div>'
,'<div class="alert alert-info i-like-big-names-and-i-cannot-lie for-your-right">'
,'<button class="close" data-dismiss="alert">&times;</button>'
,'This is an info.'
,'</div>'
,'<div class="alert alert-warning i-like-big-names-and-i-cannot-lie to">'
,'<button class="close" data-dismiss="alert">&times;</button>'
,'This is a warning.'
,'</div>'
,'<div class="alert alert-success i-like-big-names-and-i-cannot-lie paaaaartay">'
,'<button class="close" data-dismiss="alert">&times;</button>'
,'This is success.'
,'</div>'

,'</div>' ,'</div>'
].join('\n'); ].join('\n');


Expand All @@ -59,6 +104,6 @@ module.exports = {
{ body: html }); { body: html });
assert.response(app, assert.response(app,
{ url: '/none' }, { url: '/none' },
{ body: '' }); { body: '<div id="messages"></div>' });
} }
}; };

0 comments on commit 1b97ad1

Please sign in to comment.