-
-
Save matthooks/5982056 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
window.SERVICES = <%= raw ActiveModel::ArraySerializer.new(@services).to_json %> | |
window.SERVICE_SUBCATEGORIES = <%= raw ActiveModel::ArraySerializer.new(@service_subcategories).to_json %> | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ServiceSerializer < ActiveModel::Serializer | |
embed :ids, include: true | |
attributes :id, :name, :input_type, :placeholder | |
def placeholder | |
object.placeholder || "" | |
end | |
has_many :service_subcategories | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ClientDashboard.Adapter = DS.RESTAdapter.extend | |
bulkCommit: false | |
ClientDashboard.Adapter.configure 'ClientDashboard.ServiceSubcategory', | |
sideloadAs: "service_subcategories" | |
ClientDashboard.Adapter.map 'ClientDashboard.Service', | |
service_subcategories: { key: "service_subcategory_ids" } | |
ClientDashboard.Adapter.reopen | |
namespace: 'users' | |
ClientDashboard.Store = DS.Store.extend | |
adapter: ClientDashboard.Adapter.create() | |
init: -> | |
@_super() | |
@loadMany ClientDashboard.Service, window.SERVICES | |
@loadMany ClientDashboard.ServiceSubcategory, window.SERVICE_SUBCATEGORIES |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment