2016-03-31 20:46:36 +08:00
|
|
|
module Mobile
|
|
|
|
module Entities
|
|
|
|
class Journal <Grape::Entity
|
2016-04-01 18:46:00 +08:00
|
|
|
=begin
|
2016-03-31 20:46:36 +08:00
|
|
|
include Redmine::I18n
|
|
|
|
include ApplicationHelper
|
|
|
|
include ApiHelper
|
2016-04-01 18:46:00 +08:00
|
|
|
include IssuesHelper
|
2016-03-31 20:46:36 +08:00
|
|
|
include ActionView::Helpers::TagHelper
|
2016-04-01 18:46:00 +08:00
|
|
|
include ActionView::Helpers::UrlHelper
|
|
|
|
=end
|
2016-03-31 20:46:36 +08:00
|
|
|
def self.journal_expose(f)
|
|
|
|
expose f do |journal, opt|
|
|
|
|
if journal.is_a?(Hash) && journal.key?(f)
|
|
|
|
journal[f]
|
|
|
|
elsif journal.is_a?(::Journal)
|
|
|
|
if journal.respond_to?(f)
|
|
|
|
if f == :created_on
|
|
|
|
format_time(journal.send(f))
|
|
|
|
else
|
|
|
|
journal.send(f)
|
|
|
|
end
|
|
|
|
else
|
|
|
|
case f
|
|
|
|
when :detail_journal
|
|
|
|
if journal.details.any?
|
2016-04-01 18:46:00 +08:00
|
|
|
details_to_strings(journal.details)
|
2016-03-31 20:46:36 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
expose :notes
|
|
|
|
journal_expose :created_on
|
2016-04-01 18:46:00 +08:00
|
|
|
#journal_expose :detail_journal
|
2016-03-31 20:46:36 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|