mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-15 04:27:46 +02:00
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
This commit is contained in:
parent
31b7828e77
commit
2d44b457a0
111 changed files with 3933 additions and 1626 deletions
|
|
@ -53,4 +53,72 @@ class CategoryModel extends Model
|
|||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets categories for a given podcast
|
||||
*
|
||||
* @param int $podcastId
|
||||
* @param array $categories
|
||||
*
|
||||
* @return integer|false Number of rows inserted or FALSE on failure
|
||||
*/
|
||||
public function setPodcastCategories($podcastId, $categories)
|
||||
{
|
||||
cache()->delete("podcasts{$podcastId}_categories");
|
||||
|
||||
// Remove already previously set categories to overwrite them
|
||||
$this->db
|
||||
->table('podcasts_categories')
|
||||
->delete(['podcast_id' => $podcastId]);
|
||||
|
||||
if (!empty($categories)) {
|
||||
// prepare data for `podcasts_categories` table
|
||||
$data = array_reduce(
|
||||
$categories,
|
||||
function ($result, $categoryId) use ($podcastId) {
|
||||
$result[] = [
|
||||
'podcast_id' => $podcastId,
|
||||
'category_id' => $categoryId,
|
||||
];
|
||||
|
||||
return $result;
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
// Set podcast categories
|
||||
return $this->db->table('podcasts_categories')->insertBatch($data);
|
||||
}
|
||||
|
||||
// no row has been inserted after deletion
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all the podcast categories
|
||||
*
|
||||
* @param int $podcastId
|
||||
*
|
||||
* @return \App\Entities\Category[]
|
||||
*/
|
||||
public function getPodcastCategories($podcastId)
|
||||
{
|
||||
if (!($categories = cache("podcasts{$podcastId}_categories"))) {
|
||||
$categories = $this->select('categories.*')
|
||||
->join(
|
||||
'podcasts_categories',
|
||||
'podcasts_categories.category_id = categories.id'
|
||||
)
|
||||
->where('podcasts_categories.podcast_id', $podcastId)
|
||||
->findAll();
|
||||
|
||||
cache()->save(
|
||||
"podcasts{$podcastId}_categories",
|
||||
$categories,
|
||||
DECADE
|
||||
);
|
||||
}
|
||||
|
||||
return $categories;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue