Changeset 1094156
- Timestamp:
- 02/19/2015 10:11:54 AM (11 years ago)
- Location:
- foodlist/trunk
- Files:
-
- 1 added
- 12 edited
-
assets/css/admin.css (modified) (1 diff)
-
assets/js/admin.js (modified) (3 diffs)
-
assets/js/menu-manager.js (modified) (2 diffs)
-
lib/Artprima/WordPress/API/Wrapper/Admin/Metabox/Metabox.php (modified) (1 diff)
-
lib/Foodlist/Project/WordPress/Plugin/Foodlist/Admin/Ajax/Manager/Base.php (modified) (1 diff)
-
lib/Foodlist/Project/WordPress/Plugin/Foodlist/Admin/Menu/MenuManager.php (modified) (2 diffs)
-
lib/Foodlist/Project/WordPress/Plugin/Foodlist/Admin/Metabox/Menu/SectionsMetabox.php (modified) (2 diffs)
-
lib/Foodlist/Project/WordPress/Plugin/Foodlist/Admin/Metabox/MenuSection/ItemsMetabox.php (modified) (1 diff)
-
lib/Foodlist/Project/WordPress/Plugin/Foodlist/Admin/Metabox/MenuSection/UserNoteMetabox.php (added)
-
lib/Foodlist/Project/WordPress/Plugin/Foodlist/Generic/PostType/MenuSectionPostType.php (modified) (1 diff)
-
lib/Foodlist/Project/WordPress/Plugin/Foodlist/Manager.php (modified) (1 diff)
-
plugin.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
foodlist/trunk/assets/css/admin.css
r938796 r1094156 168 168 position: relative; 169 169 } 170 171 #fl-user-note { 172 width: 98%; 173 } -
foodlist/trunk/assets/js/admin.js
r938796 r1094156 3 3 4 4 var api; 5 5 6 var entityMap = { 7 "&": "&", 8 "<": "<", 9 ">": ">", 10 '"': '"', 11 "'": ''', 12 "/": '/' 13 }; 14 15 function escapeHtml(string) { 16 return String(string).replace(/[&<>"'\/]/g, function (s) { 17 return entityMap[s]; 18 }); 19 } 20 6 21 api = { 7 22 init: function() { … … 166 181 //minimumInputLength: 1, 167 182 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; }, 168 192 ajax: { 169 193 url: ajaxurl, … … 190 214 }).on('change', function(e){ 191 215 //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>' : ''); 193 217 $('#fl-menu-sortable-list').append($(html)); 194 218 -
foodlist/trunk/assets/js/menu-manager.js
r940771 r1094156 270 270 271 271 appendTitle : function(widget) { 272 /* 272 273 var title = $('input[id*="-title"]', widget).val() || ''; 273 274 … … 277 278 $(widget).children('.widget-top').children('.widget-title').children() 278 279 .children('.in-widget-title').html(title); 279 280 */ 280 281 }, 281 282 -
foodlist/trunk/lib/Artprima/WordPress/API/Wrapper/Admin/Metabox/Metabox.php
r792818 r1094156 143 143 * 'attachment' or 'custom_post_type' where custom_post_type is the custom post type slug) 144 144 * 145 * @param type $postType146 * @return \Artprima\WordPress\API\Wrapper\Admin\Metabox 145 * @param string $screen 146 * @return \Artprima\WordPress\API\Wrapper\Admin\Metabox\Metabox 147 147 */ 148 148 public function setScreen($screen) -
foodlist/trunk/lib/Foodlist/Project/WordPress/Plugin/Foodlist/Admin/Ajax/Manager/Base.php
r938796 r1094156 107 107 'id' => $post->ID, 108 108 'text' => get_the_title($post), 109 'note' => get_post_meta($post->ID, '_fl_menu_section_note', true), 109 110 ); 110 111 } -
foodlist/trunk/lib/Foodlist/Project/WordPress/Plugin/Foodlist/Admin/Menu/MenuManager.php
r940771 r1094156 55 55 if (!$multi_number) { 56 56 $multi_number = '1'; 57 } 58 59 $note = get_post_meta($postId, '_fl_menu_section_note', true); 60 if ($note) { 61 $note = '('.esc_html($note).')'; 57 62 } 58 63 … … 61 66 <div class="widget-top"> 62 67 <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> 64 69 </div> 65 70 </div> -
foodlist/trunk/lib/Foodlist/Project/WordPress/Plugin/Foodlist/Admin/Metabox/Menu/SectionsMetabox.php
r938796 r1094156 89 89 $template = ' 90 90 <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> 92 92 <div class="fl-menu-sortable-item-remove dashicons dashicons-no"></div> 93 93 <input type="hidden" name="fl_menu[sections][]" value="%s" /> … … 95 95 '; 96 96 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]">'; 98 98 if (!empty($sections) && is_array($sections)) { 99 99 foreach ($sections as $instance) { 100 100 list($postId, $instanceId) = $this->parseInstanceStr($instance); 101 101 $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); 103 107 } 104 108 } -
foodlist/trunk/lib/Foodlist/Project/WordPress/Plugin/Foodlist/Admin/Metabox/MenuSection/ItemsMetabox.php
r938796 r1094156 135 135 } 136 136 137 if (! current_user_can('edit_post')) {137 if (!@current_user_can('edit_post')) { 138 138 return; 139 139 } -
foodlist/trunk/lib/Foodlist/Project/WordPress/Plugin/Foodlist/Generic/PostType/MenuSectionPostType.php
r938796 r1094156 52 52 53 53 // metaboxes 54 $metabox = new Metabox\MenuSection\UserNoteMetabox(); 55 $metabox->init(); 56 54 57 $metabox = new Metabox\MenuSection\ItemsMetabox(); 55 58 $metabox->init(); -
foodlist/trunk/lib/Foodlist/Project/WordPress/Plugin/Foodlist/Manager.php
r974538 r1094156 85 85 public function getPluginUrl() 86 86 { 87 return $this->pluginUrl;87 return $this->pluginUrl; 88 88 } 89 89 -
foodlist/trunk/plugin.php
r986946 r1094156 6 6 Author: Artprima 7 7 Author URI: http://artprima.eu/ 8 Version: 1. 9.18 Version: 1.10 9 9 */ 10 10 11 define('FOODLIST_VERSION', '1. 9.1');11 define('FOODLIST_VERSION', '1.10'); 12 12 define('FOODLIST_MIN_PHP_VERSION', '5.3.3'); 13 define('FOODLIST_MIN_WP_VERSION', '3. 4.0');13 define('FOODLIST_MIN_WP_VERSION', '3.6.0'); 14 14 15 15 if (version_compare(PHP_VERSION, FOODLIST_MIN_PHP_VERSION, '<')) { -
foodlist/trunk/readme.txt
r986946 r1094156 47 47 == ChangeLog == 48 48 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 49 53 = Version 1.9.1 = 50 54 * Tested up to WordPress 4.0 (no changes)
Note: See TracChangeset
for help on using the changeset viewer.