-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
256 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import 'jquery-ui/ui/widgets/slider'; | ||
import Register from '../../common/utils/Register'; | ||
|
||
export default class NumberSlider { | ||
|
||
constructor ($sliderContainer) { | ||
|
||
$sliderContainer.children('.js-number-slider__slider').slider({ | ||
min: 0, | ||
max: 1, | ||
step: 0.01, | ||
slide: function (event, ui) { | ||
$(this).next('.js-number-slider__input').val(ui.value); | ||
}, | ||
create: function (event, ui) { | ||
$(this).slider('value', $(this).next('.js-number-slider__input').val()); | ||
} | ||
}); | ||
} | ||
|
||
static init ($container) { | ||
$container.filterAllNodes('.js-number-slider').each(function () { | ||
// eslint-disable-next-line no-new | ||
new NumberSlider($(this)); | ||
}); | ||
} | ||
} | ||
|
||
(new Register()).registerCallback(NumberSlider.init, 'NumberSlider.init'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
assets/styles/admin/libs/number-slider/number-slider-custom.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
.js-number-slider .js-number-slider__slider { | ||
width: @input-width / 2; | ||
display: inline-block; | ||
margin-right: @input-width / 10; | ||
vertical-align: middle; | ||
margin-bottom: 1em; | ||
} | ||
.js-number-slider input { | ||
width: @input-width / 2.5; | ||
display: inline-block; | ||
|
||
} | ||
.js-number-slider .ui-slider-handle.ui-state-default { | ||
background: @color-orange; | ||
border: 1px solid @color-grey; | ||
color: #fff; | ||
} | ||
.js-number-slider .ui-slider-handle.ui-state-active { | ||
background: @color-grey; | ||
border: 1px solid @color-yellow; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Shopsys\FrameworkBundle\Form; | ||
|
||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\Form\Extension\Core\Type\NumberType; | ||
|
||
class NumberSliderType extends AbstractType | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getParent(): ?string | ||
{ | ||
return NumberType::class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Shopsys\FrameworkBundle\Migrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Shopsys\MigrationBundle\Component\Doctrine\Migrations\AbstractMigration; | ||
|
||
class Version20241031100638 extends AbstractMigration | ||
{ | ||
/** | ||
* @param \Doctrine\DBAL\Schema\Schema $schema | ||
*/ | ||
public function up(Schema $schema): void | ||
{ | ||
$this->sql('ALTER TABLE slider_items ADD COLUMN description TEXT DEFAULT NULL'); | ||
$this->sql('ALTER TABLE slider_items ADD COLUMN rgb_background_color VARCHAR(7) NOT NULL DEFAULT \'#808080\''); | ||
$this->sql('ALTER TABLE slider_items ADD COLUMN opacity NUMERIC(3, 2) NOT NULL DEFAULT 0.8'); | ||
$this->sql('ALTER TABLE slider_items ALTER rgb_background_color DROP DEFAULT'); | ||
$this->sql('ALTER TABLE slider_items ALTER opacity DROP DEFAULT;'); | ||
} | ||
|
||
/** | ||
* @param \Doctrine\DBAL\Schema\Schema $schema | ||
*/ | ||
public function down(Schema $schema): void | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{% block number_slider_widget %} | ||
<div class="form-line__side"> | ||
<div class="form-line__item"> | ||
<div class="js-number-slider"> | ||
<div class="js-number-slider__slider"> | ||
</div> | ||
{% set attr = attr|merge({'class': ((attr.class|default('') ~ ' js-number-slider__input input')|trim)}) %} | ||
<input type="text" {{ block('widget_attributes') }} {% if value is not empty %}value="{{ value }}" {% endif %}/> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
{% endblock number_slider_widget %} |