mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
fix fields on deity/government/planet/technology
This commit is contained in:
parent
7ad90c53f4
commit
fac8c7ded5
@ -10,6 +10,9 @@ class CharactersController < ContentController
|
||||
def content_param_list
|
||||
[
|
||||
#todo remove all these (for all pages) now that we use custom attributes for them all (minus links)
|
||||
# all but
|
||||
#custom_attribute_values: [:name, :value],
|
||||
|
||||
:universe_id, :user_id,
|
||||
:name, :age, :role, :gender, :age, :archetype, :height, :weight, :haircolor,
|
||||
:facialhair, :eyecolor, :skintone, :bodytype, :identmarks, :hairstyle,
|
||||
|
||||
@ -108,7 +108,7 @@ class ContentController < ApplicationController
|
||||
|
||||
# Don't set name fields on content that doesn't have a name field
|
||||
#todo abstract this (and the one in update) to a function
|
||||
unless [AttributeCategory, AttributeField, Attribute].map(&:name).include?(@content.class.name)
|
||||
unless [AttributeCategory, AttributeField, Attribute].map(&:name).include?(@content.class.name) && [nil, ''].include?(@content.name)
|
||||
@content.name = @content.name_field_value || "Untitled"
|
||||
end
|
||||
|
||||
@ -116,6 +116,7 @@ class ContentController < ApplicationController
|
||||
'content_type': content_type.name
|
||||
}) if Rails.env.production?
|
||||
|
||||
# todo look at this code smell for collab
|
||||
@content.user = current_user
|
||||
if @content.update_attributes(content_params)
|
||||
cache_params = {}
|
||||
|
||||
@ -24,7 +24,8 @@ class DeitiesController < ContentController
|
||||
deity_relics_attributes: [:id, :relic_id, :_destroy],
|
||||
deity_abilities_attributes: [:id, :ability_id, :_destroy],
|
||||
deity_related_towns_attributes: [:id, :related_town_id, :_destroy],
|
||||
deity_related_landmarks_attributes: [:id, :related_landmark_id, :_destroy]
|
||||
deity_related_landmarks_attributes: [:id, :related_landmark_id, :_destroy],
|
||||
custom_attribute_values: [:name, :value]
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
@ -17,7 +17,8 @@ class GovernmentsController < ContentController
|
||||
government_political_figures_attributes: [:id, :political_figure_id, :_destroy],
|
||||
government_items_attributes: [:id, :item_id, :_destroy],
|
||||
government_technologies_attributes: [:id, :technology_id, :_destroy],
|
||||
government_creatures_attributes: [:id, :creature_id, :_destroy]
|
||||
government_creatures_attributes: [:id, :creature_id, :_destroy],
|
||||
custom_attribute_values: [:name, :value]
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
@ -25,7 +25,8 @@ class PlanetsController < ContentController
|
||||
planet_groups_attributes: [:id, :group_id, :_destroy],
|
||||
planet_languages_attributes: [:id, :language_id, :_destroy],
|
||||
planet_towns_attributes: [:id, :town_id, :_destroy],
|
||||
planet_nearby_planets_attributes: [:id, :nearby_planet_id, :_destroy]
|
||||
planet_nearby_planets_attributes: [:id, :nearby_planet_id, :_destroy],
|
||||
custom_attribute_values: [:name, :value]
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
@ -18,7 +18,8 @@ class TechnologiesController < ContentController
|
||||
technology_magics_attributes: [:id, :magic_id, :_destroy],
|
||||
technology_parent_technologies_attributes: [:id, :parent_technology_id, :_destroy],
|
||||
technology_child_technologies_attributes: [:id, :child_technology_id, :_destroy],
|
||||
technology_related_technologies_attributes: [:id, :related_technology_id, :_destroy]
|
||||
technology_related_technologies_attributes: [:id, :related_technology_id, :_destroy],
|
||||
custom_attribute_values: [:name, :value]
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
@ -30,7 +30,7 @@ class PermissionService < Service
|
||||
end
|
||||
|
||||
def self.content_has_no_containing_universe?(content:)
|
||||
content.universe.nil?
|
||||
content.universe_field_value.nil?
|
||||
end
|
||||
|
||||
def self.user_is_on_premium_plan?(user:)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user