diff --git a/backend/assets/main.js b/backend/assets/main.js index edab94c8..74dabb8e 100644 --- a/backend/assets/main.js +++ b/backend/assets/main.js @@ -10,9 +10,12 @@ import './main.css'; import Alpine from 'alpinejs'; import collapse from '@alpinejs/collapse'; +import ngoSearch from './ngoSearch'; Alpine.plugin(collapse); +Alpine.data('ngoSearch', ngoSearch); + window.Alpine = Alpine; Alpine.start(); diff --git a/backend/assets/ngoSearch.js b/backend/assets/ngoSearch.js new file mode 100644 index 00000000..d49d7329 --- /dev/null +++ b/backend/assets/ngoSearch.js @@ -0,0 +1,32 @@ +export default function() { + return { + query: null, + isOpen: false, + results: [], + + open() { + if (!this.results.length) { + return; + } + + this.isOpen = true; + }, + + close() { + this.isOpen = false; + }, + + async search() { + const url = new URL(window.location.origin + '/api/search'); + url.searchParams.set('q', this.query); + + this.results = await (await fetch(url)).json(); + + this.open(); + }, + + init() { + this.$watch('query', () => this.search()); + } + } +} diff --git a/backend/donations/views/site.py b/backend/donations/views/site.py index e2416ccb..a9b14760 100644 --- a/backend/donations/views/site.py +++ b/backend/donations/views/site.py @@ -16,7 +16,7 @@ class HomePage(TemplateView): - template_name = "index.html" + template_name = "public/home.html" @staticmethod @cache_decorator(timeout=settings.TIMEOUT_CACHE_LONG, cache_key_prefix=ALL_NGO_IDS_CACHE_KEY) diff --git a/backend/static_extras/images/hero.svg b/backend/static_extras/images/hero.svg new file mode 100644 index 00000000..b23bc9ce --- /dev/null +++ b/backend/static_extras/images/hero.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/backend/templates/v2/public/components/home-hero.html b/backend/templates/v2/public/components/home-hero.html new file mode 100644 index 00000000..a0f3c555 --- /dev/null +++ b/backend/templates/v2/public/components/home-hero.html @@ -0,0 +1,51 @@ +{% load static %} + +
+
+
+
+

+ Tu decizi ce se întâmplă + cu 3,5% din impozit +

+

+ Declarația 230 pentru redirecționarea a 3,5% din impozitul pe venit aferent anului 2024 va fi disponibilă după 15 ianuarie 2025. +

+ + {% include "public/components/ngo-search.html" %} + +
+
+
+
+ organizații înregistrate în platformă +
+
+ XXXX +
+
+
+
+ declarații completate în 2024 +
+
+ XXXX +
+
+
+
+ redirecționați către ONG-uri prin redirectioneaza.ro +
+
+ > €2 milioane +
+
+
+
+
+
+
+ +
+
+
diff --git a/backend/templates/v2/public/components/ngo-search.html b/backend/templates/v2/public/components/ngo-search.html new file mode 100644 index 00000000..0f63fda2 --- /dev/null +++ b/backend/templates/v2/public/components/ngo-search.html @@ -0,0 +1,44 @@ +
+ + + +
diff --git a/backend/templates/v2/public/home.html b/backend/templates/v2/public/home.html new file mode 100644 index 00000000..b14b52f4 --- /dev/null +++ b/backend/templates/v2/public/home.html @@ -0,0 +1,9 @@ +{% extends "base.html" %} + + + +{% block content %} + {% include "public/components/home-hero.html" %} + + {% include "account/snippets/cta-ngohub.html" %} +{% endblock %}