Merge branch 'flip-views'
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by visionmedia · committed by visionmedia · parents d31de1e, 0f7aa26 · Browse files · 47 files·+374 added−366 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
47 files+374 added−366 removed
- tests:+36 added−36 removed
- other:+338 added−330 removed
Provenance
- Commit
6b13fc9- Tree
83591cf- Author
visionmedia <tj@vision-media.ca>- Committer
visionmedia <tj@vision-media.ca>- Parent 1
d31de1e- Parent 2
0f7aa26
47 files changed+374 added−366 removed
deleted:examples/chat/views/partials/message.haml.html-1 removed
1%li= messageNo newline at end of fileadded:examples/chat/views/partials/message.html.haml+1 added
1+%li= messagedeleted:examples/chat/views/chat.haml.html-9 removed
123456789%h1 Chat%img.bubble{ src: '/public/images/bubble.png' }%ul#messages = this.partial('message.haml.html', { collection: messages })%form{ method: 'post' } %input{ type: 'hidden', name: '_method', value: 'put' } %input{ type: 'text', name: 'name', value: name || 'guest' } %input{ type: 'text', name: 'message' } %input{ type: 'submit', value: 'Send' }No newline at end of fileadded:examples/chat/views/chat.html.haml+9 added
1+%h1 Chat2+%img.bubble{ src: '/public/images/bubble.png' }3+%ul#messages4+ = this.partial('message.haml.html', { collection: messages })5+%form{ method: 'post' }6+ %input{ type: 'hidden', name: '_method', value: 'put' }7+ %input{ type: 'text', name: 'name', value: name || 'guest' }8+ %input{ type: 'text', name: 'message' }9+ %input{ type: 'submit', value: 'Send' }deleted:examples/chat/views/layout.haml.html-11 removed
1234567891011%html %head %title= title %script{ src: '/public/javascripts/jquery.js' } %script{ src: '/public/javascripts/app.js' } %link{ rel: 'stylesheet', href: '/style.css' } %body #wrapper= body #online Online: %strong= usersOnlineNo newline at end of fileadded:examples/chat/views/layout.html.haml+11 added
1+%html2+ %head3+ %title= title4+ %script{ src: '/public/javascripts/jquery.js' }5+ %script{ src: '/public/javascripts/app.js' }6+ %link{ rel: 'stylesheet', href: '/style.css' }7+ %body8+ #wrapper= body9+ #online 10+ Online:11+ %strong= usersOnlineadded:examples/chat/views/style.css.sass+81 added
1+body2+ :font-family "Helvetica Neue", "Lucida Grande", "Arial"3+ :font-size 13px4+ :text-align center5+ =text-stroke 1px rgba(255, 255, 255, 0.1)6+ :color #5557+ 8+h1, h29+ :margin 010+ :font-size 22px11+ :color #34343412+h113+ :text-shadow 1px 2px 2px #ddd14+ :font-size 60px15+ 16+img.bubble17+ :position absolute18+ :top -25px19+ :left 120px20+ 21+#wrapper22+ :position relative23+ :margin 100px auto24+ :width 500px25+ :text-align left26+ 27+ul28+ :margin 029+ :padding 030+ :max-height 300px31+ :overflow-x hidden32+ li33+ :margin 5px 034+ :padding 3px 8px35+ :list-style none36+ :border 1px solid #eee37+ =border-radius 3px38+ =border-radius 3px39+ li:hover40+ :cursor pointer41+ :color #2E2E2E42+43+input[type=text]44+ :padding 5px45+ :border 1px solid #ddd46+ :outline none47+ =border-radius 2px48+input[type=text]:focus49+ :border-color #00C3FF50+51+input[type=submit]52+ =border-radius 2px53+ =box-shadow 0 1px 2px #ddd54+ :padding 6px 10px55+ :border solid 1px #99956+ :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#ddd))57+ :color #33358+ :text-decoration none59+ :cursor pointer60+ :display inline-block61+ :text-align center62+ :text-shadow 0px 1px 1px #fff63+ :line-height 164+input[type=submit]:hover65+ :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#E6E4E4))66+input[type=submit]:active67+ :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#c7c7c7))68+input[name=name]69+ :width 80px70+ 71+a72+ :color #1ABFF173+ =transition-property padding74+ =transition-duration 0.15s75+a:hover76+ :padding 0 5px77+a:hover:before78+ :content 'visit: '79+ 80+#online81+ :font-size 12pxdeleted:examples/chat/views/style.sass.css-81 removed
1-body2- :font-family "Helvetica Neue", "Lucida Grande", "Arial"3- :font-size 13px4- :text-align center5- =text-stroke 1px rgba(255, 255, 255, 0.1)6- :color #5557- 8-h1, h29- :margin 010- :font-size 22px11- :color #34343412-h113- :text-shadow 1px 2px 2px #ddd14- :font-size 60px15- 16-img.bubble17- :position absolute18- :top -25px19- :left 120px20- 21-#wrapper22- :position relative23- :margin 100px auto24- :width 500px25- :text-align left26- 27-ul28- :margin 029- :padding 030- :max-height 300px31- :overflow-x hidden32- li33- :margin 5px 034- :padding 3px 8px35- :list-style none36- :border 1px solid #eee37- =border-radius 3px38- =border-radius 3px39- li:hover40- :cursor pointer41- :color #2E2E2E42-43-input[type=text]44- :padding 5px45- :border 1px solid #ddd46- :outline none47- =border-radius 2px48-input[type=text]:focus49- :border-color #00C3FF50-51-input[type=submit]52- =border-radius 2px53- =box-shadow 0 1px 2px #ddd54- :padding 6px 10px55- :border solid 1px #99956- :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#ddd))57- :color #33358- :text-decoration none59- :cursor pointer60- :display inline-block61- :text-align center62- :text-shadow 0px 1px 1px #fff63- :line-height 164-input[type=submit]:hover65- :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#E6E4E4))66-input[type=submit]:active67- :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#c7c7c7))68-input[name=name]69- :width 80px70- 71-a72- :color #1ABFF173- =transition-property padding74- =transition-duration 0.15s75-a:hover76- :padding 0 5px77-a:hover:before78- :content 'visit: '79- 80-#online81- :font-size 12pxmodified:examples/chat/app.js+2 added-2 removed
22 unmodified lines2324252627272829303124 unmodified lines5657585960606162636415 unmodified lines22 unmodified lines
get('/chat', function(){ var self = this Session.store.length(function(err, len){ self.render('chat.haml.html', { self.render('chat.html.haml', { locals: { title: 'Chat', messages: messages, name: self.session.name,24 unmodified lines }, 100)})
get('/*.css', function(file){ this.render(file + '.sass.css', { layout: false }) this.render(file + '.css.sass', { layout: false })})
get('/error/view', function(){ this.render('does.not.exist')15 unmodified linesdeleted:examples/coffee-upload/views/layout.haml.html-14 removed
1234567891011121314%html %head %title Upload %script{ src: '/public/javascripts/jquery.js' } %script{ src: '/public/javascripts/app.js' } %link{ rel: 'stylesheet', href: '/style.css' } %body #wrapper %h1 Upload :if flashes %ul.messages.info :each msg in flashes %li= msg .body= bodyadded:examples/coffee-upload/views/layout.html.haml+14 added
1+%html2+ %head3+ %title Upload4+ %script{ src: '/public/javascripts/jquery.js' }5+ %script{ src: '/public/javascripts/app.js' }6+ %link{ rel: 'stylesheet', href: '/style.css' }7+ %body8+ #wrapper9+ %h1 Upload10+ :if flashes11+ %ul.messages.info12+ :each msg in flashes13+ %li= msg14+ .body= bodyadded:examples/coffee-upload/views/style.css.sass+68 added
1+body2+ :font-family "Helvetica Neue", "Lucida Grande", "Arial"3+ :font-size 13px4+ :text-align center5+ :-webkit-text-stroke 1px rgba(255, 255, 255, 0.1)6+ :color #5557+ 8+h1, h29+ :margin 0 0 15px 010+ :font-size 22px11+ :color #34343412+h113+ :text-shadow 1px 2px 2px #ddd14+ :font-size 60px15+h216+ :margin-top 15px17+ 18+#wrapper19+ :position relative20+ :margin 100px auto21+ :width 500px22+ :text-align left23+24+input[type=file]25+ :padding 5px26+ :border 1px solid #ddd27+ :outline none28+ :-webkit-border-radius 2px29+ :-moz-border-radius 2px30+input[type=file]:focus31+ :border-color #00C3FF32+33+input[type=submit]34+ :-webkit-border-radius 2px35+ :-moz-border-radius 2px36+ :-webkit-box-shadow 0 1px 2px #ddd37+ :-moz-box-shadow 0 1px 2px #ddd38+ :padding 6px 10px39+ :border solid 1px #99940+ :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#ddd))41+ :color #33342+ :text-decoration none43+ :cursor pointer44+ :display inline-block45+ :text-align center46+ :text-shadow 0px 1px 1px #fff47+ :line-height 148+input[type=submit]:hover49+ :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#E6E4E4))50+input[type=submit]:active51+ :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#c7c7c7))52+input[name=name]53+ :width 80px54+ 55+form56+ .panel57+ :float left58+ :width 100%59+ :margin-bottom 15px60+ 61+.messages62+ :margin 063+ :padding 064+ :border 1px solid #eee65+ =box-shadow 2px 2px 5px #eee66+ li67+ :padding 5px 10px68+ :list-style nonedeleted:examples/coffee-upload/views/style.sass.css-68 removed
1-body2- :font-family "Helvetica Neue", "Lucida Grande", "Arial"3- :font-size 13px4- :text-align center5- :-webkit-text-stroke 1px rgba(255, 255, 255, 0.1)6- :color #5557- 8-h1, h29- :margin 0 0 15px 010- :font-size 22px11- :color #34343412-h113- :text-shadow 1px 2px 2px #ddd14- :font-size 60px15-h216- :margin-top 15px17- 18-#wrapper19- :position relative20- :margin 100px auto21- :width 500px22- :text-align left23-24-input[type=file]25- :padding 5px26- :border 1px solid #ddd27- :outline none28- :-webkit-border-radius 2px29- :-moz-border-radius 2px30-input[type=file]:focus31- :border-color #00C3FF32-33-input[type=submit]34- :-webkit-border-radius 2px35- :-moz-border-radius 2px36- :-webkit-box-shadow 0 1px 2px #ddd37- :-moz-box-shadow 0 1px 2px #ddd38- :padding 6px 10px39- :border solid 1px #99940- :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#ddd))41- :color #33342- :text-decoration none43- :cursor pointer44- :display inline-block45- :text-align center46- :text-shadow 0px 1px 1px #fff47- :line-height 148-input[type=submit]:hover49- :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#E6E4E4))50-input[type=submit]:active51- :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#c7c7c7))52-input[name=name]53- :width 80px54- 55-form56- .panel57- :float left58- :width 100%59- :margin-bottom 15px60- 61-.messages62- :margin 063- :padding 064- :border 1px solid #eee65- =box-shadow 2px 2px 5px #eee66- li67- :padding 5px 10px68- :list-style nonedeleted:examples/coffee-upload/views/upload.haml.html-18 removed
1-:if typeof images !== 'undefined'2- .images3- :each img in images4- %img{ src: img }5-6-%h2 Singles7-%form{ method: 'post', enctype: 'multipart/form-data' }8- %input{ type: 'file', name: 'images[0]' }9- %input{ type: 'file', name: 'images[1]' }10- %input{ type: 'file', name: 'images[2]' }11- .panel12- %input{ type: 'submit', value: 'Upload' }13- 14-%h2 Multiple15-%form{ method: 'post', enctype: 'multipart/form-data' }16- %input{ type: 'file', name: 'images[]', multiple: 'multiple' }17- .panel18- %input{ type: 'submit', value: 'Upload' }added:examples/coffee-upload/views/upload.html.haml+18 added
1+:if typeof images !== 'undefined'2+ .images3+ :each img in images4+ %img{ src: img }5+6+%h2 Singles7+%form{ method: 'post', enctype: 'multipart/form-data' }8+ %input{ type: 'file', name: 'images[0]' }9+ %input{ type: 'file', name: 'images[1]' }10+ %input{ type: 'file', name: 'images[2]' }11+ .panel12+ %input{ type: 'submit', value: 'Upload' }13+ 14+%h2 Multiple15+%form{ method: 'post', enctype: 'multipart/form-data' }16+ %input{ type: 'file', name: 'images[]', multiple: 'multiple' }17+ .panel18+ %input{ type: 'submit', value: 'Upload' }modified:examples/coffee-upload/app.coffee+2 added-2 removed
15 unmodified lines16 get '/', ->17 @redirect('/upload')18 19 get '/upload', ->20- @render 'upload.haml.html', {20+ @render 'upload.html.haml', {21 locals: {22 flashes: @flash 'info'23 }24 }4 unmodified lines29 @flash 'info', 'Uploaded ' + image.filename30 @redirect '/upload'31 32 get '/*.css', (file) ->33- @render file + '.sass.css', { layout: no }33+ @render file + '.css.sass', { layout: no }34 35 run()deleted:examples/upload/views/layout.haml.html-14 removed
1-%html2- %head3- %title Upload4- %script{ src: '/public/javascripts/jquery.js' }5- %script{ src: '/public/javascripts/app.js' }6- %link{ rel: 'stylesheet', href: '/style.css' }7- %body8- #wrapper9- %h1 Upload10- :if flashes11- %ul.messages.info12- :each msg in flashes13- %li= msg14- .body= bodyadded:examples/upload/views/layout.html.haml+14 added
1+%html2+ %head3+ %title Upload4+ %script{ src: '/public/javascripts/jquery.js' }5+ %script{ src: '/public/javascripts/app.js' }6+ %link{ rel: 'stylesheet', href: '/style.css' }7+ %body8+ #wrapper9+ %h1 Upload10+ :if flashes11+ %ul.messages.info12+ :each msg in flashes13+ %li= msg14+ .body= bodyadded:examples/upload/views/style.css.sass+68 added
1+body2+ :font-family "Helvetica Neue", "Lucida Grande", "Arial"3+ :font-size 13px4+ :text-align center5+ :-webkit-text-stroke 1px rgba(255, 255, 255, 0.1)6+ :color #5557+ 8+h1, h29+ :margin 0 0 15px 010+ :font-size 22px11+ :color #34343412+h113+ :text-shadow 1px 2px 2px #ddd14+ :font-size 60px15+h216+ :margin-top 15px17+ 18+#wrapper19+ :position relative20+ :margin 100px auto21+ :width 500px22+ :text-align left23+24+input[type=file]25+ :padding 5px26+ :border 1px solid #ddd27+ :outline none28+ :-webkit-border-radius 2px29+ :-moz-border-radius 2px30+input[type=file]:focus31+ :border-color #00C3FF32+33+input[type=submit]34+ :-webkit-border-radius 2px35+ :-moz-border-radius 2px36+ :-webkit-box-shadow 0 1px 2px #ddd37+ :-moz-box-shadow 0 1px 2px #ddd38+ :padding 6px 10px39+ :border solid 1px #99940+ :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#ddd))41+ :color #33342+ :text-decoration none43+ :cursor pointer44+ :display inline-block45+ :text-align center46+ :text-shadow 0px 1px 1px #fff47+ :line-height 148+input[type=submit]:hover49+ :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#E6E4E4))50+input[type=submit]:active51+ :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#c7c7c7))52+input[name=name]53+ :width 80px54+ 55+form56+ .panel57+ :float left58+ :width 100%59+ :margin-bottom 15px60+ 61+.messages62+ :margin 063+ :padding 064+ :border 1px solid #eee65+ =box-shadow 2px 2px 5px #eee66+ li67+ :padding 5px 10px68+ :list-style nonedeleted:examples/upload/views/style.sass.css-68 removed
1-body2- :font-family "Helvetica Neue", "Lucida Grande", "Arial"3- :font-size 13px4- :text-align center5- :-webkit-text-stroke 1px rgba(255, 255, 255, 0.1)6- :color #5557- 8-h1, h29- :margin 0 0 15px 010- :font-size 22px11- :color #34343412-h113- :text-shadow 1px 2px 2px #ddd14- :font-size 60px15-h216- :margin-top 15px17- 18-#wrapper19- :position relative20- :margin 100px auto21- :width 500px22- :text-align left23-24-input[type=file]25- :padding 5px26- :border 1px solid #ddd27- :outline none28- :-webkit-border-radius 2px29- :-moz-border-radius 2px30-input[type=file]:focus31- :border-color #00C3FF32-33-input[type=submit]34- :-webkit-border-radius 2px35- :-moz-border-radius 2px36- :-webkit-box-shadow 0 1px 2px #ddd37- :-moz-box-shadow 0 1px 2px #ddd38- :padding 6px 10px39- :border solid 1px #99940- :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#ddd))41- :color #33342- :text-decoration none43- :cursor pointer44- :display inline-block45- :text-align center46- :text-shadow 0px 1px 1px #fff47- :line-height 148-input[type=submit]:hover49- :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#E6E4E4))50-input[type=submit]:active51- :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#c7c7c7))52-input[name=name]53- :width 80px54- 55-form56- .panel57- :float left58- :width 100%59- :margin-bottom 15px60- 61-.messages62- :margin 063- :padding 064- :border 1px solid #eee65- =box-shadow 2px 2px 5px #eee66- li67- :padding 5px 10px68- :list-style nonedeleted:examples/upload/views/upload.haml.html-18 removed
1-:if typeof images !== 'undefined'2- .images3- :each img in images4- %img{ src: img }5-6-%h2 Singles7-%form{ method: 'post', enctype: 'multipart/form-data' }8- %input{ type: 'file', name: 'images[0]' }9- %input{ type: 'file', name: 'images[1]' }10- %input{ type: 'file', name: 'images[2]' }11- .panel12- %input{ type: 'submit', value: 'Upload' }13- 14-%h2 Multiple15-%form{ method: 'post', enctype: 'multipart/form-data' }16- %input{ type: 'file', name: 'images[]', multiple: 'multiple' }17- .panel18- %input{ type: 'submit', value: 'Upload' }added:examples/upload/views/upload.html.haml+18 added
1+:if typeof images !== 'undefined'2+ .images3+ :each img in images4+ %img{ src: img }5+6+%h2 Singles7+%form{ method: 'post', enctype: 'multipart/form-data' }8+ %input{ type: 'file', name: 'images[0]' }9+ %input{ type: 'file', name: 'images[1]' }10+ %input{ type: 'file', name: 'images[2]' }11+ .panel12+ %input{ type: 'submit', value: 'Upload' }13+ 14+%h2 Multiple15+%form{ method: 'post', enctype: 'multipart/form-data' }16+ %input{ type: 'file', name: 'images[]', multiple: 'multiple' }17+ .panel18+ %input{ type: 'submit', value: 'Upload' }modified:examples/upload/app.js+2 added-2 removed
18 unmodified lines19 this.redirect('/upload')20 })21 22 get('/upload', function(){23- this.render('upload.haml.html', {23+ this.render('upload.html.haml', {24 locals: {25 flashes: this.flash('info')26 } 27 })7 unmodified lines35 this.redirect('/upload')36 })37 38 get('/*.css', function(file){39- this.render(file + '.sass.css', { layout: false })39+ this.render(file + '.css.sass', { layout: false })40 })41 42 run()modified:lib/express/plugins/view.js+30 added-22 removed
107 unmodified lines108 /**109 * Render _view_ with _options_.110 *111 * Views are looked up relative to the'views' path setting. 112- * View filenames should conform to ANY.ENGINE.TYPE so for example113- * 'layout.ejs.html', 'ejs' represents the template engine, 'html'112+ * View filenames should conform to NAME.TYPE.ENGINE so for example113+ * 'layout.html.ejs', 'ejs' represents the template engine, 'html'114 * represents the type of content being rendered, which is then passed115 * to contentType().116 *117 * Engines must export a render() method accepting the template string16 unmodified lines134 * @api public135 */136 137 render: function(view, options, callback) {138- var self = this,139- options = options || {},138+ var options = options || {},139 type = options.partial ? 'partials' : 'views',140 path = set(type) + '/' + view,142- engine = path.split('.').slice(-2)[0],143- ext = extname(path),141+ parts = view.split('.'),142+ engine = parts.last,143+ contentType = parts.slice(-2)[0],144 layout = options.layout === undefined ? 'layout' : options.layout145- options.context = options.context || this146- if (type === 'views') self.contentType(ext)147- function render(content) {148- content = (engines[engine] = engines[engine] || require(engine)).render(content, options)149- if (layout)150- self.render(layout + '.' + engine + ext, options.mergeDeep({151- layout: false,152- locals: { body: content }153- }), callback)154- else if (type === 'partials')155- return content156- else if (callback)157- callback.call(self, null, content)158- else159- self.halt(200, content)145+ // >>> DEPRECATED: remove in 0.9.0146+ if (['haml', 'sass', 'ejs'].indexOf(contentType) !== -1) {147+ Ext.warn('views now take the form NAME.TYPE.ENGINE such as "page.html.haml" instead of "page.haml.html".' +148+ ' Will be removed in 0.9.0')149+ var swap = contentType150+ contentType = engine151+ engine = swap152+ path = set(type) + '/' + parts.first + '.' + contentType + '.' + engine153 }161- return render(cache[type][path] || fs.readFileSync(path))154+ // <<<155+ var content = cache[type][path] || fs.readFileSync(path)156+ options.context = options.context || this157+ content = (engines[engine] = engines[engine] || require(engine)).render(content, options)158+ if (type === 'views') this.contentType(contentType)159+ if (layout)160+ this.render([layout, contentType, engine].join('.'), options.mergeDeep({161+ layout: false,162+ locals: { body: content }163+ }), callback)164+ else if (type === 'partials')165+ return content166+ else if (callback)167+ callback.call(this, null, content)168+ else169+ this.halt(200, content)170 }171 })172 }173 }2 unmodified linesdeleted:spec/fixtures/partials/article.haml.html-6 removed
1-:if __isFirst__2- %li.first= article3-:if __isLast__4- %li.last= article5-:if !__isLast__ && !__isFirst__6- %li{ class: __index__ }= articleadded:spec/fixtures/partials/article.html.haml+6 added
1+:if __isFirst__2+ %li.first= article3+:if __isLast__4+ %li.last= article5+:if !__isLast__ && !__isFirst__6+ %li{ class: __index__ }= articledeleted:spec/fixtures/partials/item.haml.html-1 removed
1-%li= itemadded:spec/fixtures/partials/item.html.haml+1 added
1+%li= itemdeleted:spec/fixtures/partials/video.haml.html-1 removed
1-%li= vidadded:spec/fixtures/partials/video.html.haml+1 added
1+%li= viddeleted:spec/fixtures/article.haml.html-1 removed
1-%h2= this.nameadded:spec/fixtures/article.html.haml+1 added
1+%h2= this.namedeleted:spec/fixtures/hello.haml.html-1 removed
1-%h2 Helloadded:spec/fixtures/hello.html.haml+1 added
1+%h2 Hellodeleted:spec/fixtures/layout.haml.html-2 removed
1-%html2- %body= bodyadded:spec/fixtures/layout.html.haml+2 added
1+%html2+ %body= bodydeleted:spec/fixtures/layout.user.haml.html-2 removed
1-%title= "Viewing " + name2-%body= bodyadded:spec/fixtures/layout.user.html.haml+2 added
1+%title= "Viewing " + name2+%body= bodydeleted:spec/fixtures/list.haml.html-3 removed
1-%ul2- :each item in items3- = this.partial('item.haml.html', { locals: { item: item }})added:spec/fixtures/list.html.haml+3 added
1+%ul2+ :each item in items3+ = this.partial('item.html.haml', { locals: { item: item }})deleted:spec/fixtures/page.haml.html-2 removed
1-%title= this.title2-%body= bodyadded:spec/fixtures/page.html.haml+2 added
1+%title= this.title2+%body= bodydeleted:spec/fixtures/user.haml.html-2 removed
1-%h1= name2-%p= emailadded:spec/fixtures/user.html.haml+2 added
1+%h1= name2+%p= emailadded:spec/fixtures/user.html.invalid
deleted:spec/fixtures/user.invalid.html
modified:spec/spec.plugins.view.js+15 added-15 removed
28 unmodified lines29 30 describe 'given a valid view name'31 it 'should render a partial'32 get('/', function(){33- this.render('list.haml.html', { locals: { items: ['foo', 'bar'] }})33+ this.render('list.html.haml', { locals: { items: ['foo', 'bar'] }})34 })35 get('/').body.should.include '<ul>'36 get('/').body.should.include '<li>foo'37 get('/').body.should.include '<li>bar'38 end39 40 it 'should render collections'41 get('/', function(){42- return this.partial('item.haml.html', {42+ return this.partial('item.html.haml', {43 collection: ['foo', 'bar']44 })45 })46 get('/').body.should.include '<li>foo'1 unmodified line48 end49 50 it 'should render collections with a given object name'51 get('/', function(){52- return this.partial('video.haml.html', {52+ return this.partial('video.html.haml', {53 collection: ['im a movie', 'im another movie'],54 as: 'vid'55 })56 })2 unmodified lines59 end60 61 it 'should pass __isFirst__, __isLast__, and __index__ to partials as locals'62 get('/', function(){63- return this.partial('article.haml.html', {63+ return this.partial('article.html.haml', {64 collection: ['a', 'b', 'c']65 })66 })67 get('/').body.should.include '<li class="first">a'10 unmodified lines78 79 describe 'given a callback'80 it 'should be passed the rendered content'81 get('/', function(){82- this.render('hello.haml.html', {}, function(err, content){82+ this.render('hello.html.haml', {}, function(err, content){83 if (err) this.error(err)84 else this.halt(203, content)85 })86 })5 unmodified lines92 describe 'given a valid view name'93 describe 'and layout of the same type exists'94 it 'should render the layout and view'95 get('/', function(){96- this.render('hello.haml.html')96+ this.render('hello.html.haml')97 })98 get('/').body.should.include '<html><body>'99 get('/').body.should.include '<h2>Hello'100 end101 102 it 'should default context to the current request'103 get('/', function(){104 this.title = 'Welcome'105- this.render('page.haml.html', { layout: false })105+ this.render('page.html.haml', { layout: false })106 })107 get('/').body.should.include '<title>Welcome'108 end109 110 it 'should set the content type based on the last path segment'111 get('/', function(){112- this.render('hello.haml.html')112+ this.render('hello.html.haml')113 })114 get('/').headers['content-type'].should.eql 'text/html'115 end116 end117 118 describe 'and layout of the same type does not exist'119 it 'should throw an error'120 get('/', function(){121- this.render('hello.haml.html', { layout: 'front' })121+ this.render('hello.html.haml', { layout: 'front' })122 })123 -{ get('/') }.should.throw_error 'No such file or directory'124 end125 end1 unmodified line127 describe 'given a custom layout name'128 it 'should render the layout and view'129 get('/', function(){130 this.title = 'Express'131- this.render('hello.haml.html', { layout: 'page' })131+ this.render('hello.html.haml', { layout: 'page' })132 })133 get('/').body.should.include '<title>Express'134 get('/').body.should.include '<h2>Hello'135 end1 unmodified line137 138 describe 'when layout: false'139 it 'should render the view only'140 get('/', function(){141- this.render('hello.haml.html', { layout: false })141+ this.render('hello.html.haml', { layout: false })142 })143 get('/').body.should.not.include '<body>'144 get('/').body.should.include '<h2>Hello'145 end1 unmodified line147 148 describe 'when engine cannot be found'149 it 'should throw an error'150 get('/', function(){151- this.render('user.invalid.html')151+ this.render('user.html.invalid')152 })153 -{ get('/') }.should.throw_error "Cannot find module 'invalid'"154 end155 end156 157 describe 'when locals are passed'158 it 'should have direct access to locals'159 get('/user', function(){160- this.render('user.haml.html', {160+ this.render('user.html.haml', {161 locals: {162 name: 'tj',163 email: 'tj@vision-media.ca'164 }4 unmodified lines169 end170 171 it 'should have direct access to locals within the layout'172 get('/user', function(){173- this.render('user.haml.html', {173+ this.render('user.html.haml', {174 layout: 'layout.user',175 locals: {176 name: 'tj',177 email: 'tj@vision-media.ca'8 unmodified lines186 187 describe 'when context is passed'188 it 'should evaluate in context to that object'189 get('/article', function(){190- this.render('article.haml.html', {190+ this.render('article.html.haml', {191 context: {192 name: 'Writing a Node.js Web Application'193 }194 })10 unmodified lines