From 4ea92fc34b96efae151a9e479c67c45f0ef17ef4 Mon Sep 17 00:00:00 2001 From: "ryan.zhuang" Date: Mon, 12 Sep 2016 14:25:56 +0800 Subject: [PATCH 1/2] first sucess --- .eslintrc.js | 29 + .idea/eslintPlugin.xml | 9 + .idea/inspectionProfiles/Project_Default.xml | 6 + .../inspectionProfiles/profiles_settings.xml | 7 + .idea/jsLibraryMappings.xml | 6 + .idea/misc.xml | 6 + .idea/modules.xml | 8 + .idea/vcs.xml | 6 + .idea/vue-table.iml | 8 + .idea/workspace.xml | 895 ++++++++++++++++++ index.html | 20 + main.js | 9 + package.json | 37 +- src/components/App.vue | 21 + src/components/AppTable.vue | 294 ++++++ src/components/CustomAction.vue | 36 + src/components/Editor.vue | 24 + src/components/MyNav.vue | 38 + src/components/NotesList.vue | 70 ++ src/components/Toolbar.vue | 26 + src/components/VuetableSearchToolBar.vue | 104 ++ src/components/VuetableSettingsModal.vue | 69 ++ styles.css | 89 ++ vuex/actions.js | 19 + vuex/store.js | 44 + webpack.config.js | 24 + 26 files changed, 1896 insertions(+), 8 deletions(-) create mode 100644 .eslintrc.js create mode 100644 .idea/eslintPlugin.xml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/jsLibraryMappings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 .idea/vue-table.iml create mode 100644 .idea/workspace.xml create mode 100644 index.html create mode 100644 main.js create mode 100644 src/components/App.vue create mode 100644 src/components/AppTable.vue create mode 100644 src/components/CustomAction.vue create mode 100644 src/components/Editor.vue create mode 100644 src/components/MyNav.vue create mode 100644 src/components/NotesList.vue create mode 100644 src/components/Toolbar.vue create mode 100644 src/components/VuetableSearchToolBar.vue create mode 100644 src/components/VuetableSettingsModal.vue create mode 100755 styles.css create mode 100644 vuex/actions.js create mode 100644 vuex/store.js create mode 100644 webpack.config.js diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..e76d484 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,29 @@ +module.exports = { + "env": { + "browser": true, + "commonjs": true, + "es6": true + }, + "extends": "eslint:recommended", + "parserOptions": { + "sourceType": "module" + }, + "rules": { + "indent": [ + "error", + "space" + ], + "linebreak-style": [ + "error", + "unix" + ], + "quotes": [ + "error", + "double" + ], + "semi": [ + "error", + "never" + ] + } +}; \ No newline at end of file diff --git a/.idea/eslintPlugin.xml b/.idea/eslintPlugin.xml new file mode 100644 index 0000000..0846c46 --- /dev/null +++ b/.idea/eslintPlugin.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..c6cc8c8 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..3b31283 --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml new file mode 100644 index 0000000..b8387eb --- /dev/null +++ b/.idea/jsLibraryMappings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..28a804d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..efc198a --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vue-table.iml b/.idea/vue-table.iml new file mode 100644 index 0000000..c956989 --- /dev/null +++ b/.idea/vue-table.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..d9a3ad3 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,895 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + Code quality toolsJavaScript + + + JavaScript + + + + + AngularJS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + project + + + + + + + + + + + + + + + + project + + $PROJECT_DIR$ + true + + bdd + + DIRECTORY + + false + + + + + + + + + + + + 1473495736333 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..dca1056 --- /dev/null +++ b/index.html @@ -0,0 +1,20 @@ + + + + + Notes | coligo.io + + + + + + + + + + + + + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..6fed61d --- /dev/null +++ b/main.js @@ -0,0 +1,9 @@ +import Vue from 'vue' +import store from './vuex/store' +import App from './src/components/AppTable.vue' + +new Vue({ + store, // inject store to all children + el: 'body', + components: { App } +}) diff --git a/package.json b/package.json index 25d8c86..b499203 100644 --- a/package.json +++ b/package.json @@ -2,15 +2,21 @@ "name": "vuetable", "version": "1.4.1", "description": "vue.js table component that will automatically request JSON data from server and display them nicely in HTML table with swap-able/extensible pagination component", - "main": "dist/vue-table.js", + "main": "index.js", "dependencies": { "vue": "~1.0.21", - "vue-resource": "~0.7" + "vue-resource": "~0.7", + "vuex": "^0.6.2", + + "bootstrap-sweetalert": "1.0.1", + "moment": "^2.13.0" }, "directories": { "example": "examples" }, "scripts": { + "dev": "webpack-dev-server --inline --hot", + "build": "webpack -p", "test": "echo \"Error: no test specified\" && exit 1" }, "browserify": { @@ -28,7 +34,9 @@ "table", "component", "json", - "pagination" + "pagination", + "vuex", + "notes" ], "author": "Rati Wannapanop ", "license": "MIT", @@ -37,13 +45,26 @@ }, "homepage": "https://github.com/ratiw/vue-table#readme", "devDependencies": { - "babel-core": "^6.9.1", - "babel-plugin-transform-runtime": "^6.9.0", - "babel-preset-es2015": "^6.9.0", - "babel-runtime": "^6.9.2", "browserify": "13.0.1", "uglify-js": "^2.6.2", "vueify": "^8.5.4", - "watchify": "3.7.0" + "watchify": "3.7.0", + "babel-core": "^6.7.6", + "babel-loader": "^6.2.4", + "babel-plugin-transform-runtime": "^6.7.5", + "babel-preset-es2015": "^6.6.0", + "babel-runtime": "^5.8.38", + "css-loader": "^0.23.1", + "vue-hot-reload-api": "^1.3.2", + "vue-html-loader": "^1.2.2", + "vue-loader": "^8.2.3", + "vue-style-loader": "^1.0.0", + "webpack": "^1.12.15", + "webpack-dev-server": "^1.14.1" } + + + + + } diff --git a/src/components/App.vue b/src/components/App.vue new file mode 100644 index 0000000..b2e68dc --- /dev/null +++ b/src/components/App.vue @@ -0,0 +1,21 @@ + + + diff --git a/src/components/AppTable.vue b/src/components/AppTable.vue new file mode 100644 index 0000000..f9b676c --- /dev/null +++ b/src/components/AppTable.vue @@ -0,0 +1,294 @@ + + + + diff --git a/src/components/CustomAction.vue b/src/components/CustomAction.vue new file mode 100644 index 0000000..232fec3 --- /dev/null +++ b/src/components/CustomAction.vue @@ -0,0 +1,36 @@ + + + diff --git a/src/components/Editor.vue b/src/components/Editor.vue new file mode 100644 index 0000000..b72bd3b --- /dev/null +++ b/src/components/Editor.vue @@ -0,0 +1,24 @@ + + + diff --git a/src/components/MyNav.vue b/src/components/MyNav.vue new file mode 100644 index 0000000..9cf032c --- /dev/null +++ b/src/components/MyNav.vue @@ -0,0 +1,38 @@ + + + diff --git a/src/components/NotesList.vue b/src/components/NotesList.vue new file mode 100644 index 0000000..472c073 --- /dev/null +++ b/src/components/NotesList.vue @@ -0,0 +1,70 @@ + + + diff --git a/src/components/Toolbar.vue b/src/components/Toolbar.vue new file mode 100644 index 0000000..436a535 --- /dev/null +++ b/src/components/Toolbar.vue @@ -0,0 +1,26 @@ + + + diff --git a/src/components/VuetableSearchToolBar.vue b/src/components/VuetableSearchToolBar.vue new file mode 100644 index 0000000..1b545ab --- /dev/null +++ b/src/components/VuetableSearchToolBar.vue @@ -0,0 +1,104 @@ + + + diff --git a/src/components/VuetableSettingsModal.vue b/src/components/VuetableSettingsModal.vue new file mode 100644 index 0000000..4b82544 --- /dev/null +++ b/src/components/VuetableSettingsModal.vue @@ -0,0 +1,69 @@ + + + diff --git a/styles.css b/styles.css new file mode 100755 index 0000000..4ad28dd --- /dev/null +++ b/styles.css @@ -0,0 +1,89 @@ +@import url(https://fonts.googleapis.com/css?family=Raleway:400,300); + +html, #app { + height: 100%; +} + +body { + margin: 0; + padding: 0; + border: 0; + height: 100%; + max-height: 100%; + position: relative; +} + +#toolbar { + float: left; + width: 80px; + height: 100%; + background-color: #30414D; + color: #767676; + padding: 35px 25px 25px 25px; +} + +#notes-list { + float: left; + width: 300px; + height: 100%; + background-color: #F5F5F5; + font-family: 'Raleway', sans-serif; + font-weight: 400; +} + +#list-header { + padding: 5px 25px 25px 25px; +} + +#list-header h2 { + font-weight: 300; + text-transform: uppercase; + text-align: center; + font-size: 22px; + padding-bottom: 8px; +} + +#notes-list .container { + height: calc(100% - 137px); + max-height: calc(100% - 137px); + overflow: auto; + width: 100%; + padding: 0; +} + +#notes-list .container .list-group-item { + border: 0; + border-radius: 0; +} + +.list-group-item-heading { + font-weight: 300; + font-size: 15px; +} + +#note-editor { + height: 100%; + margin-left: 380px; +} + +#note-editor textarea { + height: 100%; + border: 0; + border-radius: 0; +} + +#toolbar i { + font-size: 30px; + margin-bottom: 35px; + cursor: pointer; + opacity: 0.8; + transition: opacity 0.5s ease; +} + +#toolbar i:hover { + opacity: 1; +} + +.starred { + color: #F7AE4F; +} diff --git a/vuex/actions.js b/vuex/actions.js new file mode 100644 index 0000000..6cfcd75 --- /dev/null +++ b/vuex/actions.js @@ -0,0 +1,19 @@ +export const addNote = ({ dispatch }) => { + dispatch('ADD_NOTE') +} + +export const editNote = ({ dispatch }, e) => { + dispatch('EDIT_NOTE', e.target.value) +} + +export const deleteNote = ({ dispatch }) => { + dispatch('DELETE_NOTE') +} + +export const updateActiveNote = ({ dispatch }, note) => { + dispatch('SET_ACTIVE_NOTE', note) +} + +export const toggleFavorite = ({ dispatch }) => { + dispatch('TOGGLE_FAVORITE') +} diff --git a/vuex/store.js b/vuex/store.js new file mode 100644 index 0000000..98a3123 --- /dev/null +++ b/vuex/store.js @@ -0,0 +1,44 @@ +import Vue from 'vue' +import Vuex from 'vuex' +import VueResource from 'vue-resource' + +Vue.use(Vuex) +Vue.use(VueResource) + +const state = { + notes: [], + activeNote: {} +} + +const mutations = { + ADD_NOTE (state) { + const newNote = { + text: 'New note', + favorite: false + } + state.notes.push(newNote) + state.activeNote = newNote + }, + + EDIT_NOTE (state, text) { + state.activeNote.text = text + }, + + DELETE_NOTE (state) { + state.notes.$remove(state.activeNote) + state.activeNote = state.notes[0] + }, + + TOGGLE_FAVORITE (state) { + state.activeNote.favorite = !state.activeNote.favorite + }, + + SET_ACTIVE_NOTE (state, note) { + state.activeNote = note + } +} + +export default new Vuex.Store({ + state, + mutations +}) diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..0c9fe90 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,24 @@ +module.exports = { + entry: './main.js', + output: { + path: __dirname, + filename: 'build.js' + }, + module: { + loaders: [ + { + test: /\.js$/, + loader: 'babel', + exclude: /node_modules/ + }, + { + test: /\.vue$/, + loader: 'vue' + } + ] + }, + babel: { + presets: ['es2015'], + plugins: ['transform-runtime'] + } +} From 3dcc7777a7a252dc42bd65dc12897d5a1c65aae3 Mon Sep 17 00:00:00 2001 From: "ryan.zhuang" Date: Tue, 13 Sep 2016 07:52:08 +0800 Subject: [PATCH 2/2] before push --- .idea/jsLibraryMappings.xml | 1 + .idea/libraries/vue_table_node_modules.xml | 14 + .idea/vue-table.iml | 1 + .idea/workspace.xml | 398 +++++++-------------- src/components/AppTable.vue | 30 +- src/components/Vuetable.vue | 1 + src/components/VuetableSearchToolBar.vue | 1 + 7 files changed, 172 insertions(+), 274 deletions(-) create mode 100644 .idea/libraries/vue_table_node_modules.xml diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml index b8387eb..a81b906 100644 --- a/.idea/jsLibraryMappings.xml +++ b/.idea/jsLibraryMappings.xml @@ -1,6 +1,7 @@ + \ No newline at end of file diff --git a/.idea/libraries/vue_table_node_modules.xml b/.idea/libraries/vue_table_node_modules.xml new file mode 100644 index 0000000..778cbe1 --- /dev/null +++ b/.idea/libraries/vue_table_node_modules.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vue-table.iml b/.idea/vue-table.iml index c956989..966d3fe 100644 --- a/.idea/vue-table.iml +++ b/.idea/vue-table.iml @@ -4,5 +4,6 @@ + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index d9a3ad3..4cbf69b 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,22 +2,10 @@ - - - - - - - - - - - - - - - - + + + + @@ -41,102 +29,102 @@ - - + + - - + + - - + + - - + + - - - + + + + + - - + + - - - + + + + + - - + + - - + + - - + + - - + + - - + + - - - - - + + + - - + + - - - - - + + + - - + + - - + + - - + + - - + + @@ -173,11 +161,13 @@ @@ -434,34 +424,35 @@ - + + - - + - + - - - + + + @@ -484,7 +475,6 @@ - @@ -506,7 +496,6 @@ - @@ -522,7 +511,6 @@ - @@ -530,7 +518,6 @@ - @@ -538,7 +525,6 @@ - @@ -546,7 +532,6 @@ - @@ -561,7 +546,6 @@ - @@ -569,7 +553,6 @@ - @@ -577,292 +560,205 @@ - - + + + + + + + + + + + + + - - - + + - + - - - - - - - - - - + - - + - + - - - - - - - - - - + - - - + + - + - - + - - - + + - + - - - + + - + - - - + + - + - - - + + - + - - - + + - + - - - + + - + - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - + + - + - - + + - + - - + + - + - + - - - - - + + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + @@ -875,21 +771,5 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/components/AppTable.vue b/src/components/AppTable.vue index f9b676c..3a25987 100644 --- a/src/components/AppTable.vue +++ b/src/components/AppTable.vue @@ -153,21 +153,21 @@ '' ].join('') }, - /** - * Other functions - */ - setFilter: function() { - this.moreParams = [ - 'filter=' + this.searchFor - ] - this.$nextTick(function() { - this.$broadcast('vuetable:refresh') - }) - }, - resetFilter: function() { - this.searchFor = '' - this.setFilter() - }, +// /** +// * Other functions +// */ +// setFilter: function() { +// this.moreParams = [ +// 'filter=' + this.searchFor +// ] +// this.$nextTick(function() { +// this.$broadcast('vuetable:refresh') +// }) +// }, +// resetFilter: function() { +// this.searchFor = '' +// this.setFilter() +// }, preg_quote: function( str ) { // http://kevin.vanzonneveld.net // + original by: booeyOH diff --git a/src/components/Vuetable.vue b/src/components/Vuetable.vue index a20c0ee..3be90d4 100644 --- a/src/components/Vuetable.vue +++ b/src/components/Vuetable.vue @@ -781,6 +781,7 @@ export default { this.loadData() }, 'vuetable:refresh': function() { + debugger this.currentPage = 1 this.loadData() }, diff --git a/src/components/VuetableSearchToolBar.vue b/src/components/VuetableSearchToolBar.vue index 1b545ab..1b03290 100644 --- a/src/components/VuetableSearchToolBar.vue +++ b/src/components/VuetableSearchToolBar.vue @@ -32,6 +32,7 @@ * Other functions */ setFilter: function() { + debugger; this.moreParams = [ 'filter=' + this.searchFor ]