diff --git a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/assets.py b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/assets.py index 67d5ec3..5f1fb04 100644 --- a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/assets.py +++ b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/assets.py @@ -2,20 +2,17 @@ from flask.ext.assets import Bundle, Environment css = Bundle( - "libs/bootstrap3/css/bootstrap.min.css", + "libs/bootstrap/dist/css/bootstrap.css", "css/style.css", filters="cssmin", output="public/css/common.css" ) js = Bundle( - "libs/jquery2/jquery-2.0.3.min.js", - "libs/bootstrap3/js/bootstrap.min.js", + "libs/jQuery/dist/jquery.js", + "libs/bootstrap/dist/js/bootstrap.js", "js/plugins.js", - Bundle( - "js/script.js", - filters="jsmin" - ), + filters='jsmin', output="public/js/common.js" ) diff --git a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/js/script.js b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/js/script.js index eeec128..4c75e09 100644 --- a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/js/script.js +++ b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/js/script.js @@ -1,5 +1,5 @@ -(function() { +(function($, window) { -}).call(this); +}).call(this, jQuery, window); diff --git a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/.bower.json b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/.bower.json new file mode 100644 index 0000000..30af811 --- /dev/null +++ b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/.bower.json @@ -0,0 +1,34 @@ +{ + "name": "bootstrap", + "version": "3.1.1", + "main": [ + "./dist/css/bootstrap.css", + "./dist/js/bootstrap.js", + "./dist/fonts/glyphicons-halflings-regular.eot", + "./dist/fonts/glyphicons-halflings-regular.svg", + "./dist/fonts/glyphicons-halflings-regular.ttf", + "./dist/fonts/glyphicons-halflings-regular.woff" + ], + "ignore": [ + "**/.*", + "_config.yml", + "CNAME", + "composer.json", + "CONTRIBUTING.md", + "docs", + "js/tests" + ], + "dependencies": { + "jquery": ">= 1.9.0" + }, + "homepage": "https://github.com/twbs/bootstrap", + "_release": "3.1.1", + "_resolution": { + "type": "version", + "tag": "v3.1.1", + "commit": "a365d8689c3f3cee7f1acf86b61270ecca8e106d" + }, + "_source": "git://github.com/twbs/bootstrap.git", + "_target": ">=3.1.1", + "_originalSource": "bootstrap" +} \ No newline at end of file diff --git a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/Gruntfile.js b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/Gruntfile.js new file mode 100644 index 0000000..600c1f1 --- /dev/null +++ b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/Gruntfile.js @@ -0,0 +1,421 @@ +/*! + * Bootstrap's Gruntfile + * http://getbootstrap.com + * Copyright 2013-2014 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + */ + +module.exports = function (grunt) { + 'use strict'; + + // Force use of Unix newlines + grunt.util.linefeed = '\n'; + + RegExp.quote = function (string) { + return string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&'); + }; + + var fs = require('fs'); + var path = require('path'); + var generateGlyphiconsData = require('./grunt/bs-glyphicons-data-generator.js'); + var BsLessdocParser = require('./grunt/bs-lessdoc-parser.js'); + var generateRawFilesJs = require('./grunt/bs-raw-files-generator.js'); + var updateShrinkwrap = require('./grunt/shrinkwrap.js'); + + // Project configuration. + grunt.initConfig({ + + // Metadata. + pkg: grunt.file.readJSON('package.json'), + banner: '/*!\n' + + ' * Bootstrap v<%= pkg.version %> (<%= pkg.homepage %>)\n' + + ' * Copyright 2011-<%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' + + ' * Licensed under <%= pkg.license.type %> (<%= pkg.license.url %>)\n' + + ' */\n', + jqueryCheck: 'if (typeof jQuery === \'undefined\') { throw new Error(\'Bootstrap\\\'s JavaScript requires jQuery\') }\n\n', + + // Task configuration. + clean: { + dist: ['dist', 'docs/dist'] + }, + + jshint: { + options: { + jshintrc: 'js/.jshintrc' + }, + grunt: { + options: { + jshintrc: 'grunt/.jshintrc' + }, + src: ['Gruntfile.js', 'grunt/*.js'] + }, + src: { + src: 'js/*.js' + }, + test: { + src: 'js/tests/unit/*.js' + }, + assets: { + src: ['docs/assets/js/application.js', 'docs/assets/js/customizer.js'] + } + }, + + jscs: { + options: { + config: 'js/.jscs.json', + }, + grunt: { + src: ['Gruntfile.js', 'grunt/*.js'] + }, + src: { + src: 'js/*.js' + }, + test: { + src: 'js/tests/unit/*.js' + }, + assets: { + src: ['docs/assets/js/application.js', 'docs/assets/js/customizer.js'] + } + }, + + csslint: { + options: { + csslintrc: 'less/.csslintrc' + }, + src: [ + 'dist/css/bootstrap.css', + 'dist/css/bootstrap-theme.css', + 'docs/assets/css/docs.css', + 'docs/examples/**/*.css' + ] + }, + + concat: { + options: { + banner: '<%= banner %>\n<%= jqueryCheck %>', + stripBanners: false + }, + bootstrap: { + src: [ + 'js/transition.js', + 'js/alert.js', + 'js/button.js', + 'js/carousel.js', + 'js/collapse.js', + 'js/dropdown.js', + 'js/modal.js', + 'js/tooltip.js', + 'js/popover.js', + 'js/scrollspy.js', + 'js/tab.js', + 'js/affix.js' + ], + dest: 'dist/js/<%= pkg.name %>.js' + } + }, + + uglify: { + options: { + report: 'min' + }, + bootstrap: { + options: { + banner: '<%= banner %>' + }, + src: '<%= concat.bootstrap.dest %>', + dest: 'dist/js/<%= pkg.name %>.min.js' + }, + customize: { + options: { + preserveComments: 'some' + }, + src: [ + 'docs/assets/js/vendor/less.min.js', + 'docs/assets/js/vendor/jszip.min.js', + 'docs/assets/js/vendor/uglify.min.js', + 'docs/assets/js/vendor/blob.js', + 'docs/assets/js/vendor/filesaver.js', + 'docs/assets/js/raw-files.min.js', + 'docs/assets/js/customizer.js' + ], + dest: 'docs/assets/js/customize.min.js' + }, + docsJs: { + options: { + preserveComments: 'some' + }, + src: [ + 'docs/assets/js/vendor/holder.js', + 'docs/assets/js/application.js' + ], + dest: 'docs/assets/js/docs.min.js' + } + }, + + less: { + compileCore: { + options: { + strictMath: true, + sourceMap: true, + outputSourceFiles: true, + sourceMapURL: '<%= pkg.name %>.css.map', + sourceMapFilename: 'dist/css/<%= pkg.name %>.css.map' + }, + files: { + 'dist/css/<%= pkg.name %>.css': 'less/bootstrap.less' + } + }, + compileTheme: { + options: { + strictMath: true, + sourceMap: true, + outputSourceFiles: true, + sourceMapURL: '<%= pkg.name %>-theme.css.map', + sourceMapFilename: 'dist/css/<%= pkg.name %>-theme.css.map' + }, + files: { + 'dist/css/<%= pkg.name %>-theme.css': 'less/theme.less' + } + }, + minify: { + options: { + cleancss: true, + report: 'min' + }, + files: { + 'dist/css/<%= pkg.name %>.min.css': 'dist/css/<%= pkg.name %>.css', + 'dist/css/<%= pkg.name %>-theme.min.css': 'dist/css/<%= pkg.name %>-theme.css' + } + } + }, + + cssmin: { + compress: { + options: { + keepSpecialComments: '*', + noAdvanced: true, // turn advanced optimizations off until the issue is fixed in clean-css + report: 'min', + selectorsMergeMode: 'ie8' + }, + src: [ + 'docs/assets/css/docs.css', + 'docs/assets/css/pygments-manni.css' + ], + dest: 'docs/assets/css/docs.min.css' + } + }, + + usebanner: { + dist: { + options: { + position: 'top', + banner: '<%= banner %>' + }, + files: { + src: [ + 'dist/css/<%= pkg.name %>.css', + 'dist/css/<%= pkg.name %>.min.css', + 'dist/css/<%= pkg.name %>-theme.css', + 'dist/css/<%= pkg.name %>-theme.min.css' + ] + } + } + }, + + csscomb: { + options: { + config: 'less/.csscomb.json' + }, + dist: { + files: { + 'dist/css/<%= pkg.name %>.css': 'dist/css/<%= pkg.name %>.css', + 'dist/css/<%= pkg.name %>-theme.css': 'dist/css/<%= pkg.name %>-theme.css' + } + }, + examples: { + expand: true, + cwd: 'docs/examples/', + src: ['**/*.css'], + dest: 'docs/examples/' + } + }, + + copy: { + fonts: { + expand: true, + src: 'fonts/*', + dest: 'dist/' + }, + docs: { + expand: true, + cwd: './dist', + src: [ + '{css,js}/*.min.*', + 'css/*.map', + 'fonts/*' + ], + dest: 'docs/dist' + } + }, + + qunit: { + options: { + inject: 'js/tests/unit/phantom.js' + }, + files: 'js/tests/index.html' + }, + + connect: { + server: { + options: { + port: 3000, + base: '.' + } + } + }, + + jekyll: { + docs: {} + }, + + jade: { + compile: { + options: { + pretty: true, + data: function () { + var filePath = path.join(__dirname, 'less/variables.less'); + var fileContent = fs.readFileSync(filePath, {encoding: 'utf8'}); + var parser = new BsLessdocParser(fileContent); + return {sections: parser.parseFile()}; + } + }, + files: { + 'docs/_includes/customizer-variables.html': 'docs/jade/customizer-variables.jade', + 'docs/_includes/nav-customize.html': 'docs/jade/customizer-nav.jade' + } + } + }, + + validation: { + options: { + charset: 'utf-8', + doctype: 'HTML5', + failHard: true, + reset: true, + relaxerror: [ + 'Bad value X-UA-Compatible for attribute http-equiv on element meta.', + 'Element img is missing required attribute src.' + ] + }, + files: { + src: '_gh_pages/**/*.html' + } + }, + + watch: { + src: { + files: '<%= jshint.src.src %>', + tasks: ['jshint:src', 'qunit'] + }, + test: { + files: '<%= jshint.test.src %>', + tasks: ['jshint:test', 'qunit'] + }, + less: { + files: 'less/*.less', + tasks: 'less' + } + }, + + sed: { + versionNumber: { + pattern: (function () { + var old = grunt.option('oldver'); + return old ? RegExp.quote(old) : old; + })(), + replacement: grunt.option('newver'), + recursive: true + } + }, + + 'saucelabs-qunit': { + all: { + options: { + build: process.env.TRAVIS_JOB_ID, + concurrency: 10, + urls: ['http://127.0.0.1:3000/js/tests/index.html'], + browsers: grunt.file.readYAML('test-infra/sauce_browsers.yml') + } + } + }, + + exec: { + npmUpdate: { + command: 'npm update' + }, + npmShrinkWrap: { + command: 'npm shrinkwrap --dev' + } + } + }); + + + // These plugins provide necessary tasks. + require('load-grunt-tasks')(grunt, {scope: 'devDependencies'}); + + // Docs HTML validation task + grunt.registerTask('validate-html', ['jekyll', 'validation']); + + // Test task. + var testSubtasks = []; + // Skip core tests if running a different subset of the test suite + if (!process.env.TWBS_TEST || process.env.TWBS_TEST === 'core') { + testSubtasks = testSubtasks.concat(['dist-css', 'csslint', 'jshint', 'jscs', 'qunit', 'build-customizer-html']); + } + // Skip HTML validation if running a different subset of the test suite + if (!process.env.TWBS_TEST || process.env.TWBS_TEST === 'validate-html') { + testSubtasks.push('validate-html'); + } + // Only run Sauce Labs tests if there's a Sauce access key + if (typeof process.env.SAUCE_ACCESS_KEY !== 'undefined' && + // Skip Sauce if running a different subset of the test suite + (!process.env.TWBS_TEST || process.env.TWBS_TEST === 'sauce-js-unit')) { + testSubtasks.push('connect'); + testSubtasks.push('saucelabs-qunit'); + } + grunt.registerTask('test', testSubtasks); + + // JS distribution task. + grunt.registerTask('dist-js', ['concat', 'uglify']); + + // CSS distribution task. + grunt.registerTask('dist-css', ['less', 'cssmin', 'csscomb', 'usebanner']); + + // Docs distribution task. + grunt.registerTask('dist-docs', 'copy:docs'); + + // Full distribution task. + grunt.registerTask('dist', ['clean', 'dist-css', 'copy:fonts', 'dist-js', 'dist-docs']); + + // Default task. + grunt.registerTask('default', ['test', 'dist', 'build-glyphicons-data', 'build-customizer', 'update-shrinkwrap']); + + // Version numbering task. + // grunt change-version-number --oldver=A.B.C --newver=X.Y.Z + // This can be overzealous, so its changes should always be manually reviewed! + grunt.registerTask('change-version-number', 'sed'); + + grunt.registerTask('build-glyphicons-data', generateGlyphiconsData); + + // task for building customizer + grunt.registerTask('build-customizer', ['build-customizer-html', 'build-raw-files']); + grunt.registerTask('build-customizer-html', 'jade'); + grunt.registerTask('build-raw-files', 'Add scripts/less files to customizer.', function () { + var banner = grunt.template.process('<%= banner %>'); + generateRawFilesJs(banner); + }); + + // Task for updating the npm packages used by the Travis build. + grunt.registerTask('update-shrinkwrap', ['exec:npmUpdate', 'exec:npmShrinkWrap', '_update-shrinkwrap']); + grunt.registerTask('_update-shrinkwrap', function () { updateShrinkwrap.call(this, grunt); }); +}; diff --git a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/LICENSE b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/LICENSE new file mode 100644 index 0000000..8d94aa9 --- /dev/null +++ b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2011-2014 Twitter, Inc + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/README.md b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/README.md new file mode 100644 index 0000000..60817b7 --- /dev/null +++ b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/README.md @@ -0,0 +1,173 @@ +# [Bootstrap](http://getbootstrap.com) [![Bower version](https://badge.fury.io/bo/bootstrap.png)](http://badge.fury.io/bo/bootstrap) [![Build Status](https://secure.travis-ci.org/twbs/bootstrap.png)](http://travis-ci.org/twbs/bootstrap) [![devDependency Status](https://david-dm.org/twbs/bootstrap/dev-status.png?theme=shields.io)](https://david-dm.org/twbs/bootstrap#info=devDependencies) +[![Selenium Test Status](https://saucelabs.com/browser-matrix/bootstrap.svg)](https://saucelabs.com/u/bootstrap) + +Bootstrap is a sleek, intuitive, and powerful front-end framework for faster and easier web development, created by [Mark Otto](http://twitter.com/mdo) and [Jacob Thornton](http://twitter.com/fat), and maintained by the [core team](https://github.com/twbs?tab=members) with the massive support and involvement of the community. + +To get started, check out ! + +## Table of contents + + - [Quick start](#quick-start) + - [Bugs and feature requests](#bugs-and-feature-requests) + - [Documentation](#documentation) + - [Compiling CSS and JavaScript](#compiling-css-and-javascript) + - [Contributing](#contributing) + - [Community](#community) + - [Versioning](#versioning) + - [Authors](#authors) + - [Copyright and license](#copyright-and-license) + +## Quick start + +Three quick start options are available: + +- [Download the latest release](https://github.com/twbs/bootstrap/archive/v3.1.1.zip). +- Clone the repo: `git clone https://github.com/twbs/bootstrap.git`. +- Install with [Bower](http://bower.io): `bower install bootstrap`. + +Read the [Getting Started page](http://getbootstrap.com/getting-started/) for information on the framework contents, templates and examples, and more. + +### What's included + +Within the download you'll find the following directories and files, logically grouping common assets and providing both compiled and minified variations. You'll see something like this: + +``` +bootstrap/ +├── css/ +│ ├── bootstrap.css +│ ├── bootstrap.min.css +│ ├── bootstrap-theme.css +│ └── bootstrap-theme.min.css +├── js/ +│ ├── bootstrap.js +│ └── bootstrap.min.js +└── fonts/ + ├── glyphicons-halflings-regular.eot + ├── glyphicons-halflings-regular.svg + ├── glyphicons-halflings-regular.ttf + └── glyphicons-halflings-regular.woff +``` + +We provide compiled CSS and JS (`bootstrap.*`), as well as compiled and minified CSS and JS (`bootstrap.min.*`). Fonts from Glyphicons are included, as is the optional Bootstrap theme. + + + +## Bugs and feature requests + +Have a bug or a feature request? Please first read the [issue guidelines](https://github.com/twbs/bootstrap/blob/master/CONTRIBUTING.md#using-the-issue-tracker) and search for existing and closed issues. If your problem or idea is not addressed yet, [please open a new issue](https://github.com/twbs/bootstrap/issues/new). + + +## Documentation + +Bootstrap's documentation, included in this repo in the root directory, is built with [Jekyll](http://jekyllrb.com) and publicly hosted on GitHub Pages at . The docs may also be run locally. + +### Running documentation locally + +1. If necessary, [install Jekyll](http://jekyllrb.com/docs/installation) (requires v1.x). + - **Windows users:** Read [this unofficial guide](https://github.com/juthilo/run-jekyll-on-windows/) to get Jekyll up and running without problems. We use Pygments for syntax highlighting, so make sure to read the sections on installing Python and Pygments. +2. From the root `/bootstrap` directory, run `jekyll serve` in the command line. + - **Windows users:** While we use Jekyll's `encoding` setting, you might still need to change the command prompt's character encoding ([code page](http://en.wikipedia.org/wiki/Windows_code_page)) to UTF-8 so Jekyll runs without errors. For Ruby 2.0.0, run `chcp 65001` first. For Ruby 1.9.3, you can alternatively do `SET LANG=en_EN.UTF-8`. +3. Open in your browser, and voilà. + +Learn more about using Jekyll by reading its [documentation](http://jekyllrb.com/docs/home/). + +### Documentation for previous releases + +Documentation for v2.3.2 has been made available for the time being at while folks transition to Bootstrap 3. + +[Previous releases](https://github.com/twbs/bootstrap/releases) and their documentation are also available for download. + + + +## Compiling CSS and JavaScript + +Bootstrap uses [Grunt](http://gruntjs.com/) with convenient methods for working with the framework. It's how we compile our code, run tests, and more. To use it, install the required dependencies as directed and then run some Grunt commands. + +### Install Grunt + +From the command line: + +1. Install `grunt-cli` globally with `npm install -g grunt-cli`. +2. Navigate to the root `/bootstrap` directory, then run `npm install`. npm will look at [package.json](https://github.com/twbs/bootstrap/blob/master/package.json) and automatically install the necessary local dependencies listed there. + +When completed, you'll be able to run the various Grunt commands provided from the command line. + +**Unfamiliar with `npm`? Don't have node installed?** That's a-okay. npm stands for [node packaged modules](http://npmjs.org/) and is a way to manage development dependencies through node.js. [Download and install node.js](http://nodejs.org/download/) before proceeding. + +### Available Grunt commands + +#### Build - `grunt` +Run `grunt` to run tests locally and compile the CSS and JavaScript into `/dist`. **Uses [Less](http://lesscss.org/) and [UglifyJS](http://lisperator.net/uglifyjs/).** + +#### Only compile CSS and JavaScript - `grunt dist` +`grunt dist` creates the `/dist` directory with compiled files. **Uses [Less](http://lesscss.org/) and [UglifyJS](http://lisperator.net/uglifyjs/).** + +#### Tests - `grunt test` +Runs [JSHint](http://jshint.com) and [QUnit](http://qunitjs.com/) tests headlessly in [PhantomJS](http://phantomjs.org/) (used for CI). + +#### Watch - `grunt watch` +This is a convenience method for watching just Less files and automatically building them whenever you save. + +### Troubleshooting dependencies + +Should you encounter problems with installing dependencies or running Grunt commands, uninstall all previous dependency versions (global and local). Then, rerun `npm install`. + + + +## Contributing + +Please read through our [contributing guidelines](https://github.com/twbs/bootstrap/blob/master/CONTRIBUTING.md). Included are directions for opening issues, coding standards, and notes on development. + +Moreover, if your pull request contains JavaScript patches or features, you must include relevant unit tests. All HTML and CSS should conform to the [Code Guide](http://github.com/mdo/code-guide), maintained by [Mark Otto](http://github.com/mdo). + +Editor preferences are available in the [editor config](https://github.com/twbs/bootstrap/blob/master/.editorconfig) for easy use in common text editors. Read more and download plugins at . + + + +## Community + +Keep track of development and community news. + +- Follow [@twbootstrap on Twitter](http://twitter.com/twbootstrap). +- Read and subscribe to [The Official Bootstrap Blog](http://blog.getbootstrap.com). +- Chat with fellow Bootstrappers in IRC. On the `irc.freenode.net` server, in the `##twitter-bootstrap` channel. +- Implementation help may be found at Stack Overflow (tagged [`twitter-bootstrap-3`](http://stackoverflow.com/questions/tagged/twitter-bootstrap-3)). + + + + +## Versioning + +For transparency into our release cycle and in striving to maintain backward compatibility, Bootstrap is maintained under the Semantic Versioning guidelines. Sometimes we screw up, but we'll adhere to these rules whenever possible. + +Releases will be numbered with the following format: + +`..` + +And constructed with the following guidelines: + +- Breaking backward compatibility **bumps the major** while resetting minor and patch +- New additions without breaking backward compatibility **bumps the minor** while resetting the patch +- Bug fixes and misc changes **bumps only the patch** + +For more information on SemVer, please visit . + + + +## Authors + +**Mark Otto** + +- +- + +**Jacob Thornton** + +- +- + + + +## Copyright and license + +Code and documentation copyright 2011-2014 Twitter, Inc. Code released under [the MIT license](LICENSE). Docs released under [Creative Commons](docs/LICENSE). diff --git a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/bower.json b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/bower.json new file mode 100644 index 0000000..1961cf2 --- /dev/null +++ b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/bower.json @@ -0,0 +1,24 @@ +{ + "name": "bootstrap", + "version": "3.1.1", + "main": [ + "./dist/css/bootstrap.css", + "./dist/js/bootstrap.js", + "./dist/fonts/glyphicons-halflings-regular.eot", + "./dist/fonts/glyphicons-halflings-regular.svg", + "./dist/fonts/glyphicons-halflings-regular.ttf", + "./dist/fonts/glyphicons-halflings-regular.woff" + ], + "ignore": [ + "**/.*", + "_config.yml", + "CNAME", + "composer.json", + "CONTRIBUTING.md", + "docs", + "js/tests" + ], + "dependencies": { + "jquery": ">= 1.9.0" + } +} diff --git a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/fonts/glyphicons-halflings-regular.eot b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/fonts/glyphicons-halflings-regular.eot new file mode 100644 index 0000000..4a4ca86 Binary files /dev/null and b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/fonts/glyphicons-halflings-regular.eot differ diff --git a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap3/fonts/glyphicons-halflings-regular.svg b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/fonts/glyphicons-halflings-regular.svg similarity index 81% rename from {{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap3/fonts/glyphicons-halflings-regular.svg rename to {{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/fonts/glyphicons-halflings-regular.svg index 4469488..e3e2dc7 100644 --- a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap3/fonts/glyphicons-halflings-regular.svg +++ b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/fonts/glyphicons-halflings-regular.svg @@ -28,12 +28,12 @@ - + + - - + @@ -46,7 +46,7 @@ - + @@ -58,7 +58,7 @@ - + @@ -71,14 +71,14 @@ - - + + - + @@ -93,10 +93,10 @@ - + - + @@ -110,13 +110,13 @@ - - - + + + - - - + + + @@ -127,14 +127,14 @@ - - + + - - + + @@ -148,33 +148,33 @@ - - + + - - + + - - - - - - - - + + + + + + + + - - - - + + + + - - + + @@ -187,15 +187,15 @@ - + - - + + @@ -204,11 +204,11 @@ - + - - + + @@ -221,9 +221,9 @@ - - + + - + \ No newline at end of file diff --git a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap3/fonts/glyphicons-halflings-regular.ttf b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/fonts/glyphicons-halflings-regular.ttf similarity index 68% rename from {{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap3/fonts/glyphicons-halflings-regular.ttf rename to {{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/fonts/glyphicons-halflings-regular.ttf index a498ef4..67fa00b 100644 Binary files a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap3/fonts/glyphicons-halflings-regular.ttf and b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/fonts/glyphicons-halflings-regular.ttf differ diff --git a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/fonts/glyphicons-halflings-regular.woff b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/fonts/glyphicons-halflings-regular.woff new file mode 100644 index 0000000..8c54182 Binary files /dev/null and b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/fonts/glyphicons-halflings-regular.woff differ diff --git a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/grunt/bs-glyphicons-data-generator.js b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/grunt/bs-glyphicons-data-generator.js new file mode 100644 index 0000000..16a0ca2 --- /dev/null +++ b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/grunt/bs-glyphicons-data-generator.js @@ -0,0 +1,34 @@ +/*! + * Bootstrap Grunt task for Glyphicons data generation + * http://getbootstrap.com + * Copyright 2014 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + */ +'use strict'; +var fs = require('fs'); + +module.exports = function generateGlyphiconsData() { + // Pass encoding, utf8, so `readFileSync` will return a string instead of a + // buffer + var glyphiconsFile = fs.readFileSync('less/glyphicons.less', 'utf8'); + var glpyhiconsLines = glyphiconsFile.split('\n'); + + // Use any line that starts with ".glyphicon-" and capture the class name + var iconClassName = /^\.(glyphicon-[^\s]+)/; + var glyphiconsData = '# This file is generated via Grunt task. **Do not edit directly.**\n' + + '# See the \'build-glyphicons-data\' task in Gruntfile.js.\n\n'; + for (var i = 0, len = glpyhiconsLines.length; i < len; i++) { + var match = glpyhiconsLines[i].match(iconClassName); + + if (match !== null) { + glyphiconsData += '- ' + match[1] + '\n'; + } + } + + // Create the `_data` directory if it doesn't already exist + if (!fs.existsSync('docs/_data')) { + fs.mkdirSync('docs/_data'); + } + + fs.writeFileSync('docs/_data/glyphicons.yml', glyphiconsData); +}; diff --git a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/grunt/bs-lessdoc-parser.js b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/grunt/bs-lessdoc-parser.js new file mode 100644 index 0000000..5a86f13 --- /dev/null +++ b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/grunt/bs-lessdoc-parser.js @@ -0,0 +1,236 @@ +/*! + * Bootstrap Grunt task for parsing Less docstrings + * http://getbootstrap.com + * Copyright 2014 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + */ +'use strict'; + +var markdown = require('markdown').markdown; + +function markdown2html(markdownString) { + // the slice removes the

...

wrapper output by Markdown processor + return markdown.toHTML(markdownString.trim()).slice(3, -4); +} + + +/* +Mini-language: + //== This is a normal heading, which starts a section. Sections group variables together. + //## Optional description for the heading + + //=== This is a subheading. + + //** Optional description for the following variable. You **can** use Markdown in descriptions to discuss `` stuff. + @foo: #ffff; + + //-- This is a heading for a section whose variables shouldn't be customizable + + All other lines are ignored completely. +*/ + + +var CUSTOMIZABLE_HEADING = /^[/]{2}={2}(.*)$/; +var UNCUSTOMIZABLE_HEADING = /^[/]{2}-{2}(.*)$/; +var SUBSECTION_HEADING = /^[/]{2}={3}(.*)$/; +var SECTION_DOCSTRING = /^[/]{2}#{2}(.*)$/; +var VAR_ASSIGNMENT = /^(@[a-zA-Z0-9_-]+):[ ]*([^ ;][^;]+);[ ]*$/; +var VAR_DOCSTRING = /^[/]{2}[*]{2}(.*)$/; + +function Section(heading, customizable) { + this.heading = heading.trim(); + this.id = this.heading.replace(/\s+/g, '-').toLowerCase(); + this.customizable = customizable; + this.docstring = null; + this.subsections = []; +} + +Section.prototype.addSubSection = function (subsection) { + this.subsections.push(subsection); +}; + +function SubSection(heading) { + this.heading = heading.trim(); + this.id = this.heading.replace(/\s+/g, '-').toLowerCase(); + this.variables = []; +} + +SubSection.prototype.addVar = function (variable) { + this.variables.push(variable); +}; + +function VarDocstring(markdownString) { + this.html = markdown2html(markdownString); +} + +function SectionDocstring(markdownString) { + this.html = markdown2html(markdownString); +} + +function Variable(name, defaultValue) { + this.name = name; + this.defaultValue = defaultValue; + this.docstring = null; +} + +function Tokenizer(fileContent) { + this._lines = fileContent.split('\n'); + this._next = undefined; +} + +Tokenizer.prototype.unshift = function (token) { + if (this._next !== undefined) { + throw new Error('Attempted to unshift twice!'); + } + this._next = token; +}; + +Tokenizer.prototype._shift = function () { + // returning null signals EOF + // returning undefined means the line was ignored + if (this._next !== undefined) { + var result = this._next; + this._next = undefined; + return result; + } + if (this._lines.length <= 0) { + return null; + } + var line = this._lines.shift(); + var match = null; + match = SUBSECTION_HEADING.exec(line); + if (match !== null) { + return new SubSection(match[1]); + } + match = CUSTOMIZABLE_HEADING.exec(line); + if (match !== null) { + return new Section(match[1], true); + } + match = UNCUSTOMIZABLE_HEADING.exec(line); + if (match !== null) { + return new Section(match[1], false); + } + match = SECTION_DOCSTRING.exec(line); + if (match !== null) { + return new SectionDocstring(match[1]); + } + match = VAR_DOCSTRING.exec(line); + if (match !== null) { + return new VarDocstring(match[1]); + } + var commentStart = line.lastIndexOf('//'); + var varLine = (commentStart === -1) ? line : line.slice(0, commentStart); + match = VAR_ASSIGNMENT.exec(varLine); + if (match !== null) { + return new Variable(match[1], match[2]); + } + return undefined; +}; + +Tokenizer.prototype.shift = function () { + while (true) { + var result = this._shift(); + if (result === undefined) { + continue; + } + return result; + } +}; + +function Parser(fileContent) { + this._tokenizer = new Tokenizer(fileContent); +} + +Parser.prototype.parseFile = function () { + var sections = []; + while (true) { + var section = this.parseSection(); + if (section === null) { + if (this._tokenizer.shift() !== null) { + throw new Error('Unexpected unparsed section of file remains!'); + } + return sections; + } + sections.push(section); + } +}; + +Parser.prototype.parseSection = function () { + var section = this._tokenizer.shift(); + if (section === null) { + return null; + } + if (!(section instanceof Section)) { + throw new Error('Expected section heading; got: ' + JSON.stringify(section)); + } + var docstring = this._tokenizer.shift(); + if (docstring instanceof SectionDocstring) { + section.docstring = docstring; + } + else { + this._tokenizer.unshift(docstring); + } + this.parseSubSections(section); + + return section; +}; + +Parser.prototype.parseSubSections = function (section) { + while (true) { + var subsection = this.parseSubSection(); + if (subsection === null) { + if (section.subsections.length === 0) { + // Presume an implicit initial subsection + subsection = new SubSection(''); + this.parseVars(subsection); + } + else { + break; + } + } + section.addSubSection(subsection); + } + + if (section.subsections.length === 1 && !(section.subsections[0].heading) && section.subsections[0].variables.length === 0) { + // Ignore lone empty implicit subsection + section.subsections = []; + } +}; + +Parser.prototype.parseSubSection = function () { + var subsection = this._tokenizer.shift(); + if (subsection instanceof SubSection) { + this.parseVars(subsection); + return subsection; + } + this._tokenizer.unshift(subsection); + return null; +}; + +Parser.prototype.parseVars = function (subsection) { + while (true) { + var variable = this.parseVar(); + if (variable === null) { + return; + } + subsection.addVar(variable); + } +}; + +Parser.prototype.parseVar = function () { + var docstring = this._tokenizer.shift(); + if (!(docstring instanceof VarDocstring)) { + this._tokenizer.unshift(docstring); + docstring = null; + } + var variable = this._tokenizer.shift(); + if (variable instanceof Variable) { + variable.docstring = docstring; + return variable; + } + this._tokenizer.unshift(variable); + return null; +}; + + +module.exports = Parser; diff --git a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/grunt/bs-raw-files-generator.js b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/grunt/bs-raw-files-generator.js new file mode 100644 index 0000000..b5b3309 --- /dev/null +++ b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/grunt/bs-raw-files-generator.js @@ -0,0 +1,31 @@ +/* global btoa: true */ +/*! + * Bootstrap Grunt task for generating raw-files.min.js for the Customizer + * http://getbootstrap.com + * Copyright 2014 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + */ +'use strict'; +var btoa = require('btoa'); +var fs = require('fs'); + +function getFiles(type) { + var files = {}; + fs.readdirSync(type) + .filter(function (path) { + return type === 'fonts' ? true : new RegExp('\\.' + type + '$').test(path); + }) + .forEach(function (path) { + var fullPath = type + '/' + path; + files[path] = (type === 'fonts' ? btoa(fs.readFileSync(fullPath)) : fs.readFileSync(fullPath, 'utf8')); + }); + return 'var __' + type + ' = ' + JSON.stringify(files) + '\n'; +} + +module.exports = function generateRawFilesJs(banner) { + if (!banner) { + banner = ''; + } + var files = banner + getFiles('js') + getFiles('less') + getFiles('fonts'); + fs.writeFileSync('docs/assets/js/raw-files.min.js', files); +}; diff --git a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/grunt/shrinkwrap.js b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/grunt/shrinkwrap.js new file mode 100644 index 0000000..d3292b4 --- /dev/null +++ b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/grunt/shrinkwrap.js @@ -0,0 +1,28 @@ +/*! + * Bootstrap Grunt task for generating npm-shrinkwrap.canonical.json + * http://getbootstrap.com + * Copyright 2014 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + */ +/* +This Grunt task updates the npm-shrinkwrap.canonical.json file that's used as the key for Bootstrap's npm packages cache. +This task should be run and the updated file should be committed whenever Bootstrap's dependencies change. +*/ +'use strict'; +var canonicallyJsonStringify = require('canonical-json'); +var NON_CANONICAL_FILE = 'npm-shrinkwrap.json'; +var DEST_FILE = 'test-infra/npm-shrinkwrap.canonical.json'; + + +function updateShrinkwrap(grunt) { + // Assumption: Non-canonical shrinkwrap already generated by prerequisite Grunt task + var shrinkwrapData = grunt.file.readJSON(NON_CANONICAL_FILE); + grunt.log.writeln('Deleting ' + NON_CANONICAL_FILE.cyan + '...'); + grunt.file.delete(NON_CANONICAL_FILE); + // Output as Canonical JSON in correct location + grunt.file.write(DEST_FILE, canonicallyJsonStringify(shrinkwrapData)); + grunt.log.writeln('File ' + DEST_FILE.cyan + ' updated.'); +} + + +module.exports = updateShrinkwrap; diff --git a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/js/affix.js b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/js/affix.js new file mode 100644 index 0000000..05c909e --- /dev/null +++ b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/js/affix.js @@ -0,0 +1,137 @@ +/* ======================================================================== + * Bootstrap: affix.js v3.1.1 + * http://getbootstrap.com/javascript/#affix + * ======================================================================== + * Copyright 2011-2014 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // AFFIX CLASS DEFINITION + // ====================== + + var Affix = function (element, options) { + this.options = $.extend({}, Affix.DEFAULTS, options) + this.$window = $(window) + .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this)) + .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this)) + + this.$element = $(element) + this.affixed = + this.unpin = + this.pinnedOffset = null + + this.checkPosition() + } + + Affix.RESET = 'affix affix-top affix-bottom' + + Affix.DEFAULTS = { + offset: 0 + } + + Affix.prototype.getPinnedOffset = function () { + if (this.pinnedOffset) return this.pinnedOffset + this.$element.removeClass(Affix.RESET).addClass('affix') + var scrollTop = this.$window.scrollTop() + var position = this.$element.offset() + return (this.pinnedOffset = position.top - scrollTop) + } + + Affix.prototype.checkPositionWithEventLoop = function () { + setTimeout($.proxy(this.checkPosition, this), 1) + } + + Affix.prototype.checkPosition = function () { + if (!this.$element.is(':visible')) return + + var scrollHeight = $(document).height() + var scrollTop = this.$window.scrollTop() + var position = this.$element.offset() + var offset = this.options.offset + var offsetTop = offset.top + var offsetBottom = offset.bottom + + if (this.affixed == 'top') position.top += scrollTop + + if (typeof offset != 'object') offsetBottom = offsetTop = offset + if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element) + if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element) + + var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false : + offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' : + offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false + + if (this.affixed === affix) return + if (this.unpin) this.$element.css('top', '') + + var affixType = 'affix' + (affix ? '-' + affix : '') + var e = $.Event(affixType + '.bs.affix') + + this.$element.trigger(e) + + if (e.isDefaultPrevented()) return + + this.affixed = affix + this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null + + this.$element + .removeClass(Affix.RESET) + .addClass(affixType) + .trigger($.Event(affixType.replace('affix', 'affixed'))) + + if (affix == 'bottom') { + this.$element.offset({ top: scrollHeight - offsetBottom - this.$element.height() }) + } + } + + + // AFFIX PLUGIN DEFINITION + // ======================= + + var old = $.fn.affix + + $.fn.affix = function (option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.affix') + var options = typeof option == 'object' && option + + if (!data) $this.data('bs.affix', (data = new Affix(this, options))) + if (typeof option == 'string') data[option]() + }) + } + + $.fn.affix.Constructor = Affix + + + // AFFIX NO CONFLICT + // ================= + + $.fn.affix.noConflict = function () { + $.fn.affix = old + return this + } + + + // AFFIX DATA-API + // ============== + + $(window).on('load', function () { + $('[data-spy="affix"]').each(function () { + var $spy = $(this) + var data = $spy.data() + + data.offset = data.offset || {} + + if (data.offsetBottom) data.offset.bottom = data.offsetBottom + if (data.offsetTop) data.offset.top = data.offsetTop + + $spy.affix(data) + }) + }) + +}(jQuery); diff --git a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/js/alert.js b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/js/alert.js new file mode 100644 index 0000000..516fe4f --- /dev/null +++ b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/js/alert.js @@ -0,0 +1,88 @@ +/* ======================================================================== + * Bootstrap: alert.js v3.1.1 + * http://getbootstrap.com/javascript/#alerts + * ======================================================================== + * Copyright 2011-2014 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // ALERT CLASS DEFINITION + // ====================== + + var dismiss = '[data-dismiss="alert"]' + var Alert = function (el) { + $(el).on('click', dismiss, this.close) + } + + Alert.prototype.close = function (e) { + var $this = $(this) + var selector = $this.attr('data-target') + + if (!selector) { + selector = $this.attr('href') + selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 + } + + var $parent = $(selector) + + if (e) e.preventDefault() + + if (!$parent.length) { + $parent = $this.hasClass('alert') ? $this : $this.parent() + } + + $parent.trigger(e = $.Event('close.bs.alert')) + + if (e.isDefaultPrevented()) return + + $parent.removeClass('in') + + function removeElement() { + $parent.trigger('closed.bs.alert').remove() + } + + $.support.transition && $parent.hasClass('fade') ? + $parent + .one($.support.transition.end, removeElement) + .emulateTransitionEnd(150) : + removeElement() + } + + + // ALERT PLUGIN DEFINITION + // ======================= + + var old = $.fn.alert + + $.fn.alert = function (option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.alert') + + if (!data) $this.data('bs.alert', (data = new Alert(this))) + if (typeof option == 'string') data[option].call($this) + }) + } + + $.fn.alert.Constructor = Alert + + + // ALERT NO CONFLICT + // ================= + + $.fn.alert.noConflict = function () { + $.fn.alert = old + return this + } + + + // ALERT DATA-API + // ============== + + $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) + +}(jQuery); diff --git a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/js/button.js b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/js/button.js new file mode 100644 index 0000000..f4d8d8b --- /dev/null +++ b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/js/button.js @@ -0,0 +1,107 @@ +/* ======================================================================== + * Bootstrap: button.js v3.1.1 + * http://getbootstrap.com/javascript/#buttons + * ======================================================================== + * Copyright 2011-2014 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // BUTTON PUBLIC CLASS DEFINITION + // ============================== + + var Button = function (element, options) { + this.$element = $(element) + this.options = $.extend({}, Button.DEFAULTS, options) + this.isLoading = false + } + + Button.DEFAULTS = { + loadingText: 'loading...' + } + + Button.prototype.setState = function (state) { + var d = 'disabled' + var $el = this.$element + var val = $el.is('input') ? 'val' : 'html' + var data = $el.data() + + state = state + 'Text' + + if (!data.resetText) $el.data('resetText', $el[val]()) + + $el[val](data[state] || this.options[state]) + + // push to event loop to allow forms to submit + setTimeout($.proxy(function () { + if (state == 'loadingText') { + this.isLoading = true + $el.addClass(d).attr(d, d) + } else if (this.isLoading) { + this.isLoading = false + $el.removeClass(d).removeAttr(d) + } + }, this), 0) + } + + Button.prototype.toggle = function () { + var changed = true + var $parent = this.$element.closest('[data-toggle="buttons"]') + + if ($parent.length) { + var $input = this.$element.find('input') + if ($input.prop('type') == 'radio') { + if ($input.prop('checked') && this.$element.hasClass('active')) changed = false + else $parent.find('.active').removeClass('active') + } + if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change') + } + + if (changed) this.$element.toggleClass('active') + } + + + // BUTTON PLUGIN DEFINITION + // ======================== + + var old = $.fn.button + + $.fn.button = function (option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.button') + var options = typeof option == 'object' && option + + if (!data) $this.data('bs.button', (data = new Button(this, options))) + + if (option == 'toggle') data.toggle() + else if (option) data.setState(option) + }) + } + + $.fn.button.Constructor = Button + + + // BUTTON NO CONFLICT + // ================== + + $.fn.button.noConflict = function () { + $.fn.button = old + return this + } + + + // BUTTON DATA-API + // =============== + + $(document).on('click.bs.button.data-api', '[data-toggle^=button]', function (e) { + var $btn = $(e.target) + if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') + $btn.button('toggle') + e.preventDefault() + }) + +}(jQuery); diff --git a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/js/carousel.js b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/js/carousel.js new file mode 100644 index 0000000..19e9af1 --- /dev/null +++ b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/js/carousel.js @@ -0,0 +1,205 @@ +/* ======================================================================== + * Bootstrap: carousel.js v3.1.1 + * http://getbootstrap.com/javascript/#carousel + * ======================================================================== + * Copyright 2011-2014 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // CAROUSEL CLASS DEFINITION + // ========================= + + var Carousel = function (element, options) { + this.$element = $(element) + this.$indicators = this.$element.find('.carousel-indicators') + this.options = options + this.paused = + this.sliding = + this.interval = + this.$active = + this.$items = null + + this.options.pause == 'hover' && this.$element + .on('mouseenter', $.proxy(this.pause, this)) + .on('mouseleave', $.proxy(this.cycle, this)) + } + + Carousel.DEFAULTS = { + interval: 5000, + pause: 'hover', + wrap: true + } + + Carousel.prototype.cycle = function (e) { + e || (this.paused = false) + + this.interval && clearInterval(this.interval) + + this.options.interval + && !this.paused + && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) + + return this + } + + Carousel.prototype.getActiveIndex = function () { + this.$active = this.$element.find('.item.active') + this.$items = this.$active.parent().children() + + return this.$items.index(this.$active) + } + + Carousel.prototype.to = function (pos) { + var that = this + var activeIndex = this.getActiveIndex() + + if (pos > (this.$items.length - 1) || pos < 0) return + + if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) + if (activeIndex == pos) return this.pause().cycle() + + return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos])) + } + + Carousel.prototype.pause = function (e) { + e || (this.paused = true) + + if (this.$element.find('.next, .prev').length && $.support.transition) { + this.$element.trigger($.support.transition.end) + this.cycle(true) + } + + this.interval = clearInterval(this.interval) + + return this + } + + Carousel.prototype.next = function () { + if (this.sliding) return + return this.slide('next') + } + + Carousel.prototype.prev = function () { + if (this.sliding) return + return this.slide('prev') + } + + Carousel.prototype.slide = function (type, next) { + var $active = this.$element.find('.item.active') + var $next = next || $active[type]() + var isCycling = this.interval + var direction = type == 'next' ? 'left' : 'right' + var fallback = type == 'next' ? 'first' : 'last' + var that = this + + if (!$next.length) { + if (!this.options.wrap) return + $next = this.$element.find('.item')[fallback]() + } + + if ($next.hasClass('active')) return this.sliding = false + + var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction }) + this.$element.trigger(e) + if (e.isDefaultPrevented()) return + + this.sliding = true + + isCycling && this.pause() + + if (this.$indicators.length) { + this.$indicators.find('.active').removeClass('active') + this.$element.one('slid.bs.carousel', function () { + var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()]) + $nextIndicator && $nextIndicator.addClass('active') + }) + } + + if ($.support.transition && this.$element.hasClass('slide')) { + $next.addClass(type) + $next[0].offsetWidth // force reflow + $active.addClass(direction) + $next.addClass(direction) + $active + .one($.support.transition.end, function () { + $next.removeClass([type, direction].join(' ')).addClass('active') + $active.removeClass(['active', direction].join(' ')) + that.sliding = false + setTimeout(function () { that.$element.trigger('slid.bs.carousel') }, 0) + }) + .emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000) + } else { + $active.removeClass('active') + $next.addClass('active') + this.sliding = false + this.$element.trigger('slid.bs.carousel') + } + + isCycling && this.cycle() + + return this + } + + + // CAROUSEL PLUGIN DEFINITION + // ========================== + + var old = $.fn.carousel + + $.fn.carousel = function (option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.carousel') + var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option) + var action = typeof option == 'string' ? option : options.slide + + if (!data) $this.data('bs.carousel', (data = new Carousel(this, options))) + if (typeof option == 'number') data.to(option) + else if (action) data[action]() + else if (options.interval) data.pause().cycle() + }) + } + + $.fn.carousel.Constructor = Carousel + + + // CAROUSEL NO CONFLICT + // ==================== + + $.fn.carousel.noConflict = function () { + $.fn.carousel = old + return this + } + + + // CAROUSEL DATA-API + // ================= + + $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) { + var $this = $(this), href + var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 + var options = $.extend({}, $target.data(), $this.data()) + var slideIndex = $this.attr('data-slide-to') + if (slideIndex) options.interval = false + + $target.carousel(options) + + if (slideIndex = $this.attr('data-slide-to')) { + $target.data('bs.carousel').to(slideIndex) + } + + e.preventDefault() + }) + + $(window).on('load', function () { + $('[data-ride="carousel"]').each(function () { + var $carousel = $(this) + $carousel.carousel($carousel.data()) + }) + }) + +}(jQuery); diff --git a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/js/collapse.js b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/js/collapse.js new file mode 100644 index 0000000..7130282 --- /dev/null +++ b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/js/collapse.js @@ -0,0 +1,170 @@ +/* ======================================================================== + * Bootstrap: collapse.js v3.1.1 + * http://getbootstrap.com/javascript/#collapse + * ======================================================================== + * Copyright 2011-2014 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // COLLAPSE PUBLIC CLASS DEFINITION + // ================================ + + var Collapse = function (element, options) { + this.$element = $(element) + this.options = $.extend({}, Collapse.DEFAULTS, options) + this.transitioning = null + + if (this.options.parent) this.$parent = $(this.options.parent) + if (this.options.toggle) this.toggle() + } + + Collapse.DEFAULTS = { + toggle: true + } + + Collapse.prototype.dimension = function () { + var hasWidth = this.$element.hasClass('width') + return hasWidth ? 'width' : 'height' + } + + Collapse.prototype.show = function () { + if (this.transitioning || this.$element.hasClass('in')) return + + var startEvent = $.Event('show.bs.collapse') + this.$element.trigger(startEvent) + if (startEvent.isDefaultPrevented()) return + + var actives = this.$parent && this.$parent.find('> .panel > .in') + + if (actives && actives.length) { + var hasData = actives.data('bs.collapse') + if (hasData && hasData.transitioning) return + actives.collapse('hide') + hasData || actives.data('bs.collapse', null) + } + + var dimension = this.dimension() + + this.$element + .removeClass('collapse') + .addClass('collapsing') + [dimension](0) + + this.transitioning = 1 + + var complete = function () { + this.$element + .removeClass('collapsing') + .addClass('collapse in') + [dimension]('auto') + this.transitioning = 0 + this.$element.trigger('shown.bs.collapse') + } + + if (!$.support.transition) return complete.call(this) + + var scrollSize = $.camelCase(['scroll', dimension].join('-')) + + this.$element + .one($.support.transition.end, $.proxy(complete, this)) + .emulateTransitionEnd(350) + [dimension](this.$element[0][scrollSize]) + } + + Collapse.prototype.hide = function () { + if (this.transitioning || !this.$element.hasClass('in')) return + + var startEvent = $.Event('hide.bs.collapse') + this.$element.trigger(startEvent) + if (startEvent.isDefaultPrevented()) return + + var dimension = this.dimension() + + this.$element + [dimension](this.$element[dimension]()) + [0].offsetHeight + + this.$element + .addClass('collapsing') + .removeClass('collapse') + .removeClass('in') + + this.transitioning = 1 + + var complete = function () { + this.transitioning = 0 + this.$element + .trigger('hidden.bs.collapse') + .removeClass('collapsing') + .addClass('collapse') + } + + if (!$.support.transition) return complete.call(this) + + this.$element + [dimension](0) + .one($.support.transition.end, $.proxy(complete, this)) + .emulateTransitionEnd(350) + } + + Collapse.prototype.toggle = function () { + this[this.$element.hasClass('in') ? 'hide' : 'show']() + } + + + // COLLAPSE PLUGIN DEFINITION + // ========================== + + var old = $.fn.collapse + + $.fn.collapse = function (option) { + return this.each(function () { + var $this = $(this) + var data = $this.data('bs.collapse') + var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option) + + if (!data && options.toggle && option == 'show') option = !option + if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))) + if (typeof option == 'string') data[option]() + }) + } + + $.fn.collapse.Constructor = Collapse + + + // COLLAPSE NO CONFLICT + // ==================== + + $.fn.collapse.noConflict = function () { + $.fn.collapse = old + return this + } + + + // COLLAPSE DATA-API + // ================= + + $(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) { + var $this = $(this), href + var target = $this.attr('data-target') + || e.preventDefault() + || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 + var $target = $(target) + var data = $target.data('bs.collapse') + var option = data ? 'toggle' : $this.data() + var parent = $this.attr('data-parent') + var $parent = parent && $(parent) + + if (!data || !data.transitioning) { + if ($parent) $parent.find('[data-toggle=collapse][data-parent="' + parent + '"]').not($this).addClass('collapsed') + $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed') + } + + $target.collapse(option) + }) + +}(jQuery); diff --git a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/js/dropdown.js b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/js/dropdown.js new file mode 100644 index 0000000..43d7ae3 --- /dev/null +++ b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/static/libs/bootstrap/js/dropdown.js @@ -0,0 +1,147 @@ +/* ======================================================================== + * Bootstrap: dropdown.js v3.1.1 + * http://getbootstrap.com/javascript/#dropdowns + * ======================================================================== + * Copyright 2011-2014 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ + + ++function ($) { + 'use strict'; + + // DROPDOWN CLASS DEFINITION + // ========================= + + var backdrop = '.dropdown-backdrop' + var toggle = '[data-toggle=dropdown]' + var Dropdown = function (element) { + $(element).on('click.bs.dropdown', this.toggle) + } + + Dropdown.prototype.toggle = function (e) { + var $this = $(this) + + if ($this.is('.disabled, :disabled')) return + + var $parent = getParent($this) + var isActive = $parent.hasClass('open') + + clearMenus() + + if (!isActive) { + if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) { + // if mobile we use a backdrop because click events don't delegate + $('