Skip to content

Commit

Permalink
Removing .icon class as it clashes with SS style definition
Browse files Browse the repository at this point in the history
  • Loading branch information
jaedb committed Feb 22, 2018
1 parent 6713d95 commit c0283cd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion _config/config.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
IconField:
icons_directory: site/icons
icons_directory: /site/icons/
7 changes: 7 additions & 0 deletions code/IconField.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use SilverStripe\View\Requirements;
use SilverStripe\View\ArrayData;
use SilverStripe\ORM\ArrayList;
use SilverStripe\Forms\FormField;
use SilverStripe\Forms\OptionsetField;
use SilverStripe\Core\Config\Config;

Expand Down Expand Up @@ -88,13 +89,19 @@ public function Field($properties = array()) {
));

return $this->customise($properties)->renderWith('IconField');
//return FormField::Field($properties);
}

/**
* Handle extra classes
**/
public function extraClass(){
$classes = array('field', 'IconField', parent::extraClass());

if (($key = array_search("icon", $classes)) !== false) {
unset($classes[$key]);
}

return implode(' ', $classes);
}
}
Expand Down
18 changes: 9 additions & 9 deletions css/IconField.css
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@

.field.icon ul {
.field.IconField ul {
margin: 0;
padding: 0;
border-radius: 4px;
border: 1px solid #b3b3b3;
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAJUlEQVQYV2N89+7dfwY0ICQkxIguxjgUFKI7GsTH5m4M3w1ChQDSWCb4tR+WrAAAAABJRU5ErkJggg==");
}

.field.icon .option {
.field.IconField .option {
display: inline-block;
}

.field.icon .option input {
.field.IconField .option input {
display: none;
}

.field.icon .option label {
.field.IconField .option label {
display: inline-block;
width: 50px;
height: 50px;
Expand All @@ -28,21 +28,21 @@
position: relative;
}

.field.icon .option label:hover {
.field.IconField .option label:hover {
background: rgba(0,0,0,0.1);
}

.field.icon .option label img {
.field.IconField .option label img {
max-width: 100%;
max-height: 100%;
}

.field.icon .option input:checked + label {
.field.IconField .option input:checked + label {
background-color: #3875d7;
background-image: -moz-linear-gradient(center top , #3875d7 20%, #2a62bc 90%);
}

.field.icon .option:first-child label:after {
.field.IconField .option:first-child label:after {
content: 'No icon';
display: block;
color: #000000;
Expand All @@ -55,6 +55,6 @@
right: 0;
}

.field.icon .option input:checked + label:after {
.field.IconField .option input:checked + label:after {
color: #FFFFFF;
}

0 comments on commit c0283cd

Please sign in to comment.