diff --git a/app/controllers/api/places_controller.rb b/app/controllers/api/places_controller.rb index 35016d7..5048b71 100644 --- a/app/controllers/api/places_controller.rb +++ b/app/controllers/api/places_controller.rb @@ -1,3 +1,7 @@ class Api::PlacesController < Api::BaseController + # Search attributes search_attributes :name, :city, :state, :country + + # Preloads + preloads :qualifications, only: :show end diff --git a/app/models/place.rb b/app/models/place.rb index 37dc510..04bacb0 100644 --- a/app/models/place.rb +++ b/app/models/place.rb @@ -1,5 +1,6 @@ class Place < ApplicationRecord # Includes + include Qualifiable include Recordable include Search::Place @@ -11,6 +12,7 @@ class Place < ApplicationRecord # Resourceable parameters allow_params :name, :place_type, :lat, :long, :city, :state, :country, :url, :database_value, :notes, :same_as, - :part_of, locations_attributes: [:id, :locateable_id, :locateable_type, :description, :certainty, - :notes, :_destroy, qualifications_attributes: [:id, :value_list_id, :notes, :persistent, :_destroy]] + :part_of, :authorized_vocabulary_url, + locations_attributes: [:id, :locateable_id, :locateable_type, :description, :certainty, :notes, :_destroy, + qualifications_attributes: [:id, :value_list_id, :notes, :persistent, :_destroy]] end diff --git a/app/serializers/places_serializer.rb b/app/serializers/places_serializer.rb index 036f6cb..d114eb7 100644 --- a/app/serializers/places_serializer.rb +++ b/app/serializers/places_serializer.rb @@ -1,6 +1,7 @@ class PlacesSerializer < BaseSerializer index_attributes :id, :name, :place_type, :lat, :long, :city, :state, :country - show_attributes :id, :name, :place_type, :lat, :long, :city, :state, :country, :url, :database_value, :notes, :same_as, :part_of + show_attributes :id, :name, :place_type, :lat, :long, :city, :state, :country, :url, :database_value, :notes, + :same_as, :part_of, :authorized_vocabulary_url, qualifications: QualificationsSerializer # For unauthenticated users, only display locations for artworks that are published show_attributes(:locations) do |place, current_user| diff --git a/client/src/components/PlaceForm.js b/client/src/components/PlaceForm.js index 134a52a..be97555 100644 --- a/client/src/components/PlaceForm.js +++ b/client/src/components/PlaceForm.js @@ -6,6 +6,7 @@ import { GoogleScript } from '@performant-software/shared-components'; import { Form, Grid } from 'semantic-ui-react'; import _ from 'underscore'; import Countries from '../resources/Countries.json'; +import ValueListDropdown from './ValueListDropdown'; import type { EditContainerProps } from 'react-components/types'; import type { Translateable } from '../types/Translateable'; @@ -110,6 +111,19 @@ const PlaceForm = (props: Props) => { onChange={props.onTextInputChange.bind(this, 'url')} value={props.item.url || ''} /> + + }; diff --git a/db/migrate/20241211202543_add_authorized_vocabulary_url_to_places.rb b/db/migrate/20241211202543_add_authorized_vocabulary_url_to_places.rb new file mode 100644 index 0000000..83c1684 --- /dev/null +++ b/db/migrate/20241211202543_add_authorized_vocabulary_url_to_places.rb @@ -0,0 +1,5 @@ +class AddAuthorizedVocabularyUrlToPlaces < ActiveRecord::Migration[7.0] + def change + add_column :places, :authorized_vocabulary_url, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index a4302d1..a37b980 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2024_12_11_201922) do +ActiveRecord::Schema[7.0].define(version: 2024_12_11_202543) do # These are extensions that must be enabled in order to support this database enable_extension "pg_stat_statements" enable_extension "plpgsql" @@ -235,6 +235,7 @@ t.datetime "updated_at", null: false t.bigint "created_by_id" t.bigint "updated_by_id" + t.string "authorized_vocabulary_url" t.index ["created_by_id"], name: "index_places_on_created_by_id" t.index ["updated_by_id"], name: "index_places_on_updated_by_id" end