Browse Source

aug16

master
siva 3 years ago
parent
commit
cfd615e807
13 changed files with 3063 additions and 695 deletions
  1. +0
    -452
      index.html
  2. +67
    -24
      src/main.rs
  3. +0
    -0
      templates/assets/Logo.svg
  4. +0
    -3
      templates/assets/css/index.css
  5. +4
    -0
      templates/assets/font-awesome.min.css
  6. +2970
    -0
      templates/assets/index.css
  7. +0
    -2
      templates/assets/jquery/jquery-3.5.1.min.js
  8. +0
    -108
      templates/assets/js/main.js
  9. +0
    -20
      templates/assets/js/pages.js
  10. +0
    -80
      templates/assets/js/slider.js
  11. +0
    -0
      templates/assets/nav.css
  12. +7
    -6
      templates/index.html
  13. +15
    -0
      templates/test_index.html

+ 0
- 452
index.html View File

@ -1,452 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-eqiv="X-UA-Compatible" content="ie=edge"/>
<link rel="stylesheet" type="text/css" href="assets/css/index.css">
<link rel="stylesheet" type="text/css" href="assets/css/nav.css">
<link rel="icon" href="assets/img/Logo.svg">
<title>
Cannabinieri CBD
</title>
<script defer src="assets/fontawesome/all.js"></script>
<script src="assets/jquery-3.5.1.min.js"></script>
<script src="static/js/pages.js"></script>
</head>
<body>
<div class="wrapper">
<nav class="top-bar">
<div class="languages">
<a href="static/languages/deutsch.html">Deutsch |</a>
<a href="static/languages/italiano.html">Italiano |</a>
<a href="static/languages/francais.html">Francais </a>
</div>
</nav>
<div id="main-bar">
<div id="logo-container">
<img class="logo" src= "static/img/Logo.svg">
</div>
<nav class="main-navigation-bar">
<ul>
<li><a href="static/pages/experiments.html">EXPERIMENTS</a>
<ul class="sub">
<li><a href="static/pages/oils.html">Oils</a></li>
<li><a href="static/pages/flower.html">Flower</a></li>
<li class="lastItem"><a href="static/pages/edibles.html">Edibles</a></li>
</ul>
</ul>
<ul>
<li><a href="static/pages/permaculture.html">PERMACULTURE</a>
<ul>
<li><a href="static/pages/permapp.html">PermApp</a></li>
<li><a href="static/pages/greenlab.html">GreenLab</a></li>
<li class="lastItem"><a id="edit" href="static/pages/whatsthat.html">What's that ?</a></li>
</ul>
</ul>
<ul>
<li><a href="static/pages/greentech.html">GREENTECH</a>
<ul>
<li><a href="static/pages/automation.html">Automation</a></li>
<li><a href="static/pages/iot.html">IoT</a></li>
<li class="lastItem"><a href="static/pages/diy.html">DiY</a></li>
</ul>
</ul>
<ul>
<li><a href="static/pages/spider.html">SPIDER</a>
<ul>
<li><a href="static/pages/spiderpi.html">SpiderPi</a></li>
<li class="lastItem"><a href="static/pages/join.html">Join</a></li>
</ul>
</ul>
<ul>
<li><a href="static/pages/learn.html">LEARN</a>
<ul id="learn">
<li><a href="static/pages/whoweare.html">About Us</a></li>
<li><a href="static/pages/partners.html">Partners</a></li>
<li><a href="static/pages/meet.html">Meet</a></li>
<li><a href="static/pages/blog.html">Blog</a></li>
<li class="lastItem"><a href="static/pages/code.html">Code</a></li>
</ul>
</ul>
</nav>
<nav class="hamburger-wrap">
<input type="checkbox" class="ham-btn" id="ham-btn">
<label for="ham-btn" class="hamburger" onclick= "menu()" onclick="hide()">
<span class="hamburger-icon"></span>
</label>
</nav>
<div id="mobile-dropdown-container">
<div id="mobile-dropdown">
<ul>
<li onclick="menu2()"><a href="static/pages/experiments.html">EXPERIMENTS</a>
<span class="drop">
<i class="arrow down"></i>
</span>
<ul id="down">
<li><a href="static/pages/oils.html">Oils</a></li>
<li><a href="static/pages/flower.html">Flower</a></li>
<li><a href="static/pages/edibles.html">Edibles</a></li>
</ul>
</ul>
<ul>
<li onclick="menu3()"><a href="static/pages/permaculture.html">PERMACULTURE</a>
<span class="drop">
<i class="arrow down"></i>
</span>
<ul id="down1">
<li><a href="static/pages/permapp.html">PermApp</a></li>
<li><a href="static/pages/greenlab.html">GreenLab</a></li>
<li><a href="static/pages/whatsthat.html">What's that ?</a></li>
</ul>
</ul>
<ul>
<li onclick="menu4()"><a href="static/pages/greentech.html">GREENTECH</a>
<span class="drop">
<i class="arrow down"></i>
</span>
<ul id="down2">
<li><a href="static/pages/automation.html">Automation</a></li>
<li><a href="static/pages/iot.html">IoT</a></li>
<li><a href="static/pages/diy.html">DiY</a></li>
</ul>
</ul>
<ul>
<li onclick="menu5()"><a href="static/pages/spider.html">SPIDER</a>
<span class="drop">
<i class="arrow down"></i>
</span>
<ul id="down3">
<li><a href="static/pages/spiderpi.html">SpiderPi</a></li>
<li><a href="static/pages/join.html">Join</a></li>
</ul>
</ul>
<ul>
<li onclick="menu6()"><a href="static/pages/learn.html">LEARN</a>
<span class="drop">
<i class="arrow down"></i>
</span>
<ul id="down4">
<li><a href="static/pages/whoweare.html">About Us</a></li>
<li><a href="static/pages/partners.html">Partners</a></li>
<li><a href="static/pages/meet.html">Meet</a></li>
<li><a href="static/pages/blog.html">Blog</a></li>
<li><a href="static/pages/code.html">Code</a></li>
</ul>
</ul>
</nav>
</div>
</div>
</div>
<main>
<section id="content">
<div class="section1">
<div id="title">
<h3>Cannabinieri</h3> <!--to be replaced with logo-->
</div>
<div id="product">
<a>
<img src="static/img/sample-sauvage.svg"/>
</a>
</div>
<div id="slogan">
<a href="#experiments">
<h2>Grow <br>further.</h2>
<i class='fas fa-caret-down'></i>
</a>
</div>
<div id="image">
<img id="leaves" src="static/img/bliss.jpg">
</div>
<div id="about">
<a href="#experiments">Explore
<i class='fas fa-chevron-down'></i>
</a>
</div>
</div>
<div class="pages-container">
<div class="strip">
<div class="section2" id="experiments">
<div class="image-slider">
<div class="slider-items">
<div class="item active">
<img src="static/img/sample-sauvage.svg" />
</div>
<div class="item">
<img id = "sample" src="static/img/sample-flower.svg"/>
</div>
<div class="left-slide">
<i class='fas fa-angle-left' id="dark"></i>
</div>
<div class="right-slide">
<i class='fas fa-angle-right' id="dark"></i>
</div>
</div>
</div>
<h1>Experiments</h1>
<p> # experiments=products=oils etc!Our Experiments explore how plants react to changes.<br>
Environmental conditions and the relations between plants define a plants health, growth taste and effect. <br>
<span id="desktop"> With our Experiments strive to understand our planet in order to create an organic, automated indoor garden for everyone, everywhere.</span>
</p>
<div class="page-button">
<a href="static/pages/experiments.html">More</a>
</div>
</div>
</div>
<div class="strip2" id="black">
<div class="section3" id="spider">
<div class="spider-slider">
<div class="spider-items">
<div class="item active">
<img id="pic1" src="static/img/sample-spiderpi.svg" />
</div>
<div class="item">
<img src="static/img/sample-spiderpi-2.svg" alt="">
</div>
<div id="spider-left">
<i class='fas fa-angle-left'></i>
</div>
<div id="spider-right">
<i class='fas fa-angle-right'></i>
</div>
</div>
</div>
<h1>Spider</h1>
<p><span id ="desktop">Learn about our project Spider Pi<br>
Get to know our garden hexapod. <br>
He is aimed to be a garden helper, that collects data while doing your gardening.<br></span>
Spider Pi enables everyone to grow their own crops everywhere.<br>
He is the solution for everyone who doesn't have the time for gardening but wants to grow their own local organic food and learn about plants in the meantime.<br>
#a dummy text
</p>
<div class="page-button">
<a href="static/pages/spider.html">Learn</a>
</div>
</div>
</div>
<div class="strip">
<div class="section4" id="permaculture">
<div class="image-slider">
<div class="slider-items">
<div class="item active">
<img src="static/img/sample-perma.svg"/>
</div>
<div class="item">
</div>
<div class="left-slide">
<i class='fas fa-angle-left'></i>
</div>
<div class="right-slide">
<i class='fas fa-angle-right'></i>
</div>
</div>
</div>
<h1>PermaCulture</h1>
<p>We utilitze and explore the principles of Permaculture.<br>
</p>
<div class="page-button">
<a href="static/pages/permaculture.html">Learn</a>
</div>
</div>
</div>
<div class="strip" id="black">
<div class="section5" id="greentech">
<div class="image-slider">
<div class="slider-items">
<div class="item active">
<img src="static/img/sample-greentech.svg"/>
</div>
<div class="item">
</div>
<div class="left-slide">
<i class='fas fa-angle-left'></i>
</div>
<div class="right-slide">
<i class='fas fa-angle-right'></i>
</div>
</div>
</div>
<h1>GreenTech</h1>
<p><span id="desktop">
We want you to be able to grow your own crops at home wherever that is and no matter how much time you have.<br>
There are many projects that combine farming and tech in order to create a system that bears changing environmental conditons and a growing population.<br></span>
<br>
Long distance transportation and the exploitation of ressources can be avoided if everyone grew their own crops or even better, let them be grown by affordable and accessible IoT solutions.<br><br>
Explore our projects and get inspired.<br>
</p>
<div class="page-button">
<a href="static/pages/greentech.html">Explore</a>
</div>
</div>
</div>
<div class="strip" id="black">
<div class="section6" id="about">
<div class="image-slider">
<div class="slider-items">
<div class="item active">
<img src="static/img/sample-us5.jpg" />
</div>
</div>
</div>
<h1>About Us</h1>
<p> We are currently a collective of five people, determined to connect farming and science.<br>
<span id="desktop">We aim to gather information about our ecosystem and utilize it to create 100% organic CBD products that all ship with a little bit more information for us and our customers. <br> </span>
We strive to understand our ecosystem and to utilize our knowledge in order to create a database of products and affordable solutions for an automated organic garden for everyone, everywhere.<br>
#dummy text
</p>
<div class="page-button">
<a href="static/pages/learn.html">Learn</a>
</div>
</div>
</div>
<div class="strip">
<div class="section7" id="news">
<h1>News</h1>
<div class="news">
<div class="social">
<h5>Keep in touch !</h5>
<img id="post_1" src="static/img/sample-post-insta.jpg"/>
<img class="desktop" id="post_2" src="static/img/sample-post-insta.jpg"/>
<img class="desktop" id="post_3" src="static/img/sample-post-insta.jpg"/>
<div class="instagram">
<a href="#">
<button id="insta"><img id="gram" src="static/img/pixelfed.svg"></button>
<h5 id="account">@Cannabinieri_Official</h5>
</a>
</div>
<div class="youtube">
<a href="#">
<button id="you"><img id="tube" src="static/img/peertube.svg"></button>
<h5 id="account">@Cannabinieri_Official</h5>
</a>
</div>
</div>
</div>
<!--add 3 blog posts with image here-->
</div>
</div>
</div>
</section>
</main>
<footer class="footer">
<div id="footer-wrapper">
<div id="column1">
<a href="responsive.html">
<img id="footer-logo" src="static/img/Logo.svg">
</a>
</div>
<div id="column2">
<h6 onclick="show()">Information
<span class="show">
<i class="arrow down"></i>
</span>
</h6>
<ul id="information">
<li>
<p>
<a href="static/pages/meet.html">Contact Us</a>
</p>
</li>
<li>
<p>
<a href="static/pages/global/footer-pages/privacy.html">Privacy Policy</a>
</p>
</li>
<li>
<p>
<a href="#">FAQ</a>
</p>
</li>
<li>
<p>
<a href="#">Certificate of Analysis</a>
</p>
</li>
</ul>
</div>
<div id="column3">
<h6 onclick="display()">links
<span class="show">
<i class="arrow down2"></i>
</span>
</h6>
<ul id="footer-links">
<li>
<p>
<a href="#">Blog</a>
</p>
</li>
<li>
<p>
<a href="#">Shop</a>
</p>
</li>
<li>
<p>
<a class="code" href="#">Code</a>
</p>
</li>
</ul>
</div>
<div id="column4">
<h6>TO BE SAID</h6>
<p> All our products contain<br>less than 0.2% THC</p>
</div>
<div id="column5">
<h6 class="follow">Follow us</h6>
<div id="social-media">
<ul>
<li class="youtube">
<a href="#">
<img id="youtube" src="static/img/peertube_white.svg">
</a>
</li>
<li>
<a href="#">
<img id="instagram" src="static/img/pixelfed_white.svg">
</a>
</li>
<li>
<a href="#">
<img id="gitea" src="static/img/gitea.svg">
</a>
</li>
</ul>
</div>
</div>
<div id="row2">
<p id ="print">©2020 Cannabinieri</p>
</div>
<div id="row3">
<div class="languages">
<a href="static/languages/deutsch.html">Deutsch |</a>
<a href="../languages/italiano.html">Italiano |</a>
<a href="../languages/francais.html">Francais </a>
</div>
</div>
</div>
</footer>
</div>
<script src="assets/js/main.js"></script>
<script src="assets /js/slider.js"></script>
</body>
</html>

+ 67
- 24
src/main.rs View File

@ -1,35 +1,78 @@
// use rocket macros globally // use rocket macros globally
#[macro_use]
extern crate rocket;
#[macro_use] extern crate rocket;
// Owned Mutable Path buffer holds path
use std::path::{ Path, PathBuf };
// push strings to path
// generate path from strings
use std::path::{ PathBuf, Path };
// Content-Type based on file extension
use rocket::fs::NamedFile;
// Responder Type NamedFile
// serve file with Content-Type based on name
use rocket::fs::{ NamedFile, relative };
// Set MIME-Types, Accept Header for Response
use rocket::http::{ Accept, QMediaType, MediaType };
// Render index.html on / request
#[get("/")]
// Load File asynchronously
async fn index() -> Option<NamedFile> {
// Attempt to open file readonly
NamedFile::open("templates/index.html")
.await.ok()
}
// Equivalent to main()
#[rocket::main] // enable asyn main()
async fn main() -> Result<(), rocket::Error> {
// State Rocket<Build> => configuration
// registering routes
// mounting routes
// registering/ mobuildunting catchers
// manage State
// attach Fairings
rocket::build()
// State Rocket<Ignite> => Finalized App ready to launch
// check before launching
// catch errors
// constructs FileServer with Path
.mount("/", routes![index, fileserver])
//FileServer unable to set Mime-Types
// .mount("/", FileServer::from(relative!("templates/assets")))
// Handle requests for static files
// Dynamic Path gets everything behind root
#[get("/<file..>")]
async fn static_files(file: PathBuf) -> Option<NamedFile> {
NamedFile::open(Path::new("templates/assets/").join(file)).await.ok()
.ignite().await?
// State Rocket<Orbit> => Running App
// State after launch() is called
// launch() starts server
.launch().await
} }
#[launch]
// Mount routes to Rocket instance
fn rocket() -> _{
// Launch Rocket
rocket::build().mount("/", routes![index, static_files])
// Configure requests
// generate routes, set attributes
// set http method
// set uri
#[route(GET, uri = "/")]
// if success call handler
async fn index() -> Option<NamedFile> {
NamedFile::open("templates/index.html").await.ok()
} }
// Serve static files from Index.html
// Match against multiple segments
// parameters need to implement FromSegments
// PathBuf implements FromSegments
// push all segments to path
// Option<Some, Err> implements Responder
// NamedFile implements Responder=> generates Response
#[route(GET, uri= "/<path..>")]
async fn fileserver(path: PathBuf) -> Option<NamedFile> {
// set path to static files
let mut path = Path::new(relative!("templates/assets")).join(path);
// if path exists add path to index.html ?
let accept = vec![
MediaType::CSS.into(), MediaType::JavaScript.into(),
];
if path.is_dir() {
path.push("templates/index.html");
Accept::new(accept);
}
// open file readonly
// NamedFile = Response
println!("{:?}", path);
NamedFile::open(path).await.ok()
}

templates/assets/img/Logo.svg → templates/assets/Logo.svg View File


+ 0
- 3
templates/assets/css/index.css View File

@ -1,3 +0,0 @@
h1 {
color: blueviolet;
}

+ 4
- 0
templates/assets/font-awesome.min.css
File diff suppressed because it is too large
View File


+ 2970
- 0
templates/assets/index.css
File diff suppressed because it is too large
View File


+ 0
- 2
templates/assets/jquery/jquery-3.5.1.min.js
File diff suppressed because it is too large
View File


+ 0
- 108
templates/assets/js/main.js View File

@ -1,108 +0,0 @@
// this function shows an element by id
function show() {
var x= document.getElementById("information");
if (x.style.display === "none") {
x.style.display = "flex"; }
else {
x.style.display ="none";
}
}
//this function shows element2 by id -to be generalized
function display() {
var x= document.getElementById("footer-links");
if (x.style.display === "none") {
x.style.display = "flex";}
else {
x.style.display ="none";
}
}
function menu() {
var x= document.getElementById("mobile-dropdown");
if (x.style.display === "none") {
x.style.display = "block";}
else {
x.style.display ="none";
}
}
function menu2() {
var x= document.getElementById("down");
if (x.style.display === "none") {
x.style.display = "block";}
else {
x.style.display ="none";
}
}
function menu3() {
var x= document.getElementById("down1");
if (x.style.display === "none") {
x.style.display = "block";}
else {
x.style.display ="none";
}
}
function menu4() {
var x= document.getElementById("down2");
if (x.style.display === "none") {
x.style.display = "block";}
else {
x.style.display ="none";
}
}
function menu5() {
var x= document.getElementById("down3");
if (x.style.display === "none") {
x.style.display = "block";}
else {
x.style.display ="none";
}
}
function menu6() {
var x= document.getElementById("down4");
if (x.style.display === "none") {
x.style.display = "block";}
else {
x.style.display ="none";
}
}
//print pdf file
// const pdfBtn = document.getElementById('print');
// console.log(pdfBtn);
// const printPage = () => {
// window.print();
// }
// pdfBtn.addEventListener("click", (event) => {
// printPage(event, 'printed');
// });
// let screen = () => {
// console.log(window.innerHeight);
// console.log(window.innerWidth);
// };
// screen();
window.addEventListener('load', () => {
document.getElementById('print').addEventListener('click', () => {
let page = this.document.querySelector('.wrapper');
console.log(page);
console.log(window);
})
}, false);

+ 0
- 20
templates/assets/js/pages.js View File

@ -1,20 +0,0 @@
$(document).ready(function(){
// Add smooth scrolling to all links with #
$("a").on('click', function(event) {
if (this.hash !== "") {
// Prevent default anchor click behavior
event.preventDefault();
// Store hash
var hash = this.hash;
$('html, body').animate({
scrollTop: $(hash).offset().top
}, 1000, function(){
// Add hash (#) to URL when done scrolling (default click behavior)
window.location.hash = hash;
});
} // End if
});
});

+ 0
- 80
templates/assets/js/slider.js View File

@ -1,80 +0,0 @@
let slides=document.querySelector('.slider-items').children;
let nextSlide=document.querySelector('.right-slide');
let prevSlide=document.querySelector('.left-slide');
let totalSlides=slides.length;
let index=0;
console.log(index);
nextSlide.onclick = () => {
next("next");
}
prevSlide.onclick = () => {
next("prev");
}
let next = (direction)=> {
if (direction=="next"){
index++;
if (index==totalSlides){
index=0;
}
}
else{
if(index==0){
index=totalSlides-1;
}
else {
index--;
}
}
for (i=0; i<slides.length;i++){
slides[i].classList.remove("active");
}
slides[index].classList.add("active");
}
const spider=document.querySelector('.spider-items').children;
const spiderNext=document.querySelector('#spider-right');
const spiderPrev=document.querySelector('#spider-left');
let spiderTotal=spider.length;
console.log(spider);
console.log(spiderNext);
console.log(spiderPrev);
console.log(spiderTotal);
spiderNext.onclick = () => {
nextSpider("next");
}
spiderPrev.onclick = () => {
nextSpider("prev");
}
let nextSpider = (direction)=> {
if (direction=="next"){
index++;
if (index==spiderTotal){
index=0;
}
}
else{
if(index==0){
index=spiderTotal-1;
}
else {
index--;
}
}
for (i=0; i<spider.length;i++){
spider[i].classList.remove("active");
}
spider[index].classList.add("active");
}

templates/assets/css/nav.css → templates/assets/nav.css View File


+ 7
- 6
templates/index.html View File

@ -4,18 +4,19 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-eqiv="X-UA-Compatible" content="ie=edge"/> <meta http-eqiv="X-UA-Compatible" content="ie=edge"/>
<link rel="stylesheet" type="text/css" href="assets/css/index.css">
<link rel="stylesheet" type="text/css" href="assets/css/nav.css">
<link rel="icon" href="assets/img/Logo.svg">
<link rel="stylesheet" type="text/css" href="index.css">
<link rel="stylesheet" type="text/css" href="nav.css">
<link rel="icon" type="img/svg+xml" href="Logo.svg">
<title> <title>
Cannabinieri CBD Cannabinieri CBD
</title> </title>
<script defer src="assets/fontawesome/all.css"></script>
<script defer src="fontawesome.min.css"></script>
<script src="assets/jquery/jquery-3.5.1.min.js"></script> <script src="assets/jquery/jquery-3.5.1.min.js"></script>
</head> </head>
<body> <body>
<div class="wrapper"> <div class="wrapper">
<nav class="top-bar"> <nav class="top-bar">
<!--Add Askama Language Handling-->
<div class="languages"> <div class="languages">
<a href="static/languages/deutsch.html">Deutsch |</a> <a href="static/languages/deutsch.html">Deutsch |</a>
<a href="static/languages/italiano.html">Italiano |</a> <a href="static/languages/italiano.html">Italiano |</a>
@ -24,7 +25,7 @@
</nav> </nav>
<div id="main-bar"> <div id="main-bar">
<div id="logo-container"> <div id="logo-container">
<img class="logo" src= "assets/img/Logo.svg">
<img class="logo" type="image/webp" src="Logo.svg">
</div> </div>
<nav class="main-navigation-bar"> <nav class="main-navigation-bar">
<ul> <ul>
@ -445,7 +446,7 @@
</div> </div>
</footer> </footer>
</div> </div>
<script src="assets/js/main.js"></script>
<script src="test/main.js" type="text/javascript"></script>
<script src="assets/js/pages.js"></script> <script src="assets/js/pages.js"></script>
<script src="assets/js/slider.js"></script> <script src="assets/js/slider.js"></script>
</body> </body>

+ 15
- 0
templates/test_index.html View File

@ -0,0 +1,15 @@
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-eqiv="X-UA-Compatible" content="ie=edge"/>
<link rel="stylesheet" type="text/css" href="test_index.css">
<title>Test</title>
</head>
<body>
<h1>Purple</h1>
<img src="test_logo.svg" type="image/webp">
<script src="test_index.js" type="text/javascript"></script>
</body>
</html>

Loading…
Cancel
Save