This is a separate carousel from the one displayed at the bottom with location info; it is, i suppose, a carousel for the hero image. For the database, it works exactly as the home carousel, but on the front had to use AlpineJS instead of Slick because it needs to show a text popping up from the bottom when the slide is show, something i do not know how to do in Slick. It now makes no sense to have the carousel inside the “nature” section, because the heading is no longer in there, and moved it out into a new “hero” div. Since i now have two carousels in home, i had to add additional attributes to carousel.AdminHandler to know which URL to point to when POSTing, PUTting, or redirecting.
26 lines
637 B
PL/PgSQL
26 lines
637 B
PL/PgSQL
-- Deploy camper:add_cover_carousel_slide to pg
|
|
-- requires: roles
|
|
-- requires: schema_camper
|
|
-- requires: cover_carousel
|
|
|
|
begin;
|
|
|
|
set search_path to camper, public;
|
|
|
|
create or replace function add_cover_carousel_slide(media_id integer, caption text) returns integer as
|
|
$$
|
|
insert into cover_carousel (media_id, caption)
|
|
values (media_id, coalesce(caption, ''))
|
|
on conflict (media_id) do update
|
|
set caption = excluded.caption
|
|
returning media_id
|
|
;
|
|
$$
|
|
language sql
|
|
;
|
|
|
|
revoke execute on function add_cover_carousel_slide(integer, text) from public;
|
|
grant execute on function add_cover_carousel_slide(integer, text) to admin;
|
|
|
|
commit;
|