Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to add drag and drop sortability to MultipleFileAttachmentField? #25

Open
micahsheets opened this issue Oct 30, 2011 · 3 comments

Comments

@micahsheets
Copy link
Contributor

Uncle Cheese,

Do you have plans to add sortability to this field. I often want to attache a lot of images to an object or page and then need to sort them in the CMS to either select the 1st one as a primary image or to just set the order they display very specifically.

I can see how this might be difficult since I am trying to avoid special data objects to hold my images. But in this case there is a table in the database to manage the relationships so maybe it could just be code added to the onBefore Write of the Page or Object that the images are attached to? I might be able to figure out how to modify the form with jquery sortable and then just write some manual queries to put sort values into a sort column of the relationship table.

@micahsheets
Copy link
Contributor Author

I went ahead and added this functionality myself. I have requested a pull request.

@dospuntocero
Copy link
Contributor

hey micahsheets, I'm not sure if this is related to your functionality, but in the latest kick assets i see a drag and drop functionality.
the problem is when i try to save the object:

Unknown column 'ManyManySort' in 'field list' IN POST /admin/EditForm

do you know how to solve this?

@micahsheets
Copy link
Contributor Author

Hello,

The problem comes from an issue that I have fixed in my fork of Kickassets but Uncle Cheese I don't think has merged my fixes into his branch. The issue is that if the object that has the relationship to the many objects is not decorated with ManyManySortable it will not have the ManyManySort column yet.

if you add the ManyManySortable to your object it should work.
Example: ManyManySortable::add_sortable_many_many_relations(array('ParentManyMany' => 'Relationship'));

I have put a fix into my Kickassets fork that should allow for using the functionality of Kickassets without decorating anything with ManyManySortable but it would work normally without any sortablility.

If you download Kickassets from my fork It should work for you. Please let me know of any bugs you find.

As far as the drag and drop in the MultipleFileAttachementField, that seems to break client side in the javascript so that when you do go to save it will break then as well. As of now I have not found a fix for the client-side javascript.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants