diff --git a/app/controllers/programs_controller.rb b/app/controllers/programs_controller.rb index 7138183..274e01c 100644 --- a/app/controllers/programs_controller.rb +++ b/app/controllers/programs_controller.rb @@ -1,8 +1,6 @@ class ProgramsController < ApplicationController
- DATES_PER_PAGE = 1
- include Pagy::Backend
- def index
- text = I18n.t("hello") items = [ { name: I18n.t("navigation.programming"), route: program_url, icon: "program" }, @@ -10,99 +8,11 @@ class ProgramsController < ApplicationController { name: I18n.t("navigation.mudancas_na_programacao"), route: "/", icon: "change" }, { name: I18n.t("navigation.sessoes_ao_ar_livre"), route: "/", icon: "clock" } ]
- last_import_id = Programacao.maximum(:importacoesprog_id)
- base_scope = Programacao
-
.joins(:pelicula)
-
.includes(:cinema, pelicula: :mostra)
-
.where(importacoesprog_id: last_import_id)
- if params[:query].present?
-
term = "%#{params[:query].downcase}%"
-
base_scope = base_scope.where(
-
"LOWER(peliculas.titulo_ingles_coord_int) LIKE :query OR
-
LOWER(peliculas.titulo_original_coord_int) LIKE :query OR
-
LOWER(peliculas.titulo_portugues_coord_int) LIKE :query OR
-
LOWER(peliculas.titulo_ingles_semartigo) LIKE :query OR
-
LOWER(peliculas.titulo_portugues_semartigo) LIKE :query",
-
query: term
-
)
- end
- available_dates = base_scope.distinct.pluck(:data).sort
- selected_date = available_dates.first
- if params[:date].present?
-
parsed_date = Date.parse(params[:date]) rescue nil
-
selected_date = parsed_date if parsed_date&.in?(available_dates)
- end
- programacoes_for_date = base_scope.where(data: selected_date).order(:sessao)
- current_page = params[:page].to_i ||= 1
- @pagy, @programacoes = pagy_infinite(programacoes_for_date, current_page)
- @programacoes = @programacoes.map do |p|
-
{
-
id: p.id,
-
data: p.data,
-
sessao: [ p.display_sessao ],
-
cinema: p.cinema&.nome,
-
titulo: p.pelicula&.titulo_portugues_coord_int,
-
duracao: p.pelicula&.duracao_coord_int,
-
imagem: p.pelicula&.imagem,
-
genero: p.pelicula&.genre,
-
mostra: p.pelicula&.mostra&.display_name,
-
mostra_tag_class: p.pelicula&.mostra&.tag_class
-
}
- end
- display_selected_date = I18n.l(selected_date, format: "%a, %e %b", locale: :pt) if selected_date
- root_url = request.base_url render inertia: "ProgramPage", props: {
-
rootUrl: @root_url,
-
text: text, items:,
-
available_dates:,
-
selected_date: display_selected_date,
-
elements: @programacoes,
-
pagy: @pagy,
-
tabBaseUrl: program_url,
-
searchQuery: params[:query]
-
} endrootUrl: @root_url
- private
- def pagy_infinite(collection, page_param)
- current_page = (page_param || params[:page] || 1).to_i
- limit = Pagy::DEFAULT[:limit] || 5
- if current_page <= 1
-
# First page - normal pagination
-
pagy_result = pagy(collection, limit: limit)
-
pagy_result
- else
-
# Infinite scroll - load all items from page 1 to current page
-
total_items_needed = current_page * limit
-
# Get the actual items
-
items = collection.limit(total_items_needed)
-
# Create proper pagy object with
-
# all the metadata need in the frontend
-
total_count = collection.count
-
pagy_obj = Pagy.new(
-
count: total_count,
-
limit: limit,
-
page: current_page,
-
# overflow: :last_page
-
)
-
[ pagy_obj, items ]
- end
- end end diff --git a/app/frontend/assets/css/horizontal_scroll.css b/app/frontend/assets/css/horizontal_scroll.css deleted file mode 100644 index 54b9dd4..0000000 --- a/app/frontend/assets/css/horizontal_scroll.css +++ /dev/null @@ -1,9 +0,0 @@ -.no-scroll-bar::-webkit-scrollbar {
- display: none; -}
-/* Hide scrollbar for IE, Edge and Firefox */ -.no-scroll-bar {
- -ms-overflow-style: none; /* IE and Edge */
- scrollbar-width: none; /* Firefox */ -} diff --git a/app/frontend/assets/css/tag_base.css b/app/frontend/assets/css/tag_base.css index a24ad1c..8af3024 100644 --- a/app/frontend/assets/css/tag_base.css +++ b/app/frontend/assets/css/tag_base.css @@ -6,99 +6,3 @@ .tag-base { @apply py-100 px-250 uppercase font-body text-2xs font-medium leading-[16px] tracking-widest rounded-br-100 max-w-fit; }
-@layer utilities {
- /* Mode styles */
- .tag-filled {
- @apply px-2 py-1 rounded-br-100 text-sm font-medium;
- background-color: var(--tag-bg, theme('colors.magenta.600'));
- color: var(--tag-text, theme('colors.white-transp.1000'));
- }
- .tag-outline {
- @apply px-2 py-1 rounded text-sm font-medium border-l-4;
- background-color: transparent;
- border-left-color: var(--tag-border, theme('colors.magenta.600'));
- color: var(--tag-text, theme('colors.neutrals.900'));
- }
- /* Variant color definitions */
- .tag-premiere-brasil {
- --tag-bg: theme('colors.laranja.600');
- --tag-text: theme('colors.white-transp.1000');
- --tag-border: theme('colors.laranja.600');
- }
- .tag-premiere-latina {
- --tag-bg: theme('colors.amarelo.800');
- --tag-text: theme('colors.white-transp.1000');
- --tag-border: theme('colors.amarelo.800');
- }
- .tag-gala-abertura {
- --tag-bg: theme('colors.magenta.600');
- --tag-text: theme('colors.white-transp.1000');
- --tag-border: theme('colors.magenta.600');
- }
- .tag-gala-encerramento {
- --tag-bg: theme('colors.magenta.800');
- --tag-text: theme('colors.white-transp.1000');
- --tag-border: theme('colors.magenta.800');
- }
- .tag-resistencias {
- --tag-bg: theme('colors.white-transp.900');
- --tag-text: theme('colors.neutrals.900');
- --tag-border: theme('colors.white-transp.900');
- }
- .tag-cine-memoria {
- --tag-bg: theme('colors.violeta.100');
- --tag-text: theme('colors.neutrals.900');
- --tag-border: theme('colors.violeta.100');
- }
- .tag-midnight-movies {
- --tag-bg: theme('colors.violeta.600');
- --tag-text: theme('colors.white-transp.1000');
- --tag-border: theme('colors.violeta.600');
- }
- .tag-cinema-capacete {
- --tag-bg: #C0C0C0;
- --tag-text: theme('colors.neutrals.900');
- --tag-border: #C0C0C0;
- }
- .tag-classicos--cults {
- --tag-bg: theme('colors.neutrals.900');
- --tag-text: theme('colors.white-transp.1000');
- --tag-border: theme('colors.neutrals.900');
- }
- .tag-expectativas {
- --tag-bg: theme('colors.azul.600');
- --tag-text: theme('colors.white-transp.1000');
- --tag-border: theme('colors.azul.600');
- }
- .tag-itinerarios-unicos {
- --tag-bg: theme('colors.verde.600');
- --tag-text: theme('colors.white-transp.1000');
- --tag-border: theme('colors.verde.600');
- }
- .tag-panorama-mundial {
- --tag-bg: theme('colors.vermelho.600');
- --tag-text: theme('colors.white-transp.1000');
- --tag-border: theme('colors.vermelho.600');
- }
- /* Fallback */
- .tag-default {
- --tag-bg: theme('colors.magenta.600');
- --tag-text: theme('colors.white-transp.1000');
- --tag-border: theme('colors.magenta.600');
- } -} diff --git a/app/frontend/assets/css/tailwind-config.css b/app/frontend/assets/css/tailwind-config.css index eb00df2..36dbe33 100644 --- a/app/frontend/assets/css/tailwind-config.css +++ b/app/frontend/assets/css/tailwind-config.css @@ -1,6 +1,7 @@ /* Application styles */ @import "tailwindcss";
/* @plugin "@tailwindcss/typography"; / / @plugin "@tailwindcss/forms"; */
@@ -58,7 +59,6 @@ --color-vermelho-600: #FF0000; --color-vermelho-1000: #5E0000;
- --color-violeta-100: #da9fe0; --color-violeta-200: #DA9FE0; --color-violeta-400: #BF68C8; --color-violeta-600: #7F008C; diff --git a/app/frontend/assets/index.css b/app/frontend/assets/index.css index 9023c45..0258b79 100644 --- a/app/frontend/assets/index.css +++ b/app/frontend/assets/index.css @@ -2,4 +2,3 @@ @import "./css/typography.css"; @import "./css/animation.css"; @import "./css/tag_base.css"; -@import "./css/horizontal_scroll.css"; diff --git a/app/frontend/components/common/cards/SessionCard.vue b/app/frontend/components/common/cards/SessionCard.vue deleted file mode 100644 index d246cf6..0000000 --- a/app/frontend/components/common/cards/SessionCard.vue +++ /dev/null @@ -1,112 +0,0 @@ -<script setup> -import { computed, ref } from "vue";
-import TagMostra from "@/components/common/tags/TagMostra.vue"; -import TagScreening from "@/components/common/tags/TagScreening.vue"; -import { IconPin } from "@/components/common/icons"; -// Hover state -const isHovered = ref(false); -const props = defineProps({
- session: { type: Object, required: true },
- edicao: { type: String, default: "2024" },
- size: { type: String, default: "large" }, -}); -const moviePoster = computed(() => {
- const baseUrl = "https://festivaldorio.s3.us-east-1.amazonaws.com"
- const fullUrl =
${baseUrl}/${props.edicao}/site/peliculas/${props.size}
- if (props.session.imagem) {
- return
${fullUrl}/${props.session.imagem}
- }
- return "@assets/poc-poster.jpg"; -}); -const movieGenre = computed(() => {
- return props.session.genero || "TBD"; -}); -</script>
-
-
- class="flex flex-col items-start gap-200"
- @mouseenter="isHovered = true"
- @mouseleave="isHovered = false"
-
-
-
<img
-
:src="moviePoster"
-
alt="movie-name poster"
-
class="rounded-200 h-[326px] w-full object-cover"
-
/>
-
<!-- Overlay -->
-
<div
-
class="absolute inset-0 rounded-200 pointer-events-none"
-
style="
-
background: linear-gradient(
-
180deg,
-
rgba(0, 0, 0, 0.3) 36.54%,
-
rgba(0, 0, 0, 0.45) 100%
-
);
-
"
-
></div>
-
<!-- tag -->
-
<TagMostra
-
class="absolute top-0 left-0 rounded-tl-200"
-
:tag-class="props.session.mostra_tag_class"
-
:text="props.session.mostra"
-
/>
-
<div class="content absolute bottom-250 left-250 flex flex-col gap-[5px]">
-
<!-- movie title -->
-
<h2 class="text-header-sm text-on-dark">
-
{{ props.session.titulo }}
-
</h2>
-
<div class="flex items-center gap-200">
-
<span class="text-overline text-on-dark-secondary">{{
-
"TBD"
-
}}</span>
-
<img
-
src="@assets/icons/divisor.svg"
-
alt="divisor"
-
height="16px"
-
width="1px"
-
/>
-
<span class="text-overline text-on-dark-secondary">{{
-
movieGenre
-
}}</span>
-
<img
-
src="@assets/icons/divisor.svg"
-
alt="divisor"
-
height="16px"
-
width="1px"
-
/>
-
<span class="text-overline text-on-dark-secondary"
-
>{{ props.session.duracao }}'</span
-
>
-
</div>
-
<!-- Animated underline -->
-
<span
-
class="w-full bg-white-transp-900 transition-height duration-100"
-
:style="{ height: isHovered ? '1px' : '0px' }"
-
></span>
-
</div>
-
-
<div class="flex items-center gap-[6px]">
-
<IconPin width="16" height="16" />
-
<p class="text-body-regular text-primary">
-
{{ props.session.cinema }}
-
</p>
-
</div>
-
<div class="flex items-center space-x-200">
-
<TagScreening
-
v-for="screening in props.session.sessao"
-
:key="screening"
-
:time="screening"
-
/>
-
</div>
-
diff --git a/app/frontend/components/common/cards/SkeletonSessionCard.vue b/app/frontend/components/common/cards/SkeletonSessionCard.vue deleted file mode 100644 index 9fcd776..0000000 --- a/app/frontend/components/common/cards/SkeletonSessionCard.vue +++ /dev/null @@ -1,52 +0,0 @@ --
-
-
<!-- Overlay -->
-
<div
-
class="absolute inset-0 rounded-200 pointer-events-none"
-
style="
-
background: linear-gradient(
-
180deg,
-
rgba(0, 0, 0, 0.3) 36.54%,
-
rgba(0, 0, 0, 0.45) 100%
-
);
-
"
-
></div>
-
<!-- tag placeholder -->
-
<div
-
class="absolute top-0 left-0 rounded-tl-200 rounded-br-200 bg-neutrals-200 dark:bg-neutrals-400 h-[26px] w-[96px]"
-
></div>
-
<!-- Bottom content -->
-
<div
-
class="content absolute bottom-250 left-250 flex flex-col gap-[5px] w-3/4"
-
>
-
<div class="h-5 bg-neutrals-200 dark:bg-neutrals-400 rounded w-2/4"></div>
-
<div class="flex items-center gap-200">
-
<div class="h-4 bg-neutrals-200 dark:bg-neutrals-400 rounded w-[30px]"></div>
-
<div class="h-4 bg-neutrals-200 dark:bg-neutrals-400 rounded w-[1px]"></div>
-
<div class="h-4 bg-neutrals-200 dark:bg-neutrals-400 rounded w-[46px]"></div>
-
<div class="h-4 bg-neutrals-200 dark:bg-neutrals-400 rounded w-[1px]"></div>
-
<div class="h-4 bg-neutrals-200 dark:bg-neutrals-400 rounded w-[30px]"></div>
-
</div>
-
</div>
-
-
<div class="flex items-center gap-[6px]">
-
<div class="h-4 bg-neutrals-200 dark:bg-neutrals-400 rounded w-1/3"></div>
-
</div>
-
<div class="flex items-center space-x-200">
-
<div class="h-[28px] w-[64px] rounded bg-neutrals-200 dark:bg-neutrals-400"></div>
-
<div class="h-[28px] w-[64px] rounded bg-neutrals-200 dark:bg-neutrals-400"></div>
-
</div>
-</style> diff --git a/app/frontend/components/common/icons/index.js b/app/frontend/components/common/icons/index.js index e267dfa..2756dd6 100644 --- a/app/frontend/components/common/icons/index.js +++ b/app/frontend/components/common/icons/index.js @@ -23,5 +23,5 @@ export { default as IconClock } from "./misc/IconClock.vue"; // export { default as IconInfo } from "./misc/IconInfo.vue"; export { default as IconLink } from "./misc/IconLink.vue"; export { default as IconNewUser } from "./misc/IconNewUser.vue"; -export { default as IconPin } from "./misc/IconPin.vue"; +// export { default as IconPin } from "./misc/IconPin.vue"; export { default as IconProgram } from "./misc/IconProgram.vue"; diff --git a/app/frontend/components/common/icons/misc/IconPin.vue b/app/frontend/components/common/icons/misc/IconPin.vue deleted file mode 100644 index 8dc44a7..0000000 --- a/app/frontend/components/common/icons/misc/IconPin.vue +++ /dev/null @@ -1,14 +0,0 @@ -<script setup> -import BaseIcon from "@/components/common/icons/BaseIcon.vue"; -</script>
-
- <path
-
d="M10 18C10 18 16 11.9586 16 7.375C16 5.68425 15.3679 4.06274 14.2426 2.86719C13.1174 1.67165 11.5913 1 10 1C8.4087 1 6.88258 1.67165 5.75736 2.86719C4.63214 4.06274 4 5.68425 4 7.375C4 11.9586 10 18 10 18ZM10 10.5625C9.20435 10.5625 8.44129 10.2267 7.87868 9.6289C7.31607 9.03113 7 8.22038 7 7.375C7 6.52962 7.31607 5.71887 7.87868 5.1211C8.44129 4.52332 9.20435 4.1875 10 4.1875C10.7956 4.1875 11.5587 4.52332 12.1213 5.1211C12.6839 5.71887 13 6.52962 13 7.375C13 8.22038 12.6839 9.03113 12.1213 9.6289C11.5587 10.2267 10.7956 10.5625 10 10.5625Z"
-
fill="black"
- />
-<style scoped></style> diff --git a/app/frontend/components/common/tabs/TabComponent.vue b/app/frontend/components/common/tabs/TabComponent.vue deleted file mode 100644 index c5932b1..0000000 --- a/app/frontend/components/common/tabs/TabComponent.vue +++ /dev/null @@ -1,36 +0,0 @@ -<script setup> -import { computed } from 'vue'; -import { useTabScroll } from './useTabScroll';
-const props = defineProps({
- active: { type: Boolean, default: false },
- tabIndex: { type: Number, required: true },
- content: { type: String, default: new Date().toISOString().split('T')[0] } -})
-const day = computed(() => props.content.split("-")[2]) -const month = computed(() => props.content.split("-")[1])
-
-
-
-
<div
-
class="tab-content"
-
role="tab"
-
:aria-selected="props.active"
-
:id="`tab-${month}-${day}`"
-
>
-
<time :datetime="props.content">
-
<div class="text-body-strong-sm" :class="props.active ? 'text-neutrals-900' : 'text-neutrals-700'">
-
<span class="day me-100">{{ day }}</span>/<span class="month ms-100">{{ month }}</span>
-
</div>
-
</time>
-
</div>
-<style scoped></style> diff --git a/app/frontend/components/common/tabs/useTabScroll.js b/app/frontend/components/common/tabs/useTabScroll.js deleted file mode 100644 index c5fd9a2..0000000 --- a/app/frontend/components/common/tabs/useTabScroll.js +++ /dev/null @@ -1,38 +0,0 @@ -import { nextTick, ref, onMounted } from 'vue'; -import { router } from '@inertiajs/vue3';
-export function useTabScroll(isActive) {
- const tabRef = ref(null)
- onMounted(() => {
- if (isActive) {
-
scrollToTab()
- }
- })
- router.on('success', () => {
- if (isActive) {
-
scrollToTab()
- }
- })
- const scrollToTab = () => {
- setTimeout(() => {
-
if (tabRef.value) {
-
nextTick(() => {
-
if (tabRef.value) {
-
const scrollContainer = tabRef.value.closest('.overflow-x-auto')
-
if (scrollContainer) {
-
const containerRect = scrollContainer.getBoundingClientRect()
-
const tabRect = tabRef.value.getBoundingClientRect()
-
scrollContainer.scrollLeft = tabRef.value.offsetLeft - (containerRect.width / 2) + (tabRect.width / 2)
-
}
-
}
-
})
-
}
- }, 50)
- }
- return tabRef -} diff --git a/app/frontend/components/common/tags/TagMostra.vue b/app/frontend/components/common/tags/TagMostra.vue index 37a2848..3ff402c 100644 --- a/app/frontend/components/common/tags/TagMostra.vue +++ b/app/frontend/components/common/tags/TagMostra.vue @@ -2,10 +2,10 @@ import { computed } from "vue";
const props = defineProps({
- tagClass: {
- variant: { type: String, required: true,
- // default: "cinema-capacete",
- default: "cinema-capacete", }, text: { type: String, @@ -24,13 +24,107 @@ const displayText = computed(() => props.text?.trim() || "TBD");
diff --git a/app/frontend/components/common/tags/TagScreening.vue b/app/frontend/components/common/tags/TagScreening.vue deleted file mode 100644 index 0e2a3b0..0000000 --- a/app/frontend/components/common/tags/TagScreening.vue +++ /dev/null @@ -1,36 +0,0 @@ -<script setup> -import { computed } from "vue";
-const props = defineProps({
- state: {
- type: String,
- default: "default",
- validator: (value) => ["default", "active", "disabled"].includes(value),
- },
- time: {
- type: String,
- default: "21h30",
- }, -});
-const baseClasses = `inline-flex items-center px-200 py-100 border rounded-sm max-w-fit
-
text-2xs leading-[16px] tracking-widest
-
font-body font-medium uppercase`;
-const stateClasses = computed(() => ({
- "bg-neutrals-100 border-neutrals-300 text-neutrals-900":
- props.state === "default",
- "bg-neutrals-100 border-neutrals-900 text-neutrals-900":
- props.state === "active",
- "bg-neutrals-300 text-neutrals-600 cursor-not-allowed":
- props.state === "disabled", -}));
-
-
- {{ props.time }}
-
diff --git a/app/frontend/components/features/filters/SearchBar.vue b/app/frontend/components/features/filters/SearchBar.vue index 9a89449..0861bad 100644 --- a/app/frontend/components/features/filters/SearchBar.vue +++ b/app/frontend/components/features/filters/SearchBar.vue @@ -23,19 +23,15 @@ const cleanInput = () => { emit("clear"); }; const showClearButton = computed(() => props.modelValue && props.modelValue.length > 0) -const activeSearchIcon = computed(() => props.modelValue && props.modelValue.length > 0) </script>Você viu todas as sessões disponíveis.
-- <style scoped></style>
diff --git a/app/frontend/pages/ProgramPage.vue b/app/frontend/pages/ProgramPage.vue index 7de19ea..612af4a 100644 --- a/app/frontend/pages/ProgramPage.vue +++ b/app/frontend/pages/ProgramPage.vue @@ -1,81 +1,26 @@
<script setup> -import { ref } from "vue"; -import { router } from "@inertiajs/vue3" import { IconProgram, IconClock, IconChange, IconNewUser } from "@components/common/icons"; import MenuContext from "@/components/layout/navbar/MenuContext.vue"; -import SessionCard from "@/components/common/cards/SessionCard.vue"; -import InfiniteScrollLayout from "@/components/layout/InfiniteScrollLayout.vue"; -import TwContainer from "@/components/layout/TwContainer.vue"; -import MenuTabs from "@/components/layout/navbar/MenuTabs.vue"; -import SearchBar from "@/components/features/filters/SearchBar.vue"; const props = defineProps({ - tabBaseUrl: { type: String, required: true }, + text: { type: String }, items: { type: Array, required: true } - ,elements: { type: Object, required: true } - ,pagy: { type: Object, required: true } - ,available_dates: { type: Array } - ,selected_date: { type: String } - ,searchQuery: { type: String } }) -const searchQuery = ref(props.searchQuery) - -const handleSearch = () => { - const query = `query=${searchQuery.value}` - console.log(query); - router.visit(`${props.tabBaseUrl}?${query}`, { - preserveScroll: true, - preserveState: true, - only: ["elements", "searchQuery", "available_dates"], - }); -} -const handleClear = () => { - const url = new URL(window.location.href) - const params = url.searchParams - params.delete("query") // TODO: hardcode query params name - router.visit(props.tabBaseUrl, { - preserveScroll: true, - preserveState: true, - only: ["elements", "searchQuery", "available_dates"], - }); -} - const iconMapping = { "program": IconProgram, "user": IconNewUser, "change": IconChange, "clock": IconClock }; + </script> - - - - - - - - - <style scoped></style>diff --git a/app/models/mostra.rb b/app/models/mostra.rb index 7dee645..2c98b70 100644 --- a/app/models/mostra.rb +++ b/app/models/mostra.rb @@ -1,28 +1,5 @@ class Mostra < ApplicationRecord
- MOSTRA_MAP = {
- "premiere-brasil": "tag-premiere-brasil",
- "premiere-latina": "tag-premiere-latina",
- "gala-de-abertura": "tag-gala-abertura",
- "gala-de-encerramento": "tag-gala-encerramento",
- "resistencias": "tag-resistencias",
- "cine-memoria": "tag-cine-memoria",
- "midnight-movies": "tag-midnight-movies",
- "cinema-capacete": "tag-cinema-capacete",
- "classicos-cults": "tag-classicos--cults",
- "expectativa": "tag-expectativas",
- "itinerarios-unicos": "tag-itinerarios-unicos",
- "panorama-mundial": "tag-panorama-mundial"
- }
- belongs_to :importacao belongs_to :edicao has_many :peliculas
- def tag_class
- MOSTRA_MAP.find { |key, _| permalink_pt.include?(key.to_s) }&.last || "tag-default"
- end
- def display_name
- nome_abreviado.split(/[-:]/).first
- end end diff --git a/app/models/pelicula.rb b/app/models/pelicula.rb index abc6681..f3f100f 100644 --- a/app/models/pelicula.rb +++ b/app/models/pelicula.rb @@ -8,14 +8,4 @@ class Pelicula < ApplicationRecord has_many :paises, through: :paises_peliculas has_many :programacoes has_many :peliculas_tags
- def genre
- return "TBD" unless catalogo_ficha_2007
- locales = {
-
"pt": 0,
-
"en": 1
- }
- catalogo_ficha_2007.split(" ")&.first.split("/")[locales[I18n.locale]] || "TBD"
- end end diff --git a/app/models/programacao.rb b/app/models/programacao.rb index 9a83441..66071f7 100644 --- a/app/models/programacao.rb +++ b/app/models/programacao.rb @@ -5,9 +5,4 @@ class Programacao < ApplicationRecord belongs_to :importacoesprog belongs_to :edicao has_many :logs
- def display_sessao
- sessao.strftime("%H:%M")
- end end diff --git a/config/initializers/pagy.rb b/config/initializers/pagy.rb index d49f8f9..976ce8d 100644 --- a/config/initializers/pagy.rb +++ b/config/initializers/pagy.rb @@ -10,7 +10,7 @@
You can set any pagy variable as a Pagy::DEFAULT. They can also be overridden per instance by just passing them to
-Pagy::DEFAULT[:limit] = 5 # default +# Pagy::DEFAULT[:limit] = 20 # default
@@ -151,8 +151,8 @@ Pagy::DEFAULT[:limit] = 5 # default
-require "pagy/extras/overflow" -Pagy::DEFAULT[:overflow] = :last_page # default (other options: :last_page and :exception) +# require 'pagy/extras/overflow' +# Pagy::DEFAULT[:overflow] = :empty_page # default (other options: :last_page and :exception)
diff --git a/config/locales/pt.yml b/config/locales/pt.yml index bc71dcf..b83a0f6 100644 --- a/config/locales/pt.yml +++ b/config/locales/pt.yml @@ -60,27 +60,3 @@ pt:
- date:
- abbr_day_names:
-
- Dom
-
- Seg
-
- Ter
-
- Qua
-
- Qui
-
- Sex
-
- Sáb
- abbr_month_names:
-
- ""
-
- Jan
-
- Fev
-
- Mar
-
- Abr
-
- Mai
-
- Jun
-
- Jul
-
- Ago
-
- Set
-
- Out
-
- Nov
-
- Dez
diff --git a/db/schema.rb b/db/schema.rb
deleted file mode 100644
index 5c0501f..0000000
--- a/db/schema.rb
+++ /dev/null
@@ -1,510 +0,0 @@
-# This file is auto-generated from the current state of the database. Instead
-# of editing this file, please use the migrations feature of Active Record to
-# incrementally modify your database, and then regenerate this schema definition.
-#
-# This file is the source Rails uses to define your schema when running bin/rails -# db:schema:load
. When creating a new database, bin/rails db:schema:load
tends to
-# be faster and is potentially less error prone than running all of your
-# migrations from scratch. Old migrations may fail to apply correctly if those
-# migrations use external dependencies or application code.
-#
-# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema[8.0].define(version: 0) do
- create_table "atores", id: { type: :integer, unsigned: true }, charset: "utf8mb3", force: :cascade do |t|
- t.string "nome_ator", limit: 50, null: false
- end
- create_table "atores_peliculas", id: { type: :integer, unsigned: true }, charset: "utf8mb3", force: :cascade do |t|
- t.integer "ator_id", null: false, unsigned: true
- t.integer "pelicula_id", null: false
- t.index ["ator_id"], name: "fk_atores_pelicula_idx_idx"
- t.index ["pelicula_id"], name: "fk_pelicula_id_atores_peliculas_idx"
- end
- create_table "bairros", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.string "nome", limit: 150, null: false
- t.integer "ativo", null: false
- t.datetime "created", precision: nil, null: false
- t.index ["nome"], name: "idx_bairro_nome"
- end
- create_table "cadernos", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.string "nome_en", limit: 150, null: false
- t.string "nome_pt", limit: 150, null: false
- t.string "permalink_en", limit: 150, default: "", null: false
- t.string "permalink_pt", limit: 150, default: "", null: false
- t.datetime "created", precision: nil, null: false
- end
- create_table "cineencontros", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.integer "programacao_id", null: false
- t.string "nome", limit: 150, default: "", null: false
- t.string "email", limit: 150, default: "", null: false
- t.string "telefone", limit: 45, default: "", null: false
- t.string "cpf", limit: 20
- t.datetime "created", precision: nil, null: false
- t.datetime "updated", precision: nil, null: false
- t.index ["cpf"], name: "idx_cpf"
- t.index ["email"], name: "idx_email"
- t.index ["programacao_id"], name: "fk_programacao_inscricao_idx"
- end
- create_table "cinemas", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.integer "bairro_id", null: false
- t.integer "edicao_id"
- t.string "nome", limit: 150, null: false
- t.string "endereco", limit: 150
- t.string "telefone", limit: 50
- t.string "capacidade", limit: 50
- t.string "estado", limit: 2
- t.integer "ingresso", default: 0, null: false
- t.string "tipo_venda_codigo", limit: 20
- t.string "seq_cinema", limit: 45
- t.string "seq_estabelecimento", limit: 45
- t.datetime "created", precision: nil, null: false
- t.datetime "updated", precision: nil, null: false
- t.index ["bairro_id"], name: "fk_bairro_id_idx"
- t.index ["edicao_id"], name: "idx_edicao_id"
- t.index ["nome"], name: "idx_bairro_nome"
- end
- create_table "clippings", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.integer "idioma_id", null: false
- t.date "data", null: false
- t.string "titulo", limit: 150, null: false
- t.string "permalink", limit: 150, null: false
- t.string "veiculo", limit: 150
- t.string "imagem", limit: 150
- t.string "upload_arquivo"
- t.text "url"
- t.text "conteudo", size: :long
- t.integer "tipo", default: 1
- t.integer "ativo", default: 0, null: false
- t.datetime "created", precision: nil, null: false
- t.datetime "updated", precision: nil, null: false
- t.index ["ativo"], name: "idx_clipping_ativo"
- t.index ["idioma_id"], name: "fk_clippings_idiomas"
- t.index ["permalink"], name: "idx_clipping_permalink"
- end
- create_table "convidados", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.integer "importacao_convidado_id", null: false
- t.integer "pelicula_id", null: false
- t.integer "edicao_id", null: false
- t.string "nome", limit: 150, null: false
- t.string "permalink", limit: 150, null: false
- t.string "imagem"
- t.string "seq_convidado", limit: 45
- t.string "seq_pelicula", limit: 45
- t.text "biografia_en", size: :long
- t.text "biografia_pt", size: :long
- t.datetime "created", precision: nil, null: false
- t.datetime "updated", precision: nil, null: false
- t.index ["edicao_id"], name: "idx_edicao_id"
- t.index ["importacao_convidado_id"], name: "idx_importacao_convidado_id"
- t.index ["pelicula_id"], name: "idx_pelicula_id"
- t.index ["permalink"], name: "fk_permalink"
- end
- create_table "destaques", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.integer "idioma_id", null: false
- t.integer "tipo_id", null: false
- t.string "titulo", default: "", null: false
- t.string "imagem", limit: 150
- t.text "url"
- t.string "destino", limit: 10
- t.integer "ordem", default: 0
- t.integer "ativo", default: 0, null: false
- t.datetime "created", precision: nil, null: false
- t.datetime "updated", precision: nil, null: false
- t.index ["ativo"], name: "idx_destaque_ativo"
- t.index ["idioma_id"], name: "fk_destaque_idioma"
- t.index ["tipo_id"], name: "fk_destaque_tipo"
- end
- create_table "edicoes", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.string "descricao", limit: 50, null: false
- t.text "resumo_pt"
- t.text "resumo_en"
- t.string "cartaz"
- t.string "catalogo"
- t.date "data_inicio", null: false
- t.date "data_termino", null: false
- end
- create_table "galerias", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.integer "pelicula_id", null: false
- t.string "nome", null: false
- t.integer "ordem", default: 0
- t.datetime "created", precision: nil, null: false
- t.index ["pelicula_id"], name: "fk_pelicula_galeria_idx"
- end
- create_table "idiomas", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.string "nome", limit: 45, null: false
- t.string "locale", limit: 45, null: false
- t.index ["locale"], name: "idiomas_locale_idx", length: 3
- end
- create_table "importacao_convidados", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.integer "edicao_id", null: false
- t.datetime "created", precision: nil, null: false
- t.index ["edicao_id"], name: "idx_edicao_id"
- end
- create_table "importacoes", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.integer "edicao_id"
- t.datetime "created", precision: nil, null: false
- end
- create_table "importacoesprogs", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.integer "edicao_id"
- t.datetime "created", precision: nil, null: false
- end
- create_table "layouts", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.string "layout_arquivo", limit: 45, null: false
- t.string "nome", limit: 45, null: false
- t.datetime "created", precision: nil, null: false
- t.datetime "updated", precision: nil, null: false
- end
- create_table "logs", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.integer "programacao_id", null: false
- t.string "acao", limit: 1, default: "c", null: false
- t.datetime "created", precision: nil, null: false
- t.datetime "updated", precision: nil, null: false
- end
- create_table "mostras", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.integer "importacao_id", null: false
- t.integer "edicao_id"
- t.string "nome_abreviado", limit: 150
- t.string "permalink_pt", null: false
- t.string "permalink_en", null: false
- t.integer "filme_destaque_id"
- t.string "nome_pt", limit: 150
- t.string "nome_en", limit: 150
- t.text "chamada_pt"
- t.text "chamada_en"
- t.text "conteudo_pt", size: :long
- t.text "conteudo_en", size: :long
- t.string "imagem"
- t.integer "premiere", default: 0, null: false
- t.integer "ordem", default: 0, null: false
- t.datetime "created", precision: nil, null: false
- t.datetime "updated", precision: nil, null: false
- t.index ["edicao_id"], name: "fk_importacao_edicoes_id"
- t.index ["filme_destaque_id"], name: "idx_filme_destaque_id"
- t.index ["importacao_id"], name: "fk_importacao_mostras_id_idx"
- t.index ["permalink_en"], name: "idx_permalink_en"
- t.index ["permalink_pt"], name: "idx_permalink_pt"
- end
- create_table "mostras_bkp", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.integer "importacao_id", null: false
- t.string "nome_abreviado", limit: 150
- t.string "permalink_pt", null: false
- t.string "permalink_en", null: false
- t.integer "filme_destaque_id"
- t.string "nome_pt", limit: 150
- t.string "nome_en", limit: 150
- t.text "chamada_pt"
- t.text "chamada_en"
- t.text "conteudo_pt", size: :long
- t.text "conteudo_en", size: :long
- t.string "imagem"
- t.integer "ordem", default: 0, null: false
- t.datetime "created", precision: nil, null: false
- t.datetime "updated", precision: nil, null: false
- end
- create_table "newsletters", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.string "email", null: false
- t.datetime "created", precision: nil, null: false
- t.datetime "updated", precision: nil, null: false
- t.index ["email"], name: "email"
- t.index ["email"], name: "email_2", unique: true
- end
- create_table "noticias", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.integer "idioma_id", null: false
- t.integer "caderno_id", null: false
- t.date "data", null: false
- t.time "hora"
- t.string "titulo", limit: 150, null: false
- t.string "permalink", limit: 150, null: false
- t.string "imagem", limit: 150
- t.text "chamada"
- t.text "conteudo", size: :long
- t.integer "ativo", default: 0, null: false
- t.datetime "created", precision: nil, null: false
- t.datetime "updated", precision: nil, null: false
- t.index ["ativo", "data", "hora"], name: "idx_noticia_ativa"
- t.index ["caderno_id"], name: "fk_noticia_caderno"
- t.index ["idioma_id"], name: "fk_noticia_idioma"
- t.index ["permalink"], name: "idx_noticia_permalink"
- end
- create_table "paginas", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.integer "idioma_id", null: false
- t.integer "pagina_id"
- t.integer "layout_id"
- t.string "controller", limit: 150, default: "", null: false
- t.string "view", limit: 150, default: "", null: false
- t.string "tipo", limit: 1, null: false
- t.integer "is_menu", default: 0, null: false
- t.integer "is_root", default: 0, null: false
- t.string "titulo", limit: 150, null: false
- t.string "chamada", default: "", null: false
- t.string "permalink", limit: 150
- t.string "rota", limit: 150, null: false
- t.text "url"
- t.text "conteudo", size: :long
- t.integer "ordem", default: 0, null: false
- t.integer "ordem_submenu", default: 0, null: false
- t.integer "ordem_rodape", default: 0, null: false
- t.integer "ativo", default: 0, null: false
- t.datetime "created", precision: nil, null: false
- t.datetime "updated", precision: nil, null: false
- t.index ["ativo"], name: "paginas_ativo_idx"
- t.index ["idioma_id"], name: "idioma_id"
- t.index ["layout_id"], name: "layout_id"
- t.index ["pagina_id", "is_menu", "is_root", "ativo"], name: "paginas_menu_idx"
- t.index ["pagina_id"], name: "fk_pagina_id"
- t.index ["permalink"], name: "paginas_permalink_idx"
- t.index ["rota"], name: "paginas_rota_idx"
- t.index ["tipo", "ativo", "rota", "idioma_id"], name: "paginas_busca_routes_idx"
- t.index ["tipo"], name: "paginas_tipo_idx"
- end
- create_table "paises", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.string "nome_pais", limit: 100, null: false
- end
- create_table "paises_peliculas", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.integer "pais_id", null: false
- t.integer "pelicula_id", null: false
- t.index ["pais_id"], name: "fk_paises_atores_paises_idx_idx"
- t.index ["pelicula_id"], name: "fk_paises_peliculas_peliculas_idx_idx"
- end
- create_table "peliculas", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.integer "importacao_id", null: false
- t.integer "edicao_id"
- t.string "permalink", null: false
- t.integer "mostra_id"
- t.string "imagem"
- t.string "imagem_diretor"
- t.string "imagem_diretor2"
- t.string "imagem_diretor3"
- t.string "imagem_producao"
- t.string "_id_bos_ingresso_com"
- t.string "_id_site_ingresso_com"
- t.string "_ingressocom_distribuidora"
- t.string "_ingressocom_genero"
- t.string "_ingressocom_urlespetaculo"
- t.integer "_arena_ingressocom_classificacao", default: 0
- t.string "_arena_ingressocom_fornecedorprincipalid"
- t.string "_arena_ingressocom_fornecedores"
- t.string "_arena_ingressocom_idiomaoriginalsigla", limit: 10
- t.string "_arena_ingressocom_atribancinecpbroe"
- t.string "_arena_ingressocom_tipocopiasigla", limit: 10
- t.string "_arena_ingressocom_tipoexibicaosigla", limit: 10
- t.string "_arena_ingressocom_tipolegendasigla", limit: 10
- t.string "_arena_ingressocom_tipolenteid", limit: 10
- t.string "_arena_ingressocom_tiposom", limit: 10
- t.string "_arena_ingressocom_estabelecimentos", limit: 20
- t.text "_arena_ingressocom_list_estabelecimento"
- t.integer "ano_coord_int"
- t.text "biografia_ing_export", size: :long
- t.text "biografia_port_export", size: :long
- t.string "bitola_coord_int", limit: 45
- t.text "catalogo_ficha_2007"
- t.integer "classificacao"
- t.string "cor_coord_int", limit: 45
- t.string "diretor_coord_int"
- t.integer "duracao_coord_int"
- t.string "elenco_coord_int"
- t.string "fotografia_coord_int"
- t.string "idioma_coord_int", limit: 45
- t.string "legenda_coord_int", limit: 45
- t.string "montagem_coord_int", limit: 45
- t.string "musica_coord_int", limit: 45
- t.string "paiscompleto_coord_int", limit: 45
- t.string "producao_coord_int"
- t.string "producaoempresa_coord_int"
- t.string "roteiro_coord_int"
- t.string "seq_pelicula", limit: 45
- t.text "sinopse_ing_export"
- t.text "sinopse_port_export"
- t.string "titulo_ingles_coord_int"
- t.string "titulo_original_coord_int"
- t.string "titulo_portugues_coord_int"
- t.string "titulo_ingles_semartigo"
- t.string "titulo_original_semartigo"
- t.string "titulo_portugues_semartigo"
- t.string "website_filme"
- t.text "youtube_embed_trailer"
- t.text "youtube_link_trailer"
- t.string "vimeo_link_trailer"
- t.string "filmecolado", limit: 50
- t.integer "filmeliberado", default: 0
- t.integer "ativo", default: 0, null: false
- t.datetime "created", precision: nil, null: false
- t.datetime "updated", precision: nil, null: false
- t.index ["ativo"], name: "idx_ativo"
- t.index ["edicao_id"], name: "fk_edicao_id_peliculas_idx"
- t.index ["importacao_id"], name: "fk_importacao_id_idx"
- t.index ["mostra_id"], name: "idx_mostra_id"
- t.index ["permalink"], name: "idx_permalink"
- end
- create_table "peliculas_tags", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.integer "pelicula_id", null: false
- t.integer "tag_id", null: false
- t.index ["pelicula_id"], name: "fk_pelicula_id_tags"
- t.index ["tag_id"], name: "fk_peliculas_tags_id"
- end
- create_table "perfis", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.string "nome", limit: 150, null: false
- t.datetime "created", precision: nil, null: false
- t.datetime "updated", precision: nil, null: false
- end
- create_table "programacoes", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.integer "cinema_id", null: false
- t.integer "pelicula_id", null: false
- t.integer "importacoesprog_id", null: false
- t.integer "edicao_id"
- t.string "codigo_com_5_digitos", limit: 5
- t.text "ingresso_url_venda", size: :long
- t.date "data"
- t.time "sessao"
- t.string "legnacopia", limit: 150
- t.integer "sessao_gala", default: 0, null: false
- t.integer "sessao_cineencontro", default: 0, null: false
- t.string "filmecolado", limit: 50
- t.integer "sessao_fechada_manual", default: 0, null: false
- t.integer "gratuito", default: 0, null: false
- t.integer "acessibilidade", default: 0, null: false
- t.integer "deletado", default: 0, null: false
- t.datetime "created", precision: nil, null: false
- t.datetime "updated", precision: nil, null: false
- t.index ["acessibilidade"], name: "idx_acessibilidade"
- t.index ["cinema_id", "pelicula_id", "data", "sessao"], name: "idx_programacao_id", unique: true
- t.index ["data"], name: "idx_data_programacao"
- t.index ["deletado"], name: "idx_deletado"
- t.index ["edicao_id"], name: "idx_edicao_id"
- t.index ["gratuito"], name: "idx_gratuito"
- t.index ["importacoesprog_id"], name: "fk_importacoesprog_id_idx"
- t.index ["pelicula_id"], name: "fk_pelicula_id_idx"
- t.index ["sessao"], name: "idx_sessao_programacao"
- t.index ["sessao_gala"], name: "idx_sessao_gala"
- end
- create_table "tags", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.string "nome", limit: 150, null: false
- t.string "permalink", limit: 150, null: false
- t.datetime "created", precision: nil, null: false
- t.index ["permalink"], name: "idx_tag_permalink"
- end
- create_table "tipos", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.string "nome_en", limit: 150, default: "", null: false
- t.string "nome_pt", limit: 150, default: "", null: false
- t.string "permalink_en", limit: 150, default: "", null: false
- t.string "permalink_pt", limit: 150, default: "", null: false
- t.datetime "created", precision: nil, null: false
- end
- create_table "torpedos", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.string "telefone", default: "", null: false
- t.datetime "created", precision: nil, null: false
- t.datetime "updated", precision: nil, null: false
- end
- create_table "usuarios", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.integer "idioma_id", null: false
- t.integer "perfil_id", null: false
- t.string "imagem", null: false
- t.string "nome", limit: 150, null: false
- t.string "sobrenome", limit: 150, null: false
- t.date "nascimento", null: false
- t.string "sexo", limit: 1, null: false
- t.string "email", null: false
- t.string "senha", null: false
- t.string "facebook_id"
- t.datetime "ultimo_login", precision: nil
- t.integer "quantidade_logins"
- t.integer "sessoes", default: 0, null: false
- t.integer "newsletter", default: 0, null: false
- t.integer "ativo", default: 0, null: false
- t.datetime "created", precision: nil, null: false
- t.datetime "updated", precision: nil, null: false
- t.index ["ativo"], name: "idx_usuario_ativo"
- t.index ["email", "senha"], name: "idx_usuario_login"
- t.index ["email"], name: "email_UNIQUE", unique: true
- t.index ["facebook_id"], name: "idx_usuario_facebook"
- t.index ["idioma_id"], name: "fk_usuario_idioma"
- t.index ["perfil_id"], name: "fk_usuario_perfil"
- t.index ["sexo"], name: "idx_usuario_sexo"
- end
- create_table "videos", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.integer "idioma_id", null: false
- t.string "titulo", limit: 150, null: false
- t.text "url", null: false
- t.integer "ativo", default: 0, null: false
- t.datetime "created", precision: nil, null: false
- t.datetime "updated", precision: nil, null: false
- t.index ["ativo"], name: "idx_video_ativo"
- t.index ["idioma_id"], name: "fk_video_idioma"
- end
- create_table "webdoors", id: :integer, charset: "utf8mb3", force: :cascade do |t|
- t.integer "idioma_id", null: false
- t.string "titulo", limit: 150, null: false
- t.text "chamada", null: false
- t.string "imagem", limit: 150
- t.string "imagem_mobile", limit: 150
- t.text "url"
- t.string "destino", limit: 10
- t.integer "ordem", default: 0
- t.integer "ativo", default: 0, null: false
- t.datetime "created", precision: nil, null: false
- t.datetime "updated", precision: nil, null: false
- t.index ["ativo"], name: "idx_webdoor_ativo"
- t.index ["idioma_id"], name: "fk_webdoor_idioma"
- end
- add_foreign_key "atores_peliculas", "atores", name: "fk_ator_id_atores_peliculas", on_delete: :cascade
- add_foreign_key "atores_peliculas", "peliculas", name: "fk_pelicula_id_atores_peliculas", on_delete: :cascade
- add_foreign_key "cineencontros", "programacoes", name: "fk_programacao_inscricao"
- add_foreign_key "cinemas", "bairros", name: "fk_bairro_id", on_delete: :cascade
- add_foreign_key "cinemas", "edicoes", name: "fk_edicao_id_cinemas", on_delete: :cascade
- add_foreign_key "clippings", "idiomas", name: "clippings_ibfk_1", on_delete: :cascade
- add_foreign_key "galerias", "peliculas", name: "fk_pelicula_galeria", on_delete: :cascade
- add_foreign_key "mostras", "edicoes", name: "fk_importacao_edicoes_id", on_delete: :cascade
- add_foreign_key "mostras", "importacoes", name: "fk_importacao_mostras_id", on_delete: :cascade
- add_foreign_key "noticias", "cadernos", name: "noticias_cadernos_id"
- add_foreign_key "noticias", "idiomas", name: "noticias_ibfk_1", on_delete: :cascade
- add_foreign_key "noticias", "idiomas", name: "noticias_idiomas_id", on_delete: :cascade
- add_foreign_key "paginas", "idiomas", name: "fk_pagina_idioma_idx"
- add_foreign_key "paginas", "layouts", name: "fk_pagina_layout_idx"
- add_foreign_key "paginas", "paginas", name: "fk_pagina_pagina_idx"
- add_foreign_key "paises_peliculas", "paises", name: "fk_paises_peliculas_paises_idx", on_delete: :cascade
- add_foreign_key "paises_peliculas", "peliculas", name: "fk_paises_peliculas_peliculas_idx", on_delete: :cascade
- add_foreign_key "peliculas", "edicoes", name: "fk_edicao_id_peliculas", on_delete: :cascade
- add_foreign_key "peliculas", "importacoes", name: "fk_importacao_id", on_delete: :cascade
- add_foreign_key "peliculas", "mostras", name: "fk_mostra_id_peliculas", on_delete: :nullify
- add_foreign_key "programacoes", "cinemas", name: "fk_cinema_id"
- add_foreign_key "programacoes", "importacoesprogs", column: "importacoesprog_id", name: "fk_importacoesprog_id"
- add_foreign_key "programacoes", "peliculas", name: "fk_pelicula_id"
- add_foreign_key "usuarios", "idiomas", name: "usuarios_ibfk_1"
- add_foreign_key "usuarios", "perfis", name: "usuarios_ibfk_2", on_delete: :cascade
- add_foreign_key "videos", "idiomas", name: "videos_ibfk_1", on_delete: :cascade
- add_foreign_key "webdoors", "idiomas", name: "webdoors_ibfk_1", on_delete: :cascade -end diff --git a/test/controllers/programs_controller_test.rb b/test/controllers/programs_controller_test.rb deleted file mode 100644 index 6488776..0000000 --- a/test/controllers/programs_controller_test.rb +++ /dev/null @@ -1,291 +0,0 @@ -require "test_helper"
-class ProgramsControllerTest < ActionDispatch::IntegrationTest
- test "index returns inertia response" do
- get program_url
- assert_response :success
- props = inertia_props
- assert_equal "pt", props["currentLocale"]
- assert props["available_dates"].is_a?(Array)
- assert props["elements"].any?, "Expected at least one program element"
- assert props["selected_date"].present?, "Expected selected_date to be present"
- end
- test "should return matching elements when query is provided" do
- get program_url, params: { query: "Batman" }
- assert_response :success
- props = inertia_props
- elements = props["elements"]
- assert_equal 1, elements.length
- assert_equal "Batman", elements.first["titulo"]
- end
- test "should return all elements for 2024-10-05 when no query is provided" do
- get program_url
- assert_response :success
- props = inertia_props
- elements = props["elements"]
- assert_equal 2, elements.length
- end
- test "should ignore case when searching" do
- get program_url, params: { query: "batman" }
- assert_response :success
- props = inertia_props
- elements = props["elements"]
- assert_equal 1, elements.length
- assert_equal "Batman", elements.first["titulo"]
- end
- test "should return elements for partial title" do
- get program_url, params: { query: "ma" }
- assert_response :success
- props = inertia_props
- elements = props["elements"]
- assert_equal 1, elements.length
- end
- test "should handle special characters" do
- get program_url, params: { query: "São Paulo" }
- assert_response :success
- props = inertia_props
- elements = props["elements"]
- assert_equal 1, elements.length
- end
- test "preserves search query when navigating to different date" do
- get program_url, params: { query: "Batman", date: "2024-10-05" }
- assert_response :success
- props = inertia_props
- assert_equal "Batman", props["searchQuery"]
- elements = props["elements"]
- elements.each do |element|
-
assert_includes element["titulo"], "Batman"
-
assert_equal "2024-10-05", element["data"].to_s
- end
- end
- test "passes query to frontend for URL building" do
- get program_url, params: { query: "Batman" }
- assert_response :success
- props = inertia_props
- assert_equal "Batman", props["searchQuery"]
- end
- test "available_dates only includes dates with matching movies" do
- get program_url, params: { query: "Batman" }
- props = inertia_props
- available_dates = props["available_dates"]
- expected = [ "2024-10-05", "2024-10-06" ]
- assert_equal expected, available_dates
- end
- test "handles search with no results gracefully" do
- get program_url, params: { query: "NonexistentMovie" }
- assert_response :success
- props = inertia_props
- assert_equal [], props["available_dates"]
- assert_equal [], props["elements"]
- assert_nil props["selected_date"]
- end
- test "handles invalid date parameter gracefully" do
- get program_url, params: { query: "Batman", date: "invalid-date" }
- assert_response :success
- props = inertia_props
- assert props["selected_date"].present?
- assert_equal "Batman", props["searchQuery"]
- end
- test "pagination returns 1st page with search and date filters" do
- get program_url, params: {
-
query: "test",
-
date: "2024-10-07"
- }
- assert_response :success
- props = inertia_props
- pagy = props["pagy"]
- assert_equal 1, pagy["page"]
- elements = props["elements"]
- assert_equal 5, props["elements"].count
- elements.each do |element|
-
assert_includes element["titulo"], "test"
-
assert_equal "2024-10-07", element["data"].to_s
- end
- end
- test "pagination returns 2nd page with search, date and page filters" do
- get program_url, params: {
-
query: "test",
-
date: "2024-10-07",
-
page: 2
- }
- assert_response :success
- props = inertia_props
- pagy = props["pagy"]
- assert_equal 2, pagy["page"]
- elements = props["elements"]
- assert_equal 10, props["elements"].count
- elements.each do |element|
-
assert_includes element["titulo"], "test"
-
assert_equal "2024-10-07", element["data"].to_s
- end
- end
- test "pagination returns 3rd page with search, date and page filters" do
- get program_url, params: {
-
query: "test",
-
date: "2024-10-07",
-
page: 3
- }
- assert_response :success
- props = inertia_props
- pagy = props["pagy"]
- assert_equal 3, pagy["page"]
- elements = props["elements"]
- assert_equal 15, props["elements"].count
- elements.each do |element|
-
assert_includes element["titulo"], "test"
-
assert_equal "2024-10-07", element["data"].to_s
- end
- end
- test "pagination returns 4th page with search, date and page filters" do
- get program_url, params: {
-
query: "test",
-
date: "2024-10-07",
-
page: 4
- }
- assert_response :success
- props = inertia_props
- pagy = props["pagy"]
- assert_equal 4, pagy["page"]
- elements = props["elements"]
- assert_equal 17, props["elements"].count
- elements.each do |element|
-
assert_includes element["titulo"], "test"
-
assert_equal "2024-10-07", element["data"].to_s
- end
- end
- test "preserves search across dates when navigating" do
- get program_url, params: { query: "Batman" }
- assert_response :success
- get program_url, params: { query: "Batman", date: "2024-10-06" }
- assert_response :success
- props = inertia_props
- assert_equal "Batman", props["searchQuery"]
- assert_includes props["selected_date"], "6 Out"
- elements = props["elements"]
- elements.each do |element|
-
assert_includes element["titulo"], "Batman"
- end
- end
- test "selects first available date when searching" do
- get program_url, params: { query: "est" }
- assert_response :success
- props = inertia_props
- assert_includes props["selected_date"], "7 Out"
- end
- test "handles dates with no matching movies via direct URL" do
- get program_url, params: { query: "Batman", date: "2024-10-04" }
- assert_response :success
- props = inertia_props
- assert_equal 1, props["elements"].count
- assert_equal "Batman", props["searchQuery"]
- assert_not_equal "2024-10-04", props["selected_date"]
- assert_includes props["selected_date"], "5 Out"
- end
- test "search changes available dates when results are filtered" do
- get program_url
- assert_response :success
- available_dates_count = inertia_props["available_dates"].count
- get program_url, params: { query: "test" }
- assert_response :success
- filtered_available_dates_count = inertia_props["available_dates"].count
- assert filtered_available_dates_count < available_dates_count,
-
"Expected filtered search to have fewer dates (#{filtered_available_dates_count}) than unfiltered (#{available_dates_count})"
- end -end diff --git a/test/fixtures/cinemas.yml b/test/fixtures/cinemas.yml deleted file mode 100644 index 41a4c34..0000000 --- a/test/fixtures/cinemas.yml +++ /dev/null @@ -1,14 +0,0 @@ -cinepolis:
- nome: "Cinépolis Lagoon"
- bairro_id: 1
- edicao_id: 1
- endereco: "Av. Borges de Medeiros, 1424 - Lagoa"
- telefone: "(21) 99999-9999"
- capacidade: "300"
- estado: "RJ"
- ingresso: 1
- tipo_venda_codigo: "online"
- seq_cinema: "C001"
- seq_estabelecimento: "E001"
- created: <%= Date.today %>
- updated: <%= Date.today %> diff --git a/test/fixtures/mostras.yml b/test/fixtures/mostras.yml deleted file mode 100644 index 65508a4..0000000 --- a/test/fixtures/mostras.yml +++ /dev/null @@ -1,17 +0,0 @@ -sci_fi:
- nome_abreviado: "Sci-Fi"
- permalink_pt: "sci-fi"
- permalink_en: "sci-fi"
- importacao_id: 1
- edicao_id: 1
- nome_pt: "Ficção Científica"
- nome_en: "Science Fiction"
- chamada_pt: "Mostra de filmes de ficção científica"
- chamada_en: "Sci-fi film showcase"
- conteudo_pt: "Conteúdo em português"
- conteudo_en: "English content"
- imagem: "sci-fi-banner.jpg"
- premiere: 1
- ordem: 1
- created: <%= Date.today %>
- updated: <%= Date.today %> diff --git a/test/fixtures/peliculas.yml b/test/fixtures/peliculas.yml deleted file mode 100644 index f794b01..0000000 --- a/test/fixtures/peliculas.yml +++ /dev/null @@ -1,81 +0,0 @@ -batman:
- titulo_portugues_coord_int: "Batman"
- titulo_original_coord_int: "Batman Begins"
- titulo_ingles_coord_int: "Batman Begins"
- titulo_ingles_semartigo: "Batman"
- titulo_portugues_semartigo: "Batman"
- permalink: "batman-link"
- importacao_id: 1
- edicao_id: 1
- mostra: sci_fi
- imagem: "batman.jpg"
- duracao_coord_int: 140
- diretor_coord_int: "Christopher Nolan"
- elenco_coord_int: "Christian Bale, Michael Caine"
- paiscompleto_coord_int: "EUA"
- sinopse_port_export: "Um jovem bilionário se torna o Batman."
- ativo: 1
- created: <%= Date.today %>
- updated: <%= Date.today %>
-special_char:
- titulo_portugues_coord_int: "São Paulo"
- titulo_original_coord_int: "São Paulo"
- titulo_ingles_coord_int: "São Paulo"
- titulo_ingles_semartigo: "São Paulo"
- titulo_portugues_semartigo: "São Paulo"
- permalink: "sao-paulo-link"
- importacao_id: 1
- edicao_id: 1
- mostra: sci_fi
- imagem: "sao-paulo.jpg"
- duracao_coord_int: 140
- diretor_coord_int: "Marcos Jorge"
- elenco_coord_int: "Babu Santana, Fabiula Nascimento"
- paiscompleto_coord_int: "Brasil"
- sinopse_port_export: "Um jovem que busca uma vida melhor."
- ativo: 1
- created: <%= Date.today %>
- updated: <%= Date.today %>
-matrix:
- titulo_portugues_coord_int: "Matrix"
- titulo_original_coord_int: "Matrix"
- titulo_ingles_coord_int: "The Matrix"
- titulo_ingles_semartigo: "Matrix"
- titulo_portugues_semartigo: "Matrix"
- permalink: "matrix-link"
- importacao_id: 1
- edicao_id: 1
- mostra: sci_fi
- imagem: "matrix.jpg"
- duracao_coord_int: 136
- diretor_coord_int: "Wachowskis"
- elenco_coord_int: "Keanu Reeves, Laurence Fishburne"
- paiscompleto_coord_int: "EUA"
- sinopse_port_export: "Um hacker descobre a verdade sobre a realidade."
- ativo: 1
- created: <%= Date.today %>
- updated: <%= Date.today %>
-<% 17.times do |i| %> -test_<%= i %>:
- titulo_portugues_coord_int: "test_<%= i %>"
- titulo_original_coord_int: "test_<%= i %>"
- titulo_ingles_coord_int: "test_<%= i %>"
- titulo_ingles_semartigo: "test_<%= i %>"
- titulo_portugues_semartigo: "test_<%= i %>"
- permalink: "test-<%= i %>-link"
- importacao_id: 1
- edicao_id: 1
- mostra: sci_fi
- imagem: "matrix.jpg"
- duracao_coord_int: 136
- diretor_coord_int: "Wachowskis"
- elenco_coord_int: "Keanu Reeves, Laurence Fishburne"
- paiscompleto_coord_int: "EUA"
- sinopse_port_export: "Um hacker descobre a verdade sobre a realidade TEST <%= i %>."
- ativo: 1
- created: <%= Date.today %>
- updated: <%= Date.today %> -<% end %> diff --git a/test/fixtures/programacoes.yml b/test/fixtures/programacoes.yml deleted file mode 100644 index 791af98..0000000 --- a/test/fixtures/programacoes.yml +++ /dev/null @@ -1,103 +0,0 @@ -program_batman:
- cinema: cinepolis
- pelicula: batman
- importacoesprog_id: 123
- edicao_id: 1
- codigo_com_5_digitos: "00001"
- ingresso_url_venda: "https://ingressos.com/batman"
- data: 2024-10-05
- sessao: "19:00"
- legnacopia: "PT"
- sessao_gala: 0
- sessao_cineencontro: 1
- filmecolado: "N"
- sessao_fechada_manual: 0
- gratuito: 0
- acessibilidade: 1
- deletado: 0
- created: <%= Date.yesterday %>
- updated: <%= Date.yesterday %>
-program_batman_other_day:
- cinema: cinepolis
- pelicula: batman
- importacoesprog_id: 123
- edicao_id: 1
- codigo_com_5_digitos: "00001"
- ingresso_url_venda: "https://ingressos.com/batman"
- data: 2024-10-06
- sessao: "19:00"
- legnacopia: "PT"
- sessao_gala: 0
- sessao_cineencontro: 1
- filmecolado: "N"
- sessao_fechada_manual: 0
- gratuito: 0
- acessibilidade: 1
- deletado: 0
- created: <%= Date.yesterday %>
- updated: <%= Date.yesterday %>
-program_special_char:
- cinema: cinepolis
- pelicula: special_char
- importacoesprog_id: 123
- edicao_id: 1
- codigo_com_5_digitos: "00001"
- ingresso_url_venda: "https://ingressos.com/estomago"
- data: 2024-10-05
- sessao: "19:00"
- legnacopia: "PT"
- sessao_gala: 0
- sessao_cineencontro: 1
- filmecolado: "N"
- sessao_fechada_manual: 0
- gratuito: 0
- acessibilidade: 1
- deletado: 0
- created: <%= Date.yesterday %>
- updated: <%= Date.yesterday %>
-program_matrix:
- cinema: cinepolis
- pelicula: matrix
- importacoesprog_id: 123
- edicao_id: 1
- codigo_com_5_digitos: "00002"
- ingresso_url_venda: "https://ingressos.com/matrix"
- data: 2024-10-06
- sessao: "21:00"
- legnacopia: "PT"
- sessao_gala: 1
- sessao_cineencontro: 0
- filmecolado: "N"
- sessao_fechada_manual: 0
- gratuito: 1
- acessibilidade: 0
- deletado: 0
- created: <%= Date.today %>
- updated: <%= Date.today %>
-# paginated program related with peliculas -<% 17.times do |i| %> -program_batman_<%= i %>:
- cinema: cinepolis
- pelicula: test_<%= i %>
- importacoesprog_id: 123
- edicao_id: 1
- codigo_com_5_digitos: "00001"
- ingresso_url_venda: "https://ingressos.com/test_<%= i %>"
- data: 2024-10-07
- sessao: "0<%= i %>:00"
- legnacopia: "PT"
- sessao_gala: 0
- sessao_cineencontro: 1
- filmecolado: "N"
- sessao_fechada_manual: 0
- gratuito: 0
- acessibilidade: 1
- deletado: 0
- created: <%= Date.yesterday %>
- updated: <%= Date.yesterday %> -<% end %> diff --git a/test/test_helper.rb b/test/test_helper.rb index 9f2d5a5..0c22470 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -13,21 +13,3 @@ module ActiveSupport end end
-module InertiaTestHelper
- def inertia_props
- html = Nokogiri::HTML(response.body)
- data_page = html.at_css("#app")&.attribute("data-page")&.value
- raise "No data-page found in response!" unless data_page
- JSON.parse(data_page)["props"]
- end -end
-class ActionDispatch::IntegrationTest
- include InertiaTestHelper -end diff --git a/vite.config.ts b/vite.config.ts index b440551..42e6dd4 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -2,6 +2,7 @@ import vue from '@vitejs/plugin-vue' import tailwindcss from '@tailwindcss/vite' import { defineConfig } from 'vite' import RubyPlugin from 'vite-plugin-ruby' +import path from "path" import { fileURLToPath, URL } from 'node:url'
export default defineConfig({ @@ -17,9 +18,9 @@ export default defineConfig({ '@/lib': fileURLToPath(new URL('./app/frontend/lib', import.meta.url)), '@/pages': fileURLToPath(new URL('./app/frontend/pages', import.meta.url)), '@/assets': fileURLToPath(new URL('./app/frontend/assets', import.meta.url)),
-
"@assets": fileURLToPath(new URL('./app/frontend/assets', import.meta.url)),
-
"@components": fileURLToPath(new URL('./app/frontend/components', import.meta.url)),
-
"@pages": fileURLToPath(new URL('./app/frontend/pages', import.meta.url)),
-
"@assets": path.resolve(__dirname, "app/frontend/assets"),
-
"@components": path.resolve(__dirname, "app/frontend/components"),
-
}, }, })"@pages": path.resolve(__dirname, "app/frontend/pages"),