Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Weijers committed Aug 7, 2018
2 parents efadc13 + 3187e16 commit 0f51aea
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# Changelog

## 1.0.5 - 2018-08-07

### Changed
- Added a 'remove icon' button, so you can remove the selected icon
- Fixed a bug that prevented the iconpicker modal from appearing when using the iconpicker field in a matrix field

## 1.0.4 - 2017-12-14

### Changed
Expand All @@ -16,4 +23,4 @@
- Added resource links to download font packages

## 1.0.2 - 2017-09-06
- Initial release
- Initial release
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "dolphiq/iconpicker",
"description": "Craft Iconpicker field type that offers end-users an easy way to pick an icon/symbol from a .woff or .ttf font file.",
"version": "1.0.4",
"version": "1.0.5",
"keywords": [
"craft",
"cms",
Expand Down
1 change: 1 addition & 0 deletions src/resources-app/js/IconpickerModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Craft.IconpickerModal = Garnish.Modal.extend(
selectIcon: function(){
$(this.iconField).find('.iconpicker-icon').val(this.icon);
$(this.iconField).find('.iconpicker-msg').removeClass('dolphiq-iconpicker--empty');
$(this.iconField).find('.iconpickerField_removeicon').removeClass('dolphiq-iconpicker--empty');
$(this.iconField).find('.iconpicker-msg .iconpicker-preview').html('&#x'+(parseInt(this.icon).toString(16))+';');
$(this.iconField).find('.iconpicker-msg .iconpicker-code').html((parseInt(this.icon).toString(16)));
this.hide();
Expand Down
16 changes: 13 additions & 3 deletions src/resources-app/js/field.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ $(function() {

var iconpickerField_modals = [];

$('.iconpickerField_modaltoggle').on('click', function(){
$(document).on('click', '.iconpickerField_modaltoggle', function(){
var p = $(this).parent();
if(p.data('modal-id') !== undefined){
iconpickerField_modals[p.data('modal-id')].show();
Expand All @@ -18,7 +18,17 @@ $(function() {
});

// Close visible modal when clicking on close button
$('document').on('click', '.locationField_modal_close', function(){
$(document).on('click', '.locationField_modal_close', function(){
Garnish.Modal.visibleModal.hide();
});
});

// Remove the selected icon
$(document).on('click', '.iconpickerField_removeicon', function(){
var p = $(this).parent();
$(p).find('.iconpicker-icon').val('');
$(p).find('.iconpicker-msg .iconpicker-preview').html('');
$(p).find('.iconpicker-msg .iconpicker-code').html('');
$(p).find('.iconpicker-msg').addClass('dolphiq-iconpicker--empty');
$(this).addClass('dolphiq-iconpicker--empty');
});
});
3 changes: 2 additions & 1 deletion src/views/main/_field.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
</span>
</p>
<button class="iconpickerField_modaltoggle btn" type="button">Pick an icon</button>
<button class="iconpickerField_removeicon btn <?= empty($value->icon) ? 'dolphiq-iconpicker--empty' : ''?>" type="button">Remove icon</button>

<div class="modal iconpickerField_modal elementselectormodal" style="display: none" id="<?= $name; ?>_modal">
<div class="body">
Expand Down Expand Up @@ -64,4 +65,4 @@
?>
<p>There is no font uploaded to the font folder of this plugin, no font selected in the field settings, or the font contains no icons</p>
<?php
} ?>
} ?>

0 comments on commit 0f51aea

Please sign in to comment.