Plugin Directory

Changeset 1094156


Ignore:
Timestamp:
02/19/2015 10:11:54 AM (11 years ago)
Author:
v-media
Message:

Version 1.10

Location:
foodlist/trunk
Files:
1 added
12 edited

Legend:

Unmodified
Added
Removed
  • foodlist/trunk/assets/css/admin.css

    r938796 r1094156  
    168168    position: relative;
    169169}
     170
     171#fl-user-note {
     172    width: 98%;
     173}
  • foodlist/trunk/assets/js/admin.js

    r938796 r1094156  
    33
    44    var api;
    5    
     5
     6    var entityMap = {
     7        "&": "&",
     8        "<": "&lt;",
     9        ">": "&gt;",
     10        '"': '&quot;',
     11        "'": '&#39;',
     12        "/": '&#x2F;'
     13    };
     14
     15    function escapeHtml(string) {
     16        return String(string).replace(/[&<>"'\/]/g, function (s) {
     17            return entityMap[s];
     18        });
     19    }
     20
    621    api = {
    722        init: function() {
     
    166181                //minimumInputLength: 1,
    167182                placeholder: el.attr('placeholder'),
     183                formatResult: function(item) {
     184                    var note = "";
     185
     186                    if (item.note && item.note.length) {
     187                        note = " <small>(" + escapeHtml(item.note) + ")</small>";
     188                    }
     189                    return escapeHtml(item.text) + note;
     190                },
     191                escapeMarkup: function(m) { return m; },
    168192                ajax: {
    169193                    url: ajaxurl,
     
    190214            }).on('change', function(e){
    191215                //e.added.id
    192                 var html = tpl.replace('__title__', e.added.text).replace('__id__', e.added.id);
     216                var html = tpl.replace('__title__', e.added.text).replace('__id__', e.added.id).replace('__note__', e.added.note.length ? '<span class="in-widget-title">('+e.added.note+')</span>' : '');
    193217                $('#fl-menu-sortable-list').append($(html));
    194218
  • foodlist/trunk/assets/js/menu-manager.js

    r940771 r1094156  
    270270
    271271    appendTitle : function(widget) {
     272        /*
    272273        var title = $('input[id*="-title"]', widget).val() || '';
    273274
     
    277278        $(widget).children('.widget-top').children('.widget-title').children()
    278279                .children('.in-widget-title').html(title);
    279 
     280        */
    280281    },
    281282
  • foodlist/trunk/lib/Artprima/WordPress/API/Wrapper/Admin/Metabox/Metabox.php

    r792818 r1094156  
    143143     * 'attachment' or 'custom_post_type' where custom_post_type is the custom post type slug)
    144144     *
    145      * @param type $postType
    146      * @return \Artprima\WordPress\API\Wrapper\Admin\Metabox
     145     * @param string $screen
     146     * @return \Artprima\WordPress\API\Wrapper\Admin\Metabox\Metabox
    147147     */
    148148    public function setScreen($screen)
  • foodlist/trunk/lib/Foodlist/Project/WordPress/Plugin/Foodlist/Admin/Ajax/Manager/Base.php

    r938796 r1094156  
    107107                        'id' => $post->ID,
    108108                        'text' => get_the_title($post),
     109                        'note' => get_post_meta($post->ID, '_fl_menu_section_note', true),
    109110                    );
    110111                }
  • foodlist/trunk/lib/Foodlist/Project/WordPress/Plugin/Foodlist/Admin/Menu/MenuManager.php

    r940771 r1094156  
    5555        if (!$multi_number) {
    5656            $multi_number = '1';
     57        }
     58
     59        $note = get_post_meta($postId, '_fl_menu_section_note', true);
     60        if ($note) {
     61            $note = '('.esc_html($note).')';
    5762        }
    5863
     
    6166                <div class="widget-top">
    6267                    <div class="widget-title">
    63                         <h4>'.esc_attr(strip_tags(get_the_title())).'<span class="in-widget-title"></span></h4>
     68                        <h4>'.esc_attr(strip_tags(get_the_title())).' <span class="in-widget-title">'.$note.'</span></h4>
    6469                    </div>
    6570                </div>
  • foodlist/trunk/lib/Foodlist/Project/WordPress/Plugin/Foodlist/Admin/Metabox/Menu/SectionsMetabox.php

    r938796 r1094156  
    8989        $template = '
    9090            <li class="widget-top fl-menu-sortable-item">
    91                     <div class="widget-title"><h4>%s</h4></div>
     91                    <div class="widget-title"><h4>%s %s</h4></div>
    9292                    <div class="fl-menu-sortable-item-remove dashicons dashicons-no"></div>
    9393                    <input type="hidden" name="fl_menu[sections][]" value="%s" />
     
    9595        ';
    9696
    97         echo '<ul id="fl-menu-sortable-list" class="widget ui-draggable" data-template="'.esc_attr(sprintf($template, '__title__', '__id__')).'" data-context="sections" data-nonce="fl_menu[sections_nonce]">';
     97        echo '<ul id="fl-menu-sortable-list" class="widget ui-draggable" data-template="'.esc_attr(sprintf($template, '__title__', '__note__', '__id__')).'" data-context="sections" data-nonce="fl_menu[sections_nonce]">';
    9898        if (!empty($sections) && is_array($sections)) {
    9999            foreach ($sections as $instance) {
    100100                list($postId, $instanceId) = $this->parseInstanceStr($instance);
    101101                $title = get_the_title($postId);
    102                 echo sprintf($template, esc_html($title), (int)$postId);
     102                $note = get_post_meta($postId, '_fl_menu_section_note', true);
     103                if ($note) {
     104                    $note = '<span class="in-widget-title">('.esc_html($note).')</span>';
     105                }
     106                echo sprintf($template, esc_html($title), $note, (int)$postId);
    103107            }
    104108        }
  • foodlist/trunk/lib/Foodlist/Project/WordPress/Plugin/Foodlist/Admin/Metabox/MenuSection/ItemsMetabox.php

    r938796 r1094156  
    135135        }
    136136
    137         if (!current_user_can('edit_post')) {
     137        if (!@current_user_can('edit_post')) {
    138138            return;
    139139        }
  • foodlist/trunk/lib/Foodlist/Project/WordPress/Plugin/Foodlist/Generic/PostType/MenuSectionPostType.php

    r938796 r1094156  
    5252
    5353        // metaboxes
     54        $metabox = new Metabox\MenuSection\UserNoteMetabox();
     55        $metabox->init();
     56
    5457        $metabox = new Metabox\MenuSection\ItemsMetabox();
    5558        $metabox->init();
  • foodlist/trunk/lib/Foodlist/Project/WordPress/Plugin/Foodlist/Manager.php

    r974538 r1094156  
    8585    public function getPluginUrl()
    8686    {
    87        return $this->pluginUrl;
     87        return $this->pluginUrl;
    8888    }
    8989   
  • foodlist/trunk/plugin.php

    r986946 r1094156  
    66Author: Artprima
    77Author URI: http://artprima.eu/
    8 Version: 1.9.1
     8Version: 1.10
    99*/
    1010
    11 define('FOODLIST_VERSION', '1.9.1');
     11define('FOODLIST_VERSION', '1.10');
    1212define('FOODLIST_MIN_PHP_VERSION', '5.3.3');
    13 define('FOODLIST_MIN_WP_VERSION', '3.4.0');
     13define('FOODLIST_MIN_WP_VERSION', '3.6.0');
    1414
    1515if (version_compare(PHP_VERSION, FOODLIST_MIN_PHP_VERSION, '<')) {
  • foodlist/trunk/readme.txt

    r986946 r1094156  
    4747== ChangeLog ==
    4848
     49= Version 1.10 =
     50* Tested up to WordPress 4.1.1
     51* New field in the Menu Section post type: Note. You can now put your short note (description) to the section and it will be shown when you add a section to the menu. This will let you distinguish different sections with the same names.
     52
    4953= Version 1.9.1 =
    5054* Tested up to WordPress 4.0 (no changes)
Note: See TracChangeset for help on using the changeset viewer.