fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-10-06 06:44 am

[dw-free] better shop workflow for renames

[commit: http://hg.dwscoalition.org/dw-free/rev/c611987401d5]

http://bugs.dwscoalition.org/show_bug.cgi?id=3098

Have a note linking to the base /rename/ page while the rename token is not
yet paid for. (Once paid for, the link will be to the actual token on the
rename page)

Patch by [personal profile] fu.

Files modified:
  • bin/upgrading/en.dat
  • cgi-bin/DW/Shop/Item.pm
  • cgi-bin/DW/Shop/Item/Rename.pm
  • cgi-bin/LJ/Widget/ShopCart.pm
--------------------------------------------------------------------------------
diff -r 91c6778b13fb -r c611987401d5 bin/upgrading/en.dat
--- a/bin/upgrading/en.dat	Tue Oct 05 10:25:55 2010 -0500
+++ b/bin/upgrading/en.dat	Wed Oct 06 14:44:16 2010 +0800
@@ -3618,6 +3618,8 @@ shop.item.points.name=[[num]] [[sitename
 
 shop.item.rename.canbeadded.invalidjournaltype=You can only send a rename token to a personal journal. To rename a community, have a community administrator use the token.
 
+shop.item.rename.note=Tokens can be used at the <a [[aopts]]>rename page</a>.
+
 shop.item.rename.name.notoken=[[points]] points for a Rename Token
 
 shop.item.rename.name.hastoken=Rename Token <a [[aopts]]>[[token]]</a>
diff -r 91c6778b13fb -r c611987401d5 cgi-bin/DW/Shop/Item.pm
--- a/cgi-bin/DW/Shop/Item.pm	Tue Oct 05 10:25:55 2010 -0500
+++ b/cgi-bin/DW/Shop/Item.pm	Wed Oct 06 14:44:16 2010 +0800
@@ -279,6 +279,18 @@ sub name_html {
     return $_[0]->name_text;
 }
 
+
+=head2 C<< $self->note >>
+
+Render a note to the user about this item.
+
+Subclasses may override to provide a brief note about this item.
+
+=cut
+
+sub note {
+    return "";
+}
 
 =head2 C<< $self->short_desc >>
 
diff -r 91c6778b13fb -r c611987401d5 cgi-bin/DW/Shop/Item/Rename.pm
--- a/cgi-bin/DW/Shop/Item/Rename.pm	Tue Oct 05 10:25:55 2010 -0500
+++ b/cgi-bin/DW/Shop/Item/Rename.pm	Wed Oct 06 14:44:16 2010 +0800
@@ -60,8 +60,17 @@ sub name_text {
 # override
 sub name_html {
     return $_[0]->token && $_[0]->from_userid == $_[0]->t_userid
-        ? LJ::Lang::ml( 'shop.item.rename.name.hastoken', { token => $_[0]->token, aopts => 'href="/rename/' . $_[0]->token . '"' } )
+        ? LJ::Lang::ml( 'shop.item.rename.name.hastoken', { token => $_[0]->token, aopts => "href='$LJ::SITEROOT/rename/" . $_[0]->token . "'" } )
         : LJ::Lang::ml( 'shop.item.rename.name.notoken', { points => $_[0]->cost_points } );
+}
+
+# override
+sub note {
+    # token is for ourselves, but currently unpaid for
+    return LJ::Lang::ml( 'shop.item.rename.note', { aopts => "href='$LJ::SITEROOT/rename/'" } )
+        if $_[0]->from_userid == $_[0]->t_userid && ! $_[0]->token;
+
+    return "";
 }
 
 # override
diff -r 91c6778b13fb -r c611987401d5 cgi-bin/LJ/Widget/ShopCart.pm
--- a/cgi-bin/LJ/Widget/ShopCart.pm	Tue Oct 05 10:25:55 2010 -0500
+++ b/cgi-bin/LJ/Widget/ShopCart.pm	Wed Oct 06 14:44:16 2010 +0800
@@ -75,7 +75,11 @@ sub render_body {
         } else {
             $ret .= "<td>" . $class->html_check( name => 'remove_' . $item->id, value => 1 ) . "</td>"
         }
-        $ret .= "<td>" . $item->name_html . "</td>";
+
+        $ret .= "<td>" . $item->name_html;
+        $ret .= "<p class='note'>" . $item->note . "</p>" if $item->note;
+        $ret .= "</td>";
+
         $ret .= "<td>" . ( $item->deliverydate ? $item->deliverydate : $class->ml( 'widget.shopcart.deliverydate.asap' ) ) . "</td>";
         $ret .= "<td>" . $item->t_html( admin => $opts{admin} ) . "</td>";
         $ret .= "<td>" . $item->from_html . "</td>";
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org