Skip to content

Commit

Permalink
Handling new link situations
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewhayward committed Jan 17, 2013
1 parent c7b7a40 commit 66ddc71
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions shortbread/shortbread.php
Expand Up @@ -318,9 +318,10 @@ function admin_description () {
// No description
}

function admin_link_box ($post) {
$url = $this->get_short_url('link', $post->link_id);
echo '<input type="text" value="'.$url.'" readonly="readonly" style="width: 100%;">';
function admin_link_box ($link) {
if ($link->link_id) {
$url = $this->get_short_url('link', $link->link_id);
echo '<input type="text" value="'.$url.'" readonly="readonly" style="width: 100%;">';
?><script>
(function($) {
var $box = $('#<?php echo self::$_domain; ?>_link_meta_box'),
Expand All @@ -336,6 +337,9 @@ function admin_link_box ($post) {
}
})(jQuery);
</script><?php
} else {
echo '<p>Short URL will be generated on creation.</p>';
}
}

protected function create_input ($key, $attributes=array(), $type='text', $description='') {
Expand Down

0 comments on commit 66ddc71

Please sign in to comment.