Skip to content

Commit

Permalink
Merge branch '4.0-dev' into project-checklist-ui-fix-2171
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelfolaron authored Dec 16, 2024
2 parents c0b73e0 + d493cdb commit 8c2988c
Show file tree
Hide file tree
Showing 99 changed files with 14,392 additions and 9,269 deletions.
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ release/*
logs/*
target/*
backupdb/*
public/js/*.min.js
public/js/*.map
public/css/*.css
public/dist/*

# PHPStorm specific git ignore to be able to share inspection configs and run tools
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
Expand Down Expand Up @@ -128,4 +126,9 @@ config/.env
caddy
frankenphp
frankenphp-worker.php
storage/event_cache.json
config/_configuration.php
.idea/codebuddy.xml
.codebuddy/summary.md

herd.yml
1 change: 1 addition & 0 deletions .idea/codeception.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions .idea/leantime-oss.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 8 additions & 49 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions app/Core/Events/EventDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ public function addEventListener(
'isWild' => $isWild];
}

public function add_event_listener( $eventName,
string|callable|object $handler,
int $priority = 10
): void {
$this->addEventListener($eventName, $handler, $priority);
}

//Support laravel event listeners
public function listen($events, $listener = null)
{
Expand Down Expand Up @@ -199,6 +206,13 @@ public function addFilterListener(
$this->filterRegistry[$filtername][] = ['handler' => $handler, 'priority' => $priority];
}

public function add_filter_listener( string $filtername,
string|callable|object $handler,
int $priority = 10
): void {
$this->addFilterListener($filtername, $handler, $priority);
}

/**
* Gets all registered listeners
*/
Expand Down
17 changes: 17 additions & 0 deletions app/Core/Providers/ViewServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace App\Core\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Blade;
use Leantime\Core\Support\AssetHelper;

class ViewServiceProvider extends ServiceProvider
{
public function boot()
{
Blade::directive('mix', function ($expression) {
return "<?php echo \Leantime\Core\Support\AssetHelper::mix($expression); ?>";
});
}
}
7 changes: 6 additions & 1 deletion app/Core/Providers/Views.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,12 @@ private function discoverComposerPaths()
return $composerList;
}

public function boot() {}
public function boot(BladeCompiler $blade)
{
$blade->directive('mix', function ($expression) {
return "<?php echo \Leantime\Core\Support\AssetHelper::mix($expression); ?>";
});
}

public function getViewPaths()
{
Expand Down
32 changes: 32 additions & 0 deletions app/Core/Support/AssetHelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace Leantime\Core\Support;

use Illuminate\Support\Facades\File;

class AssetHelper
{
protected static $manifestPath = '/public/dist/mix-manifest.json';
protected static $manifest = null;

public static function mix($path)
{
if (static::$manifest === null) {
if (File::exists(base_path().static::$manifestPath)) {
static::$manifest = json_decode(File::get(base_path().static::$manifestPath), true);
} else {
static::$manifest = [];
}
}

if (!str_starts_with($path, '/')) {
$path = "/{$path}";
}

if (isset(static::$manifest[$path])) {
return '/dist/' . ltrim(static::$manifest[$path], '/');
}

return '/dist/' . ltrim($path, '/');
}
}
6 changes: 6 additions & 0 deletions app/Core/Support/Mix.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,15 @@ public function __construct()

public function __invoke(string $path, string $manifestDirectory = ''): string
{

//Remove trailing slash


$manifestDirectory = Str::start('/', $manifestDirectory ?: APP_ROOT.'/public/dist');
$path = Str::start($path, '/');

$manifestDirectory = rtrim($manifestDirectory, '/');

if (! isset($this->manifest[$manifestDirectory])) {
throw new \Exception("Unable to locate Manifest in: {$manifestDirectory}.");
}
Expand Down
Loading

0 comments on commit 8c2988c

Please sign in to comment.