drusepth / Indent

Indent is a set of tools for writers, game designers, and roleplayers to create magnificent universes – and everything within them.
http://indentapp.com
1 stars 1 forks source link

Allow planners to add their own fields #8

Open drusepth opened 11 years ago

drusepth commented 11 years ago

For example, if I am planning a vampire, I should be able to add a "Person-who-turned-this-character-into-a-vampire" field and store a value for it.

drusepth commented 11 years ago

Implementation details:

A new model should be created to represent additional fields of data on an object: CustomField.

CustomField should look like this:

CustomField: id|target_id|key|value|section_name

CustomFields should be created with AJAX with a button on an object's edit form. This will create an empty CustomField behind the scenes (id, target_id, " ", " ", "section name") with id, target_id, and section_name already set. This CustomField should also be able to be deleted from the same place.

When a form is submitted that contains CustomFields, they should be stripped out from the controller method that creates/updates the object that contains them. They should each be saved, and duplicate keys should be appended with (i) where (i) makes it unique [Sister, Sister(1), Sister(2), etc].

CustomFields should be shown per-section when displaying an object by querying for matching target_id and section_name parameters (WHERE target_id = current_id AND section_name = current_section).