🔥 Remove jQuery as PageTop won't support it

This commit is contained in:
Manuel Cillero 2023-10-15 10:30:30 +02:00
parent 9b317142e0
commit 79557bfa27
10 changed files with 0 additions and 140 deletions

View file

@ -5,10 +5,7 @@ members = [
# Utilities.
"pagetop-macros",
"pagetop-build",
"pagetop-jquery",
"pagetop-homedemo",
# Components.
"pagetop-megamenu",
# Modules.
"pagetop-admin",
"pagetop-user",

View file

@ -42,16 +42,6 @@ El repositorio se organiza en un *workspace* con los siguientes subproyectos:
incluir fácilmente recursos en los archivos binarios al compilar aplicaciones creadas con
**PageTop**.
## Componentes
* **[pagetop-jquery](https://github.com/manuelcillero/pagetop/tree/main/pagetop-jquery)**, módulo
que permite añadir jQuery en las páginas que incluyen componentes o temas que usen esta librería
JavaScript para interactuar con el documento HTML.
* **[pagetop-megamenu](https://github.com/manuelcillero/pagetop/tree/main/pagetop-megamenu)**,
módulo que proporciona un nuevo componente para incluir menús avanzados en las aplicaciones web
creadas con **PageTop**.
## Módulos
* **[pagetop-homedemo](https://github.com/manuelcillero/pagetop/tree/main/pagetop-homedemo)**,

View file

@ -1,22 +0,0 @@
[package]
name = "pagetop-jquery"
version = "0.0.8"
edition = "2021"
authors = [
"Manuel Cillero <manuel@cillero.es>"
]
description = """\
Module for PageTop that allows adding jQuery in pages that include components or themes that \
use this JavaScript library to interact with the HTML document.\
"""
homepage = "https://pagetop.cillero.es"
repository = "https://github.com/manuelcillero/pagetop"
license = "Apache-2.0 OR MIT"
[dependencies]
pagetop = { version = "0.0", path = "../pagetop" }
static-files = "0.2.3"
[build-dependencies]
pagetop-build = { version = "0.0", path = "../pagetop-build" }

View file

@ -1,30 +0,0 @@
Módulo para **PageTop** que permite añadir jQuery en las páginas que incluyen componentes o temas
que usen esta librería JavaScript para interactuar con el documento HTML.
Por defecto **PageTop** no requiere jQuery para el funcionamiento de sus componentes base y tema
predefinido.
[PageTop](https://github.com/manuelcillero/pagetop/tree/main/pagetop), es un entorno de desarrollo
basado en algunos de los *crates* más estables y populares del ecosistema Rust para proporcionar
APIs, patrones de desarrollo y buenas prácticas para la creación de soluciones web SSR (*Server-Side
Rendering*).
# 🚧 Advertencia
**PageTop** sólo libera actualmente versiones de desarrollo. La API no es estable y los cambios son
constantes. No puede considerarse preparado hasta que se libere la versión **0.1.0**.
# 📜 Licencia
Este proyecto tiene licencia, de hecho tiene dos, puedes aplicar cualquiera de las siguientes a tu
elección:
* Licencia Apache versión 2.0
([LICENSE-APACHE](https://github.com/manuelcillero/pagetop/blob/main/LICENSE-APACHE) o
[http://www.apache.org/licenses/LICENSE-2.0]).
* Licencia MIT
([LICENSE-MIT](https://github.com/manuelcillero/pagetop/blob/main/LICENSE-MIT) o
[http://opensource.org/licenses/MIT]).

View file

@ -1,7 +0,0 @@
use pagetop_build::StaticFilesBundle;
fn main() -> std::io::Result<()> {
StaticFilesBundle::from_dir("./static")
.with_name("jquery")
.build()
}

View file

@ -1,61 +0,0 @@
use pagetop::prelude::*;
new_handle!(MODULE_JQUERY);
static_locales!(LOCALES_JQUERY);
static_files!(jquery);
// Library version.
const VERSION_JQUERY: &str = "3.6.0";
// Context parameter.
const PARAM_JQUERY: &str = "jquery.lib";
/// Implements [`ModuleTrait`](pagetop::core::module::ModuleTrait) and specific module API.
pub struct JQuery;
impl ModuleTrait for JQuery {
fn handle(&self) -> Handle {
MODULE_JQUERY
}
fn name(&self) -> L10n {
L10n::t("module_name", &LOCALES_JQUERY)
}
fn description(&self) -> L10n {
L10n::t("module_description", &LOCALES_JQUERY)
}
fn actions(&self) -> Vec<Action> {
actions![action::page::AfterPrepareBody::with(after_prepare_body)]
}
fn configure_service(&self, scfg: &mut service::web::ServiceConfig) {
static_files_service!(scfg, "/jquery", jquery);
}
}
impl JQuery {
pub fn enable_jquery(&self, cx: &mut Context) -> &Self {
cx.set_param::<bool>(PARAM_JQUERY, true);
self
}
pub fn disable_jquery(&self, cx: &mut Context) -> &Self {
cx.set_param::<bool>(PARAM_JQUERY, false);
self
}
}
fn after_prepare_body(page: &mut Page) {
if let Some(true) = page.context().get_param::<bool>(PARAM_JQUERY) {
page.context().alter(ContextOp::AddJavaScript(
JavaScript::at("/jquery/jquery.min.js")
.with_version(VERSION_JQUERY)
.with_weight(-99)
.with_mode(ModeJS::Normal),
));
}
}

View file

@ -1,2 +0,0 @@
module_name = jQuery support
module_description = Integrate the jQuery library into web pages generated by other modules.

View file

@ -1,2 +0,0 @@
module_name = Soporte a jQuery
module_description = Incorpora la librería jQuery en páginas web generadas por otros módulos.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long