Problems, need help? Have a tip or advice? Post it here.
11 posts Page 1 of 2
Hi all,

I'm using couch and the very nice feature of inline editing to build a small app, to serve as a text editor for translation work. I find that most text editors require you to have different windows open, and are too cluttered with layout stuff. So I'm using couch to build something more fit to the purpose.

You can see it here: http://thijsvissia.nl/webapp/what-is-wealth.html

Basically the page displays several source texts (to be copy-pasted in, but I aim to find another solution to be able to load a whole text in one go), and a field for the target translation, and all are available for editing at a single click (once logged in). You can split one or both source texts up into single sentences, if you define a character to separate them, and add the same character to the source field(s) at appropriate points. (The splitter function works with "cms:each", and the text splitter area of the page is hidden if no character is defined).

Every fragment of the current translation-in-progress is on its own cloned page of the "webapp" template, numbered, and each of them is listed at the bottom of the page. I will create another part of the same page where the full translation is being output using a cms:pages tag, but I haven't gotten round to this yet.

What I was wondering right now, is if the back-end "Add new" button can somehow be brought to the front end, to create pages from there instead of going to the back end to do so.

Any suggestions appreciated.
Hey, please check this concept http://docs.couchcms.com/concepts/databound-forms.html Hope it fits.
trendoman wrote: Hey, please check this concept http://docs.couchcms.com/concepts/databound-forms.html Hope it fits.


Great, thank you, I wasn't aware of that feature. I'll look into it.
Follow up on this: one reason why I like the inline editing for this thing, is that it leaves out the submit button and the reloading of the page which that entails. This way it's possible to edit all fields on the screen and save them at appropriate moments, but saving one field does not erase unsaved changes in the other fields. And you're not forced to save them all at once.

I think data-bound-forms will definitely be of use for some of the other problems to be solved though, such as populating several new pages with data in one go by splitting up a whole text into paragraphs. I think I'll make a separate template to do that.

But my main question for the editing page as I have it now is to be able to have a button that adds a new page.

Also this can be the super-admin, or regular logged-in user, irrespectively. Is there a way to do this?

edit: another question, is there a specific variable or another method of checking for logged-in status, to use in a conditional (in hiding parts of the page etc.)?
trendoman wrote: Hey, please check this concept http://docs.couchcms.com/concepts/databound-forms.html Hope it fits.


Pleasy ignore my repeated question about the add button in my post above, I realized last night how I can use the data-bound-forms to do what I'm trying, or at least I think so. Thanks for the suggestion.
Update: works like a charm.

I rebuilt the page I already had around a working databound-form (the other way round I couldn't get it to work, actually a good thing because I needed to clean up a little). End result, I've got a working "add page" button without any hacks. After submitting the form (or clicking "add page"), it does take a manual page reload to update the displayed list of pages, before it shows the newly created page, but that's fine for the moment. (Perhaps I can have the success message simultaneously output the link of the newly created page.)

Cheers again, on to the next problem.
A follow-up question: is there a way to output the existing dynamic folders as a radio-button input field or a dropdown inside the databound form?
Thijs wrote: A follow-up question: is there a way to output the existing dynamic folders as a radio-button input field or a dropdown inside the databound form?

Use a regular radio-input, feed it the prepared list of folders. db_persist it as a parameter (see samples in forum).
trendoman wrote: Use a regular radio-input, feed it the prepared list of folders. db_persist it as a parameter (see samples in forum).


Thank you.
I've looked around and most examples are fairly complicated or specific. Are there any examples of using it for only a single parameter?
I tried to make an example page which did that, but it crashed firefox in a wink. :roll:

What confused me about db_persist is that the parameters that don't belong to the db_persist tag as such (the underscored ones), would be the parameter(s) I'm trying to update, but where do I specify the name of the editable itself to which that parameter belongs?

A shorter example would allow me to make better sense of it.
OK, when we need to create a new page and assign it to some *existing* folder at the same time, we need to pass the id of the folder to the db_persist_form/db_persist tag. This is done as (if I remember this correctly)
k_page_folderid = your_folder_id, for example
Code: Select all
<cms:db_persist_form 
     k_page_folderid = '32'
/>

This "32" is a sample Id, which is taken from the value of selected dropdown. Normally, if you use couch dropdowns, cms:input type='dropdown' name='my_folder', then the variable would be frm_my_folder and it will hold the '32' value in it. Then you can use it in the db_persist_form as:
k_page_folderid = frm_my_folder.
With regular inputs, the variable would simply be my_folder.
Hopefully this helps a bit.

Please also check this thread viewtopic.php?f=4&t=8414&hilit=k_page_folderid#p15640
Maybe it should be simply k_folder_id

Or maybe even regular couch databound input <cms:input type='bound' name='k_folder_id' /> would suffice.
Kindly let us know what worked for you :)
11 posts Page 1 of 2