Created
December 27, 2011 19:34
-
-
Save anvie/1524891 to your computer and use it in GitHub Desktop.
Armin Code Correction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/js/coffee/Channel.coffee b/js/coffee/Channel.coffee | |
index 1fd7a05..a0b61b4 100755 | |
--- a/js/coffee/Channel.coffee | |
+++ b/js/coffee/Channel.coffee | |
@@ -546,14 +546,18 @@ dg.channel.gsChannelMore = (ctl, elm_id) -> | |
, {'show_loading':false} | |
### | |
-Get similar channel a.k.a CYML | |
+Get similar channel a.k.a CYML. | |
+@INFO{armin}: semua operasi yg menggunakan static html element lebih baik taruh di pages/* | |
@param user_id -- {String} ID of user. | |
@param channel_id -- {String} ID of channel. | |
@param elm -- {HTMLElement} placeholder. | |
### | |
dg.channel.getSimilarChannels = (user_id, channel_id, elm)-> | |
dg.utils.jsonp (digaku.config['dgai_host'] + '/channels/similar'), {'user_id': user_id, 'channel_id': channel_id, 'limit': 3}, (d)-> | |
- elm.innerHTML = dg.tmpl.similarChannels( 'data': d['result'] ) | |
+ if d['result'].length == 0 | |
+ goog.style.showElement($ge('SimilarChannels')) | |
+ else | |
+ elm.innerHTML = dg.tmpl.similarChannels( 'channels': d['result'] ) | |
return | |
return | |
diff --git a/js/coffee/pages/channel.coffee b/js/coffee/pages/channel.coffee | |
index e00bf87..4a82d8c 100644 | |
--- a/js/coffee/pages/channel.coffee | |
+++ b/js/coffee/pages/channel.coffee | |
@@ -102,8 +102,14 @@ window['buildMainLayout'] = ()-> | |
# add channel suggestions | |
user_id = digaku.session.user.id | |
channel_id = current_channel['id'] | |
+ | |
log.info("user_id, channel_id: " + user_id + ", " + channel_id) | |
- dg.channel.getSimilarChannels(user_id, channel_id, $ge('similar-channels-content')) | |
+ | |
+ dg.utils.jsonp (digaku.config['dgai_host'] + '/channels/similar'), {'user_id': user_id, 'channel_id': channel_id, 'limit': 3}, (d)-> | |
+ if d['result'].length == 0 | |
+ goog.style.showElement($ge('SimilarChannels')) | |
+ else | |
+ $ge('SimilarChannelsContent').innerHTML = dg.tmpl.similarChannels( 'channels': d['result'] ) | |
ChannelTaggerApp = spine['app']['startTagger']( | |
diff --git a/soys/channel.soy b/soys/channel.soy | |
index 8df9139..06f46c1 100644 | |
--- a/soys/channel.soy | |
+++ b/soys/channel.soy | |
@@ -3,13 +3,13 @@ | |
/** | |
* Similar channels template. | |
* | |
- * @param data | |
+ * @param channels -- {List} of channels. | |
*/ | |
{template .similarChannels} | |
<ul class="{css sug-list}" style="width: 185px; overflow: hidden;"> | |
-{foreach $d in $data} | |
- {call .similarChannelItem data="$d" /} | |
+{foreach $ch in $channels} | |
+ {call .similarChannelItem data="$ch" /} | |
{/foreach} | |
</ul> | |
{/template} | |
@@ -18,11 +18,11 @@ | |
/** | |
* Similar channel item template. | |
* | |
- * @param id | |
- * @param logo_small | |
- * @param name | |
- * @param creator | |
- * @param member_count | |
+ * @param id -- {String} ID of channel. | |
+ * @param logo_small -- {String} url to channel's logo small. | |
+ * @param name -- {String} channel's name. | |
+ * @param creator -- {User} channel's creator. | |
+ * @param member_count -- {Int} Channel's member count. | |
*/ | |
{template .similarChannelItem} | |
<li id="Channel-{$id |id}" style="width: 185px;" > | |
@@ -518,17 +518,20 @@ | |
</div> | |
</div> | |
- <div id="similar-channels" style="margin-top: 10px;"> | |
+ // @INFO{armin}: use Upper+Lower CamelCase for ID, see: http://developer.digaku.com/digaku/wiki/sop/technical/programming/css | |
+ <div id="SimilarChannels" style="margin-top: 10px;"> | |
<div class="{css clear-both}"></div> | |
<div class="{css colrad10}"> | |
<div class="{css padding10}"> | |
- <div class="judul_gray3" style="text-align: center;">Channel You Might Like</div> | |
+ <div class="judul_gray3" style="text-align: center;">{msg desc=""}Channel You Might Like{/msg}</div> | |
- <div id="similar-channels-content"> | |
- </div> | |
+ // @INFO{armin}: use Upper+Lower CamelCase for ID, see: http://developer.digaku.com/digaku/wiki/sop/technical/programming/css | |
+ <div id="SimilarChannelsContent"> | |
+ </div> | |
</div> | |
</div> | |
</div> | |
+ | |
</div> | |
{/template} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment