Plugin Directory

Changeset 1596578


Ignore:
Timestamp:
02/15/2017 01:45:00 PM (9 years ago)
Author:
EkAndreas
Message:

release 0.2.4

Location:
listig/trunk
Files:
3 added
15 edited

Legend:

Unmodified
Added
Removed
  • listig/trunk/README.md

    r1595759 r1596578  
    66
    77## Work In Progress
    8 Version *0.2.2*
    9 
    108This is a plugin in beta phase. A lot of work in progress.
    11 
    129As development environment we use another repo at [Github](https://github.com/ekandreas/listig.app).
    1310
  • listig/trunk/composer.json

    r1595759 r1596578  
    11{
    22    "name": "ekandreas/listig",
    3     "version": "0.2.2",
     3    "version": "0.2.4",
    44    "description": "List Manager as a WordPress plugin",
    55    "keywords": ["wordpress","wordpress-plugin","list-manager","query","structures","tool","editorial"],
  • listig/trunk/globals/custom-filters.php

    r1594408 r1596578  
    33 * Custom filters within this plugin application for modifications
    44 */
     5
     6add_filter('listig/pluginData', function () {
     7    return get_plugin_data(dirname(__DIR__) . '/listig.php', $markup = true, $translate = true);
     8});
  • listig/trunk/listig.php

    r1595759 r1596578  
    44Plugin URI:  https://github.com/ekandreas/listig/
    55Description: List Manager
    6 Version:     0.2.2
     6Version:     0.2.4
    77Author:      Andreas Ek
    88Author URI:  https://www.elseif.se/
  • listig/trunk/mix-manifest.json

    r1594408 r1596578  
    11{
    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"
    44}
  • listig/trunk/package.json

    r1594408 r1596578  
    1313  "license": "MIT",
    1414  "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.*"
    2324  }
    2425}
  • listig/trunk/readme.txt

    r1595759 r1596578  
    44Requires at least: 4.7
    55Tested up to: 4.7.2
    6 Stable tag: 0.2.2
     6Stable tag: 0.2.4
    77License: MIT
    88License URI: https://opensource.org/licenses/MIT
  • listig/trunk/resources/vue/components/list-edit.vue

    r1594408 r1596578  
    11<template>
    22    <div :class="moduleClass">
    3         <div class="modal-background"></div>
     3        <div class="modal-background" @click="close"></div>
    44        <div class="modal-card">
    55            <header class="modal-card-head">
     
    3737                <a class="button is-success" @click="save">{{ lang.saveLabel }}</a>
    3838                <a class="button" @click="close">{{ lang.cancelLabel }}</a>
     39                <a class="button is-warning" @click="hide">{{ lang.hideListLabel }}</a>
    3940                <a class="button is-danger" @click="destroy">{{ lang.destroyLabel }}</a>
    4041            </footer>
     
    4445
    4546<script>
    46     module.exports = {
    47         mounted: function () {
     47    export default {
     48        mounted() {
    4849            let self = this;
    4950        },
    50         created: function () {
     51        created() {
    5152            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);
    5455            });
    5556        },
    56         data: function () {
     57        data() {
    5758            return {
    5859                moduleClass: 'modal',
     
    6869        },
    6970        methods: {
    70             edit: function (list) {
     71            edit(listId) {
    7172                let self = this;
    7273
    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;
    7882
    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                    });
    8388            },
    84             close: function () {
     89            close() {
    8590                let self = this;
    8691
    8792                self.moduleClass = 'modal';
    8893            },
    89             save: function () {
     94            hide() {
     95                let self = this;
     96                self.close();
     97            },
     98            save() {
    9099                let self = this;
    91100                axios.defaults.headers.common['X-WP-Nonce'] = listig.nonce;
     
    97106                        self.form.posts = [];
    98107                        window.eventBus.$emit('list-rebound', response.data.id);
    99                         self.moduleClass = 'modal';
     108                        self.close();
    100109                    });
    101110            },
    102             destroy: function () {
     111            destroy() {
    103112                let self = this;
    104113
     
    107116                    .then(function (response) {
    108117                        window.eventBus.$emit('list-rebound', self.form.id);
    109                         self.moduleClass = 'modal';
     118                        self.close();
    110119                    });
    111120            }
  • listig/trunk/resources/vue/components/list-item.vue

    r1594408 r1596578  
    22    <nav class="panel">
    33        <p class="panel-heading">
    4             {{ list.name }}
    5             <a class="icon pull-right gear-icon" @click="listEdit(list)">
     4            {{ name }}&nbsp;
     5            <a class="icon is-pulled-right gear-icon" @click="listEdit">
    66                <i class="fa fa-gear"></i>
    77            </a>
     8            <a class="icon is-pulled-right file-icon" @click="addEmpty">
     9                <i class="fa fa-file-o"></i>
     10            </a>
    811        </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">
    1114
    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>&nbsp;&nbsp;
     19                <span :class="{ 'active-post': selectedIndex==posts.indexOf(post) }">{{ post.headline}}</span>
     20
     21            </div>
    1822        </draggable>
    1923        <div class="panel-block" v-if="dirty">
     
    2731<script>
    2832    module.exports = {
    29         props: ['list'],
     33        props: ['id'],
    3034        data() {
    3135            return {
    32                 currentPostId: 0,
     36                name: '',
     37                posts: [],
     38                selectedIndex: -1,
    3339                dirty: false,
    3440                drag: false,
     
    3844            let self = this;
    3945            window.eventBus.$on('list-dirty', function (listId) {
    40                 if (listId == self.list.id) self.dirty = true;
     46                if (listId == self.id) self.dirty = true;
    4147            });
    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;
    4554                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.
    4756            });
    4857        },
    4958        mounted() {
    5059            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                });
    5167        },
    5268        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});
    5572            },
    56             added(e) {
     73            addEmpty() {
    5774                let self = this;
    5875                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]);
    6190            },
    6291            postEdit(post) {
    6392                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;
    66101            },
    67102            save() {
    68103                let self = this;
    69104                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)
    71106                    .then(function (response) {
    72107                        self.dirty = false;
    73                         window.eventBus.$emit('list-rebound', self.list.id);
     108                        //window.eventBus.$emit('list-rebound', self.id);
    74109                    });
    75110            },
    76             endDrag() {
     111            dragEnded(e) {
    77112                let self = this;
    78113                self.dirty = true;
     114                self.focusOnPost(self.posts[e.newIndex]);
    79115            }
    80116        }
     
    87123    }
    88124
     125    .file-icon {
     126        margin-right: 10px;
     127        color: #999;
     128    }
     129
    89130    .gear-icon {
    90131        color: #999;
     
    94135        min-height: 40px;
    95136    }
     137
     138    .active-post {
     139        font-weight: bolder;
     140    }
    96141</style>
  • listig/trunk/resources/vue/components/listings.vue

    r1594408 r1596578  
    11<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>
    65</template>
    76
     
    98
    109    module.exports = {
    11         data: function () {
     10        data() {
    1211            return {
    1312                listings: []
    1413            }
    1514        },
    16         created: function () {
     15        created() {
    1716            let self = this;
    1817            window.eventBus.$on('list-rebound', function (listId) {
     
    2524            });
    2625        },
    27         mounted: function () {
     26        mounted() {
    2827            let self = this;
    2928            self.getAll();
  • listig/trunk/resources/vue/components/post-edit.vue

    r1594408 r1596578  
    11<template>
    2     <div v-if="post.id">
     2    <div v-if="post">
    33        <div class="box">
    44            <h2 class="title is-2">{{ post.headline }}</h2>
     
    3333                              v-on:keyup="changed(post)"
    3434                              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"/>
    3544                </div>
    3645            </div>
  • listig/trunk/src/Controller/ListingController.php

    r1594408 r1596578  
    4444    public function savePosts(\WP_REST_Request $request)
    4545    {
     46        $id = (int)$request->get_param('id');
    4647        $params = $request->get_json_params();
    4748
    48         $listing = new ListingModel((int)$params['id']);
    49         $listing->posts = $params['posts'];
     49        $listing = new ListingModel($id);
     50        $listing->posts = isset($params) ? $params : [];
    5051        $listing->save();
    5152
  • listig/trunk/src/Language/Script.php

    r1594408 r1596578  
    3232            'removeImageLabel' => __('Remove image', 'listig'),
    3333            'changeImageLabel' => __('Change image', 'listig'),
     34            'hideListLabel' => __('Hide list', 'listig'),
     35            'urlLabel' => __('Url', 'listig'),
    3436        ];
    3537    }
  • listig/trunk/src/Setup/Script.php

    r1594408 r1596578  
    1818        $manifest = json_decode(file_get_contents(__DIR__.'/../../mix-manifest.json'), true);
    1919
     20        $pluginData = apply_filters('listig/pluginData', []);
     21        $version = isset($pluginData['Version']) ? $pluginData['Version'] : uniqid();
     22
    2023        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);
    2225
    2326        $data = [
     
    2831        ];
    2932
    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);
    3134        wp_localize_script('listig_js', 'listig', $data);
    3235        wp_enqueue_script('listig_js');
  • listig/trunk/webpack.mix.js

    r1594408 r1596578  
    1212 */
    1313
    14 mix.js('resources/js/app.js', 'assets/js/')
    15     .sass('resources/sass/app.scss', 'assets/css/')
    16     .version();
     14mix.js('resources/js/app.js', 'dist')
     15    .sass('resources/sass/app.scss', 'dist');
    1716
    1817// Full API
Note: See TracChangeset for help on using the changeset viewer.