Commit 2d44b457 authored by Yassine Doghri's avatar Yassine Doghri
Browse files

feat: enhance admin ui with responsive design and ux improvements

- add podcast sidebar navigation
- add podcast dashboard with latest episodes
- add pagination to podcast episodes
- add components helper to reuse ui components (button, data_table, etc.)
- enhance podcast and episode forms by splitting them into form sections
- add hint tooltips to podcast and episode forms
- transform radio inputs as buttons for better ux
- replace explicit field by parental_advisory
- replace author field by publisher
- add podcasts_categories table to set multiple categories
- use choices.js to enhance multiselect fields
- update Language files
- update js dependencies to latest versions

closes #31, #9
parent 31b7828e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -17,9 +17,9 @@ Javascript dependencies:

- [rollup](https://rollupjs.org/) ([MIT License](https://github.com/rollup/rollup/blob/master/LICENSE.md))
- [tailwindcss](https://tailwindcss.com/) ([MIT License](https://github.com/tailwindcss/tailwindcss/blob/master/LICENSE))
- [CodeMirror](https://github.com/codemirror/CodeMirror) ([MIT License](https://github.com/codemirror/CodeMirror/blob/master/LICENSE))
- [ProseMirror](https://prosemirror.net/) ([MIT License](https://github.com/ProseMirror/prosemirror/blob/master/LICENSE))
- [D3: Data-Driven Documents](https://d3js.org) ([BSD 3-Clause "New" or "Revised" License](https://github.com/d3/d3/blob/master/LICENSE))
- [Choices.js](https://joshuajohnson.co.uk/Choices/) ([MIT License](https://github.com/jshjohnson/Choices/blob/master/LICENSE))

Other:

+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ class Pager extends BaseConfig
    |
    */
    public $templates = [
        'default_full' => 'CodeIgniter\Pager\Views\default_full',
        'default_full' => 'App\Views\pager\default_full',
        'default_simple' => 'CodeIgniter\Pager\Views\default_simple',
        'default_head' => 'CodeIgniter\Pager\Views\default_head',
    ];
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ class BaseController extends Controller
     *
     * @var array
     */
    protected $helpers = ['auth', 'breadcrumb', 'svg'];
    protected $helpers = ['auth', 'breadcrumb', 'svg', 'components'];

    /**
     * Constructor.
+1 −1
Original line number Diff line number Diff line
@@ -166,7 +166,7 @@ class Contributor extends BaseController

    public function remove()
    {
        if ($this->podcast->owner_id == $this->user->id) {
        if ($this->podcast->created_by == $this->user->id) {
            return redirect()
                ->back()
                ->with('errors', [
+60 −7
Original line number Diff line number Diff line
@@ -45,8 +45,14 @@ class Episode extends BaseController

    public function list()
    {
        $episodes = (new EpisodeModel())
            ->where('podcast_id', $this->podcast->id)
            ->orderBy('created_at', 'desc');

        $data = [
            'podcast' => $this->podcast,
            'episodes' => $episodes->paginate(10),
            'pager' => $episodes->pager,
        ];

        replace_breadcrumb_params([
@@ -57,7 +63,10 @@ class Episode extends BaseController

    public function view()
    {
        $data = ['episode' => $this->episode];
        $data = [
            'podcast' => $this->podcast,
            'episode' => $this->episode,
        ];

        replace_breadcrumb_params([
            0 => $this->podcast->title,
@@ -105,7 +114,10 @@ class Episode extends BaseController
            'enclosure' => $this->request->getFile('enclosure'),
            'description' => $this->request->getPost('description'),
            'image' => $this->request->getFile('image'),
            'explicit' => $this->request->getPost('explicit') == 'yes',
            'parental_advisory' =>
                $this->request->getPost('parental_advisory') !== 'undefined'
                    ? $this->request->getPost('parental_advisory')
                    : null,
            'number' => $this->request->getPost('episode_number'),
            'season_number' => $this->request->getPost('season_number'),
            'type' => $this->request->getPost('type'),
@@ -120,14 +132,33 @@ class Episode extends BaseController

        $episodeModel = new EpisodeModel();

        if (!$episodeModel->save($newEpisode)) {
        if (!($newEpisodeId = $episodeModel->insert($newEpisode, true))) {
            return redirect()
                ->back()
                ->withInput()
                ->with('errors', $episodeModel->errors());
        }

        return redirect()->route('episode-list', [$this->podcast->id]);
        // update podcast's episode_description_footer if changed
        $podcastModel = new PodcastModel();

        if ($this->podcast->hasChanged('episode_description_footer')) {
            $this->podcast->episode_description_footer = $this->request->getPost(
                'description_footer'
            );

            if (!$podcastModel->update($this->podcast->id, $this->podcast)) {
                return redirect()
                    ->back()
                    ->withInput()
                    ->with('errors', $podcastModel->errors());
            }
        }

        return redirect()->route('episode-view', [
            $this->podcast->id,
            $newEpisodeId,
        ]);
    }

    public function edit()
@@ -135,6 +166,7 @@ class Episode extends BaseController
        helper(['form']);

        $data = [
            'podcast' => $this->podcast,
            'episode' => $this->episode,
        ];

@@ -167,7 +199,10 @@ class Episode extends BaseController
        $this->episode->title = $this->request->getPost('title');
        $this->episode->slug = $this->request->getPost('slug');
        $this->episode->description = $this->request->getPost('description');
        $this->episode->explicit = $this->request->getPost('explicit') == 'yes';
        $this->episode->parental_advisory =
            $this->request->getPost('parental_advisory') !== 'undefined'
                ? $this->request->getPost('parental_advisory')
                : null;
        $this->episode->number = $this->request->getPost('episode_number');
        $this->episode->season_number = $this->request->getPost('season_number')
            ? $this->request->getPost('season_number')
@@ -191,14 +226,32 @@ class Episode extends BaseController

        $episodeModel = new EpisodeModel();

        if (!$episodeModel->save($this->episode)) {
        if (!$episodeModel->update($this->episode->id, $this->episode)) {
            return redirect()
                ->back()
                ->withInput()
                ->with('errors', $episodeModel->errors());
        }

        return redirect()->route('episode-list', [$this->podcast->id]);
        // update podcast's episode_description_footer if changed
        $this->podcast->episode_description_footer = $this->request->getPost(
            'description_footer'
        );

        if ($this->podcast->hasChanged('episode_description_footer')) {
            $podcastModel = new PodcastModel();
            if (!$podcastModel->update($this->podcast->id, $this->podcast)) {
                return redirect()
                    ->back()
                    ->withInput()
                    ->with('errors', $podcastModel->errors());
            }
        }

        return redirect()->route('episode-view', [
            $this->podcast->id,
            $this->episode->id,
        ]);
    }

    public function delete()
Loading