track forks
This commit is contained in:
parent
33fc27ffd1
commit
2beaa2e5be
5 changed files with 12 additions and 2 deletions
|
@ -124,7 +124,7 @@ class MapsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_map_params
|
def create_map_params
|
||||||
params.permit(:name, :desc, :permission)
|
params.permit(:name, :desc, :permission, :source_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_map_params
|
def update_map_params
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
class Map < ApplicationRecord
|
class Map < ApplicationRecord
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
belongs_to :source, class_name: :Map
|
||||||
|
|
||||||
has_many :topicmappings, -> { Mapping.topicmapping }, class_name: :Mapping, dependent: :destroy
|
has_many :topicmappings, -> { Mapping.topicmapping }, class_name: :Mapping, dependent: :destroy
|
||||||
has_many :synapsemappings, -> { Mapping.synapsemapping }, class_name: :Mapping, dependent: :destroy
|
has_many :synapsemappings, -> { Mapping.synapsemapping }, class_name: :Mapping, dependent: :destroy
|
||||||
|
|
5
db/migrate/20161218183817_add_source_to_maps.rb
Normal file
5
db/migrate/20161218183817_add_source_to_maps.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class AddSourceToMaps < ActiveRecord::Migration[5.0]
|
||||||
|
def change
|
||||||
|
add_reference :maps, :source, foreign_key: {to_table: :maps}
|
||||||
|
end
|
||||||
|
end
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20161216174257) do
|
ActiveRecord::Schema.define(version: 20161218183817) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
@ -151,6 +151,8 @@ ActiveRecord::Schema.define(version: 20161216174257) do
|
||||||
t.string "screenshot_content_type", limit: 255
|
t.string "screenshot_content_type", limit: 255
|
||||||
t.integer "screenshot_file_size"
|
t.integer "screenshot_file_size"
|
||||||
t.datetime "screenshot_updated_at"
|
t.datetime "screenshot_updated_at"
|
||||||
|
t.integer "source_id"
|
||||||
|
t.index ["source_id"], name: "index_maps_on_source_id", using: :btree
|
||||||
t.index ["user_id"], name: "index_maps_on_user_id", using: :btree
|
t.index ["user_id"], name: "index_maps_on_user_id", using: :btree
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -340,5 +342,6 @@ ActiveRecord::Schema.define(version: 20161216174257) do
|
||||||
add_foreign_key "mailboxer_notifications", "mailboxer_conversations", column: "conversation_id", name: "notifications_on_conversation_id"
|
add_foreign_key "mailboxer_notifications", "mailboxer_conversations", column: "conversation_id", name: "notifications_on_conversation_id"
|
||||||
add_foreign_key "mailboxer_receipts", "mailboxer_notifications", column: "notification_id", name: "receipts_on_notification_id"
|
add_foreign_key "mailboxer_receipts", "mailboxer_notifications", column: "notification_id", name: "receipts_on_notification_id"
|
||||||
add_foreign_key "mappings", "users", column: "updated_by_id"
|
add_foreign_key "mappings", "users", column: "updated_by_id"
|
||||||
|
add_foreign_key "maps", "maps", column: "source_id"
|
||||||
add_foreign_key "tokens", "users"
|
add_foreign_key "tokens", "users"
|
||||||
end
|
end
|
||||||
|
|
|
@ -61,6 +61,7 @@ const CreateMap = {
|
||||||
if (GlobalUI.lightbox === 'forkmap') {
|
if (GlobalUI.lightbox === 'forkmap') {
|
||||||
self.newMap.set('topicsToMap', self.topicsToMap)
|
self.newMap.set('topicsToMap', self.topicsToMap)
|
||||||
self.newMap.set('synapsesToMap', self.synapsesToMap)
|
self.newMap.set('synapsesToMap', self.synapsesToMap)
|
||||||
|
self.newMap.set('source_id', Active.Map.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
var formId = GlobalUI.lightbox === 'forkmap' ? '#fork_map' : '#new_map'
|
var formId = GlobalUI.lightbox === 'forkmap' ? '#fork_map' : '#new_map'
|
||||||
|
|
Loading…
Add table
Reference in a new issue