kanbanworkflowstimelinescrumrubyroadmapproject-planningproject-managementopenprojectangularissue-trackerifcgantt-chartganttbug-trackerboardsbcf
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.9 KiB
60 lines
1.9 KiB
10 years ago
|
#-- copyright
|
||
10 years ago
|
# OpenProject Costs Plugin
|
||
10 years ago
|
#
|
||
10 years ago
|
# Copyright (C) 2009 - 2014 the OpenProject Foundation (OPF)
|
||
10 years ago
|
#
|
||
|
# This program is free software; you can redistribute it and/or
|
||
|
# modify it under the terms of the GNU General Public License
|
||
10 years ago
|
# version 3.
|
||
10 years ago
|
#
|
||
|
# This program is distributed in the hope that it will be useful,
|
||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
# GNU General Public License for more details.
|
||
|
#
|
||
|
# You should have received a copy of the GNU General Public License
|
||
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
#++
|
||
|
|
||
|
require 'roar/decorator'
|
||
10 years ago
|
require 'roar/json/hal'
|
||
10 years ago
|
|
||
|
module API
|
||
|
module V3
|
||
10 years ago
|
module Budgets
|
||
|
class BudgetRepresenter < Roar::Decorator
|
||
10 years ago
|
include Roar::JSON::HAL
|
||
|
include Roar::Hypermedia
|
||
10 years ago
|
include OpenProject::StaticRouting::UrlHelpers
|
||
|
|
||
|
self.as_strategy = API::Utilities::CamelCasingStrategy.new
|
||
|
|
||
|
def initialize(model, options = {}, *expand)
|
||
|
@expand = expand
|
||
|
|
||
|
super(model)
|
||
|
end
|
||
|
|
||
|
property :_type, exec_context: :decorator
|
||
|
|
||
|
property :id, render_nil: true
|
||
|
property :project_id
|
||
10 years ago
|
property :project_name, getter: -> (*) { project.try(:name) }
|
||
10 years ago
|
property :subject, render_nil: true
|
||
|
property :description, render_nil: true
|
||
|
property :type, render_nil: true
|
||
10 years ago
|
property :fixed_date, getter: -> (*) { created_on.utc.iso8601 }, render_nil: true
|
||
|
property :created_at, getter: -> (*) { created_on.utc.iso8601 }, render_nil: true
|
||
|
property :updated_at, getter: -> (*) { updated_on.utc.iso8601 }, render_nil: true
|
||
10 years ago
|
|
||
10 years ago
|
property :author, embedded: true, class: ::User, decorator: ::API::V3::Users::UserRepresenter, if: -> (*) { !author.nil? }
|
||
10 years ago
|
|
||
|
def _type
|
||
10 years ago
|
'Budget'
|
||
10 years ago
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|