Topic: edit-repeat without text editor and prevent delete last

I would like the ability to make repeating sections where not the entire block can be edited.

For example, I have a repeating div on a staff page which has an image on the left and a text section on the right, each are separately editable, but the entire div should not be editable as a whole.

Also, an option to prevent deleting the last occurrence of a repeatable section would be greatly appreciated.

Re: edit-repeat without text editor and prevent delete last

Hi Josh, I've just updated the system. For each repeatable area that you don't want the whole content to be editable simply add this class:
no-repeat-edit

For example:

<div class="edit-repeat no-repeat-edit">
     // editable area 1
     // editable area 2
</div>

If you want to remove the delete button use this class:
no-repeat-delete

For example:

<div class="edit-repeat no-repeat-delete">
     // editable area 1
     // editable area 2
</div>

You may want to apply that class using JavaScript so it is always added to the last repeatable area. Here's an example using jQuery:

$('.edit-repeat:last').addClass('no-repeat-delete');

I hope that helps, let us know if you have any questions or problems.

Re: edit-repeat without text editor and prevent delete last

Hi Simon,

Wow, that was some prompt work.  And those solutions are excellent, they are working great.

There is a very minor issue.  The arrow disappears when the edit button is hidden.

class="edit-repeat"
http://dl.dropbox.com/u/19888282/Temporary/scms01.png

class="edit-repeat no-repeat-edit"
http://dl.dropbox.com/u/19888282/Temporary/scms02.png

edit:

Another minor thing, could you remove the "no-repeat-delete" class on new elements?  Otherwise it creates items that cannot be deleted, until refresh.

Last edited by Josh9 (07 Mar 2012 21:53:54)

Re: edit-repeat without text editor and prevent delete last

Hi Josh, we'll add in an arrow to that box too.

Re: edit-repeat without text editor and prevent delete last

All this should be in a manual, I use simplecms for several months and recently I find these classes