mirror of
https://github.com/jbcr/core.git
synced 2026-04-01 13:52:15 +02:00
Merge pull request #581 from bolt/hotfix/more-tiny-tweaks
Working on some more tiny tweaks
This commit is contained in:
7
assets/scss/modules/editor/fields/_pre_postfix.scss
Normal file
7
assets/scss/modules/editor/fields/_pre_postfix.scss
Normal file
@@ -0,0 +1,7 @@
|
||||
.form--helper {
|
||||
font-size: 0.95rem;
|
||||
color: #666;
|
||||
max-width: 46em;
|
||||
display: inline-block;
|
||||
margin: 0.5rem 0;
|
||||
}
|
||||
@@ -4,3 +4,4 @@
|
||||
@import '_textarea';
|
||||
@import '_date';
|
||||
@import '_image';
|
||||
@import '_pre_postfix';
|
||||
|
||||
@@ -31,7 +31,7 @@ theme: skeleton
|
||||
#
|
||||
# This can be done as [nl_NL, Dutch_Netherlands] when specifying multiple
|
||||
# locales, ensure the first is a standard locale.
|
||||
locale: nl_NL
|
||||
locale: en
|
||||
|
||||
# Set the timezone to be used on the website. For a list of valid timezone
|
||||
# settings, see: http://php.net/manual/en/timezones.php
|
||||
|
||||
@@ -8,6 +8,7 @@ use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
class SetupCommand extends Command
|
||||
{
|
||||
@@ -20,21 +21,32 @@ class SetupCommand extends Command
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): ?int
|
||||
{
|
||||
$exitCode = 0;
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
|
||||
$command = $this->getApplication()->find('doctrine:database:create');
|
||||
$commandInput = new ArrayInput(['-q' => true]);
|
||||
$command->run($commandInput, $output);
|
||||
$exitCode += $command->run($commandInput, $output);
|
||||
|
||||
$command = $this->getApplication()->find('doctrine:schema:create');
|
||||
$commandInput = new ArrayInput([]);
|
||||
$command->run($commandInput, $output);
|
||||
$exitCode += $command->run($commandInput, $output);
|
||||
|
||||
$command = $this->getApplication()->find('bolt:add-user');
|
||||
$commandInput = new ArrayInput(['--admin' => true]);
|
||||
$command->run($commandInput, $output);
|
||||
$exitCode += $command->run($commandInput, $output);
|
||||
|
||||
$command = $this->getApplication()->find('doctrine:fixtures:load');
|
||||
$commandInput = new ArrayInput(['--append' => true]);
|
||||
$command->run($commandInput, $output);
|
||||
$exitCode += $command->run($commandInput, $output);
|
||||
|
||||
$io->newLine();
|
||||
|
||||
if ($exitCode !== 0) {
|
||||
$io->error('Some errors occurred while setting up Bolt.');
|
||||
} else {
|
||||
$io->success('Bolt was set up successfully! Start a web server, and open your Bolt site in a browser.');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -131,12 +131,16 @@ class ImageExtension extends AbstractExtension
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ImageField|array|string $image
|
||||
* @param ImageField|Content|array|string $image
|
||||
*/
|
||||
private function getFilename($image): ?string
|
||||
{
|
||||
$filename = null;
|
||||
|
||||
if ($image instanceof Content) {
|
||||
$image = $this->getImageFromContent($image);
|
||||
}
|
||||
|
||||
if ($image instanceof ImageField) {
|
||||
$filename = $image->get('filename');
|
||||
} elseif (is_array($image)) {
|
||||
@@ -149,12 +153,16 @@ class ImageExtension extends AbstractExtension
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ImageField|array|string $image
|
||||
* @param ImageField|Content|array|string $image
|
||||
*/
|
||||
private function getAlt($image): string
|
||||
{
|
||||
$alt = '';
|
||||
|
||||
if ($image instanceof Content) {
|
||||
$image = $this->getImageFromContent($image);
|
||||
}
|
||||
|
||||
if ($image instanceof ImageField) {
|
||||
$alt = $image->get('alt');
|
||||
} elseif (is_array($image)) {
|
||||
@@ -165,4 +173,15 @@ class ImageExtension extends AbstractExtension
|
||||
|
||||
return htmlentities($alt, ENT_QUOTES);
|
||||
}
|
||||
|
||||
private function getImageFromContent(Content $content): ?ImageField
|
||||
{
|
||||
foreach ($content->getFields() as $field) {
|
||||
if ($field instanceof ImageField) {
|
||||
return $field;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,13 +73,14 @@
|
||||
|
||||
<form>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-success mb-3" form="editcontent">
|
||||
<i class="fas fa-save mr-2"></i> {{ 'action.save'|trans }}
|
||||
</button>
|
||||
|
||||
<ul class="ui divided selection list" id="swatcheslist">
|
||||
</ul>
|
||||
<button type="submit" class="btn btn-success mb-3" form="editcontent">
|
||||
<i class="fas fa-save mr-2"></i> {{ 'action.save'|trans }}
|
||||
</button>
|
||||
|
||||
<p>{{ 'label.predominant_colors__in_image'|trans }}:
|
||||
<ul class="ui divided selection list" id="swatcheslist">
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{% include '@bolt/_partials/fields/text.html.twig' with {
|
||||
@@ -157,14 +158,16 @@
|
||||
var swatches = vibrant.swatches();
|
||||
for (var swatch in swatches) {
|
||||
if (swatches.hasOwnProperty(swatch) && swatches[swatch]) {
|
||||
// <li>Vibrant <span class="badge badge-secondary" style="background-color: #94ad49">#94ad49</span></li>
|
||||
|
||||
var elem = document.createElement('li');
|
||||
var label = document.createElement('div');
|
||||
var badge = document.createElement('span');
|
||||
var labelNode = document.createTextNode(swatches[swatch].getHex());
|
||||
var referenceNode = document.getElementById('swatcheslist');
|
||||
label.className = "ui horizontal label";
|
||||
label.setAttribute('style', 'background-color: ' + swatches[swatch].getHex());
|
||||
elem.appendChild(label).appendChild(labelNode);
|
||||
badge.className = "badge badge-secondary ml-2";
|
||||
badge.setAttribute('style', 'background-color: ' + swatches[swatch].getHex());
|
||||
elem.appendChild(document.createTextNode(swatch));
|
||||
elem.appendChild(badge).appendChild(labelNode);
|
||||
referenceNode.append(elem);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1815,5 +1815,11 @@
|
||||
<target>Unknown user</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="EaqUUfe" name="label.predominant_colors__in_image">
|
||||
<segment>
|
||||
<source>label.predominant_colors__in_image</source>
|
||||
<target>Predominant colors in image</target>
|
||||
</segment>
|
||||
</unit>
|
||||
</file>
|
||||
</xliff>
|
||||
|
||||
@@ -1482,5 +1482,11 @@
|
||||
<target>Voorvertoning</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="EaqUUfe" name="label.predominant_colors__in_image">
|
||||
<segment>
|
||||
<source>label.predominant_colors__in_image</source>
|
||||
<target>Overheersende kleuren in afbeelding</target>
|
||||
</segment>
|
||||
</unit>
|
||||
</file>
|
||||
</xliff>
|
||||
|
||||
Reference in New Issue
Block a user