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

Commit

Permalink
Merge pull request #5 from Dolphiq/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
johanzandstra authored Dec 14, 2017
2 parents 3d65de8 + d826535 commit efadc13
Show file tree
Hide file tree
Showing 9 changed files with 115 additions and 25 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Changelog
## 1.0.4 - 2017-12-14

### Changed
- Changed the plugin icon
- Made compatible with Craft RC2
- Use css for the font-asset style set and not scss (sass) to support more environments

## 1.0.3 - 2017-10-06

Expand Down
33 changes: 28 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,30 @@ You can easily use ionicons or font awesome icons

## Usage sample in twig template

### Quick example code
{% do view.registerAssetBundle("plugins\\dolphiq\\iconpicker\\assets\\sharedAsset") %}
<html style="padding: 0; margin: 0;">
<head>
<title></title>

{{ head() }}

</head>

<body>

{{ beginBody() }}

{% if entry.iconPickerField.icon %}
Hex: {{ entry.iconPickerField.icon }}<br>
{{ entry.iconPickerField.iconSpan|raw }}
{% endif %}

{{ endBody() }}

</body>
</html>

Display an icon with a custom class:

<span class='{{ entry.iconClass }} myCustomClass'>{{ entry.iconChar }}</span>
Expand Down Expand Up @@ -75,17 +99,16 @@ Display an icon with a custom class:
6. Get the icon font class

{{ entry.fieldName.iconClass }}

7. Get the icon name

{{ entry.fieldName.iconName }}

8. Conditional example of showing icon only when it is set
7. Conditional example of showing icon only when it is set

{% if entry.fieldName.icon %}
{{ entry.fieldName.iconSpan|raw }}
{% endif %}

## Iconpicker Roadmap
- Select and upload the fonts in the UI
- Enable (name) search while picking an icon

### Contributors & Developers
Lucas Weijers - Original developer
Expand Down
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
{
"name": "dolphiq/iconpicker",
"description": "Craft Iconpicker plugin provides a new field type that offers users an easy way to pick an icon from a .woff or .ttf font file.",
"version": "1.0.3",
"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",
"keywords": [
"craft",
"cms",
"craftcms",
"craft-plugin",
"icon",
"symbol",
"iconpicker",
"craft3"
],
"type": "craft-plugin",
"license": "MIT",
"require": {
"craftcms/cms": "^3.0.0-beta.20",
"craftcms/cms": "^3.0.0-RC2",
"phenx/php-font-lib": "^0.5.0"
},
"autoload": {
Expand All @@ -32,7 +33,7 @@
"extra": {
"handle": "dolphiq-iconpicker",
"name": "Iconpicker",
"description": "Craft Iconpicker plugin provides a new field type that offers users an easy way to pick an icon from a .woff or .ttf font file.",
"description": "Craft Iconpicker field type that offers end-users an easy way to pick an icon/symbol from a .woff or .ttf font file.",
"schemaVersion": "1.0.0",
"developer": "Dolphiq",
"developerUrl": "https://dolphiq.nl/",
Expand Down
10 changes: 5 additions & 5 deletions src/Plugin.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
/**
* Created by PhpStorm.
* User: lucasweijers
* Date: 19-05-17
* Time: 15:23
* Craft3 Forms plugin
*
* @author Lucas Weijers
* @copyright Copyright (c) 2017 Dolphiq
* @link https://dolphiq.nl/
*/


namespace plugins\dolphiq\iconpicker;

use Craft;
Expand Down
8 changes: 4 additions & 4 deletions src/assets/appAsset.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
/**
* Created by PhpStorm.
* User: lucasweijers
* Date: 16-08-17
* Time: 14:58
* Created by Dolphiq
* Lucas Weijers
* Date: 2017-10-16
*
*
* This asset will publish all css and js needed voor the backend application
*/
Expand Down
17 changes: 12 additions & 5 deletions src/assets/sharedAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,18 @@ public function init()
// define the path that your publishable resources live
$this->sourcePath = '@vendor/dolphiq/iconpicker/src/resources-shared';

// The css file is autogenerated in field/iconpicker.php, with the fonts that are available in the resources-shared folder
$this->css = [
'css/fonts.scss',
];

// try to find the file, if scss exists,
if(file_exists(__DIR__. '/../resources-shared/css/fonts.css')) {
// The css file is autogenerated in field/iconpicker.php, with the fonts that are available in the resources-shared folder
$this->css = [
'css/fonts.css',
];
} elseif(file_exists(__DIR__ . '/../resources-shared/css/fonts.scss')) {
// The css file is autogenerated in field/iconpicker.php, with the fonts that are available in the resources-shared folder
$this->css = [
'css/fonts.scss',
];
}
parent::init();
}
}
2 changes: 1 addition & 1 deletion src/fields/Iconpicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ public function getFontCss()
}
}

file_put_contents(Craft::getAlias($sharedAsset->sourcePath . '/css/fonts.scss'), $scss);
file_put_contents(Craft::getAlias($sharedAsset->sourcePath . '/css/fonts.css'), $scss);

// Register the assetbundle that loads the generated css
Craft::$app->view->registerAssetBundle(sharedAsset::className());
Expand Down
53 changes: 52 additions & 1 deletion src/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/templates/fieldSettings.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
id: 'dolphiq-iconpicker-font',
name: 'iconFont',
options: fonts,
instructions: 'To select an other font, upload more font files (.ttf or .woff) in the plugins font directory. (src/resources-shared/fonts)',
value: field.iconFont,
}) }}


{% else %}

<p class="warning">You need to put at least one font (.ttf or .woff) in the plugins font directory. (src/resources-shared/fonts)</p>
Expand Down

0 comments on commit efadc13

Please sign in to comment.