Skip to content

Commit

Permalink
Merge branch 'develop' into feature/kopff_clear_layout
Browse files Browse the repository at this point in the history
  • Loading branch information
maurofmferrao authored Dec 19, 2024
2 parents d5dd8a0 + f7f6502 commit 6d51a5b
Show file tree
Hide file tree
Showing 140 changed files with 6,562 additions and 6,284 deletions.
19 changes: 9 additions & 10 deletions bin/locale.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* Copyright (C) 2023 Xibo Signage Ltd
* Copyright (C) 2024 Xibo Signage Ltd
*
* Xibo - Digital Signage - https://xibosignage.com
*
Expand Down Expand Up @@ -29,14 +29,16 @@

use Slim\Flash\Messages;
use Slim\Views\Twig;
use Slim\Views\TwigExtension;
use Twig\TwigFilter;
use Xibo\Service\ConfigService;
use Xibo\Twig\ByteFormatterTwigExtension;
use Xibo\Twig\DateFormatTwigExtension;
use Xibo\Twig\TransExtension;
use Xibo\Twig\TwigMessages;

error_reporting(E_ALL);
ini_set('display_errors', 1);

define('PROJECT_ROOT', realpath(__DIR__ . '/..'));
require_once PROJECT_ROOT . '/vendor/autoload.php';

Expand All @@ -57,8 +59,6 @@
$view->addExtension(new TwigMessages(new Messages($storage)));

foreach (glob(PROJECT_ROOT . '/views/*.twig') as $file) {
echo var_export($file, true) . PHP_EOL;

$view->getEnvironment()->load(str_replace(PROJECT_ROOT . '/views/', '', $file));
}

Expand Down Expand Up @@ -137,7 +137,7 @@ function __($original)
}
if (!empty($setting->helpText)) {
// replaces any single quote within the value with a backslash followed by a single quote
$helpText = addslashes($setting->helpText);
$helpText = addslashes(trim($setting->helpText));
$content .= 'echo __(\''.$helpText.'\');' . PHP_EOL;
}

Expand All @@ -153,7 +153,7 @@ function __($original)
// Properties translation
foreach ($module->properties as $property) {
if (!empty($property->title)) {
$content .= 'echo __(\''.$property->title.'\');' . PHP_EOL;
$content .= 'echo __(\''.addslashes(trim($property->title)).'\');' . PHP_EOL;
}
if (!empty($property->helpText)) {
// replaces any single quote within the value with a backslash followed by a single quote
Expand All @@ -167,7 +167,7 @@ function __($original)
// Property rule test message
$message = $test->message;
if (!empty($message)) {
$content .= 'echo __(\''.$message.'\');' . PHP_EOL;
$content .= 'echo __(\''.addslashes(trim($message)).'\');' . PHP_EOL;
}
}
}
Expand All @@ -190,11 +190,11 @@ function __($original)
// Properties Translation
foreach ($moduleTemplate->properties as $property) {
if (!empty($property->title)) {
$content .= 'echo __(\''.$property->title.'\');' . PHP_EOL;
$content .= 'echo __(\''.addslashes(trim($property->title)).'\');' . PHP_EOL;
}
if (!empty($property->helpText)) {
// replaces any single quote within the value with a backslash followed by a single quote
$helpText = addslashes($property->helpText);
$helpText = addslashes(trim($property->helpText));
$content .= 'echo __(\''.$helpText.'\');' . PHP_EOL;
}

Expand All @@ -219,6 +219,5 @@ function __($original)
}
}

$content .= '?>';
file_put_contents($file, $content);
echo 'moduletranslate.file created and data written successfully.';
62 changes: 62 additions & 0 deletions cypress/e2e/Layout/Editor/layout_editor_background.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Copyright (C) 2024 Xibo Signage Ltd
*
* Xibo - Digital Signage - https://xibosignage.com
*
* This file is part of Xibo.
*
* Xibo is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* Xibo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
*/

describe('Layout Editor', function() {
beforeEach(function() {
cy.login();
cy.visit('/layout/view');
cy.get('button.layout-add-button').click();
cy.get('#layout-viewer').should('be.visible'); // Assert that the URL has changed to the layout editor
});

it('should update the background according to the colour set via colour picker', function() {
cy.get('#properties-panel').should('be.visible'); //Verify properties panel is present
cy.get('.input-group-prepend').click(); //Open colour picker
cy.get('.colorpicker-saturation').click(68, 28); //Select on a specific saturation
cy.get('#properties-panel').click(30, 60); //Click outside color picker to close
//Verify the selected color is applied to the background
cy.get('#layout-viewer').should('have.css', 'background-color', 'rgb(243, 248, 255)');
});

it('should update the background according to the colour set via hex input', function() {
cy.get('#properties-panel').should('be.visible');
cy.get('#input_backgroundColor').clear().type('#b53939{enter}');
//Verify the selected color is applied to the background
cy.get('#layout-viewer').should('have.css', 'background-color', 'rgb(243, 248, 255)');
});

it('should update the layout resolution', function() {
cy.get('#properties-panel').should('be.visible'); //Verify properties panel is present
const resName='cinema';
cy.get('#input_resolutionId')
.parent()
.find('.select2-selection')
.click();
cy.get('.select2-container--open input[type="search"]')
.type(resName);
cy.selectOption(resName);
cy.get(".layout-info-dimensions span")
.should("be.visible")
.and("contain", "4096x2304");

});

});
Loading

0 comments on commit 6d51a5b

Please sign in to comment.