Hey so at the present moment i am trying to setup a listing where a user can dictate the length in which a service can provided for. So for example Joe blogs will off 24 hour technical support for a person sharetribe open source installation, for say 3 weeks, for $100 for that period of time. Is there away to make this clear during the listing phase.
Do we have to edit the unit_listing.rb file, and change
class ListingUnit < ApplicationRecord
belongs_to :listing_shape
validates :unit_type, inclusion: ['hour', 'day', 'night', 'week', 'month', 'custom'] -# do we change this row?
validates :kind, inclusion: ['time', 'quantity']
validates :name_tr_key, presence: true, if: proc { unit_type == 'custom' }
validates :selector_tr_key, presence: true, if: proc { unit_type == 'custom' }
validates :quantity_selector, inclusion: [nil, '', 'none', 'number', 'day', 'night'] # in the future include :hour, :week:,:month
def to_unit_hash
{
unit_type: unit_type,
kind: kind,
quantity_selector: quantity_selector,
name_tr_key: name_tr_key,
selector_tr_key: selector_tr_key
}
end
def self.permitted_attributes(unit)
HashUtils.compact(unit.slice(:unit_type, :quantity_selector, :kind, :name_tr_key, :selector_tr_key))
end
end
i am also trying to work out what name_tr_key, selector_tr_key and quantity_selectors are. Or maybe someone can point in the right direction to find some resources on this.
Regards,
Joshua