Comments (2)
Thank you for your input, keep it coming
There is a bit of a discrepancy between what the user interface allows you to do and what the api allows.
Basically the UI tries to prevent you from breaking stuff, the api on the other hand gives you way more and less opinionated access to content types and entries.
In general deleting a field from a content type before it is activated is ok. However the api will not (at the moment) stop you from deleting a field from an activated content type. Once a content type is activated the field should be disabled.
For the request: adding the disable
field makes total sense, make destroy
behave like disable
is the wrong way to go in my opinion and the api should let you know that this is a bad idea.
I will discuss this with the backend team and will add the disable
feature to the roadmap for the gem.
Could you maybe share your code?
from contentful-management.rb.
Makes sense. I actually ended up not deleting any fields, because in my use case I'm trying to delete fields on already activated content types. So ultimately, being able to explicitly disable / reenable fields is the feature that works.
First and foremost, actually adding a property that tracks the disabled status of the field is the most helpful step:
::Contentful::Management::Field.class_eval do
# Contentful Management gem doesn't keep disabled, so monkeypatch it here
# until this gets implemented
property :disabled, :boolean
end
Doing that, disabled just becomes one more property to manage. So for example to disable a given field, I'm doing something like this:
# Where field_id is the ID of the field we're trying to disable
fields = content_type.fields.map do |field|
if field.id == field_id
field.disabled = true
end
field
end
content_type.update(fields: fields)
from contentful-management.rb.
Related Issues (20)
- Old http dependency causing issues HOT 1
- Creating an asset example fails on `process_file`
- Error reading from socket HOT 7
- Rich text field validations prevent operations on content type HOT 5
- Retrieving content types throws an HTTP connection error HOT 1
- JSON field getting cleared on save HOT 4
- Gem blows up when querying entries that have tags associated with them HOT 4
- Entry destroy not working as expected HOT 1
- Creating entry with field 'id' doesn't work HOT 4
- Get all users implementation missing HOT 6
- editor_interface missing sidebar implementation HOT 1
- Tasks implementation missing in contentful-management.rb
- Unprocessable Entity: raised error message provides insufficient information
- Creating an asset from upload fails
- Why is there nothing working in this gem? HOT 2
- Can't access Users API HOT 2
- Editor interface `sidebar` property unexpectedly `nil` HOT 4
- Inconsistent 400/409 errors HOT 2
- No default reviewers/maintainers added to pull requests HOT 1
- URI.escape is obsolete and does not work with URI 0.10.1 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from contentful-management.rb.