git の練習

0.6.18 で playback-order が実装されました。
ので、以下のようなことはしないでねー.

git の練習に remedie をいじることにしてみました。
ローカルリポジトリにコミットしたのはこんなん。

commit 29d6f303d1eb077b27414ca6335d4631f7b2ddec
Author: yujiorama <yujiorama@mac-mini.local>
Date:   Sat Aug 22 21:52:59 2009 +0900

    add toggle item list order

diff --git a/lib/Remedie/DB/Channel.pm b/lib/Remedie/DB/Channel.pm
index da0597f..fb8cff2 100644
--- a/lib/Remedie/DB/Channel.pm
+++ b/lib/Remedie/DB/Channel.pm
@@ -17,9 +17,13 @@ sub items {
     my @query = (channel_id => $self->id);
     push @query, status => $opts{status} if $opts{status} && @{$opts{status}} > 0;
 
+    my $sort_by = "id DESC";
+    if ($opts{order}) {
+        $sort_by = "id $opts{order}";
+    }
     return Remedie::DB::Item::Manager->get_items(
         query => \@query,
-        sort_by => 'id DESC',
+        sort_by => $sort_by,
         $opts{limit} ? (limit => $opts{limit}) : (),
     );
 }
diff --git a/lib/Remedie/Server/RPC/Channel.pm b/lib/Remedie/Server/RPC/Channel.pm
index 3213a85..765cf1e 100644
--- a/lib/Remedie/Server/RPC/Channel.pm
+++ b/lib/Remedie/Server/RPC/Channel.pm
@@ -101,6 +101,7 @@ sub show {
         items   => $channel->items(
             limit  => scalar $req->param('limit'),
             status => [ map _enum_status($_), $req->param('status') ],
+            order => $req->param('order'),
         ),
     };
 }
diff --git a/root/static/js/remedie.js b/root/static/js/remedie.js
index 5bd67e2..1ddf9da 100644
--- a/root/static/js/remedie.js
+++ b/root/static/js/remedie.js
@@ -1038,6 +1038,8 @@ Remedie.prototype = {
     if (want < 0) want = channels.length - 1;
     return channels[want];
   },
+  
+  order: "desc",
 
   showChannel: function(channel, opts) {
     if (!channel) return;
@@ -1052,7 +1054,7 @@ Remedie.prototype = {
     $.ajax({
       url: "/rpc/channel/show",
       type: 'get',
-      data: { id: channel.id, limit: (opts.all ? 0 : 50), status: (opts.unwatched ? [ 'new', 'downloaded' ] : 0) },
+      data: { id: channel.id, limit: (opts.all ? 0 : 50), status: (opts.unwatched ? [ 'new', 'downloaded' ] : 0), order: remedie.order },
       dataType: 'json',
       success: function(r) {
         $.unblockUI();
@@ -1070,6 +1072,10 @@ Remedie.prototype = {
               'img', { src: "/static/images/feed_256x256.png", alt: channel.name }, null
             ],
             'div', { className: 'channel-header-infobox', style: 'width: ' + ($(window).width()-220) + 'px' }, [
+              'div', { className: 'channel-header-order' }, [
+                'a', { href: "#channel/" + channel.id,  className: "item-order" },
+                   remedie.order
+              ],
               'div', { className: 'channel-header-nextprev' }, [
                 'ul', { className: 'inline' }, [
                   'li', { className: 'first' }, [
@@ -1101,8 +1107,14 @@ Remedie.prototype = {
         if (channel.props.thumbnail)
           RemedieUtil.layoutImage($("#channel-pane .channel-header-thumbnail img"), channel.props.thumbnail.url, 128, 96);
 
+        $("#channel-pane .item-order").click(function(){
+          remedie.order = (remedie.order == "desc") ? "asc" : "desc";
+          jQuery(this).html(remedie.order);
+          remedie.showChannel(channel);
+        });
         $("#channel-pane .prev-channel").click(function(){remedie.showChannel(prevChannel)});
         $("#channel-pane .next-channel").click(function(){remedie.showChannel(nextChannel)});
+        
 
         $("#channel-pane").createAppend(
           'div', { id: 'channel-items', className: "clear" }, null

Remedie - フィードを古い順に連続再生したい - komagataのブログ のアイデアを流しただけ。
github で人のコードをいじる「前」にforkする必要はない - Bulknews::Subtech - subtechでは「無闇に fork するの意味ない」というようなことも言われてるので、ローカルで十分です。