├── .gitignore ├── LICENSE ├── README.md ├── chapter-01 ├── .editorconfig ├── .gitignore ├── app.js ├── bin │ └── www ├── package.json ├── public │ └── stylesheets │ │ ├── style.css │ │ ├── style.css.map │ │ └── style.sass └── server │ ├── config │ ├── config.js │ └── passport.js │ ├── controllers │ └── comments.js │ ├── models │ ├── comments.js │ └── users.js │ ├── routes │ ├── comments.js │ ├── index.js │ └── users.js │ └── views │ ├── pages │ ├── comments.ejs │ ├── error.ejs │ ├── index.ejs │ ├── login.ejs │ ├── profile.ejs │ └── signup.ejs │ └── partials │ ├── footer.ejs │ ├── header.ejs │ ├── javascript.ejs │ └── stylesheet.ejs ├── chapter-02 ├── .gitignore ├── .sequelizerc ├── app.js ├── bin │ └── www ├── config │ ├── config.json │ └── migrations │ │ ├── 20160319100145-create-user.js │ │ └── 20160319101806-create-band.js ├── controllers │ ├── band.js │ ├── index.js │ └── user.js ├── models │ ├── band.js │ ├── index.js │ └── user.js ├── mvc_mysql_app.sql ├── package.json ├── public │ └── stylesheets │ │ └── style.css └── views │ ├── pages │ ├── band-list.html │ ├── error.html │ ├── index.html │ └── layout.html │ └── partials │ ├── footer.html │ └── head.html ├── chapter-03 ├── .editorconfig ├── .gitignore ├── app.js ├── package.json ├── public │ ├── images │ │ └── image-placeholder.jpg │ ├── javascripts │ │ ├── bootstrap.min.js │ │ └── jquery.min.js │ ├── stylesheets │ │ ├── bootstrap.min.css │ │ ├── style.css │ │ ├── style.css.map │ │ └── style.sass │ └── videos │ │ ├── sample.mp4 │ │ └── sample.webm └── server │ ├── config │ ├── config.js │ └── passport.js │ ├── controllers │ ├── auth.js │ ├── comments.js │ ├── images.js │ ├── index.js │ └── videos.js │ ├── models │ ├── comments.js │ ├── images.js │ ├── users.js │ └── videos.js │ └── views │ ├── pages │ ├── comments.ejs │ ├── error.ejs │ ├── images-gallery.ejs │ ├── index.ejs │ ├── login.ejs │ ├── profile.ejs │ ├── signup.ejs │ └── videos.ejs │ └── partials │ ├── footer.ejs │ ├── header.ejs │ ├── javascript.ejs │ └── stylesheet.ejs ├── chapter-04 ├── .bowerrc ├── .editorconfig ├── .env ├── .gitignore ├── app.js ├── app │ ├── controllers │ │ ├── books.js │ │ └── home.js │ ├── models │ │ ├── article.js │ │ └── book.js │ └── views │ │ ├── book │ │ ├── add-photo.swig │ │ ├── books.swig │ │ └── posted-photo.swig │ │ ├── error.swig │ │ ├── index.swig │ │ └── layout.swig ├── bower.json ├── config │ ├── config.js │ ├── env.js │ └── express.js ├── gulpfile.js ├── package.json └── public │ └── css │ └── style.css ├── chapter-05 ├── .bowerrc ├── .editorconfig ├── .gitignore ├── README.md ├── app.js ├── app │ ├── controllers │ │ ├── home.js │ │ └── locations.js │ ├── models │ │ ├── article.js │ │ ├── location.js │ │ └── store.js │ └── views │ │ ├── pages │ │ ├── add-location.html │ │ ├── error.html │ │ ├── index.html │ │ ├── layout.html │ │ └── locations.html │ │ └── partials │ │ ├── footer.html │ │ └── head.html ├── bower.json ├── config │ ├── config.js │ └── express.js ├── gulpfile.js ├── locations.json ├── package.json └── public │ ├── css │ └── style.css │ ├── images │ ├── pin-off.png │ └── pin.png │ └── js │ └── getCurrentPosition.js ├── chapter-06 ├── .editorconfig ├── .gitignore ├── .jshintignore ├── .jshintrc ├── .yo-rc.json ├── client │ ├── README.md │ ├── images │ │ ├── heritage.jpg │ │ └── knucklehead.jpg │ ├── index.html │ └── js │ │ ├── motorcycles.js │ │ └── reviews.js ├── common │ └── models │ │ ├── motorcycle.js │ │ ├── motorcycle.json │ │ ├── review.js │ │ └── review.json ├── package.json └── server │ ├── boot │ ├── _root.js │ └── create-sample-models.js │ ├── component-config.json │ ├── config.json │ ├── datasources.json │ ├── middleware.json │ ├── middleware.production.json │ ├── model-config.json │ └── server.js ├── chapter-07 ├── .bowerrc ├── .editorconfig ├── .gitignore ├── app.js ├── bower.json ├── gulpfile.js ├── package.json ├── public │ ├── css │ │ └── style.css │ └── js │ │ └── main.js ├── routes │ └── index.js └── views │ ├── error.ejs │ ├── footer.ejs │ ├── header.ejs │ └── index.ejs ├── chapter-08 ├── .editorconfig ├── .gitignore ├── Procfile ├── gulpfile.js ├── keystone.js ├── models │ ├── About.js │ ├── Enquiry.js │ ├── Gallery.js │ ├── Post.js │ ├── PostCategory.js │ └── UserAdmin.js ├── package.json ├── public │ ├── favicon.ico │ ├── fonts │ │ └── bootstrap │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ ├── glyphicons-halflings-regular.svg │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ └── glyphicons-halflings-regular.woff2 │ ├── images │ │ ├── header-bg-1920x1440.jpg │ │ ├── logo-email.gif │ │ └── logo.svg │ ├── js │ │ ├── bootstrap │ │ │ ├── affix.js │ │ │ ├── alert.js │ │ │ ├── bootstrap-3.3.5.js │ │ │ ├── bootstrap-3.3.5.min.js │ │ │ ├── button.js │ │ │ ├── carousel.js │ │ │ ├── collapse.js │ │ │ ├── dropdown.js │ │ │ ├── modal.js │ │ │ ├── npm.js │ │ │ ├── popover.js │ │ │ ├── scrollspy.js │ │ │ ├── tab.js │ │ │ ├── tooltip.js │ │ │ └── transition.js │ │ ├── jquery │ │ │ ├── jquery-1.11.3.js │ │ │ ├── jquery-1.11.3.min.js │ │ │ ├── jquery-2.1.4.js │ │ │ └── jquery-2.1.4.min.js │ │ └── scripts.js │ └── styles │ │ ├── bootstrap │ │ ├── _bootstrap-compass.scss │ │ ├── _bootstrap-mincer.scss │ │ ├── _bootstrap-sprockets.scss │ │ ├── _bootstrap.scss │ │ ├── _bootswatch.scss │ │ └── bootstrap │ │ │ ├── _alerts.scss │ │ │ ├── _badges.scss │ │ │ ├── _breadcrumbs.scss │ │ │ ├── _button-groups.scss │ │ │ ├── _buttons.scss │ │ │ ├── _carousel.scss │ │ │ ├── _close.scss │ │ │ ├── _code.scss │ │ │ ├── _component-animations.scss │ │ │ ├── _dropdowns.scss │ │ │ ├── _forms.scss │ │ │ ├── _glyphicons.scss │ │ │ ├── _grid.scss │ │ │ ├── _input-groups.scss │ │ │ ├── _jumbotron.scss │ │ │ ├── _labels.scss │ │ │ ├── _list-group.scss │ │ │ ├── _media.scss │ │ │ ├── _mixins.scss │ │ │ ├── _modals.scss │ │ │ ├── _navbar.scss │ │ │ ├── _navs.scss │ │ │ ├── _normalize.scss │ │ │ ├── _pager.scss │ │ │ ├── _pagination.scss │ │ │ ├── _panels.scss │ │ │ ├── _popovers.scss │ │ │ ├── _print.scss │ │ │ ├── _progress-bars.scss │ │ │ ├── _responsive-embed.scss │ │ │ ├── _responsive-utilities.scss │ │ │ ├── _scaffolding.scss │ │ │ ├── _tables.scss │ │ │ ├── _theme.scss │ │ │ ├── _theme_variables.scss │ │ │ ├── _thumbnails.scss │ │ │ ├── _tooltip.scss │ │ │ ├── _type.scss │ │ │ ├── _utilities.scss │ │ │ ├── _variables.scss │ │ │ ├── _wells.scss │ │ │ └── mixins │ │ │ ├── _alerts.scss │ │ │ ├── _background-variant.scss │ │ │ ├── _border-radius.scss │ │ │ ├── _buttons.scss │ │ │ ├── _center-block.scss │ │ │ ├── _clearfix.scss │ │ │ ├── _forms.scss │ │ │ ├── _gradients.scss │ │ │ ├── _grid-framework.scss │ │ │ ├── _grid.scss │ │ │ ├── _hide-text.scss │ │ │ ├── _image.scss │ │ │ ├── _labels.scss │ │ │ ├── _list-group.scss │ │ │ ├── _nav-divider.scss │ │ │ ├── _nav-vertical-align.scss │ │ │ ├── _opacity.scss │ │ │ ├── _pagination.scss │ │ │ ├── _panels.scss │ │ │ ├── _progress-bar.scss │ │ │ ├── _reset-filter.scss │ │ │ ├── _reset-text.scss │ │ │ ├── _resize.scss │ │ │ ├── _responsive-visibility.scss │ │ │ ├── _size.scss │ │ │ ├── _tab-focus.scss │ │ │ ├── _table-row.scss │ │ │ ├── _text-emphasis.scss │ │ │ ├── _text-overflow.scss │ │ │ └── _vendor-prefixes.scss │ │ ├── site.css │ │ ├── site.scss │ │ └── site │ │ ├── _layout.scss │ │ ├── _mixins.scss │ │ └── _variables.scss ├── routes │ ├── emails.js │ ├── index.js │ ├── middleware.js │ └── views │ │ ├── about.js │ │ ├── blog.js │ │ ├── contact.js │ │ ├── gallery.js │ │ ├── index.js │ │ └── post.js ├── templates │ └── themes │ │ ├── default │ │ ├── emails │ │ │ └── enquiry-notification.swig │ │ ├── layouts │ │ │ └── default.swig │ │ ├── mixins │ │ │ └── flash-messages.swig │ │ └── views │ │ │ ├── blog.swig │ │ │ ├── contact.swig │ │ │ ├── errors │ │ │ ├── 404.swig │ │ │ └── 500.swig │ │ │ ├── gallery.swig │ │ │ ├── index.swig │ │ │ └── post.swig │ │ └── newBlog │ │ ├── emails │ │ └── enquiry-notification.swig │ │ ├── layouts │ │ └── default.swig │ │ ├── mixins │ │ └── flash-messages.swig │ │ └── views │ │ ├── about.swig │ │ ├── blog.swig │ │ ├── contact.swig │ │ ├── errors │ │ ├── 404.swig │ │ └── 500.swig │ │ ├── gallery.swig │ │ ├── index.swig │ │ └── post.swig └── updates │ └── 0.0.1-admins.js ├── chapter-09 ├── .bowerrc ├── .editorconfig ├── .eslintignore ├── .eslintrc ├── .eslintrc.json ├── .gitignore ├── .yo-rc.json ├── Procfile ├── arc-manager.json ├── bin │ └── deploy.sh ├── bower.json ├── client │ ├── README.md │ ├── components │ │ ├── bootstrap │ │ │ ├── .bower.json │ │ │ ├── CHANGELOG.md │ │ │ ├── Gemfile │ │ │ ├── Gemfile.lock │ │ │ ├── Gruntfile.js │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── bower.json │ │ │ ├── dist │ │ │ │ ├── css │ │ │ │ │ ├── bootstrap.css │ │ │ │ │ ├── bootstrap.css.map │ │ │ │ │ ├── bootstrap.min.css │ │ │ │ │ └── bootstrap.min.css.map │ │ │ │ └── js │ │ │ │ │ ├── bootstrap.js │ │ │ │ │ ├── bootstrap.min.js │ │ │ │ │ ├── npm.js │ │ │ │ │ └── umd │ │ │ │ │ ├── alert.js │ │ │ │ │ ├── button.js │ │ │ │ │ ├── carousel.js │ │ │ │ │ ├── collapse.js │ │ │ │ │ ├── dropdown.js │ │ │ │ │ ├── modal.js │ │ │ │ │ ├── popover.js │ │ │ │ │ ├── scrollspy.js │ │ │ │ │ ├── tab.js │ │ │ │ │ ├── tooltip.js │ │ │ │ │ └── util.js │ │ │ ├── grunt │ │ │ │ ├── .jshintrc │ │ │ │ ├── bs-commonjs-generator.js │ │ │ │ ├── bs-sass-compile │ │ │ │ │ ├── libsass.js │ │ │ │ │ └── sass.js │ │ │ │ ├── configBridge.json │ │ │ │ └── sauce_browsers.yml │ │ │ ├── js │ │ │ │ ├── .eslintrc │ │ │ │ ├── .jscsrc │ │ │ │ ├── dist │ │ │ │ │ ├── alert.js │ │ │ │ │ ├── alert.js.map │ │ │ │ │ ├── button.js │ │ │ │ │ ├── button.js.map │ │ │ │ │ ├── carousel.js │ │ │ │ │ ├── carousel.js.map │ │ │ │ │ ├── collapse.js │ │ │ │ │ ├── collapse.js.map │ │ │ │ │ ├── dropdown.js │ │ │ │ │ ├── dropdown.js.map │ │ │ │ │ ├── modal.js │ │ │ │ │ ├── modal.js.map │ │ │ │ │ ├── popover.js │ │ │ │ │ ├── popover.js.map │ │ │ │ │ ├── scrollspy.js │ │ │ │ │ ├── scrollspy.js.map │ │ │ │ │ ├── tab.js │ │ │ │ │ ├── tab.js.map │ │ │ │ │ ├── tooltip.js │ │ │ │ │ ├── tooltip.js.map │ │ │ │ │ ├── util.js │ │ │ │ │ └── util.js.map │ │ │ │ └── src │ │ │ │ │ ├── alert.js │ │ │ │ │ ├── button.js │ │ │ │ │ ├── carousel.js │ │ │ │ │ ├── collapse.js │ │ │ │ │ ├── dropdown.js │ │ │ │ │ ├── modal.js │ │ │ │ │ ├── popover.js │ │ │ │ │ ├── scrollspy.js │ │ │ │ │ ├── tab.js │ │ │ │ │ ├── tooltip.js │ │ │ │ │ └── util.js │ │ │ ├── package.js │ │ │ ├── package.json │ │ │ ├── sache.json │ │ │ └── scss │ │ │ │ ├── .csscomb.json │ │ │ │ ├── .scsslint.yml │ │ │ │ ├── _alert.scss │ │ │ │ ├── _animation.scss │ │ │ │ ├── _breadcrumb.scss │ │ │ │ ├── _button-group.scss │ │ │ │ ├── _buttons.scss │ │ │ │ ├── _card.scss │ │ │ │ ├── _carousel.scss │ │ │ │ ├── _close.scss │ │ │ │ ├── _code.scss │ │ │ │ ├── _custom-forms.scss │ │ │ │ ├── _dropdown.scss │ │ │ │ ├── _forms.scss │ │ │ │ ├── _grid.scss │ │ │ │ ├── _images.scss │ │ │ │ ├── _input-group.scss │ │ │ │ ├── _jumbotron.scss │ │ │ │ ├── _labels.scss │ │ │ │ ├── _list-group.scss │ │ │ │ ├── _media.scss │ │ │ │ ├── _mixins.scss │ │ │ │ ├── _modal.scss │ │ │ │ ├── _nav.scss │ │ │ │ ├── _navbar.scss │ │ │ │ ├── _normalize.scss │ │ │ │ ├── _pager.scss │ │ │ │ ├── _pagination.scss │ │ │ │ ├── _popover.scss │ │ │ │ ├── _print.scss │ │ │ │ ├── _progress.scss │ │ │ │ ├── _reboot.scss │ │ │ │ ├── _responsive-embed.scss │ │ │ │ ├── _tables.scss │ │ │ │ ├── _tooltip.scss │ │ │ │ ├── _type.scss │ │ │ │ ├── _utilities-responsive.scss │ │ │ │ ├── _utilities-spacing.scss │ │ │ │ ├── _utilities.scss │ │ │ │ ├── _variables.scss │ │ │ │ ├── bootstrap-flex.scss │ │ │ │ ├── bootstrap-grid.scss │ │ │ │ ├── bootstrap-reboot.scss │ │ │ │ ├── bootstrap.scss │ │ │ │ └── mixins │ │ │ │ ├── _alert.scss │ │ │ │ ├── _background-variant.scss │ │ │ │ ├── _border-radius.scss │ │ │ │ ├── _breakpoints.scss │ │ │ │ ├── _buttons.scss │ │ │ │ ├── _center-block.scss │ │ │ │ ├── _clearfix.scss │ │ │ │ ├── _forms.scss │ │ │ │ ├── _gradients.scss │ │ │ │ ├── _grid-framework.scss │ │ │ │ ├── _grid.scss │ │ │ │ ├── _hide-text.scss │ │ │ │ ├── _hover.scss │ │ │ │ ├── _image.scss │ │ │ │ ├── _label.scss │ │ │ │ ├── _list-group.scss │ │ │ │ ├── _nav-divider.scss │ │ │ │ ├── _navbar-align.scss │ │ │ │ ├── _pagination.scss │ │ │ │ ├── _progress.scss │ │ │ │ ├── _pulls.scss │ │ │ │ ├── _reset-filter.scss │ │ │ │ ├── _reset-text.scss │ │ │ │ ├── _resize.scss │ │ │ │ ├── _responsive-visibility.scss │ │ │ │ ├── _screen-reader.scss │ │ │ │ ├── _size.scss │ │ │ │ ├── _tab-focus.scss │ │ │ │ ├── _table-row.scss │ │ │ │ ├── _text-emphasis.scss │ │ │ │ └── _text-truncate.scss │ │ ├── fancybox │ │ │ ├── .bower.json │ │ │ ├── .gitattributes │ │ │ ├── CHANGELOG.md │ │ │ ├── README.md │ │ │ ├── demo │ │ │ │ ├── 1_b.jpg │ │ │ │ ├── 1_s.jpg │ │ │ │ ├── 2_b.jpg │ │ │ │ ├── 2_s.jpg │ │ │ │ ├── 3_b.jpg │ │ │ │ ├── 3_s.jpg │ │ │ │ ├── 4_b.jpg │ │ │ │ ├── 4_s.jpg │ │ │ │ ├── 5_b.jpg │ │ │ │ ├── 5_s.jpg │ │ │ │ ├── ajax.txt │ │ │ │ ├── iframe.html │ │ │ │ └── index.html │ │ │ ├── lib │ │ │ │ ├── jquery-1.10.1.min.js │ │ │ │ ├── jquery-1.9.0.min.js │ │ │ │ └── jquery.mousewheel-3.0.6.pack.js │ │ │ ├── source │ │ │ │ ├── blank.gif │ │ │ │ ├── fancybox_loading.gif │ │ │ │ ├── fancybox_loading@2x.gif │ │ │ │ ├── fancybox_overlay.png │ │ │ │ ├── fancybox_sprite.png │ │ │ │ ├── fancybox_sprite@2x.png │ │ │ │ ├── helpers │ │ │ │ │ ├── fancybox_buttons.png │ │ │ │ │ ├── jquery.fancybox-buttons.css │ │ │ │ │ ├── jquery.fancybox-buttons.js │ │ │ │ │ ├── jquery.fancybox-media.js │ │ │ │ │ ├── jquery.fancybox-thumbs.css │ │ │ │ │ └── jquery.fancybox-thumbs.js │ │ │ │ ├── jquery.fancybox.css │ │ │ │ ├── jquery.fancybox.js │ │ │ │ └── jquery.fancybox.pack.js │ │ │ └── sprite.psd │ │ ├── jquery │ │ │ ├── .bower.json │ │ │ ├── AUTHORS.txt │ │ │ ├── LICENSE.txt │ │ │ ├── README.md │ │ │ ├── bower.json │ │ │ ├── dist │ │ │ │ ├── jquery.js │ │ │ │ ├── jquery.min.js │ │ │ │ └── jquery.min.map │ │ │ ├── external │ │ │ │ └── sizzle │ │ │ │ │ ├── LICENSE.txt │ │ │ │ │ └── dist │ │ │ │ │ ├── sizzle.js │ │ │ │ │ ├── sizzle.min.js │ │ │ │ │ └── sizzle.min.map │ │ │ └── src │ │ │ │ ├── .jshintrc │ │ │ │ ├── ajax.js │ │ │ │ ├── ajax │ │ │ │ ├── jsonp.js │ │ │ │ ├── load.js │ │ │ │ ├── parseJSON.js │ │ │ │ ├── parseXML.js │ │ │ │ ├── script.js │ │ │ │ ├── var │ │ │ │ │ ├── location.js │ │ │ │ │ ├── nonce.js │ │ │ │ │ └── rquery.js │ │ │ │ └── xhr.js │ │ │ │ ├── attributes.js │ │ │ │ ├── attributes │ │ │ │ ├── attr.js │ │ │ │ ├── classes.js │ │ │ │ ├── prop.js │ │ │ │ ├── support.js │ │ │ │ └── val.js │ │ │ │ ├── callbacks.js │ │ │ │ ├── core.js │ │ │ │ ├── core │ │ │ │ ├── access.js │ │ │ │ ├── init.js │ │ │ │ ├── parseHTML.js │ │ │ │ ├── ready.js │ │ │ │ └── var │ │ │ │ │ └── rsingleTag.js │ │ │ │ ├── css.js │ │ │ │ ├── css │ │ │ │ ├── addGetHookIf.js │ │ │ │ ├── adjustCSS.js │ │ │ │ ├── curCSS.js │ │ │ │ ├── defaultDisplay.js │ │ │ │ ├── hiddenVisibleSelectors.js │ │ │ │ ├── showHide.js │ │ │ │ ├── support.js │ │ │ │ └── var │ │ │ │ │ ├── cssExpand.js │ │ │ │ │ ├── getStyles.js │ │ │ │ │ ├── isHidden.js │ │ │ │ │ ├── rmargin.js │ │ │ │ │ ├── rnumnonpx.js │ │ │ │ │ └── swap.js │ │ │ │ ├── data.js │ │ │ │ ├── data │ │ │ │ ├── Data.js │ │ │ │ └── var │ │ │ │ │ ├── acceptData.js │ │ │ │ │ ├── dataPriv.js │ │ │ │ │ └── dataUser.js │ │ │ │ ├── deferred.js │ │ │ │ ├── deprecated.js │ │ │ │ ├── dimensions.js │ │ │ │ ├── effects.js │ │ │ │ ├── effects │ │ │ │ ├── Tween.js │ │ │ │ └── animatedSelector.js │ │ │ │ ├── event.js │ │ │ │ ├── event │ │ │ │ ├── ajax.js │ │ │ │ ├── alias.js │ │ │ │ ├── focusin.js │ │ │ │ ├── support.js │ │ │ │ └── trigger.js │ │ │ │ ├── exports │ │ │ │ ├── amd.js │ │ │ │ └── global.js │ │ │ │ ├── intro.js │ │ │ │ ├── jquery.js │ │ │ │ ├── manipulation.js │ │ │ │ ├── manipulation │ │ │ │ ├── _evalUrl.js │ │ │ │ ├── buildFragment.js │ │ │ │ ├── getAll.js │ │ │ │ ├── setGlobalEval.js │ │ │ │ ├── support.js │ │ │ │ ├── var │ │ │ │ │ ├── rcheckableType.js │ │ │ │ │ ├── rscriptType.js │ │ │ │ │ └── rtagName.js │ │ │ │ └── wrapMap.js │ │ │ │ ├── offset.js │ │ │ │ ├── outro.js │ │ │ │ ├── queue.js │ │ │ │ ├── queue │ │ │ │ └── delay.js │ │ │ │ ├── selector-native.js │ │ │ │ ├── selector-sizzle.js │ │ │ │ ├── selector.js │ │ │ │ ├── serialize.js │ │ │ │ ├── traversing.js │ │ │ │ ├── traversing │ │ │ │ ├── findFilter.js │ │ │ │ └── var │ │ │ │ │ ├── dir.js │ │ │ │ │ ├── rneedsContext.js │ │ │ │ │ └── siblings.js │ │ │ │ ├── var │ │ │ │ ├── arr.js │ │ │ │ ├── class2type.js │ │ │ │ ├── concat.js │ │ │ │ ├── document.js │ │ │ │ ├── documentElement.js │ │ │ │ ├── hasOwn.js │ │ │ │ ├── indexOf.js │ │ │ │ ├── pnum.js │ │ │ │ ├── push.js │ │ │ │ ├── rcssNum.js │ │ │ │ ├── rnotwhite.js │ │ │ │ ├── slice.js │ │ │ │ ├── support.js │ │ │ │ └── toString.js │ │ │ │ └── wrap.js │ │ └── react │ │ │ ├── .bower.json │ │ │ ├── LICENSE │ │ │ ├── PATENTS │ │ │ ├── bower.json │ │ │ ├── react-dom-server.js │ │ │ ├── react-dom-server.min.js │ │ │ ├── react-dom.js │ │ │ ├── react-dom.min.js │ │ │ ├── react-with-addons.js │ │ │ ├── react-with-addons.min.js │ │ │ ├── react.js │ │ │ └── react.min.js │ ├── css │ │ └── main.css │ ├── images │ │ └── gallery │ │ │ ├── sample-car-gallery.jpg │ │ │ ├── sample-car1.jpg │ │ │ ├── sample-car2.jpg │ │ │ ├── sample-car3.jpg │ │ │ ├── sample-moto-gallery.jpg │ │ │ ├── sample-moto1.jpg │ │ │ ├── sample-moto2.jpg │ │ │ ├── sample-moto3.jpg │ │ │ └── src │ │ │ ├── sample-car-gallery.jpg │ │ │ ├── sample-car1.jpg │ │ │ ├── sample-car2.jpg │ │ │ ├── sample-car3.jpg │ │ │ ├── sample-moto-gallery.jpg │ │ │ ├── sample-moto1.jpg │ │ │ ├── sample-moto2.jpg │ │ │ └── sample-moto3.jpg │ ├── index.html │ ├── js │ │ ├── app.config.js │ │ ├── app.js │ │ ├── app.routes.js │ │ ├── controllers.js │ │ ├── libs │ │ │ ├── angular-resource.js │ │ │ ├── angular-ui-router.js │ │ │ ├── angular.js │ │ │ ├── jquery.js │ │ │ └── libs.js │ │ ├── scripts │ │ │ └── scripts.js │ │ └── services.js │ └── views │ │ ├── galleries.html │ │ └── home.html ├── common │ └── models │ │ ├── bike.js │ │ ├── bike.json │ │ ├── gallery.js │ │ └── gallery.json ├── package.json ├── server │ ├── boot │ │ ├── _root.js │ │ └── create-sample-models.js │ ├── component-config.json │ ├── config.json │ ├── datasources.json │ ├── middleware.json │ ├── middleware.production.json │ ├── model-config.json │ └── server.js └── src │ ├── images │ └── gallery │ │ ├── sample-car-gallery.jpg │ │ ├── sample-car1.jpg │ │ ├── sample-car2.jpg │ │ ├── sample-car3.jpg │ │ ├── sample-moto-gallery.jpg │ │ ├── sample-moto1.jpg │ │ ├── sample-moto2.jpg │ │ └── sample-moto3.jpg │ ├── libs │ ├── bootstrap.js │ ├── jquery.fancybox.js │ └── jquery.fancybox.pack.js │ ├── scripts │ └── gallery.js │ └── scss │ ├── main.scss │ └── vendor │ ├── .csscomb.json │ ├── .scsslint.yml │ ├── _alert.scss │ ├── _animation.scss │ ├── _breadcrumb.scss │ ├── _button-group.scss │ ├── _buttons.scss │ ├── _card.scss │ ├── _carousel.scss │ ├── _close.scss │ ├── _code.scss │ ├── _custom-forms.scss │ ├── _dropdown.scss │ ├── _forms.scss │ ├── _grid.scss │ ├── _images.scss │ ├── _input-group.scss │ ├── _jumbotron.scss │ ├── _labels.scss │ ├── _list-group.scss │ ├── _media.scss │ ├── _mixins.scss │ ├── _modal.scss │ ├── _nav.scss │ ├── _navbar.scss │ ├── _normalize.scss │ ├── _pager.scss │ ├── _pagination.scss │ ├── _popover.scss │ ├── _print.scss │ ├── _progress.scss │ ├── _reboot.scss │ ├── _responsive-embed.scss │ ├── _tables.scss │ ├── _tooltip.scss │ ├── _type.scss │ ├── _utilities-responsive.scss │ ├── _utilities-spacing.scss │ ├── _utilities.scss │ ├── _variables.scss │ ├── bootstrap-flex.scss │ ├── bootstrap-grid.scss │ ├── bootstrap-reboot.scss │ ├── bootstrap.scss │ └── mixins │ ├── _alert.scss │ ├── _background-variant.scss │ ├── _border-radius.scss │ ├── _breakpoints.scss │ ├── _buttons.scss │ ├── _center-block.scss │ ├── _clearfix.scss │ ├── _forms.scss │ ├── _gradients.scss │ ├── _grid-framework.scss │ ├── _grid.scss │ ├── _hide-text.scss │ ├── _hover.scss │ ├── _image.scss │ ├── _label.scss │ ├── _list-group.scss │ ├── _nav-divider.scss │ ├── _navbar-align.scss │ ├── _pagination.scss │ ├── _progress.scss │ ├── _pulls.scss │ ├── _reset-filter.scss │ ├── _reset-text.scss │ ├── _resize.scss │ ├── _responsive-visibility.scss │ ├── _screen-reader.scss │ ├── _size.scss │ ├── _tab-focus.scss │ ├── _table-row.scss │ ├── _text-emphasis.scss │ └── _text-truncate.scss └── chapter-10 ├── .env ├── .gitignore ├── Dockerfile ├── Procfile ├── config └── passport.js ├── controllers ├── home.js └── user.js ├── docker-compose.yml ├── models └── User.js ├── package.json ├── public ├── css │ ├── main.css │ ├── main.scss │ └── vendor │ │ ├── _bootstrap.scss │ │ └── bootstrap │ │ ├── _alerts.scss │ │ ├── _badges.scss │ │ ├── _breadcrumbs.scss │ │ ├── _button-groups.scss │ │ ├── _buttons.scss │ │ ├── _carousel.scss │ │ ├── _close.scss │ │ ├── _code.scss │ │ ├── _component-animations.scss │ │ ├── _dropdowns.scss │ │ ├── _forms.scss │ │ ├── _glyphicons.scss │ │ ├── _grid.scss │ │ ├── _input-groups.scss │ │ ├── _jumbotron.scss │ │ ├── _labels.scss │ │ ├── _list-group.scss │ │ ├── _media.scss │ │ ├── _mixins.scss │ │ ├── _modals.scss │ │ ├── _navbar.scss │ │ ├── _navs.scss │ │ ├── _normalize.scss │ │ ├── _pager.scss │ │ ├── _pagination.scss │ │ ├── _panels.scss │ │ ├── _popovers.scss │ │ ├── _print.scss │ │ ├── _progress-bars.scss │ │ ├── _responsive-embed.scss │ │ ├── _responsive-utilities.scss │ │ ├── _scaffolding.scss │ │ ├── _tables.scss │ │ ├── _theme.scss │ │ ├── _thumbnails.scss │ │ ├── _tooltip.scss │ │ ├── _type.scss │ │ ├── _utilities.scss │ │ ├── _variables.scss │ │ ├── _wells.scss │ │ └── mixins │ │ ├── _alerts.scss │ │ ├── _background-variant.scss │ │ ├── _border-radius.scss │ │ ├── _buttons.scss │ │ ├── _center-block.scss │ │ ├── _clearfix.scss │ │ ├── _forms.scss │ │ ├── _gradients.scss │ │ ├── _grid-framework.scss │ │ ├── _grid.scss │ │ ├── _hide-text.scss │ │ ├── _image.scss │ │ ├── _labels.scss │ │ ├── _list-group.scss │ │ ├── _nav-divider.scss │ │ ├── _nav-vertical-align.scss │ │ ├── _opacity.scss │ │ ├── _pagination.scss │ │ ├── _panels.scss │ │ ├── _progress-bar.scss │ │ ├── _reset-filter.scss │ │ ├── _reset-text.scss │ │ ├── _resize.scss │ │ ├── _responsive-visibility.scss │ │ ├── _size.scss │ │ ├── _tab-focus.scss │ │ ├── _table-row.scss │ │ ├── _text-emphasis.scss │ │ ├── _text-overflow.scss │ │ └── _vendor-prefixes.scss ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 └── js │ ├── lib │ ├── bootstrap.js │ └── jquery.js │ └── main.js ├── server.js ├── test └── app.test.js └── views ├── layouts └── main.html ├── pages ├── home.html ├── login.html ├── profile.html └── signup.html └── partials ├── footer.html └── header.html /chapter-01/.editorconfig: -------------------------------------------------------------------------------- 1 | 2 | # http://editorconfig.org 3 | root = true 4 | 5 | [*] 6 | indent_style = tab 7 | indent_size = 4 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /chapter-01/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # node-waf configuration 20 | .lock-wscript 21 | 22 | # Compiled binary addons (http://nodejs.org/api/addons.html) 23 | build/Release 24 | 25 | # Dependency directory 26 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- 27 | node_modules 28 | 29 | # Debug log from npm 30 | npm-debug.log 31 | -------------------------------------------------------------------------------- /chapter-01/server/config/config.js: -------------------------------------------------------------------------------- 1 | // Database URL 2 | module.exports = { 3 | // Uncomment to connect with MongoDB on Cloud 4 | //'url' : 'mongodb://mvc-user-connect:opklnm@ds019028.mlab.com:19028/mvc-app' 5 | 'url' : 'mongodb://localhost/mvc-app' 6 | }; 7 | -------------------------------------------------------------------------------- /chapter-01/server/models/comments.js: -------------------------------------------------------------------------------- 1 | // load the things we need 2 | var mongoose = require('mongoose'); 3 | var Schema = mongoose.Schema; 4 | 5 | var commentSchema = mongoose.Schema({ 6 | created: { 7 | type: Date, 8 | default: Date.now 9 | }, 10 | title: { 11 | type: String, 12 | default: '', 13 | trim: true, 14 | required: 'Title cannot be blank' 15 | }, 16 | content: { 17 | type: String, 18 | default: '', 19 | trim: true 20 | }, 21 | user: { 22 | type: Schema.ObjectId, 23 | ref: 'User' 24 | } 25 | }); 26 | 27 | module.exports = mongoose.model('Comments', commentSchema); 28 | -------------------------------------------------------------------------------- /chapter-01/server/models/users.js: -------------------------------------------------------------------------------- 1 | // Import Mongoose and password Encrypt 2 | var mongoose = require('mongoose'); 3 | var bcrypt = require('bcrypt-nodejs'); 4 | 5 | // define the schema for User model 6 | var userSchema = mongoose.Schema({ 7 | // Using local for Local Strategy Passport 8 | local: { 9 | name: String, 10 | email: String, 11 | password: String, 12 | } 13 | 14 | }); 15 | 16 | // Encrypt Password 17 | userSchema.methods.generateHash = function(password) { 18 | return bcrypt.hashSync(password, bcrypt.genSaltSync(8), null); 19 | }; 20 | 21 | // Verify if password is valid 22 | userSchema.methods.validPassword = function(password) { 23 | return bcrypt.compareSync(password, this.local.password); 24 | }; 25 | 26 | // create the model for users and expose it to our app 27 | module.exports = mongoose.model('User', userSchema); 28 | -------------------------------------------------------------------------------- /chapter-01/server/routes/users.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var router = express.Router(); 3 | 4 | /* GET users listing. */ 5 | router.get('/', function(req, res, next) { 6 | res.send('respond with a resource'); 7 | }); 8 | 9 | module.exports = router; 10 | -------------------------------------------------------------------------------- /chapter-01/server/views/pages/error.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Wohp's Error 5 | <% include ../partials/stylesheet %> 6 | 7 | 8 | <% include ../partials/header %> 9 | 10 |
11 | 16 | 17 |
18 | 19 | <% include ../partials/footer %> 20 | <% include ../partials/javascript %> 21 | 22 | 23 | -------------------------------------------------------------------------------- /chapter-01/server/views/pages/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <%= title %> 5 | <% include ../partials/stylesheet %> 6 | 7 | 8 | <% include ../partials/header %> 9 | 10 |
11 | 14 |

Welcome to <%= title %>

15 |
16 | 17 | <% include ../partials/footer %> 18 | <% include ../partials/javascript %> 19 | 20 | 21 | -------------------------------------------------------------------------------- /chapter-01/server/views/partials/footer.ejs: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /chapter-01/server/views/partials/javascript.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /chapter-01/server/views/partials/stylesheet.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /chapter-02/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # node-waf configuration 20 | .lock-wscript 21 | 22 | # Compiled binary addons (http://nodejs.org/api/addons.html) 23 | build/Release 24 | 25 | # Dependency directory 26 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- 27 | node_modules 28 | 29 | # Debug log from npm 30 | npm-debug.log 31 | -------------------------------------------------------------------------------- /chapter-02/.sequelizerc: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | 3 | module.exports = { 4 | 'config': path.resolve('./config', 'config.json'), 5 | 'migrations-path': path.resolve('./config', 'migrations'), 6 | 'models-path': path.resolve('./', 'models'), 7 | 'seeders-path': path.resolve('./config', 'seeders') 8 | } 9 | -------------------------------------------------------------------------------- /chapter-02/config/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "development": { 3 | "username": "root", 4 | "password": "", 5 | "database": "mvc_mysql_app", 6 | "host": "127.0.0.1", 7 | "port": "3306", 8 | "dialect": "mysql" 9 | }, 10 | "test": { 11 | "username": "root", 12 | "password": null, 13 | "database": "database_test", 14 | "host": "127.0.0.1", 15 | "dialect": "mysql" 16 | }, 17 | "production": { 18 | "username": "root", 19 | "password": null, 20 | "database": "database_production", 21 | "host": "127.0.0.1", 22 | "dialect": "mysql" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /chapter-02/config/migrations/20160319100145-create-user.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | module.exports = { 3 | up: function(queryInterface, Sequelize) { 4 | return queryInterface.createTable('Users', { 5 | id: { 6 | allowNull: false, 7 | autoIncrement: true, 8 | primaryKey: true, 9 | type: Sequelize.INTEGER 10 | }, 11 | name: { 12 | type: Sequelize.STRING 13 | }, 14 | email: { 15 | type: Sequelize.STRING 16 | }, 17 | createdAt: { 18 | allowNull: false, 19 | type: Sequelize.DATE 20 | }, 21 | updatedAt: { 22 | allowNull: false, 23 | type: Sequelize.DATE 24 | } 25 | }); 26 | }, 27 | down: function(queryInterface, Sequelize) { 28 | return queryInterface.dropTable('Users'); 29 | } 30 | }; -------------------------------------------------------------------------------- /chapter-02/config/migrations/20160319101806-create-band.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | module.exports = { 3 | up: function(queryInterface, Sequelize) { 4 | return queryInterface.createTable('Bands', { 5 | id: { 6 | allowNull: false, 7 | autoIncrement: true, 8 | primaryKey: true, 9 | type: Sequelize.INTEGER 10 | }, 11 | name: { 12 | type: Sequelize.STRING 13 | }, 14 | description: { 15 | type: Sequelize.STRING 16 | }, 17 | album: { 18 | type: Sequelize.STRING 19 | }, 20 | year: { 21 | type: Sequelize.STRING 22 | }, 23 | UserId: { 24 | type: Sequelize.INTEGER 25 | }, 26 | createdAt: { 27 | allowNull: false, 28 | type: Sequelize.DATE 29 | }, 30 | updatedAt: { 31 | allowNull: false, 32 | type: Sequelize.DATE 33 | } 34 | }); 35 | }, 36 | down: function(queryInterface, Sequelize) { 37 | return queryInterface.dropTable('Bands'); 38 | } 39 | }; -------------------------------------------------------------------------------- /chapter-02/controllers/user.js: -------------------------------------------------------------------------------- 1 | var models = require('../models/index'); 2 | var User = require('../models/user'); 3 | 4 | // Create Users 5 | exports.create = function(req, res) { 6 | // create a new instance of the Users model with request body 7 | models.User.create({ 8 | name: req.body.name, 9 | email: req.body.email 10 | }).then(function(user) { 11 | res.json(user); 12 | }); 13 | }; 14 | 15 | // List Users 16 | exports.list = function(req, res) { 17 | // List all users 18 | models.User.findAll({}).then(function(users) { 19 | res.json(users); 20 | }); 21 | }; 22 | -------------------------------------------------------------------------------- /chapter-02/models/band.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | module.exports = function(sequelize, DataTypes) { 3 | var Band = sequelize.define('Band', { 4 | name: DataTypes.STRING, 5 | description: DataTypes.STRING, 6 | album: DataTypes.STRING, 7 | year: DataTypes.STRING, 8 | UserId: DataTypes.INTEGER 9 | }, { 10 | classMethods: { 11 | associate: function(models) { 12 | // associations can be defined here 13 | Band.belongsTo(models.User); 14 | } 15 | } 16 | }); 17 | return Band; 18 | }; 19 | -------------------------------------------------------------------------------- /chapter-02/models/user.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | module.exports = function(sequelize, DataTypes) { 3 | var User = sequelize.define('User', { 4 | name: DataTypes.STRING, 5 | email: DataTypes.STRING 6 | }, { 7 | classMethods: { 8 | associate: function(models) { 9 | // associations can be defined here 10 | User.hasMany(models.Band); 11 | } 12 | } 13 | }); 14 | return User; 15 | }; 16 | -------------------------------------------------------------------------------- /chapter-02/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chapter-02", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "node ./bin/www" 7 | }, 8 | "dependencies": { 9 | "body-parser": "~1.13.2", 10 | "cookie-parser": "~1.3.5", 11 | "debug": "~2.2.0", 12 | "express": "~4.13.1", 13 | "morgan": "~1.6.1", 14 | "mysql": "^2.10.2", 15 | "sequelize": "^3.19.3", 16 | "serve-favicon": "~2.3.0", 17 | "swig": "^1.4.2" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /chapter-02/views/pages/band-list.html: -------------------------------------------------------------------------------- 1 | {% extends 'layout.html' %} 2 | 3 | {% block title %}{% endblock %} 4 | 5 | 6 | {% block content %} 7 |
8 |
9 |
10 | {% for band in bands %} 11 |
12 |

{{ band.name }}

13 | {% if band.album == null %} 14 | {{ band.name }} 15 | {% endif %} 16 | {% if band.album %} 17 | 18 | {% endif %} 19 |

{{ band.description }}

20 |
21 | {% endfor %} 22 |
23 |
24 |
25 | {% endblock %} 26 | -------------------------------------------------------------------------------- /chapter-02/views/pages/error.html: -------------------------------------------------------------------------------- 1 | {% extends 'layout.html' %} 2 | 3 | {% block title %}{% endblock %} 4 | 5 | 6 | {% block content %} 7 | 8 |
9 | 10 |

{{ message }}

11 |

{{ error.status }}

12 |
{{ error.stack }}
13 | 14 |
15 | 16 | {% endblock %} 17 | -------------------------------------------------------------------------------- /chapter-02/views/partials/footer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /chapter-02/views/partials/head.html: -------------------------------------------------------------------------------- 1 | 2 | {{ title }} 3 | 4 | 5 | -------------------------------------------------------------------------------- /chapter-03/.editorconfig: -------------------------------------------------------------------------------- 1 | 2 | # http://editorconfig.org 3 | root = true 4 | 5 | [*] 6 | indent_style = tab 7 | indent_size = 4 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /chapter-03/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # node-waf configuration 20 | .lock-wscript 21 | 22 | # Compiled binary addons (http://nodejs.org/api/addons.html) 23 | build/Release 24 | 25 | # Dependency directory 26 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- 27 | node_modules 28 | 29 | # Debug log from npm 30 | npm-debug.log 31 | -------------------------------------------------------------------------------- /chapter-03/public/images/image-placeholder.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-03/public/images/image-placeholder.jpg -------------------------------------------------------------------------------- /chapter-03/public/videos/sample.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-03/public/videos/sample.mp4 -------------------------------------------------------------------------------- /chapter-03/public/videos/sample.webm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-03/public/videos/sample.webm -------------------------------------------------------------------------------- /chapter-03/server/config/config.js: -------------------------------------------------------------------------------- 1 | // Database URL 2 | module.exports = { 3 | // Uncomment to connect with MongoDB on Cloud 4 | //'url' : 'mongodb://mvc-user-connect:opklnm@ds019028.mlab.com:19028/mvc-app' 5 | 'url' : 'mongodb://localhost/mvc-app-multimedia' 6 | }; 7 | -------------------------------------------------------------------------------- /chapter-03/server/controllers/index.js: -------------------------------------------------------------------------------- 1 | // Show home screen 2 | exports.show = function(req, res) { 3 | // Render home screen 4 | res.render('index', { 5 | title: 'Multimedia Application', 6 | callToAction: 'An easy way to upload and manipulate files with Node.js' 7 | }); 8 | }; 9 | -------------------------------------------------------------------------------- /chapter-03/server/models/comments.js: -------------------------------------------------------------------------------- 1 | // load the things we need 2 | var mongoose = require('mongoose'); 3 | var Schema = mongoose.Schema; 4 | 5 | var commentSchema = mongoose.Schema({ 6 | created: { 7 | type: Date, 8 | default: Date.now 9 | }, 10 | title: { 11 | type: String, 12 | default: '', 13 | trim: true, 14 | required: 'Title cannot be blank' 15 | }, 16 | content: { 17 | type: String, 18 | default: '', 19 | trim: true 20 | }, 21 | user: { 22 | type: Schema.ObjectId, 23 | ref: 'User' 24 | } 25 | }); 26 | 27 | module.exports = mongoose.model('Comments', commentSchema); 28 | -------------------------------------------------------------------------------- /chapter-03/server/models/images.js: -------------------------------------------------------------------------------- 1 | // load the things we need 2 | var mongoose = require('mongoose'); 3 | var Schema = mongoose.Schema; 4 | 5 | var imagesSchema = mongoose.Schema({ 6 | created: { 7 | type: Date, 8 | default: Date.now 9 | }, 10 | title: { 11 | type: String, 12 | default: '', 13 | trim: true, 14 | required: 'Title cannot be blank' 15 | }, 16 | imageName: { 17 | type: String 18 | }, 19 | user: { 20 | type: Schema.ObjectId, 21 | ref: 'User' 22 | } 23 | }); 24 | 25 | module.exports = mongoose.model('Images', imagesSchema); 26 | -------------------------------------------------------------------------------- /chapter-03/server/models/users.js: -------------------------------------------------------------------------------- 1 | // Import Mongoose and password Encrypt 2 | var mongoose = require('mongoose'); 3 | var bcrypt = require('bcrypt-nodejs'); 4 | 5 | // define the schema for User model 6 | var userSchema = mongoose.Schema({ 7 | // Using local for Local Strategy Passport 8 | local: { 9 | name: String, 10 | email: String, 11 | password: String, 12 | } 13 | 14 | }); 15 | 16 | // Encrypt Password 17 | userSchema.methods.generateHash = function(password) { 18 | return bcrypt.hashSync(password, bcrypt.genSaltSync(8), null); 19 | }; 20 | 21 | // Verify if password is valid 22 | userSchema.methods.validPassword = function(password) { 23 | return bcrypt.compareSync(password, this.local.password); 24 | }; 25 | 26 | // create the model for users and expose it to our app 27 | module.exports = mongoose.model('User', userSchema); 28 | -------------------------------------------------------------------------------- /chapter-03/server/models/videos.js: -------------------------------------------------------------------------------- 1 | // load the things we need 2 | var mongoose = require('mongoose'); 3 | var Schema = mongoose.Schema; 4 | 5 | var videosSchema = mongoose.Schema({ 6 | created: { 7 | type: Date, 8 | default: Date.now 9 | }, 10 | title: { 11 | type: String, 12 | default: '', 13 | trim: true, 14 | required: 'Title cannot be blank' 15 | }, 16 | videoName: { 17 | type: String 18 | }, 19 | user: { 20 | type: Schema.ObjectId, 21 | ref: 'User' 22 | } 23 | }); 24 | 25 | module.exports = mongoose.model('Videos', videosSchema); 26 | -------------------------------------------------------------------------------- /chapter-03/server/views/pages/error.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Wohp's Error 5 | <% include ../partials/stylesheet %> 6 | 7 | 8 | <% include ../partials/header %> 9 | 10 |
11 | 16 | 17 |
18 | 19 | <% include ../partials/footer %> 20 | <% include ../partials/javascript %> 21 | 22 | 23 | -------------------------------------------------------------------------------- /chapter-03/server/views/pages/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <%= title %> 5 | <% include ../partials/stylesheet %> 6 | 7 | 8 | <% include ../partials/header %> 9 | 10 |
11 | 14 |

Welcome to <%= title %>

15 |
16 | 17 | <% include ../partials/footer %> 18 | <% include ../partials/javascript %> 19 | 20 | 21 | -------------------------------------------------------------------------------- /chapter-03/server/views/partials/footer.ejs: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /chapter-03/server/views/partials/javascript.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /chapter-03/server/views/partials/stylesheet.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /chapter-04/.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "public/components", 3 | "json": "bower.json" 4 | } 5 | -------------------------------------------------------------------------------- /chapter-04/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | -------------------------------------------------------------------------------- /chapter-04/.env: -------------------------------------------------------------------------------- 1 | PORT=9000 2 | CLOUDINARY_URL=cloudinary://824993664991229:dGACKgmrwFpfUyswKCCQXH_7pOk@n6b 3 | -------------------------------------------------------------------------------- /chapter-04/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | public/components 3 | .sass-cache -------------------------------------------------------------------------------- /chapter-04/app.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | var express = require('express'), 4 | config = require('./config/config'); 5 | 6 | var app = express(); 7 | 8 | require('./config/express')(app, config); 9 | // Get cloudinary environment configuration 10 | require('./config/env')(app); 11 | 12 | app.listen(config.port, function () { 13 | console.log('Express server listening on port ' + config.port); 14 | }); 15 | -------------------------------------------------------------------------------- /chapter-04/app/controllers/home.js: -------------------------------------------------------------------------------- 1 | var express = require('express'), 2 | router = express.Router(), 3 | Article = require('../models/article'); 4 | 5 | module.exports = function (app) { 6 | app.use('/', router); 7 | }; 8 | 9 | router.get('/', function (req, res, next) { 10 | var articles = [new Article(), new Article()]; 11 | res.render('index', { 12 | title: 'Generator-Express MVC', 13 | articles: articles 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /chapter-04/app/models/article.js: -------------------------------------------------------------------------------- 1 | // Example model 2 | 3 | 4 | function Article (opts) { 5 | if(!opts) opts = {}; 6 | this.title = opts.title || ''; 7 | this.url = opts.url || ''; 8 | this.text = opts.text || ''; 9 | } 10 | 11 | module.exports = Article; 12 | 13 | -------------------------------------------------------------------------------- /chapter-04/app/models/book.js: -------------------------------------------------------------------------------- 1 | var Schema = require('jugglingdb').Schema; 2 | // Pay attention, we are using MongoDB for this example. 3 | var schema = new Schema('mongodb', {url: 'mongodb://localhost/myapp'}); 4 | 5 | // Setup Books Schema 6 | var Picture = schema.define('Picture', { 7 | title : { type: String, length: 255 }, 8 | description: {type: Schema.Text}, 9 | category: {type: String, length: 255 }, 10 | image : { type: JSON} 11 | }); 12 | 13 | module.exports = schema; 14 | -------------------------------------------------------------------------------- /chapter-04/app/views/book/posted-photo.swig: -------------------------------------------------------------------------------- 1 | {% extends '../layout.swig' %} 2 | 3 | {% block content %} 4 |
5 |
6 |

7 |

{{ title }}

8 |
9 |
Welcome to {{ title }}
10 |
11 | 20 |
21 |
22 |
23 |
24 |
25 | 26 | {% endblock %} 27 | -------------------------------------------------------------------------------- /chapter-04/app/views/error.swig: -------------------------------------------------------------------------------- 1 | {% extends 'layout.swig' %} 2 | 3 | {% block content %} 4 |

{{ message }}

5 |

{{ error.status }}

6 |
{{ error.stack }}
7 | {% endblock %} 8 | -------------------------------------------------------------------------------- /chapter-04/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mvc-photobook", 3 | "version": "0.0.1", 4 | "ignore": [ 5 | "**/.*", 6 | "node_modules", 7 | "components" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /chapter-04/config/config.js: -------------------------------------------------------------------------------- 1 | var path = require('path'), 2 | rootPath = path.normalize(__dirname + '/..'), 3 | env = process.env.NODE_ENV || 'development'; 4 | 5 | var config = { 6 | development: { 7 | root: rootPath, 8 | app: { 9 | name: 'mvc-photobook' 10 | }, 11 | port: process.env.PORT || 3000, 12 | }, 13 | 14 | test: { 15 | root: rootPath, 16 | app: { 17 | name: 'mvc-photobook' 18 | }, 19 | port: process.env.PORT || 3000, 20 | }, 21 | 22 | production: { 23 | root: rootPath, 24 | app: { 25 | name: 'mvc-photobook' 26 | }, 27 | port: process.env.PORT || 3000, 28 | } 29 | }; 30 | 31 | module.exports = config[env]; 32 | -------------------------------------------------------------------------------- /chapter-04/config/env.js: -------------------------------------------------------------------------------- 1 | // get Env variable / cloudinary 2 | module.exports = function(app, configEnv) { 3 | 4 | var dotenv = require('dotenv'); 5 | dotenv.load(); 6 | var cloudinary = require('cloudinary').v2; 7 | // Log some messages on Terminal 8 | if ( typeof(process.env.CLOUDINARY_URL) == 'undefined' ){ 9 | console.log('Cloudinary config file is not defined'); 10 | console.log('Setup CLOUDINARY_URL or use dotenv mdule file') 11 | } else { 12 | console.log('Cloudinary config, successfully used:'); 13 | console.log(cloudinary.config()) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /chapter-04/gulpfile.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'), 2 | nodemon = require('gulp-nodemon'), 3 | plumber = require('gulp-plumber'), 4 | livereload = require('gulp-livereload'); 5 | 6 | 7 | gulp.task('develop', function () { 8 | livereload.listen(); 9 | nodemon({ 10 | script: 'app.js', 11 | ext: 'js coffee swig', 12 | stdout: false 13 | }).on('readable', function () { 14 | this.stdout.on('data', function (chunk) { 15 | if(/^Express server listening on port/.test(chunk)){ 16 | livereload.changed(__dirname); 17 | } 18 | }); 19 | this.stdout.pipe(process.stdout); 20 | this.stderr.pipe(process.stderr); 21 | }); 22 | }); 23 | 24 | gulp.task('default', [ 25 | 'develop' 26 | ]); 27 | -------------------------------------------------------------------------------- /chapter-04/public/css/style.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-04/public/css/style.css -------------------------------------------------------------------------------- /chapter-05/.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "public/components", 3 | "json": "bower.json" 4 | } 5 | -------------------------------------------------------------------------------- /chapter-05/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 4 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | -------------------------------------------------------------------------------- /chapter-05/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | public/components 3 | .sass-cache 4 | .idea/ 5 | -------------------------------------------------------------------------------- /chapter-05/app.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | var express = require('express'), 4 | config = require('./config/config'), 5 | glob = require('glob'), 6 | mongoose = require('mongoose'); 7 | 8 | mongoose.connect(config.db); 9 | var db = mongoose.connection; 10 | db.on('error', function () { 11 | throw new Error('unable to connect to database at ' + config.db); 12 | }); 13 | 14 | var models = glob.sync(config.root + '/app/models/*.js'); 15 | models.forEach(function (model) { 16 | require(model); 17 | }); 18 | var app = express(); 19 | 20 | require('./config/express')(app, config); 21 | 22 | app.listen(config.port, function () { 23 | console.log('Express server listening on port ' + config.port); 24 | }); 25 | 26 | -------------------------------------------------------------------------------- /chapter-05/app/controllers/home.js: -------------------------------------------------------------------------------- 1 | var express = require('express'), 2 | router = express.Router(), 3 | mongoose = require('mongoose'), 4 | Article = mongoose.model('Article'); 5 | 6 | module.exports = function (app) { 7 | app.use('/', router); 8 | }; 9 | 10 | router.get('/', function (req, res, next) { 11 | Article.find(function (err, articles) { 12 | if (err) return next(err); 13 | res.render('index', { 14 | title: 'Map', 15 | articles: articles 16 | }); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /chapter-05/app/models/article.js: -------------------------------------------------------------------------------- 1 | // Example model 2 | 3 | var mongoose = require('mongoose'), 4 | Schema = mongoose.Schema; 5 | 6 | var ArticleSchema = new Schema({ 7 | title: String, 8 | url: String, 9 | text: String 10 | }); 11 | 12 | ArticleSchema.virtual('date') 13 | .get(function(){ 14 | return this._id.getTimestamp(); 15 | }); 16 | 17 | mongoose.model('Article', ArticleSchema); 18 | 19 | -------------------------------------------------------------------------------- /chapter-05/app/models/location.js: -------------------------------------------------------------------------------- 1 | // Example model 2 | 3 | var mongoose = require('mongoose'), 4 | Schema = mongoose.Schema; 5 | 6 | var LocationSchema = new Schema({ 7 | title: String, 8 | coordinates: { 9 | type: [Number], 10 | index: '2dsphere' 11 | }, 12 | created: { 13 | type: Date, 14 | default: Date.now 15 | } 16 | }); 17 | 18 | mongoose.model('Location', LocationSchema); 19 | -------------------------------------------------------------------------------- /chapter-05/app/models/store.js: -------------------------------------------------------------------------------- 1 | // Example model 2 | 3 | var mongoose = require('mongoose'), 4 | Schema = mongoose.Schema; 5 | 6 | var StoreSchema = new Schema({ 7 | distance: Number, 8 | store: { 9 | id: { type: String}, 10 | name: {type: String}, 11 | brandName: {type: String}, 12 | phoneNumber: {type: String}, 13 | market: {type: String}, 14 | operatingStatus: { 15 | operating: {type: Boolean}, 16 | openDate: {type: String}, 17 | closeDate: {type: String}, 18 | status: {type: String} 19 | }, 20 | coordinates: {type: [Number], index: '2dsphere'} 21 | } 22 | }); 23 | 24 | mongoose.model('Store', StoreSchema); 25 | -------------------------------------------------------------------------------- /chapter-05/app/views/pages/error.html: -------------------------------------------------------------------------------- 1 | {% extends 'layout.html' %} 2 | 3 | {% block content %} 4 |
5 |
6 |
7 |

{{ message }}

8 |
9 |

{{ error.status }}

10 |
11 |
12 |
{{ error.stack }}
13 |
14 |

15 |
16 |
17 | {% endblock %} 18 | -------------------------------------------------------------------------------- /chapter-05/app/views/pages/index.html: -------------------------------------------------------------------------------- 1 | {% extends 'layout.html' %} 2 | 3 | {% block content %} 4 |
5 |
6 |
7 |
8 |

{{ title }}

9 |
10 |
Welcome to {{ title }}
11 |
12 |
13 | Add your location 14 |
15 |

16 |
17 |
18 | 19 | 20 | {% endblock %} 21 | -------------------------------------------------------------------------------- /chapter-05/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "maps-api", 3 | "version": "0.0.1", 4 | "ignore": [ 5 | "**/.*", 6 | "node_modules", 7 | "components" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /chapter-05/config/config.js: -------------------------------------------------------------------------------- 1 | var path = require('path'), 2 | rootPath = path.normalize(__dirname + '/..'), 3 | env = process.env.NODE_ENV || 'development'; 4 | 5 | var config = { 6 | development: { 7 | root: rootPath, 8 | app: { 9 | name: 'maps-api' 10 | }, 11 | port: process.env.PORT || 3000, 12 | db: 'mongodb://localhost/maps-api-development' 13 | }, 14 | 15 | test: { 16 | root: rootPath, 17 | app: { 18 | name: 'maps-api' 19 | }, 20 | port: process.env.PORT || 3000, 21 | db: 'mongodb://localhost/maps-api-test' 22 | }, 23 | 24 | production: { 25 | root: rootPath, 26 | app: { 27 | name: 'maps-api' 28 | }, 29 | port: process.env.PORT || 3000, 30 | db: 'mongodb://localhost/maps-api-production' 31 | } 32 | }; 33 | 34 | module.exports = config[env]; 35 | -------------------------------------------------------------------------------- /chapter-05/gulpfile.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'), 2 | nodemon = require('gulp-nodemon'), 3 | plumber = require('gulp-plumber'), 4 | livereload = require('gulp-livereload'); 5 | 6 | 7 | gulp.task('develop', function () { 8 | livereload.listen(); 9 | nodemon({ 10 | script: 'app.js', 11 | ext: 'js coffee swig', 12 | stdout: false 13 | }).on('readable', function () { 14 | this.stdout.on('data', function (chunk) { 15 | if(/^Express server listening on port/.test(chunk)){ 16 | livereload.changed(__dirname); 17 | } 18 | }); 19 | this.stdout.pipe(process.stdout); 20 | this.stderr.pipe(process.stderr); 21 | }); 22 | }); 23 | 24 | gulp.task('default', [ 25 | 'develop' 26 | ]); 27 | -------------------------------------------------------------------------------- /chapter-05/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "maps-api", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node app.js" 7 | }, 8 | "dependencies": { 9 | "body-parser": "^1.13.3", 10 | "compression": "^1.5.2", 11 | "cookie-parser": "^1.3.3", 12 | "express": "^4.13.3", 13 | "glob": "^6.0.4", 14 | "google-maps": "^3.2.1", 15 | "method-override": "^2.3.0", 16 | "mongoose": "^4.1.2", 17 | "morgan": "^1.6.1", 18 | "serve-favicon": "^2.3.0", 19 | "swig": "^1.4.2" 20 | }, 21 | "devDependencies": { 22 | "gulp": "^3.9.0", 23 | "gulp-nodemon": "^2.0.2", 24 | "gulp-livereload": "^3.8.0", 25 | "gulp-plumber": "^1.0.0" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /chapter-05/public/css/style.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-05/public/css/style.css -------------------------------------------------------------------------------- /chapter-05/public/images/pin-off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-05/public/images/pin-off.png -------------------------------------------------------------------------------- /chapter-05/public/images/pin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-05/public/images/pin.png -------------------------------------------------------------------------------- /chapter-06/.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # http://editorconfig.org 4 | 5 | root = true 6 | 7 | [*] 8 | indent_style = tab 9 | indent_size = 4 10 | end_of_line = lf 11 | charset = utf-8 12 | trim_trailing_whitespace = true 13 | insert_final_newline = true 14 | -------------------------------------------------------------------------------- /chapter-06/.gitignore: -------------------------------------------------------------------------------- 1 | *.csv 2 | *.dat 3 | *.iml 4 | *.log 5 | *.out 6 | *.pid 7 | *.seed 8 | *.sublime-* 9 | *.swo 10 | *.swp 11 | *.tgz 12 | *.xml 13 | .DS_Store 14 | .idea 15 | .project 16 | .strong-pm 17 | coverage 18 | node_modules 19 | npm-debug.log 20 | -------------------------------------------------------------------------------- /chapter-06/.jshintignore: -------------------------------------------------------------------------------- 1 | /client/ 2 | /node_modules/ 3 | -------------------------------------------------------------------------------- /chapter-06/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true, 3 | "esnext": true, 4 | "bitwise": true, 5 | "camelcase": true, 6 | "eqeqeq": true, 7 | "eqnull": true, 8 | "immed": true, 9 | "indent": 2, 10 | "latedef": "nofunc", 11 | "newcap": true, 12 | "nonew": true, 13 | "noarg": true, 14 | "quotmark": "single", 15 | "regexp": true, 16 | "undef": true, 17 | "unused": false, 18 | "trailing": true, 19 | "sub": true, 20 | "maxlen": 80 21 | } 22 | -------------------------------------------------------------------------------- /chapter-06/.yo-rc.json: -------------------------------------------------------------------------------- 1 | { 2 | "generator-loopback": {} 3 | } -------------------------------------------------------------------------------- /chapter-06/client/README.md: -------------------------------------------------------------------------------- 1 | ## Client 2 | 3 | This is the place for your application front-end files. 4 | -------------------------------------------------------------------------------- /chapter-06/client/images/heritage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-06/client/images/heritage.jpg -------------------------------------------------------------------------------- /chapter-06/client/images/knucklehead.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-06/client/images/knucklehead.jpg -------------------------------------------------------------------------------- /chapter-06/common/models/motorcycle.js: -------------------------------------------------------------------------------- 1 | module.exports = function(Motorcycle) { 2 | 3 | }; 4 | -------------------------------------------------------------------------------- /chapter-06/common/models/review.js: -------------------------------------------------------------------------------- 1 | module.exports = function(Review) { 2 | // Disable endpoint / methods 3 | Review.disableRemoteMethod("count", true); 4 | Review.disableRemoteMethod("exists", true); 5 | Review.disableRemoteMethod("findOne", true); 6 | Review.disableRemoteMethod('createChangeStream', true); 7 | Review.disableRemoteMethod("updateAll", true); 8 | 9 | }; 10 | -------------------------------------------------------------------------------- /chapter-06/common/models/review.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "review", 3 | "base": "PersistedModel", 4 | "idInjection": true, 5 | "options": { 6 | "validateUpsert": true 7 | }, 8 | "properties": { 9 | "name": { 10 | "type": "string", 11 | "required": true 12 | }, 13 | "email": { 14 | "type": "string", 15 | "required": true 16 | }, 17 | "review": { 18 | "type": "string", 19 | "required": true 20 | } 21 | }, 22 | "validations": [], 23 | "relations": {}, 24 | "acls": [], 25 | "methods": {} 26 | } 27 | -------------------------------------------------------------------------------- /chapter-06/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "motorcycle-feedback", 3 | "version": "1.0.0", 4 | "main": "server/server.js", 5 | "scripts": { 6 | "start": "node .", 7 | "pretest": "jshint .", 8 | "posttest": "nsp check" 9 | }, 10 | "dependencies": { 11 | "compression": "^1.0.3", 12 | "cors": "^2.5.2", 13 | "helmet": "^1.3.0", 14 | "loopback": "^2.22.0", 15 | "loopback-boot": "^2.6.5", 16 | "loopback-component-explorer": "^2.4.0", 17 | "loopback-connector-mongodb": "^1.15.1", 18 | "loopback-datasource-juggler": "^2.39.0", 19 | "serve-favicon": "^2.0.1" 20 | }, 21 | "devDependencies": { 22 | "jshint": "^2.5.6", 23 | "nsp": "^2.1.0" 24 | }, 25 | "repository": { 26 | "type": "", 27 | "url": "" 28 | }, 29 | "license": "UNLICENSED", 30 | "description": "motorcycle-feedback" 31 | } 32 | -------------------------------------------------------------------------------- /chapter-06/server/boot/_root.js: -------------------------------------------------------------------------------- 1 | module.exports = function(server) { 2 | // Install a `/` route that returns server status 3 | var router = server.loopback.Router(); 4 | router.get('/', server.loopback.status()); 5 | server.use(router); 6 | }; 7 | -------------------------------------------------------------------------------- /chapter-06/server/component-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "loopback-component-explorer": { 3 | "mountPath": "/explorer" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /chapter-06/server/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "restApiRoot": "/api", 3 | "host": "0.0.0.0", 4 | "port": 3000, 5 | "remoting": { 6 | "context": { 7 | "enableHttpContext": false 8 | }, 9 | "rest": { 10 | "normalizeHttpPath": false, 11 | "xml": false 12 | }, 13 | "json": { 14 | "strict": false, 15 | "limit": "100kb" 16 | }, 17 | "urlencoded": { 18 | "extended": true, 19 | "limit": "100kb" 20 | }, 21 | "cors": false, 22 | "errorHandler": { 23 | "disableStackTrace": false 24 | } 25 | }, 26 | "legacyExplorer": false 27 | } 28 | -------------------------------------------------------------------------------- /chapter-06/server/datasources.json: -------------------------------------------------------------------------------- 1 | { 2 | "motorcycleDataSource": { 3 | "host": "localhost", 4 | "port": 27017, 5 | "database": "motorcycle-feedback", 6 | "password": "", 7 | "name": "motorcycleDataSource", 8 | "user": "", 9 | "connector": "mongodb" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /chapter-06/server/middleware.production.json: -------------------------------------------------------------------------------- 1 | { 2 | "final:after": { 3 | "loopback#errorHandler": { 4 | "params": { 5 | "includeStack": false 6 | } 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /chapter-06/server/model-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "_meta": { 3 | "sources": [ 4 | "loopback/common/models", 5 | "loopback/server/models", 6 | "../common/models", 7 | "./models" 8 | ], 9 | "mixins": [ 10 | "loopback/common/mixins", 11 | "loopback/server/mixins", 12 | "../common/mixins", 13 | "./mixins" 14 | ] 15 | }, 16 | "motorcycle": { 17 | "dataSource": "motorcycleDataSource", 18 | "public": true 19 | }, 20 | "review": { 21 | "dataSource": "motorcycleDataSource", 22 | "public": true 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /chapter-06/server/server.js: -------------------------------------------------------------------------------- 1 | var loopback = require('loopback'); 2 | var boot = require('loopback-boot'); 3 | 4 | var app = module.exports = loopback(); 5 | 6 | app.start = function() { 7 | // start the web server 8 | return app.listen(function() { 9 | app.emit('started'); 10 | var baseUrl = app.get('url').replace(/\/$/, ''); 11 | console.log('Web server listening at: %s', baseUrl); 12 | if (app.get('loopback-component-explorer')) { 13 | var explorerPath = app.get('loopback-component-explorer').mountPath; 14 | console.log('Browse your REST API at %s%s', baseUrl, explorerPath); 15 | } 16 | }); 17 | }; 18 | 19 | // Bootstrap the application, configure models, datasources and middleware. 20 | // Sub-apps like REST API are mounted via boot scripts. 21 | boot(app, __dirname, function(err) { 22 | if (err) throw err; 23 | 24 | // start the server if `$ node server.js` 25 | if (require.main === module) 26 | app.start(); 27 | }); 28 | -------------------------------------------------------------------------------- /chapter-07/.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "public/components", 3 | "json": "bower.json" 4 | } 5 | -------------------------------------------------------------------------------- /chapter-07/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = tab 6 | indent_size = 4 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | -------------------------------------------------------------------------------- /chapter-07/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | public/components 3 | .sass-cache 4 | npm-debug.log 5 | -------------------------------------------------------------------------------- /chapter-07/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chapter-07", 3 | "version": "0.0.1", 4 | "ignore": [ 5 | "**/.*", 6 | "node_modules", 7 | "components" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /chapter-07/gulpfile.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'), 2 | nodemon = require('gulp-nodemon'), 3 | plumber = require('gulp-plumber'), 4 | livereload = require('gulp-livereload'); 5 | 6 | 7 | gulp.task('develop', function () { 8 | livereload.listen(); 9 | nodemon({ 10 | script: 'app.js', 11 | ext: 'js ejs', 12 | stdout: false 13 | }).on('readable', function () { 14 | this.stdout.on('data', function (chunk) { 15 | if (/^Express server listening on port/.test(chunk)) { 16 | livereload.changed(__dirname); 17 | } 18 | }); 19 | this.stdout.pipe(process.stdout); 20 | this.stderr.pipe(process.stderr); 21 | }); 22 | }); 23 | 24 | gulp.task('default', [ 25 | 'develop' 26 | ]); 27 | -------------------------------------------------------------------------------- /chapter-07/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chapter-07", 3 | "description": "Build a real time chat application with Node.js and Socket.io", 4 | "version": "0.0.1", 5 | "private": true, 6 | "scripts": { 7 | "start": "node app.js" 8 | }, 9 | "dependencies": { 10 | "body-parser": "^1.13.3", 11 | "cookie-parser": "^1.3.3", 12 | "ejs": "^2.3.1", 13 | "express": "^4.13.3", 14 | "morgan": "^1.6.1", 15 | "serve-favicon": "^2.3.0", 16 | "socket.io": "^1.4.6" 17 | }, 18 | "devDependencies": { 19 | "gulp": "^3.9.0", 20 | "gulp-nodemon": "^2.0.2", 21 | "gulp-livereload": "^3.8.0", 22 | "gulp-plumber": "^1.0.0" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /chapter-07/routes/index.js: -------------------------------------------------------------------------------- 1 | // Import Express and Router 2 | var express = require('express'); 3 | var router = express.Router(); 4 | 5 | // Get 6 | router.get('/', function(req, res) { 7 | res.render('index', { 8 | title: 'Socket.io chat application', 9 | lead: 'Insert your user name and start talk' 10 | }); 11 | }); 12 | 13 | module.exports = router; 14 | -------------------------------------------------------------------------------- /chapter-07/views/error.ejs: -------------------------------------------------------------------------------- 1 | <% include header %> 2 | 3 |
4 |

<%- error.status %>

5 |

<%- message %>

6 |

<%- error.stack %>

7 |
8 | 9 | <% include footer %> 10 | -------------------------------------------------------------------------------- /chapter-07/views/footer.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /chapter-07/views/header.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | <%- title %> 6 | 7 | 8 | 9 | 10 | <% if (ENV_DEVELOPMENT) { %> 11 | 12 | <% } %> 13 | 14 | 15 | 16 |
17 |
18 |
19 |
20 |
21 |

Node.js 6 Blueprints Book

22 | 25 |
26 |
27 | -------------------------------------------------------------------------------- /chapter-08/.editorconfig: -------------------------------------------------------------------------------- 1 | # This file is for unifying the coding style for different editors and IDEs 2 | # editorconfig.org 3 | root = true 4 | 5 | [*] 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = false 9 | insert_final_newline = true 10 | indent_style = tab 11 | 12 | [{*.yml,*.json}] 13 | indent_style = space 14 | indent_size = 2 15 | -------------------------------------------------------------------------------- /chapter-08/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # Compiled binary addons (http://nodejs.org/api/addons.html) 20 | build/Release 21 | 22 | # Dependency directory 23 | # Deployed apps should consider commenting this line out: 24 | # see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git 25 | node_modules 26 | 27 | # Ignore .env configuration files 28 | .env 29 | 30 | # Ignore .DS_Store files on OS X 31 | .DS_Store 32 | -------------------------------------------------------------------------------- /chapter-08/Procfile: -------------------------------------------------------------------------------- 1 | web: node keystone.js 2 | -------------------------------------------------------------------------------- /chapter-08/gulpfile.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var watch = require('gulp-watch'); 3 | var shell = require('gulp-shell') 4 | 5 | var sass = require('gulp-sass'); 6 | 7 | 8 | var paths = { 9 | 'src':['./models/**/*.js','./routes/**/*.js', 'keystone.js', 'package.json'] 10 | 11 | , 12 | 'style': { 13 | all: './public/styles/**/*.scss', 14 | output: './public/styles/' 15 | } 16 | 17 | }; 18 | 19 | 20 | gulp.task('watch:sass', function () { 21 | gulp.watch(paths.style.all, ['sass']); 22 | }); 23 | 24 | gulp.task('sass', function(){ 25 | gulp.src(paths.style.all) 26 | .pipe(sass().on('error', sass.logError)) 27 | .pipe(gulp.dest(paths.style.output)); 28 | }); 29 | 30 | 31 | gulp.task('runKeystone', shell.task('node keystone.js')); 32 | gulp.task('watch', [ 33 | 34 | 'watch:sass' 35 | ]); 36 | 37 | gulp.task('default', ['watch', 'runKeystone']); 38 | -------------------------------------------------------------------------------- /chapter-08/models/About.js: -------------------------------------------------------------------------------- 1 | var keystone = require('keystone'); 2 | var Types = keystone.Field.Types; 3 | 4 | /** 5 | * About Model 6 | * ========== 7 | */ 8 | 9 | var About = new keystone.List('About', { 10 | // Using map to show title instead ObjectID on Admin Interface 11 | map: { name: 'title' }, 12 | autokey: { path: 'slug', from: 'title', unique: true }, 13 | }); 14 | 15 | About.add({ 16 | title: { type: String, initial: true, default: '', required: true }, 17 | description: { type: Types.Textarea } 18 | }); 19 | 20 | About.defaultColumns = 'title, description|60%'; 21 | About.register(); 22 | -------------------------------------------------------------------------------- /chapter-08/models/Gallery.js: -------------------------------------------------------------------------------- 1 | var keystone = require('keystone'); 2 | var Types = keystone.Field.Types; 3 | 4 | /** 5 | * Gallery Model 6 | * ============= 7 | */ 8 | 9 | var Gallery = new keystone.List('Gallery', { 10 | autokey: { from: 'name', path: 'key', unique: true }, 11 | }); 12 | 13 | Gallery.add({ 14 | name: { type: String, required: true }, 15 | publishedDate: { type: Date, default: Date.now }, 16 | heroImage: { type: Types.CloudinaryImage }, 17 | images: { type: Types.CloudinaryImages }, 18 | }); 19 | 20 | Gallery.register(); 21 | -------------------------------------------------------------------------------- /chapter-08/models/PostCategory.js: -------------------------------------------------------------------------------- 1 | var keystone = require('keystone'); 2 | 3 | /** 4 | * PostCategory Model 5 | * ================== 6 | */ 7 | 8 | var PostCategory = new keystone.List('PostCategory', { 9 | autokey: { from: 'name', path: 'key', unique: true }, 10 | }); 11 | 12 | PostCategory.add({ 13 | name: { type: String, required: true }, 14 | }); 15 | 16 | PostCategory.relationship({ ref: 'Post', path: 'categories' }); 17 | 18 | PostCategory.register(); 19 | -------------------------------------------------------------------------------- /chapter-08/models/UserAdmin.js: -------------------------------------------------------------------------------- 1 | var keystone = require('keystone'); 2 | var Types = keystone.Field.Types; 3 | 4 | /** 5 | * UserAdmin Model 6 | * ========== 7 | */ 8 | var UserAdmin = new keystone.List('UserAdmin'); 9 | 10 | UserAdmin.add({ 11 | name: { type: Types.Name, required: true, index: true }, 12 | email: { type: Types.Email, initial: true, required: true, index: true }, 13 | password: { type: Types.Password, initial: true, required: true }, 14 | }, 'Permissions', { 15 | isAdmin: { type: Boolean, label: 'Can access Keystone', index: true }, 16 | }); 17 | 18 | // Provide access to Keystone 19 | UserAdmin.schema.virtual('canAccessKeystone').get(function () { 20 | return this.isAdmin; 21 | }); 22 | 23 | 24 | /** 25 | * Relationships 26 | */ 27 | UserAdmin.relationship({ ref: 'Post', path: 'posts', refPath: 'author' }); 28 | 29 | 30 | /** 31 | * Registration 32 | */ 33 | UserAdmin.defaultColumns = 'name, email, isAdmin'; 34 | UserAdmin.register(); 35 | -------------------------------------------------------------------------------- /chapter-08/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chapter-08", 3 | "version": "0.0.0", 4 | "private": true, 5 | "dependencies": { 6 | "keystone": "4.0.0-beta.7", 7 | "async": "^1.5.0", 8 | "underscore": "^1.8.3", 9 | "swig": "^1.4.1", 10 | "node-sass": "^3.3.2", 11 | "node-sass-middleware": "^0.9.7", 12 | "dotenv": "^1.1.0" 13 | }, 14 | "devDependencies": { 15 | "gulp": "^3.7.0", 16 | "gulp-nodemon": "^2.0.7", 17 | "gulp-sass": "^2.0.4", 18 | "gulp-shell": "^0.5.0", 19 | "gulp-watch": "^4.3.5" 20 | }, 21 | "engines": { 22 | "node": ">=0.10.22", 23 | "npm": ">=1.3.14" 24 | }, 25 | "scripts": { 26 | "start": "gulp" 27 | }, 28 | "main": "keystone.js" 29 | } 30 | -------------------------------------------------------------------------------- /chapter-08/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-08/public/favicon.ico -------------------------------------------------------------------------------- /chapter-08/public/fonts/bootstrap/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-08/public/fonts/bootstrap/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /chapter-08/public/fonts/bootstrap/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-08/public/fonts/bootstrap/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /chapter-08/public/fonts/bootstrap/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-08/public/fonts/bootstrap/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /chapter-08/public/fonts/bootstrap/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-08/public/fonts/bootstrap/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /chapter-08/public/images/header-bg-1920x1440.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-08/public/images/header-bg-1920x1440.jpg -------------------------------------------------------------------------------- /chapter-08/public/images/logo-email.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-08/public/images/logo-email.gif -------------------------------------------------------------------------------- /chapter-08/public/js/bootstrap/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /chapter-08/public/js/scripts.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-08/public/js/scripts.js -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/_bootstrap-compass.scss: -------------------------------------------------------------------------------- 1 | @function twbs-font-path($path) { 2 | @return font-url($path, true); 3 | } 4 | 5 | @function twbs-image-path($path) { 6 | @return image-url($path, true); 7 | } 8 | 9 | $bootstrap-sass-asset-helper: true; 10 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/_bootstrap-mincer.scss: -------------------------------------------------------------------------------- 1 | // Mincer asset helper functions 2 | // 3 | // This must be imported into a .css.ejs.scss file. 4 | // Then, <% %>-interpolations will be parsed as strings by Sass, and evaluated by EJS after Sass compilation. 5 | 6 | 7 | @function twbs-font-path($path) { 8 | // do something like following 9 | // from "path/to/font.ext#suffix" to "<%- asset_path(path/to/font.ext)) + #suffix %>" 10 | // from "path/to/font.ext?#suffix" to "<%- asset_path(path/to/font.ext)) + ?#suffix %>" 11 | // or from "path/to/font.ext" just "<%- asset_path(path/to/font.ext)) %>" 12 | @return "<%- asset_path('#{$path}'.replace(/[#?].*$/, '')) + '#{$path}'.replace(/(^[^#?]*)([#?]?.*$)/, '$2') %>"; 13 | } 14 | 15 | @function twbs-image-path($file) { 16 | @return "<%- asset_path('#{$file}') %>"; 17 | } 18 | 19 | $bootstrap-sass-asset-helper: true; 20 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/_bootstrap-sprockets.scss: -------------------------------------------------------------------------------- 1 | @function twbs-font-path($path) { 2 | @return font-path($path); 3 | } 4 | 5 | @function twbs-image-path($path) { 6 | @return image-path($path); 7 | } 8 | 9 | $bootstrap-sass-asset-helper: true; 10 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/bootstrap/_breadcrumbs.scss: -------------------------------------------------------------------------------- 1 | // 2 | // Breadcrumbs 3 | // -------------------------------------------------- 4 | 5 | 6 | .breadcrumb { 7 | padding: $breadcrumb-padding-vertical $breadcrumb-padding-horizontal; 8 | margin-bottom: $line-height-computed; 9 | list-style: none; 10 | background-color: $breadcrumb-bg; 11 | border-radius: $border-radius-base; 12 | 13 | > li { 14 | display: inline-block; 15 | 16 | + li:before { 17 | content: "#{$breadcrumb-separator}\00a0"; // Unicode space added since inline-block means non-collapsing white-space 18 | padding: 0 5px; 19 | color: $breadcrumb-color; 20 | } 21 | } 22 | 23 | > .active { 24 | color: $breadcrumb-active-color; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/bootstrap/_close.scss: -------------------------------------------------------------------------------- 1 | // 2 | // Close icons 3 | // -------------------------------------------------- 4 | 5 | 6 | .close { 7 | float: right; 8 | font-size: ($font-size-base * 1.5); 9 | font-weight: $close-font-weight; 10 | line-height: 1; 11 | color: $close-color; 12 | text-shadow: $close-text-shadow; 13 | @include opacity(.2); 14 | 15 | &:hover, 16 | &:focus { 17 | color: $close-color; 18 | text-decoration: none; 19 | cursor: pointer; 20 | @include opacity(.5); 21 | } 22 | 23 | // [converter] extracted button& to button.close 24 | } 25 | 26 | // Additional properties for button version 27 | // iOS requires the button element instead of an anchor tag. 28 | // If you want the anchor version, it requires `href="#"`. 29 | // See https://developer.mozilla.org/en-US/docs/Web/Events/click#Safari_Mobile 30 | button.close { 31 | padding: 0; 32 | cursor: pointer; 33 | background: transparent; 34 | border: 0; 35 | -webkit-appearance: none; 36 | } 37 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/bootstrap/_component-animations.scss: -------------------------------------------------------------------------------- 1 | // 2 | // Component animations 3 | // -------------------------------------------------- 4 | 5 | // Heads up! 6 | // 7 | // We don't use the `.opacity()` mixin here since it causes a bug with text 8 | // fields in IE7-8. Source: https://github.com/twbs/bootstrap/pull/3552. 9 | 10 | .fade { 11 | opacity: 0; 12 | @include transition(opacity .15s linear); 13 | &.in { 14 | opacity: 1; 15 | } 16 | } 17 | 18 | .collapse { 19 | display: none; 20 | 21 | &.in { display: block; } 22 | // [converter] extracted tr&.in to tr.collapse.in 23 | // [converter] extracted tbody&.in to tbody.collapse.in 24 | } 25 | 26 | tr.collapse.in { display: table-row; } 27 | 28 | tbody.collapse.in { display: table-row-group; } 29 | 30 | .collapsing { 31 | position: relative; 32 | height: 0; 33 | overflow: hidden; 34 | @include transition-property(height, visibility); 35 | @include transition-duration(.35s); 36 | @include transition-timing-function(ease); 37 | } 38 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/bootstrap/_responsive-embed.scss: -------------------------------------------------------------------------------- 1 | // Embeds responsive 2 | // 3 | // Credit: Nicolas Gallagher and SUIT CSS. 4 | 5 | .embed-responsive { 6 | position: relative; 7 | display: block; 8 | height: 0; 9 | padding: 0; 10 | overflow: hidden; 11 | 12 | .embed-responsive-item, 13 | iframe, 14 | embed, 15 | object, 16 | video { 17 | position: absolute; 18 | top: 0; 19 | left: 0; 20 | bottom: 0; 21 | height: 100%; 22 | width: 100%; 23 | border: 0; 24 | } 25 | } 26 | 27 | // Modifier class for 16:9 aspect ratio 28 | .embed-responsive-16by9 { 29 | padding-bottom: 56.25%; 30 | } 31 | 32 | // Modifier class for 4:3 aspect ratio 33 | .embed-responsive-4by3 { 34 | padding-bottom: 75%; 35 | } 36 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/bootstrap/_utilities.scss: -------------------------------------------------------------------------------- 1 | // 2 | // Utility classes 3 | // -------------------------------------------------- 4 | 5 | 6 | // Floats 7 | // ------------------------- 8 | 9 | .clearfix { 10 | @include clearfix; 11 | } 12 | .center-block { 13 | @include center-block; 14 | } 15 | .pull-right { 16 | float: right !important; 17 | } 18 | .pull-left { 19 | float: left !important; 20 | } 21 | 22 | 23 | // Toggling content 24 | // ------------------------- 25 | 26 | // Note: Deprecated .hide in favor of .hidden or .sr-only (as appropriate) in v3.0.1 27 | .hide { 28 | display: none !important; 29 | } 30 | .show { 31 | display: block !important; 32 | } 33 | .invisible { 34 | visibility: hidden; 35 | } 36 | .text-hide { 37 | @include text-hide; 38 | } 39 | 40 | 41 | // Hide from screenreaders and browsers 42 | // 43 | // Credit: HTML5 Boilerplate 44 | 45 | .hidden { 46 | display: none !important; 47 | } 48 | 49 | 50 | // For Affix plugin 51 | // ------------------------- 52 | 53 | .affix { 54 | position: fixed; 55 | } 56 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/bootstrap/_wells.scss: -------------------------------------------------------------------------------- 1 | // 2 | // Wells 3 | // -------------------------------------------------- 4 | 5 | 6 | // Base class 7 | .well { 8 | min-height: 20px; 9 | padding: 19px; 10 | margin-bottom: 20px; 11 | background-color: $well-bg; 12 | border: 1px solid $well-border; 13 | border-radius: $border-radius-base; 14 | @include box-shadow(inset 0 1px 1px rgba(0,0,0,.05)); 15 | blockquote { 16 | border-color: #ddd; 17 | border-color: rgba(0,0,0,.15); 18 | } 19 | } 20 | 21 | // Sizes 22 | .well-lg { 23 | padding: 24px; 24 | border-radius: $border-radius-large; 25 | } 26 | .well-sm { 27 | padding: 9px; 28 | border-radius: $border-radius-small; 29 | } 30 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/bootstrap/mixins/_alerts.scss: -------------------------------------------------------------------------------- 1 | // Alerts 2 | 3 | @mixin alert-variant($background, $border, $text-color) { 4 | background-color: $background; 5 | border-color: $border; 6 | color: $text-color; 7 | 8 | hr { 9 | border-top-color: darken($border, 5%); 10 | } 11 | .alert-link { 12 | color: darken($text-color, 10%); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/bootstrap/mixins/_background-variant.scss: -------------------------------------------------------------------------------- 1 | // Contextual backgrounds 2 | 3 | // [converter] $parent hack 4 | @mixin bg-variant($parent, $color) { 5 | #{$parent} { 6 | background-color: $color; 7 | } 8 | a#{$parent}:hover, 9 | a#{$parent}:focus { 10 | background-color: darken($color, 10%); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/bootstrap/mixins/_border-radius.scss: -------------------------------------------------------------------------------- 1 | // Single side border-radius 2 | 3 | @mixin border-top-radius($radius) { 4 | border-top-right-radius: $radius; 5 | border-top-left-radius: $radius; 6 | } 7 | @mixin border-right-radius($radius) { 8 | border-bottom-right-radius: $radius; 9 | border-top-right-radius: $radius; 10 | } 11 | @mixin border-bottom-radius($radius) { 12 | border-bottom-right-radius: $radius; 13 | border-bottom-left-radius: $radius; 14 | } 15 | @mixin border-left-radius($radius) { 16 | border-bottom-left-radius: $radius; 17 | border-top-left-radius: $radius; 18 | } 19 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/bootstrap/mixins/_center-block.scss: -------------------------------------------------------------------------------- 1 | // Center-align a block level element 2 | 3 | @mixin center-block() { 4 | display: block; 5 | margin-left: auto; 6 | margin-right: auto; 7 | } 8 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/bootstrap/mixins/_clearfix.scss: -------------------------------------------------------------------------------- 1 | // Clearfix 2 | // 3 | // For modern browsers 4 | // 1. The space content is one way to avoid an Opera bug when the 5 | // contenteditable attribute is included anywhere else in the document. 6 | // Otherwise it causes space to appear at the top and bottom of elements 7 | // that are clearfixed. 8 | // 2. The use of `table` rather than `block` is only necessary if using 9 | // `:before` to contain the top-margins of child elements. 10 | // 11 | // Source: http://nicolasgallagher.com/micro-clearfix-hack/ 12 | 13 | @mixin clearfix() { 14 | &:before, 15 | &:after { 16 | content: " "; // 1 17 | display: table; // 2 18 | } 19 | &:after { 20 | clear: both; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/bootstrap/mixins/_hide-text.scss: -------------------------------------------------------------------------------- 1 | // CSS image replacement 2 | // 3 | // Heads up! v3 launched with only `.hide-text()`, but per our pattern for 4 | // mixins being reused as classes with the same name, this doesn't hold up. As 5 | // of v3.0.1 we have added `.text-hide()` and deprecated `.hide-text()`. 6 | // 7 | // Source: https://github.com/h5bp/html5-boilerplate/commit/aa0396eae757 8 | 9 | // Deprecated as of v3.0.1 (will be removed in v4) 10 | @mixin hide-text() { 11 | font: 0/0 a; 12 | color: transparent; 13 | text-shadow: none; 14 | background-color: transparent; 15 | border: 0; 16 | } 17 | 18 | // New mixin to use as of v3.0.1 19 | @mixin text-hide() { 20 | @include hide-text; 21 | } 22 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/bootstrap/mixins/_labels.scss: -------------------------------------------------------------------------------- 1 | // Labels 2 | 3 | @mixin label-variant($color) { 4 | background-color: $color; 5 | 6 | &[href] { 7 | &:hover, 8 | &:focus { 9 | background-color: darken($color, 10%); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/bootstrap/mixins/_list-group.scss: -------------------------------------------------------------------------------- 1 | // List Groups 2 | 3 | @mixin list-group-item-variant($state, $background, $color) { 4 | .list-group-item-#{$state} { 5 | color: $color; 6 | background-color: $background; 7 | 8 | // [converter] extracted a&, button& to a.list-group-item-#{$state}, button.list-group-item-#{$state} 9 | } 10 | 11 | a.list-group-item-#{$state}, 12 | button.list-group-item-#{$state} { 13 | color: $color; 14 | 15 | .list-group-item-heading { 16 | color: inherit; 17 | } 18 | 19 | &:hover, 20 | &:focus { 21 | color: $color; 22 | background-color: darken($background, 5%); 23 | } 24 | &.active, 25 | &.active:hover, 26 | &.active:focus { 27 | color: #fff; 28 | background-color: $color; 29 | border-color: $color; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/bootstrap/mixins/_nav-divider.scss: -------------------------------------------------------------------------------- 1 | // Horizontal dividers 2 | // 3 | // Dividers (basically an hr) within dropdowns and nav lists 4 | 5 | @mixin nav-divider($color: #e5e5e5) { 6 | height: 1px; 7 | margin: (($line-height-computed / 2) - 1) 0; 8 | overflow: hidden; 9 | background-color: $color; 10 | } 11 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/bootstrap/mixins/_nav-vertical-align.scss: -------------------------------------------------------------------------------- 1 | // Navbar vertical align 2 | // 3 | // Vertically center elements in the navbar. 4 | // Example: an element has a height of 30px, so write out `.navbar-vertical-align(30px);` to calculate the appropriate top margin. 5 | 6 | @mixin navbar-vertical-align($element-height) { 7 | margin-top: (($navbar-height - $element-height) / 2); 8 | margin-bottom: (($navbar-height - $element-height) / 2); 9 | } 10 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/bootstrap/mixins/_opacity.scss: -------------------------------------------------------------------------------- 1 | // Opacity 2 | 3 | @mixin opacity($opacity) { 4 | opacity: $opacity; 5 | // IE8 filter 6 | $opacity-ie: ($opacity * 100); 7 | filter: alpha(opacity=$opacity-ie); 8 | } 9 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/bootstrap/mixins/_pagination.scss: -------------------------------------------------------------------------------- 1 | // Pagination 2 | 3 | @mixin pagination-size($padding-vertical, $padding-horizontal, $font-size, $line-height, $border-radius) { 4 | > li { 5 | > a, 6 | > span { 7 | padding: $padding-vertical $padding-horizontal; 8 | font-size: $font-size; 9 | line-height: $line-height; 10 | } 11 | &:first-child { 12 | > a, 13 | > span { 14 | @include border-left-radius($border-radius); 15 | } 16 | } 17 | &:last-child { 18 | > a, 19 | > span { 20 | @include border-right-radius($border-radius); 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/bootstrap/mixins/_panels.scss: -------------------------------------------------------------------------------- 1 | // Panels 2 | 3 | @mixin panel-variant($border, $heading-text-color, $heading-bg-color, $heading-border) { 4 | border-color: $border; 5 | 6 | & > .panel-heading { 7 | color: $heading-text-color; 8 | background-color: $heading-bg-color; 9 | border-color: $heading-border; 10 | 11 | + .panel-collapse > .panel-body { 12 | border-top-color: $border; 13 | } 14 | .badge { 15 | color: $heading-bg-color; 16 | background-color: $heading-text-color; 17 | } 18 | } 19 | & > .panel-footer { 20 | + .panel-collapse > .panel-body { 21 | border-bottom-color: $border; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/bootstrap/mixins/_progress-bar.scss: -------------------------------------------------------------------------------- 1 | // Progress bars 2 | 3 | @mixin progress-bar-variant($color) { 4 | background-color: $color; 5 | 6 | // Deprecated parent class requirement as of v3.2.0 7 | .progress-striped & { 8 | @include gradient-striped; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/bootstrap/mixins/_reset-filter.scss: -------------------------------------------------------------------------------- 1 | // Reset filters for IE 2 | // 3 | // When you need to remove a gradient background, do not forget to use this to reset 4 | // the IE filter for IE9 and below. 5 | 6 | @mixin reset-filter() { 7 | filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); 8 | } 9 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/bootstrap/mixins/_reset-text.scss: -------------------------------------------------------------------------------- 1 | @mixin reset-text() { 2 | font-family: $font-family-base; 3 | // We deliberately do NOT reset font-size. 4 | font-style: normal; 5 | font-weight: normal; 6 | letter-spacing: normal; 7 | line-break: auto; 8 | line-height: $line-height-base; 9 | text-align: left; // Fallback for where `start` is not supported 10 | text-align: start; 11 | text-decoration: none; 12 | text-shadow: none; 13 | text-transform: none; 14 | white-space: normal; 15 | word-break: normal; 16 | word-spacing: normal; 17 | word-wrap: normal; 18 | } 19 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/bootstrap/mixins/_resize.scss: -------------------------------------------------------------------------------- 1 | // Resize anything 2 | 3 | @mixin resizable($direction) { 4 | resize: $direction; // Options: horizontal, vertical, both 5 | overflow: auto; // Per CSS3 UI, `resize` only applies when `overflow` isn't `visible` 6 | } 7 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/bootstrap/mixins/_responsive-visibility.scss: -------------------------------------------------------------------------------- 1 | // Responsive utilities 2 | 3 | // 4 | // More easily include all the states for responsive-utilities.less. 5 | // [converter] $parent hack 6 | @mixin responsive-visibility($parent) { 7 | #{$parent} { 8 | display: block !important; 9 | } 10 | table#{$parent} { display: table !important; } 11 | tr#{$parent} { display: table-row !important; } 12 | th#{$parent}, 13 | td#{$parent} { display: table-cell !important; } 14 | } 15 | 16 | // [converter] $parent hack 17 | @mixin responsive-invisibility($parent) { 18 | #{$parent} { 19 | display: none !important; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/bootstrap/mixins/_size.scss: -------------------------------------------------------------------------------- 1 | // Sizing shortcuts 2 | 3 | @mixin size($width, $height) { 4 | width: $width; 5 | height: $height; 6 | } 7 | 8 | @mixin square($size) { 9 | @include size($size, $size); 10 | } 11 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/bootstrap/mixins/_tab-focus.scss: -------------------------------------------------------------------------------- 1 | // WebKit-style focus 2 | 3 | @mixin tab-focus() { 4 | // Default 5 | outline: thin dotted; 6 | // WebKit 7 | outline: 5px auto -webkit-focus-ring-color; 8 | outline-offset: -2px; 9 | } 10 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/bootstrap/mixins/_table-row.scss: -------------------------------------------------------------------------------- 1 | // Tables 2 | 3 | @mixin table-row-variant($state, $background) { 4 | // Exact selectors below required to override `.table-striped` and prevent 5 | // inheritance to nested tables. 6 | .table > thead > tr, 7 | .table > tbody > tr, 8 | .table > tfoot > tr { 9 | > td.#{$state}, 10 | > th.#{$state}, 11 | &.#{$state} > td, 12 | &.#{$state} > th { 13 | background-color: $background; 14 | } 15 | } 16 | 17 | // Hover states for `.table-hover` 18 | // Note: this is not available for cells or rows within `thead` or `tfoot`. 19 | .table-hover > tbody > tr { 20 | > td.#{$state}:hover, 21 | > th.#{$state}:hover, 22 | &.#{$state}:hover > td, 23 | &:hover > .#{$state}, 24 | &.#{$state}:hover > th { 25 | background-color: darken($background, 5%); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/bootstrap/mixins/_text-emphasis.scss: -------------------------------------------------------------------------------- 1 | // Typography 2 | 3 | // [converter] $parent hack 4 | @mixin text-emphasis-variant($parent, $color) { 5 | #{$parent} { 6 | color: $color; 7 | } 8 | a#{$parent}:hover, 9 | a#{$parent}:focus { 10 | color: darken($color, 10%); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /chapter-08/public/styles/bootstrap/bootstrap/mixins/_text-overflow.scss: -------------------------------------------------------------------------------- 1 | // Text overflow 2 | // Requires inline-block or block for proper styling 3 | 4 | @mixin text-overflow() { 5 | overflow: hidden; 6 | text-overflow: ellipsis; 7 | white-space: nowrap; 8 | } 9 | -------------------------------------------------------------------------------- /chapter-08/public/styles/site.scss: -------------------------------------------------------------------------------- 1 | // Bootstrap 2 | // ========= 3 | 4 | // Bootstrap can be removed entirely by deleting this line. 5 | 6 | @import "bootstrap/bootstrap"; 7 | 8 | // The easiest way to customise Bootstrap variables while 9 | // being able to easily override the source files with new 10 | // versions is to override the ones you want in another file. 11 | // 12 | // You can also add your own custom variables to this file for 13 | // use in your site stylesheets. 14 | 15 | @import "site/variables"; 16 | 17 | // Add mixins 18 | @import "site/mixins"; 19 | // Site Styles 20 | // =========== 21 | 22 | // Add your own site style includes here 23 | @import "site/layout"; 24 | -------------------------------------------------------------------------------- /chapter-08/public/styles/site/_mixins.scss: -------------------------------------------------------------------------------- 1 | // Mixins 2 | 3 | @mixin transition-all() { 4 | -webkit-transition: all 0.5s; 5 | -moz-transition: all 0.5s; 6 | transition: all 0.5s; 7 | } 8 | 9 | @mixin background-cover() { 10 | -webkit-background-size: cover; 11 | -moz-background-size: cover; 12 | background-size: cover; 13 | -o-background-size: cover; 14 | } 15 | 16 | @mixin serif() { 17 | font-family: 'Lora', 'Times New Roman', serif; 18 | } 19 | 20 | @mixin sans-serif () { 21 | font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; 22 | } 23 | -------------------------------------------------------------------------------- /chapter-08/public/styles/site/_variables.scss: -------------------------------------------------------------------------------- 1 | // Override Bootstrap variables in this file, e.g. 2 | 3 | $font-size-base: 14px; 4 | 5 | // Theme Variables 6 | 7 | $brand-primary: #0085A1; 8 | $gray-dark: lighten(black, 25%); 9 | $gray: lighten(black, 50%); 10 | $white-faded: fade(white, 80%); 11 | $gray-light: #eee; 12 | -------------------------------------------------------------------------------- /chapter-08/routes/views/about.js: -------------------------------------------------------------------------------- 1 | var keystone = require('keystone'); 2 | 3 | 4 | exports = module.exports = function (req, res) { 5 | 6 | var view = new keystone.View(req, res); 7 | var locals = res.locals; 8 | 9 | // locals.section is used to set the currently selected 10 | // item in the header navigation. 11 | locals.section = 'about'; 12 | 13 | // Add code to show posts on index 14 | locals.data = { 15 | abouts: [] 16 | }; 17 | 18 | view.on('init', function(next) { 19 | 20 | var q = keystone.list('About').model.find() 21 | .limit('1'); 22 | 23 | q.exec(function(err, results) { 24 | locals.data.abouts = results; 25 | next(err); 26 | }); 27 | }); 28 | 29 | // Render the view 30 | view.render('about'); 31 | }; 32 | -------------------------------------------------------------------------------- /chapter-08/routes/views/gallery.js: -------------------------------------------------------------------------------- 1 | var keystone = require('keystone'); 2 | 3 | exports = module.exports = function (req, res) { 4 | 5 | var view = new keystone.View(req, res); 6 | var locals = res.locals; 7 | 8 | // Set locals 9 | locals.section = 'gallery'; 10 | 11 | // Load the galleries by sortOrder 12 | view.query('galleries', keystone.list('Gallery').model.find().sort('sortOrder')); 13 | 14 | // Render the view 15 | view.render('gallery'); 16 | 17 | }; 18 | -------------------------------------------------------------------------------- /chapter-08/routes/views/index.js: -------------------------------------------------------------------------------- 1 | var keystone = require('keystone'); 2 | 3 | 4 | exports = module.exports = function (req, res) { 5 | 6 | var view = new keystone.View(req, res); 7 | var locals = res.locals; 8 | 9 | // locals.section is used to set the currently selected 10 | // item in the header navigation. 11 | locals.section = 'home'; 12 | 13 | // Add code to show posts on index 14 | locals.data = { 15 | posts: [] 16 | }; 17 | 18 | view.on('init', function(next) { 19 | 20 | var q = keystone.list('Post').model.find() 21 | .where('state', 'published') 22 | .sort('-publishedDate') 23 | .populate('author') 24 | .limit('4'); 25 | 26 | q.exec(function(err, results) { 27 | locals.data.posts = results; 28 | next(err); 29 | }); 30 | }); 31 | 32 | // Render the view 33 | view.render('index'); 34 | }; 35 | -------------------------------------------------------------------------------- /chapter-08/templates/themes/default/views/errors/404.swig: -------------------------------------------------------------------------------- 1 | {% extends "../../layouts/default.swig" %} 2 | 3 | {% block content %} 4 |
5 |

404

6 |

Sorry, the page you requested can"t be found.

7 |
8 | {% endblock %} 9 | -------------------------------------------------------------------------------- /chapter-08/templates/themes/default/views/errors/500.swig: -------------------------------------------------------------------------------- 1 | {% extends "../../layouts/default.swig" %} 2 | 3 | {% block content %} 4 |
5 |

Error (500)

6 |

Sorry, the site has encountered an error.

7 |
8 | {% endblock %} 9 | -------------------------------------------------------------------------------- /chapter-08/templates/themes/newBlog/views/about.swig: -------------------------------------------------------------------------------- 1 | {% extends "../layouts/default.swig" %} 2 | 3 | {% block content %} 4 |
5 |
6 |
7 | {% for about in data.abouts %} 8 |

{{ about.title }}

9 |

{{ about.description }}

10 |
11 | {% endfor %} 12 |
13 |
14 | {% endblock %} 15 | -------------------------------------------------------------------------------- /chapter-08/templates/themes/newBlog/views/errors/404.swig: -------------------------------------------------------------------------------- 1 | {% extends "../../layouts/default.swig" %} 2 | 3 | {% block content %} 4 |
5 |

404

6 |

Sorry, the page you requested can"t be found.

7 |
8 | {% endblock %} 9 | -------------------------------------------------------------------------------- /chapter-08/templates/themes/newBlog/views/errors/500.swig: -------------------------------------------------------------------------------- 1 | {% extends "../../layouts/default.swig" %} 2 | 3 | {% block content %} 4 |
5 |

Error (500)

6 |

Sorry, the site has encountered an error.

7 |
8 | {% endblock %} 9 | -------------------------------------------------------------------------------- /chapter-09/.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "src/components", 3 | "json": "bower.json" 4 | } 5 | -------------------------------------------------------------------------------- /chapter-09/.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # http://editorconfig.org 4 | 5 | root = true 6 | 7 | [*] 8 | indent_style = space 9 | indent_size = 2 10 | end_of_line = lf 11 | charset = utf-8 12 | trim_trailing_whitespace = true 13 | insert_final_newline = true 14 | -------------------------------------------------------------------------------- /chapter-09/.eslintignore: -------------------------------------------------------------------------------- 1 | /client/ -------------------------------------------------------------------------------- /chapter-09/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "loopback" 3 | } 4 | -------------------------------------------------------------------------------- /chapter-09/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true 4 | }, 5 | "globals": { 6 | "angular": 1, 7 | "module": 1, 8 | "exports": 1 9 | }, 10 | "extends": "eslint:recommended", 11 | "rules": { 12 | "linebreak-style": [ 13 | "error", 14 | "unix" 15 | ], 16 | "no-mixed-spaces-and-tabs": 0, 17 | "quotes": 0, 18 | "semi": 0, 19 | "comma-dangle": 1, 20 | "no-console": 0 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /chapter-09/.gitignore: -------------------------------------------------------------------------------- 1 | *.csv 2 | *.dat 3 | *.iml 4 | *.log 5 | *.out 6 | *.pid 7 | *.seed 8 | *.sublime-* 9 | *.swo 10 | *.swp 11 | *.tgz 12 | *.xml 13 | .DS_Store 14 | .idea 15 | .project 16 | .strong-pm 17 | coverage 18 | node_modules 19 | npm-debug.log 20 | 21 | src/components/ 22 | -------------------------------------------------------------------------------- /chapter-09/.yo-rc.json: -------------------------------------------------------------------------------- 1 | { 2 | "generator-loopback": {} 3 | } -------------------------------------------------------------------------------- /chapter-09/Procfile: -------------------------------------------------------------------------------- 1 | web: slc run 2 | -------------------------------------------------------------------------------- /chapter-09/arc-manager.json: -------------------------------------------------------------------------------- 1 | { 2 | "ids": { 3 | "ManagerHost": 2, 4 | "LoadBalancer": 1 5 | }, 6 | "models": { 7 | "ManagerHost": { 8 | "5ff77321-1955-43a6-bf27-c8bb1435763c": "{\"id\":\"5ff77321-1955-43a6-bf27-c8bb1435763c\",\"host\":\"localhost\",\"port\":8701,\"actions\":[\"delete\",\"edit\",\"env-set\",\"env-get\"],\"protocol\":\"http\",\"created\":1465781722535,\"error\":null,\"errorType\":null,\"app\":null,\"processes\":{\"pids\":[]}}" 9 | }, 10 | "LoadBalancer": {} 11 | } 12 | } -------------------------------------------------------------------------------- /chapter-09/bin/deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit # Exit on error 4 | 5 | npm run build # Generate the bundled Javascript and CSS 6 | 7 | git push heroku master # Deploy to Heroku 8 | -------------------------------------------------------------------------------- /chapter-09/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chapter-09", 3 | "version": "0.0.1", 4 | "authors": [ 5 | "fernando monteiro " 6 | ], 7 | "description": "Node 6 blueprints book, chapter 09 example", 8 | "keywords": [ 9 | "Npm", 10 | "building", 11 | "process" 12 | ], 13 | "license": "MIT", 14 | "ignore": [ 15 | "**/.*", 16 | "node_modules", 17 | "bower_components", 18 | "test", 19 | "tests" 20 | ], 21 | "dependencies": { 22 | "bootstrap": "v4.0.0-alpha", 23 | "fancybox": "~2.1.5", 24 | "angular": "angularjs#1.5.0", 25 | "angular-resource": "1.5.0", 26 | "angular-ui-router": "~0.3.1" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /chapter-09/client/README.md: -------------------------------------------------------------------------------- 1 | ## Client 2 | 3 | This is the place for your application front-end files. 4 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | Bootstrap uses [GitHub's Releases feature](https://github.com/blog/1547-release-your-software) for its changelogs. 2 | 3 | See [the Releases section of our GitHub project](https://github.com/twbs/bootstrap/releases) for changelogs for each release version of Bootstrap. 4 | 5 | Release announcement posts on [the official Bootstrap blog](http://blog.getbootstrap.com) contain summaries of the most noteworthy changes made in each release. 6 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/Gemfile: -------------------------------------------------------------------------------- 1 | # Ruby Gems for building and testing Bootstrap 2 | # Run `grunt update-gemfile-lock` to update to the latest compatible versions 3 | 4 | source 'https://rubygems.org' 5 | 6 | group :development, :test do 7 | gem 'jekyll', '~> 2.5.2' 8 | gem 'rouge', '~> 1.7.4' 9 | gem 'sass', '~> 3.4.9' 10 | gem 'scss-lint', '~> 0.31' 11 | end 12 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bootstrap", 3 | "description": "The most popular front-end framework for developing responsive, mobile first projects on the web.", 4 | "keywords": [ 5 | "css", 6 | "js", 7 | "sass", 8 | "mobile-first", 9 | "responsive", 10 | "front-end", 11 | "framework", 12 | "web" 13 | ], 14 | "homepage": "http://getbootstrap.com", 15 | "license": "MIT", 16 | "moduleType": "globals", 17 | "main": [ 18 | "scss/bootstrap.scss", 19 | "dist/js/bootstrap.js" 20 | ], 21 | "ignore": [ 22 | "/.*", 23 | "_config.yml", 24 | "CNAME", 25 | "composer.json", 26 | "CONTRIBUTING.md", 27 | "docs", 28 | "js/tests", 29 | "test-infra" 30 | ], 31 | "dependencies": { 32 | "jquery": "1.9.1 - 2" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/dist/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('./umd/util.js') 3 | require('./umd/alert.js') 4 | require('./umd/button.js') 5 | require('./umd/carousel.js') 6 | require('./umd/collapse.js') 7 | require('./umd/dropdown.js') 8 | require('./umd/modal.js') 9 | require('./umd/scrollspy.js') 10 | require('./umd/tab.js') 11 | require('./umd/tooltip.js') 12 | require('./umd/popover.js') -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/grunt/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends" : "../js/.jshintrc", 3 | "asi" : false, 4 | "browser" : false, 5 | "es3" : false, 6 | "node" : true 7 | } 8 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/package.js: -------------------------------------------------------------------------------- 1 | // package metadata file for Meteor.js 2 | 3 | /* jshint strict:false */ 4 | /* global Package:true */ 5 | 6 | Package.describe({ 7 | name: 'twbs:bootstrap', // http://atmospherejs.com/twbs/bootstrap 8 | summary: 'The most popular front-end framework for developing responsive, mobile first projects on the web.', 9 | version: '3.3.5', 10 | git: 'https://github.com/twbs/bootstrap.git' 11 | }); 12 | 13 | Package.onUse(function (api) { 14 | api.versionsFrom('METEOR@1.0'); 15 | api.use('jquery', 'client'); 16 | api.addFiles([ 17 | 'dist/fonts/glyphicons-halflings-regular.eot', 18 | 'dist/fonts/glyphicons-halflings-regular.svg', 19 | 'dist/fonts/glyphicons-halflings-regular.ttf', 20 | 'dist/fonts/glyphicons-halflings-regular.woff', 21 | 'dist/fonts/glyphicons-halflings-regular.woff2' 22 | ], 'client', { isAsset: true }); 23 | api.addFiles([ 24 | 'dist/css/bootstrap.css', 25 | 'dist/js/bootstrap.js' 26 | ], 'client'); 27 | }); 28 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/sache.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bootstrap", 3 | "description": "The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.", 4 | "tags": ["bootstrap", "grid", "typography", "buttons", "ui", "responsive-web-design"] 5 | } 6 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/_animation.scss: -------------------------------------------------------------------------------- 1 | .fade { 2 | opacity: 0; 3 | transition: opacity .15s linear; 4 | 5 | &.in { 6 | opacity: 1; 7 | } 8 | } 9 | 10 | .collapse { 11 | display: none; 12 | 13 | &.in { 14 | display: block; 15 | } 16 | // tr&.in { display: table-row; } 17 | // tbody&.in { display: table-row-group; } 18 | } 19 | 20 | .collapsing { 21 | position: relative; 22 | height: 0; 23 | overflow: hidden; 24 | transition-timing-function: ease; 25 | transition-duration: .35s; 26 | transition-property: height; 27 | } 28 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/_breadcrumb.scss: -------------------------------------------------------------------------------- 1 | .breadcrumb { 2 | padding: $breadcrumb-padding-vertical $breadcrumb-padding-horizontal; 3 | margin-bottom: $spacer-y; 4 | list-style: none; 5 | background-color: $breadcrumb-bg; 6 | @include border-radius($border-radius); 7 | 8 | > li { 9 | display: inline-block; 10 | 11 | + li:before { 12 | $nbsp: "\00a0"; 13 | padding-right: .5rem; 14 | padding-left: .5rem; 15 | color: $breadcrumb-divider-color; 16 | content: "#{$breadcrumb-divider}#{$nbsp}"; // Unicode space added since inline-block means non-collapsing white-space 17 | } 18 | } 19 | 20 | > .active { 21 | color: $breadcrumb-active-color; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/_close.scss: -------------------------------------------------------------------------------- 1 | .close { 2 | float: right; 3 | font-size: ($font-size-base * 1.5); 4 | font-weight: $close-font-weight; 5 | line-height: 1; 6 | color: $close-color; 7 | text-shadow: $close-text-shadow; 8 | opacity: .2; 9 | 10 | @include hover-focus { 11 | color: $close-color; 12 | text-decoration: none; 13 | cursor: pointer; 14 | opacity: .5; 15 | } 16 | } 17 | 18 | // Additional properties for button version 19 | // iOS requires the button element instead of an anchor tag. 20 | // If you want the anchor version, it requires `href="#"`. 21 | // See https://developer.mozilla.org/en-US/docs/Web/Events/click#Safari_Mobile 22 | button.close { 23 | padding: 0; 24 | cursor: pointer; 25 | background: transparent; 26 | border: 0; 27 | -webkit-appearance: none; 28 | } 29 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/_images.scss: -------------------------------------------------------------------------------- 1 | // Responsive images (ensure images don't scale beyond their parents) 2 | .img-responsive { 3 | @include img-responsive(); 4 | } 5 | 6 | // Rounded corners 7 | .img-rounded { 8 | @include border-radius($border-radius-lg); 9 | } 10 | 11 | // Image thumbnails 12 | .img-thumbnail { 13 | padding: $thumbnail-padding; 14 | line-height: $line-height; 15 | background-color: $thumbnail-bg; 16 | border: 1px solid $thumbnail-border; 17 | border-radius: $thumbnail-border-radius; 18 | transition: all .2s ease-in-out; 19 | @include box-shadow(0 1px 2px rgba(0,0,0,.075)); 20 | 21 | // Keep them at most 100% wide 22 | @include img-responsive(inline-block); 23 | } 24 | 25 | // Perfect circle 26 | .img-circle { 27 | border-radius: 50%; 28 | } 29 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/_jumbotron.scss: -------------------------------------------------------------------------------- 1 | .jumbotron { 2 | padding: $jumbotron-padding ($jumbotron-padding / 2); 3 | margin-bottom: $jumbotron-padding; 4 | background-color: $jumbotron-bg; 5 | @include border-radius($border-radius-lg); 6 | } 7 | 8 | .jumbotron-hr { 9 | border-top-color: darken($jumbotron-bg, 10%); 10 | } 11 | 12 | @include media-breakpoint-up(sm) { 13 | .jumbotron { 14 | padding: ($jumbotron-padding * 2) $jumbotron-padding; 15 | } 16 | } 17 | 18 | .jumbotron-fluid { 19 | padding-right: 0; 20 | padding-left: 0; 21 | @include border-radius(0); 22 | } 23 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/_responsive-embed.scss: -------------------------------------------------------------------------------- 1 | // Credit: Nicolas Gallagher and SUIT CSS. 2 | 3 | .embed-responsive { 4 | position: relative; 5 | display: block; 6 | height: 0; 7 | padding: 0; 8 | overflow: hidden; 9 | 10 | .embed-responsive-item, 11 | iframe, 12 | embed, 13 | object, 14 | video { 15 | position: absolute; 16 | top: 0; 17 | bottom: 0; 18 | left: 0; 19 | width: 100%; 20 | height: 100%; 21 | border: 0; 22 | } 23 | } 24 | 25 | // Modifier class for 21:9 aspect ratio 26 | .embed-responsive-21by9 { 27 | padding-bottom: percentage(9 / 21); 28 | } 29 | 30 | // Modifier class for 16:9 aspect ratio 31 | .embed-responsive-16by9 { 32 | padding-bottom: percentage(9 / 16); 33 | } 34 | 35 | // Modifier class for 4:3 aspect ratio 36 | .embed-responsive-4by3 { 37 | padding-bottom: percentage(3 / 4); 38 | } 39 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/bootstrap-flex.scss: -------------------------------------------------------------------------------- 1 | // Bootstrap with Flexbox enabled 2 | // 3 | // Includes all the imports from the standard Bootstrap project, but enables 4 | // the flexbox variable. 5 | 6 | $enable-flex: true; 7 | 8 | @import "bootstrap"; 9 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/bootstrap-reboot.scss: -------------------------------------------------------------------------------- 1 | // Bootstrap Reboot only 2 | // 3 | // Includes only Normalize and our custom Reboot reset. 4 | 5 | @import "variables"; 6 | @import "mixins/hover"; 7 | @import "mixins/tab-focus"; 8 | 9 | @import "normalize"; 10 | @import "reboot"; 11 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/mixins/_alert.scss: -------------------------------------------------------------------------------- 1 | // Alerts 2 | 3 | @mixin alert-variant($background, $border, $body-color) { 4 | background-color: $background; 5 | border-color: $border; 6 | color: $body-color; 7 | 8 | hr { 9 | border-top-color: darken($border, 5%); 10 | } 11 | .alert-link { 12 | color: darken($body-color, 10%); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/mixins/_background-variant.scss: -------------------------------------------------------------------------------- 1 | // Contextual backgrounds 2 | 3 | // [converter] $parent hack 4 | @mixin bg-variant($parent, $color) { 5 | #{$parent} { 6 | color: #fff; 7 | background-color: $color; 8 | } 9 | a#{$parent} { 10 | @include hover-focus { 11 | background-color: darken($color, 10%); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/mixins/_border-radius.scss: -------------------------------------------------------------------------------- 1 | // Single side border-radius 2 | 3 | @mixin border-top-radius($radius) { 4 | border-top-right-radius: $radius; 5 | border-top-left-radius: $radius; 6 | } 7 | 8 | @mixin border-right-radius($radius) { 9 | border-bottom-right-radius: $radius; 10 | border-top-right-radius: $radius; 11 | } 12 | 13 | @mixin border-bottom-radius($radius) { 14 | border-bottom-right-radius: $radius; 15 | border-bottom-left-radius: $radius; 16 | } 17 | 18 | @mixin border-left-radius($radius) { 19 | border-bottom-left-radius: $radius; 20 | border-top-left-radius: $radius; 21 | } 22 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/mixins/_center-block.scss: -------------------------------------------------------------------------------- 1 | // Center-align a block level element 2 | 3 | @mixin center-block() { 4 | display: block; 5 | margin-left: auto; 6 | margin-right: auto; 7 | } 8 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/mixins/_clearfix.scss: -------------------------------------------------------------------------------- 1 | // Clearfix 2 | // 3 | // For modern browsers 4 | // 1. The space content is one way to avoid an Opera bug when the 5 | // contenteditable attribute is included anywhere else in the document. 6 | // Otherwise it causes space to appear at the top and bottom of elements 7 | // that are clearfixed. 8 | // 2. The use of `table` rather than `block` is only necessary if using 9 | // `:before` to contain the top-margins of child elements. 10 | // 11 | // Source: http://nicolasgallagher.com/micro-clearfix-hack/ 12 | 13 | @mixin clearfix() { 14 | &:before, 15 | &:after { 16 | content: " "; // 1 17 | display: table; // 2 18 | } 19 | &:after { 20 | clear: both; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/mixins/_hide-text.scss: -------------------------------------------------------------------------------- 1 | // CSS image replacement 2 | @mixin text-hide() { 3 | font: "0/0" a; 4 | color: transparent; 5 | text-shadow: none; 6 | background-color: transparent; 7 | border: 0; 8 | } 9 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/mixins/_label.scss: -------------------------------------------------------------------------------- 1 | // Labels 2 | 3 | @mixin label-variant($color) { 4 | background-color: $color; 5 | 6 | &[href] { 7 | @include hover-focus { 8 | background-color: darken($color, 10%); 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/mixins/_list-group.scss: -------------------------------------------------------------------------------- 1 | // List Groups 2 | 3 | @mixin list-group-item-variant($state, $background, $color) { 4 | .list-group-item-#{state} { 5 | color: $color; 6 | background-color: $background; 7 | } 8 | 9 | a.list-group-item-#{state}, 10 | button.list-group-item-#{state} { 11 | color: $color; 12 | 13 | .list-group-item-heading { 14 | color: inherit; 15 | } 16 | 17 | @include hover-focus { 18 | color: $color; 19 | background-color: darken($background, 5%); 20 | } 21 | 22 | &.active { 23 | @include plain-hover-focus { 24 | color: #fff; 25 | background-color: $color; 26 | border-color: $color; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/mixins/_nav-divider.scss: -------------------------------------------------------------------------------- 1 | // Horizontal dividers 2 | // 3 | // Dividers (basically an hr) within dropdowns and nav lists 4 | 5 | @mixin nav-divider($color: #e5e5e5) { 6 | height: 1px; 7 | margin: ($spacer-y / 2) 0; 8 | overflow: hidden; 9 | background-color: $color; 10 | } 11 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/mixins/_navbar-align.scss: -------------------------------------------------------------------------------- 1 | // Navbar vertical align 2 | // 3 | // Vertically center elements in the navbar. 4 | // Example: an element has a height of 30px, so write out `.navbar-vertical-align(30px);` to calculate the appropriate top margin. 5 | 6 | // @mixin navbar-vertical-align($element-height) { 7 | // margin-top: (($navbar-height - $element-height) / 2); 8 | // margin-bottom: (($navbar-height - $element-height) / 2); 9 | // } 10 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/mixins/_pagination.scss: -------------------------------------------------------------------------------- 1 | // Pagination 2 | 3 | @mixin pagination-size($padding-vertical, $padding-horizontal, $font-size, $line-height, $border-radius) { 4 | > li { 5 | > a, 6 | > span { 7 | padding: $padding-vertical $padding-horizontal; 8 | font-size: $font-size; 9 | line-height: $line-height; 10 | } 11 | &:first-child { 12 | > a, 13 | > span { 14 | @include border-left-radius($border-radius); 15 | } 16 | } 17 | &:last-child { 18 | > a, 19 | > span { 20 | @include border-right-radius($border-radius); 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/mixins/_progress.scss: -------------------------------------------------------------------------------- 1 | // Progress bars 2 | 3 | @mixin progress-variant($color) { 4 | &[value]::-webkit-progress-value { 5 | background-color: $color; 6 | } 7 | 8 | &[value]::-moz-progress-bar { 9 | background-color: $color; 10 | } 11 | 12 | @media screen and (min-width:0\0) { 13 | .progress-bar { 14 | background-color: $color; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/mixins/_pulls.scss: -------------------------------------------------------------------------------- 1 | @mixin pull-left { 2 | float: left !important; 3 | } 4 | @mixin pull-right { 5 | float: right !important; 6 | } 7 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/mixins/_reset-filter.scss: -------------------------------------------------------------------------------- 1 | // Reset filters for IE 2 | // 3 | // When you need to remove a gradient background, do not forget to use this to reset 4 | // the IE filter for IE9. 5 | 6 | @mixin reset-filter() { 7 | filter: "progid:DXImageTransform.Microsoft.gradient(enabled = false)"; 8 | } 9 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/mixins/_reset-text.scss: -------------------------------------------------------------------------------- 1 | @mixin reset-text { 2 | font-family: $font-family-base; 3 | // We deliberately do NOT reset font-size. 4 | font-style: normal; 5 | font-weight: normal; 6 | letter-spacing: normal; 7 | line-break: auto; 8 | line-height: $line-height; 9 | text-align: left; // Fallback for where `start` is not supported 10 | text-align: start; 11 | text-decoration: none; 12 | text-shadow: none; 13 | text-transform: none; 14 | white-space: normal; 15 | word-break: normal; 16 | word-spacing: normal; 17 | word-wrap: normal; 18 | } 19 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/mixins/_resize.scss: -------------------------------------------------------------------------------- 1 | // Resize anything 2 | 3 | @mixin resizable($direction) { 4 | resize: $direction; // Options: horizontal, vertical, both 5 | overflow: auto; // Per CSS3 UI, `resize` only applies when `overflow` isn't `visible` 6 | } 7 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/mixins/_responsive-visibility.scss: -------------------------------------------------------------------------------- 1 | // Responsive utilities 2 | 3 | // 4 | // More easily include all the states for responsive-utilities.less. 5 | // [converter] $parent hack 6 | @mixin responsive-visibility($parent) { 7 | #{$parent} { 8 | display: block !important; 9 | } 10 | table#{$parent} { display: table !important; } 11 | tr#{$parent} { display: table-row !important; } 12 | th#{$parent}, 13 | td#{$parent} { display: table-cell !important; } 14 | } 15 | 16 | // [converter] $parent hack 17 | @mixin responsive-invisibility($parent) { 18 | #{$parent} { 19 | display: none !important; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/mixins/_screen-reader.scss: -------------------------------------------------------------------------------- 1 | // Only display content to screen readers 2 | // 3 | // See: http://a11yproject.com/posts/how-to-hide-content/ 4 | 5 | @mixin sr-only { 6 | position: absolute; 7 | width: 1px; 8 | height: 1px; 9 | padding: 0; 10 | margin: -1px; 11 | overflow: hidden; 12 | clip: rect(0,0,0,0); 13 | border: 0; 14 | } 15 | 16 | // Use in conjunction with .sr-only to only display content when it's focused. 17 | // 18 | // Useful for "Skip to main content" links; see http://www.w3.org/TR/2013/NOTE-WCAG20-TECHS-20130905/G1 19 | // 20 | // Credit: HTML5 Boilerplate 21 | 22 | @mixin sr-only-focusable { 23 | &:active, 24 | &:focus { 25 | position: static; 26 | width: auto; 27 | height: auto; 28 | margin: 0; 29 | overflow: visible; 30 | clip: auto; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/mixins/_size.scss: -------------------------------------------------------------------------------- 1 | // Sizing shortcuts 2 | 3 | @mixin size($width, $height) { 4 | width: $width; 5 | height: $height; 6 | } 7 | 8 | @mixin square($size) { 9 | @include size($size, $size); 10 | } 11 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/mixins/_tab-focus.scss: -------------------------------------------------------------------------------- 1 | // WebKit-style focus 2 | 3 | @mixin tab-focus() { 4 | // Default 5 | outline: thin dotted; 6 | // WebKit 7 | outline: 5px auto -webkit-focus-ring-color; 8 | outline-offset: -2px; 9 | } 10 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/mixins/_table-row.scss: -------------------------------------------------------------------------------- 1 | // Tables 2 | 3 | @mixin table-row-variant($state, $background) { 4 | // Exact selectors below required to override `.table-striped` and prevent 5 | // inheritance to nested tables. 6 | .table-#{$state} { 7 | &, 8 | > th, 9 | > td { 10 | background-color: $background; 11 | } 12 | } 13 | 14 | // Hover states for `.table-hover` 15 | // Note: this is not available for cells or rows within `thead` or `tfoot`. 16 | .table-hover { 17 | $hover-background: darken($background, 5%); 18 | 19 | .table-#{$state} { 20 | @include hover { 21 | background-color: $hover-background; 22 | 23 | > td, 24 | > th { 25 | background-color: $hover-background; 26 | } 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/mixins/_text-emphasis.scss: -------------------------------------------------------------------------------- 1 | // Typography 2 | 3 | @mixin text-emphasis-variant($parent, $color) { 4 | #{$parent} { 5 | color: $color; 6 | } 7 | a#{$parent} { 8 | @include hover-focus { 9 | color: darken($color, 10%); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /chapter-09/client/components/bootstrap/scss/mixins/_text-truncate.scss: -------------------------------------------------------------------------------- 1 | // Text truncate 2 | // Requires inline-block or block for proper styling 3 | 4 | @mixin text-truncate() { 5 | overflow: hidden; 6 | text-overflow: ellipsis; 7 | white-space: nowrap; 8 | } -------------------------------------------------------------------------------- /chapter-09/client/components/fancybox/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fancybox", 3 | "homepage": "https://github.com/fancyapps/fancyBox", 4 | "version": "2.1.5", 5 | "_release": "2.1.5", 6 | "_resolution": { 7 | "type": "version", 8 | "tag": "v2.1.5", 9 | "commit": "18d171278d21ca59067aace6d52a1adeb6462219" 10 | }, 11 | "_source": "https://github.com/fancyapps/fancyBox.git", 12 | "_target": "~2.1.5", 13 | "_originalSource": "fancybox", 14 | "_direct": true 15 | } -------------------------------------------------------------------------------- /chapter-09/client/components/fancybox/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Denote all files that are truly binary and should not be modified. 5 | *.png binary 6 | *.jpg binary 7 | *.gif binary -------------------------------------------------------------------------------- /chapter-09/client/components/fancybox/demo/1_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/components/fancybox/demo/1_b.jpg -------------------------------------------------------------------------------- /chapter-09/client/components/fancybox/demo/1_s.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/components/fancybox/demo/1_s.jpg -------------------------------------------------------------------------------- /chapter-09/client/components/fancybox/demo/2_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/components/fancybox/demo/2_b.jpg -------------------------------------------------------------------------------- /chapter-09/client/components/fancybox/demo/2_s.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/components/fancybox/demo/2_s.jpg -------------------------------------------------------------------------------- /chapter-09/client/components/fancybox/demo/3_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/components/fancybox/demo/3_b.jpg -------------------------------------------------------------------------------- /chapter-09/client/components/fancybox/demo/3_s.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/components/fancybox/demo/3_s.jpg -------------------------------------------------------------------------------- /chapter-09/client/components/fancybox/demo/4_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/components/fancybox/demo/4_b.jpg -------------------------------------------------------------------------------- /chapter-09/client/components/fancybox/demo/4_s.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/components/fancybox/demo/4_s.jpg -------------------------------------------------------------------------------- /chapter-09/client/components/fancybox/demo/5_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/components/fancybox/demo/5_b.jpg -------------------------------------------------------------------------------- /chapter-09/client/components/fancybox/demo/5_s.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/components/fancybox/demo/5_s.jpg -------------------------------------------------------------------------------- /chapter-09/client/components/fancybox/source/blank.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/components/fancybox/source/blank.gif -------------------------------------------------------------------------------- /chapter-09/client/components/fancybox/source/fancybox_loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/components/fancybox/source/fancybox_loading.gif -------------------------------------------------------------------------------- /chapter-09/client/components/fancybox/source/fancybox_loading@2x.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/components/fancybox/source/fancybox_loading@2x.gif -------------------------------------------------------------------------------- /chapter-09/client/components/fancybox/source/fancybox_overlay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/components/fancybox/source/fancybox_overlay.png -------------------------------------------------------------------------------- /chapter-09/client/components/fancybox/source/fancybox_sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/components/fancybox/source/fancybox_sprite.png -------------------------------------------------------------------------------- /chapter-09/client/components/fancybox/source/fancybox_sprite@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/components/fancybox/source/fancybox_sprite@2x.png -------------------------------------------------------------------------------- /chapter-09/client/components/fancybox/source/helpers/fancybox_buttons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/components/fancybox/source/helpers/fancybox_buttons.png -------------------------------------------------------------------------------- /chapter-09/client/components/fancybox/source/helpers/jquery.fancybox-thumbs.css: -------------------------------------------------------------------------------- 1 | #fancybox-thumbs { 2 | position: fixed; 3 | left: 0; 4 | width: 100%; 5 | overflow: hidden; 6 | z-index: 8050; 7 | } 8 | 9 | #fancybox-thumbs.bottom { 10 | bottom: 2px; 11 | } 12 | 13 | #fancybox-thumbs.top { 14 | top: 2px; 15 | } 16 | 17 | #fancybox-thumbs ul { 18 | position: relative; 19 | list-style: none; 20 | margin: 0; 21 | padding: 0; 22 | } 23 | 24 | #fancybox-thumbs ul li { 25 | float: left; 26 | padding: 1px; 27 | opacity: 0.5; 28 | } 29 | 30 | #fancybox-thumbs ul li.active { 31 | opacity: 0.75; 32 | padding: 0; 33 | border: 1px solid #fff; 34 | } 35 | 36 | #fancybox-thumbs ul li:hover { 37 | opacity: 1; 38 | } 39 | 40 | #fancybox-thumbs ul li a { 41 | display: block; 42 | position: relative; 43 | overflow: hidden; 44 | border: 1px solid #222; 45 | background: #111; 46 | outline: none; 47 | } 48 | 49 | #fancybox-thumbs ul li img { 50 | display: block; 51 | position: relative; 52 | border: 0; 53 | padding: 0; 54 | max-width: none; 55 | } -------------------------------------------------------------------------------- /chapter-09/client/components/fancybox/sprite.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/components/fancybox/sprite.psd -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery", 3 | "main": "dist/jquery.js", 4 | "license": "MIT", 5 | "ignore": [ 6 | "package.json" 7 | ], 8 | "keywords": [ 9 | "jquery", 10 | "javascript", 11 | "browser", 12 | "library" 13 | ], 14 | "homepage": "https://github.com/jquery/jquery-dist", 15 | "version": "2.2.4", 16 | "_release": "2.2.4", 17 | "_resolution": { 18 | "type": "version", 19 | "tag": "2.2.4", 20 | "commit": "c0185ab7c75aab88762c5aae780b9d83b80eda72" 21 | }, 22 | "_source": "https://github.com/jquery/jquery-dist.git", 23 | "_target": "1.9.1 - 2", 24 | "_originalSource": "jquery" 25 | } -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery", 3 | "main": "dist/jquery.js", 4 | "license": "MIT", 5 | "ignore": [ 6 | "package.json" 7 | ], 8 | "keywords": [ 9 | "jquery", 10 | "javascript", 11 | "browser", 12 | "library" 13 | ] 14 | } -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "boss": true, 3 | "curly": true, 4 | "eqeqeq": true, 5 | "eqnull": true, 6 | "expr": true, 7 | "immed": true, 8 | "noarg": true, 9 | "quotmark": "double", 10 | "undef": true, 11 | "unused": true, 12 | 13 | "sub": true, 14 | 15 | // Support: IE < 10, Android < 4.1 16 | // The above browsers are failing a lot of tests in the ES5 17 | // test suite at http://test262.ecmascript.org. 18 | "es3": true, 19 | 20 | "globals": { 21 | "window": true, 22 | "JSON": false, 23 | 24 | "jQuery": true, 25 | "define": true, 26 | "module": true, 27 | "noGlobal": true 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/ajax/parseJSON.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "../core" 3 | ], function( jQuery ) { 4 | 5 | // Support: Android 2.3 6 | // Workaround failure to string-cast null input 7 | jQuery.parseJSON = function( data ) { 8 | return JSON.parse( data + "" ); 9 | }; 10 | 11 | return jQuery.parseJSON; 12 | 13 | } ); 14 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/ajax/parseXML.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "../core" 3 | ], function( jQuery ) { 4 | 5 | // Cross-browser xml parsing 6 | jQuery.parseXML = function( data ) { 7 | var xml; 8 | if ( !data || typeof data !== "string" ) { 9 | return null; 10 | } 11 | 12 | // Support: IE9 13 | try { 14 | xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); 15 | } catch ( e ) { 16 | xml = undefined; 17 | } 18 | 19 | if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { 20 | jQuery.error( "Invalid XML: " + data ); 21 | } 22 | return xml; 23 | }; 24 | 25 | return jQuery.parseXML; 26 | 27 | } ); 28 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/ajax/var/location.js: -------------------------------------------------------------------------------- 1 | define( function() { 2 | return window.location; 3 | } ); 4 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/ajax/var/nonce.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "../../core" 3 | ], function( jQuery ) { 4 | return jQuery.now(); 5 | } ); 6 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/ajax/var/rquery.js: -------------------------------------------------------------------------------- 1 | define( function() { 2 | return ( /\?/ ); 3 | } ); 4 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/attributes.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "./core", 3 | "./attributes/attr", 4 | "./attributes/prop", 5 | "./attributes/classes", 6 | "./attributes/val" 7 | ], function( jQuery ) { 8 | 9 | // Return jQuery for attributes-only inclusion 10 | return jQuery; 11 | } ); 12 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/core/var/rsingleTag.js: -------------------------------------------------------------------------------- 1 | define( function() { 2 | 3 | // Match a standalone tag 4 | return ( /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/ ); 5 | } ); 6 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/css/addGetHookIf.js: -------------------------------------------------------------------------------- 1 | define( function() { 2 | 3 | function addGetHookIf( conditionFn, hookFn ) { 4 | 5 | // Define the hook, we'll check on the first run if it's really needed. 6 | return { 7 | get: function() { 8 | if ( conditionFn() ) { 9 | 10 | // Hook not needed (or it's not possible to use it due 11 | // to missing dependency), remove it. 12 | delete this.get; 13 | return; 14 | } 15 | 16 | // Hook needed; redefine it so that the support test is not executed again. 17 | return ( this.get = hookFn ).apply( this, arguments ); 18 | } 19 | }; 20 | } 21 | 22 | return addGetHookIf; 23 | 24 | } ); 25 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/css/hiddenVisibleSelectors.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "../core", 3 | "../selector" 4 | ], function( jQuery ) { 5 | 6 | jQuery.expr.filters.hidden = function( elem ) { 7 | return !jQuery.expr.filters.visible( elem ); 8 | }; 9 | jQuery.expr.filters.visible = function( elem ) { 10 | 11 | // Support: Opera <= 12.12 12 | // Opera reports offsetWidths and offsetHeights less than zero on some elements 13 | // Use OR instead of AND as the element is not visible if either is true 14 | // See tickets #10406 and #13132 15 | return elem.offsetWidth > 0 || elem.offsetHeight > 0 || elem.getClientRects().length > 0; 16 | }; 17 | 18 | } ); 19 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/css/var/cssExpand.js: -------------------------------------------------------------------------------- 1 | define( function() { 2 | return [ "Top", "Right", "Bottom", "Left" ]; 3 | } ); 4 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/css/var/getStyles.js: -------------------------------------------------------------------------------- 1 | define( function() { 2 | return function( elem ) { 3 | 4 | // Support: IE<=11+, Firefox<=30+ (#15098, #14150) 5 | // IE throws on elements created in popups 6 | // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 7 | var view = elem.ownerDocument.defaultView; 8 | 9 | if ( !view || !view.opener ) { 10 | view = window; 11 | } 12 | 13 | return view.getComputedStyle( elem ); 14 | }; 15 | } ); 16 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/css/var/isHidden.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "../../core", 3 | "../../selector" 4 | 5 | // css is assumed 6 | ], function( jQuery ) { 7 | 8 | return function( elem, el ) { 9 | 10 | // isHidden might be called from jQuery#filter function; 11 | // in that case, element will be second argument 12 | elem = el || elem; 13 | return jQuery.css( elem, "display" ) === "none" || 14 | !jQuery.contains( elem.ownerDocument, elem ); 15 | }; 16 | } ); 17 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/css/var/rmargin.js: -------------------------------------------------------------------------------- 1 | define( function() { 2 | return ( /^margin/ ); 3 | } ); 4 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/css/var/rnumnonpx.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "../../var/pnum" 3 | ], function( pnum ) { 4 | return new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 5 | } ); 6 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/css/var/swap.js: -------------------------------------------------------------------------------- 1 | define( function() { 2 | 3 | // A method for quickly swapping in/out CSS properties to get correct calculations. 4 | return function( elem, options, callback, args ) { 5 | var ret, name, 6 | old = {}; 7 | 8 | // Remember the old values, and insert the new ones 9 | for ( name in options ) { 10 | old[ name ] = elem.style[ name ]; 11 | elem.style[ name ] = options[ name ]; 12 | } 13 | 14 | ret = callback.apply( elem, args || [] ); 15 | 16 | // Revert the old values 17 | for ( name in options ) { 18 | elem.style[ name ] = old[ name ]; 19 | } 20 | 21 | return ret; 22 | }; 23 | 24 | } ); 25 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/data/var/acceptData.js: -------------------------------------------------------------------------------- 1 | define( function() { 2 | 3 | /** 4 | * Determines whether an object can have data 5 | */ 6 | return function( owner ) { 7 | 8 | // Accepts only: 9 | // - Node 10 | // - Node.ELEMENT_NODE 11 | // - Node.DOCUMENT_NODE 12 | // - Object 13 | // - Any 14 | /* jshint -W018 */ 15 | return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); 16 | }; 17 | 18 | } ); 19 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/data/var/dataPriv.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "../Data" 3 | ], function( Data ) { 4 | return new Data(); 5 | } ); 6 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/data/var/dataUser.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "../Data" 3 | ], function( Data ) { 4 | return new Data(); 5 | } ); 6 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/deprecated.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "./core" 3 | ], function( jQuery ) { 4 | 5 | jQuery.fn.extend( { 6 | 7 | bind: function( types, data, fn ) { 8 | return this.on( types, null, data, fn ); 9 | }, 10 | unbind: function( types, fn ) { 11 | return this.off( types, null, fn ); 12 | }, 13 | 14 | delegate: function( selector, types, data, fn ) { 15 | return this.on( types, selector, data, fn ); 16 | }, 17 | undelegate: function( selector, types, fn ) { 18 | 19 | // ( namespace ) or ( selector, types [, fn] ) 20 | return arguments.length === 1 ? 21 | this.off( selector, "**" ) : 22 | this.off( types, selector || "**", fn ); 23 | }, 24 | size: function() { 25 | return this.length; 26 | } 27 | } ); 28 | 29 | jQuery.fn.andSelf = jQuery.fn.addBack; 30 | 31 | } ); 32 | 33 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/effects/animatedSelector.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "../core", 3 | "../selector", 4 | "../effects" 5 | ], function( jQuery ) { 6 | 7 | jQuery.expr.filters.animated = function( elem ) { 8 | return jQuery.grep( jQuery.timers, function( fn ) { 9 | return elem === fn.elem; 10 | } ).length; 11 | }; 12 | 13 | } ); 14 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/event/ajax.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "../core", 3 | "../event" 4 | ], function( jQuery ) { 5 | 6 | // Attach a bunch of functions for handling common AJAX events 7 | jQuery.each( [ 8 | "ajaxStart", 9 | "ajaxStop", 10 | "ajaxComplete", 11 | "ajaxError", 12 | "ajaxSuccess", 13 | "ajaxSend" 14 | ], function( i, type ) { 15 | jQuery.fn[ type ] = function( fn ) { 16 | return this.on( type, fn ); 17 | }; 18 | } ); 19 | 20 | } ); 21 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/event/alias.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "../core", 3 | 4 | "../event", 5 | "./trigger" 6 | ], function( jQuery ) { 7 | 8 | jQuery.each( ( "blur focus focusin focusout load resize scroll unload click dblclick " + 9 | "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 10 | "change select submit keydown keypress keyup error contextmenu" ).split( " " ), 11 | function( i, name ) { 12 | 13 | // Handle event binding 14 | jQuery.fn[ name ] = function( data, fn ) { 15 | return arguments.length > 0 ? 16 | this.on( name, null, data, fn ) : 17 | this.trigger( name ); 18 | }; 19 | } ); 20 | 21 | jQuery.fn.extend( { 22 | hover: function( fnOver, fnOut ) { 23 | return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); 24 | } 25 | } ); 26 | 27 | } ); 28 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/event/support.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "../var/support" 3 | ], function( support ) { 4 | 5 | support.focusin = "onfocusin" in window; 6 | 7 | return support; 8 | 9 | } ); 10 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/exports/global.js: -------------------------------------------------------------------------------- 1 | var 2 | 3 | // Map over jQuery in case of overwrite 4 | _jQuery = window.jQuery, 5 | 6 | // Map over the $ in case of overwrite 7 | _$ = window.$; 8 | 9 | jQuery.noConflict = function( deep ) { 10 | if ( window.$ === jQuery ) { 11 | window.$ = _$; 12 | } 13 | 14 | if ( deep && window.jQuery === jQuery ) { 15 | window.jQuery = _jQuery; 16 | } 17 | 18 | return jQuery; 19 | }; 20 | 21 | // Expose jQuery and $ identifiers, even in AMD 22 | // (#7102#comment:10, https://github.com/jquery/jquery/pull/557) 23 | // and CommonJS for browser emulators (#13566) 24 | if ( !noGlobal ) { 25 | window.jQuery = window.$ = jQuery; 26 | } 27 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/jquery.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "./core", 3 | "./selector", 4 | "./traversing", 5 | "./callbacks", 6 | "./deferred", 7 | "./core/ready", 8 | "./data", 9 | "./queue", 10 | "./queue/delay", 11 | "./attributes", 12 | "./event", 13 | "./event/alias", 14 | "./event/focusin", 15 | "./manipulation", 16 | "./manipulation/_evalUrl", 17 | "./wrap", 18 | "./css", 19 | "./css/hiddenVisibleSelectors", 20 | "./serialize", 21 | "./ajax", 22 | "./ajax/xhr", 23 | "./ajax/script", 24 | "./ajax/jsonp", 25 | "./ajax/load", 26 | "./event/ajax", 27 | "./effects", 28 | "./effects/animatedSelector", 29 | "./offset", 30 | "./dimensions", 31 | "./deprecated", 32 | "./exports/amd" 33 | ], function( jQuery ) { 34 | 35 | return ( window.jQuery = window.$ = jQuery ); 36 | 37 | } ); 38 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/manipulation/_evalUrl.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "../ajax" 3 | ], function( jQuery ) { 4 | 5 | jQuery._evalUrl = function( url ) { 6 | return jQuery.ajax( { 7 | url: url, 8 | 9 | // Make this explicit, since user can override this through ajaxSetup (#11264) 10 | type: "GET", 11 | dataType: "script", 12 | async: false, 13 | global: false, 14 | "throws": true 15 | } ); 16 | }; 17 | 18 | return jQuery._evalUrl; 19 | 20 | } ); 21 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/manipulation/getAll.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "../core" 3 | ], function( jQuery ) { 4 | 5 | function getAll( context, tag ) { 6 | 7 | // Support: IE9-11+ 8 | // Use typeof to avoid zero-argument method invocation on host objects (#15151) 9 | var ret = typeof context.getElementsByTagName !== "undefined" ? 10 | context.getElementsByTagName( tag || "*" ) : 11 | typeof context.querySelectorAll !== "undefined" ? 12 | context.querySelectorAll( tag || "*" ) : 13 | []; 14 | 15 | return tag === undefined || tag && jQuery.nodeName( context, tag ) ? 16 | jQuery.merge( [ context ], ret ) : 17 | ret; 18 | } 19 | 20 | return getAll; 21 | } ); 22 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/manipulation/setGlobalEval.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "../data/var/dataPriv" 3 | ], function( dataPriv ) { 4 | 5 | // Mark scripts as having already been evaluated 6 | function setGlobalEval( elems, refElements ) { 7 | var i = 0, 8 | l = elems.length; 9 | 10 | for ( ; i < l; i++ ) { 11 | dataPriv.set( 12 | elems[ i ], 13 | "globalEval", 14 | !refElements || dataPriv.get( refElements[ i ], "globalEval" ) 15 | ); 16 | } 17 | } 18 | 19 | return setGlobalEval; 20 | } ); 21 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/manipulation/var/rcheckableType.js: -------------------------------------------------------------------------------- 1 | define( function() { 2 | return ( /^(?:checkbox|radio)$/i ); 3 | } ); 4 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/manipulation/var/rscriptType.js: -------------------------------------------------------------------------------- 1 | define( function() { 2 | return ( /^$|\/(?:java|ecma)script/i ); 3 | } ); 4 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/manipulation/var/rtagName.js: -------------------------------------------------------------------------------- 1 | define( function() { 2 | return ( /<([\w:-]+)/ ); 3 | } ); 4 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/manipulation/wrapMap.js: -------------------------------------------------------------------------------- 1 | define( function() { 2 | 3 | // We have to close these tags to support XHTML (#13200) 4 | var wrapMap = { 5 | 6 | // Support: IE9 7 | option: [ 1, "" ], 8 | 9 | // XHTML parsers do not magically insert elements in the 10 | // same way that tag soup parsers do. So we cannot shorten 11 | // this by omitting or other required elements. 12 | thead: [ 1, "", "
" ], 13 | col: [ 2, "", "
" ], 14 | tr: [ 2, "", "
" ], 15 | td: [ 3, "", "
" ], 16 | 17 | _default: [ 0, "", "" ] 18 | }; 19 | 20 | // Support: IE9 21 | wrapMap.optgroup = wrapMap.option; 22 | 23 | wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 24 | wrapMap.th = wrapMap.td; 25 | 26 | return wrapMap; 27 | } ); 28 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/outro.js: -------------------------------------------------------------------------------- 1 | return jQuery; 2 | })); 3 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/queue/delay.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "../core", 3 | "../queue", 4 | "../effects" // Delay is optional because of this dependency 5 | ], function( jQuery ) { 6 | 7 | // Based off of the plugin by Clint Helfers, with permission. 8 | // http://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ 9 | jQuery.fn.delay = function( time, type ) { 10 | time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 11 | type = type || "fx"; 12 | 13 | return this.queue( type, function( next, hooks ) { 14 | var timeout = window.setTimeout( next, time ); 15 | hooks.stop = function() { 16 | window.clearTimeout( timeout ); 17 | }; 18 | } ); 19 | }; 20 | 21 | return jQuery.fn.delay; 22 | } ); 23 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/selector-sizzle.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "./core", 3 | "../external/sizzle/dist/sizzle" 4 | ], function( jQuery, Sizzle ) { 5 | 6 | jQuery.find = Sizzle; 7 | jQuery.expr = Sizzle.selectors; 8 | jQuery.expr[ ":" ] = jQuery.expr.pseudos; 9 | jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; 10 | jQuery.text = Sizzle.getText; 11 | jQuery.isXMLDoc = Sizzle.isXML; 12 | jQuery.contains = Sizzle.contains; 13 | 14 | } ); 15 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/selector.js: -------------------------------------------------------------------------------- 1 | define( [ "./selector-sizzle" ], function() {} ); 2 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/traversing/var/dir.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "../../core" 3 | ], function( jQuery ) { 4 | 5 | return function( elem, dir, until ) { 6 | var matched = [], 7 | truncate = until !== undefined; 8 | 9 | while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { 10 | if ( elem.nodeType === 1 ) { 11 | if ( truncate && jQuery( elem ).is( until ) ) { 12 | break; 13 | } 14 | matched.push( elem ); 15 | } 16 | } 17 | return matched; 18 | }; 19 | 20 | } ); 21 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/traversing/var/rneedsContext.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "../../core", 3 | "../../selector" 4 | ], function( jQuery ) { 5 | return jQuery.expr.match.needsContext; 6 | } ); 7 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/traversing/var/siblings.js: -------------------------------------------------------------------------------- 1 | define( function() { 2 | 3 | return function( n, elem ) { 4 | var matched = []; 5 | 6 | for ( ; n; n = n.nextSibling ) { 7 | if ( n.nodeType === 1 && n !== elem ) { 8 | matched.push( n ); 9 | } 10 | } 11 | 12 | return matched; 13 | }; 14 | 15 | } ); 16 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/var/arr.js: -------------------------------------------------------------------------------- 1 | define( function() { 2 | return []; 3 | } ); 4 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/var/class2type.js: -------------------------------------------------------------------------------- 1 | define( function() { 2 | 3 | // [[Class]] -> type pairs 4 | return {}; 5 | } ); 6 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/var/concat.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "./arr" 3 | ], function( arr ) { 4 | return arr.concat; 5 | } ); 6 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/var/document.js: -------------------------------------------------------------------------------- 1 | define( function() { 2 | return window.document; 3 | } ); 4 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/var/documentElement.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "./document" 3 | ], function( document ) { 4 | return document.documentElement; 5 | } ); 6 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/var/hasOwn.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "./class2type" 3 | ], function( class2type ) { 4 | return class2type.hasOwnProperty; 5 | } ); 6 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/var/indexOf.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "./arr" 3 | ], function( arr ) { 4 | return arr.indexOf; 5 | } ); 6 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/var/pnum.js: -------------------------------------------------------------------------------- 1 | define( function() { 2 | return ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; 3 | } ); 4 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/var/push.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "./arr" 3 | ], function( arr ) { 4 | return arr.push; 5 | } ); 6 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/var/rcssNum.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "../var/pnum" 3 | ], function( pnum ) { 4 | 5 | return new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); 6 | 7 | } ); 8 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/var/rnotwhite.js: -------------------------------------------------------------------------------- 1 | define( function() { 2 | return ( /\S+/g ); 3 | } ); 4 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/var/slice.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "./arr" 3 | ], function( arr ) { 4 | return arr.slice; 5 | } ); 6 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/var/support.js: -------------------------------------------------------------------------------- 1 | define( function() { 2 | 3 | // All support tests are defined in their respective modules. 4 | return {}; 5 | } ); 6 | -------------------------------------------------------------------------------- /chapter-09/client/components/jquery/src/var/toString.js: -------------------------------------------------------------------------------- 1 | define( [ 2 | "./class2type" 3 | ], function( class2type ) { 4 | return class2type.toString; 5 | } ); 6 | -------------------------------------------------------------------------------- /chapter-09/client/components/react/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react", 3 | "main": [ 4 | "react.js", 5 | "react-dom.js" 6 | ], 7 | "ignore": [], 8 | "homepage": "https://github.com/facebook/react-bower", 9 | "version": "15.1.0", 10 | "_release": "15.1.0", 11 | "_resolution": { 12 | "type": "version", 13 | "tag": "v15.1.0", 14 | "commit": "687c097a7db9e4e32681105eded57b553732c14a" 15 | }, 16 | "_source": "https://github.com/facebook/react-bower.git", 17 | "_target": "~15.1.0", 18 | "_originalSource": "react", 19 | "_direct": true 20 | } -------------------------------------------------------------------------------- /chapter-09/client/components/react/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react", 3 | "main": ["react.js", "react-dom.js"], 4 | "ignore": [] 5 | } 6 | -------------------------------------------------------------------------------- /chapter-09/client/components/react/react-dom-server.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * ReactDOMServer v15.1.0 3 | * 4 | * Copyright 2013-present, Facebook, Inc. 5 | * All rights reserved. 6 | * 7 | * This source code is licensed under the BSD-style license found in the 8 | * LICENSE file in the root directory of this source tree. An additional grant 9 | * of patent rights can be found in the PATENTS file in the same directory. 10 | * 11 | */ 12 | !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e(require("react"));else if("function"==typeof define&&define.amd)define(["react"],e);else{var f;f="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,f.ReactDOMServer=e(f.React)}}(function(e){return e.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED}); -------------------------------------------------------------------------------- /chapter-09/client/components/react/react-dom.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * ReactDOM v15.1.0 3 | * 4 | * Copyright 2013-present, Facebook, Inc. 5 | * All rights reserved. 6 | * 7 | * This source code is licensed under the BSD-style license found in the 8 | * LICENSE file in the root directory of this source tree. An additional grant 9 | * of patent rights can be found in the PATENTS file in the same directory. 10 | * 11 | */ 12 | !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e(require("react"));else if("function"==typeof define&&define.amd)define(["react"],e);else{var f;f="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,f.ReactDOM=e(f.React)}}(function(e){return e.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED}); -------------------------------------------------------------------------------- /chapter-09/client/images/gallery/sample-car-gallery.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/images/gallery/sample-car-gallery.jpg -------------------------------------------------------------------------------- /chapter-09/client/images/gallery/sample-car1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/images/gallery/sample-car1.jpg -------------------------------------------------------------------------------- /chapter-09/client/images/gallery/sample-car2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/images/gallery/sample-car2.jpg -------------------------------------------------------------------------------- /chapter-09/client/images/gallery/sample-car3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/images/gallery/sample-car3.jpg -------------------------------------------------------------------------------- /chapter-09/client/images/gallery/sample-moto-gallery.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/images/gallery/sample-moto-gallery.jpg -------------------------------------------------------------------------------- /chapter-09/client/images/gallery/sample-moto1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/images/gallery/sample-moto1.jpg -------------------------------------------------------------------------------- /chapter-09/client/images/gallery/sample-moto2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/images/gallery/sample-moto2.jpg -------------------------------------------------------------------------------- /chapter-09/client/images/gallery/sample-moto3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/images/gallery/sample-moto3.jpg -------------------------------------------------------------------------------- /chapter-09/client/images/gallery/src/sample-car-gallery.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/images/gallery/src/sample-car-gallery.jpg -------------------------------------------------------------------------------- /chapter-09/client/images/gallery/src/sample-car1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/images/gallery/src/sample-car1.jpg -------------------------------------------------------------------------------- /chapter-09/client/images/gallery/src/sample-car2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/images/gallery/src/sample-car2.jpg -------------------------------------------------------------------------------- /chapter-09/client/images/gallery/src/sample-car3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/images/gallery/src/sample-car3.jpg -------------------------------------------------------------------------------- /chapter-09/client/images/gallery/src/sample-moto-gallery.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/images/gallery/src/sample-moto-gallery.jpg -------------------------------------------------------------------------------- /chapter-09/client/images/gallery/src/sample-moto1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/images/gallery/src/sample-moto1.jpg -------------------------------------------------------------------------------- /chapter-09/client/images/gallery/src/sample-moto2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/images/gallery/src/sample-moto2.jpg -------------------------------------------------------------------------------- /chapter-09/client/images/gallery/src/sample-moto3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/client/images/gallery/src/sample-moto3.jpg -------------------------------------------------------------------------------- /chapter-09/client/js/app.config.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | 'use strict'; 3 | 4 | angular 5 | .module('bikesGallery') 6 | .config(configure) 7 | .run(runBlock); 8 | 9 | configure.$inject = ['$urlRouterProvider', '$httpProvider', '$locationProvider']; 10 | 11 | function configure($urlRouterProvider, $httpProvider, $locationProvider) { 12 | 13 | $locationProvider.hashPrefix('!'); 14 | 15 | // This is required for Browser Sync to work poperly 16 | $httpProvider.defaults.withCredentials = true; 17 | $httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 18 | 19 | $urlRouterProvider 20 | .otherwise('/'); 21 | 22 | } 23 | 24 | runBlock.$inject = ['$rootScope', '$state', '$stateParams']; 25 | 26 | function runBlock($rootScope, $state, $stateParams ) { 27 | 28 | $rootScope.$state = $state; 29 | $rootScope.$stateParams = $stateParams; 30 | } 31 | 32 | })(); 33 | -------------------------------------------------------------------------------- /chapter-09/client/js/app.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | 'use strict'; 3 | 4 | angular 5 | .module('bikesGallery', ['ui.router','lbServices']); 6 | 7 | })(); 8 | -------------------------------------------------------------------------------- /chapter-09/client/js/app.routes.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | 'use strict'; 3 | 4 | angular 5 | .module('bikesGallery') 6 | .config(routes); 7 | 8 | routes.$inject = ['$stateProvider']; 9 | 10 | function routes($stateProvider) { 11 | $stateProvider 12 | .state('home', { 13 | url:'/', 14 | templateUrl: 'views/home.html', 15 | controller: 'HomeController', 16 | controllerAs: 'vm' 17 | }) 18 | .state('galleries', { 19 | url:'/galleries/{itemId}/bikes', 20 | templateUrl: 'views/galleries.html', 21 | controller: 'GalleryController', 22 | controllerAs: 'vm' 23 | }) 24 | ; 25 | } 26 | 27 | })(); 28 | -------------------------------------------------------------------------------- /chapter-09/client/js/controllers.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | 'use strict'; 3 | 4 | angular 5 | .module('bikesGallery') 6 | .controller('GalleryController', GalleryController) 7 | .controller('HomeController', HomeController); 8 | 9 | HomeController.$inject = ['Gallery']; 10 | function HomeController(Gallery) { 11 | var vm = this; 12 | 13 | vm.listProducts = Gallery.find(); 14 | 15 | //console.log(vm.listProducts); 16 | } 17 | 18 | GalleryController.$inject = ['Gallery', '$stateParams']; 19 | function GalleryController(Gallery, $stateParams) { 20 | var vm = this; 21 | 22 | var itemId = $stateParams.itemId; 23 | console.log(itemId); 24 | 25 | vm.listProducts = Gallery.bikes({ 26 | id: itemId 27 | }); 28 | 29 | //console.log(vm.listProducts); 30 | } 31 | 32 | })(); 33 | -------------------------------------------------------------------------------- /chapter-09/client/js/scripts/scripts.js: -------------------------------------------------------------------------------- 1 | (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 2 |
3 |
4 | 5 | {{ item.name }} 6 | 7 |
8 |

{{ item.name }}

9 |

{{ item.model }} - {{ item.category }}

10 |
11 |
12 |
13 |
14 | -------------------------------------------------------------------------------- /chapter-09/client/views/home.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | Card image cap 5 |
6 |

{{ item.name }}

7 |

{{ item.description }}

8 | View Gallery 9 |
10 |
11 |
12 |
13 | -------------------------------------------------------------------------------- /chapter-09/common/models/bike.js: -------------------------------------------------------------------------------- 1 | module.exports = function(Bike) { 2 | 3 | }; 4 | -------------------------------------------------------------------------------- /chapter-09/common/models/bike.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bike", 3 | "base": "PersistedModel", 4 | "idInjection": true, 5 | "options": { 6 | "validateUpsert": true 7 | }, 8 | "properties": { 9 | "name": { 10 | "type": "string", 11 | "required": true 12 | }, 13 | "model": { 14 | "type": "string", 15 | "required": true 16 | }, 17 | "category": { 18 | "type": "string", 19 | "required": true 20 | } 21 | }, 22 | "validations": [], 23 | "relations": { 24 | "gallery": { 25 | "type": "belongsTo", 26 | "model": "gallery", 27 | "foreignKey": "" 28 | } 29 | }, 30 | "acls": [], 31 | "methods": {} 32 | } 33 | -------------------------------------------------------------------------------- /chapter-09/common/models/gallery.js: -------------------------------------------------------------------------------- 1 | module.exports = function(Gallery) { 2 | 3 | }; 4 | -------------------------------------------------------------------------------- /chapter-09/common/models/gallery.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gallery", 3 | "base": "PersistedModel", 4 | "idInjection": true, 5 | "options": { 6 | "validateUpsert": true 7 | }, 8 | "properties": { 9 | "name": { 10 | "type": "string", 11 | "required": true 12 | }, 13 | "description": { 14 | "type": "string", 15 | "required": true 16 | } 17 | }, 18 | "validations": [], 19 | "relations": { 20 | "bikes": { 21 | "type": "hasMany", 22 | "model": "bike", 23 | "foreignKey": "" 24 | } 25 | }, 26 | "acls": [], 27 | "methods": {} 28 | } 29 | -------------------------------------------------------------------------------- /chapter-09/server/boot/_root.js: -------------------------------------------------------------------------------- 1 | module.exports = function(server) { 2 | // Install a `/` route that returns server status 3 | var router = server.loopback.Router(); 4 | router.get('/'); 5 | server.use(router); 6 | }; 7 | -------------------------------------------------------------------------------- /chapter-09/server/component-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "loopback-component-explorer": { 3 | "mountPath": "/explorer" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /chapter-09/server/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "restApiRoot": "/api", 3 | "host": "0.0.0.0", 4 | "port": 3000, 5 | "remoting": { 6 | "context": { 7 | "enableHttpContext": false 8 | }, 9 | "rest": { 10 | "normalizeHttpPath": false, 11 | "xml": false 12 | }, 13 | "json": { 14 | "strict": false, 15 | "limit": "100kb" 16 | }, 17 | "urlencoded": { 18 | "extended": true, 19 | "limit": "100kb" 20 | }, 21 | "cors": false, 22 | "errorHandler": { 23 | "disableStackTrace": false 24 | } 25 | }, 26 | "legacyExplorer": false 27 | } 28 | -------------------------------------------------------------------------------- /chapter-09/server/datasources.json: -------------------------------------------------------------------------------- 1 | { 2 | "galleryDS": { 3 | "host": "ds013564.mlab.com", 4 | "port": 13564, 5 | "url": "", 6 | "database": "n6b-chapter-09", 7 | "password": "chapter-09-example", 8 | "name": "n6b-chapter-09", 9 | "user": "chapter-09-example", 10 | "connector": "mongodb" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /chapter-09/server/middleware.production.json: -------------------------------------------------------------------------------- 1 | { 2 | "final:after": { 3 | "loopback#errorHandler": { 4 | "params": { 5 | "includeStack": false 6 | } 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /chapter-09/server/model-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "_meta": { 3 | "sources": [ 4 | "loopback/common/models", 5 | "loopback/server/models", 6 | "../common/models", 7 | "./models" 8 | ], 9 | "mixins": [ 10 | "loopback/common/mixins", 11 | "loopback/server/mixins", 12 | "../common/mixins", 13 | "./mixins" 14 | ] 15 | }, 16 | "bike": { 17 | "dataSource": "galleryDS", 18 | "public": true 19 | }, 20 | "gallery": { 21 | "dataSource": "galleryDS", 22 | "public": true 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /chapter-09/server/server.js: -------------------------------------------------------------------------------- 1 | var loopback = require('loopback'); 2 | var boot = require('loopback-boot'); 3 | 4 | var app = module.exports = loopback(); 5 | 6 | app.start = function() { 7 | // start the web server 8 | return app.listen(function() { 9 | app.emit('started'); 10 | var baseUrl = app.get('url').replace(/\/$/, ''); 11 | console.log('Web server listening at: %s', baseUrl); 12 | if (app.get('loopback-component-explorer')) { 13 | var explorerPath = app.get('loopback-component-explorer').mountPath; 14 | console.log('Browse your REST API at %s%s', baseUrl, explorerPath); 15 | } 16 | }); 17 | }; 18 | 19 | // Bootstrap the application, configure models, datasources and middleware. 20 | // Sub-apps like REST API are mounted via boot scripts. 21 | boot(app, __dirname, function(err) { 22 | if (err) throw err; 23 | 24 | // start the server if `$ node server.js` 25 | if (require.main === module) 26 | app.start(); 27 | }); 28 | -------------------------------------------------------------------------------- /chapter-09/src/images/gallery/sample-car-gallery.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/src/images/gallery/sample-car-gallery.jpg -------------------------------------------------------------------------------- /chapter-09/src/images/gallery/sample-car1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/src/images/gallery/sample-car1.jpg -------------------------------------------------------------------------------- /chapter-09/src/images/gallery/sample-car2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/src/images/gallery/sample-car2.jpg -------------------------------------------------------------------------------- /chapter-09/src/images/gallery/sample-car3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/src/images/gallery/sample-car3.jpg -------------------------------------------------------------------------------- /chapter-09/src/images/gallery/sample-moto-gallery.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/src/images/gallery/sample-moto-gallery.jpg -------------------------------------------------------------------------------- /chapter-09/src/images/gallery/sample-moto1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/src/images/gallery/sample-moto1.jpg -------------------------------------------------------------------------------- /chapter-09/src/images/gallery/sample-moto2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/src/images/gallery/sample-moto2.jpg -------------------------------------------------------------------------------- /chapter-09/src/images/gallery/sample-moto3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-09/src/images/gallery/sample-moto3.jpg -------------------------------------------------------------------------------- /chapter-09/src/scripts/gallery.js: -------------------------------------------------------------------------------- 1 | (function (){ 2 | 'use-strict' 3 | //jQuery fancybox activation 4 | $('.fancybox').fancybox({ 5 | padding : 0, 6 | openEffect : 'elastic' 7 | }); 8 | 9 | })(); 10 | -------------------------------------------------------------------------------- /chapter-09/src/scss/main.scss: -------------------------------------------------------------------------------- 1 | // Project Style 2 | 3 | // Import Botstrap 4 | @import "vendor/bootstrap"; 5 | 6 | // 7 | body { 8 | padding-top: 5rem; 9 | } 10 | .starter-template { 11 | padding: 3rem 1.5rem; 12 | text-align: center; 13 | @include clearfix 14 | } 15 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/_animation.scss: -------------------------------------------------------------------------------- 1 | .fade { 2 | opacity: 0; 3 | transition: opacity .15s linear; 4 | 5 | &.in { 6 | opacity: 1; 7 | } 8 | } 9 | 10 | .collapse { 11 | display: none; 12 | 13 | &.in { 14 | display: block; 15 | } 16 | // tr&.in { display: table-row; } 17 | // tbody&.in { display: table-row-group; } 18 | } 19 | 20 | .collapsing { 21 | position: relative; 22 | height: 0; 23 | overflow: hidden; 24 | transition-timing-function: ease; 25 | transition-duration: .35s; 26 | transition-property: height; 27 | } 28 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/_breadcrumb.scss: -------------------------------------------------------------------------------- 1 | .breadcrumb { 2 | padding: $breadcrumb-padding-vertical $breadcrumb-padding-horizontal; 3 | margin-bottom: $spacer-y; 4 | list-style: none; 5 | background-color: $breadcrumb-bg; 6 | @include border-radius($border-radius); 7 | 8 | > li { 9 | display: inline-block; 10 | 11 | + li:before { 12 | $nbsp: "\00a0"; 13 | padding-right: .5rem; 14 | padding-left: .5rem; 15 | color: $breadcrumb-divider-color; 16 | content: "#{$breadcrumb-divider}#{$nbsp}"; // Unicode space added since inline-block means non-collapsing white-space 17 | } 18 | } 19 | 20 | > .active { 21 | color: $breadcrumb-active-color; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/_close.scss: -------------------------------------------------------------------------------- 1 | .close { 2 | float: right; 3 | font-size: ($font-size-base * 1.5); 4 | font-weight: $close-font-weight; 5 | line-height: 1; 6 | color: $close-color; 7 | text-shadow: $close-text-shadow; 8 | opacity: .2; 9 | 10 | @include hover-focus { 11 | color: $close-color; 12 | text-decoration: none; 13 | cursor: pointer; 14 | opacity: .5; 15 | } 16 | } 17 | 18 | // Additional properties for button version 19 | // iOS requires the button element instead of an anchor tag. 20 | // If you want the anchor version, it requires `href="#"`. 21 | // See https://developer.mozilla.org/en-US/docs/Web/Events/click#Safari_Mobile 22 | button.close { 23 | padding: 0; 24 | cursor: pointer; 25 | background: transparent; 26 | border: 0; 27 | -webkit-appearance: none; 28 | } 29 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/_images.scss: -------------------------------------------------------------------------------- 1 | // Responsive images (ensure images don't scale beyond their parents) 2 | .img-responsive { 3 | @include img-responsive(); 4 | } 5 | 6 | // Rounded corners 7 | .img-rounded { 8 | @include border-radius($border-radius-lg); 9 | } 10 | 11 | // Image thumbnails 12 | .img-thumbnail { 13 | padding: $thumbnail-padding; 14 | line-height: $line-height; 15 | background-color: $thumbnail-bg; 16 | border: 1px solid $thumbnail-border; 17 | border-radius: $thumbnail-border-radius; 18 | transition: all .2s ease-in-out; 19 | @include box-shadow(0 1px 2px rgba(0,0,0,.075)); 20 | 21 | // Keep them at most 100% wide 22 | @include img-responsive(inline-block); 23 | } 24 | 25 | // Perfect circle 26 | .img-circle { 27 | border-radius: 50%; 28 | } 29 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/_jumbotron.scss: -------------------------------------------------------------------------------- 1 | .jumbotron { 2 | padding: $jumbotron-padding ($jumbotron-padding / 2); 3 | margin-bottom: $jumbotron-padding; 4 | background-color: $jumbotron-bg; 5 | @include border-radius($border-radius-lg); 6 | } 7 | 8 | .jumbotron-hr { 9 | border-top-color: darken($jumbotron-bg, 10%); 10 | } 11 | 12 | @include media-breakpoint-up(sm) { 13 | .jumbotron { 14 | padding: ($jumbotron-padding * 2) $jumbotron-padding; 15 | } 16 | } 17 | 18 | .jumbotron-fluid { 19 | padding-right: 0; 20 | padding-left: 0; 21 | @include border-radius(0); 22 | } 23 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/_responsive-embed.scss: -------------------------------------------------------------------------------- 1 | // Credit: Nicolas Gallagher and SUIT CSS. 2 | 3 | .embed-responsive { 4 | position: relative; 5 | display: block; 6 | height: 0; 7 | padding: 0; 8 | overflow: hidden; 9 | 10 | .embed-responsive-item, 11 | iframe, 12 | embed, 13 | object, 14 | video { 15 | position: absolute; 16 | top: 0; 17 | bottom: 0; 18 | left: 0; 19 | width: 100%; 20 | height: 100%; 21 | border: 0; 22 | } 23 | } 24 | 25 | // Modifier class for 21:9 aspect ratio 26 | .embed-responsive-21by9 { 27 | padding-bottom: percentage(9 / 21); 28 | } 29 | 30 | // Modifier class for 16:9 aspect ratio 31 | .embed-responsive-16by9 { 32 | padding-bottom: percentage(9 / 16); 33 | } 34 | 35 | // Modifier class for 4:3 aspect ratio 36 | .embed-responsive-4by3 { 37 | padding-bottom: percentage(3 / 4); 38 | } 39 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/_utilities-responsive.scss: -------------------------------------------------------------------------------- 1 | // 2 | // Mixins 3 | // 4 | 5 | @each $bp in map-keys($grid-breakpoints) { 6 | .hidden-#{$bp}-up { 7 | @include media-breakpoint-up($bp) { 8 | display: none !important; 9 | } 10 | } 11 | .hidden-#{$bp}-down { 12 | @include media-breakpoint-down($bp) { 13 | display: none !important; 14 | } 15 | } 16 | } 17 | 18 | 19 | // Print utilities 20 | // 21 | // Media queries are placed on the inside to be mixin-friendly. 22 | 23 | .visible-print-block { 24 | display: none !important; 25 | 26 | @media print { 27 | display: block !important; 28 | } 29 | } 30 | .visible-print-inline { 31 | display: none !important; 32 | 33 | @media print { 34 | display: inline !important; 35 | } 36 | } 37 | .visible-print-inline-block { 38 | display: none !important; 39 | 40 | @media print { 41 | display: inline-block !important; 42 | } 43 | } 44 | 45 | .hidden-print { 46 | @media print { 47 | @include responsive-invisibility(".hidden-print"); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/bootstrap-flex.scss: -------------------------------------------------------------------------------- 1 | // Bootstrap with Flexbox enabled 2 | // 3 | // Includes all the imports from the standard Bootstrap project, but enables 4 | // the flexbox variable. 5 | 6 | $enable-flex: true; 7 | 8 | @import "../bootstrap"; 9 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/bootstrap-reboot.scss: -------------------------------------------------------------------------------- 1 | // Bootstrap Reboot only 2 | // 3 | // Includes only Normalize and our custom Reboot reset. 4 | 5 | @import "variables"; 6 | @import "mixins/hover"; 7 | @import "mixins/tab-focus"; 8 | 9 | @import "normalize"; 10 | @import "reboot"; 11 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/mixins/_alert.scss: -------------------------------------------------------------------------------- 1 | // Alerts 2 | 3 | @mixin alert-variant($background, $border, $body-color) { 4 | background-color: $background; 5 | border-color: $border; 6 | color: $body-color; 7 | 8 | hr { 9 | border-top-color: darken($border, 5%); 10 | } 11 | .alert-link { 12 | color: darken($body-color, 10%); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/mixins/_background-variant.scss: -------------------------------------------------------------------------------- 1 | // Contextual backgrounds 2 | 3 | // [converter] $parent hack 4 | @mixin bg-variant($parent, $color) { 5 | #{$parent} { 6 | color: #fff; 7 | background-color: $color; 8 | } 9 | a#{$parent} { 10 | @include hover-focus { 11 | background-color: darken($color, 10%); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/mixins/_border-radius.scss: -------------------------------------------------------------------------------- 1 | // Single side border-radius 2 | 3 | @mixin border-top-radius($radius) { 4 | border-top-right-radius: $radius; 5 | border-top-left-radius: $radius; 6 | } 7 | 8 | @mixin border-right-radius($radius) { 9 | border-bottom-right-radius: $radius; 10 | border-top-right-radius: $radius; 11 | } 12 | 13 | @mixin border-bottom-radius($radius) { 14 | border-bottom-right-radius: $radius; 15 | border-bottom-left-radius: $radius; 16 | } 17 | 18 | @mixin border-left-radius($radius) { 19 | border-bottom-left-radius: $radius; 20 | border-top-left-radius: $radius; 21 | } 22 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/mixins/_center-block.scss: -------------------------------------------------------------------------------- 1 | // Center-align a block level element 2 | 3 | @mixin center-block() { 4 | display: block; 5 | margin-left: auto; 6 | margin-right: auto; 7 | } 8 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/mixins/_clearfix.scss: -------------------------------------------------------------------------------- 1 | // Clearfix 2 | // 3 | // For modern browsers 4 | // 1. The space content is one way to avoid an Opera bug when the 5 | // contenteditable attribute is included anywhere else in the document. 6 | // Otherwise it causes space to appear at the top and bottom of elements 7 | // that are clearfixed. 8 | // 2. The use of `table` rather than `block` is only necessary if using 9 | // `:before` to contain the top-margins of child elements. 10 | // 11 | // Source: http://nicolasgallagher.com/micro-clearfix-hack/ 12 | 13 | @mixin clearfix() { 14 | &:before, 15 | &:after { 16 | content: " "; // 1 17 | display: table; // 2 18 | } 19 | &:after { 20 | clear: both; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/mixins/_hide-text.scss: -------------------------------------------------------------------------------- 1 | // CSS image replacement 2 | @mixin text-hide() { 3 | font: "0/0" a; 4 | color: transparent; 5 | text-shadow: none; 6 | background-color: transparent; 7 | border: 0; 8 | } 9 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/mixins/_label.scss: -------------------------------------------------------------------------------- 1 | // Labels 2 | 3 | @mixin label-variant($color) { 4 | background-color: $color; 5 | 6 | &[href] { 7 | @include hover-focus { 8 | background-color: darken($color, 10%); 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/mixins/_list-group.scss: -------------------------------------------------------------------------------- 1 | // List Groups 2 | 3 | @mixin list-group-item-variant($state, $background, $color) { 4 | .list-group-item-#{state} { 5 | color: $color; 6 | background-color: $background; 7 | } 8 | 9 | a.list-group-item-#{state}, 10 | button.list-group-item-#{state} { 11 | color: $color; 12 | 13 | .list-group-item-heading { 14 | color: inherit; 15 | } 16 | 17 | @include hover-focus { 18 | color: $color; 19 | background-color: darken($background, 5%); 20 | } 21 | 22 | &.active { 23 | @include plain-hover-focus { 24 | color: #fff; 25 | background-color: $color; 26 | border-color: $color; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/mixins/_nav-divider.scss: -------------------------------------------------------------------------------- 1 | // Horizontal dividers 2 | // 3 | // Dividers (basically an hr) within dropdowns and nav lists 4 | 5 | @mixin nav-divider($color: #e5e5e5) { 6 | height: 1px; 7 | margin: ($spacer-y / 2) 0; 8 | overflow: hidden; 9 | background-color: $color; 10 | } 11 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/mixins/_navbar-align.scss: -------------------------------------------------------------------------------- 1 | // Navbar vertical align 2 | // 3 | // Vertically center elements in the navbar. 4 | // Example: an element has a height of 30px, so write out `.navbar-vertical-align(30px);` to calculate the appropriate top margin. 5 | 6 | // @mixin navbar-vertical-align($element-height) { 7 | // margin-top: (($navbar-height - $element-height) / 2); 8 | // margin-bottom: (($navbar-height - $element-height) / 2); 9 | // } 10 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/mixins/_pagination.scss: -------------------------------------------------------------------------------- 1 | // Pagination 2 | 3 | @mixin pagination-size($padding-vertical, $padding-horizontal, $font-size, $line-height, $border-radius) { 4 | > li { 5 | > a, 6 | > span { 7 | padding: $padding-vertical $padding-horizontal; 8 | font-size: $font-size; 9 | line-height: $line-height; 10 | } 11 | &:first-child { 12 | > a, 13 | > span { 14 | @include border-left-radius($border-radius); 15 | } 16 | } 17 | &:last-child { 18 | > a, 19 | > span { 20 | @include border-right-radius($border-radius); 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/mixins/_progress.scss: -------------------------------------------------------------------------------- 1 | // Progress bars 2 | 3 | @mixin progress-variant($color) { 4 | &[value]::-webkit-progress-value { 5 | background-color: $color; 6 | } 7 | 8 | &[value]::-moz-progress-bar { 9 | background-color: $color; 10 | } 11 | 12 | @media screen and (min-width:0\0) { 13 | .progress-bar { 14 | background-color: $color; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/mixins/_pulls.scss: -------------------------------------------------------------------------------- 1 | @mixin pull-left { 2 | float: left !important; 3 | } 4 | @mixin pull-right { 5 | float: right !important; 6 | } 7 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/mixins/_reset-filter.scss: -------------------------------------------------------------------------------- 1 | // Reset filters for IE 2 | // 3 | // When you need to remove a gradient background, do not forget to use this to reset 4 | // the IE filter for IE9. 5 | 6 | @mixin reset-filter() { 7 | filter: "progid:DXImageTransform.Microsoft.gradient(enabled = false)"; 8 | } 9 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/mixins/_reset-text.scss: -------------------------------------------------------------------------------- 1 | @mixin reset-text { 2 | font-family: $font-family-base; 3 | // We deliberately do NOT reset font-size. 4 | font-style: normal; 5 | font-weight: normal; 6 | letter-spacing: normal; 7 | line-break: auto; 8 | line-height: $line-height; 9 | text-align: left; // Fallback for where `start` is not supported 10 | text-align: start; 11 | text-decoration: none; 12 | text-shadow: none; 13 | text-transform: none; 14 | white-space: normal; 15 | word-break: normal; 16 | word-spacing: normal; 17 | word-wrap: normal; 18 | } 19 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/mixins/_resize.scss: -------------------------------------------------------------------------------- 1 | // Resize anything 2 | 3 | @mixin resizable($direction) { 4 | resize: $direction; // Options: horizontal, vertical, both 5 | overflow: auto; // Per CSS3 UI, `resize` only applies when `overflow` isn't `visible` 6 | } 7 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/mixins/_responsive-visibility.scss: -------------------------------------------------------------------------------- 1 | // Responsive utilities 2 | 3 | // 4 | // More easily include all the states for responsive-utilities.less. 5 | // [converter] $parent hack 6 | @mixin responsive-visibility($parent) { 7 | #{$parent} { 8 | display: block !important; 9 | } 10 | table#{$parent} { display: table !important; } 11 | tr#{$parent} { display: table-row !important; } 12 | th#{$parent}, 13 | td#{$parent} { display: table-cell !important; } 14 | } 15 | 16 | // [converter] $parent hack 17 | @mixin responsive-invisibility($parent) { 18 | #{$parent} { 19 | display: none !important; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/mixins/_screen-reader.scss: -------------------------------------------------------------------------------- 1 | // Only display content to screen readers 2 | // 3 | // See: http://a11yproject.com/posts/how-to-hide-content/ 4 | 5 | @mixin sr-only { 6 | position: absolute; 7 | width: 1px; 8 | height: 1px; 9 | padding: 0; 10 | margin: -1px; 11 | overflow: hidden; 12 | clip: rect(0,0,0,0); 13 | border: 0; 14 | } 15 | 16 | // Use in conjunction with .sr-only to only display content when it's focused. 17 | // 18 | // Useful for "Skip to main content" links; see http://www.w3.org/TR/2013/NOTE-WCAG20-TECHS-20130905/G1 19 | // 20 | // Credit: HTML5 Boilerplate 21 | 22 | @mixin sr-only-focusable { 23 | &:active, 24 | &:focus { 25 | position: static; 26 | width: auto; 27 | height: auto; 28 | margin: 0; 29 | overflow: visible; 30 | clip: auto; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/mixins/_size.scss: -------------------------------------------------------------------------------- 1 | // Sizing shortcuts 2 | 3 | @mixin size($width, $height) { 4 | width: $width; 5 | height: $height; 6 | } 7 | 8 | @mixin square($size) { 9 | @include size($size, $size); 10 | } 11 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/mixins/_tab-focus.scss: -------------------------------------------------------------------------------- 1 | // WebKit-style focus 2 | 3 | @mixin tab-focus() { 4 | // Default 5 | outline: thin dotted; 6 | // WebKit 7 | outline: 5px auto -webkit-focus-ring-color; 8 | outline-offset: -2px; 9 | } 10 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/mixins/_table-row.scss: -------------------------------------------------------------------------------- 1 | // Tables 2 | 3 | @mixin table-row-variant($state, $background) { 4 | // Exact selectors below required to override `.table-striped` and prevent 5 | // inheritance to nested tables. 6 | .table-#{$state} { 7 | &, 8 | > th, 9 | > td { 10 | background-color: $background; 11 | } 12 | } 13 | 14 | // Hover states for `.table-hover` 15 | // Note: this is not available for cells or rows within `thead` or `tfoot`. 16 | .table-hover { 17 | $hover-background: darken($background, 5%); 18 | 19 | .table-#{$state} { 20 | @include hover { 21 | background-color: $hover-background; 22 | 23 | > td, 24 | > th { 25 | background-color: $hover-background; 26 | } 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/mixins/_text-emphasis.scss: -------------------------------------------------------------------------------- 1 | // Typography 2 | 3 | @mixin text-emphasis-variant($parent, $color) { 4 | #{$parent} { 5 | color: $color; 6 | } 7 | a#{$parent} { 8 | @include hover-focus { 9 | color: darken($color, 10%); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /chapter-09/src/scss/vendor/mixins/_text-truncate.scss: -------------------------------------------------------------------------------- 1 | // Text truncate 2 | // Requires inline-block or block for proper styling 3 | 4 | @mixin text-truncate() { 5 | overflow: hidden; 6 | text-overflow: ellipsis; 7 | white-space: nowrap; 8 | } -------------------------------------------------------------------------------- /chapter-10/.env: -------------------------------------------------------------------------------- 1 | SESSION_SECRET="" 2 | 3 | MONGODB="" 4 | -------------------------------------------------------------------------------- /chapter-10/.gitignore: -------------------------------------------------------------------------------- 1 | lib-cov 2 | *.seed 3 | *.log 4 | *.csv 5 | *.dat 6 | *.out 7 | *.pid 8 | *.gz 9 | *.swp 10 | 11 | pids 12 | logs 13 | results 14 | tmp 15 | coverage 16 | 17 | # API keys 18 | #.env 19 | 20 | # Dependency directory 21 | node_modules 22 | bower_components 23 | npm-debug.log 24 | 25 | # Editors 26 | .idea 27 | *.iml 28 | 29 | # OS metadata 30 | .DS_Store 31 | Thumbs.db 32 | -------------------------------------------------------------------------------- /chapter-10/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:argon 2 | 3 | # Create app directory 4 | RUN mkdir -p /usr/src/app 5 | WORKDIR /usr/src/app 6 | 7 | # Install app dependencies 8 | COPY package.json /usr/src/app/ 9 | RUN npm install 10 | 11 | ENV PORT 3000 12 | ENV DB_PORT_27017_TCP_ADDR db 13 | 14 | # Bundle app source 15 | COPY . /usr/src/app 16 | 17 | EXPOSE 3000 18 | CMD [ "npm", "start" ] 19 | -------------------------------------------------------------------------------- /chapter-10/Procfile: -------------------------------------------------------------------------------- 1 | web: node server.js 2 | -------------------------------------------------------------------------------- /chapter-10/controllers/home.js: -------------------------------------------------------------------------------- 1 | // Render Home Page 2 | exports.index = function(req, res) { 3 | res.render('home', { 4 | title: 'Home' 5 | }); 6 | }; 7 | -------------------------------------------------------------------------------- /chapter-10/docker-compose.yml: -------------------------------------------------------------------------------- 1 | app: 2 | build: . 3 | ports: 4 | - "3000:3000" 5 | links: 6 | - db 7 | 8 | db: 9 | image: mongo 10 | ports: 11 | - "27017:27017" 12 | -------------------------------------------------------------------------------- /chapter-10/public/css/vendor/bootstrap/_breadcrumbs.scss: -------------------------------------------------------------------------------- 1 | // 2 | // Breadcrumbs 3 | // -------------------------------------------------- 4 | 5 | 6 | .breadcrumb { 7 | padding: $breadcrumb-padding-vertical $breadcrumb-padding-horizontal; 8 | margin-bottom: $line-height-computed; 9 | list-style: none; 10 | background-color: $breadcrumb-bg; 11 | border-radius: $border-radius-base; 12 | 13 | > li { 14 | display: inline-block; 15 | 16 | + li:before { 17 | // [converter] Workaround for https://github.com/sass/libsass/issues/1115 18 | $nbsp: "\00a0"; 19 | content: "#{$breadcrumb-separator}#{$nbsp}"; // Unicode space added since inline-block means non-collapsing white-space 20 | padding: 0 5px; 21 | color: $breadcrumb-color; 22 | } 23 | } 24 | 25 | > .active { 26 | color: $breadcrumb-active-color; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /chapter-10/public/css/vendor/bootstrap/_close.scss: -------------------------------------------------------------------------------- 1 | // 2 | // Close icons 3 | // -------------------------------------------------- 4 | 5 | 6 | .close { 7 | float: right; 8 | font-size: ($font-size-base * 1.5); 9 | font-weight: $close-font-weight; 10 | line-height: 1; 11 | color: $close-color; 12 | text-shadow: $close-text-shadow; 13 | @include opacity(.2); 14 | 15 | &:hover, 16 | &:focus { 17 | color: $close-color; 18 | text-decoration: none; 19 | cursor: pointer; 20 | @include opacity(.5); 21 | } 22 | 23 | // [converter] extracted button& to button.close 24 | } 25 | 26 | // Additional properties for button version 27 | // iOS requires the button element instead of an anchor tag. 28 | // If you want the anchor version, it requires `href="#"`. 29 | // See https://developer.mozilla.org/en-US/docs/Web/Events/click#Safari_Mobile 30 | button.close { 31 | padding: 0; 32 | cursor: pointer; 33 | background: transparent; 34 | border: 0; 35 | -webkit-appearance: none; 36 | } 37 | -------------------------------------------------------------------------------- /chapter-10/public/css/vendor/bootstrap/_component-animations.scss: -------------------------------------------------------------------------------- 1 | // 2 | // Component animations 3 | // -------------------------------------------------- 4 | 5 | // Heads up! 6 | // 7 | // We don't use the `.opacity()` mixin here since it causes a bug with text 8 | // fields in IE7-8. Source: https://github.com/twbs/bootstrap/pull/3552. 9 | 10 | .fade { 11 | opacity: 0; 12 | @include transition(opacity .15s linear); 13 | &.in { 14 | opacity: 1; 15 | } 16 | } 17 | 18 | .collapse { 19 | display: none; 20 | 21 | &.in { display: block; } 22 | // [converter] extracted tr&.in to tr.collapse.in 23 | // [converter] extracted tbody&.in to tbody.collapse.in 24 | } 25 | 26 | tr.collapse.in { display: table-row; } 27 | 28 | tbody.collapse.in { display: table-row-group; } 29 | 30 | .collapsing { 31 | position: relative; 32 | height: 0; 33 | overflow: hidden; 34 | @include transition-property(height, visibility); 35 | @include transition-duration(.35s); 36 | @include transition-timing-function(ease); 37 | } 38 | -------------------------------------------------------------------------------- /chapter-10/public/css/vendor/bootstrap/_responsive-embed.scss: -------------------------------------------------------------------------------- 1 | // Embeds responsive 2 | // 3 | // Credit: Nicolas Gallagher and SUIT CSS. 4 | 5 | .embed-responsive { 6 | position: relative; 7 | display: block; 8 | height: 0; 9 | padding: 0; 10 | overflow: hidden; 11 | 12 | .embed-responsive-item, 13 | iframe, 14 | embed, 15 | object, 16 | video { 17 | position: absolute; 18 | top: 0; 19 | left: 0; 20 | bottom: 0; 21 | height: 100%; 22 | width: 100%; 23 | border: 0; 24 | } 25 | } 26 | 27 | // Modifier class for 16:9 aspect ratio 28 | .embed-responsive-16by9 { 29 | padding-bottom: 56.25%; 30 | } 31 | 32 | // Modifier class for 4:3 aspect ratio 33 | .embed-responsive-4by3 { 34 | padding-bottom: 75%; 35 | } 36 | -------------------------------------------------------------------------------- /chapter-10/public/css/vendor/bootstrap/_utilities.scss: -------------------------------------------------------------------------------- 1 | // 2 | // Utility classes 3 | // -------------------------------------------------- 4 | 5 | 6 | // Floats 7 | // ------------------------- 8 | 9 | .clearfix { 10 | @include clearfix; 11 | } 12 | .center-block { 13 | @include center-block; 14 | } 15 | .pull-right { 16 | float: right !important; 17 | } 18 | .pull-left { 19 | float: left !important; 20 | } 21 | 22 | 23 | // Toggling content 24 | // ------------------------- 25 | 26 | // Note: Deprecated .hide in favor of .hidden or .sr-only (as appropriate) in v3.0.1 27 | .hide { 28 | display: none !important; 29 | } 30 | .show { 31 | display: block !important; 32 | } 33 | .invisible { 34 | visibility: hidden; 35 | } 36 | .text-hide { 37 | @include text-hide; 38 | } 39 | 40 | 41 | // Hide from screenreaders and browsers 42 | // 43 | // Credit: HTML5 Boilerplate 44 | 45 | .hidden { 46 | display: none !important; 47 | } 48 | 49 | 50 | // For Affix plugin 51 | // ------------------------- 52 | 53 | .affix { 54 | position: fixed; 55 | } 56 | -------------------------------------------------------------------------------- /chapter-10/public/css/vendor/bootstrap/_wells.scss: -------------------------------------------------------------------------------- 1 | // 2 | // Wells 3 | // -------------------------------------------------- 4 | 5 | 6 | // Base class 7 | .well { 8 | min-height: 20px; 9 | padding: 19px; 10 | margin-bottom: 20px; 11 | background-color: $well-bg; 12 | border: 1px solid $well-border; 13 | border-radius: $border-radius-base; 14 | @include box-shadow(inset 0 1px 1px rgba(0,0,0,.05)); 15 | blockquote { 16 | border-color: #ddd; 17 | border-color: rgba(0,0,0,.15); 18 | } 19 | } 20 | 21 | // Sizes 22 | .well-lg { 23 | padding: 24px; 24 | border-radius: $border-radius-large; 25 | } 26 | .well-sm { 27 | padding: 9px; 28 | border-radius: $border-radius-small; 29 | } 30 | -------------------------------------------------------------------------------- /chapter-10/public/css/vendor/bootstrap/mixins/_alerts.scss: -------------------------------------------------------------------------------- 1 | // Alerts 2 | 3 | @mixin alert-variant($background, $border, $text-color) { 4 | background-color: $background; 5 | border-color: $border; 6 | color: $text-color; 7 | 8 | hr { 9 | border-top-color: darken($border, 5%); 10 | } 11 | .alert-link { 12 | color: darken($text-color, 10%); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /chapter-10/public/css/vendor/bootstrap/mixins/_background-variant.scss: -------------------------------------------------------------------------------- 1 | // Contextual backgrounds 2 | 3 | // [converter] $parent hack 4 | @mixin bg-variant($parent, $color) { 5 | #{$parent} { 6 | background-color: $color; 7 | } 8 | a#{$parent}:hover, 9 | a#{$parent}:focus { 10 | background-color: darken($color, 10%); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /chapter-10/public/css/vendor/bootstrap/mixins/_border-radius.scss: -------------------------------------------------------------------------------- 1 | // Single side border-radius 2 | 3 | @mixin border-top-radius($radius) { 4 | border-top-right-radius: $radius; 5 | border-top-left-radius: $radius; 6 | } 7 | @mixin border-right-radius($radius) { 8 | border-bottom-right-radius: $radius; 9 | border-top-right-radius: $radius; 10 | } 11 | @mixin border-bottom-radius($radius) { 12 | border-bottom-right-radius: $radius; 13 | border-bottom-left-radius: $radius; 14 | } 15 | @mixin border-left-radius($radius) { 16 | border-bottom-left-radius: $radius; 17 | border-top-left-radius: $radius; 18 | } 19 | -------------------------------------------------------------------------------- /chapter-10/public/css/vendor/bootstrap/mixins/_center-block.scss: -------------------------------------------------------------------------------- 1 | // Center-align a block level element 2 | 3 | @mixin center-block() { 4 | display: block; 5 | margin-left: auto; 6 | margin-right: auto; 7 | } 8 | -------------------------------------------------------------------------------- /chapter-10/public/css/vendor/bootstrap/mixins/_clearfix.scss: -------------------------------------------------------------------------------- 1 | // Clearfix 2 | // 3 | // For modern browsers 4 | // 1. The space content is one way to avoid an Opera bug when the 5 | // contenteditable attribute is included anywhere else in the document. 6 | // Otherwise it causes space to appear at the top and bottom of elements 7 | // that are clearfixed. 8 | // 2. The use of `table` rather than `block` is only necessary if using 9 | // `:before` to contain the top-margins of child elements. 10 | // 11 | // Source: http://nicolasgallagher.com/micro-clearfix-hack/ 12 | 13 | @mixin clearfix() { 14 | &:before, 15 | &:after { 16 | content: " "; // 1 17 | display: table; // 2 18 | } 19 | &:after { 20 | clear: both; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /chapter-10/public/css/vendor/bootstrap/mixins/_hide-text.scss: -------------------------------------------------------------------------------- 1 | // CSS image replacement 2 | // 3 | // Heads up! v3 launched with only `.hide-text()`, but per our pattern for 4 | // mixins being reused as classes with the same name, this doesn't hold up. As 5 | // of v3.0.1 we have added `.text-hide()` and deprecated `.hide-text()`. 6 | // 7 | // Source: https://github.com/h5bp/html5-boilerplate/commit/aa0396eae757 8 | 9 | // Deprecated as of v3.0.1 (has been removed in v4) 10 | @mixin hide-text() { 11 | font: 0/0 a; 12 | color: transparent; 13 | text-shadow: none; 14 | background-color: transparent; 15 | border: 0; 16 | } 17 | 18 | // New mixin to use as of v3.0.1 19 | @mixin text-hide() { 20 | @include hide-text; 21 | } 22 | -------------------------------------------------------------------------------- /chapter-10/public/css/vendor/bootstrap/mixins/_labels.scss: -------------------------------------------------------------------------------- 1 | // Labels 2 | 3 | @mixin label-variant($color) { 4 | background-color: $color; 5 | 6 | &[href] { 7 | &:hover, 8 | &:focus { 9 | background-color: darken($color, 10%); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /chapter-10/public/css/vendor/bootstrap/mixins/_list-group.scss: -------------------------------------------------------------------------------- 1 | // List Groups 2 | 3 | @mixin list-group-item-variant($state, $background, $color) { 4 | .list-group-item-#{$state} { 5 | color: $color; 6 | background-color: $background; 7 | 8 | // [converter] extracted a&, button& to a.list-group-item-#{$state}, button.list-group-item-#{$state} 9 | } 10 | 11 | a.list-group-item-#{$state}, 12 | button.list-group-item-#{$state} { 13 | color: $color; 14 | 15 | .list-group-item-heading { 16 | color: inherit; 17 | } 18 | 19 | &:hover, 20 | &:focus { 21 | color: $color; 22 | background-color: darken($background, 5%); 23 | } 24 | &.active, 25 | &.active:hover, 26 | &.active:focus { 27 | color: #fff; 28 | background-color: $color; 29 | border-color: $color; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /chapter-10/public/css/vendor/bootstrap/mixins/_nav-divider.scss: -------------------------------------------------------------------------------- 1 | // Horizontal dividers 2 | // 3 | // Dividers (basically an hr) within dropdowns and nav lists 4 | 5 | @mixin nav-divider($color: #e5e5e5) { 6 | height: 1px; 7 | margin: (($line-height-computed / 2) - 1) 0; 8 | overflow: hidden; 9 | background-color: $color; 10 | } 11 | -------------------------------------------------------------------------------- /chapter-10/public/css/vendor/bootstrap/mixins/_nav-vertical-align.scss: -------------------------------------------------------------------------------- 1 | // Navbar vertical align 2 | // 3 | // Vertically center elements in the navbar. 4 | // Example: an element has a height of 30px, so write out `.navbar-vertical-align(30px);` to calculate the appropriate top margin. 5 | 6 | @mixin navbar-vertical-align($element-height) { 7 | margin-top: (($navbar-height - $element-height) / 2); 8 | margin-bottom: (($navbar-height - $element-height) / 2); 9 | } 10 | -------------------------------------------------------------------------------- /chapter-10/public/css/vendor/bootstrap/mixins/_opacity.scss: -------------------------------------------------------------------------------- 1 | // Opacity 2 | 3 | @mixin opacity($opacity) { 4 | opacity: $opacity; 5 | // IE8 filter 6 | $opacity-ie: ($opacity * 100); 7 | filter: alpha(opacity=$opacity-ie); 8 | } 9 | -------------------------------------------------------------------------------- /chapter-10/public/css/vendor/bootstrap/mixins/_pagination.scss: -------------------------------------------------------------------------------- 1 | // Pagination 2 | 3 | @mixin pagination-size($padding-vertical, $padding-horizontal, $font-size, $line-height, $border-radius) { 4 | > li { 5 | > a, 6 | > span { 7 | padding: $padding-vertical $padding-horizontal; 8 | font-size: $font-size; 9 | line-height: $line-height; 10 | } 11 | &:first-child { 12 | > a, 13 | > span { 14 | @include border-left-radius($border-radius); 15 | } 16 | } 17 | &:last-child { 18 | > a, 19 | > span { 20 | @include border-right-radius($border-radius); 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /chapter-10/public/css/vendor/bootstrap/mixins/_panels.scss: -------------------------------------------------------------------------------- 1 | // Panels 2 | 3 | @mixin panel-variant($border, $heading-text-color, $heading-bg-color, $heading-border) { 4 | border-color: $border; 5 | 6 | & > .panel-heading { 7 | color: $heading-text-color; 8 | background-color: $heading-bg-color; 9 | border-color: $heading-border; 10 | 11 | + .panel-collapse > .panel-body { 12 | border-top-color: $border; 13 | } 14 | .badge { 15 | color: $heading-bg-color; 16 | background-color: $heading-text-color; 17 | } 18 | } 19 | & > .panel-footer { 20 | + .panel-collapse > .panel-body { 21 | border-bottom-color: $border; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /chapter-10/public/css/vendor/bootstrap/mixins/_progress-bar.scss: -------------------------------------------------------------------------------- 1 | // Progress bars 2 | 3 | @mixin progress-bar-variant($color) { 4 | background-color: $color; 5 | 6 | // Deprecated parent class requirement as of v3.2.0 7 | .progress-striped & { 8 | @include gradient-striped; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /chapter-10/public/css/vendor/bootstrap/mixins/_reset-filter.scss: -------------------------------------------------------------------------------- 1 | // Reset filters for IE 2 | // 3 | // When you need to remove a gradient background, do not forget to use this to reset 4 | // the IE filter for IE9 and below. 5 | 6 | @mixin reset-filter() { 7 | filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); 8 | } 9 | -------------------------------------------------------------------------------- /chapter-10/public/css/vendor/bootstrap/mixins/_reset-text.scss: -------------------------------------------------------------------------------- 1 | @mixin reset-text() { 2 | font-family: $font-family-base; 3 | // We deliberately do NOT reset font-size. 4 | font-style: normal; 5 | font-weight: normal; 6 | letter-spacing: normal; 7 | line-break: auto; 8 | line-height: $line-height-base; 9 | text-align: left; // Fallback for where `start` is not supported 10 | text-align: start; 11 | text-decoration: none; 12 | text-shadow: none; 13 | text-transform: none; 14 | white-space: normal; 15 | word-break: normal; 16 | word-spacing: normal; 17 | word-wrap: normal; 18 | } 19 | -------------------------------------------------------------------------------- /chapter-10/public/css/vendor/bootstrap/mixins/_resize.scss: -------------------------------------------------------------------------------- 1 | // Resize anything 2 | 3 | @mixin resizable($direction) { 4 | resize: $direction; // Options: horizontal, vertical, both 5 | overflow: auto; // Per CSS3 UI, `resize` only applies when `overflow` isn't `visible` 6 | } 7 | -------------------------------------------------------------------------------- /chapter-10/public/css/vendor/bootstrap/mixins/_responsive-visibility.scss: -------------------------------------------------------------------------------- 1 | // Responsive utilities 2 | 3 | // 4 | // More easily include all the states for responsive-utilities.less. 5 | // [converter] $parent hack 6 | @mixin responsive-visibility($parent) { 7 | #{$parent} { 8 | display: block !important; 9 | } 10 | table#{$parent} { display: table !important; } 11 | tr#{$parent} { display: table-row !important; } 12 | th#{$parent}, 13 | td#{$parent} { display: table-cell !important; } 14 | } 15 | 16 | // [converter] $parent hack 17 | @mixin responsive-invisibility($parent) { 18 | #{$parent} { 19 | display: none !important; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /chapter-10/public/css/vendor/bootstrap/mixins/_size.scss: -------------------------------------------------------------------------------- 1 | // Sizing shortcuts 2 | 3 | @mixin size($width, $height) { 4 | width: $width; 5 | height: $height; 6 | } 7 | 8 | @mixin square($size) { 9 | @include size($size, $size); 10 | } 11 | -------------------------------------------------------------------------------- /chapter-10/public/css/vendor/bootstrap/mixins/_tab-focus.scss: -------------------------------------------------------------------------------- 1 | // WebKit-style focus 2 | 3 | @mixin tab-focus() { 4 | // Default 5 | outline: thin dotted; 6 | // WebKit 7 | outline: 5px auto -webkit-focus-ring-color; 8 | outline-offset: -2px; 9 | } 10 | -------------------------------------------------------------------------------- /chapter-10/public/css/vendor/bootstrap/mixins/_table-row.scss: -------------------------------------------------------------------------------- 1 | // Tables 2 | 3 | @mixin table-row-variant($state, $background) { 4 | // Exact selectors below required to override `.table-striped` and prevent 5 | // inheritance to nested tables. 6 | .table > thead > tr, 7 | .table > tbody > tr, 8 | .table > tfoot > tr { 9 | > td.#{$state}, 10 | > th.#{$state}, 11 | &.#{$state} > td, 12 | &.#{$state} > th { 13 | background-color: $background; 14 | } 15 | } 16 | 17 | // Hover states for `.table-hover` 18 | // Note: this is not available for cells or rows within `thead` or `tfoot`. 19 | .table-hover > tbody > tr { 20 | > td.#{$state}:hover, 21 | > th.#{$state}:hover, 22 | &.#{$state}:hover > td, 23 | &:hover > .#{$state}, 24 | &.#{$state}:hover > th { 25 | background-color: darken($background, 5%); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /chapter-10/public/css/vendor/bootstrap/mixins/_text-emphasis.scss: -------------------------------------------------------------------------------- 1 | // Typography 2 | 3 | // [converter] $parent hack 4 | @mixin text-emphasis-variant($parent, $color) { 5 | #{$parent} { 6 | color: $color; 7 | } 8 | a#{$parent}:hover, 9 | a#{$parent}:focus { 10 | color: darken($color, 10%); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /chapter-10/public/css/vendor/bootstrap/mixins/_text-overflow.scss: -------------------------------------------------------------------------------- 1 | // Text overflow 2 | // Requires inline-block or block for proper styling 3 | 4 | @mixin text-overflow() { 5 | overflow: hidden; 6 | text-overflow: ellipsis; 7 | white-space: nowrap; 8 | } 9 | -------------------------------------------------------------------------------- /chapter-10/public/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-10/public/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /chapter-10/public/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-10/public/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /chapter-10/public/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-10/public/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /chapter-10/public/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/nodejs-6-blueprints/d1a609035c7499c9382ab2d3d0aac358e3c5be5a/chapter-10/public/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /chapter-10/public/js/main.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | // Custom JavaScript code 3 | }); 4 | -------------------------------------------------------------------------------- /chapter-10/test/app.test.js: -------------------------------------------------------------------------------- 1 | // import modules 2 | var request = require('supertest'); 3 | var server = require('../server'); 4 | 5 | // Test 01 6 | describe('GET /', function() { 7 | it('should render ok', function(done) { 8 | request(server) 9 | .get('/') 10 | // expected result 11 | .expect(200, done); 12 | }); 13 | }); 14 | 15 | // Test 02 16 | describe('GET /bikes', function() { 17 | it('should not found', function(done) { 18 | request(server) 19 | .get('/bikes') 20 | // expected result 21 | .expect(404, done); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /chapter-10/views/layouts/main.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Chapter-10 8 | {{title}} 9 | 10 | 11 | 12 | {% include "../partials/header.html" %} 13 | {% block content %} 14 | {% endblock %} 15 | {% include "../partials/footer.html" %} 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /chapter-10/views/partials/footer.html: -------------------------------------------------------------------------------- 1 | 6 | --------------------------------------------------------------------------------