Merge branch 'weixin_guange' of https://git.trustie.net/jacknudt/trustieforge into weixin_guange

This commit is contained in:
Tim 2016-09-19 13:54:04 +08:00
commit abb3f942fa
7 changed files with 24 additions and 3 deletions

View File

@ -23,6 +23,8 @@ module Mobile
(number_to_human_size(f.filesize)).gsub("ytes", "").to_s
when :coursename
f.course.nil? ? "" : f.course.name
when :syllabus_title
f.course.nil? ? "" : f.course.syllabus.nil? ? "" : f.course.syllabus.title
when :course_id
f.course.nil? ? 0 : f.course.id
@ -40,6 +42,7 @@ module Mobile
attachment_expose :file_dir
attachment_expose :attafile_size
attachment_expose :coursename #所属班级名
attachment_expose :syllabus_title #所属班级名
attachment_expose :course_id #所属班级名
expose :current_user_is_teacher, if: lambda { |instance, options| options[:user] } do |instance, options|
current_user = options[:user]

View File

@ -19,8 +19,6 @@ module Mobile
(format_time(c[field]) if (c.is_a?(Hash) && c.key?(field))) || (format_time(c.send(field)) if c.respond_to?(field))
elsif field == :member_count
::Course===c ? c.members.count : 0
elsif field == :syllabus_title
c.syllabus.nil? ? "":c.syllabus.title
else
(c[field] if (c.is_a?(Hash) && c.key?(field))) || (c.send(field) if c.respond_to?(field))
end
@ -40,7 +38,6 @@ module Mobile
course_expose :lft
course_expose :location
course_expose :name
course_expose :syllabus_title
course_expose :open_student
# course_expose :password
course_expose :rgt

View File

@ -19,6 +19,8 @@ module Mobile
case field
when :coursename
f.course.nil? ? "" : f.course.name
when :syllabus_title
f.course.nil? ? "" : f.course.syllabus.nil? ? "" : f.course.syllabus.title
end
end
end
@ -27,6 +29,7 @@ module Mobile
expose :exercise_name
expose :exercise_description
exercise_expose :coursename #所属班级名
exercise_expose :syllabus_title
expose :current_user_is_teacher, if: lambda { |instance, options| options[:user] } do |instance, options|
current_user = options[:user]

View File

@ -39,6 +39,8 @@ module Mobile
val
when :coursename
f.course.nil? ? "" : f.course.name
when :syllabus_title
f.course.nil? ? "" : f.course.syllabus.nil? ? "" : f.course.syllabus.title
end
end
end
@ -49,6 +51,8 @@ module Mobile
#课程名称
homework_expose :course_name
homework_expose :syllabus_title
homework_expose :course_id
#作业发布者
expose :author,using: Mobile::Entities::User do |f, opt|

View File

@ -22,6 +22,10 @@ module Mobile
else
u.project.name
end
when :syllabus_title
if u.board.project_id == -1
u.course.syllabus.nil? ? "" : u.course.syllabus.title
end
when :lasted_comment
time_from_now u.created_on
when :praise_count
@ -50,6 +54,7 @@ module Mobile
message_expose :act_type
message_expose :act_id
message_expose :course_project_name
message_expose :syllabus_title
message_expose :board_id
message_expose :subject
message_expose :title

View File

@ -26,6 +26,11 @@ module Mobile
f.id
when :comment_count
f.comments.count
when :syllabus_title
unless f.course_id == nil
course = get_course(f.course_id)
course.syllabus.nil? ? "" : course.syllabus.title
end
end
end
elsif f.is_a?(::Comment)
@ -89,6 +94,7 @@ module Mobile
news_expose :praise_count
#课程名字
news_expose :course_name
news_expose :syllabus_title
news_expose :lasted_comment
#评论

View File

@ -30,6 +30,8 @@ module Mobile
wh.journals_for_messages.count
when :course_name
wh.course.name
when :syllabus_title
wh.course.syllabus.nil? ? "" : wh.course.syllabus.title
when :act_type
'HomeworkCommon'
when :act_id
@ -65,6 +67,7 @@ module Mobile
whomework_expose :act_type
whomework_expose :act_id
whomework_expose :course_name
whomework_expose :syllabus_title
whomework_expose :created_at
whomework_expose :absence_penalty
whomework_expose :evaluation_start