mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
add text_color helper methods
This commit is contained in:
parent
cf999fbbe8
commit
f56c8bc46b
@ -14,6 +14,10 @@ class ApplicationIntegration < ApplicationRecord
|
||||
'orange'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'orange-text'
|
||||
end
|
||||
|
||||
def generate_new_access_token!
|
||||
self.update(application_token: SecureRandom.hex(24))
|
||||
end
|
||||
|
||||
@ -32,10 +32,18 @@ class Document < ApplicationRecord
|
||||
'teal'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'teal-text'
|
||||
end
|
||||
|
||||
def color
|
||||
Document.color
|
||||
end
|
||||
|
||||
def text_color
|
||||
Document.text_color
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#009688'
|
||||
end
|
||||
|
||||
@ -10,6 +10,10 @@ class Folder < ApplicationRecord
|
||||
'lighten-1 teal'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'text-lighten-1 teal-text'
|
||||
end
|
||||
|
||||
def self.icon
|
||||
'folder'
|
||||
end
|
||||
|
||||
@ -74,6 +74,10 @@ class PageCollection < ApplicationRecord
|
||||
'brown'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'brown-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#795548'
|
||||
end
|
||||
|
||||
@ -24,6 +24,10 @@ class AttributeCategory < ApplicationRecord
|
||||
'amber'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'amber-text'
|
||||
end
|
||||
|
||||
def icon
|
||||
icon_override || self.class.icon
|
||||
end
|
||||
@ -62,6 +66,7 @@ class AttributeCategory < ApplicationRecord
|
||||
|
||||
def backfill_fields_ordering!
|
||||
sorted_fields = attribute_fields.select(&:persisted?).sort do |a, b|
|
||||
# TODO: we shouldn't need this code anymore
|
||||
a_value = case a.field_type
|
||||
when 'name' then 0
|
||||
when 'universe' then 1
|
||||
|
||||
@ -31,6 +31,10 @@ class AttributeField < ApplicationRecord
|
||||
'amber'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'amber-text'
|
||||
end
|
||||
|
||||
def self.icon
|
||||
'text_fields'
|
||||
end
|
||||
|
||||
@ -26,6 +26,10 @@ class Building < ActiveRecord::Base
|
||||
'blue-grey'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'blue-grey-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#607D8B'
|
||||
end
|
||||
|
||||
@ -52,6 +52,10 @@ class Character < ApplicationRecord
|
||||
'red'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'red-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#F44336'
|
||||
end
|
||||
|
||||
@ -17,6 +17,10 @@ class Condition < ActiveRecord::Base
|
||||
'text-darken-1 lime'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'text-darken-1 lime-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#CDDC39'
|
||||
end
|
||||
|
||||
@ -13,4 +13,8 @@ class ContentPage < ApplicationRecord
|
||||
def color
|
||||
self.page_type.constantize.color
|
||||
end
|
||||
|
||||
def text_color
|
||||
self.page_type.constantize.text_color
|
||||
end
|
||||
end
|
||||
|
||||
@ -33,6 +33,10 @@ class Continent < ActiveRecord::Base
|
||||
'lighten-1 text-lighten-1 green'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'text-lighten-1 green-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#66BB6A'
|
||||
end
|
||||
|
||||
@ -37,6 +37,10 @@ class Country < ApplicationRecord
|
||||
'lighten-2 text-lighten-2 brown'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'text-lighten-2 brown-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#A1887F'
|
||||
end
|
||||
|
||||
@ -36,6 +36,10 @@ class Creature < ApplicationRecord
|
||||
'brown'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'brown-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#795548'
|
||||
end
|
||||
|
||||
@ -37,6 +37,10 @@ class Deity < ApplicationRecord
|
||||
'text-lighten-4 blue'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'text-lighten-4 blue-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#BBDEFB'
|
||||
end
|
||||
|
||||
@ -32,6 +32,10 @@ class Flora < ApplicationRecord
|
||||
'text-lighten-2 lighten-2 teal'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'text-lighten-2 teal-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#4DB6AC'
|
||||
end
|
||||
|
||||
@ -17,6 +17,10 @@ class Food < ActiveRecord::Base
|
||||
'red'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'red-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#F44336'
|
||||
end
|
||||
|
||||
@ -27,6 +27,10 @@ class Government < ApplicationRecord
|
||||
'darken-2 green'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'green-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#388E3C'
|
||||
end
|
||||
|
||||
@ -40,6 +40,10 @@ class Group < ApplicationRecord
|
||||
'cyan'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'cyan-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#00BCD4'
|
||||
end
|
||||
|
||||
@ -34,6 +34,10 @@ class Item < ApplicationRecord
|
||||
'text-darken-2 amber'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'text-darken-2 amber-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#FFA000'
|
||||
end
|
||||
|
||||
@ -17,6 +17,10 @@ class Job < ActiveRecord::Base
|
||||
'text-lighten-1 brown'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'text-lighten-1 brown-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#795548'
|
||||
end
|
||||
|
||||
@ -31,6 +31,10 @@ class Landmark < ApplicationRecord
|
||||
'text-lighten-1 lighten-1 orange'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'text-lighten-1 orange-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#FFA726'
|
||||
end
|
||||
|
||||
@ -24,6 +24,10 @@ class Language < ApplicationRecord
|
||||
'blue'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'blue-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#2196F3'
|
||||
end
|
||||
|
||||
@ -46,6 +46,10 @@ class Location < ApplicationRecord
|
||||
'green'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'green-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#4CAF50'
|
||||
end
|
||||
|
||||
@ -47,6 +47,10 @@ class Lore < ActiveRecord::Base
|
||||
'text-lighten-2 lighten-1 orange'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'text-lighten-2 orange-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#FFB74D'
|
||||
end
|
||||
|
||||
@ -25,6 +25,10 @@ class Magic < ApplicationRecord
|
||||
'orange'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'orange-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#FF9800'
|
||||
end
|
||||
|
||||
@ -34,6 +34,10 @@ class Planet < ApplicationRecord
|
||||
'text-lighten-2 blue'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'text-lighten-2 blue-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#64B5F6'
|
||||
end
|
||||
|
||||
@ -31,6 +31,10 @@ class Race < ApplicationRecord
|
||||
'darken-2 light-green'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'text-darken-2 light-green-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#689F38'
|
||||
end
|
||||
|
||||
@ -38,6 +38,10 @@ class Religion < ApplicationRecord
|
||||
'indigo'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'indigo-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#3f51b5'
|
||||
end
|
||||
|
||||
@ -30,6 +30,10 @@ class Scene < ApplicationRecord
|
||||
'grey'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'grey-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#9E9E9E'
|
||||
end
|
||||
|
||||
@ -17,6 +17,10 @@ class School < ActiveRecord::Base
|
||||
'cyan'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'cyan-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#00BCD4'
|
||||
end
|
||||
|
||||
@ -18,6 +18,10 @@ class Sport < ActiveRecord::Base
|
||||
'orange'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'orange-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#FF9800'
|
||||
end
|
||||
|
||||
@ -31,6 +31,10 @@ class Technology < ApplicationRecord
|
||||
'text-darken-2 red'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'text-darken-2 red-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#D32F2F'
|
||||
end
|
||||
|
||||
@ -34,6 +34,10 @@ class Town < ApplicationRecord
|
||||
'text-lighten-3 lighten-3 purple'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'text-lighten-3 purple-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#CE93D8'
|
||||
end
|
||||
|
||||
@ -17,6 +17,10 @@ class Tradition < ActiveRecord::Base
|
||||
'text-lighten-3 lighten-3 red'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'text-lighten-3 red-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#EF9A9A'
|
||||
end
|
||||
|
||||
@ -78,6 +78,10 @@ class Universe < ApplicationRecord
|
||||
'purple'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'purple-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#9C27B0'
|
||||
end
|
||||
|
||||
@ -14,7 +14,11 @@ class Vehicle < ActiveRecord::Base
|
||||
self.authorizer_name = 'ExtendedContentAuthorizer'
|
||||
|
||||
def self.color
|
||||
'text-lighten-2 green'
|
||||
'text-lighten-2 lighten-2 green'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'text-lighten-2 green-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
|
||||
@ -28,6 +28,10 @@ class ContentPageShare < ApplicationRecord
|
||||
'text-lighten-3 purple'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'text-lighten-3 purple-text'
|
||||
end
|
||||
|
||||
def self.hex_color
|
||||
'#CE93D8'
|
||||
end
|
||||
|
||||
@ -25,6 +25,10 @@ class Timeline < ApplicationRecord
|
||||
'green'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'green-text'
|
||||
end
|
||||
|
||||
# Needed because we sometimes munge Timelines in with ContentPages :(
|
||||
def color
|
||||
Timeline.color
|
||||
|
||||
@ -333,6 +333,10 @@ class User < ApplicationRecord
|
||||
'green'
|
||||
end
|
||||
|
||||
def self.text_color
|
||||
'green-text'
|
||||
end
|
||||
|
||||
def favorite_page_type_color
|
||||
return User.color unless favorite_page_type? && Rails.application.config.content_types[:all].map(&:name).include?(favorite_page_type)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user