mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
add reference type to page references
This commit is contained in:
parent
3d6aa78856
commit
b5b0ee27f4
@ -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!
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
<i class="material-icons" style="position: relative; top: 7px">chevron_right</i>
|
||||
<%= reference_list.first.cached_relation_title %>
|
||||
<i class="material-icons" style="position: relative; top: 7px; margin: 0 0.3em">link</i>
|
||||
<%= reference_list.first.reference_type %>
|
||||
<span class="<%= content.class.color %>-text">
|
||||
<%= content.name %>
|
||||
</span>
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
class AddReferenceTypeToPageReferences < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :page_references, :reference_type, :string
|
||||
end
|
||||
end
|
||||
@ -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"
|
||||
|
||||
@ -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!
|
||||
|
||||
Loading…
Reference in New Issue
Block a user