diff --git a/app/controllers/creatures_controller.rb b/app/controllers/creatures_controller.rb index a97f1b83..40f13f70 100644 --- a/app/controllers/creatures_controller.rb +++ b/app/controllers/creatures_controller.rb @@ -11,7 +11,7 @@ class CreaturesController < ContentController materials preferred_habitat sounds strengths weaknesses spoils aggressiveness attack_method defense_method maximum_speed food_sources migratory_patterns reproduction herd_patterns - similar_animals symbolisms privacy + similar_animals symbolisms privacy notes private_notes ) + [ wildlifeships_attributes: [:id, :habitat_id, :_destroy], ] diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 8a455004..17cb26de 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -10,7 +10,7 @@ class GroupsController < ContentController name description other_names universe_id organization_structure motivation goal obstacles risks - inventory + inventory notes private_notes ) + [ group_leaderships_attributes: [:id, :leader_id, :_destroy], supergroupships_attributes: [:id, :supergroup_id, :_destroy], diff --git a/app/controllers/races_controller.rb b/app/controllers/races_controller.rb index 1a9ec9a5..384d8c64 100644 --- a/app/controllers/races_controller.rb +++ b/app/controllers/races_controller.rb @@ -8,7 +8,7 @@ class RacesController < ContentController def content_param_list %i( name description other_names universe_id - body_shape skin_colors height weight notable_features variance_clothing + body_shape skin_colors height weight notable_features variance clothing strengths weaknesses traditions beliefs governments technologies occupations economics favorite_foods notable_events diff --git a/app/models/content_types/creature.rb b/app/models/content_types/creature.rb index c55e14fc..21fb85ac 100644 --- a/app/models/content_types/creature.rb +++ b/app/models/content_types/creature.rb @@ -14,6 +14,7 @@ class Creature < ActiveRecord::Base belongs_to :universe + include HasAttributes include HasPrivacy include HasContentGroupers include Serendipitous::Concern @@ -31,32 +32,7 @@ class Creature < ActiveRecord::Base 'pets' end - def self.attribute_categories - { - overview: { - icon: 'info', - attributes: %w(name description type_of other_names universe_id) - }, - looks: { - icon: 'pets', - attributes: %w(color shape size notable_features materials) - }, - traits: { - icon: 'fingerprint', - attributes: %w(aggressiveness attack_method defense_method maximum_speed strengths weaknesses sounds spoils) - }, - habitat: { - icon: 'location_on', - attributes: %w(preferred_habitat habitats food_sources migratory_patterns reproduction herd_patterns) - }, - comparisons: { - icon: 'call_split', - attributes: %w(similar_animals symbolisms) - }, - notes: { - icon: 'edit', - attributes: %w(notes private_notes) - } - } + def self.content_name + 'creature' end end diff --git a/app/models/content_types/group.rb b/app/models/content_types/group.rb index edb93b05..845aa669 100644 --- a/app/models/content_types/group.rb +++ b/app/models/content_types/group.rb @@ -6,6 +6,7 @@ class Group < ActiveRecord::Base belongs_to :universe + include HasAttributes include HasPrivacy include HasContentGroupers include Serendipitous::Concern @@ -41,36 +42,7 @@ class Group < ActiveRecord::Base 'wc' end - def self.attribute_categories - { - overview: { - icon: 'info', - attributes: %w(name description other_names universe_id) - }, - hierarchy: { - icon: 'call_split', - attributes: %w(organization_structure leaders supergroups subgroups sistergroups) - }, - location: { - icon: 'location_on', - attributes: %w(headquarters offices) - }, - purpose: { - icon: 'business', - attributes: %w(motivation goal obstacles risks) - }, - politics: { - icon: 'thumbs_up_down', - attributes: %w(allies enemies rivals clients) - }, - inventory: { - icon: 'shopping_cart', - attributes: %w(inventory equipment key_items suppliers) - }, - notes: { - icon: 'edit', - attributes: %w(notes private_notes) - } - } + def self.content_name + 'group' end end diff --git a/app/models/content_types/language.rb b/app/models/content_types/language.rb index 340b3a1e..2e22a585 100644 --- a/app/models/content_types/language.rb +++ b/app/models/content_types/language.rb @@ -6,6 +6,7 @@ class Language < ActiveRecord::Base belongs_to :universe + include HasAttributes include HasPrivacy include HasContentGroupers include Serendipitous::Concern @@ -25,40 +26,7 @@ class Language < ActiveRecord::Base 'forum' end - def self.attribute_categories - { - overview: { - icon: 'info', - attributes: %w(name other_names universe_id) - }, - info: { - icon: 'forum', - attributes: %w(history typology dialectical_information register) - }, - phonology: { - icon: 'speaker_notes', - attributes: %w(phonology) - }, - grammar: { - icon: 'list', - attributes: %w(grammar) - }, - entities: { - icon: 'settings_input_component', - attributes: %w(numbers quantifiers) - }, - # lexicon: { - # icon: 'info', - # attributes: %w() - # }, - # spoken_by: { - # icon: 'info', - # attributes: %w() - # }, - notes: { - icon: 'edit', - attributes: %w(notes private_notes) - } - } + def self.content_name + 'language' end end diff --git a/app/models/content_types/magic.rb b/app/models/content_types/magic.rb index ffb050a0..567f0782 100644 --- a/app/models/content_types/magic.rb +++ b/app/models/content_types/magic.rb @@ -6,6 +6,7 @@ class Magic < ActiveRecord::Base belongs_to :universe + include HasAttributes include HasPrivacy include HasContentGroupers include Serendipitous::Concern @@ -23,32 +24,7 @@ class Magic < ActiveRecord::Base 'flash_on' end - def self.attribute_categories - { - overview: { - icon: 'info', - attributes: %w(name description type_of universe_id) - }, - appearance: { - icon: 'flash_on', - attributes: %w(visuals effects) - }, - effects: { - icon: 'flare', - attributes: %w(positive_effects negative_effects neutral_effects) - }, - alignment: { - icon: 'polymer', - attributes: %w(element deities) - }, - requirements: { - icon: 'lock', - attributes: %w(resource_costs materials skills_required limitations) - }, - notes: { - icon: 'edit', - attributes: %w(notes private_notes) - } - } + def self.content_name + 'magic' end end diff --git a/app/models/content_types/race.rb b/app/models/content_types/race.rb index dee6b69f..5516eb4b 100644 --- a/app/models/content_types/race.rb +++ b/app/models/content_types/race.rb @@ -12,6 +12,7 @@ class Race < ActiveRecord::Base belongs_to :universe + include HasAttributes include HasPrivacy include HasContentGroupers include Serendipitous::Concern @@ -29,32 +30,7 @@ class Race < ActiveRecord::Base 'face' end - def self.attribute_categories - { - overview: { - icon: 'info', - attributes: %w(name description other_names universe_id) - }, - looks: { - icon: 'face', - attributes: %w(body_shape skin_colors height weight notable_features variance clothing) - }, - traits: { - icon: 'fingerprint', - attributes: %w(strengths weaknesses) - }, - culture: { - icon: 'groups', - attributes: %w(famous_figures traditions beliefs governments technologies occupations economics favorite_foods) - }, - history: { - icon: 'import_contacts', - attributes: %w(notable_events) - }, - notes: { - icon: 'edit', - attributes: %w(notes private_notes) - } - } + def self.content_name + 'race' end end diff --git a/app/models/content_types/religion.rb b/app/models/content_types/religion.rb index 2404842f..0a41d9fc 100644 --- a/app/models/content_types/religion.rb +++ b/app/models/content_types/religion.rb @@ -6,6 +6,7 @@ class Religion < ActiveRecord::Base belongs_to :universe + include HasAttributes include HasPrivacy include HasContentGroupers include Serendipitous::Concern @@ -33,32 +34,7 @@ class Religion < ActiveRecord::Base 'brightness_7' end - def self.attribute_categories - { - overview: { - icon: 'info', - attributes: %w(name description other_names universe_id) - }, - history: { - icon: 'import_contacts', - attributes: %w(origin_story notable_figures artifacts) - }, - beliefs: { - icon: 'forum', - attributes: %w(deities teachings prophecies places_of_worship worship_services obligations paradise) - }, - traditions: { - icon: 'account_balance', - attributes: %w(initiation rituals holidays) - }, - spread: { - icon: 'location_on', - attributes: %w(practicing_locations races) - }, - notes: { - icon: 'edit', - attributes: %w(notes private_notes) - } - } + def self.content_name + 'religion' end end diff --git a/app/models/content_types/scene.rb b/app/models/content_types/scene.rb index 16f77bc6..004749ba 100644 --- a/app/models/content_types/scene.rb +++ b/app/models/content_types/scene.rb @@ -6,6 +6,7 @@ class Scene < ActiveRecord::Base belongs_to :universe + include HasAttributes include HasPrivacy include HasContentGroupers include Serendipitous::Concern @@ -29,24 +30,7 @@ class Scene < ActiveRecord::Base 'local_movies' end - def self.attribute_categories - { - overview: { - icon: 'info', - attributes: %w(name summary universe_id) - }, - members: { - icon: 'face', - attributes: %w(scene_characters scene_locations scene_items) - }, - action: { - icon: 'gesture', - attributes: %w(cause description results) - }, - notes: { - icon: 'edit', - attributes: %w(notes private_notes) - } - } + def self.content_name + 'scene' end end diff --git a/app/views/attribute_fields/_modal.html.erb b/app/views/attribute_fields/_modal.html.erb index 87ae01fa..d2f8ae30 100644 --- a/app/views/attribute_fields/_modal.html.erb +++ b/app/views/attribute_fields/_modal.html.erb @@ -15,6 +15,11 @@
<%= f.text_area :label, class: "materialize-textarea", placeholder: "Field Name" %>
+ +

+ Please save any changes before adding a field. It will refresh the page and any changes in your form + will be lost. +

- <% button_text = content_list.any? ? "Create another #{content_type}" : "Create your first #{content_type}" %> + <% button_text = content_list.any? ? "Create another #{content_type}" : "Create one" %> <%= link_to button_text, new_polymorphic_path(content_type), class: "btn #{content_type_class.color}" if current_user %>
diff --git a/app/views/content/form/_text_input.html.erb b/app/views/content/form/_text_input.html.erb index e9749ad2..f8478ddf 100644 --- a/app/views/content/form/_text_input.html.erb +++ b/app/views/content/form/_text_input.html.erb @@ -14,10 +14,10 @@ %>
- <%= f.label attribute, I18n.translate( # todo use field.name here instead of attribute? - "attributes.#{class_name}.#{attribute}", + <%= f.label field.name, I18n.translate( + "attributes.#{f.object.class.name}.#{field.name}", scope: :activerecord, - default: attribute.humanize.capitalize + default: field.label.humanize.capitalize ) %> <% placeholder = I18n.translate "attributes.#{content_name}.#{field.name}", diff --git a/app/views/content/index.html.erb b/app/views/content/index.html.erb index 692ca5d6..44fb38f5 100644 --- a/app/views/content/index.html.erb +++ b/app/views/content/index.html.erb @@ -1,5 +1,6 @@ <% content_type_class = @content.build.class + content_type = content_type_class.name.downcase %> <% content_for :sidebar_top do %> @@ -43,7 +44,7 @@ <% end %> - <%= render partial: 'content/list/list', locals: { content_list: @content.content_name, show_add_another_form: true } %> + <%= render partial: 'content/list/list', locals: { content_list: @content, show_add_another_form: true } %> <% elsif @content.empty? %> @@ -55,7 +56,7 @@

- <%= t("content_descriptions.#{content_type_class.name.downcase}") %> + <%= t("content_descriptions.#{content_type}") %>

<%= link_to "Create your first #{@content.content_name.humanize.downcase}", new_polymorphic_path(@content.build), class: "btn #{content_type_class.color}" %>
diff --git a/config/attributes/creature.yml b/config/attributes/creature.yml new file mode 100644 index 00000000..fdde2650 --- /dev/null +++ b/config/attributes/creature.yml @@ -0,0 +1,79 @@ +:overview: + :label: Overview + :icon: info + :attributes: + - :name: name + :label: Name + - :name: description + :label: Description + - :name: type_of + :label: Type of creature + - :name: universe_id + :label: Universe +:looks: + :label: Looks + :icon: pets + :attributes: + - :name: color + :label: Color + - :name: shape + :label: Shape + - :name: size + :label: Size + - :name: notable_features + :label: Notable features + - :name: materials + :label: Materials +:traits: + :label: Traits + :icon: fingerprint + :attributes: + - :name: aggressiveness + :label: Aggressiveness + - :name: attack_method + :label: Method of attack + - :name: defense_method + :label: Methods of defense + - :name: maximum_speed + :label: Maximum speed + - :name: strengths + :label: Strengths + - :name: weaknesses + :label: Weaknesses + - :name: sounds + :label: Sounds + - :name: spoils + :label: Spoils +:habitat: + :label: Habitat + :icon: location_on + :attributes: + - :name: preferred_habitat + :label: Preferred habitat + - :name: habitats + :label: Habitats + - :name: food_sources + :label: Food sources + - :name: migratory_patterns + :label: Migratory patterns + - :name: reproduction + :label: Reproductive patterns + - :name: herd_patterns + :label: Herding patterns +:comparisons: + :label: Comparisons + :icon: call_split + :attributes: + - :name: similar_animals + :label: Similar animals + - :name: symbolisms + :label: Symbolisms +:notes: + :label: Notes + :icon: edit + :attributes: + - :name: notes + :label: Notes + - :name: private_notes + :label: Private notes + :description: Private notes are always visible to only you, even if content is made public and shared. diff --git a/config/attributes/group.yml b/config/attributes/group.yml new file mode 100644 index 00000000..50fb7a97 --- /dev/null +++ b/config/attributes/group.yml @@ -0,0 +1,79 @@ +:overview: + :label: Overview + :icon: info + :attributes: + - :name: name + :label: Name + - :name: description + :label: Description + - :name: other_names + :label: Other names + - :name: universe_id + :label: Universe +:hierarchy: + :label: Hierarchy + :icon: call_split + :attributes: + - :name: organization_structure + :label: Organization structure + - :name: leaders + :label: Leaders + - :name: supergroups + :label: Supergroups + - :name: subgroups + :label: Subgroups + - :name: sistergroups + :label: Sistergroups +:location: + :label: Location + :icon: location_on + :attributes: + - :name: headquarters + :label: Headquarters + - :name: offices + :label: Offices +:purpose: + :label: Purpose + :icon: business + :attributes: + - :name: motivation + :label: Motivations + - :name: goal + :label: Goals + - :name: obstacles + :label: Obstacles + - :name: risks + :label: Risks +:politics: + :label: Politics + :icon: thumbs_up_down + :attributes: + - :name: allies + :label: Allies + - :name: enemies + :label: Enemies + - :name: rivals + :label: Rivals + - :name: clients + :label: Clients +:inventory: + :label: Inventory + :icon: shopping_cart + :attributes: + - :name: inventory + :label: Inventory + - :name: equipment + :label: Equipment + - :name: key_items + :label: Key items + - :name: suppliers + :label: Suppliers +:notes: + :label: Notes + :icon: edit + :attributes: + - :name: notes + :label: Notes + - :name: private_notes + :label: Private notes + :description: Private notes are always visible to only you, even if content is made public and shared. diff --git a/config/attributes/language.yml b/config/attributes/language.yml new file mode 100644 index 00000000..736bd053 --- /dev/null +++ b/config/attributes/language.yml @@ -0,0 +1,51 @@ +:overview: + :label: Overview + :icon: info + :attributes: + - :name: name + :label: Name + - :name: other_names + :label: Other names + - :name: universe_id + :label: Universe +:info: + :label: Info + :icon: forum + :attributes: + - :name: history + :label: History + - :name: typology + :label: Typology + - :name: dialectical_information + :label: Dialectical information + - :name: register + :label: Register +:phonology: + :label: Phonology + :icon: speaker_notes + :attributes: + - :name: phonology + :label: Phonology +:grammar: + :label: Grammar + :icon: list + :attributes: + - :name: grammar + :label: Grammar +:entities: + :label: Entities + :icon: settings_input_component + :attributes: + - :name: numbers + :label: Numbers + - :name: quantifiers + :label: Quantifiers +:notes: + :label: Notes + :icon: edit + :attributes: + - :name: notes + :label: Notes + - :name: private_notes + :label: Private notes + :description: Private notes are always visible to only you, even if content is made public and shared. diff --git a/config/attributes/magic.yml b/config/attributes/magic.yml new file mode 100644 index 00000000..64923232 --- /dev/null +++ b/config/attributes/magic.yml @@ -0,0 +1,59 @@ +:overview: + :label: Overview + :icon: info + :attributes: + - :name: name + :label: Name + - :name: description + :label: Description + - :name: type_of + :label: Type of magic + - :name: universe_id + :label: Universe +:appearance: + :label: Appearance + :icon: flash_on + :attributes: + - :name: visuals + :label: Visuals + - :name: effects + :label: Effects +:effects: + :label: Effects + :icon: flare + :attributes: + - :name: positive_effects + :label: Positive effects + - :name: neutral_effects + :label: Neutral effects + - :name: negative_effects + :label: Negative effects +:alignment: + :label: Alignment + :icon: polymer + :attributes: + - :name: element + :label: Element + - :name: deities + :label: Deities +:requirements: + :label: Requirements + :icon: lock + :attributes: + - :name: resource_costs + :label: Resource costs + - :name: materials + :label: Materials required + - :name: skills_required + :label: Skills required + - :name: limitations + :label: Limitations +:notes: + :label: Notes + :icon: edit + :attributes: + - :name: notes + :label: Notes + - :name: private_notes + :label: Private notes + :description: Private notes are always visible to only you, even if content is made public and shared. diff --git a/config/attributes/race.yml b/config/attributes/race.yml new file mode 100644 index 00000000..741f994a --- /dev/null +++ b/config/attributes/race.yml @@ -0,0 +1,73 @@ +:overview: + :label: Overview + :icon: info + :attributes: + - :name: name + :label: Name + - :name: description + :label: Description + - :name: other_names + :label: Other names + - :name: universe_id + :label: Universe +:looks: + :label: Looks + :icon: face + :attributes: + - :name: body_shape + :label: Body shape + - :name: skin_colors + :label: Skin colors + - :name: height + :label: General height + - :name: weight + :label: General weight + - :name: notable_features + :label: Notable features + - :name: variance + :label: Physical variance + - :name: clothing + :label: Typical clothing +:traits: + :label: Traits + :icon: fingerprint + :attributes: + - :name: strengths + :label: Strengths + - :name: weaknesses + :label: Weaknesses +:culture: + :label: Culture + :icon: groups + :attributes: + - :name: famous_figures + :label: Famous figures + - :name: traditions + :label: Traditions + - :name: beliefs + :label: Beliefs + - :name: governments + :label: Governments + - :name: technologies + :label: Technologies + - :name: occupations + :label: Occupations + - :name: economics + :label: Economics + - :name: favorite_foods + :label: Favorite foods +:history: + :label: History + :icon: import_contacts + :attributes: + - :name: notable_events + :label: Notable events +:notes: + :label: Notes + :icon: edit + :attributes: + - :name: notes + :label: Notes + - :name: private_notes + :label: Private notes + :description: Private notes are always visible to only you, even if content is made public and shared. diff --git a/config/attributes/religion.yml b/config/attributes/religion.yml new file mode 100644 index 00000000..d04aeba8 --- /dev/null +++ b/config/attributes/religion.yml @@ -0,0 +1,67 @@ +:overview: + :label: Overview + :icon: info + :attributes: + - :name: name + :label: Name + - :name: description + :label: Description + - :name: other_names + :label: Other names + - :name: universe_id + :label: Universe +:history: + :label: History + :icon: import_contacts + :attributes: + - :name: origin_story + :label: Origin story + - :name: notable_figures + :label: Notable figures + - :name: artifacts + :label: Artifacts +:beliefs: + :label: Beliefs + :icon: forum + :attributes: + - :name: deities + :label: Deities + - :name: teachings + :label: Teachings + - :name: prophecies + :label: Prophecies + - :name: places_of_worship + :label: Places of worship + - :name: worship_services + :label: Worship services + - :name: obligations + :label: Obligations + - :name: paradise + :label: Vision of paradise +:traditions: + :label: Traditions + :icon: account_balance + :attributes: + - :name: initiation + :label: Initiation process + - :name: rituals + :label: Rituals + - :name: holidays + :label: Holidays +:spread: + :label: Spread + :icon: location_on + :attributes: + - :name: practicing_locations + :label: Practicing locations + - :name: races + :label: Practicing races +:notes: + :label: Notes + :icon: edit + :attributes: + - :name: notes + :label: Notes + - :name: private_notes + :label: Private notes + :description: Private notes are always visible to only you, even if content is made public and shared. diff --git a/config/attributes/scene.yml b/config/attributes/scene.yml new file mode 100644 index 00000000..02dbc206 --- /dev/null +++ b/config/attributes/scene.yml @@ -0,0 +1,39 @@ +:overview: + :label: Overview + :icon: info + :attributes: + - :name: name + :label: Name + - :name: summary + :label: Summary + - :name: universe_id + :label: Universe +:looks: + :label: members + :icon: face + :attributes: + - :name: scene_characters + :label: Characters in scene + - :name: scene_locations + :label: Locations in scene + - :name: scene_items + :label: Items in scene +:action: + :label: Action + :icon: gesture + :attributes: + - :name: cause + :label: What caused this? + - :name: description + :label: Description + - :name: results + :label: Results +:notes: + :label: Notes + :icon: edit + :attributes: + - :name: notes + :label: Notes + - :name: private_notes + :label: Private notes + :description: Private notes are always visible to only you, even if content is made public and shared.