Changeset 41823
- Timestamp:
- 10/11/2017 05:27:05 AM (8 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
-
wp-admin/css/customize-nav-menus.css (modified) (1 diff)
-
wp-admin/js/customize-nav-menus.js (modified) (2 diffs)
-
wp-includes/class-wp-customize-nav-menus.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/customize-nav-menus.css
r41817 r41823 774 774 #accordion-section-add_menu { 775 775 margin: 15px 12px; 776 } 777 778 #accordion-section-add_menu h3 { 776 779 text-align: right; 777 780 } -
trunk/src/wp-admin/js/customize-nav-menus.js
r41768 r41823 1164 1164 var section = this, 1165 1165 container = section.container, 1166 contentContainer = section.contentContainer; 1166 contentContainer = section.contentContainer, 1167 navMenuSettingPattern = /^nav_menu\[/; 1167 1168 1168 1169 /* … … 1185 1186 } ); 1186 1187 1187 api.Section.prototype.attachEvents.apply( this, arguments ); 1188 /** 1189 * Get number of non-deleted nav menus. 1190 * 1191 * @since 4.9.0 1192 * @returns {number} Count. 1193 */ 1194 function getNavMenuCount() { 1195 var count = 0; 1196 api.each( function( setting ) { 1197 if ( navMenuSettingPattern.test( setting.id ) && false !== setting.get() ) { 1198 count += 1; 1199 } 1200 } ); 1201 return count; 1202 } 1203 1204 /** 1205 * Update visibility of notice to prompt users to create menus. 1206 * 1207 * @since 4.9.0 1208 * @returns {void} 1209 */ 1210 function updateNoticeVisibility() { 1211 container.find( '.add-new-menu-notice' ).prop( 'hidden', getNavMenuCount() > 0 ); 1212 } 1213 1214 /** 1215 * Handle setting addition. 1216 * 1217 * @since 4.9.0 1218 * @param {wp.customize.Setting} setting - Added setting. 1219 * @returns {void} 1220 */ 1221 function addChangeEventListener( setting ) { 1222 if ( navMenuSettingPattern.test( setting.id ) ) { 1223 setting.bind( updateNoticeVisibility ); 1224 updateNoticeVisibility(); 1225 } 1226 } 1227 1228 /** 1229 * Handle setting removal. 1230 * 1231 * @since 4.9.0 1232 * @param {wp.customize.Setting} setting - Removed setting. 1233 * @returns {void} 1234 */ 1235 function removeChangeEventListener( setting ) { 1236 if ( navMenuSettingPattern.test( setting.id ) ) { 1237 setting.unbind( updateNoticeVisibility ); 1238 updateNoticeVisibility(); 1239 } 1240 } 1241 1242 api.each( addChangeEventListener ); 1243 api.bind( 'add', addChangeEventListener ); 1244 api.bind( 'removed', removeChangeEventListener ); 1245 updateNoticeVisibility(); 1246 1247 api.Section.prototype.attachEvents.apply( section, arguments ); 1188 1248 }, 1189 1249 -
trunk/src/wp-includes/class-wp-customize-nav-menus.php
r41816 r41823 952 952 953 953 <script type="text/html" id="tmpl-nav-menu-create-menu-section-title"> 954 <p class="add-new-menu-notice"> 955 <?php _e( 'It doesn’t look like your site has any menus yet. Want to build one? Click the button to start.' ); ?> 956 </p> 957 <p class="add-new-menu-notice"> 958 <?php _e( 'You’ll create a menu, assign it a location, and add menu items like links to pages and categories. If your theme has multiple menu areas, you might need to create more than one.' ); ?> 959 </p> 954 960 <h3> 955 961 <button type="button" class="button customize-add-menu-button">
Note: See TracChangeset
for help on using the changeset viewer.