more admin cleanups

This commit is contained in:
John Bintz 2010-01-14 16:03:28 -05:00
parent f95f9b9673
commit 99afbd9ee8
2 changed files with 11 additions and 1 deletions

View File

@ -70,6 +70,7 @@ class PostFixtures {
function admin_enqueue_scripts($hook_suffix) { function admin_enqueue_scripts($hook_suffix) {
if ($this->hook_suffix == $hook_suffix) { if ($this->hook_suffix == $hook_suffix) {
wp_enqueue_script('jquery'); wp_enqueue_script('jquery');
wp_enqueue_style('post-fixtures', plugin_dir_url(dirname(__FILE__)) . 'style.css');
} }
} }

View File

@ -11,13 +11,22 @@
<input type="hidden" name="pf[_nonce]" value="<?php echo wp_create_nonce('post-fixtures') ?>" /> <input type="hidden" name="pf[_nonce]" value="<?php echo wp_create_nonce('post-fixtures') ?>" />
<h3><?php _e('JSON data to load into the database:', 'post-fixtures') ?></h3> <h3><?php _e('JSON data to load into the database:', 'post-fixtures') ?></h3>
<textarea name="pf[data]" rows="20" style="width: 100%"></textarea> <textarea name="pf[data]" rows="20" style="width: 100%"></textarea>
<label style="margin: 5px 0; display: block"> <label>
<input type="checkbox" name="pf[is_ok]" value="yes" /> <?php _e('Yes, I want Post Fixtures to <strong>delete all of my data and load this data instead.</strong>', 'post-fixtures') ?><br /> <input type="checkbox" name="pf[is_ok]" value="yes" /> <?php _e('Yes, I want Post Fixtures to <strong>delete all of my data and load this data instead.</strong>', 'post-fixtures') ?><br />
</label> </label>
<div id="post-fixtures-additional-options">
</div>
<input type="submit" value="Load Provided Data" /> <input type="submit" value="Load Provided Data" />
</form> </form>
<script type="text/javascript"> <script type="text/javascript">
(function($) { (function($) {
$('input[name*=is_ok]').change(function() {
$('#post-fixtures-additional-options')[$('input[name*=is_ok]:checked').val() ? 'show' : 'hide'](250);
});
$('#post-fixtures-additional-options').hide();
$('input[name*=is_ok]').get(0).checked = false;
$('#post-fixtures-form').submit(function() { $('#post-fixtures-form').submit(function() {
var checkbox = $('input[name*=is_ok]', this.target).get(0); var checkbox = $('input[name*=is_ok]', this.target).get(0);
var ok = false var ok = false