Skip to content

Commit

Permalink
Hide topic type and status selects if there's only one option.
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Tadlock committed Feb 2, 2015
1 parent 15faf35 commit e745640
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions js/board.js
Expand Up @@ -39,6 +39,20 @@ jQuery( document ).ready( function() {

/* === Topic Form === */

/* Count the number of options in the topic type and status selects. */
var mb_topic_type_options = jQuery( 'select#mb_topic_type option' ).length;
var mb_topic_status_options = jQuery( 'select#mb_post_status option' ).length;

/* If no more than one topic type option, hide the select. */
if ( 1 >= mb_topic_type_options ) {
jQuery( 'select#mb_topic_type' ).closest( '.mb-form-type' ).hide();
}

/* If no more than one topic status option, hide the select. */
if ( 1 >= mb_topic_status_options ) {
jQuery( 'select#mb_post_status' ).closest( '.mb-form-status' ).hide();
}

/* Get the topic title and content. */
var mb_topic_title = jQuery( '#mb-topic-form input[name="mb_topic_title"]' ).attr( 'value' );
var mb_topic_content = jQuery( '#mb-topic-form textarea[name="mb_topic_content"]' ).val();
Expand Down

0 comments on commit e745640

Please sign in to comment.