Add mode setting and tooltips

This commit is contained in:
Brian Miyaji
2015-01-22 10:01:43 +11:00
parent cabc1bc90e
commit 1936387bd9
8 changed files with 156 additions and 101 deletions

View File

@@ -392,10 +392,15 @@ table.widefat.sp-sortable-table tbody tr .icon {
}
/* TipTip */
.tips {
.sp-tip,
.sp-desc-tip {
cursor: help;
}
.sp-desc-tip:before {
color: #aaa;
}
#tiptip_holder {
display: none;
position: absolute;
@@ -575,7 +580,7 @@ table.sp-modules-table [class^="sp-icon-"],
table.sp-modules-table [class*=" sp-icon-"],
table.sp-modules-table .dashicons {
position: relative;
top: 3px;
top: 2px;
left: -0.5px;
line-height: 1;
}
@@ -615,11 +620,11 @@ table.sp-modules-table .sp-module-unavailable label .dashicons {
outline: 0;
}
table.sp_status_table td mark {
table.sp-status-table td mark {
background: transparent none;
}
table.sp_status_table td mark.yes {
table.sp-status-table td mark.yes {
color: #7ad03a;
}
@@ -661,6 +666,72 @@ table.sp_status_table td mark.yes {
color: #f00;
}
/* Welcome Screen */
.about-sportspress-wrap .sp-welcome-logo {
display: inline;
}
.about-sportspress-wrap .sp-about-text {
min-height: 0;
margin-right: 165px;
}
.about-sportspress-wrap .sp-badge {
float: right;
background: #00cac4 url(../images/welcome/sp-badge.png) no-repeat center top;
text-rendering: optimizeLegibility;
padding-top: 10px;
height: 150px;
width: 150px;
font-size: 14px;
line-height: 1.75;
text-align: center;
font-weight: 600;
color: #c4fffc;
margin: 5px 0 0 0;
-webkit-box-shadow: 0 1px 3px rgba(0,0,0,.2);
box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.about-sportspress-wrap .sportspress-actions .twitter-share-button {
margin-top: -3px;
margin-left: 3px;
vertical-align: middle;
}
.about-sportspress-wrap .sp-feature {
overflow: visible !important;
*zoom:1;
}
.about-sportspress-wrap .sp-feature:before,
.about-sportspress-wrap .sp-feature:after {
content: " ";
display: table;
}
.about-sportspress-wrap .sp-feature:after {
clear: both;
}
.about-sportspress-wrap div.icon {
width: 0 !important;
padding: 0;
margin: 0;
}
.about-sportspress-wrap .sp-feature div.icon:before {
font-family: sportspress !important;
font-weight: normal;
width: 100%;
font-size: 170px;
line-height: 125px;
color: #9c5d90;
display: inline-block;
position: relative;
text-align: center;
speak: none;
margin: <?php echo is_rtl() ? '0 -100px 0 0' : '0 0 0 -100px'; ?>;
content: "\f111";
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.about-sportspress-wrap .form-table th {
width: auto;
}
/* Media Queries */
@media only screen and (max-width: 850px) {
.sp-modules-wrapper {
@@ -696,4 +767,18 @@ table.sp_status_table td mark.yes {
table.sp-modules-table td .button {
margin: -3px -7px -3px 10px;
}
}
}
@media only screen and (max-width: 600px) {
.about-sportspress-wrap .sp-welcome-logo,
.about-sportspress-wrap .sp-about-text {
display: block;
text-align: center;
margin-right: 0;
padding-right: 0;
}
.about-sportspress-wrap .sp-badge {
float: none;
margin: 20px auto 10px;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@@ -1,11 +1,17 @@
jQuery(document).ready(function($){
// Tiptip
$(".tips").tipTip({
$(".sp-tip").tipTip({
delay: 200,
fadeIn: 100,
fadeOut: 100
});
$(".sp-desc-tip").tipTip({
delay: 200,
fadeIn: 100,
fadeOut: 100,
defaultPosition: 'right'
});
// Chosen select
$(".chosen-select, #poststuff #post_author_override").chosen({
@@ -459,6 +465,11 @@ jQuery(document).ready(function($){
// Trigger player list layout change
$(".post-type-sp_list #post-formats-select input.post-format").trigger("change");
// Auto-select hides options
$(".sp-select-setting").change(function() {
$(".sp-select-options").toggle("manual"==$(this).val());
});
// Configure primary result option (Ajax)
$(".sp-admin-config-table").on("click", ".sp-primary-result-option", function() {
$.post( ajaxurl, {

View File

@@ -224,7 +224,9 @@ class SP_Admin_Settings {
if ( $description && in_array( $value['type'], array( 'textarea', 'radio' ) ) ) {
$description = '<p style="margin-top:0">' . wp_kses_post( $description ) . '</p>';
} elseif ( $description && in_array( $value['type'], array( 'checkbox' ) ) ) {
$description = wp_kses_post( $description );
$description = wp_kses_post( $description );
} elseif ( $description && in_array( $value['type'], array( 'select' ) ) ) {
$description = '<p class="description">' . wp_kses_post( $description ) . '</p>';
} elseif ( $description ) {
$description = '<span class="description">' . wp_kses_post( $description ) . '</span>';
}
@@ -235,7 +237,7 @@ class SP_Admin_Settings {
} elseif ( $tip ) {
$tip = '<img class="help_tip" data-tip="' . esc_attr( $tip ) . '" src="' . SP()->plugin_url() . '/assets/images/help.png" height="16" width="16" />';
$tip = '<i class="dashicons dashicons-editor-help sp-desc-tip" title="' . esc_attr( $tip ) . '" />';
}

View File

@@ -85,82 +85,6 @@ class SP_Admin_Welcome {
remove_submenu_page( 'index.php', 'sp-about' );
remove_submenu_page( 'index.php', 'sp-credits' );
remove_submenu_page( 'index.php', 'sp-translators' );
// Badge for welcome page
$badge_url = SP()->plugin_url() . '/assets/images/welcome/sp-badge.png';
?>
<style type="text/css">
/*<![CDATA[*/
.about-sportspress-wrap .sp-about-text {
min-height: 0;
}
.about-sportspress-wrap .sp-badge {
position: absolute;
top: 0;
right: 0;
background: #00cac4 url(<?php echo $badge_url; ?>) no-repeat center top;
text-rendering: optimizeLegibility;
padding-top: 10px;
height: 150px;
width: 150px;
font-size: 14px;
line-height: 1.75;
text-align: center;
font-weight: 600;
color: #c4fffc;
margin: 5px 0 0 0;
-webkit-box-shadow: 0 1px 3px rgba(0,0,0,.2);
box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.about-sportspress-wrap .sportspress-actions .twitter-share-button {
margin-top: -3px;
margin-left: 3px;
vertical-align: middle;
}
.about-sportspress-wrap .sp-feature {
overflow: visible !important;
*zoom:1;
}
.about-sportspress-wrap .sp-feature:before,
.about-sportspress-wrap .sp-feature:after {
content: " ";
display: table;
}
.about-sportspress-wrap .sp-feature:after {
clear: both;
}
.about-sportspress-wrap div.icon {
width: 0 !important;
padding: 0;
margin: 0;
}
.about-sportspress-wrap .sp-feature div.icon:before {
font-family: sportspress !important;
font-weight: normal;
width: 100%;
font-size: 170px;
line-height: 125px;
color: #9c5d90;
display: inline-block;
position: relative;
text-align: center;
speak: none;
margin: <?php echo is_rtl() ? '0 -100px 0 0' : '0 0 0 -100px'; ?>;
content: "\f111";
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.about-sportspress-wrap .form-table th {
width: auto;
}
@media only screen and (max-width: 500px) {
.about-sportspress-wrap h1 {
padding-top: 240px;
}
}
/*]]>*/
</style>
<?php
}
/**
@@ -178,7 +102,9 @@ class SP_Admin_Welcome {
// Drop minor version if 0
$major_version = substr( SP()->version, 0, 3 );
?>
<h1><?php printf( __( 'Welcome to SportsPress %s', 'sportspress' ), $major_version ); ?></h1>
<h2 class="sp-welcome-logo"><?php echo apply_filters( 'sportspress_logo', '<img src="' . plugin_dir_url( SP_PLUGIN_FILE ) . '/assets/images/welcome/sportspress' . ( class_exists( 'SportsPress_Pro' ) ? '-pro' : '' ) . '.png" alt="' . __( 'SportsPress', 'sportspress' ) . '">' ); ?></h2>
<div class="sp-badge"><?php printf( __( 'Version %s', 'sportspress' ), SP()->version ); ?></div>
<div class="about-text sp-about-text">
<?php
@@ -193,8 +119,6 @@ class SP_Admin_Welcome {
?>
</div>
<div class="sp-badge"><?php printf( __( 'Version %s', 'sportspress' ), SP()->version ); ?></div>
<p class="sportspress-actions">
<a href="<?php echo admin_url( add_query_arg( array( 'page' => 'sportspress', 'tab' => 'general' ), 'admin.php' ) ); ?>" class="button button-primary"><?php _e( 'Settings', 'sportspress' ); ?></a>
<a href="<?php echo esc_url( apply_filters( 'sportspress_docs_url', 'http://sportspresspro.com/docs/', 'sportspress' ) ); ?>" class="docs button button-primary"><?php _e( 'Docs', 'sportspress' ); ?></a>
@@ -242,6 +166,9 @@ class SP_Admin_Welcome {
</div>
<?php
endif;
if ( isset( $_POST['sportspress_mode'] ) ):
update_option( 'sportspress_mode', $_POST['sportspress_mode'] );
endif;
if ( isset( $_POST['add_sample_data'] ) ):
SP_Admin_Sample_Data::delete_posts();
SP_Admin_Sample_Data::insert_posts();
@@ -264,7 +191,12 @@ class SP_Admin_Welcome {
endforeach;
echo $sport;
?>
<a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'sportspress', 'tab' => 'general' ), 'admin.php' ) ) ); ?>"><div class="dashicons dashicons-edit"></div><?php _e( 'Change', 'sportspress' ); ?></a>
<a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'sportspress', 'tab' => 'general' ), 'admin.php' ) ) ); ?>"><i class="dashicons dashicons-edit"></i> <?php _e( 'Change', 'sportspress' ); ?></a>
<h4><?php _e( 'Mode', 'sportspress' ); ?></h4>
<?php echo ( 'team' == get_option( 'sportspress_mode', 'team' ) ? __( 'Teams', 'sportspress' ) : __( 'Players', 'sportspress' ) ); ?>
<a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'sportspress', 'tab' => 'general' ), 'admin.php' ) ) ); ?>"><i class="dashicons dashicons-edit"></i> <?php _e( 'Change', 'sportspress' ); ?></a>
<h4><?php _e( 'Next Steps', 'sportspress' ); ?></h4>
<p><?php _e( 'We&#8217;ve assembled some links to get you started:', 'sportspress' ); ?></p>
<div class="sportspress-steps">
@@ -285,7 +217,7 @@ class SP_Admin_Welcome {
<tbody>
<tr valign="top">
<th scope="row" class="titledesc">
<label for="timezone_string"><?php _e( 'Timezone', 'sportspress' ); ?></label>
<label for="timezone_string"><?php _e( 'Timezone', 'sportspress' ); ?> <i class="dashicons dashicons-editor-help sp-desc-tip" title="<?php _e( 'Choose a city in the same timezone as you.', 'sportspress' ); ?>"></i></label>
</th>
<td>
<select id="timezone_string" name="timezone_string" class="<?php echo $class; ?>">
@@ -315,15 +247,29 @@ class SP_Admin_Welcome {
</tr>
<?php
$sport_options = SP_Admin_Sports::get_preset_options();
$settings = array( array(
'id' => 'sportspress_sport',
'default' => 'custom',
'type' => 'sport',
'title' => __( 'Sport', 'sportspress' ),
'welcome' => true,
'class' => $class,
'options' => $sport_options,
));
$settings = array(
array(
'id' => 'sportspress_sport',
'default' => 'custom',
'type' => 'sport',
'title' => __( 'Sport', 'sportspress' ),
'welcome' => true,
'class' => $class,
'options' => $sport_options,
),
array(
'title' => __( 'Mode', 'sportspress' ),
'id' => 'sportspress_mode',
'default' => 'team',
'type' => 'select',
'options' => array(
'team' => __( 'Teams', 'sportspress' ),
'player' => __( 'Players', 'sportspress' ),
),
'desc_tip' => _x( 'Who competes in events?', 'mode setting description', 'sportspress' ),
),
);
SP_Admin_Settings::output_fields( $settings );
?>
</tbody>

View File

@@ -57,6 +57,18 @@ class SP_Settings_General extends SP_Settings_Page {
'options' => $presets,
),
array(
'title' => __( 'Mode', 'sportspress' ),
'id' => 'sportspress_mode',
'default' => 'team',
'type' => 'select',
'options' => array(
'team' => __( 'Teams', 'sportspress' ),
'player' => __( 'Players', 'sportspress' ),
),
'desc_tip' => _x( 'Who competes in events?', 'mode setting description', 'sportspress' ),
),
array(
'title' => __( 'Google Maps', 'sportspress' ),
'id' => 'sportspress_map_type',
@@ -269,14 +281,13 @@ class SP_Settings_General extends SP_Settings_Page {
?>
<tr valign="top">
<th scope="row" class="titledesc">
<label for="timezone_string"><?php _e( 'Timezone', 'sportspress' ); ?></label>
<label for="timezone_string"><?php _e( 'Timezone', 'sportspress' ); ?> <i class="dashicons dashicons-editor-help sp-desc-tip" title="<?php _e( 'Choose a city in the same timezone as you.', 'sportspress' ); ?>"></i></label>
</th>
<td class="forminp">
<legend class="screen-reader-text"><span><?php _e( 'Timezone', 'sportspress' ); ?></span></legend>
<select id="timezone_string" name="timezone_string" class="<?php echo $class; ?>">
<?php echo wp_timezone_choice($tzstring); ?>
</select>
<p class="description"><?php _e( 'Choose a city in the same timezone as you.', 'sportspress' ); ?></p>
</td>
</tr>
<?php

View File

@@ -46,7 +46,7 @@ $common[ __( 'Position', 'sportspress' ) ] = implode( ', ', $position_names );
$data = array_merge( $metrics_before, $common, $metrics_after );
if ( 'teams' == get_option( 'sportspress_mode', 'teams' ) ) {
if ( 'team' == get_option( 'sportspress_mode', 'team' ) ) {
if ( $current_teams ):
$teams = array();
foreach ( $current_teams as $team ):