From d2f31793729f34ba507776e339eff5a7551859b1 Mon Sep 17 00:00:00 2001 From: Jakub Elzbieciak Date: Wed, 25 Sep 2013 19:17:20 +0200 Subject: [PATCH] 9th thing - bootstrap --- 09-bootstrap/app/app.js | 20 ++++++++++++++++++++ 09-bootstrap/app/main.js | 20 ++++++++++++++++++++ 09-bootstrap/bower.json | 21 +++++++++++++++++++++ 09-bootstrap/index.html | 37 +++++++++++++++++++++++++++++++++++++ README.md | 4 ++-- 5 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 09-bootstrap/app/app.js create mode 100644 09-bootstrap/app/main.js create mode 100644 09-bootstrap/bower.json create mode 100644 09-bootstrap/index.html diff --git a/09-bootstrap/app/app.js b/09-bootstrap/app/app.js new file mode 100644 index 0000000..6db9f81 --- /dev/null +++ b/09-bootstrap/app/app.js @@ -0,0 +1,20 @@ +define([ + 'bootstrap/modal', 'bootstrap/tooltip', 'bootstrap/transition' +], function () { + return { + start: function () { + $('#with-tooltip').tooltip({ + placement: 'right', + title: 'Hello from tooltip!' + }); + + $('#show-modal').on('click', function () { + $('#modal').modal('show'); + }); + + $('#modal .btn-primary').on('click', function () { + $('#modal').modal('hide'); + }) + } + }; +}); diff --git a/09-bootstrap/app/main.js b/09-bootstrap/app/main.js new file mode 100644 index 0000000..ee3f9ac --- /dev/null +++ b/09-bootstrap/app/main.js @@ -0,0 +1,20 @@ +require.config({ + paths: { + jquery: '../bower_components/jquery/jquery' + }, + packages: [ + 'bootstrap', { + name: 'bootstrap', + location: '../bower_components/bootstrap/js' + } + ], + shim: { + bootstrap: ['jquery'] + } +}); + +require(['jquery', 'app'], function ($, app) { + $(function () { + app.start(); + }); +}); diff --git a/09-bootstrap/bower.json b/09-bootstrap/bower.json new file mode 100644 index 0000000..c4d7e37 --- /dev/null +++ b/09-bootstrap/bower.json @@ -0,0 +1,21 @@ +{ + "name": "09 Bootstrap", + "version": "0.0.1", + "homepage": "https://github.com/jelz/10-things-about-amd", + "authors": [ + "Jakub Elzbieciak " + ], + "license": "MIT", + "private": true, + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ], + "dependencies": { + "requirejs": "~2.1.8", + "bootstrap": "~3.0.0" + } +} diff --git a/09-bootstrap/index.html b/09-bootstrap/index.html new file mode 100644 index 0000000..98a2750 --- /dev/null +++ b/09-bootstrap/index.html @@ -0,0 +1,37 @@ + + + + + 09 Bootstrap + + + +
+

09 Bootstrap

+ + +
+ + + + + + + diff --git a/README.md b/README.md index 4cf16d6..60b3721 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ 5. __text!__ - don't store all your templates in one template überfile (applies to any other text resource, too) 6. __i18n!__ - localize JS apps right way 7. __jQuery__ - use jQuery in an AMD manner -8. __Bootstrap__ - customize your libraries with no effort (applies to many other libs, too) (todo) -9. __Packages__ - find best place for every piece of code (todo) +8. __Packages__ - find the best place for every piece of code (todo) +9. __Bootstrap__ - customize your libraries with no effort (applies to many other libs, too) 10. __browserify__ - know alternative (todo) As you can see: work is in progress :)