Merge branch 'weixin_guange' of https://git.trustie.net/jacknudt/trustieforge into weixin_guange
This commit is contained in:
commit
572d84b55d
|
@ -7,8 +7,9 @@ module Mobile
|
|||
|
||||
desc "get special topic"
|
||||
get ':id' do
|
||||
user = UserWechat.find_by_openid(params[:openid]).user
|
||||
blog = BlogComment.find params[:id]
|
||||
present :data, blog, with: Mobile::Entities::BlogComment
|
||||
present :data, blog, with: Mobile::Entities::BlogComment,user: user
|
||||
present :status, 0
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,8 +8,9 @@ module Mobile
|
|||
|
||||
desc "get special issuse"
|
||||
get ':id' do
|
||||
user = UserWechat.find_by_openid(params[:openid]).user
|
||||
issue = Issue.find params[:id]
|
||||
present :data, issue, with: Mobile::Entities::Issue
|
||||
present :data, issue, with: Mobile::Entities::Issue,user: user
|
||||
present :status, 0
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,8 +7,9 @@ module Mobile
|
|||
|
||||
desc "get special journal"
|
||||
get ':id' do
|
||||
user = UserWechat.find_by_openid(params[:openid]).user
|
||||
jour = JournalsForMessage.find params[:id]
|
||||
present :data, jour, with: Mobile::Entities::Jours
|
||||
present :data, jour, with: Mobile::Entities::Jours,user: user
|
||||
present :status, 0
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,8 +7,9 @@ module Mobile
|
|||
|
||||
desc "get special topic"
|
||||
get ':id' do
|
||||
user = UserWechat.find_by_openid(params[:openid]).user
|
||||
message = Message.find params[:id]
|
||||
present :data, message, with: Mobile::Entities::Message
|
||||
present :data, message, with: Mobile::Entities::Message,user: user
|
||||
present :status, 0
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,8 +7,9 @@ module Mobile
|
|||
|
||||
desc "get special news"
|
||||
get ':id' do
|
||||
user = UserWechat.find_by_openid(params[:openid]).user
|
||||
news = News.find params[:id]
|
||||
present :data, news, with: Mobile::Entities::News
|
||||
present :data, news, with: Mobile::Entities::News,user: user
|
||||
present :status, 0
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,8 +7,9 @@ module Mobile
|
|||
|
||||
desc "get one homework"
|
||||
get ':id' do
|
||||
user = UserWechat.find_by_openid(params[:openid]).user
|
||||
homework = HomeworkCommon.find params[:id]
|
||||
present :data, homework, with: Mobile::Entities::Whomework
|
||||
present :data, homework, with: Mobile::Entities::Whomework,user: user
|
||||
present :status, 0
|
||||
end
|
||||
end
|
||||
|
|
|
@ -131,8 +131,11 @@ module Mobile
|
|||
act_expose :course_project_name #课程/项目名字
|
||||
act_expose :activity_type_name #课程问答区/项目缺陷等
|
||||
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||
has_praise = false
|
||||
current_user = options[:user]
|
||||
false
|
||||
obj = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",instance.act_id,instance.act_type.to_s,current_user.id)
|
||||
has_praise = obj.empty? ? false : true
|
||||
has_praise
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -45,6 +45,13 @@ module Mobile
|
|||
c.children
|
||||
end
|
||||
end
|
||||
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||
has_praise = false
|
||||
current_user = options[:user]
|
||||
obj = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",instance.id,instance.class.to_s,current_user.id)
|
||||
has_praise = obj.empty? ? false : true
|
||||
has_praise
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -49,6 +49,13 @@ module Mobile
|
|||
f.journals.where("notes is not null and notes != ''")
|
||||
end
|
||||
end
|
||||
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||
has_praise = false
|
||||
current_user = options[:user]
|
||||
obj = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",instance.id,instance.class.to_s,current_user.id)
|
||||
has_praise = obj.empty? ? false : true
|
||||
has_praise
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -51,6 +51,13 @@ module Mobile
|
|||
f.children
|
||||
end
|
||||
end
|
||||
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||
has_praise = false
|
||||
current_user = options[:user]
|
||||
obj = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",instance.id,instance.class.to_s,current_user.id)
|
||||
has_praise = obj.empty? ? false : true
|
||||
has_praise
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -52,6 +52,13 @@ module Mobile
|
|||
c.children
|
||||
end
|
||||
end
|
||||
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||
has_praise = false
|
||||
current_user = options[:user]
|
||||
obj = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",instance.id,instance.class.to_s,current_user.id)
|
||||
has_praise = obj.empty? ? false : true
|
||||
has_praise
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -73,8 +73,13 @@ module Mobile
|
|||
f.send(:comments)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||
has_praise = false
|
||||
current_user = options[:user]
|
||||
obj = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",instance.id,instance.class.to_s,current_user.id)
|
||||
has_praise = obj.empty? ? false : true
|
||||
has_praise
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -67,6 +67,13 @@ module Mobile
|
|||
f.journals_for_messages
|
||||
end
|
||||
end
|
||||
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||
has_praise = false
|
||||
current_user = options[:user]
|
||||
obj = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",instance.id,instance.class.to_s,current_user.id)
|
||||
has_praise = obj.empty? ? false : true
|
||||
has_praise
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -16,7 +16,8 @@
|
|||
</div>
|
||||
<div class="post-interactive border-bottom">
|
||||
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{blog.comments_count}})</span></div>
|
||||
<div class="post-interactive-praise c-grey2"><span class="paise-text">赞</span> <span class="praise-num">({{blog.blog_praise_count}})</span></div>
|
||||
<div class="post-interactive-column c-grey2" ng-if="blog.has_praise" ng-click="addPraise(blog);">已赞 ({{blog.blog_praise_count}})</div>
|
||||
<div class="post-interactive-column c-grey2" ng-if="!blog.has_praise">赞 ({{blog.blog_praise_count}})</div>
|
||||
</div>
|
||||
<div id="all_blog_reply">
|
||||
<div class="post-reply-wrap border-bottom" ng-repeat="journal in blog.blog_comment_children">
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
</div>
|
||||
<div class="post-interactive border-bottom">
|
||||
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{discussion.replies_count}})</span></div>
|
||||
<div class="post-interactive-praise c-grey2"><span class="paise-text"> 赞 </span><span class="praise-num">({{discussion.message_praise_count}})</span></div>
|
||||
<div class="post-interactive-column c-grey2" ng-if="discussion.has_praise" ng-click="addPraise(discussion);">已赞 ({{discussion.message_praise_count}})</div>
|
||||
<div class="post-interactive-column c-grey2" ng-if="!discussion.has_praise">赞 ({{discussion.message_praise_count}})</div>
|
||||
</div>
|
||||
<div id="all_course_message_reply">
|
||||
<div class="post-reply-wrap border-bottom" ng-repeat="journal in discussion.message_children">
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
</div>
|
||||
<div class="post-interactive border-bottom">
|
||||
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{news.comments_count}})</span></div>
|
||||
<div class="post-interactive-praise c-grey2"><span class="paise-text"> 赞 </span><span class="praise-num">({{news.news_praise_count}})</span></div>
|
||||
<div class="post-interactive-column c-grey2" ng-if="news.has_praise" ng-click="addPraise(news);">已赞 ({{news.news_praise_count}})</div>
|
||||
<div class="post-interactive-column c-grey2" ng-if="!news.has_praise">赞 ({{news.news_praise_count}})</div>
|
||||
</div>
|
||||
<div id="all_news_reply">
|
||||
<div class="post-reply-wrap border-bottom" ng-repeat="comments in news.comments">
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
</div>
|
||||
<div class="post-interactive border-bottom">
|
||||
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{homework.whomework_journal_count}})</span></div>
|
||||
<div class="post-interactive-praise c-grey2"><span class="paise-text"> 赞 </span><span class="praise-num">({{homework.whomework_praise_count}})</span></div>
|
||||
<div class="post-interactive-column c-grey2" ng-if="homework.has_praise" ng-click="addPraise(homework);">已赞 ({{homework.whomework_praise_count}})</div>
|
||||
<div class="post-interactive-column c-grey2" ng-if="!homework.has_praise">赞 ({{homework.whomework_praise_count}})</div>
|
||||
</div>
|
||||
<div id="all_homework_reply">
|
||||
<div class="post-reply-wrap border-bottom" ng-repeat="journal in homework.journals_for_messages">
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
</div>
|
||||
<div class="post-interactive border-bottom">
|
||||
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{issue.journals_count}})</span></div>
|
||||
<div class="post-interactive-praise c-grey2"><span class="paise-text">赞</span> <span class="praise-num">({{issue.issue_praise_count}})</span></div>
|
||||
<div class="post-interactive-column c-grey2" ng-if="!issue.has_praise" ng-click="addPraise(issue);">已赞 ({{issue.issue_praise_count}})</div>
|
||||
<div class="post-interactive-column c-grey2" ng-if="issue.has_praise">赞 ({{issue.issue_praise_count}})</div>
|
||||
</div>
|
||||
<div id="all_issue_reply">
|
||||
<div class="post-reply-wrap border-bottom" ng-repeat="journal in issue.issue_journals">
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
</div>
|
||||
<div class="post-interactive border-bottom">
|
||||
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{message.reply_count}})</span></div>
|
||||
<div class="post-interactive-praise c-grey2"><span class="paise-text">赞</span> <span class="praise-num">({{message.message_praise_count}})</span></div>
|
||||
<div class="post-interactive-column c-grey2" ng-if="message.has_praise" ng-click="addPraise(message);">已赞 ({{message.message_praise_count}})</div>
|
||||
<div class="post-interactive-column c-grey2" ng-if="!message.has_praise">赞 ({{message.message_praise_count}})</div>
|
||||
</div>
|
||||
<div id="all_message_reply">
|
||||
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
</div>
|
||||
<div class="post-interactive border-bottom">
|
||||
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{discussion.replies_count}})</span></div>
|
||||
<div class="post-interactive-praise c-grey2"><span class="paise-text"> 赞 </span><span class="praise-num">({{discussion.message_praise_count}})</span></div>
|
||||
<div class="post-interactive-column c-grey2" ng-if="discussion.has_praise" ng-click="addPraise(discussion);">已赞 ({{discussion.message_praise_count}})</div>
|
||||
<div class="post-interactive-column c-grey2" ng-if="!discussion.has_praise">赞 ({{discussion.message_praise_count}})</div>
|
||||
</div>
|
||||
<div id="all_course_message_reply">
|
||||
<div class="post-reply-wrap border-bottom" ng-repeat="journal in discussion.message_children">
|
||||
|
|
Loading…
Reference in New Issue