Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 67 additions & 59 deletions image-picker/image-picker.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions source/coffee/image-picker.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ sanitized_options = (opts) ->
initialized: undefined,
changed: undefined,
clicked: undefined,
dblclicked: undefined,
selected: undefined,
limit: undefined,
limit_reached: undefined,
Expand Down Expand Up @@ -125,6 +126,7 @@ class ImagePickerOption

destroy: ->
@node.find(".thumbnail").off("click", @clicked)
@node.find(".thumbnail").off("dblclick", @dblclicked)

has_image: () ->
@option.data("img-src")?
Expand Down Expand Up @@ -159,6 +161,9 @@ class ImagePickerOption
@opts.clicked.call(@picker.select, this, event) if @opts.clicked?
@opts.selected.call(@picker.select, this, event) if @opts.selected? and @is_selected()

dblclicked: (event) =>
@opts.dblclicked.call(@picker.select, this, event) if @opts.dblclicked?

create_node: () ->
@node = jQuery("<li/>")
# font-awesome support
Expand All @@ -180,6 +185,7 @@ class ImagePickerOption
if imgAlt
image.attr('alt', imgAlt);
thumbnail.on("click", @clicked)
thumbnail.on("dblclick", @dblclicked)
thumbnail.append(image)
thumbnail.append(jQuery("<p/>").html(@label())) if @opts.show_label
@node.append( thumbnail )
Expand Down