Merge branch 'szzh' of http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git into szzh
commit
2caf2ddf30
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,30 @@
|
|||||||
|
module Mobile
|
||||||
|
module Entities
|
||||||
|
class Comment < Grape::Entity
|
||||||
|
include Redmine::I18n
|
||||||
|
def self.comment_expose(field)
|
||||||
|
expose field do |f,opt|
|
||||||
|
if f.is_a?(Hash) && f.key?(field)
|
||||||
|
f[field]
|
||||||
|
elsif f.is_a?(::Comment)
|
||||||
|
if f.respond_to?(field)
|
||||||
|
if field == :created_on
|
||||||
|
format_time(f.send(field))
|
||||||
|
else
|
||||||
|
f.send(field)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
comment_expose :id
|
||||||
|
expose :author, using: Mobile::Entities::User do |c, opt|
|
||||||
|
if c.is_a? ::Comment
|
||||||
|
c.author
|
||||||
|
end
|
||||||
|
end
|
||||||
|
comment_expose :comments
|
||||||
|
comment_expose :created_on
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,16 @@
|
|||||||
|
module Mobile
|
||||||
|
module Entities
|
||||||
|
class CourseDynamic < Grape::Entity
|
||||||
|
def self.course_dynamic_expose(field)
|
||||||
|
expose field do |c,opt|
|
||||||
|
c[field] if (c.is_a?(Hash) && c.key?(field))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
course_dynamic_expose :type
|
||||||
|
course_dynamic_expose :count
|
||||||
|
course_dynamic_expose :course_name
|
||||||
|
course_dynamic_expose :course_id
|
||||||
|
course_dynamic_expose :course_img_url
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue