Browse Source

updated

integrate_codes_to_fields
anghenfil 3 years ago
parent
commit
4c0eed0748
  1. 14
      .gitignore
  2. 2
      Cargo.toml
  3. 15
      Generator.iml
  4. 23
      src/webserver/sites.rs
  5. 23
      src/webserver/templates.rs

14
.gitignore

@ -1,12 +1,2 @@
# ---> Rust
# Generated by Cargo
# will have compiled files and executables
/target/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock
# These are backup files generated by rustfmt
**/*.rs.bk
/target
**/*.rs.bk

2
Cargo.toml

@ -1,6 +1,6 @@
[package]
name = "Surveyz"
version = "0.6.3"
version = "0.1.2"
authors = ["anghenfil <ares@anghenfil.de>"]
[dependencies]

15
Generator.iml

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="RUST_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/examples" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/benches" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

23
src/webserver/sites.rs

@ -165,28 +165,7 @@ pub fn poll_post(code: &RawStr, data: Form<FormData>, sessionid: Option<&RawStr>
}
if session_manager::SESSIONS.read().unwrap().get(&sessionid).unwrap().complete {
return Ok(content::Html(format!("<!DOCTYPE html>
<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\">
<title>Surveyz</title>
<link href=\"https://fonts.googleapis.com/css?family=Lato\" rel=\"stylesheet\">
<link rel=\"stylesheet\" href=\"style/bootstrap.css\">
<link rel=\"stylesheet\" href=\"style/global.css\">
<link rel=\"stylesheet\" href=\"style/poll.css\">
</head>
<body class=\"centered\">
{}
<div class=\"mainframe text-center align-middle\">
<h1>Completed!</h1>
<p>Thank you for your participation!</p>
</div>
<div class=\"footer\">
<p>Powered by Surveyz - Project created by Keanu Dölle</p>
</div>
</body>
</html>
return Ok(content::Html(format!("d
", logo)));
}

23
src/webserver/templates.rs

@ -0,0 +1,23 @@
fn get_main(content : String, stylesheets : Vec<String>, scripts : Vec<String>) -> String{
let stylesheets_list = stylesheets.iter().map(|stylesheet|{
format!("<link rel=\"stylesheet\" type=\"text/css\" href=\"{}\"", stylesheet)
}).collect();
let scripts_list = scripts.iter().map(|script| {
format!("<script type=\"text/javascript\" src=\"{}\"", script)
}).collect();
format!("
<!DOCTYPE html>
<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\">
<title>Surveyz</title>
{}
</head>
<body>
{}
{}
</body>
</html>", stylesheets_list, content, scripts_list)
}
Loading…
Cancel
Save