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.
25 lines
608 B
PL/PgSQL
25 lines
608 B
PL/PgSQL
-- Deploy camper:order_cover_carousel to pg
|
|
-- requires: schema_camper
|
|
-- requires: roles
|
|
-- requires: cover_carousel
|
|
|
|
begin;
|
|
|
|
set search_path to camper, public;
|
|
|
|
create or replace function order_cover_carousel(positions integer[]) returns void as
|
|
$$
|
|
update cover_carousel
|
|
set position = cast(temp.position as integer)
|
|
from unnest(positions) with ordinality as temp(media_id, position)
|
|
where cover_carousel.media_id = temp.media_id
|
|
;
|
|
$$
|
|
language sql
|
|
;
|
|
|
|
revoke execute on function order_cover_carousel(integer[]) from public;
|
|
grant execute on function order_cover_carousel(integer[]) to admin;
|
|
|
|
commit;
|