Skip to content

Commit b3b6b37

Browse files
committed
module should now be detected & other stuff
1 parent 2ad1bd7 commit b3b6b37

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

_config.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?php

javascript/ImageSelect.jquery.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
// MIT License, https://github.com/websemantics/Image-Select/blob/master/LICENSE
99

10+
// Modified for DropdownImageField
11+
1012
(function($) {
1113

1214
// Image template, this can be overridden from the constructor (options.template),
@@ -157,7 +159,7 @@
157159
var option = options[i];
158160
var img_src = $(option).attr('data-img-src');
159161

160-
if(img_src != undefined){
162+
if(typeof img_src != undefined && img_src != ''){
161163
var template = html_template.replace('{url}',img_src);
162164
// SS uses a modified Chosen.js and after the 'showing_dropdown' event the
163165
// values get immediatelly reset, also removing the images. Solved it with setTimeout.

templates/DropdownImageField.ss

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
<select $AttributesHTML>
22
<% loop $Options %>
3-
<option
4-
data-img-src="$Image.URL"
5-
value="$Value.XML"<% if $Selected %>
6-
selected="selected"<% end_if %><% if $Disabled %>
7-
disabled="disabled"<% end_if %>>
8-
<% if $Title = "--nbsp" %>&nbsp;
9-
<% else %>$Title.XML<% end_if %></option>
3+
<option data-img-src="$Image.Link" value="$Value.XML"<% if $Selected %> selected="selected"<% end_if %><% if $Disabled %> disabled="disabled"<% end_if %>><% if $Title = "--nbsp" %>&nbsp;<% else %>$Title.XML<% end_if %></option>
104
<% end_loop %>
115
</select>

0 commit comments

Comments
 (0)