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

Doesnt work with embercli with ember 2.0 #26

Closed
abhayathapa opened this issue Nov 21, 2015 · 8 comments
Closed

Doesnt work with embercli with ember 2.0 #26

abhayathapa opened this issue Nov 21, 2015 · 8 comments

Comments

@abhayathapa
Copy link

I created items on model on route and used the {{photoswipe}} as in this dummy app but nothing renders and no error is given

@lifeart
Copy link

lifeart commented Nov 27, 2015

+1

@dzena
Copy link

dzena commented Dec 3, 2015

I have the same problem. I'm using ember 1.12.0 and ember-cli 1.13.8.
Solve the problem in the following way though:

{{#photo-swipe}}
 {{#each model.product.pictures as |img|}}
     <a class="photo-item" href={{img.readUrl}} data-width="100" data-height="100">
        <img src={{img.readUrl}} width="100" height="100" alt={{img.fileName}}>
     </a>
 {{/each}}
{{/photo-swipe}}

I just realised that this is def. not a good solution. Mainly because data- attributes will always have a static value, and that fact will affect your pictures (height and width) when you open the gallery.

@davidgoli
Copy link
Contributor

Please don't do as @dzena's example shows - this is deprecated, breaks the bindings, and prevents updates to your model from being reflected in the slideshow. Instead, make sure your items are structured as follows:

items = [
  {
    src: 'http://your/photo.jpg',
    w: 320,
    h: 480,
    title: 'fancy pic',
    msrc: 'bigger size url'
  }
];

Then invoke the component like so:

{{#photo-swipe items=items as |item|}}
  <img src={{item.src}} alt={{item.title}} />
{{/photo-swipe}}

For most of us, this will mean mapping your model properties into the PhotoSwipe item structure.

@davidgoli
Copy link
Contributor

Oh and here's another thing - the latest published version 1.1.0 is not using the same code as you see on the master branch; it's a few commits behind and doesn't work with the README you see here. Hopefully the maintainers of this addon will wake up from their deep deep sleep and publish a new version with what they have here in master. Until then, you can pin in package.json:

"ember-cli-photoswipe": "poetic/ember-cli-photoswipe#master"

@dzena
Copy link

dzena commented Feb 12, 2016

@davidgoli
I still have the same problem. Nothing is being rendered.
ember-cli: 1.13.8
ember: 1.12.0

 items: Ember.computed("model.product.pictures.[]", function () {
    var pictures = this.get("model.product.pictures");

    var items = [];

    pictures.forEach(function (picture) {
      var item = {
        src: picture.get("readUrl"),
        w: 320,
        h: 480,
        title: picture.get("fileName"),
        msrc: "bigger"
      };

      items.push(item);
    });

    return items;
  }),
{{#photo-swipe items=items as |item|}}
      <img class="thumb" src={{item.src}} alt={{item.title}} />
{{/photo-swipe}}

@davidgoli
Copy link
Contributor

@dzena what version of ember-cli-photoswipe are you running?

@dzena
Copy link

dzena commented Feb 12, 2016

"ember-cli-photoswipe": "poetic/ember-cli-photoswipe#master"

@davidgoli
Copy link
Contributor

I just published 1.2.0 to npm so you should once again be able to point to that version now for this functionality.

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

4 participants