Skip to content

Commit

Permalink
Merge pull request #42 from x-team/all-activity
Browse files Browse the repository at this point in the history
Add All Activity Selector
  • Loading branch information
frankiejarrett committed Mar 21, 2014
2 parents 5ca2cd2 + 64fbc49 commit 5788e8f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
10 changes: 7 additions & 3 deletions includes/meta-boxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,18 +164,19 @@ public function metabox_content( $object, $section ) {
}

$data_types = array(
'all' => __( 'All Activity', 'stream-reports' ),
array(
'title' => __( 'Connector Activity', 'stream-report' ),
'title' => __( 'Connector Activity', 'stream-reports' ),
'group' => 'connector',
'options' => WP_Stream_Connectors::$term_labels['stream_connector'],
),
array(
'title' => __( 'Context Activity', 'stream-report' ),
'title' => __( 'Context Activity', 'stream-reports' ),
'group' => 'context',
'options' => WP_Stream_Connectors::$term_labels['stream_context'],
),
array(
'title' => __( 'Actions Activity', 'stream-report' ),
'title' => __( 'Actions Activity', 'stream-reports' ),
'group' => 'action',
'options' => WP_Stream_Connectors::$term_labels['stream_action'],
),
Expand Down Expand Up @@ -313,6 +314,9 @@ public function load_metabox_records( $args, $date_interval ) {
case 'action':
$query_args['action'] = $data_type;
break;
case 'other':
// all selector requires no query arg modifications
break;
default:
return array();
}
Expand Down
20 changes: 13 additions & 7 deletions views/meta-box.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,20 @@
<div class="inside">

<select class="chart-option chart-dataset">
<?php foreach ( $data_types as $section ) : ?>
<optgroup label="<?php echo esc_attr( $section['title'] ) ?>">
<?php foreach ( $section['options'] as $type => $text ) : ?>
<option data-group="<?php echo esc_attr( $section['group'] ) ?>" value="<?php echo esc_attr( $type ) ?>" <?php selected( $type === $data_type ) ?>>
<?php echo esc_html( $text ) ?>
<?php foreach ( $data_types as $section_key => $section ) : ?>
<?php if ( is_string( $section ) ) : ?>
<option data-group="other" value="<?php echo esc_attr( $section_key ) ?>" <?php selected( $section_key === $data_type ) ?>>
<?php echo esc_html( $section ) ?>
</option>
<?php endforeach; ?>
</optgroup>
<?php else : ?>
<optgroup label="<?php echo esc_attr( $section['title'] ) ?>">
<?php foreach ( $section['options'] as $type => $text ) : ?>
<option data-group="<?php echo esc_attr( $section['group'] ) ?>" value="<?php echo esc_attr( $type ) ?>" <?php selected( $type === $data_type ) ?>>
<?php echo esc_html( $text ) ?>
</option>
<?php endforeach; ?>
</optgroup>
<?php endif; ?>
<?php endforeach; ?>
</select>

Expand Down

0 comments on commit 5788e8f

Please sign in to comment.