Git Product home page Git Product logo

ember-cli-photoswipe's People

Contributors

alexloi avatar bekzod avatar danielochoa avatar davidgoli avatar ember-tomster avatar jcowley avatar max-konin avatar michalbryxi avatar mschinis avatar n3k avatar osxi avatar sivakumar-kailasam avatar ssendev avatar zeppelin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ember-cli-photoswipe's Issues

Programmatically update when items change

When items are modified, the current implementation does not update the gallery. On first "post-update" click you'll still see the images from the previous initialisation.

Pull request following - added items observer that re-initialises the gallery

msrc attribute is not working

Clone dummy app, set msrc attributes for each item in the items array and run.
For the first clicked image I can see that the larger image is downloaded however it is not shown.
For the next clicked image the larger version is not even downloaded.
In both cases, the short image is shown when expanded.

ember-cli-photoswipe: 1.2.0
ember-cli: 2.14.0
node: 6.10.2
os: win32 x64

How to configure Ui

Default UI Options

Options for PhotoSwipeUI_Default (dist/ui/photoswipe-ui-default.js) are added the same way and to the same object as core options.

-Source

Specifically, I am interested in these

shareButtons: [
{id:'facebook', label:'Share on Facebook', url:'https://www.facebook.com/sharer/sharer.php?u={{url}}'},
{id:'twitter', label:'Tweet', url:'https://twitter.com/intent/tweet?text={{text}}&url={{url}}'},
{id:'pinterest', label:'Pin it', url:'http://www.pinterest.com/pin/create/button/?url={{url}}&media={{image_url}}&description={{text}}'},
{id:'download', label:'Download image', url:'{{raw_image_url}}', download:true}
],

Edit

It looks like there was already some work towards this already?
#10

Possible to make specific sections clickable?

Currently, the whole div (career-path-headshot) causes the photoswipe to open. I would like it to only open if the img (red section of included image) is clicked. I want a custom action (test) to fire if the user clicks the text-ribbon-primary div (green section of included image).

Is the above possible? Or, can I programmatically interact with Photoswipe in my test action to prevent it from opening?

{{#photo-swipe items=model as |img|}}
  <div class='career-path-headshot col-xs-12 col-sm-6 col-md-6 m-b'>
    <img src='{{img.src}}' class='img-responsive' style='transform: none; margin: auto;' alt='{{img.title}}'/>

    <div class='text-ribbon-bottom text-ribbon-primary text-ribbon-opaque' {{action 'test'}}>
      <h2 class='text-uppercase'>{{img.title}}</h2>
    </div>
  </div>
{{/photo-swipe}}

image

element index is not being passed to photoswipe click method

When using the photoswipe component in this way, the actual index of the element is not being passed to the click() function, so it always ends up rendering the first element.

{{#photo-swipe}}
  <a href="http://placekitten.com/g/600/400" data-width="600" data-height="400">
    <img src="http://placekitten.com/g/300/200" alt="kitty!">
  </a>
{{/photo-swipe}}

generator needs to run every time the bower_components dir is cleared.

Right now, ember g photoswipe needs to run every time the bower_components/photoswipe directory is removed or regenerated. This is because the addon creates a custom build of photoswipe without the history module, given that it breaks ember routing.

It would be nice if the generator does not need to be run every time this happens.

Cannot convert a Symbol value to a string

I am trying to set ember-cli.photoswipe locally and i come across to these issues

Cannot convert a Symbol value to a string
TypeError: Cannot convert a Symbol value to a string
Symbol.hasOwnProperty

Symbols don't coerce to strings on their own

schermata 2015-03-15 alle 18 09 52

after all these steps

How can i sort it out?

error: "event listener's handler isn't a function or empty"

I'm on ember 2.2.0 and installed the package:

ember install ember-cli-photoswipe

then restarted ember watch to reload deps and added:

{{#photo-swipe items=model.userimageobjects as |img|}}
        <img class="thumb" src={{img.src}} alt={{img.title}}>
{{/photo-swipe}}

which is showing the images so far.

when hovering them, I can click. but the click does not do anything and no errors show instantly. anyway a few seconds later console shows:

Framework Event Listeners API Errors:
    event listener's handler isn't a function or empty
    event listener's handler isn't a function or empty
    event listener's handler isn't a function or empty
    event listener's handler isn't a function or empty
    event listener's handler isn't a function or empty
    event listener's handler isn't a function or empty
...

I'd be very happy with any advice as I'm a Ember newbie and would love to use this great lib here...

THX!

Uncaught TypeError: Cannot assign to read only property 'initialLayout' of false

Can't use the addon, [email protected]

When I click a thumbnail I get Uncaught TypeError: Cannot assign to read only property 'initialLayout' of false.

Offending code:

_registerModule('Controller', {
    ....
    _listen('initialLayout', function() {
                self.currItem.initialLayout = _options.getThumbBoundsFn && _options.getThumbBoundsFn(_currentItemIndex);
            });

My template:

{{#photo-swipe}}
      {{#each model.bar.photos as |image|}}
        <a class="photo-item" href="{{image.url}}" data-width="{{image.width}}" data-height="{{image.height}}">
          <img src="{{image.url}}" alt="" />
        </a>
      {{/each}}
{{/photo-swipe}}

Code coverage

The test suite right now basically makes sure that the addon can be run with the generator and rendered. It should probably have more coverage for some of its features. Maybe we can do an acceptance test to make sure photoswipe is in fact working?

Using ember-cli-photoswipe without an 'items' attribute is deprecated.

So I'm using the example code/data to try to get this working, and I keep getting these two errors. I'm using the button action approach that opens the gallery.

Using ember-cli-photoswipe without an items attribute is deprecated. and
Cannot read property 'init' of undefined (in regards to this.get('myGallery').init();)

this is what the code looks like

//handlebars
<button class="btn" {{action 'initGallery'}}>Open PhotoSwipe</button>
 {{photo-swipe gallery=myGallery options=psOpts items=items}}

//component
 psOpts: {  
   index: 1
 },
items: [
    {
      src: 'http://placekitten.com/g/600/400',
      w: 600,
      h: 400,
      title: 'whooa'
    },
    {
      src: 'http://placekitten.com/g/1200/900',
      w: 1200,
      h: 900
    }
  ]

actions: {
   initGallery() {
      this.get('myGallery').init();
    }
}

Addon does not work as advertised

This is a deeper issue perhaps, but one that basically cripples this addon for use in Ember 2.0. This is based on the workarounds found in #26.

  • Render a template containing the photo-swipe component with some photos nested inside
  • Update the model that contains the photos
  • Click on the photo-swipe component to open the gallery

Result: The old model's photos are displayed, not the new model's
This is because the photo-swipe component is not compatible with Glimmer and Ember 1.13+. Rather than relying on model bindings on the component, it depends on the didInsertElement hook to inspect its contents. This is a big no-no in Glimmer, as this hook is not guaranteed to fire when the contents have changed.

Additionally, these workarounds contradict the documented usage of the addon based on the README. In fact, the addon's own code marks the usage of the items argument as deprecated. I would strongly recommend restoring the items argument and yielding the individual items as a block.

Empty src causes component crash

Steps to reproduce:

  1. Take sample photoswipe code.
  2. Set src of some property for the gallery to empty string (anything that does not resolve to image will do).
  3. Display the gallery in browser and click on the image to enlarge it.
  4. Observe that there is error in console.

Sample data:

  moo: [
  {
    src: 'http://placekitten.com/g/600/400',
    w: 600,
    h: 400,
    title: 'whooa',
    msrc: '(optional) larger image'
  },
  {
    src: '',
    w: 600,
    h: 400,
    title: 'whooa',
    msrc: '(optional) larger image'
  }
]

With that data I get following error:

ember.debug.js:16591 Uncaught Error: Assertion Failed: You must use Ember.set() to set the `h` property (of [object Object]) to `0`.

and following stack trace.

I found the line in photoswipe source which causes this.

In general, I think ember-cli-photoswipe should pass only plain JSON objects to photoswipe library, because there might be also other cases in which photoswipe changes input data and thus makes EmberJS freak out.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.