Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Fields/Labels Added To Snippets Pages Appear Multiple Times #3

Open
sipple opened this issue Jan 31, 2013 · 2 comments
Open

Comments

@sipple
Copy link

sipple commented Jan 31, 2013

We have a few extensions in Radiant that add custom fields to the Snippets Edit Form (and also to the Snippets index). After the upgrade to Radiant 1.1.1 and beginning to use the new Snippets extension, added fields and labels appear multiple times. This isn't a problem for fields we add to Layouts (or other core Radiant admin pages), just Snippets.

An example of how we're adding them, in the *_extension.rb config file:
admin.snippet.edit.add :form, "mobile_content", :after => "edit_content"

@sipple
Copy link
Author

sipple commented Feb 4, 2013

Update to this ticket: The behavior is actually that the first time you load a Snippet page of any kind, everything renders once. Every time you load a new page, or reload a current page, any added fields render an extra time. So, if you reload a page 10 times, you end up with every custom field being rendered 10 times.

The fields are being added by our main site extension, by a multi_site extension (https://github.com/pgharts/radiant-multi-site-extension ) and a scoped_admin extension (https://github.com/spanner/radiant-scoped-admin-extension)

I've disabled the scoped_admin plugin, which didn't fix anything. I can't easily disable multi_site, because our site extension relies on it.

@sipple
Copy link
Author

sipple commented Feb 4, 2013

One more update: The problem seems to be that every time a page is loaded, the extension initializer re-adds the field to the snippets model. This isn't happening with any core radiant features, only with extensions.

I've come up with a fix to stop it from happening in my extensions, but I think there might be something up with how this is being handled as an extension than when snippets was part of Radiant core.

The code I'm using to work around looks like:

admin.snippet.edit.add(:form, "mobile_content", :after => "edit_content") unless admin.snippets.edit.form.include?("mobile_content")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant