Permalink
Browse files

Handling new link situations

  • Loading branch information...
1 parent c7b7a40 commit 66ddc71dde9e3b176971ee25185ea17413a5e1e7 @andrewhayward committed Jan 17, 2013
Showing with 7 additions and 3 deletions.
  1. +7 −3 shortbread/shortbread.php
@@ -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'),
@@ -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='') {

0 comments on commit 66ddc71

Please sign in to comment.