Sign in to follow this  
louisstephens

"Drag and Drop" pages to Page field (brainstorming)

Recommended Posts

So, I really don't know where to begin with this. I have the thought in my head (the basics), but not really sure how to set it up.

The desired effect:

The homepage is set up with a foreach loop that outputs all the child pages (basically just a bunch of pages with pdfs, docs etc stored in a file field). When A user is actually logged in, they can "star" an item or drag and drop (using Dragula) the page to a sidebar. Also, they would be able to reorder the pages in the sidebar.

The question(s):

I guess I have multiple questions regarding how to achieve this.

  1. Would it be best to create a page field in the user template to save the page(s)?
  2. How would you actually save the page state (sidebar output, reordering, etc) once the drag and drop has been used?

Thanks in advance for any help! A lot of this was just what was in my head, so it might not make full sense. However, I will update this if I can actually wrap my head around everything.

Share this post


Link to post
Share on other sites

You could do this entirely just client-side, i.e. use cookies to store the pages and page-ordering.

How would I save the page state? If you really want to save it in PW, simply create a textarea and save a JSON object, or maybe even a simple comma-separated list with page IDs would do the job. With Ajax, you would then simply post (save) a user-choice to PW, or retrieve it like that. No need to even use something like page reference fields.

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By webhoes
      Hello,
      I am working of a site for a sport organisation.
      All affiliated gyms can edit their profile. I have used the advaced mode so that if you create a new page under location the gym can login and edit their profile.
      i also want that they can add instructors as child of their profile and also are able to edit those instructors.
      I can not get passed the able to edit all subpaged or none.
      How should this be done? Or is this not possible?
    • By benbyf
      Sure this has been asked a million times but cant find a simple answer.
      Trying to set the page to redirect to after login in the front end - i.e. not on the admin login page.
      some reason this works for super users but not normal users redirecting to a page which is viewable by members not guest role users.
       
      $showLoginError = false; if($input->post->user && $input->post->pass) { $username = $sanitizer->username($input->post->user); $pass = $input->post->pass; try { $session->login($username, $pass); // redirect user $session->redirect("/events/"); } catch (\Exception $e) { $showLoginError = true; } }  
    • By Eunico Cornelius
      Hi, I am new to process wire and I've been trying to change the date time format in my webpage according to its language selection(example: English 'd/m/y' , Deutsch: 'd.m.y'). I know that using 
      $datetime->getDateFormats(); we can achieve the type of formats in the shape of indexes. Also, by using 
      $user->language->id we can know which language we are using. How do I combine this two functions so that when I select English/Deutsch, the date will be adjusted accordingly?
      Is there a specific function that can do this or is there any provided index in the $user->language somewhere. Thanks in advance :).
    • By benbyf
      Strange question but I was wondering if it was possible to have more than one user with the same user name - or put in another way, allow the user to login with the same name but different passwords...?
    • By prestoav
      I have a site built with a user role 'member' that can view some extra 'member area' pages. I have a user with the role 'editor' that has been given 'user-admin' permission who can successfully generate new users. However, when they try to add / change a 'member' role password to a 'member' role they get the error:
      Unable to generate password hash Does anyone know how to assign the 'editor' role the permission to generate a password for other user types?
      Thanks!