Ruby on Rails Monday, February 29, 2016

> On Feb 29, 2016, at 8:39 PM, fugee ohu <fugee279@gmail.com> wrote:
>
>
>
> On Monday, February 29, 2016 at 9:39:28 AM UTC-5, Walter Lee Davis wrote:
>
> > On Feb 28, 2016, at 7:24 PM, fugee ohu <fuge...@gmail.com> wrote:
> >
> >
> >
> [snip]
>
> > > Here's the code they provide, I tried but it doesn't have any effect so far
> > >
> > > blueimp.Gallery(
> > > document.getElementById('links'),
> > > {
> > > onslide: function (index, slide) {
> > > var text = this.list[index].getAttribute('data-description'),
> >
> > For the preceding line to work, your element needs to have the attribute data-description on it. Does it?
> >
> > > node = this.container.find('.description');
> >
> > For the preceding line to work, you need to have an empty HTML element with the classname description present in the page, within the container element of the slide (no clue where that means, I'm just interpreting the code for you). If that element exists, then it will be emptied and re-filled with the description.
> >
> > > node.empty();
> > > if (text) {
> > > node[0].appendChild(document.createTextNode(text));
> > > }
> > > }
> > > }
> > > );
> >
> > My guess is that you are missing one or more of these antecedents, and without them, the JS won't have anything to work with.
> >
> > Walter
> >
> >
> > hi, thanks, i dunno what you mean by an empty html element with the classname description, i think you mean <div class="description"> but that's not my view Here's my view:
> >
> > <div id="links">
> > <table>
> > <% @profile.pictures.in_groups_of(5, false) do |row_tasks| %>
> > <tr>
> > <% for task in row_tasks do %>
> > <td><a href= "<%= task.name %>" data-description = "<%= task.comment %>" data-gallery ><%= image_tag(task.name.thumb) %></a></td>
> > <% end %>
> > <% end %>
> > </tr>
> > </table>
> > </div>
>
> Yes, you did get what I meant. Reading through the portion of the script you provided, I can't see where that element needs to be. Perhaps it is added by the lightbox code when it creates the overlay elements. In any case, you have added the correct data attributes to the link, so that part looks right. In the example for the gallery, was there any reference to creating a separate structure in the page html to receive the description? In the documentation, do they have an example page coded in HTML that includes a secondary overlay element or similar? Or is it all generated by the JS code when the page loads?
>
> Walter
>
> >
> > --
> > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> > To post to this group, send email to rubyonra...@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ed810211-4222-4a87-978f-bf9942b78193%40googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
>
> No, there isn't The docs are at https://github.com/blueimp/Gallery/blob/master/README.md#setup and the relevant section is headed Additional Gallery Elements about 3/4 of the way down ~ fugue

Start here, and see that you do need to add a description element (empty) if you want it to be updated with the value you set in the data-description attribute.

https://github.com/blueimp/Gallery/blob/master/README.md#additional-gallery-elements

Walter

>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ba8a9e19-aead-47d7-b7d1-0e516a6db7dc%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/9FF8A63C-4170-4D75-A9EA-70645A73A68D%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment