Skip to content

Commit

Permalink
Merge pull request #32 from adshares/develop
Browse files Browse the repository at this point in the history
v0.3.0
  • Loading branch information
m-pilarczyk authored Jun 24, 2021
2 parents 68a910c + 03a18ad commit 073092a
Show file tree
Hide file tree
Showing 76 changed files with 8,191 additions and 8,540 deletions.
20 changes: 9 additions & 11 deletions .env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# In all environments, the following files are loaded if they exist,
# the later taking precedence over the former:
# the latter taking precedence over the former:
#
# * .env contains default values for the environment variables needed by the app
# * .env.local uncommitted file with local overrides
Expand All @@ -15,11 +15,7 @@

###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=5e734d98acd5ca677cae5f6d11921f7e
APP_VERSION=0.1.0
APP_NAME=Adclassify
#TRUSTED_PROXIES=127.0.0.1,127.0.0.2
#TRUSTED_HOSTS='^localhost|example\.com$'
APP_SECRET=0b8c5408e09192de3ef1f5c04aeae06b
###< symfony/framework-bundle ###

TAXONOMY_VERSION=0.1.0
Expand All @@ -30,10 +26,12 @@ CLASSIFIER_SECRET_KEY=65F4102094D4E24B2DC480BE12CA0505299CA5D67B1F8FD9591090B44E
CLASSIFIER_PUBLIC_KEY=614DA6DE6ACD8996E0D9124D437F477FE96CB7AFE2A3E2D9B852F58626A0F695

###> doctrine/doctrine-bundle ###
# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# Configure your db driver and server_version in config/packages/doctrine.yaml
DATABASE_URL=mysql://db_user:[email protected]:3306/db_name
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
#
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
# DATABASE_URL="mysql://db_user:[email protected]:3306/db_name?serverVersion=5.7"
DATABASE_URL="postgresql://db_user:[email protected]:5432/db_name?serverVersion=13&charset=utf8"
###< doctrine/doctrine-bundle ###

###> symfony/swiftmailer-bundle ###
Expand All @@ -42,4 +40,4 @@ DATABASE_URL=mysql://db_user:[email protected]:3306/db_name
# Delivery is disabled by default via "null://localhost"
MAILER_URL=null://localhost
###< symfony/swiftmailer-bundle ###
EMAIL_SENDER=[email protected]
EMAIL_SENDER=[email protected]
4 changes: 0 additions & 4 deletions .env.test

This file was deleted.

11 changes: 1 addition & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,11 @@
/.env.local
/.env.local.php
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###

###> symfony/phpunit-bridge ###
.phpunit
/phpunit.xml
###< symfony/phpunit-bridge ###

###> symfony/web-server-bundle ###
/.web-server-pid
###< symfony/web-server-bundle ###

###> squizlabs/php_codesniffer ###
/.phpcs-cache
/phpcs.xml
Expand Down
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.3.0] - 2021-06-24
### Added
- Banners searcher
### Changed
- Upgrade to PHP 7.4
- Upgrade to Composer 2
- Upgrade to Symfony 5
- Upgrade to node 14

## [0.2.0] - 2021-06-01
### Added
- Direct iframe handling
Expand Down Expand Up @@ -33,7 +42,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Changelog, Readme, License
- Project structure

[Unreleased]: https://github.com/adshares/adclassify/compare/v0.2.0...HEAD
[Unreleased]: https://github.com/adshares/adclassify/compare/v0.3.0...HEAD
[0.3.0]: https://github.com/adshares/adselect/compare/v0.2.0...v0.3.0
[0.2.0]: https://github.com/adshares/adselect/compare/v0.1.2...v0.2.0
[0.1.2]: https://github.com/adshares/adselect/compare/v0.1.1...v0.1.2
[0.1.1]: https://github.com/adshares/adselect/compare/v0.1.0...v0.1.1
Expand Down
13 changes: 4 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,10 @@ composer install
composer dump-env dev
vi .env.local.php
php bin/console doctrine:schema:create
or
php bin/console doctrine:schema:update
or
php bin/console doctrine:migration:migrate
yarn
yarn encore dev
php bin/console server:run
yarn dev
composer dev or php -t ./public -S adclassify.local:8015
```

### Production
Expand All @@ -45,11 +42,9 @@ composer install --no-dev --no-scripts --optimize-autoloader
composer dump-env prod
vi .env.local.php
php bin/console doctrine:schema:create
php bin/console doctrine:migration:migrate
or
php bin/console doctrine:schema:update
yarn
yarn encore production
yarn build
```

Nginx configuration:
Expand Down Expand Up @@ -89,4 +84,4 @@ If not, see <https://www.gnu.org/licenses/gpl.html>.

## More Info

- [AdServer](https://github.com/adshares/adserver) - the core logic behind it all
- [AdServer](https://github.com/adshares/adserver) - the core logic behind it all
5 changes: 5 additions & 0 deletions assets/css/regular.scss
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
body {
#searchForm {
input[type="search"] {
width: 400px;
}
}
}
128 changes: 65 additions & 63 deletions assets/js/button-checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,80 +2,82 @@ import jQuery from 'jquery'

(function ($) {

$.fn.extend({
buttonCheckbox: function (options) {
options = $.extend({}, $.ButtonCheckbox.defaults, options)
this.each(function () {
new $.ButtonCheckbox(this, options)
})
return this
}
})
$.fn.extend({
buttonCheckbox: function (options) {
options = $.extend({}, $.ButtonCheckbox.defaults, options)
this.each(function () {
new $.ButtonCheckbox(this, options)
})
return this
}
})

// ctl is the element, options is the set of defaults + user options
$.ButtonCheckbox = function (ctl, options) {
var $widget = $(ctl),
$button = $widget.find('button'),
$checkbox = $widget.find('input:checkbox'),
onColor = $button.data('onColor') || options.on.color,
offColor = $button.data('offColor') || options.off.color
$.ButtonCheckbox = function (ctl, options) {
var $widget = $(ctl),
$button = $widget.find('button'),
$checkbox = $widget.find('input:checkbox'),
onColor = $button.data('onColor') || options.on.color,
offColor = $button.data('offColor') || options.off.color

// Event Handlers
$button.on('click', function () {
$checkbox.prop('checked', !$checkbox.is(':checked'))
$checkbox.triggerHandler('change')
updateDisplay()
})
$checkbox.on('change', function () {
updateDisplay()
})
// Event Handlers
$button.on('click', function () {
$checkbox.prop('checked', !$checkbox.is(':checked'))
$checkbox.triggerHandler('change')
updateDisplay()
})
$checkbox.on('change', function () {
updateDisplay()
})

// Actions
function updateDisplay () {
var isChecked = $checkbox.is(':checked')
// Actions
function updateDisplay()
{
var isChecked = $checkbox.is(':checked')

// Set the button's state
$button.data('state', (isChecked) ? 'on' : 'off')
// Set the button's state
$button.data('state', (isChecked) ? 'on' : 'off')

// Set the button's icon
$button.find('.state-icon')
.removeClass()
.addClass('state-icon ' + options[$button.data('state')].icon)
// Set the button's icon
$button.find('.state-icon')
.removeClass()
.addClass('state-icon ' + options[$button.data('state')].icon)

// Update the button's color
if (isChecked) {
$button
.removeClass('btn-' + offColor)
.addClass('btn-' + onColor + ' checked')
} else {
$button
.removeClass('btn-' + onColor + ' checked')
.addClass('btn-' + offColor)
}
}
// Update the button's color
if (isChecked) {
$button
.removeClass('btn-' + offColor)
.addClass('btn-' + onColor + ' checked')
} else {
$button
.removeClass('btn-' + onColor + ' checked')
.addClass('btn-' + offColor)
}
}

// Initialization
function init () {
updateDisplay()
// Inject the icon if applicable
if ($button.find('.state-icon').length === 0) {
// $button.prepend('<i class="state-icon ' + options[$button.data('state')].icon + '"></i> ')
}
}
// Initialization
function init()
{
updateDisplay()
// Inject the icon if applicable
if ($button.find('.state-icon').length === 0) {
// $button.prepend('<i class="state-icon ' + options[$button.data('state')].icon + '"></i> ')
}
}

init()
}
init()
}

// option defaults
$.ButtonCheckbox.defaults = {
on: {
icon: 'far fa-check-square',
color: 'primary'
},
off: {
icon: 'far fa-square',
color: 'secondary'
$.ButtonCheckbox.defaults = {
on: {
icon: 'far fa-check-square',
color: 'primary'
},
off: {
icon: 'far fa-square',
color: 'secondary'
}
}
}

})(jQuery)
39 changes: 7 additions & 32 deletions bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,15 @@

use Adshares\Adclassify\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;

if (false === in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.\PHP_SAPI.' SAPI'.\PHP_EOL;
if (!is_file(dirname(__DIR__) . '/vendor/autoload_runtime.php')) {
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
}

set_time_limit(0);
require_once dirname(__DIR__) . '/vendor/autoload_runtime.php';

require dirname(__DIR__).'/vendor/autoload.php';
return function (array $context) {
$kernel = new Kernel($context['APP_ENV'], (bool)$context['APP_DEBUG']);

if (!class_exists(Application::class)) {
throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
}

$input = new ArgvInput();
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
}

if ($input->hasParameterOption('--no-debug', true)) {
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
}

require dirname(__DIR__).'/config/bootstrap.php';

if ($_SERVER['APP_DEBUG']) {
umask(0000);

if (class_exists(Debug::class)) {
Debug::enable();
}
}

$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$application = new Application($kernel);
$application->run($input);
return new Application($kernel);
};
19 changes: 0 additions & 19 deletions bin/phpunit

This file was deleted.

Loading

0 comments on commit 073092a

Please sign in to comment.