spicywebau / craft-neo Goto Github PK
View Code? Open in Web Editor NEWA Matrix-like field type for Craft CMS that uses existing fields
License: Other
A Matrix-like field type for Craft CMS that uses existing fields
License: Other
Craft 2.6.2789
What do you think this could be all about?
This is in the URL. Why?
../admin/manualupdate/neo
This is a small issue but still a small usability thing and annoyed me a little bit.
When creating a BlockType and you want to change the handle, Cmd + A should select the whole input value, but it directly gets unselected again.
Tested in Chrome 50.0.2661.102.
Hi Benjamin.
First of all, LOVE the plugin. It's how the Matrix should work by default.
But I'm having a error when uploading an asset file (S3) with a preset upload location with {slug} as variable. The error is only showing when using the field inside Neo. As standalone field it's uploading fine.
This is the error: Could not resolve the subpath “{slug}”.
It seems that the UI slows down when an entry has multiple neo fields with a lot of child blocks (not insane amount, but around 10-15 child blocks). It's extra noticeable when scrolling, which becomes sluggish.
It would be a great piece of functionality if it was possible to duplicate an existing and already built block when adding content... with all of the sub fields in tact (although they don't necessarily have to be filled out, for my use case at least)
The duplicate block feature currently only duplicates the block you select the "duplicate" menu item on. Would be handy to be able to duplicate all the currently selected blocks.
Hi, I'm trying to check if a field exists in a neo block. I'm following this suggestion (but for a matrix field) and I can't get it to work:
{% for block in blocks.level(1) %}
{% if block['foo'] is defined %}
yep
{% else %}
nope
{% endif %}
{% endfor %}
It will output 'true' if the field exists anywhere in Craft, even if its not present in the block. Am I missing something?
Thanks in advance.
It would be super helpful if blocks could be dragged in and out of different levels.
At the moment, if you have a block as a child of say a column block, then you have to recreate it if you now need it to be in another column.
A field has to be unique within a section in Craft right? So it's not possible to have a Neo field in a "main content" tab, and then another instance of the same field in a "sidebar" or "footer" tab on the same section.
I tried cloning a Neo field with Field Manager. While the clone was successfully created, all the fields were removed from the original Neo field (silly me should have done a DB backup right before trying this, but I'm sure I can work out how to reassign them back to the original in the DB).
So my question is - how might I go about reusing a Neo field on the same section?
Thanks
Seeing as I'm an uncultured bogan who can't speak anything other than aussie, additional phrases that need translations are
Block type
The maximum number of blocks of this type the field is allowed to have.
Child Blocks
Which block types do you want to allow as children?
Max Child Blocks
The maximum number of child blocks this block type is allowed to have.
Top Level
Will this block type be allowed at the top level?
Define the types of blocks that can be created within this Neo field, as well as the fields each block type is made up of.
Delete block type
Delete group
Unable to nest Neo fields.
Are you sure you want to delete this block type?
Are you sure you want to delete this group?
Add block above
Duplicate block
This field is currently of the Neo type. You may automatically convert it to Matrix along with all of it's content.
Convert
By converting to Matrix, structural information will be lost.
Are you sure? This is a one way operation. You cannot undo conversion from Neo to Matrix.
Could not convert Neo field to Matrix
Obviously not very important, but if anyone has some spare time to translate these phrases into a language they're fluent with, I'll write nice things about you in the README and maybe order you a pizza.
(If you are actually going to do this, I'm happy for you to either open a pull request with the translations implemented or just post them here)
We can limit blocks by type but it would be nice to limit child blocks to a set number to allow a choice of which blocks they want to use.
Currently if I have 3 child blocks I can set a max of 3 to each meaning they can get up to 9 child blocks. If I set 1 max to each type they can only use 3 but have to use one of each.
Sometimes blocks can get pretty long, if they have a lot of content or children in them. Dragging them to change their position can get a little clunky in these cases. Would be good to have an option on the dropdown menu for each block to move their positions up and down as an alternative to dragging.
I've noticed that Rich Text fields are not initialising within Neo. When a block is added with a Rich Text field inside, a JS error is thrown and the Redactor field is not loaded.
Uncaught TypeError: Cannot read property 'opts' of undefined
I believe this is related to the following:
/*<![CDATA[*/
$.extend($.Redactor.opts.langs["en"], {
"fullscreen": "Fullscreen",
"insert-page-break": "Insert Page Break",
"table": "Table",
"insert-table": "Insert table",
"insert-row-above": "Insert row above",
"insert-row-below": "Insert row below",
"insert-column-left": "Insert column left",
"insert-column-right": "Insert column right",
"add-head": "Add head",
"delete-head": "Delete head",
"delete-column": "Delete column",
"delete-row": "Delete row",
"delete-table": "Delete table",
"video": "Video",
"video-html-code": "Video Embed Code or Youtube\/Vimeo Link"
});
new Craft.RichTextInput({
"id": "fields-blogBody-new0-fields-text",
"linkOptions": [{
"optionTitle": "Link to an entry",
"elementType": "Entry",
"sources": ["singles", "section:3", "section:2"]
}],
"assetSources": [],
"transforms": [],
"elementLocale": "en_gb",
"redactorConfig": {
"buttons": ["format", "bold", "italic", "lists", "link", "file", "horizontalrule"],
"plugins": ["source", "fullscreen"]
},
"redactorLang": "en"
});
/*]]>*/
It's possible to trick the fields into working, if a Rich Text field is added to the section outside of Neo, for example:
I'm currently using Neo 1.3.3 in a fresh install of Craft 2.6.2903. I've not installed any other plugins and created all the fields from scratch.
If there's anything else I can give you to help, please let me know.
Thanks in advance,
Tom.
Hey benjammin,
I just noticed that you can't revert an entry to a previous version, the Neo field is just empty. Is this a known bug? Do you think this feature will be available in the near future?
Cheerio
Sidney
Currently the restrictions for limiting blocks by their type, and blocks owning child blocks, are entirely cosmetic (in other words, it's only enforced with client-side Javascript). This is fine for the most part, but if someone were to change the rules for a Neo block type, some current values of that field may then violate these rules. At the moment, you're able to continue saving these field values as if nothing has happened. Adding server-side validation will report these conflicts after a save.
Not sure if anyone has seen this before:
CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint. The SQL statement executed was: ALTER TABLE `craft_neoblocks` ADD CONSTRAINT `craft_neoblocks_ownerLocale_fk` FOREIGN KEY (`ownerLocale`) REFERENCES `craft_locales` (`locale`) ON DELETE CASCADE ON UPDATE CASCADE
Not sure what to do here.
I've just upgraded to version 1.3.5, and now, when I open an entry that uses Neo, I see this alert in the Chrome JS console: "Double-instantiating a transparent text input on an element" - garnish.js:6535
I'm not sure this is actually causing a problem with the plugin's functionality, but the notice was not there before.
With the latest release, Draft tokenized links don't display correctly (or maybe this has always been the case?). If I save an existing entry as a draft and make edits to the draft, when I click the arrow to take me to the tokenized draft link, the changes that we make aren't displayed there and instead displays the current live version. Live Preview works just fine on the Drafts though and when I publish the Draft, the changes that I made in it do overwrite the existing version so that is working as well.
Unfortunately our clients do use the Draft mode quite frequently to get feedback and approval for changes and new layouts for their pages, so we've had to hack up a couple workarounds to that that aren't ideal (duplicate entry, disable the duplicated entry, make edits, and use that link to share out -- disabled entries that have tokenized URLs work just fine with edits/changes).
I took a look at the closed issues and saw that there was another issue relating to Drafts but that seems to have been fixed? So I believe this one is different however I could be wrong.
Thanks so much, other than this small issue we are loving Neo and hope that the Craft team can make it part of the core build at some point!
When I'm creating/updating/editing entries in Draft mode, none of the fields in my Neo field are updating, including Rich Text, Plain Text, Assets, Dropdowns, etc. This only happens on Draft mode though, and only when I save a Draft. Live Preview is working fine on Draft mode (all my additions/edits are showing up as expected), however when I save the Draft and the entry edit page refreshes, all of the changes I made on my fields are wiped away.
This issue doesn't happen (my changes do save and carry over when the entry edit page is refreshed) if I'm in Draft mode, enter in my changes/additions in the fields, and then Publish my draft. The new live published version of the entry has the changes I made to it when I was editing the Draft. It also doesn't happen on edits to published entries or even disabled published entries - every time I save those, the changes I make in the fields don't get wiped away. It seems to only happen on Draft saves.
I'm seeing the issue on dev, staging, and production environments, so I don't suspect it's a server issue.
Would be handy to have block types and groups added after the currently selected one in the configurator. Saves having to reorder every time you add a new one.
Currently only partially implemented.
First thanks again for your work and an awesome plugin. While playing around with it I noticed two small points:
Hi Benjamin.
I'm just wondering if you've hit many performance issues with Neo yet? I have a pretty large Neo field that includes an awful lot of fields including quite a few Matrix fields. I find saving a page with the Neo field is quite slow. I've had a couple of errors when my php memory was set low at 8M, but it's been upped now and although slow, I've not had any errors. I haven't tested properly yet and I'm sure there's some optimisations I can make, just wondering if you've hit anything yet?
Hi
I'm new in Craft. How can i output the children of a block?
With this code a don't get a output for the children. Sorry if my code looks nooby, i'm a craft beginner.
{% for block in entry.body.level(1) %}
{% switch block.type.handle %}
{% case 'boxContentImage' %}
{{ block.richText }}
{% for item in block.children %}
{{ block.something }}
{% endfor %}
{% case .. %}
{% endswitch %}
{% endfor %}
Hi,
I have an issue with a Neo Field that consists of 3 block types.
And each block type has a matrix field in it.
The Neo Field and the matrix fields are all set on translatable.
The two locales are NL (Dutch) and EN (English), with dutch as the primary.
If I add a block for the first time in the Neo field on the English locale, then the matrix field in it has the Dutch locale enabled. See the screenshot, the locale EN for the field is displayed and the matrix block is set to NL instead of EN.
If I add in some matrix blocks with content, all blocks and the content inside are deleted on save. The next screen shows the result after saving:
So the locales of the matrix blocks are now set to the right one: EN. And if I add in matrix blocks, now it gets saved.
Have an Idea to fix this?
With kind regards,
Ruben
First. This plugin changes everything. So well done. Thank you!
I've just built a pretty robust Neo-based install using our internal Live Wires prototyping library. It works amazingly well, there' just one small hitch we're running into… Live Preview doesn't refresh when editing the Neo field.
Possibly related: I had the same issue with another Craft install with the Matrix field when Eager-loading was implemented. Removing eager-loading helped. Same issue as this: http://craftcms.stackexchange.com/questions/8879/issue-with-matrix-type-property-and-live-preview
Not sure if it's just the sheer size of this field, or something else.
Feel free to try out the install for yourself (auto resets every night): http://demo.livewires.io/admin u:admin p:password)
Also here's the repo if you want to see the code used: https://github.com/louderthanten/craft-editorial-system (this field uses the _content.html file and _content folder to render the field).
When first adding a new block type, it sometimes puts it in the wrong location in the child blocks lists. Reordering it then fixes the problem.
In response to the concern about using Neo given it's a third-party plugin, I figured adding graceful degradation would help people feel more confident using it.
Neo fields and Matrix fields obviously aren't 1:1, so there will be a minor loss of information — specifically, block hierarchy information will be lost — but it's better than losing everything.
Just like with Matrix blocks, having the field values summarised in the block title when collapsed would be nice.
In some cases, I would like the first tab in a block to be blank. For example I have a block called "row". It has options, but this block is just a simple container for child blocks and the options are rarely used. I don't want to see them all while adding new rows. In the field layout I create a tab with no fields in it and then another tab with all the optional fields.
When I go back to an entry, this is not respected. Then when I go back to the NEO field settings, the first blank tab I created is gone.
Ironically, this is the result of a bug being fixed that I reported.
Hey Ben, do you currently plan to port Neo to Craft 3 (in due course)?
I understand that Neo is a hobby project and that you can't commit to anything definitively, but Craft 3 is getting close enough that we need to make sure there's an upgrade path for our client sites, and that means thinking carefully about potentially plugin use, especially those that are both fairly substantial and OS, so I wondered if can give any guide at the moment?
Thanks for your time!
Since updating to 1.1.1, all Neo matrixes on our site are broken. The CMS has become obsolete and we have to revert to a previous backup. Here is a list of problem we encountered:
What happened there?
I have a columns block which has column child blocks that are limited to a maximum of 4.
In the scenario I currently face, I have added 1 columns block with 4 (the maximum) child column blocks.
If I add another top-level columns block, it already imposes the limit on adding more children (by graying out the button to add a column).
Because Neo is re-using fields, writing instructions for clients need to be generic so that one field can be used in different situations. Sometimes generic is okay, but sometimes its not clear enough and that would warrant creating a separate field just to accommodate the different instructions. It would be great if we have the ability to override a field's instructions so we can give clearer direction to clients on a per-field basis.
It could be something to replace the instructions on the field, or maybe additional text that can appear below the field.
Having a super minor issue with the javascript prompt for Staying/Leaving showing up without any changes actually made.
Thanks for a brilliant plugin!
Would love to eventually see some documentation with examples of templating and so forth. Various basic use cases perhaps.
Searching Neo fields on elements is broken. Problem being that the search keywords method incorrectly starts a task to generate the keywords, where it should be returning the keywords only. Need to move the task to the onAfterSave()
hook method and have the getSearchKeywords()
just return the currently saved keywords.
I wanted to test. Build a Simple Neo Field with two Blocks not more. Click on Save than a CException
/craft/app/framework/db/ar/CActiveRecord.php(146)
*/
public function __get($name)
{
if(isset($this->_attributes[$name]))
return $this->_attributes[$name];
elseif(isset($this->getMetaData()->columns[$name]))
return null;
elseif(isset($this->_related[$name]))
return $this->_related[$name];
elseif(isset($this->getMetaData()->relations[$name]))
return $this->getRelated($name);
else
return parent::__get($name); => Error
}
/**
* PHP setter magic method.
* This method is overridden so that AR attributes can be accessed like properties.
* @param string $name property name
* @param mixed $value property value
*/
public function __set($name,$value)
{
if($this->setAttribute($name,$value)===false)
{
Tested with Craft 2.6.2781
I've used Neo to add content to my homepage.
Everything worked fine and my homepage does display the content.
But after a while I wanted to change some content and all I saw was one field. The content is still there on the homepage, but I can't see the fields.
When I try to add another field it won't show either (because of the max fields, I do know that a field is added but no is shown). When I add a field above the one field that is displayed, It does shows up.
Edit: same bug #25
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.