Merge branch 'master' into documents

This commit is contained in:
Andrew Brown 2018-10-18 13:11:10 -05:00
commit 36eab5f4e3
32 changed files with 224 additions and 114 deletions

View File

@ -55,8 +55,8 @@ gem 'slack-notifier'
gem 'redcarpet' #markdown formatting
# Analytics
gem 'raygun4ruby'
gem 'mixpanel-ruby'
gem 'barnes'
# Sharing
gem 'social-share-button'

View File

@ -83,6 +83,9 @@ GEM
babel-source (>= 4.0, < 6)
execjs (~> 2.0)
backports (3.11.3)
barnes (0.0.7)
multi_json (~> 1)
statsd-ruby (~> 1.1)
bcrypt (3.1.12)
better_errors (2.4.0)
coderay (>= 1.0.0)
@ -202,8 +205,6 @@ GEM
activesupport (>= 2)
nokogiri (>= 1.4)
htmlentities (4.3.4)
httparty (0.16.2)
multi_xml (>= 0.5.2)
i18n (1.1.0)
concurrent-ruby (~> 1.0)
inline_svg (1.3.1)
@ -259,7 +260,6 @@ GEM
moneta (1.0.0)
multi_json (1.13.1)
multi_test (0.1.2)
multi_xml (0.6.0)
multipart-post (2.0.0)
mustache (1.0.5)
nenv (0.3.0)
@ -349,11 +349,6 @@ GEM
thor (>= 0.18.1, < 2.0)
rainbow (3.0.0)
rake (12.3.1)
raygun4ruby (2.7.0)
concurrent-ruby
httparty (> 0.13.7)
json
rack
rb-fsevent (0.10.3)
rb-gravatar (1.0.5)
rb-inotify (0.9.10)
@ -400,7 +395,7 @@ GEM
ruby-prof (0.15.9)
ruby-progressbar (1.9.0)
ruby_dep (1.5.0)
rubyzip (1.2.1)
rubyzip (1.2.2)
safe_yaml (1.0.4)
sanitize (4.6.5)
crass (~> 1.0.2)
@ -444,6 +439,7 @@ GEM
sprockets (>= 3.0.0)
sqlite3 (1.3.13)
stackprof (0.2.12)
statsd-ruby (1.4.0)
stripe (3.15.0)
faraday (~> 0.10)
stripe_event (2.1.1)
@ -510,6 +506,7 @@ DEPENDENCIES
authority
aws-sdk (~> 1.5)
aws-sdk-s3
barnes
better_errors
binding_of_caller
bullet (>= 5.4)
@ -552,7 +549,6 @@ DEPENDENCIES
rails-perftest
rails-ujs
rails_12factor
raygun4ruby
redcarpet
rmagick
rspec-prof

View File

@ -33,9 +33,9 @@ You'll notice there are *a lot* of issues in *a lot* of milestones. Call it feat
TL;DR Milestones are independent of each other -- work on whatever you want to see made!
== Installing the notebook stack locally
== Installing the notebook development stack locally
Install ruby 2.5.1
Install ruby 2.5.1 (using `rbenv`, `rvm`, any other Ruby version manager, or just plain ol' ruby)
rbenv install 2.5.1

View File

@ -1,11 +0,0 @@
/*
* These are temporary fixes and/or hacks for issues seen in prod. Every line here
* should be assumed temporary and with an inherit desire to remove it with something
* cleaner.
*/
// For some reason, the latest materializecss hides checkboxes. This un-hides them.
input[type="checkbox"]:not(:checked), input[type="checkbox"]:checked {
position: inherit !important;
opacity: inherit !important;
}

View File

@ -43,13 +43,10 @@ class ApplicationController < ActionController::Base
return unless user_signed_in?
@activated_content_types = (
Rails.application.config.content_types[:all].map(&:name) & # Use config to dictate order
Rails.application.config.content_types[:all].map(&:name) & # Use config to dictate order, but AND to only include what a user has turned on
current_user.user_content_type_activators.pluck(:content_type)
)
@current_user_content = {}
@activated_content_types.each do |content_type|
@current_user_content[content_type] = content_type.constantize.where(user: current_user).to_a
end
@current_user_content = current_user.content(content_types: @activated_content_types)
end
end

View File

@ -1,6 +1,6 @@
class ContentController < ApplicationController
# todo before_action :load_content to set @content
before_action :authenticate_user!, only: [:index, :new, :create, :edit, :update, :destroy]
before_action :authenticate_user!, only: [:index, :new, :create, :edit, :update, :destroy, :deleted, :attributes]
before_action :migrate_old_style_field_values, only: [:show, :edit]
before_action :populate_linkable_content_for_each_content_type, only: [:new, :edit]

View File

@ -27,13 +27,13 @@ class ExportController < ApplicationController
def notebook_json
report_to_mixpanel 'json', 'notebook'
json_dump = current_user.content.map { |category, content| {"#{category}": fill_relations(content)} }.to_json
json_dump = current_user.content.map { |category, content| {"#{category}": fill_relations(category.constantize, content)} }.to_json
send_data json_dump, filename: "notebook-#{Date.today}.json"
end
def notebook_xml
report_to_mixpanel 'xml', 'notebook'
xml_dump = current_user.content.map { |category, content| {"#{category}": fill_relations(content)}}.to_xml
xml_dump = current_user.content.map { |category, content| {"#{category}": fill_relations(category.constantize, content)}}.to_xml
send_data xml_dump, filename: "notebook-#{Date.today}.xml"
end
@ -88,8 +88,7 @@ class ExportController < ApplicationController
end
end
def fill_relations ar_relation
ar_class = ar_relation.build.class
def fill_relations(ar_class, ar_relation)
attribute_categories = ar_class.attribute_categories(current_user)
ar_relation.map do |content|
@ -99,7 +98,7 @@ class ExportController < ApplicationController
begin
value = content.send(attr.name)
rescue
value = Attribute.where(user: current_user, attribute_field: attr, entity: content).first
value = Attribute.find_by(user: current_user, attribute_field: attr, entity_id: content.id, entity_type: ar_class.name)
value = value.value if value
end
next if value.nil? || value.blank?

View File

@ -37,20 +37,20 @@ class MainController < ApplicationController
end
def recent_content
content_types = Rails.application.config.content_types[:all]
# todo optimize this / use Attributes
@recent_edits = content_types.flat_map { |klass|
klass.where(user_id: current_user.id)
@recent_edits = @activated_content_types.flat_map { |klass|
klass.constantize
.where(user_id: current_user.id)
.order(updated_at: :desc)
.limit(100)
}.sort_by(&:updated_at)
.last(100)
.reverse
@recent_creates = content_types.flat_map { |klass|
klass.where(user_id: current_user.id)
@recent_creates = @activated_content_types.flat_map { |klass|
klass.constantize
.where(user_id: current_user.id)
.order(created_at: :desc)
.limit(100)
}.sort_by(&:created_at)
@ -84,10 +84,21 @@ class MainController < ApplicationController
def set_random_content
@activated_content_types.shuffle.each do |content_type|
if @universe_scope.present?
@content = content_type.constantize.where(user: current_user, universe: @universe_scope).sample
if content_type.downcase == "universe"
if @universe_scope.present?
# when we want to enable prompts for contributing universes we can remove the user:
# selector here, but we will need to verify the user has permission to see the universe
# when we do that, or else prompts could open leak
@content = content_type.constantize.where(user: current_user, id: @universe_scope.id).sample
else
@content = content_type.constantize.where(user: current_user).sample
end
else
@content = content_type.constantize.where(user: current_user).sample
if @universe_scope.present?
@content = content_type.constantize.where(user: current_user, universe: @universe_scope).sample
else
@content = content_type.constantize.where(user: current_user).sample
end
end
return if @content.present?

View File

@ -25,10 +25,12 @@ class SearchController < ApplicationController
# Returns all attributes on a class that we match against in a search.
# Usage: searchable_attributes_for(Character) => [:name, :role, ...]
def searchable_attributes_for klass
related_controller = "#{klass.to_s.pluralize}Controller".constantize.new
related_controller = "#{klass.to_s.pluralize}Controller".constantize.new # can throw NameError
related_controller.send(:content_param_list).select do |attribute|
!attribute.is_a?(Hash) && searchable_attribute?(attribute.to_s)
end
rescue NameError # If we don't have a controller for a particular content type, treat it as no results
[]
end
# Returns whether or not a particular attribute should be included on searches.

View File

@ -82,7 +82,7 @@ class SubscriptionsController < ApplicationController
end
new_plan_id = params[:plan]
result = move_user_to_plan_requested(new_plan_id)
result = move_user_to_plan_requested(new_plan_id) if new_plan_id
if result == :payment_method_needed
redirect_to payment_info_path(plan: new_plan_id)

View File

@ -19,26 +19,32 @@ module HasContent
# characters: [...],
# locations: [...]
# }
def content
@user_content ||= begin
content_value = {}
Rails.application.config.content_types[:all].each do |type|
relation = type.name.downcase.pluralize.to_sym # :characters
content_value[relation] = send(relation)
end
content_value
end
def content(
content_types: Rails.application.config.content_types[:all].map(&:name),
page_scoping: { user_id: self.id }
)
@user_content ||= content_list(page_scoping: page_scoping, content_types: content_types).group_by(&:page_type)
end
# [..., ...]
def content_list
@user_content_list ||= begin
Rails.application.config.content_types[:all].flat_map do |type|
relation = type.name.downcase.pluralize.to_sym # :characters
send(relation)
def content_list(
content_types: Rails.application.config.content_types[:all].map(&:name),
page_scoping: { user_id: self.id }
)
# todo we can't select for universe_id here which kind of sucks, so we need to research 1) the repercussions, 2) what to do instead
polymorphic_content_fields = [:id, :name, :page_type, :user_id, :created_at, :updated_at, :deleted_at, :privacy]
chained_query = nil
(content_types + ["ContentPage"]).each do |content_type|
content_type_class = content_type.constantize
if chained_query.nil?
chained_query = content_type_class.select(*polymorphic_content_fields).where(page_scoping)
else
chained_query = content_type_class.select(*polymorphic_content_fields).where(page_scoping).union(chained_query)
end
end
@user_content_list ||= chained_query
end
# {
@ -46,25 +52,12 @@ module HasContent
# locations: [...]
# }
def content_in_universe universe_id
@user_content_in_universe ||= begin
content_value = {}
Rails.application.config.content_types[:all_non_universe].each do |type|
relation = type.name.downcase.pluralize.to_sym # :characters
content_value[relation] = send(relation).in_universe(universe_id)
end
content_value
end
@user_content_in_universe ||= content_list(page_scoping: { user_id: self.id, universe_id: universe_id }).group_by(&:page_type)
end
# 5
def content_count
@user_content_count ||= begin
Rails.application.config.content_types[:all].map do |type|
relation = type.name.downcase.pluralize.to_sym # :characters
send(relation).count
end.sum
end
@user_content_count ||= content_list.count
end
# {

View File

@ -0,0 +1,4 @@
class ContentPage < ApplicationRecord
belongs_to :user
belongs_to :universe
end

View File

@ -3,6 +3,7 @@ class SubscriptionService < Service
def self.add_subscription(user, plan_id)
related_plan = BillingPlan.find_by(stripe_plan_id: plan_id, available: true)
raise "Plan #{plan_id} not available for user #{user.id}" if related_plan.nil?
# Add any bonus bandwidth granted by the plan
user.update(

View File

@ -5,7 +5,7 @@
locals: {
title: defined?(title) ? title : 'Recent creations',
content_list: content_list,
content_type: Character
content_type: Character # todo why is this hard-coded?
}
%>
</div>

View File

@ -81,11 +81,11 @@
</tr>
<% content_list.each do |content| %>
<tr>
<td><%= link_to list_name_lookup_cache[content.id].presence || content.name, polymorphic_path(content) %></td>
<td><%= link_to list_name_lookup_cache[content.id].presence || content.name, polymorphic_path(content.page_type.downcase, id: content.id) %></td>
<td class="hide-on-small-only"><%# truncate(content.description, length: 200) %></td>
<td>
<div class="secondary-content">
<%= link_to edit_polymorphic_path(content) do %>
<%= link_to edit_polymorphic_path(content.page_type.downcase, id: content.id) do %>
<i class="material-icons">edit</i>
<% end %>
</div>

View File

@ -10,7 +10,7 @@
list_name_lookup_cache = Hash[
name_field.attribute_values.where(
entity_type: content_type.name
).pluck(:entity_id, :value)
).pluck(:entity_type, :entity_id, :value).map { |page_type, page_id, value| ["#{page_type}_#{page_id}", value]}
]
else
list_name_lookup_cache = {}
@ -28,7 +28,7 @@
<i class="material-icons circle <%= content.class.color %>"><%= content.class.icon %></i>
<% end %>
<span class="title">
<%= link_to (content.respond_to?(:label) ? content.label : list_name_lookup_cache[content.id].presence || content.name), content %>
<%= link_to (content.respond_to?(:label) ? content.label : list_name_lookup_cache["#{content.page_type}_#{content.id}"].presence || content.name), content %>
<small class="grey-text">
<% universe_field_value = content.universe_field_value %>
<% if universe_field_value.present? %>
@ -77,7 +77,7 @@
<span class="secondary-content hide-on-med-and-up">
<% if user_signed_in? && content.user_id == current_user.id %>
<%# todo also show if you're a contributor %>
<%= link_to edit_polymorphic_path(content), class: 'js-edit-hover' do %>
<%= link_to edit_polymorphic_path(content.page_type.downcase, id: content.id), class: 'js-edit-hover' do %>
<i class="material-icons">edit</i>
<% end %>
<% end %>
@ -86,6 +86,7 @@
<% end %>
<% if local_assigns[:show_add_another_form] && content_list.any? && current_user.can_create?(content_type) %>
<%# todo real permissions here %>
<% if content_type == Character || content_type == Location || content_type == Item || current_user.on_premium_plan? %>
<% unless content_type == Universe %>
<%= render partial: 'content/list/quick_add_form', locals: { content_type: content_type } %>

View File

@ -60,10 +60,10 @@
%>
<div class="field">
<%= f.check_box :email_updates %>
<%= f.label :email_updates do %>
We're always working to improve Notebook.ai. Please leave this box checked if you'd like to receive occasional updates about
what's new.
<%= f.check_box :email_updates %>
<span>We're always working to improve Notebook.ai. Please leave this box checked if you'd like to receive occasional updates about
what's new.</span>
<% end %>
</div>

View File

@ -2,9 +2,9 @@
<div class="card-content">
<h4>Your Notebook.ai design</h4>
<div class="field">
<%= f.check_box :fluid_preference %>
<%= f.label :fluid_preference do %>
I want to use <strong>full-width</strong> Notebook.ai. Great for small screens, but not so much for very large ones.
<%= f.check_box :fluid_preference %>
<span>I want to use <strong>full-width</strong> Notebook.ai. Great for small screens, but not so much for very large ones.</span>
<% end %>
</div>
</div>
@ -14,9 +14,9 @@
<div class="card-content">
<h4>Email preferences</h4>
<div class="field">
<%= f.check_box :email_updates %>
<%= f.label :email_updates do %>
I want to receive occasional updates by email about new Notebook.ai features.
<%= f.check_box :email_updates %>
<span>I want to receive occasional updates by email about new Notebook.ai features.</span>
<% end %>
</div>
</div>

View File

@ -13,17 +13,21 @@
</div>
<div class="actions center">
<div class="col s6">
<% if devise_mapping.rememberable? -%>
<span class="field" style="margin-right: 30px;">
<%= f.label :remember_me do %>
<%= f.check_box :remember_me %>
<%= f.label :remember_me %>
</span>
<span>Remember me</span>
<% end %>
<% end -%>
<%= f.submit "Log in", class: 'btn blue' %>
</div>
<div class="col s6">
<%= f.submit "Log in", class: 'btn blue' %>
</div>
<p class="center">
<br />
<%= render "devise/shared/links" %>
</p>
</div>
<% end %>
<% end %>

View File

@ -2,14 +2,14 @@
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'application' %>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-beta/css/materialize.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" integrity="sha256-rByPlHULObEjJ6XQxW/flG2r+22R5dKiAoef+aXWfik=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js" integrity="sha256-KM512VNnjElC30ehFwehXjx1YCHPiQkOPmqnrWtpccM=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-ujs/1.2.2/rails.min.js" integrity="sha256-BbyWhCn0G+F6xbWJ2pcI5LnnpsnpSzyjJNVtl7ABp+M=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-beta/js/materialize.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.16.6/lodash.min.js" integrity="sha256-BWnUqM2wJJk2qUy9kUxldWF2drzn2awHUNcmMy87bDQ=" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://js.stripe.com/v2/"></script>

View File

@ -93,7 +93,7 @@
@universe_scope.send(pluralized_name).count
else
(
@current_user_content[content_type] +
@current_user_content[content_type] || [] +
current_user.send("contributable_#{pluralized_name}") +
(content_type_klass == Universe ? [] : content_type_klass.where(universe_id: current_user.universes.pluck(:id)))
).uniq.count

View File

@ -2,14 +2,14 @@
<html lang="en">
<head>
<%= stylesheet_link_tag 'application' %>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-beta/css/materialize.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" integrity="sha256-rByPlHULObEjJ6XQxW/flG2r+22R5dKiAoef+aXWfik=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js" integrity="sha256-KM512VNnjElC30ehFwehXjx1YCHPiQkOPmqnrWtpccM=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-ujs/1.2.2/rails.min.js" integrity="sha256-BbyWhCn0G+F6xbWJ2pcI5LnnpsnpSzyjJNVtl7ABp+M=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-beta/js/materialize.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.16.6/lodash.min.js" integrity="sha256-BWnUqM2wJJk2qUy9kUxldWF2drzn2awHUNcmMy87bDQ=" crossorigin="anonymous"></script>
<%= render 'layouts/favicon' %>

View File

@ -21,13 +21,8 @@
if @universe_scope.present? && content_type != 'Universe'
content_list = @universe_scope.send(pluralized_content_name)
else
content_list = @current_user_content[content_type] +
content_list = @current_user_content[content_type] || [] +
current_user.send("contributable_#{pluralized_content_name}")
# todo I don't think this is actually necessary anymore, but leaving around for a few days just in case
# if content_type != 'Universe'
# content_list.concat(content_type.constantize.where(universe_id: current_user_universe_ids))
# end
end
content_list = content_list.uniq

View File

@ -20,7 +20,7 @@
<li><%= link_to "All universes", "?universe=all" %></li>
<% if current_user %>
<li class="divider"></li>
<% (@current_user_content['Universe'] + current_user.contributable_universes).sort_by(&:name).each do |universe| %>
<% ((@current_user_content['Universe'] || []) + current_user.contributable_universes).sort_by(&:name).each do |universe| %>
<li><%= link_to universe.name + (universe.user_id == current_user.id ? '' : ' (contributor)'), "?universe=#{universe.id}" %></li>
<% end %>
<% end %>

View File

@ -1,7 +0,0 @@
Raygun.setup do |config|
config.api_key = ENV['RAYGUN_API_KEY'] || ''
config.filter_parameters = Rails.application.config.filter_parameters
# The default is Rails.env.production?
# config.enable_reporting = !Rails.env.development? && !Rails.env.test?
end

View File

@ -1,5 +1,10 @@
require 'puma/plugin/heroku'
require 'barnes'
before_fork do
Barnes.start
end
workers Integer(ENV['WEB_CONCURRENCY'] || 0)
threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5)
threads threads_count, threads_count

View File

@ -0,0 +1,23 @@
class AddPageTypeColumnToPages < ActiveRecord::Migration[5.2]
def change
add_column :universes, :page_type, :string
add_column :characters, :page_type, :string
add_column :countries, :page_type, :string
add_column :creatures, :page_type, :string
add_column :deities, :page_type, :string
add_column :floras, :page_type, :string
add_column :governments, :page_type, :string
add_column :groups, :page_type, :string
add_column :items, :page_type, :string
add_column :landmarks, :page_type, :string
add_column :languages, :page_type, :string
add_column :locations, :page_type, :string
add_column :magics, :page_type, :string
add_column :planets, :page_type, :string
add_column :races, :page_type, :string
add_column :religions, :page_type, :string
add_column :scenes, :page_type, :string
add_column :technologies, :page_type, :string
add_column :towns, :page_type, :string
end
end

View File

@ -0,0 +1,23 @@
class AddDefaultsToNewPageColumns < ActiveRecord::Migration[5.2]
def change
change_column_default :universes, :page_type, 'Universe'
change_column_default :characters, :page_type, 'Character'
change_column_default :countries, :page_type, 'Country'
change_column_default :creatures, :page_type, 'Creature'
change_column_default :deities, :page_type, 'Deity'
change_column_default :floras, :page_type, 'Flora'
change_column_default :governments, :page_type, 'Government'
change_column_default :groups, :page_type, 'Group'
change_column_default :items, :page_type, 'Item'
change_column_default :landmarks, :page_type, 'Landmark'
change_column_default :languages, :page_type, 'Language'
change_column_default :locations, :page_type, 'Location'
change_column_default :magics, :page_type, 'Magic'
change_column_default :planets, :page_type, 'Planet'
change_column_default :races, :page_type, 'Race'
change_column_default :religions, :page_type, 'Religion'
change_column_default :scenes, :page_type, 'Scene'
change_column_default :technologies, :page_type, 'Technology'
change_column_default :towns, :page_type, 'Town'
end
end

View File

@ -0,0 +1,15 @@
class CreateContentPages < ActiveRecord::Migration[5.2]
def change
create_table :content_pages do |t|
t.string :name
t.string :description
t.references :user, foreign_key: true
t.references :universe, foreign_key: true
t.datetime :deleted_at
t.string :privacy
t.string :page_type
t.timestamps
end
end
end

View File

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2018_10_02_170145) do
ActiveRecord::Schema.define(version: 2018_10_17_224014) do
create_table "api_keys", force: :cascade do |t|
t.integer "user_id"
@ -269,6 +269,7 @@ ActiveRecord::Schema.define(version: 2018_10_02_170145) do
t.string "hobbies"
t.string "personality_type"
t.datetime "deleted_at"
t.string "page_type", default: "Character"
t.index ["deleted_at", "id"], name: "index_characters_on_deleted_at_and_id"
t.index ["deleted_at", "universe_id"], name: "index_characters_on_deleted_at_and_universe_id"
t.index ["deleted_at", "user_id"], name: "index_characters_on_deleted_at_and_user_id"
@ -295,6 +296,20 @@ ActiveRecord::Schema.define(version: 2018_10_02_170145) do
t.index ["user_id"], name: "index_content_change_events_on_user_id"
end
create_table "content_pages", force: :cascade do |t|
t.string "name"
t.string "description"
t.integer "user_id"
t.integer "universe_id"
t.datetime "deleted_at"
t.string "privacy"
t.string "page_type"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["universe_id"], name: "index_content_pages_on_universe_id"
t.index ["user_id"], name: "index_content_pages_on_user_id"
end
create_table "contributors", force: :cascade do |t|
t.integer "universe_id"
t.string "email"
@ -327,6 +342,7 @@ ActiveRecord::Schema.define(version: 2018_10_02_170145) do
t.datetime "deleted_at"
t.string "privacy"
t.integer "user_id"
t.string "page_type", default: "Country"
t.index ["deleted_at", "id"], name: "index_countries_on_deleted_at_and_id"
t.index ["deleted_at", "universe_id"], name: "index_countries_on_deleted_at_and_universe_id"
t.index ["deleted_at", "user_id"], name: "index_countries_on_deleted_at_and_user_id"
@ -469,6 +485,7 @@ ActiveRecord::Schema.define(version: 2018_10_02_170145) do
t.string "family"
t.string "genus"
t.string "species"
t.string "page_type", default: "Creature"
t.index ["deleted_at", "id"], name: "index_creatures_on_deleted_at_and_id"
t.index ["deleted_at", "universe_id"], name: "index_creatures_on_deleted_at_and_universe_id"
t.index ["deleted_at", "user_id"], name: "index_creatures_on_deleted_at_and_user_id"
@ -508,6 +525,7 @@ ActiveRecord::Schema.define(version: 2018_10_02_170145) do
t.datetime "deleted_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "page_type", default: "Deity"
t.index ["deleted_at", "id"], name: "index_deities_on_deleted_at_and_id"
t.index ["deleted_at", "universe_id"], name: "index_deities_on_deleted_at_and_universe_id"
t.index ["deleted_at", "user_id"], name: "index_deities_on_deleted_at_and_user_id"
@ -780,6 +798,7 @@ ActiveRecord::Schema.define(version: 2018_10_02_170145) do
t.string "privacy"
t.datetime "deleted_at"
t.string "material_uses"
t.string "page_type", default: "Flora"
t.index ["deleted_at", "id"], name: "index_floras_on_deleted_at_and_id"
t.index ["deleted_at", "universe_id"], name: "index_floras_on_deleted_at_and_universe_id"
t.index ["deleted_at", "user_id"], name: "index_floras_on_deleted_at_and_user_id"
@ -898,6 +917,7 @@ ActiveRecord::Schema.define(version: 2018_10_02_170145) do
t.datetime "deleted_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "page_type", default: "Government"
t.index ["deleted_at", "id"], name: "index_governments_on_deleted_at_and_id"
t.index ["deleted_at", "universe_id"], name: "index_governments_on_deleted_at_and_universe_id"
t.index ["deleted_at", "user_id"], name: "index_governments_on_deleted_at_and_user_id"
@ -988,6 +1008,7 @@ ActiveRecord::Schema.define(version: 2018_10_02_170145) do
t.datetime "updated_at", null: false
t.string "privacy"
t.datetime "deleted_at"
t.string "page_type", default: "Group"
t.index ["deleted_at", "id"], name: "index_groups_on_deleted_at_and_id"
t.index ["deleted_at", "universe_id"], name: "index_groups_on_deleted_at_and_universe_id"
t.index ["deleted_at", "user_id"], name: "index_groups_on_deleted_at_and_user_id"
@ -1047,6 +1068,7 @@ ActiveRecord::Schema.define(version: 2018_10_02_170145) do
t.datetime "updated_at"
t.string "privacy", default: "private", null: false
t.datetime "deleted_at"
t.string "page_type", default: "Item"
t.index ["deleted_at", "id"], name: "index_items_on_deleted_at_and_id"
t.index ["deleted_at", "universe_id"], name: "index_items_on_deleted_at_and_universe_id"
t.index ["deleted_at", "user_id"], name: "index_items_on_deleted_at_and_user_id"
@ -1121,6 +1143,7 @@ ActiveRecord::Schema.define(version: 2018_10_02_170145) do
t.datetime "deleted_at"
t.string "privacy"
t.integer "user_id"
t.string "page_type", default: "Landmark"
t.index ["deleted_at", "id"], name: "index_landmarks_on_deleted_at_and_id"
t.index ["deleted_at", "universe_id"], name: "index_landmarks_on_deleted_at_and_universe_id"
t.index ["deleted_at", "user_id"], name: "index_landmarks_on_deleted_at_and_user_id"
@ -1147,6 +1170,7 @@ ActiveRecord::Schema.define(version: 2018_10_02_170145) do
t.datetime "updated_at", null: false
t.string "privacy"
t.datetime "deleted_at"
t.string "page_type", default: "Language"
t.index ["deleted_at", "id"], name: "index_languages_on_deleted_at_and_id"
t.index ["deleted_at", "universe_id"], name: "index_languages_on_deleted_at_and_universe_id"
t.index ["deleted_at", "user_id"], name: "index_languages_on_deleted_at_and_user_id"
@ -1255,6 +1279,7 @@ ActiveRecord::Schema.define(version: 2018_10_02_170145) do
t.string "founding_story"
t.string "sports"
t.datetime "deleted_at"
t.string "page_type", default: "Location"
t.index ["deleted_at", "id"], name: "index_locations_on_deleted_at_and_id"
t.index ["deleted_at", "universe_id"], name: "index_locations_on_deleted_at_and_universe_id"
t.index ["deleted_at", "user_id"], name: "index_locations_on_deleted_at_and_user_id"
@ -1291,6 +1316,7 @@ ActiveRecord::Schema.define(version: 2018_10_02_170145) do
t.datetime "updated_at", null: false
t.string "privacy"
t.datetime "deleted_at"
t.string "page_type", default: "Magic"
t.index ["deleted_at", "id"], name: "index_magics_on_deleted_at_and_id"
t.index ["deleted_at", "universe_id"], name: "index_magics_on_deleted_at_and_universe_id"
t.index ["deleted_at", "user_id"], name: "index_magics_on_deleted_at_and_user_id"
@ -1511,6 +1537,7 @@ ActiveRecord::Schema.define(version: 2018_10_02_170145) do
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "notes"
t.string "page_type", default: "Planet"
t.index ["deleted_at", "id"], name: "index_planets_on_deleted_at_and_id"
t.index ["deleted_at", "universe_id"], name: "index_planets_on_deleted_at_and_universe_id"
t.index ["deleted_at", "user_id"], name: "index_planets_on_deleted_at_and_user_id"
@ -1547,6 +1574,7 @@ ActiveRecord::Schema.define(version: 2018_10_02_170145) do
t.datetime "updated_at", null: false
t.string "privacy"
t.datetime "deleted_at"
t.string "page_type", default: "Race"
t.index ["deleted_at", "id"], name: "index_races_on_deleted_at_and_id"
t.index ["deleted_at", "universe_id"], name: "index_races_on_deleted_at_and_universe_id"
t.index ["deleted_at", "user_id"], name: "index_races_on_deleted_at_and_user_id"
@ -1615,6 +1643,7 @@ ActiveRecord::Schema.define(version: 2018_10_02_170145) do
t.datetime "updated_at", null: false
t.string "privacy"
t.datetime "deleted_at"
t.string "page_type", default: "Religion"
t.index ["deleted_at", "id"], name: "index_religions_on_deleted_at_and_id"
t.index ["deleted_at", "universe_id"], name: "index_religions_on_deleted_at_and_universe_id"
t.index ["deleted_at", "user_id"], name: "index_religions_on_deleted_at_and_user_id"
@ -1675,6 +1704,7 @@ ActiveRecord::Schema.define(version: 2018_10_02_170145) do
t.datetime "updated_at", null: false
t.string "privacy"
t.datetime "deleted_at"
t.string "page_type", default: "Scene"
t.index ["deleted_at", "id"], name: "index_scenes_on_deleted_at_and_id"
t.index ["deleted_at", "universe_id"], name: "index_scenes_on_deleted_at_and_universe_id"
t.index ["deleted_at", "user_id"], name: "index_scenes_on_deleted_at_and_user_id"
@ -1758,6 +1788,7 @@ ActiveRecord::Schema.define(version: 2018_10_02_170145) do
t.datetime "deleted_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "page_type", default: "Technology"
t.index ["deleted_at", "id"], name: "index_technologies_on_deleted_at_and_id"
t.index ["deleted_at", "universe_id"], name: "index_technologies_on_deleted_at_and_universe_id"
t.index ["deleted_at", "user_id"], name: "index_technologies_on_deleted_at_and_user_id"
@ -2184,6 +2215,7 @@ ActiveRecord::Schema.define(version: 2018_10_02_170145) do
t.datetime "deleted_at"
t.string "privacy"
t.integer "user_id"
t.string "page_type", default: "Town"
t.index ["deleted_at", "id"], name: "index_towns_on_deleted_at_and_id"
t.index ["deleted_at", "universe_id"], name: "index_towns_on_deleted_at_and_universe_id"
t.index ["deleted_at", "user_id"], name: "index_towns_on_deleted_at_and_user_id"
@ -2206,6 +2238,7 @@ ActiveRecord::Schema.define(version: 2018_10_02_170145) do
t.string "technology"
t.string "genre"
t.datetime "deleted_at"
t.string "page_type", default: "Universe"
t.index ["deleted_at", "id"], name: "index_universes_on_deleted_at_and_id"
t.index ["deleted_at", "user_id"], name: "index_universes_on_deleted_at_and_user_id"
t.index ["deleted_at"], name: "index_universes_on_deleted_at"

19
test/fixtures/content_pages.yml vendored Normal file
View File

@ -0,0 +1,19 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
name: MyString
description: MyString
user: one
universe: one
deleted_at: 2018-10-17 17:40:14
privacy: MyString
page_type: MyString
two:
name: MyString
description: MyString
user: two
universe: two
deleted_at: 2018-10-17 17:40:14
privacy: MyString
page_type: MyString

View File

@ -0,0 +1,7 @@
require 'test_helper'
class ContentPageTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end