From 85d985917063de32af277217af43736a2252ab5b Mon Sep 17 00:00:00 2001 From: Dan Nelson Date: Sun, 11 Nov 2018 22:06:52 -0700 Subject: [PATCH] #26 Upgrade Bootstrap & Font Awesome --- .gitignore | 5 + addon/mixins/autosize.js | 25 +- app/styles/app.scss | 2 + .../ember-cli-textarea-autosize/index.js | 4 +- bower.json | 2 - install_ember_addons.sh | 23 +- package.json | 18 +- tests/dummy/app/components/auto-focus.js | 6 - .../app/components/ctrl-enter-submits.js | 11 - .../dummy/app/components/focus-select-text.js | 6 - tests/dummy/app/components/max-height.js | 6 - tests/dummy/app/components/min-height.js | 6 - .../controllers/demo/ctrl-enter-submits.js | 15 + tests/dummy/app/router.js | 10 +- .../app/routes/demo-ctrl-enter-submits.js | 11 - .../{demo-focus-selects-text.js => demo.js} | 0 .../ctrl-enter-submits.js} | 0 .../{demo-min-height.js => demo/index.js} | 0 .../max-height.js} | 0 tests/dummy/app/routes/demo/min-height.js | 3 + tests/dummy/app/styles/app.scss | 13 +- tests/dummy/app/templates/application.hbs | 120 +- .../app/templates/components/auto-focus.hbs | 1 - .../components/ctrl-enter-submits.hbs | 47 - .../components/focus-select-text.hbs | 1 - .../app/templates/components/max-height.hbs | 19 - .../app/templates/components/min-height.hbs | 58 - .../app/templates/demo-ctrl-enter-submits.hbs | 16 - .../app/templates/demo-focus-selects-text.hbs | 5 - tests/dummy/app/templates/demo-max-height.hbs | 11 - tests/dummy/app/templates/demo-min-height.hbs | 11 - .../app/templates/demo-trigger-focus.hbs | 5 - tests/dummy/app/templates/demo.hbs | 23 + .../app/templates/demo/ctrl-enter-submits.hbs | 52 + tests/dummy/app/templates/demo/index.hbs | 44 + tests/dummy/app/templates/demo/max-height.hbs | 18 + tests/dummy/app/templates/demo/min-height.hbs | 47 + tests/dummy/app/templates/index.hbs | 76 +- tests/dummy/config/environment.js | 6 + yarn.lock | 3184 ++++++++++++++--- 40 files changed, 3007 insertions(+), 903 deletions(-) create mode 100644 app/styles/app.scss delete mode 100644 tests/dummy/app/components/auto-focus.js delete mode 100644 tests/dummy/app/components/ctrl-enter-submits.js delete mode 100644 tests/dummy/app/components/focus-select-text.js delete mode 100644 tests/dummy/app/components/max-height.js delete mode 100644 tests/dummy/app/components/min-height.js create mode 100644 tests/dummy/app/controllers/demo/ctrl-enter-submits.js delete mode 100644 tests/dummy/app/routes/demo-ctrl-enter-submits.js rename tests/dummy/app/routes/{demo-focus-selects-text.js => demo.js} (100%) rename tests/dummy/app/routes/{demo-max-height.js => demo/ctrl-enter-submits.js} (100%) rename tests/dummy/app/routes/{demo-min-height.js => demo/index.js} (100%) rename tests/dummy/app/routes/{demo-trigger-focus.js => demo/max-height.js} (100%) create mode 100644 tests/dummy/app/routes/demo/min-height.js delete mode 100644 tests/dummy/app/templates/components/auto-focus.hbs delete mode 100644 tests/dummy/app/templates/components/ctrl-enter-submits.hbs delete mode 100644 tests/dummy/app/templates/components/focus-select-text.hbs delete mode 100644 tests/dummy/app/templates/components/max-height.hbs delete mode 100644 tests/dummy/app/templates/components/min-height.hbs delete mode 100644 tests/dummy/app/templates/demo-ctrl-enter-submits.hbs delete mode 100644 tests/dummy/app/templates/demo-focus-selects-text.hbs delete mode 100644 tests/dummy/app/templates/demo-max-height.hbs delete mode 100644 tests/dummy/app/templates/demo-min-height.hbs delete mode 100644 tests/dummy/app/templates/demo-trigger-focus.hbs create mode 100644 tests/dummy/app/templates/demo.hbs create mode 100644 tests/dummy/app/templates/demo/ctrl-enter-submits.hbs create mode 100644 tests/dummy/app/templates/demo/index.hbs create mode 100644 tests/dummy/app/templates/demo/max-height.hbs create mode 100644 tests/dummy/app/templates/demo/min-height.hbs diff --git a/.gitignore b/.gitignore index 30a36fe..e8468a3 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,9 @@ testem.log .node_modules.ember-try/ bower.json.ember-try package.json.ember-try + +# npm package-lock.json can get stale because we use yarn; someone might commit a npm installed `package-lock.json` +package-lock.json + +# git time metric /.gtm/ diff --git a/addon/mixins/autosize.js b/addon/mixins/autosize.js index f2d0134..6d95695 100644 --- a/addon/mixins/autosize.js +++ b/addon/mixins/autosize.js @@ -1,7 +1,5 @@ /* global autosize */ import { isPresent } from '@ember/utils'; - -import { on } from '@ember/object/evented'; import Mixin from '@ember/object/mixin'; /** @@ -10,24 +8,25 @@ import Mixin from '@ember/object/mixin'; * @see http://www.jacklmoore.com/autosize/ */ export default Mixin.create({ - - /** - * Once this textarea is being destroyed let's help clean up the DOM by removing the autosize binding. - * @see http://www.jacklmoore.com/autosize/ - */ - _removeAutosize: on('willDestroyElement', function () { - autosize.destroy(this.element); - }), - /** * Once this textarea is inserted in the DOM initialize on autosize. * @see https://github.com/jackmoore/autosize */ - _initializeAutosize: on('didInsertElement', function () { + didInsertElement() { + this._super(...arguments); autosize(this.element); this._setCss('min-height'); this._setCss('max-height'); - }), + }, + + /** + * Once this textarea is being destroyed let's help clean up the DOM by removing the autosize binding. + * @see http://www.jacklmoore.com/autosize/ + */ + willDestroyElement() { + this._super(...arguments); + autosize.destroy(this.element); + }, /** * Set the jquery css property `propertyName` with the component property `propertyName`. diff --git a/app/styles/app.scss b/app/styles/app.scss new file mode 100644 index 0000000..4c1d677 --- /dev/null +++ b/app/styles/app.scss @@ -0,0 +1,2 @@ +//noinspection CssUnknownTarget +@import "ember-cli-bootstrap-4/bootstrap"; diff --git a/blueprints/ember-cli-textarea-autosize/index.js b/blueprints/ember-cli-textarea-autosize/index.js index 9d95462..1987274 100644 --- a/blueprints/ember-cli-textarea-autosize/index.js +++ b/blueprints/ember-cli-textarea-autosize/index.js @@ -7,11 +7,11 @@ module.exports = { afterInstall: function (/*options*/) { return this.addAddonsToProject({ packages: [ - { name: 'ember-cli-text-support-mixins', target: '~1' } + { name: 'ember-cli-text-support-mixins', target: '~2.0.2' } ] }).then(() => { return this.addPackagesToProject([ - { name: 'autosize' } + { name: 'autosize' } // always install the latest ... that's trust baby ]) }); } diff --git a/bower.json b/bower.json index 13f028e..58e8412 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,5 @@ { "name": "ember-cli-textarea-autosize", "devDependencies": { - "bootstrap-sass": "^3.3.7", - "font-awesome": "^4.7.0" } } diff --git a/install_ember_addons.sh b/install_ember_addons.sh index f7bcf98..10e4637 100755 --- a/install_ember_addons.sh +++ b/install_ember_addons.sh @@ -1,13 +1,26 @@ #!/bin/sh -ember install ember-cli-bootstrap3-sass +yarn add --dev clipboard + +ember install ct-emberjs-bling + +ember install @fortawesome/ember-fontawesome +yarn add @fortawesome/free-solid-svg-icons --dev +yarn add @fortawesome/free-brands-svg-icons --dev + +ember install ember-auto-import + +ember install ember-cli-app-version + +ember install ember-cli-bootstrap-4 + ember install ember-cli-deploy ember install ember-cli-deploy-build ember install ember-cli-deploy-gzip ember install ember-cli-deploy-s3 -ember install ember-cli-font-awesome-sass -ember install ember-cli-text-support-mixins@~1 +ember install ember-cli-deploy-slack + +ember install ember-cli-text-support-mixins@~2.0.0 -yarn add autosize@~4 --dev -yarn add bootswatch@3.3.7 --dev +yarn add autosize --dev yarn add ember-cli-node-assets # this must go into "dependencies" NOT "devDependencies" diff --git a/package.json b/package.json index bf4a6fc..59cc365 100644 --- a/package.json +++ b/package.json @@ -45,27 +45,36 @@ "ember-cli-node-assets": "^0.2.2" }, "devDependencies": { + "@fortawesome/ember-fontawesome": "^0.1.8", + "@fortawesome/free-brands-svg-icons": "^5.5.0", + "@fortawesome/free-solid-svg-icons": "^5.5.0", "autosize": "~4", + "bootstrap": "^4.1.0", "bootswatch": "3.3.7", "broccoli-asset-rev": "^2.4.5", + "clipboard": "^2.0.3", + "ct-emberjs-bling": "^0.0.1-rc.5", "ember-ajax": "^3.0.0", + "ember-auto-import": "^1.2.15", "ember-cli": "~2.18.2", - "ember-cli-bootstrap3-sass": "^1.0.6", + "ember-cli-app-version": "^3.2.0", + "ember-cli-bootstrap-4": "^0.7.0", "ember-cli-dependency-checker": "^2.0.0", "ember-cli-deploy": "^1.0.2", "ember-cli-deploy-build": "^1.1.1", "ember-cli-deploy-gzip": "^1.0.1", "ember-cli-deploy-s3": "^1.4.0", + "ember-cli-deploy-slack": "^1.0.1", + "ember-cli-element-closest-polyfill": "^0.0.1", "ember-cli-eslint": "^4.2.1", - "ember-cli-font-awesome-sass": "^1.0.4", "ember-cli-htmlbars": "^2.0.1", "ember-cli-htmlbars-inline-precompile": "^1.0.0", "ember-cli-inject-live-reload": "^1.4.1", "ember-cli-qunit": "^4.1.1", - "ember-cli-sass": "^8.0.1", + "ember-cli-sass": "^7.2.0", "ember-cli-shims": "^1.2.0", "ember-cli-sri": "^2.1.0", - "ember-cli-text-support-mixins": "^2.0.1", + "ember-cli-text-support-mixins": "^2.0.2-rc.1", "ember-cli-uglify": "^2.0.0", "ember-disable-prototype-extensions": "^1.1.2", "ember-export-application-global": "^2.0.0", @@ -77,6 +86,7 @@ "eslint-plugin-node": "^5.2.1", "keyevent": "^1.1.0", "loader.js": "^4.2.3", + "popper.js": "^1.14.0", "sass": "^1.14.3" }, "engines": { diff --git a/tests/dummy/app/components/auto-focus.js b/tests/dummy/app/components/auto-focus.js deleted file mode 100644 index 23dbe36..0000000 --- a/tests/dummy/app/components/auto-focus.js +++ /dev/null @@ -1,6 +0,0 @@ -import Component from '@ember/component'; -import layout from '../templates/components/auto-focus'; - -export default Component.extend({ - layout -}); diff --git a/tests/dummy/app/components/ctrl-enter-submits.js b/tests/dummy/app/components/ctrl-enter-submits.js deleted file mode 100644 index 64cbb9d..0000000 --- a/tests/dummy/app/components/ctrl-enter-submits.js +++ /dev/null @@ -1,11 +0,0 @@ -import Component from '@ember/component'; -import layout from '../templates/components/ctrl-enter-submits'; - -export default Component.extend({ - actions: { - submit() { - window.alert("The text-area's parent form had the submit event triggered with the Ctrl+Enter keystroke."); - } - }, - layout -}); diff --git a/tests/dummy/app/components/focus-select-text.js b/tests/dummy/app/components/focus-select-text.js deleted file mode 100644 index e2b676f..0000000 --- a/tests/dummy/app/components/focus-select-text.js +++ /dev/null @@ -1,6 +0,0 @@ -import Component from '@ember/component'; -import layout from '../templates/components/focus-select-text'; - -export default Component.extend({ - layout -}); diff --git a/tests/dummy/app/components/max-height.js b/tests/dummy/app/components/max-height.js deleted file mode 100644 index 83a6b31..0000000 --- a/tests/dummy/app/components/max-height.js +++ /dev/null @@ -1,6 +0,0 @@ -import Component from '@ember/component'; -import layout from '../templates/components/max-height'; - -export default Component.extend({ - layout -}); diff --git a/tests/dummy/app/components/min-height.js b/tests/dummy/app/components/min-height.js deleted file mode 100644 index 4e1bcea..0000000 --- a/tests/dummy/app/components/min-height.js +++ /dev/null @@ -1,6 +0,0 @@ -import Component from '@ember/component'; -import layout from '../templates/components/min-height'; - -export default Component.extend({ - layout -}); diff --git a/tests/dummy/app/controllers/demo/ctrl-enter-submits.js b/tests/dummy/app/controllers/demo/ctrl-enter-submits.js new file mode 100644 index 0000000..5410b49 --- /dev/null +++ b/tests/dummy/app/controllers/demo/ctrl-enter-submits.js @@ -0,0 +1,15 @@ +import Controller from '@ember/controller'; + +export default Controller.extend({ + actions: { + withSubmit(/*event*/) { + window.alert('
'); + return false; + }, + + withOnSubmit(/*event*/) { + window.alert(''); + return false; + } + } +}); diff --git a/tests/dummy/app/router.js b/tests/dummy/app/router.js index 6e9fa0d..388fd45 100644 --- a/tests/dummy/app/router.js +++ b/tests/dummy/app/router.js @@ -7,11 +7,11 @@ const Router = EmberRouter.extend({ }); Router.map(function() { - this.route('demo-focus-selects-text'); - this.route('demo-trigger-focus'); - this.route('demo-min-height'); - this.route('demo-max-height'); - this.route('demo-ctrl-enter-submits'); + this.route('demo', function () { + this.route('max-height'); + this.route('min-height'); + this.route('ctrl-enter-submits'); + }); }); export default Router; diff --git a/tests/dummy/app/routes/demo-ctrl-enter-submits.js b/tests/dummy/app/routes/demo-ctrl-enter-submits.js deleted file mode 100644 index d9e7d9f..0000000 --- a/tests/dummy/app/routes/demo-ctrl-enter-submits.js +++ /dev/null @@ -1,11 +0,0 @@ -import Route from '@ember/routing/route'; - -export default Route.extend({ - actions: { - submitForm() { - this.set('submitCount', this.get('submitCount') + 1); - this.get('controller').set('submitMessage', `Submit Count: ${this.get('submitCount')}`); - } - }, - submitCount: 0 -}); diff --git a/tests/dummy/app/routes/demo-focus-selects-text.js b/tests/dummy/app/routes/demo.js similarity index 100% rename from tests/dummy/app/routes/demo-focus-selects-text.js rename to tests/dummy/app/routes/demo.js diff --git a/tests/dummy/app/routes/demo-max-height.js b/tests/dummy/app/routes/demo/ctrl-enter-submits.js similarity index 100% rename from tests/dummy/app/routes/demo-max-height.js rename to tests/dummy/app/routes/demo/ctrl-enter-submits.js diff --git a/tests/dummy/app/routes/demo-min-height.js b/tests/dummy/app/routes/demo/index.js similarity index 100% rename from tests/dummy/app/routes/demo-min-height.js rename to tests/dummy/app/routes/demo/index.js diff --git a/tests/dummy/app/routes/demo-trigger-focus.js b/tests/dummy/app/routes/demo/max-height.js similarity index 100% rename from tests/dummy/app/routes/demo-trigger-focus.js rename to tests/dummy/app/routes/demo/max-height.js diff --git a/tests/dummy/app/routes/demo/min-height.js b/tests/dummy/app/routes/demo/min-height.js new file mode 100644 index 0000000..d09f667 --- /dev/null +++ b/tests/dummy/app/routes/demo/min-height.js @@ -0,0 +1,3 @@ +import Route from '@ember/routing/route'; + +export default Route.extend({}); diff --git a/tests/dummy/app/styles/app.scss b/tests/dummy/app/styles/app.scss index 33f9001..4c1d677 100644 --- a/tests/dummy/app/styles/app.scss +++ b/tests/dummy/app/styles/app.scss @@ -1,13 +1,2 @@ -@import "../../../../node_modules/bootswatch/spacelab/variables"; - -$icon-font-path: '/assets/bootstrap/'; // TODO: this should be removed once I fix the bootstrap3-sass addon //noinspection CssUnknownTarget -@import 'ember-cli-bootstrap3-sass'; -@import "../../../../node_modules/bootswatch/spacelab/bootswatch"; -//noinspection CssUnknownTarget -@import "ember-cli-font-awesome-sass"; - -body { - padding-top: 50px; // for the fixed navbar - margin-bottom: 50%; // to allow scrolling beyond the end of the last example -} +@import "ember-cli-bootstrap-4/bootstrap"; diff --git a/tests/dummy/app/templates/application.hbs b/tests/dummy/app/templates/application.hbs index 5eff63a..db32fe9 100644 --- a/tests/dummy/app/templates/application.hbs +++ b/tests/dummy/app/templates/application.hbs @@ -1,101 +1,31 @@ - + -
-