微信课程名
This commit is contained in:
parent
3624d9d4ca
commit
5b61396410
|
@ -23,6 +23,8 @@ module Mobile
|
||||||
(number_to_human_size(f.filesize)).gsub("ytes", "").to_s
|
(number_to_human_size(f.filesize)).gsub("ytes", "").to_s
|
||||||
when :coursename
|
when :coursename
|
||||||
f.course.nil? ? "" : f.course.name
|
f.course.nil? ? "" : f.course.name
|
||||||
|
when :syllabus_title
|
||||||
|
f.course.nil? ? "" : f.course.syllabus.nil? ? "" : f.course.syllabus.title
|
||||||
when :course_id
|
when :course_id
|
||||||
f.course.nil? ? 0 : f.course.id
|
f.course.nil? ? 0 : f.course.id
|
||||||
|
|
||||||
|
@ -40,6 +42,7 @@ module Mobile
|
||||||
attachment_expose :file_dir
|
attachment_expose :file_dir
|
||||||
attachment_expose :attafile_size
|
attachment_expose :attafile_size
|
||||||
attachment_expose :coursename #所属班级名
|
attachment_expose :coursename #所属班级名
|
||||||
|
attachment_expose :syllabus_title #所属班级名
|
||||||
attachment_expose :course_id #所属班级名
|
attachment_expose :course_id #所属班级名
|
||||||
expose :current_user_is_teacher, if: lambda { |instance, options| options[:user] } do |instance, options|
|
expose :current_user_is_teacher, if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||||
current_user = options[:user]
|
current_user = options[:user]
|
||||||
|
|
|
@ -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))
|
(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
|
elsif field == :member_count
|
||||||
::Course===c ? c.members.count : 0
|
::Course===c ? c.members.count : 0
|
||||||
elsif field == :syllabus_title
|
|
||||||
c.syllabus.nil? ? "":c.syllabus.title
|
|
||||||
else
|
else
|
||||||
(c[field] if (c.is_a?(Hash) && c.key?(field))) || (c.send(field) if c.respond_to?(field))
|
(c[field] if (c.is_a?(Hash) && c.key?(field))) || (c.send(field) if c.respond_to?(field))
|
||||||
end
|
end
|
||||||
|
@ -40,7 +38,6 @@ module Mobile
|
||||||
course_expose :lft
|
course_expose :lft
|
||||||
course_expose :location
|
course_expose :location
|
||||||
course_expose :name
|
course_expose :name
|
||||||
course_expose :syllabus_title
|
|
||||||
course_expose :open_student
|
course_expose :open_student
|
||||||
# course_expose :password
|
# course_expose :password
|
||||||
course_expose :rgt
|
course_expose :rgt
|
||||||
|
|
|
@ -19,6 +19,8 @@ module Mobile
|
||||||
case field
|
case field
|
||||||
when :coursename
|
when :coursename
|
||||||
f.course.nil? ? "" : f.course.name
|
f.course.nil? ? "" : f.course.name
|
||||||
|
when :syllabus_title
|
||||||
|
f.course.nil? ? "" : f.course.syllabus.nil? ? "" : f.course.syllabus.title
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -27,6 +29,7 @@ module Mobile
|
||||||
expose :exercise_name
|
expose :exercise_name
|
||||||
expose :exercise_description
|
expose :exercise_description
|
||||||
exercise_expose :coursename #所属班级名
|
exercise_expose :coursename #所属班级名
|
||||||
|
exercise_expose :syllabus_title
|
||||||
|
|
||||||
expose :current_user_is_teacher, if: lambda { |instance, options| options[:user] } do |instance, options|
|
expose :current_user_is_teacher, if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||||
current_user = options[:user]
|
current_user = options[:user]
|
||||||
|
|
|
@ -39,6 +39,8 @@ module Mobile
|
||||||
val
|
val
|
||||||
when :coursename
|
when :coursename
|
||||||
f.course.nil? ? "" : f.course.name
|
f.course.nil? ? "" : f.course.name
|
||||||
|
when :syllabus_title
|
||||||
|
f.course.nil? ? "" : f.course.syllabus.nil? ? "" : f.course.syllabus.title
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -49,6 +51,8 @@ module Mobile
|
||||||
#课程名称
|
#课程名称
|
||||||
homework_expose :course_name
|
homework_expose :course_name
|
||||||
|
|
||||||
|
homework_expose :syllabus_title
|
||||||
|
|
||||||
homework_expose :course_id
|
homework_expose :course_id
|
||||||
#作业发布者
|
#作业发布者
|
||||||
expose :author,using: Mobile::Entities::User do |f, opt|
|
expose :author,using: Mobile::Entities::User do |f, opt|
|
||||||
|
|
|
@ -22,6 +22,10 @@ module Mobile
|
||||||
else
|
else
|
||||||
u.project.name
|
u.project.name
|
||||||
end
|
end
|
||||||
|
when :syllabus_title
|
||||||
|
if u.board.project_id == -1
|
||||||
|
u.course.syllabus.nil? ? "" : u.course.syllabus.title
|
||||||
|
end
|
||||||
when :lasted_comment
|
when :lasted_comment
|
||||||
time_from_now u.created_on
|
time_from_now u.created_on
|
||||||
when :praise_count
|
when :praise_count
|
||||||
|
@ -50,6 +54,7 @@ module Mobile
|
||||||
message_expose :act_type
|
message_expose :act_type
|
||||||
message_expose :act_id
|
message_expose :act_id
|
||||||
message_expose :course_project_name
|
message_expose :course_project_name
|
||||||
|
message_expose :syllabus_title
|
||||||
message_expose :board_id
|
message_expose :board_id
|
||||||
message_expose :subject
|
message_expose :subject
|
||||||
message_expose :title
|
message_expose :title
|
||||||
|
|
|
@ -26,6 +26,11 @@ module Mobile
|
||||||
f.id
|
f.id
|
||||||
when :comment_count
|
when :comment_count
|
||||||
f.comments.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
|
||||||
end
|
end
|
||||||
elsif f.is_a?(::Comment)
|
elsif f.is_a?(::Comment)
|
||||||
|
@ -89,6 +94,7 @@ module Mobile
|
||||||
news_expose :praise_count
|
news_expose :praise_count
|
||||||
#课程名字
|
#课程名字
|
||||||
news_expose :course_name
|
news_expose :course_name
|
||||||
|
news_expose :syllabus_title
|
||||||
news_expose :lasted_comment
|
news_expose :lasted_comment
|
||||||
|
|
||||||
#评论
|
#评论
|
||||||
|
|
|
@ -30,6 +30,8 @@ module Mobile
|
||||||
wh.journals_for_messages.count
|
wh.journals_for_messages.count
|
||||||
when :course_name
|
when :course_name
|
||||||
wh.course.name
|
wh.course.name
|
||||||
|
when :syllabus_title
|
||||||
|
wh.course.syllabus.nil? ? "" : wh.course.syllabus.title
|
||||||
when :act_type
|
when :act_type
|
||||||
'HomeworkCommon'
|
'HomeworkCommon'
|
||||||
when :act_id
|
when :act_id
|
||||||
|
@ -65,6 +67,7 @@ module Mobile
|
||||||
whomework_expose :act_type
|
whomework_expose :act_type
|
||||||
whomework_expose :act_id
|
whomework_expose :act_id
|
||||||
whomework_expose :course_name
|
whomework_expose :course_name
|
||||||
|
whomework_expose :syllabus_title
|
||||||
whomework_expose :created_at
|
whomework_expose :created_at
|
||||||
whomework_expose :absence_penalty
|
whomework_expose :absence_penalty
|
||||||
whomework_expose :evaluation_start
|
whomework_expose :evaluation_start
|
||||||
|
|
Loading…
Reference in New Issue