Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5ca8312
commit 0bb7cd0
Showing
21 changed files
with
473 additions
and
70 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
@import "../../style/less/mixins"; | ||
|
||
.orange { | ||
color: @mainColor !important; | ||
.views { | ||
overflow-y: hidden; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
var appFunc = require('../utils/appFunc'), | ||
service = require('./service'), | ||
template = require('./comment.tpl.html'), | ||
popupTpl = require('./commentPopup.tpl.html'); | ||
|
||
var commentModule = { | ||
init: function(){ | ||
this.getComments(); | ||
}, | ||
getComments: function(){ | ||
service.getComments(function(c){ | ||
var random = Math.floor(Math.random()*2); | ||
if(!random) c = null; | ||
|
||
setTimeout(function(){ | ||
var renderData = { | ||
comments: c, | ||
rtime: function(){ | ||
return appFunc.timeFormat(this.time); | ||
} | ||
}; | ||
var output = appFunc.renderTpl(template, renderData); | ||
$$('#commentContent').html(output); | ||
},1500); | ||
}); | ||
}, | ||
commentPopup: function(params){ | ||
var renderData = { | ||
comment: i18n.timeline.comment | ||
}; | ||
|
||
if(params.name){ | ||
renderData.title = i18n.comment.reply_comment; | ||
renderData.placeholder = i18n.comment.reply + '@' + params.name + ':'; | ||
}else { | ||
renderData.title = i18n.timeline.comment; | ||
renderData.placeholder = i18n.comment.placeholder; | ||
} | ||
|
||
var output = appFunc.renderTpl(popupTpl, renderData); | ||
hiApp.popup(output); | ||
|
||
var bindings = [{ | ||
element:'#commentBtn', | ||
event: 'click', | ||
handler: commentModule.sendComment | ||
}]; | ||
|
||
appFunc.bindEvents(bindings); | ||
}, | ||
sendComment: function(){ | ||
var text = $$('#commentText').val(); | ||
|
||
if(appFunc.getCharLength(text) < 4){ | ||
hiApp.alert(i18n.index.err_text_too_short); | ||
return false; | ||
} | ||
|
||
hiApp.showPreloader(i18n.comment.commenting); | ||
|
||
setTimeout(function(){ | ||
hiApp.hidePreloader(); | ||
hiApp.closeModal('.comment-popup'); | ||
|
||
//Refresh comment content | ||
},1500); | ||
}, | ||
createActionSheet: function(){ | ||
var replyName = $$(this).find('.comment-detail .name').html(); | ||
var buttons1 = [ | ||
{ | ||
text: i18n.comment.reply_comment, | ||
bold: true, | ||
onClick:function(){ | ||
commentModule.commentPopup({name:replyName}); | ||
} | ||
}, | ||
{ | ||
text: i18n.comment.copy_comment , | ||
bold: true | ||
} | ||
]; | ||
var buttons2 = [ | ||
{ | ||
text: i18n.global.cancel, | ||
color: 'red' | ||
} | ||
]; | ||
|
||
var groups = [buttons1, buttons2]; | ||
hiApp.actions(groups); | ||
} | ||
}; | ||
|
||
module.exports = commentModule; |
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{{#each comments}} | ||
<li class="comment-item"> | ||
<div class="avatar"> | ||
<img src="http://lorempixel.com/68/68/people/{{avatar}}/" alt=""> | ||
</div> | ||
<div class="comment-detail"> | ||
<div class="name">{{name}}</div> | ||
<div class="text">{{text}}</div> | ||
<div class="time">{{rtime}}</div> | ||
</div> | ||
</li> | ||
{{else}} | ||
<div class="none-comment"> | ||
<i class="icon ios7-chatboxes-outline"></i> | ||
<p>{{t i18n="i18n.comment.empty_comment"}}</p> | ||
</div> | ||
{{/each}} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<div class="popup comment-popup"> | ||
<div class="view navbar-fixed"> | ||
<div class="page"> | ||
<div class="navbar"> | ||
<div class="navbar-inner"> | ||
<div class="left"><a href="#" class="link close-popup">{{t i18n="global.cancel"}}</a></div> | ||
<div class="center">{{title}}</div> | ||
<div class="right"><a id="commentBtn" href="#" class="link color-orange">{{t i18n="global.send"}}</a></div> | ||
</div> | ||
</div> | ||
<div class="page-content message-content"> | ||
|
||
<div class="message-input"> | ||
<textarea id="commentText" placeholder="{{placeholder}}"></textarea> | ||
</div> | ||
|
||
<div class="message-tools"> | ||
<ul> | ||
<li><i class="icon ios7-emotion"></i></li> | ||
<li><i class="icon ios7-at-outline"></i></li> | ||
</ul> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
</div> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
var xhr = require('../utils/xhr'); | ||
|
||
module.exports = { | ||
getComments: function(callback) { | ||
xhr.simpleCall({ | ||
func: 'comments' | ||
}, function (res) { | ||
callback(res.data); | ||
}); | ||
} | ||
}; |
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
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
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
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
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
Oops, something went wrong.