├── dist └── .gitkeep ├── .babelrc ├── .gitignore ├── .eslintrc ├── src ├── main.js ├── vuex │ ├── modules │ │ ├── menu.js │ │ └── orders.js │ └── store.js ├── components │ ├── menuitems │ │ ├── ItemA.vue │ │ ├── ItemB.vue │ │ └── ItemC.vue │ ├── SovMenu.vue │ ├── SovConsole.vue │ └── SovOrders.vue └── App.vue ├── README.md ├── karma.conf.js ├── index.html ├── LICENSE └── package.json /dist/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015", "stage-2"] 3 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | dist/build.js 4 | dist/build.css 5 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "standard", 3 | "plugins": [ 4 | "html" 5 | ], 6 | "env": { 7 | "jasmine": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | 4 | // Import the app's store 5 | import store from './vuex/store' 6 | 7 | new Vue({ // eslint-disable-line no-new 8 | el: '#app', 9 | render: (h) => h(App), 10 | store: store, 11 | components: { 12 | App 13 | } 14 | }) 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # short-order-vue 2 | 3 | > A simple Vue 2.0 demo 4 | 5 | ## Build Setup 6 | 7 | ``` bash 8 | # install dependencies 9 | npm install 10 | 11 | # serve with hot reload at localhost:8080 12 | npm run dev 13 | 14 | # build for production with minification 15 | npm run build 16 | 17 | # lint all *.js and *.vue files 18 | npm run lint 19 | 20 | # run unit tests 21 | npm test 22 | ``` 23 | 24 | For more information see the [docs for vueify](https://github.com/vuejs/vueify). 25 | -------------------------------------------------------------------------------- /src/vuex/modules/menu.js: -------------------------------------------------------------------------------- 1 | // Initial state 2 | const state = { 3 | items: [ 4 | { 5 | id: 1, 6 | title: 'Bowl of chocolate ice cream', 7 | type: 'ItemA' 8 | }, 9 | { 10 | id: 2, 11 | title: 'Salad', 12 | type: 'ItemB' 13 | }, 14 | { 15 | id: 3, 16 | title: 'Iced tea', 17 | type: 'ItemC' 18 | } 19 | ] 20 | } 21 | 22 | // Mutations 23 | const mutations = {} 24 | 25 | export default { 26 | state, 27 | mutations 28 | } 29 | -------------------------------------------------------------------------------- /src/components/menuitems/ItemA.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 22 | 23 | -------------------------------------------------------------------------------- /src/vuex/modules/orders.js: -------------------------------------------------------------------------------- 1 | // Initial state 2 | const state = { 3 | items: [] 4 | } 5 | 6 | // Mutations 7 | const mutations = { 8 | NEW_ORDER (state, type) { 9 | var id = 'order-' + parseInt(Math.random() * 100000) 10 | state.items.push({ 'type': type, 'id': id }) 11 | }, 12 | CLEAR_ORDER (state, id) { 13 | for (var i = state.items.length - 1; i >= 0; i--) { 14 | if (state.items[i].id === id) { 15 | state.items.splice(i, 1) 16 | } 17 | } 18 | } 19 | } 20 | 21 | export default { 22 | state, 23 | mutations 24 | } 25 | -------------------------------------------------------------------------------- /src/components/menuitems/ItemB.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 26 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | // https://github.com/Nikku/karma-browserify 2 | module.exports = function (config) { 3 | config.set({ 4 | browsers: ['PhantomJS'], 5 | frameworks: ['browserify', 'jasmine'], 6 | files: ['test/unit/**/*.js'], 7 | reporters: ['spec'], 8 | preprocessors: { 9 | 'test/unit/**/*.js': ['browserify'] 10 | }, 11 | browserify: { 12 | debug: true, 13 | // needed to enable mocks 14 | plugin: [require('proxyquireify').plugin] 15 | }, 16 | // if you want to continuously re-run tests on file-save, 17 | // replace the following line with `autoWatch: true` 18 | singleRun: true 19 | }) 20 | } 21 | -------------------------------------------------------------------------------- /src/vuex/store.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | 4 | // Modules 5 | import menu from './modules/menu' 6 | import orders from './modules/orders' 7 | 8 | const debug = process.env.NODE_ENV !== 'production' 9 | 10 | // Initialize 11 | Vue.use(Vuex) 12 | Vue.config.debug = debug 13 | 14 | // Build the store 15 | export default new Vuex.Store({ 16 | actions: { 17 | newOrder ({commit}, event) { 18 | commit('NEW_ORDER', event.target.dataset.type) 19 | }, 20 | orderUp ({commit}, id) { 21 | commit('CLEAR_ORDER', id) 22 | } 23 | }, 24 | 25 | modules: { 26 | menu, 27 | orders 28 | }, 29 | 30 | strict: debug 31 | 32 | }) 33 | -------------------------------------------------------------------------------- /src/components/SovMenu.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 30 | 31 | -------------------------------------------------------------------------------- /src/components/menuitems/ItemC.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 23 | 24 | -------------------------------------------------------------------------------- /src/components/SovConsole.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 23 | 24 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Short Order Vue 6 | 7 | 8 | 9 | 10 |
11 |
12 |
13 |

Short Order Vue

14 |

A simple demo app for Vue 2.0
Blog Post | GitHub Repo | Dist Zip | Diner Lingo

15 |
16 |
17 |
18 | 19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Benjamin Listwon 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 26 | 27 | 59 | -------------------------------------------------------------------------------- /src/components/SovOrders.vue: -------------------------------------------------------------------------------- 1 | 11 | 23 | 24 | 50 | 51 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "short-order-vue", 3 | "version": "0.0.1", 4 | "description": "A simple Vue 2.0 demo", 5 | "repository": { 6 | "type": "git", 7 | "url": "git+https://github.com/BenjaminListwon/short-order-vue.git" 8 | }, 9 | "keywords": [ 10 | "vue", 11 | "vuejs", 12 | "vuex", 13 | "javascript" 14 | ], 15 | "license": "MIT", 16 | "author": "Benjamin Listwon ", 17 | "scripts": { 18 | "watchify": "watchify -vd -p browserify-hmr -e src/main.js -o dist/build.js", 19 | "serve": "http-server -c 1 -a localhost", 20 | "dev": "npm-run-all --parallel watchify serve", 21 | "lint": "eslint --ext .js,.vue src", 22 | "build": "cross-env NODE_ENV=production browserify -g envify -p [ vueify/plugins/extract-css -o dist/build.css ] -e src/main.js | uglifyjs -c warnings=false -m > dist/build.js" 23 | }, 24 | "browserify": { 25 | "transform": [ 26 | "vueify", 27 | "babelify" 28 | ] 29 | }, 30 | "dependencies": { 31 | "vue": "^v2.0.0-rc.6", 32 | "vuex": "^v2.0.0-rc.5" 33 | }, 34 | "devDependencies": { 35 | "babel-core": "^6.0.0", 36 | "babel-plugin-transform-runtime": "^6.0.0", 37 | "babel-preset-es2015": "^6.0.0", 38 | "babel-preset-stage-2": "^6.0.0", 39 | "babel-runtime": "^6.0.0", 40 | "babelify": "^7.2.0", 41 | "browserify": "^13.1.0", 42 | "browserify-hmr": "^0.3.1", 43 | "cross-env": "^2.0.0", 44 | "envify": "^3.4.1", 45 | "eslint": "^3.3.0", 46 | "eslint-config-standard": "^5.3.5", 47 | "eslint-plugin-html": "^1.5.2", 48 | "eslint-plugin-promise": "^2.0.1", 49 | "eslint-plugin-standard": "^2.0.0", 50 | "http-server": "^0.9.0", 51 | "npm-run-all": "^2.3.0", 52 | "proxyquireify": "^3.0.1", 53 | "uglify-js": "^2.5.0", 54 | "vueify": "^9.0.0", 55 | "watchify": "^3.4.0" 56 | } 57 | } 58 | --------------------------------------------------------------------------------