Changeset 1596578
- Timestamp:
- 02/15/2017 01:45:00 PM (9 years ago)
- Location:
- listig/trunk
- Files:
-
- 3 added
- 15 edited
-
README.md (modified) (1 diff)
-
composer.json (modified) (1 diff)
-
dist (added)
-
dist/app.css (added)
-
dist/app.js (added)
-
globals/custom-filters.php (modified) (1 diff)
-
listig.php (modified) (1 diff)
-
mix-manifest.json (modified) (1 diff)
-
package.json (modified) (1 diff)
-
readme.txt (modified) (1 diff)
-
resources/vue/components/list-edit.vue (modified) (6 diffs)
-
resources/vue/components/list-item.vue (modified) (5 diffs)
-
resources/vue/components/listings.vue (modified) (3 diffs)
-
resources/vue/components/post-edit.vue (modified) (2 diffs)
-
src/Controller/ListingController.php (modified) (1 diff)
-
src/Language/Script.php (modified) (1 diff)
-
src/Setup/Script.php (modified) (2 diffs)
-
webpack.mix.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
listig/trunk/README.md
r1595759 r1596578 6 6 7 7 ## Work In Progress 8 Version *0.2.2*9 10 8 This is a plugin in beta phase. A lot of work in progress. 11 12 9 As development environment we use another repo at [Github](https://github.com/ekandreas/listig.app). 13 10 -
listig/trunk/composer.json
r1595759 r1596578 1 1 { 2 2 "name": "ekandreas/listig", 3 "version": "0.2. 2",3 "version": "0.2.4", 4 4 "description": "List Manager as a WordPress plugin", 5 5 "keywords": ["wordpress","wordpress-plugin","list-manager","query","structures","tool","editorial"], -
listig/trunk/globals/custom-filters.php
r1594408 r1596578 3 3 * Custom filters within this plugin application for modifications 4 4 */ 5 6 add_filter('listig/pluginData', function () { 7 return get_plugin_data(dirname(__DIR__) . '/listig.php', $markup = true, $translate = true); 8 }); -
listig/trunk/listig.php
r1595759 r1596578 4 4 Plugin URI: https://github.com/ekandreas/listig/ 5 5 Description: List Manager 6 Version: 0.2. 26 Version: 0.2.4 7 7 Author: Andreas Ek 8 8 Author URI: https://www.elseif.se/ -
listig/trunk/mix-manifest.json
r1594408 r1596578 1 1 { 2 " assets/js/app.js": "assets/js/app.705c228d800663d8f498.js",3 " assets/css/app.css": "assets/css/app.e0e3d92f49b1c7d698c4.css"2 "/dist/app.js": "/dist/app.js", 3 "/dist/app.css": "/dist/app.css" 4 4 } -
listig/trunk/package.json
r1594408 r1596578 13 13 "license": "MIT", 14 14 "devDependencies": { 15 "axios": "^0.15.3", 16 "bulma": "^0.3.1", 17 "font-awesome": "^4.7.0", 18 "jquery": "^3.1.1", 19 "laravel-mix": "^0.6.3", 20 "moment": "^2.17.1", 21 "vue": "^2.1.10", 22 "vuedraggable": "^2.8.3-rc0" 15 "axios": "^0.*", 16 "bulma": "^0.*", 17 "font-awesome": "^4.*", 18 "jquery": "^3.*", 19 "laravel-mix": "^0.*", 20 "moment": "^2.*", 21 "vue": "^2.*", 22 "vue-bulma-modal": "^1.0.1", 23 "vuedraggable": "^2.*" 23 24 } 24 25 } -
listig/trunk/readme.txt
r1595759 r1596578 4 4 Requires at least: 4.7 5 5 Tested up to: 4.7.2 6 Stable tag: 0.2. 26 Stable tag: 0.2.4 7 7 License: MIT 8 8 License URI: https://opensource.org/licenses/MIT -
listig/trunk/resources/vue/components/list-edit.vue
r1594408 r1596578 1 1 <template> 2 2 <div :class="moduleClass"> 3 <div class="modal-background" ></div>3 <div class="modal-background" @click="close"></div> 4 4 <div class="modal-card"> 5 5 <header class="modal-card-head"> … … 37 37 <a class="button is-success" @click="save">{{ lang.saveLabel }}</a> 38 38 <a class="button" @click="close">{{ lang.cancelLabel }}</a> 39 <a class="button is-warning" @click="hide">{{ lang.hideListLabel }}</a> 39 40 <a class="button is-danger" @click="destroy">{{ lang.destroyLabel }}</a> 40 41 </footer> … … 44 45 45 46 <script> 46 module.exports ={47 mounted : function() {47 export default { 48 mounted() { 48 49 let self = this; 49 50 }, 50 created : function() {51 created() { 51 52 let self = this; 52 window.eventBus.$on('list-edit', function (list ) {53 self.edit(list );53 window.eventBus.$on('list-edit', function (listId) { 54 self.edit(listId); 54 55 }); 55 56 }, 56 data : function() {57 data() { 57 58 return { 58 59 moduleClass: 'modal', … … 68 69 }, 69 70 methods: { 70 edit : function (list) {71 edit(listId) { 71 72 let self = this; 72 73 73 self.form.id = list ? list.id : 0; 74 self.form.name = list ? list.name : ''; 75 self.form.description = list ? list.description : ''; 76 self.form.private = list ? list.private : false; 77 self.form.posts = list ? list.posts : []; 74 axios.defaults.headers.common['X-WP-Nonce'] = listig.nonce; 75 axios.get(`${listig.restUrl}/listing/${listId}`) 76 .then(function (response) { 77 self.form.id = response.data.id; 78 self.form.name = response.data.name; 79 self.form.description = response.data.description; 80 self.form.private = response.data.private; 81 self.form.posts = response.data.posts; 78 82 79 self.moduleClass = 'modal is-active'; 80 setTimeout(function () { 81 self.$refs.editName.focus(); 82 }, 500); 83 self.moduleClass = 'modal is-active'; 84 setTimeout(function () { 85 self.$refs.editName.focus(); 86 }, 500); 87 }); 83 88 }, 84 close : function() {89 close() { 85 90 let self = this; 86 91 87 92 self.moduleClass = 'modal'; 88 93 }, 89 save: function () { 94 hide() { 95 let self = this; 96 self.close(); 97 }, 98 save() { 90 99 let self = this; 91 100 axios.defaults.headers.common['X-WP-Nonce'] = listig.nonce; … … 97 106 self.form.posts = []; 98 107 window.eventBus.$emit('list-rebound', response.data.id); 99 self. moduleClass = 'modal';108 self.close(); 100 109 }); 101 110 }, 102 destroy : function() {111 destroy() { 103 112 let self = this; 104 113 … … 107 116 .then(function (response) { 108 117 window.eventBus.$emit('list-rebound', self.form.id); 109 self. moduleClass = 'modal';118 self.close(); 110 119 }); 111 120 } -
listig/trunk/resources/vue/components/list-item.vue
r1594408 r1596578 2 2 <nav class="panel"> 3 3 <p class="panel-heading"> 4 {{ list.name }}5 <a class="icon pull-right gear-icon" @click="listEdit(list)">4 {{ name }} 5 <a class="icon is-pulled-right gear-icon" @click="listEdit"> 6 6 <i class="fa fa-gear"></i> 7 7 </a> 8 <a class="icon is-pulled-right file-icon" @click="addEmpty"> 9 <i class="fa fa-file-o"></i> 10 </a> 8 11 </p> 9 <draggable :class="{ 'panel-block initial-area' : list.posts.length==0 }" :list="list.posts"10 :options="{group:'posts',animation:350}" @ start="drag=true" @end="endDrag" @add="added">12 <draggable :class="{ 'panel-block initial-area' : posts.length==0 }" :list="posts" 13 :options="{group:'posts',animation:350}" @add="dragAdded" @end="dragEnded"> 11 14 12 <a class="panel-block draggable-post" 13 v-for="post in list.posts" 14 @click="postEdit(post)" 15 :class="{ 'is-active': post.id==currentPostId }"> 16 {{ post.headline}} 17 </a> 15 <div class="panel-block draggable-post" @click="postEdit(post)" 16 v-for="(post,index) in posts" :class="{ 'is-active': selectedIndex==posts.indexOf(post) }"> 17 18 <a class="delete is-small" @click="postRemove(post)"></a> 19 <span :class="{ 'active-post': selectedIndex==posts.indexOf(post) }">{{ post.headline}}</span> 20 21 </div> 18 22 </draggable> 19 23 <div class="panel-block" v-if="dirty"> … … 27 31 <script> 28 32 module.exports = { 29 props: [' list'],33 props: ['id'], 30 34 data() { 31 35 return { 32 currentPostId: 0, 36 name: '', 37 posts: [], 38 selectedIndex: -1, 33 39 dirty: false, 34 40 drag: false, … … 38 44 let self = this; 39 45 window.eventBus.$on('list-dirty', function (listId) { 40 if (listId == self. list.id) self.dirty = true;46 if (listId == self.id) self.dirty = true; 41 47 }); 42 $(window).bind('beforeunload', function(e){ 43 if(self.dirty) 44 return "Unsaved changes in list " + self.list.name; 48 window.eventBus.$on('post-selected', function (post) { 49 self.selectedIndex = self.posts.indexOf(post); 50 }); 51 $(window).bind('beforeunload', function (e) { 52 if (self.dirty) 53 return "Unsaved changes in list " + self.name; 45 54 else 46 e =null; // i.e; if form state change show warning box, else don't show it.55 e = null; // i.e; if form state change show warning box, else don't show it. 47 56 }); 48 57 }, 49 58 mounted() { 50 59 let self = this; 60 axios.defaults.headers.common['X-WP-Nonce'] = listig.nonce; 61 axios.get(`${listig.restUrl}/listing/${self.id}`) 62 .then(function (response) { 63 self.dirty = false; 64 self.name = response.data.name; 65 self.posts = response.data.posts; 66 }); 51 67 }, 52 68 methods: { 53 listEdit(list) { 54 window.eventBus.$emit('list-edit', list); 69 focusOnPost(post) { 70 window.eventBus.$emit('post-selected', post); 71 window.eventBus.$emit('post-edit', {listId: self.id, post: post}); 55 72 }, 56 add ed(e) {73 addEmpty() { 57 74 let self = this; 58 75 self.dirty = true; 59 60 self.currentPostId = self.list.posts[e.newIndex].id; 76 let newPost = { 77 headline: 'New post item' 78 }; 79 self.posts.push(newPost); 80 self.focusOnPost(newPost); 81 }, 82 listEdit() { 83 let self = this; 84 window.eventBus.$emit('list-edit', self.id); 85 }, 86 dragAdded(e) { 87 let self = this; 88 self.dirty = true; 89 self.focusOnPost(self.posts[e.newIndex]); 61 90 }, 62 91 postEdit(post) { 63 92 let self = this; 64 self.currentPostId = post.id; 65 window.eventBus.$emit('post-edit', {listId: self.list.id, post: post}); 93 self.focusOnPost(post); 94 }, 95 postRemove(post) { 96 let self = this; 97 window.eventBus.$emit('post-selected', null); 98 let index = self.posts.indexOf(post); 99 self.posts.splice(index, 1); 100 self.dirty = true; 66 101 }, 67 102 save() { 68 103 let self = this; 69 104 axios.defaults.headers.common['X-WP-Nonce'] = listig.nonce; 70 axios.post(`${listig.restUrl}/listing/${self. list.id}/posts`, self.list)105 axios.post(`${listig.restUrl}/listing/${self.id}/posts`, self.posts) 71 106 .then(function (response) { 72 107 self.dirty = false; 73 window.eventBus.$emit('list-rebound', self.list.id);108 //window.eventBus.$emit('list-rebound', self.id); 74 109 }); 75 110 }, 76 endDrag() {111 dragEnded(e) { 77 112 let self = this; 78 113 self.dirty = true; 114 self.focusOnPost(self.posts[e.newIndex]); 79 115 } 80 116 } … … 87 123 } 88 124 125 .file-icon { 126 margin-right: 10px; 127 color: #999; 128 } 129 89 130 .gear-icon { 90 131 color: #999; … … 94 135 min-height: 40px; 95 136 } 137 138 .active-post { 139 font-weight: bolder; 140 } 96 141 </style> -
listig/trunk/resources/vue/components/listings.vue
r1594408 r1596578 1 1 <template> 2 <draggable :list="listings" 3 :options="{group:'listings',animation:350}" @start="drag=true" @end="drag=false"> 4 <list-item v-for="list in listings" :list="list" :key="list.id"></list-item> 5 </draggable> 2 <div> 3 <list-item v-for="list in listings" :id="list.id"></list-item> 4 </div> 6 5 </template> 7 6 … … 9 8 10 9 module.exports = { 11 data : function() {10 data() { 12 11 return { 13 12 listings: [] 14 13 } 15 14 }, 16 created : function() {15 created() { 17 16 let self = this; 18 17 window.eventBus.$on('list-rebound', function (listId) { … … 25 24 }); 26 25 }, 27 mounted : function() {26 mounted() { 28 27 let self = this; 29 28 self.getAll(); -
listig/trunk/resources/vue/components/post-edit.vue
r1594408 r1596578 1 1 <template> 2 <div v-if="post .id">2 <div v-if="post"> 3 3 <div class="box"> 4 4 <h2 class="title is-2">{{ post.headline }}</h2> … … 33 33 v-on:keyup="changed(post)" 34 34 v-model="post.excerpt"></textarea> 35 </div> 36 </div> 37 <div class="panel-block"> 38 <div class="control"> 39 <input class="input" 40 type="text" 41 :placeholder="lang.urlLabel" 42 v-on:keyup="changed(post)" 43 v-model="post.url"/> 35 44 </div> 36 45 </div> -
listig/trunk/src/Controller/ListingController.php
r1594408 r1596578 44 44 public function savePosts(\WP_REST_Request $request) 45 45 { 46 $id = (int)$request->get_param('id'); 46 47 $params = $request->get_json_params(); 47 48 48 $listing = new ListingModel( (int)$params['id']);49 $listing->posts = $params['posts'];49 $listing = new ListingModel($id); 50 $listing->posts = isset($params) ? $params : []; 50 51 $listing->save(); 51 52 -
listig/trunk/src/Language/Script.php
r1594408 r1596578 32 32 'removeImageLabel' => __('Remove image', 'listig'), 33 33 'changeImageLabel' => __('Change image', 'listig'), 34 'hideListLabel' => __('Hide list', 'listig'), 35 'urlLabel' => __('Url', 'listig'), 34 36 ]; 35 37 } -
listig/trunk/src/Setup/Script.php
r1594408 r1596578 18 18 $manifest = json_decode(file_get_contents(__DIR__.'/../../mix-manifest.json'), true); 19 19 20 $pluginData = apply_filters('listig/pluginData', []); 21 $version = isset($pluginData['Version']) ? $pluginData['Version'] : uniqid(); 22 20 23 wp_enqueue_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css'); 21 wp_enqueue_style('listig_css', plugins_url('listig/'.$manifest[' assets/css/app.css']));24 wp_enqueue_style('listig_css', plugins_url('listig/'.$manifest['/dist/app.css']), [], $version); 22 25 23 26 $data = [ … … 28 31 ]; 29 32 30 wp_register_script('listig_js', plugins_url('listig/'.$manifest[' assets/js/app.js']), [], null, true);33 wp_register_script('listig_js', plugins_url('listig/'.$manifest['/dist/app.js']), [], $version, true); 31 34 wp_localize_script('listig_js', 'listig', $data); 32 35 wp_enqueue_script('listig_js'); -
listig/trunk/webpack.mix.js
r1594408 r1596578 12 12 */ 13 13 14 mix.js('resources/js/app.js', 'assets/js/') 15 .sass('resources/sass/app.scss', 'assets/css/') 16 .version(); 14 mix.js('resources/js/app.js', 'dist') 15 .sass('resources/sass/app.scss', 'dist'); 17 16 18 17 // Full API
Note: See TracChangeset
for help on using the changeset viewer.