miroc / Laravel-Adminer

Adminer wrapper for Laravel 5
58 stars 24 forks source link

themes #9

Open rebornishard opened 8 years ago

rebornishard commented 8 years ago

how to include themes ? or at least provide responsive theme as default, thanks

btw great package, i'm stuck including adminer.php standalone

ergonomicus commented 8 years ago

Adminer is expecting the .css file in the same folder where it is being executed, so you can download any theme from adminer website and put it in your public folder (where index.php is located). Just leave the default name 'adminer.css' and you should see the theme applied.

I hope that's good enough for your case.

rebornishard commented 8 years ago

@ergonomicus since i move default index to / so i must add adminer.css to dir / ? let me try it,

ok i try both on public/ and / , both of them none worked. i put adminer.css into attachment endorse.zip

btw adminer 1.2.5 released

bkoch31 commented 7 years ago

Having some trouble here too. I tried adding the adminer.css file to the laravel public folder, my public_html/ folder and into the composer package src directory without any luck. Love this package just want this theme added.

cweiske commented 6 years ago

With 4.3.1, I adjusted the CSS as follows:

  1. Extend AdminerAutologinController
  2. Overwrite function index()
  3. In there, check if request()->query->get('file') equals default.css
  4. If yes, echo custom CSS (this is prepended before the adminer CSS, but there is no other way. You have to use !important)
  5. Call parent index() method
jtallinger commented 6 years ago

Hi,

Here is my solution (based on @cweiske's idea):

1) Create a new controller for adminer, include needed auth/acl middlewares (I want to wrap adminer with my normal ACL control). 2) Add: use Illuminate\Support\Facades\Response; 3) Create index function in the new controller:

` public function index() { // Manual override of CSS if (request()->query->get('file') == 'default.css') { // Location of css theme file $file = 'css/adminer/adminer-haeckel.css';

        // Retrieve contents of css file
        if (file_exists($file)) {
            $contents = file_get_contents($file);

            // Create response
            $response = Response::make($contents);

            // Set header to text/css
            $response->header('Content-Type', 'text/css');

            // Send response to client
            return $response;
        }
    }

    require('../vendor/miroc/laravel-adminer/src/adminer-4.5.0-en.php');
}

`

4) Download CSS theme file from adminer. Copy content of default adminer css file (default.css) and add to the top of new theme file.

/r annoying code block feature...