Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kringkaste committed Apr 6, 2019
0 parents commit 0eae690
Show file tree
Hide file tree
Showing 25 changed files with 757 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
42 changes: 42 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "codemonauts/craft-customizable-radio-buttons-field",
"description": "Radio buttons field customizable with CSS classes, icons, images and text",
"version": "1.0.0",
"type": "craft-plugin",
"minimum-stability": "dev",
"keywords": [
"craft",
"cms",
"craftcms",
"craft-plugin"
],
"autoload": {
"psr-4": {
"codemonauts\\buttons\\": "src/"
}
},
"authors": [
{
"name": "codemonauts",
"homepage": "https://www.codemonauts.com"
}
],
"require": {
"craftcms/cms": "^3.0.0"
},
"support": {
"docs": "https://github.com/codemonauts/craft-customizable-radio-buttons-field/blob/master/README.md",
"issues": "https://github.com/codemonauts/craft-customizable-radio-buttons-field/issues"
},
"license": "MIT",
"extra": {
"handle": "buttons",
"name": "Customizable radio buttons field",
"developer": "codemonauts",
"developerUrl": "https://www.codemonauts.com",
"schemaVersion": "1.0.0",
"hasCpSection": false,
"hasSettings": false,
"class": "codemonauts\\buttons\\Buttons"
}
}
67 changes: 67 additions & 0 deletions examples/colorset/buttons.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

return [
'buttonGroups' => [
'colorset' => [
'name' => 'Colorset',
'cssFile' => '@config/buttons/colorset.css',
'buttons' => [
'white' => [
'label' => 'T',
'class' => 'white',
'value' => 'white',
],
'petrol' => [
'label' => 'T',
'class' => 'petrol',
'value' => 'petrol',
],
'petrol--dark' => [
'label' => 'T',
'class' => 'petrol--dark',
'value' => 'petrol--dark',
],
'petrol--soft' => [
'label' => 'T',
'class' => 'petrol--soft',
'value' => 'petrol--soft',
],
'petrol--ultrasoft' => [
'label' => 'T',
'class' => 'petrol--ultrasoft',
'value' => 'petrol--ultrasoft',
],
'gray--soft' => [
'label' => 'T',
'class' => 'gray--soft',
'value' => 'gray--soft',
],
'gray--light' => [
'label' => 'T',
'class' => 'gray--light',
'value' => 'gray--light',
],
'gray' => [
'label' => 'T',
'class' => 'gray',
'value' => 'gray',
],
'gray--dark' => [
'label' => 'T',
'class' => 'gray--dark',
'value' => 'gray--dark',
],
'gray--darker' => [
'label' => 'T',
'class' => 'gray--darker',
'value' => 'gray--darker',
],
'black' => [
'label' => 'T',
'class' => 'black',
'value' => 'black',
],
],
]
],
];
113 changes: 113 additions & 0 deletions examples/colorset/colorset.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
.btn-group label.petrol {
background: #107e8b;
color: #fefefe;
}

.btn-group label.petrol--dark {
background: #0d3b40;
color: #fefefe;
}

.btn-group label.petrol--soft {
background: #e6f1f3;
color: #0a0a0a;
}

.btn-group label.petrol--ultrasoft {
background: #f2f8f8;
color: #0a0a0a;
}

.btn-group label.gray {
background: #848484;
color: #fefefe;
}

.btn-group label.gray--soft {
background: #f7f7f7;
color: #0a0a0a;
}

.btn-group label.gray--light {
background: #cdcdcd;
color: #0a0a0a;
}

.btn-group label.gray--darker {
background: #2f2f2f;
color: #fefefe;
}

.btn-group label.gray--dark {
background: #535353;
color: #fefefe;
}

.btn-group label.black {
background: #0a0a0a;
color: #fefefe;
}

.btn-group label.white {
background: #fefefe;
color: #0a0a0a;
}

.btn-group input[type=radio]:checked + label.petrol {
background-color: #107e8b;
color: #fefefe;
}

.btn-group input[type=radio]:checked + label.petrol--dark {
background-color: #0d3b40;
color: #fefefe;
box-shadow: inset 0 2px 4px #fefefe;
}

.btn-group input[type=radio]:checked + label.petrol--soft {
background-color: #e6f1f3;
color: #0a0a0a;
}

.btn-group input[type=radio]:checked + label.petrol--ultrasoft {
background-color: #f2f8f8;
color: #0a0a0a;
}

.btn-group input[type=radio]:checked + label.gray {
background-color: #848484;
color: #fefefe;
}

.btn-group input[type=radio]:checked + label.gray--soft {
background-color: #f7f7f7;
color: #0a0a0a;
}

.btn-group input[type=radio]:checked + label.gray--light {
background-color: #cdcdcd;
color: #0a0a0a;
}

.btn-group input[type=radio]:checked + label.gray--darker {
background-color: #2f2f2f;
color: #fefefe;
box-shadow: inset 0 2px 4px #fefefe;
}

.btn-group input[type=radio]:checked + label.gray--dark {
background-color: #535353;
color: #fefefe;
box-shadow: inset 0 2px 4px #fefefe;
}

.btn-group input[type=radio]:checked + label.black {
background-color: #0a0a0a;
color: #fefefe;
box-shadow: inset 0 2px 4px #fefefe;
}

.btn-group input[type=radio]:checked + label.white {
background-color: #fefefe;
color: #0a0a0a;
}
36 changes: 36 additions & 0 deletions examples/icons/buttons.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

return [
'cssFile' => '@config/buttons/fontawesome.css',
'buttonGroups' => [
'icons' => [
'name' => 'Transport',
'buttons' => [
'bicycle' => [
'class' => 'fas fa-bicycle',
'value' => 'bicycle',
],
'bus' => [
'class' => 'fas fa-bus',
'value' => 'bus',
],
'car' => [
'class' => 'fas fa-car',
'value' => 'car',
],
'plane' => [
'class' => 'fas fa-plane',
'value' => 'plane',
],
'ship' => [
'class' => 'fas fa-ship',
'value' => 'ship',
],
'subway' => [
'class' => 'fas fa-subway',
'value' => 'subway',
],
],
],
],
];
Binary file added resources/buttons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions src/Buttons.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace codemonauts\buttons;

use codemonauts\buttons\models\Settings;
use craft\base\Plugin;
use craft\events\RegisterComponentTypesEvent;
use craft\services\Fields;
use yii\base\Event;
use codemonauts\buttons\fields\Buttons as ButtonsField;

class Buttons extends Plugin
{
/**
* @inheritdoc
*/
public function init()
{
parent::init();

Event::on(Fields::class, Fields::EVENT_REGISTER_FIELD_TYPES, function(RegisterComponentTypesEvent $event) {
$event->types[] = ButtonsField::class;
});
}

/**
* @inheritdoc
*/
protected function createSettingsModel()
{
return new Settings();
}
}
56 changes: 56 additions & 0 deletions src/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

return [
'buttonGroups' => [
'position' => [
'name' => 'Position',
'buttons' => [
'left-top' => [
'image' => '@codemonauts/buttons/resources/images/left-top.svg',
'title' => 'Top left',
'value' => 'left-top',
],
'center-top' => [
'image' => '@codemonauts/buttons/resources/images/center-top.svg',
'title' => 'Top center',
'value' => 'center-top',
],
'right-top' => [
'image' => '@codemonauts/buttons/resources/images/right-top.svg',
'title' => 'Top right',
'value' => 'right-top',
],
'left-middle' => [
'image' => '@codemonauts/buttons/resources/images/left-middle.svg',
'title' => 'Middle left',
'value' => 'left-middle',
],
'center-middle' => [
'image' => '@codemonauts/buttons/resources/images/center-middle.svg',
'title' => 'Middle center',
'value' => 'center-middle',
],
'right-middle' => [
'image' => '@codemonauts/buttons/resources/images/right-middle.svg',
'title' => 'Middle right',
'value' => 'right-middle',
],
'left-bottom' => [
'image' => '@codemonauts/buttons/resources/images/left-bottom.svg',
'title' => 'Bottom left',
'value' => 'left-bottom',
],
'center-bottom' => [
'image' => '@codemonauts/buttons/resources/images/center-bottom.svg',
'title' => 'Bottom center',
'value' => 'center-bottom',
],
'right-bottom' => [
'image' => '@codemonauts/buttons/resources/images/right-bottom.svg',
'title' => 'Bottom right',
'value' => 'right-bottom',
],
],
],
],
];
Loading

0 comments on commit 0eae690

Please sign in to comment.