diff --git a/app/controllers/content_controller.rb b/app/controllers/content_controller.rb
index 630456db..942368d7 100644
--- a/app/controllers/content_controller.rb
+++ b/app/controllers/content_controller.rb
@@ -458,7 +458,8 @@ class ContentController < ApplicationController
reference = referencing_page.outgoing_page_references.find_or_initialize_by(
referenced_page_type: page_type,
referenced_page_id: page_id,
- attribute_field_id: @attribute_field.id
+ attribute_field_id: @attribute_field.id,
+ reference_type: 'linked'
)
reference.cached_relation_title = @attribute_field.label
reference.save!
@@ -506,7 +507,8 @@ class ContentController < ApplicationController
reference = @entity.outgoing_page_references.find_or_initialize_by(
referenced_page_type: token[:content_type],
referenced_page_id: token[:content_id],
- attribute_field_id: @attribute_field.id
+ attribute_field_id: @attribute_field.id,
+ reference_type: 'mentioned'
)
reference.cached_relation_title = @attribute_field.label
reference.save!
diff --git a/app/views/content/panels/_associations.html.erb b/app/views/content/panels/_associations.html.erb
index 57740188..07e6753e 100644
--- a/app/views/content/panels/_associations.html.erb
+++ b/app/views/content/panels/_associations.html.erb
@@ -18,6 +18,7 @@
chevron_right
<%= reference_list.first.cached_relation_title %>
link
+ <%= reference_list.first.reference_type %>
<%= content.name %>
diff --git a/db/migrate/20210429194615_add_reference_type_to_page_references.rb b/db/migrate/20210429194615_add_reference_type_to_page_references.rb
new file mode 100644
index 00000000..432cd0fd
--- /dev/null
+++ b/db/migrate/20210429194615_add_reference_type_to_page_references.rb
@@ -0,0 +1,5 @@
+class AddReferenceTypeToPageReferences < ActiveRecord::Migration[6.0]
+ def change
+ add_column :page_references, :reference_type, :string
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 36c13052..0e4dbac6 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.define(version: 2021_04_25_200153) do
+ActiveRecord::Schema.define(version: 2021_04_29_194615) do
create_table "active_storage_attachments", force: :cascade do |t|
t.string "name", null: false
@@ -2385,6 +2385,7 @@ ActiveRecord::Schema.define(version: 2021_04_25_200153) do
t.string "cached_relation_title"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
+ t.string "reference_type"
t.index ["attribute_field_id"], name: "index_page_references_on_attribute_field_id"
t.index ["referenced_page_type", "referenced_page_id"], name: "page_reference_referenced_page"
t.index ["referencing_page_type", "referencing_page_id"], name: "page_reference_referencing_page"
diff --git a/lib/tasks/data_migrations.rake b/lib/tasks/data_migrations.rake
index 0c77aea8..3de3bb4b 100644
--- a/lib/tasks/data_migrations.rake
+++ b/lib/tasks/data_migrations.rake
@@ -82,7 +82,8 @@ namespace :data_migrations do
reference = referencing_page.outgoing_page_references.find_or_initialize_by(
referenced_page_type: referenced_page_type,
referenced_page_id: referenced_page.id,
- attribute_field_id: attribute_field.id
+ attribute_field_id: attribute_field.id,
+ reference_type: 'linked'
)
reference.cached_relation_title = attribute_field.label
if reference.save!