💡 chore: add documentation to the code (#302)
This commit is contained in:
parent
38ba4bd6cb
commit
c1a5b7086a
18 changed files with 154 additions and 29 deletions
|
@ -1,10 +1,19 @@
|
|||
//!
|
||||
//! A module that handles the view for the about page in the `websurfx` frontend.
|
||||
|
||||
use maud::{html, Markup};
|
||||
|
||||
use crate::templates::partials::{footer::footer, header::header};
|
||||
|
||||
/// A function that handles the html code for the about page view in the search engine frontend.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `colorscheme` - It takes the colorscheme name as an argument.
|
||||
/// * `theme` - It takes the theme name as an argument.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// It returns the compiled html markup code as a result.
|
||||
pub fn about(colorscheme: &str, theme: &str) -> Markup {
|
||||
html!(
|
||||
(header(colorscheme, theme))
|
||||
|
|
|
@ -1,16 +1,25 @@
|
|||
//!
|
||||
//! A module that handles the view for the index/home/main page in the `websurfx` frontend.
|
||||
|
||||
use maud::{html, Markup, PreEscaped};
|
||||
|
||||
use crate::templates::partials::{bar::bar, footer::footer, header::header};
|
||||
|
||||
/// A function that handles the html code for the index/html/main page view in the search engine frontend.
|
||||
///
|
||||
pub fn index(colorscheme: &str, theme: &str, query: &str) -> Markup {
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `colorscheme` - It takes the colorscheme name as an argument.
|
||||
/// * `theme` - It takes the theme name as an argument.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// It returns the compiled html markup code as a result.
|
||||
pub fn index(colorscheme: &str, theme: &str) -> Markup {
|
||||
html!(
|
||||
(header(colorscheme, theme))
|
||||
main class="search-container"{
|
||||
img src="../images/websurfx_logo.png" alt="Websurfx meta-search engine logo";
|
||||
(bar(query))
|
||||
(bar(&String::default()))
|
||||
(PreEscaped("</div>"))
|
||||
}
|
||||
script src="static/index.js"{}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
//!
|
||||
//! This module provides other modules to handle view for each individual page in the
|
||||
//! `websurfx` frontend.
|
||||
|
||||
pub mod about;
|
||||
pub mod index;
|
||||
pub mod not_found;
|
||||
pub mod settings;
|
||||
pub mod search;
|
||||
pub mod settings;
|
||||
|
|
|
@ -1,15 +1,24 @@
|
|||
//!
|
||||
//! A module that handles the view for the 404 page in the `websurfx` frontend.
|
||||
|
||||
use crate::templates::partials::{footer::footer, header::header};
|
||||
use maud::{html, Markup};
|
||||
|
||||
/// A function that handles the html code for the 404 page view in the search engine frontend.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `colorscheme` - It takes the colorscheme name as an argument.
|
||||
/// * `theme` - It takes the theme name as an argument.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// It returns the compiled html markup code as a result.
|
||||
pub fn not_found(colorscheme: &str, theme: &str) -> Markup {
|
||||
html!(
|
||||
(header(colorscheme, theme))
|
||||
main class="error_container"{
|
||||
img src="images/robot-404.svg" alt="Image of broken robot.";
|
||||
div class="error_content"{
|
||||
.error_content{
|
||||
h1{"Aw! snap"}
|
||||
h2{"404 Page Not Found!"}
|
||||
p{"Go to "{a href="/"{"search page"}}}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//!
|
||||
//! A module that handles the view for the search page in the `websurfx` frontend.
|
||||
|
||||
use maud::{html, Markup, PreEscaped};
|
||||
|
||||
|
@ -7,7 +7,18 @@ use crate::{
|
|||
templates::partials::{footer::footer, header::header, search_bar::search_bar},
|
||||
};
|
||||
|
||||
/// A function that handles the html code for the search page view in the search engine frontend.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `colorscheme` - It takes the colorscheme name as an argument.
|
||||
/// * `theme` - It takes the theme name as an argument.
|
||||
/// * `query` - It takes the current search query provided by the user as an argument.
|
||||
/// * `search_results` - It takes the aggregated search results as an argument.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// It returns the compiled html markup code as a result.
|
||||
pub fn search(
|
||||
colorscheme: &str,
|
||||
theme: &str,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//!
|
||||
//! A module that handles the view for the settings page in the `websurfx` frontend.
|
||||
|
||||
use maud::{html, Markup};
|
||||
|
||||
|
@ -10,7 +10,18 @@ use crate::templates::partials::{
|
|||
},
|
||||
};
|
||||
|
||||
/// A function that handles the html code for the settings page view in the search engine frontend.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `colorscheme` - It takes the colorscheme name as an argument.
|
||||
/// * `theme` - It takes the theme name as an argument.
|
||||
/// * `engine_names` - It takes a list of engine names as an argument.
|
||||
///
|
||||
/// # Error
|
||||
///
|
||||
/// This function returns a compiled html markup code on success otherwise returns a standard error
|
||||
/// message.
|
||||
pub fn settings(
|
||||
colorscheme: &str,
|
||||
theme: &str,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue