Developing a new dexterity widget and field - plone

I need to develop a dexterity content type with a particular field/widget.
This widget is like a multiselection widget but I need to give the
possibility to upload a file for every choosen option. Something like this:
[] option 1 Upload a file: [ ] [ Browse ]
[X] option 2 Upload a file: [ ] [ Browse ]
[] option 3 Upload a file: [ ] [ Browse ]
Any idea/pointer on how to implement this on dexterity? I think it has to do with z3c.form mostly. Any example of similar widget/field is welcome, as any pointer to existing packages :)
I would also manage the vocabulary TTW, if possible, so users with a particular role can update the list.

Though I haven't used this myself I suspect you could look at collective.z3cform.datagridfield and the related demo code on github for pointers on how to use subforms and widget factories.

Related

No permalink in Eleventy

I'm migrating from Jekyll to Eleventy, where previously my blog post links had the permalink in this style: /:title/
What I want: https://example.com/my-blog-post/ for posts/my-blog-post.md
What I get: https://example.com/posts/my-blog-post/ for posts/my-blog-post.md
How can I configure this in Eleventy? The official page on 11ty docs says it takes the name of the folder, which is posts in this case.
I want this /:title/ for all my markdown files. I can't manually set the permalink in all my files. Is there a way to do so for the entire posts collection?
I'm using this repo as the base theme.
So after searching a lot (not the docs), I finally found the solution in this article.
In the last part of that section, use this:
// posts.json (or whatever your collection name is)
{
// ...
"permalink": "/{{ title | slug }}/"
// ...
}
Excerpt:
Using directory data to manage defaults
By default, Eleventy will maintain the structure of your content files when generating your site. In our case, that means /_basic-syntax/lists.md is generated as /_basic-syntax/lists/index.html. Like Jekyll, we can change where files are saved using the permalink property. For example, if we want the URL for this page to be /basic-syntax/lists.html we can add the
following:
---
title: Lists
syntax-id: lists
api: "no"
permalink: /basic-syntax/lists.html
---
Again, this is probably not something we want to manage on a file-by-file basis but again, Eleventy has features that can help: directory data and permalink variables.
For example, to achieve the above for all content stored in the _basic-syntax folder, we can create a JSON file that shares the name of that folder and sits inside it, i.e. _basic-syntax/_basic-syntax.json and set our default values. For permalinks, we can use Liquid templating to construct our desired path:
{
"layout": "syntax",
"tag": "basic-syntax",
"permalink": "basic-syntax/{{ title | slug }}.html"
}
You can set up permalinks per page or per collection. Assume you create a posts folder, then add a posts.11tydata.json file with content to set up basic values for a collection.
{
"eleventyExcludeFromCollections": false,
"layout": "post",
"permalink": "post/{{ title }}/",
"tags": [
"posts"
]
}

How to define the default grammar for new file extensions

I'm opening files in Atom with a new file extension, a file extension that is not recognized by any of the existing grammars (i.e. Plain Test, C, C#, etc.). How can I associate my new file extension with one of the already-available grammars?
Success is being able to open a file with my new file extension and have Atom default to my chosen grammar automatically.
I tried the suggestion but Atom bounced it back at me:
customFileTypes:
"source.fs": [
"*.seedsource"
]
For personal use, you can register a custom file type in the Atom config file (config.cson by default).
Here's a minimal example of what config.cson might look like. Make sure to insert the customFileTypes part at the correct indentation, since CSON files are indentation-sensitive.
"*":
core:
customFileTypes:
"source.c": [
"*.custom-extension"
]
If you want to share this configuration with other users, it's probably better to create a package that contains a grammar file (e.g. grammars/custom.cson):
fileTypes: [
"custom-extension"
]
patterns: [
{
include: "source.c"
}
]
scopeName: "source.c.custom"
In both cases, example.custom-extension would be opened with C syntax highlighting.

Kaa Project - Create Schemas

I follwing the step from https://kaaproject.github.io/kaa/docs/v0.10.0/Programming-guide/Your-first-Kaa-application/
First error occur from step "Create schemas" when I upload and add my schemas like this...
Then I rename "Namespace" from [ org.kaaproject.kaa.schema.sample ]
to [ org.kaaproject.kaa.sample ]
And it work no error
Question: Should I do that? I do something wrong?
That happends because 'Your first Kaa application' resembles the Data Collection sample application which is already in the Sandbox. Thus, the name is already there.
You should either use the existing schema or create another with a different name (what you actually did to make it work).

SuiteScript 2.0 Intellisense create search filter

I'm just starting out with suitescript, and I was wondering how to get the intellisense to work in suitescript 2.0 on creating a saved search.
I know this is easy to do on the netsuite UI but I would like to learn how to do it in Suitescript. Here is example code below. I'm trying to use ctrl + space to show options on the Customer type. I've tried adding ['N/record'] and it gave me options on records.Type.(here were the options) but I can't get it to give me anything inside the filter single quotes.
define(['N/search'],
function(search) {
var MYsearch = search.create({
type: search.Type.CUSTOMER,
title: 'My Customer search',
filters: ['', '', ''] // here is where i want intellisense
})
as a side question: Does anyone know a good place for suitescript 2.0 questions and answers? stackoverflow seems to be lacking. I'm assuming because it's pretty much brand new.
(I know of all the tutorials on the help center and SuiteAnswers)
Thanks for the help!
UPDATE: It looks like Netsuite 2.0 doesn't like Internal IDs... hope that helps.
I usually just create an array for filters, and another for columns, then add my filters to that array like sovar arrFilters = [];
arrFilters.push(search.createFilter({
name: 'mainline',
operator: search.Operator.IS,
values: ['F']
}));
arrFilters.push(search.createFilter({
name: 'trandate',
operator: search.Operator.WITHIN,
values: 'lastMonth',
}));
var arrColumns = [];
// invoiceid
arrColumns.push(search.createColumn({
name: 'internalid',
join: 'appliedtotransaction'
}));
Then you can just use your
search.create({
type: search.Type.VENDOR_PAYMENT,
filters: arrFilters,
columns: arrColumns
});
Hope this helps.
Download the latest SuiteCloud Developer IDE or the Eclipse Mars version (just make sure you have downloaded SuiteCloud plugin SuiteCloud IDE - http://system.netsuite.com/download/ide/update_e4). With this IDE, you will be able to have API code assist for SuiteScript 1.0. However, there is other setup to enable it for SuiteScript 2.0. Also, this will enable you to have intellesense for native fields.
Then if you want to include custom fields/columns, setup your master password at main menu >Netsuite>Master Password>.
Get the list of your accounts from the production, sandbox, and beta environment. Do this at main menu >Netsuite>Manage Account>. If you will be added to a new customer account later, you need to add it manually by doing this step again to reflect it.
Now, you need to connect your project folder to NetSuite account. But first, check the project setting by right clicking to the project folder>NetSuite>Change Project Settings>. Then, make sure you will be using the correct account.
Then log-in to the account by right clicking the project folder >NetSuite>Log in to Project Account>. Once successfully logged-in.
Finally, right click again the project folder >NetSuite>Sync Script IDs from Account>. Follow the instructions and select record type and fields.

Rendering MongoDB documents with Meteor

The question is: how to display complex documents returned from Mongodb.
Suppose I have two projects in my Projects collection and each project has 2 People embedded by their IDs from the People collection.
Project.find() returns this CURSOR which I'm presenting as JSON for readability:
{ "_id" : "5ed5ade8-c140-46f7-8d9e-2344fc53df8e", "name" : "Project1", "personnel" : [ "b4690c4b-d126-4737-8f40-921234567890", "977a6335-a1be-4af5-8b3f-4abcdefghijk" ] }
{ "_id" : "23f073c7-a713-4713-86a7-7d6600433146", "name" : "Project2", "personnel" : [ "b4690c4b-d126-4737-8f40-92b43072d7a1", "977a6335-a1be-4af5-8b3f-48cd5f8328db" ]}
My template in .html file:
<template name="theProjects">
{{#each theTitles}}
Name: {{name}}
Personnel: {{personnel}}
{{/each}}
</template>
renders this in the browser:
Name: Project1
Personnel: b4690c4b-d126-4737-8f40-921234567890,977a6335-a1be-4af5-8b3f-4abcdefghijk
Name: Project2
Personnel:b4690c4b-d126-4737-8f40-92b43072d7a1,977a6335-a1be-4af5-8b3f-48cd5f8328db
Questions:
The {{personnel}} field is simply being filled in by the contents of the personnel array in the Projects collect. I want to list these separately on their own line. Can't figure that out. Just slicing won't do because...
The greater need clearly is to be able to manipulate and edit the Personnel data so the template has to be properly Meteor reactive.
Now the hard one: the personnel ID's from the People collection are embedded in the Project documents. How would I use Meteor to replace the ID's with the appropriate names from the Personnel collection and still keep their data reactivity?
I know this is a lot to ask but these kind of things seem like they are foundational to bigger and more complex web site.
Thanks everyone.
https://gist.github.com/3220991
This is a gist I made to show you use the of Handlebars helpers. This will stay reactive and is very easy to use. I hope you can use it.
If you need more help or comments , just mention me.

Resources