Skip to content

Commit

Permalink
fixed paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Taha Paksu committed Dec 25, 2019
1 parent 828bcbc commit ee7e4aa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "tpaksu/laravel-todobar",
"description": "A simple todo list drawer for development tasks listing",
"type": "library",
"version": "1.3.0",
"version": "1.3.1",
"license": "MIT",
"authors": [
{
Expand Down
15 changes: 13 additions & 2 deletions src/Controllers/TodoBarController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,21 @@
class TodoBarController extends Controller {

public function getScripts(){
return "<script type='text/javascript'>" . file_get_contents(__DIR__."\\..\\assets\\todobar.js") . "</script>";
return "<script type='text/javascript'>" . file_get_contents($this->assets_path("todobar.js")) . "</script>";
}

public function getDrawer(){
return View::make("laravel-todobar::todobar");
}

public function getStyles(){
return "<style>" . file_get_contents(dirname(__FILE__) . "\\..\\assets\\todobar" . (\config("todobar.dark_mode", false) === true ? "-dark" : "") . ".css") . "</style>";
$dark_mode = config("todobar.dark_mode", false);
$file = "todobar.css";
if($dark_mode){
$file = "todobar-dark.css";
}
$path = $this->assets_path($file);
return "<style>" . file_get_contents($path) . "</style>";
}

public function getInjection()
Expand All @@ -28,4 +34,9 @@ public function getInjection()
public function inject(Response $response){
$response->setContent(str_replace("</body>", "</body>" . $this->getInjection(), $response->getContent()));
}

public function assets_path($file)
{
return implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "assets", $file]);
}
}

0 comments on commit ee7e4aa

Please sign in to comment.