Jump to content

link to instances of repeating content from edit view?


Jennifer S
 Share

Recommended Posts

Here's what I'm doing: I added a repeater field to my basic page type to hold blocks of content to be called as modal pop-up windows as needed by editors. Ideally I could add a box to the Insert Link dialog in the TinyMCE editor and they could choose to insert a link to any and all instances of their repeating content just like a Page or File. In lieu of this, I'd like to output the correct link tag to make the modal appear as part of the field description. I'm currently using an instance of the Title field to use as the unique identifier in the HTML for the pop-up.

I sense I may be going about this in an entirely backward fashion. Advice is welcome.

J

Link to comment
Share on other sites

I'm not sure that I totally understand what you are attempting, but I'll pretend I do. :) With modals and such, you are already relying upon javascript, so it seems like everything else could be accomplished with javascript as well. What you would do is probably link to anchor names in PW, like "#this-item" and "#that-item" or whatever. And those anchor names could match up to <div id='this-item'>...</div>, <div id='that-item'>...</div>, etc. Or you could just look for them to trigger a modal window. Your $(document).ready() function would add click event handlers to any such anchor links. 

$(document).ready(function() {
  $("a[href^=#]").click(function() {
    var anchor = $(this).attr('href'); 
    $(anchor).show(); // or open a modal or something
  }); 
}); 
Link to comment
Share on other sites

Yes. The hard part, I think, is making it clear to editors what to add to their text content to trigger the corresponding modal box. Which is why I was investigating using a "smart" field description that appended the correct ID to an example link tag that editors could then copy and paste as needed, once they added each piece of modal content as a repeating field.

I'm also looking into other means of progressive disclosure because I think relying too heavily on pop-up windows is probably not optimal. :)

Link to comment
Share on other sites

I'm still totally confused about exactly what you are doing :) but it definitely sounds challenging and interesting. Please let us know what solution you ultimately find. A screenshot might ultimately help to clarify too. 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...