Merge branch 'weixin_guange' of https://git.trustie.net/jacknudt/trustieforge into weixin_guange
This commit is contained in:
commit
4dbc619fc5
|
@ -24,6 +24,7 @@ module Mobile
|
|||
if (feedback.errors.empty?)
|
||||
homework_common.update_attributes(:updated_at => Time.now)
|
||||
data = homework_common.journals_for_messages.last
|
||||
present :data, data, with: Mobile::Entities::Jours
|
||||
result = 2
|
||||
else
|
||||
result = 3
|
||||
|
@ -81,7 +82,9 @@ module Mobile
|
|||
is_jour.notes = params[:content]
|
||||
is_jour.journalized = issue
|
||||
#is_jour.journalized_type = "Issue"
|
||||
if issue.journals << is_jour
|
||||
if is_jour.save
|
||||
data = is_jour
|
||||
present :data, data, with: Mobile::Entities::Journal
|
||||
result = 2
|
||||
else
|
||||
result = 3
|
||||
|
@ -110,7 +113,6 @@ module Mobile
|
|||
else
|
||||
result = 4
|
||||
end
|
||||
present :data, data, with: Mobile::Entities::Jours
|
||||
present :result, result
|
||||
present :status, 0
|
||||
end
|
||||
|
|
|
@ -27,7 +27,7 @@ module Mobile
|
|||
elsif ac.act_type == "Message" || ac.act_type == "BlogComment" || ac.act_type == "JournalsForMessage"
|
||||
ac.nil? || ac.act.nil? ? 0 : ac.act.children.count
|
||||
elsif ac.act_type == "Issue"
|
||||
ac.nil? || ac.act.nil? ? 0 : ac.act.journals.where("notes != null").count
|
||||
ac.nil? || ac.act.nil? ? 0 : ac.act.journals.where("notes is not null and notes != ''").count
|
||||
end
|
||||
when :subject
|
||||
if ac.act_type == "HomeworkCommon"
|
||||
|
|
|
@ -23,9 +23,11 @@ module Mobile
|
|||
when :issue_status
|
||||
IssueStatus.find(issue.status_id).name
|
||||
when :journals_count
|
||||
issue.journals.where("notes != null").count
|
||||
issue.journals.where("notes is not null and notes != ''").count
|
||||
when :project_name
|
||||
issue.project.name
|
||||
when :issue_praise_count
|
||||
get_activity_praise_num(issue)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -41,9 +43,10 @@ module Mobile
|
|||
issue_expose :issue_status
|
||||
issue_expose :journals_count
|
||||
issue_expose :project_name
|
||||
issue_expose :issue_praise_count
|
||||
expose :issue_journals, using: Mobile::Entities::Journal do |f, opt|
|
||||
if f.is_a?(::Issue)
|
||||
f.journals.where("notes != null")
|
||||
f.journals.where("notes is not null and notes != ''")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
module Mobile
|
||||
module Entities
|
||||
class Journal <Grape::Entity
|
||||
include Redmine::I18n
|
||||
=begin
|
||||
include Redmine::I18n
|
||||
include ApplicationHelper
|
||||
|
@ -16,7 +17,7 @@ module Entities
|
|||
elsif journal.is_a?(::Journal)
|
||||
if journal.respond_to?(f)
|
||||
if f == :created_on
|
||||
format_time(journal.send(f))
|
||||
time_from_now(journal.send(f))
|
||||
else
|
||||
journal.send(f)
|
||||
end
|
||||
|
@ -34,7 +35,6 @@ module Entities
|
|||
|
||||
expose :notes
|
||||
journal_expose :created_on
|
||||
journal_expose :last_created_time
|
||||
expose :user,using: Mobile::Entities::User do |f, opt|
|
||||
f.user
|
||||
end
|
||||
|
|
|
@ -213,7 +213,7 @@
|
|||
<! } !>
|
||||
<! } !>
|
||||
<! if ((count + page * 10) < all_count) {!>
|
||||
<div id="more_activities" class="more-events mt10" onclick="loadDataFromServer(868, <!= page+1 !>);">更多</div>
|
||||
<div id="more_activities" class="more-events mt10" onclick="loadDataFromServer(8686, <!= page+1 !>);">更多</div>
|
||||
<! } !>
|
||||
</script>
|
||||
|
||||
|
|
|
@ -36,16 +36,17 @@
|
|||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="post-interactive border-bottom">
|
||||
<div class="post-interactive-column c-grey2">回复 <span class="reply-num">(<!=issues.journals_count!>)</span></div>
|
||||
<div class="post-interactive-column c-grey2"><span class="paise-text">赞</span> <span class="praise-num">()</span></div>
|
||||
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">(<!=issues.journals_count!>)</span></div>
|
||||
<div class="post-interactive-praise c-grey2"><span class="paise-text">赞</span> <span class="praise-num">(<!=issues.issue_praise_count!>)</span></div>
|
||||
</div>
|
||||
<! for(var j =0; j < issues.issue_journals.length; ++j){ !>
|
||||
<div id="all_issue_reply">
|
||||
<! for(var j = (issues.issue_journals.length -1); j >= 0; --j){ !>
|
||||
<div class="post-reply-wrap border-bottom">
|
||||
<div class="post-reply-row">
|
||||
<div class="post-reply-avatar fl"><img src="<!=issues.issue_journals[j].user.img_url!>" width="45" height="45" class="border-radius" /></div>
|
||||
<div class="ml55">
|
||||
<div class="post-reply-user hidden"><!=issues.issue_journals[j].user.realname!></div>
|
||||
<div class="post-reply-content c-grey2 mb10"><!:=issue.issue_journals[j].notes!></div>
|
||||
<div class="post-reply-content c-grey2 mb10"><!:=issues.issue_journals[j].notes!></div>
|
||||
<div class="post-reply-date fl"><!=issues.issue_journals[j].created_on!></div>
|
||||
<div class="post-reply-trigger fr undis">回复</div>
|
||||
</div>
|
||||
|
@ -53,6 +54,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<! } !>
|
||||
</div>
|
||||
<div class="post-input-wrap">
|
||||
<div class="post-reply-row">
|
||||
<!--<div class="post-reply-avatar fl"><img src="images/post-avatar.jpg" width="30" height="30" /></div>-->
|
||||
|
@ -65,6 +67,20 @@
|
|||
</div>
|
||||
</script>
|
||||
|
||||
<script id="t:issue-detail-reply" type="text/html">
|
||||
<div class="post-reply-wrap border-bottom">
|
||||
<div class="post-reply-row">
|
||||
<div class="post-reply-avatar fl"><img src="<!=issue_reply.user.img_url!>" width="45" height="45" class="border-radius" /></div>
|
||||
<div class="ml55">
|
||||
<div class="post-reply-user hidden"><!=issue_reply.user.realname!></div>
|
||||
<div class="post-reply-content c-grey2 mb10"><!:=issue_reply.notes!></div>
|
||||
<div class="post-reply-date fl"><!=issue_reply.created_on!></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script src="/javascripts/jquery-1.3.2.js"></script>
|
||||
<script src="/javascripts/baiduTemplate.js"></script>
|
||||
<script src="/javascripts/wechat/issue_detail.js"></script>
|
||||
|
|
|
@ -80,7 +80,6 @@ $(document).ready(function(){
|
|||
url: apiUrl + 'new_comment/' + homeworkID, //提交的页面,方法名
|
||||
data: userInfo, //参数,如果没有,可以为null
|
||||
success: function (data) { //如果执行成功,那么执行此方法
|
||||
alert(data.result); //用data.d来获取后台传过来的json语句,或者是单纯的语句
|
||||
setReplyTemplate(data.data);
|
||||
},
|
||||
error: function (err) { //如果执行不成功,那么执行此方法
|
||||
|
|
|
@ -13,12 +13,19 @@ $(document).ready(function(){
|
|||
|
||||
var apiUrl = '/api/v1/';
|
||||
|
||||
var setReplyTemplate = function(data){
|
||||
console.log(data);
|
||||
var html=bt('t:issue-detail-reply',{issue_reply: data});
|
||||
$('#all_issue_reply').prepend(html);
|
||||
};
|
||||
|
||||
|
||||
var setTemplate = function(data){
|
||||
console.log(data);
|
||||
var html=bt('t:issue-detail',{issues: data});
|
||||
$('#issue-container').prepend(html);
|
||||
$('.post-reply-submit').click(function(){
|
||||
replyInsert();
|
||||
IssueReplyInsert();
|
||||
});
|
||||
/*$('post-interactive-praise').click(function(){
|
||||
praiseClick();
|
||||
|
@ -42,22 +49,22 @@ $(document).ready(function(){
|
|||
|
||||
};
|
||||
|
||||
var homeworkUrl = window.location.search;
|
||||
var homeworkID = homeworkUrl.split("=")[1];
|
||||
var IssueUrl = window.location.search;
|
||||
var IssueID = IssueUrl.split("=")[1];
|
||||
|
||||
loadDataFromServer(homeworkID);
|
||||
loadDataFromServer(IssueID);
|
||||
|
||||
//点击回复按钮,插入回复内容
|
||||
var replyInsert = function(){
|
||||
var IssueReplyInsert = function(){
|
||||
var replyContent = $("#postInput").val();
|
||||
if (!replyContent){
|
||||
alert("请输入回复");
|
||||
}else{
|
||||
|
||||
//将用户输入内容插入最后一条回复
|
||||
$(".post-reply-wrap:last").after('<div class="post-reply-wrap border-bottom"><div class="post-reply-row"><div class="post-reply-avatar fl"><img src="images/post-avatar.jpg" width="45" height="45" /></div><div class="ml55"><div class="post-reply-user hidden">Mrs. Ashford</div><div class="post-reply-content c-grey2 mb10"></div><div class="post-reply-date fl"></div><div class="post-reply-trigger fr undis">回复</div></div><div class="cl"></div></div> </div>');
|
||||
/*$(".post-reply-wrap:last").after('<div class="post-reply-wrap border-bottom"><div class="post-reply-row"><div class="post-reply-avatar fl"><img src="images/post-avatar.jpg" width="45" height="45" /></div><div class="ml55"><div class="post-reply-user hidden">Mrs. Ashford</div><div class="post-reply-content c-grey2 mb10"></div><div class="post-reply-date fl"></div><div class="post-reply-trigger fr undis">回复</div></div><div class="cl"></div></div> </div>');
|
||||
$(".post-reply-content:last").append(replyContent);
|
||||
$(".post-reply-date:last").append(Date());
|
||||
$(".post-reply-date:last").append(Date());*/
|
||||
var postInput = $("#postInput").val();
|
||||
$("#postInput").val("");
|
||||
//回复数目+1
|
||||
|
@ -74,10 +81,10 @@ $(document).ready(function(){
|
|||
$.ajax({
|
||||
type: "POST", //提交方式
|
||||
dataType: "json", //类型
|
||||
url: apiUrl + 'new_comment/' + homeworkID, //提交的页面,方法名
|
||||
url: apiUrl + 'new_comment/' + IssueID, //提交的页面,方法名
|
||||
data: userInfo, //参数,如果没有,可以为null
|
||||
success: function (data) { //如果执行成功,那么执行此方法
|
||||
alert(data.result); //用data.d来获取后台传过来的json语句,或者是单纯的语句
|
||||
setReplyTemplate(data.data);
|
||||
},
|
||||
error: function (err) { //如果执行不成功,那么执行此方法
|
||||
alert("err:" + err);
|
||||
|
|
Loading…
Reference in New Issue