├── .gitignore ├── dist ├── crudtable.js └── crudtable.js.map ├── gulpfile.js ├── package.json ├── readme.md ├── resources └── assets │ └── js │ ├── components │ ├── CrudInsert.vue │ └── CrudWrapper.vue │ └── crudtable.js └── sample.gif /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | var elixir = require('laravel-elixir'); 2 | require('laravel-elixir-vueify'); 3 | /* 4 | |-------------------------------------------------------------------------- 5 | | Elixir Asset Management 6 | |-------------------------------------------------------------------------- 7 | | 8 | | Elixir provides a clean, fluent API for defining some basic Gulp tasks 9 | | for your Laravel application. By default, we are compiling the Sass 10 | | file for our application, as well as publishing vendor resources. 11 | | 12 | */ 13 | 14 | elixir(function(mix) { 15 | mix.browserify('crudtable.js','./dist/crudtable.js'); 16 | }); 17 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "crudtable", 3 | "version": "1.0.0", 4 | "description": "crud table plugin", 5 | "main": "gulpfile.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/heruujoko/crudtable.git" 12 | }, 13 | "author": "heruujoko", 14 | "license": "MIT", 15 | "bugs": { 16 | "url": "https://github.com/heruujoko/crudtable/issues" 17 | }, 18 | "homepage": "https://github.com/heruujoko/crudtable#readme", 19 | "devDependencies": { 20 | "babel-core": "^6.11.4", 21 | "babel-plugin-transform-runtime": "^6.12.0", 22 | "babel-preset-es2015": "^6.9.0", 23 | "babel-preset-react": "^6.11.1", 24 | "babel-preset-stage-2": "^6.13.0", 25 | "babel-runtime": "^6.11.6", 26 | "babelify": "^7.3.0", 27 | "bootstrap-sass": "^3.3.0", 28 | "browserify": "^13.0.1", 29 | "gulp": "^3.9.1", 30 | "laravel-elixir": "^5.0.0", 31 | "laravel-elixir-vueify": "^1.0.3", 32 | "vue-hot-reload-api": "^2.0.5", 33 | "vueify": "^8.7.0" 34 | }, 35 | "dependencies": { 36 | "jquery": "~2.1.0", 37 | "js-cookie": "^2.1.2", 38 | "lodash": "^4.15.0", 39 | "stringify": "^5.1.0", 40 | "sweetalert": "^1.1.3", 41 | "vue": "^1.0.26", 42 | "vue-resource": "^0.9.3", 43 | "vue-router": "^0.7.13", 44 | "vue-select": "^1.3.3", 45 | "vue-tables": "^1.4.64" 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | ## Synopsis 2 | 3 | This library helps you create more functional table easily. 4 | 5 | ## Sample 6 | 7 | ![sample](https://github.com/heruujoko/crudtable/blob/master/sample.gif) 8 | 9 | Fiddle : https://jsfiddle.net/heruujoko/vj7ds7um/2/ 10 | 11 | Note: the fiddle is just to show how to set up the HTML tags and may not have the full table functionality since I can't provide an API to serve the table. 12 | 13 | ## Installation 14 | 15 | Include [crudtable.js](https://github.com/heruujoko/crudtable/blob/master/dist/crudtable.js) to your page, and just wrap it inside a div with id "crudsection" 16 | 17 | ```html 18 |
19 | 20 |
21 | ``` 22 | 23 | ## Column JSON Spec Sample 24 | 25 | ```json 26 | [ 27 | { "label": "name" , "type":"text", "required": true}, 28 | { "label": "email" , "type":"email", "required": true}, 29 | { "label": "password" , "type":"password", "required": true}, 30 | { "label": "description" , "type":"textarea", "required": true}, 31 | ] 32 | ``` 33 | 34 | Supported form type : 35 | 36 | 1. text 37 | 2. textarea 38 | 3. email 39 | 4. password 40 | 41 | ## API endpoint 42 | 43 | This library assumes your API has common resources structures and match the JSON Spec for the forms 44 | 45 | 1. GET http://your_endpoint/ 46 | ```json 47 | [ 48 | { 49 | "name": "name", 50 | "email": "email", 51 | "password": "password", 52 | "description": "description" 53 | }, 54 | { 55 | "name": "name", 56 | "email": "email", 57 | "password": "password", 58 | "description": "description" 59 | } 60 | ] 61 | ``` 62 | 2. GET http://your_endpoint/{id} 63 | ```json 64 | { 65 | "name": "name", 66 | "email": "email", 67 | "password": "password", 68 | "description": "description" 69 | } 70 | ``` 71 | 2. POST http://your_endpoint/ 72 | 3. PUT http://your_endpoint/{id} 73 | ```json 74 | { 75 | "name": "name", 76 | "email": "email", 77 | "password": "password", 78 | "description": "description" 79 | } 80 | ``` 81 | 4. DELETE http://your_endpoint/{id} 82 | 83 | ## What's Next 84 | 85 | Add select , multiselect and file options for forms. 86 | -------------------------------------------------------------------------------- /resources/assets/js/components/CrudInsert.vue: -------------------------------------------------------------------------------- 1 | 27 | 92 | -------------------------------------------------------------------------------- /resources/assets/js/components/CrudWrapper.vue: -------------------------------------------------------------------------------- 1 | 30 | 159 | -------------------------------------------------------------------------------- /resources/assets/js/crudtable.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Resource from 'vue-resource' 3 | import VueTables from 'vue-tables' 4 | import CrudWrapper from './components/CrudWrapper.vue' 5 | 6 | Vue.config.devtools = true; 7 | Vue.use(VueTables.client, { 8 | compileTemplates: true, 9 | highlightMatches: true, 10 | filterByColumn: false, 11 | texts: { 12 | filter: "Search:" 13 | }, 14 | datepickerOptions: { 15 | showDropdowns: true 16 | }, 17 | perPage: 8, 18 | perPageValues: [8,10,25,50,100] 19 | }); 20 | Vue.use(Resource); 21 | new Vue({ 22 | el: "#crudsection", 23 | data: { 24 | vue: Vue 25 | }, 26 | components: { 27 | CrudTable: CrudWrapper 28 | }, 29 | ready(){ 30 | console.log("parent ready"); 31 | } 32 | }); 33 | -------------------------------------------------------------------------------- /sample.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heruujoko/crudtable/ac34bf5a77234635b5fd60b26dcfdfef2ec52a5a/sample.gif --------------------------------------------------------------------------------