mirror of
https://github.com/cse110-fa22-group29/cse110-fa22-group29.git
synced 2024-11-10 05:34:44 +00:00
Merge branch 'sprint-2-css-review-details' of https://github.com/cse110-fa22-group29/cse110-fa22-group29 into sprint-2-css-review-details
This commit is contained in:
commit
6d126f6085
2
.github/workflows/css-linting.yml
vendored
2
.github/workflows/css-linting.yml
vendored
@ -20,4 +20,4 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: sudo npm install
|
||||
- name: Run tests
|
||||
run: sudo npm run lintCSS
|
||||
run: sudo npm run lint-css
|
2
.github/workflows/html-linting.yml
vendored
2
.github/workflows/html-linting.yml
vendored
@ -20,4 +20,4 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: sudo npm install
|
||||
- name: Run tests
|
||||
run: sudo npm run lintHTML
|
||||
run: sudo npm run lint-html
|
||||
|
2
.github/workflows/js-linting.yml
vendored
2
.github/workflows/js-linting.yml
vendored
@ -22,4 +22,4 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: sudo npm install
|
||||
- name: Run tests
|
||||
run: sudo npm run lint
|
||||
run: sudo npm run lint-js
|
@ -1,3 +1,4 @@
|
||||
{
|
||||
"attr-value-not-empty": false
|
||||
"attr-value-not-empty": false,
|
||||
"space-tab-mixed-disabled": false
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
{
|
||||
"extends": "stylelint-config-standard"
|
||||
"extends": "stylelint-config-standard",
|
||||
"ignore": ["inside-parens", "param", "value"]
|
||||
}
|
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"liveServer.settings.port": 5501
|
||||
}
|
@ -40,9 +40,14 @@
|
||||
<form id="new-food-entry">
|
||||
<fieldset>
|
||||
<legend>Pic:</legend>
|
||||
<label for="mealImage">
|
||||
Choose Input type:
|
||||
<select id="select" name="select">
|
||||
<option value="file">File Upload</option>
|
||||
<option value="url">From an URL</option>
|
||||
</select>
|
||||
<label for="mealImage" id="source">
|
||||
Source:
|
||||
<input type="text" id="mealImg" name="mealImg">
|
||||
<input type="file" accept="image/*" id="mealImg" name="mealImg">
|
||||
</label>
|
||||
<label for="image-alt">
|
||||
Alt Text:
|
||||
|
@ -53,9 +53,14 @@
|
||||
<form id="update-food-entry">
|
||||
<fieldset>
|
||||
<legend>Pic:</legend>
|
||||
<label for="mealImage">
|
||||
Choose Input type:
|
||||
<select id="select" name="select">
|
||||
<option value="file">File Upload</option>
|
||||
<option value="url">From an URL</option>
|
||||
</select>
|
||||
<label for="mealImage" id="source">
|
||||
Source:
|
||||
<input type="text" id="mealImg" name="mealImg">
|
||||
<input type="file" accept="image/*" id="mealImg" name="mealImg">
|
||||
</label>
|
||||
<label for="image-alt">
|
||||
Alt Text:
|
||||
|
@ -15,7 +15,44 @@ function initFormHandler() {
|
||||
//accessing form components
|
||||
let tagContainer = document.getElementById("tag-container-form");
|
||||
let form = document.querySelector("form");
|
||||
|
||||
|
||||
/*
|
||||
* change the input source of the image between local file and URL
|
||||
* depending on user's selection
|
||||
*/
|
||||
let select = document.getElementById("select");
|
||||
select.addEventListener("change", function() {
|
||||
const input = document.getElementById("source");
|
||||
|
||||
if (select.value == "file") {
|
||||
input.innerHTML = `
|
||||
Source:
|
||||
<input type="file" accept="image/*" id="mealImg" name="mealImg">
|
||||
`;
|
||||
}
|
||||
//TODO: change to photo taking for sprint 3
|
||||
else {
|
||||
input.innerHTML = `
|
||||
Source:
|
||||
<input type="text" id="mealImg" name="mealImg">
|
||||
`;
|
||||
}
|
||||
});
|
||||
|
||||
//addressing sourcing image from local file
|
||||
let imgDataURL = "";
|
||||
document.getElementById("mealImg").addEventListener("change", function() {
|
||||
const reader = new FileReader();
|
||||
|
||||
//store image data URL after successful image load
|
||||
reader.addEventListener("load", ()=>{
|
||||
imgDataURL = reader.result;
|
||||
}, false);
|
||||
|
||||
//convert image file into data URL for local storage
|
||||
reader.readAsDataURL(document.getElementById("mealImg").files[0]);
|
||||
});
|
||||
|
||||
form.addEventListener("submit", function(e){
|
||||
/*
|
||||
* User submits the form for their review.
|
||||
@ -30,6 +67,9 @@ function initFormHandler() {
|
||||
if (`${key}` !== "tag-form") {
|
||||
reviewObject[`${key}`] = `${value}`;
|
||||
}
|
||||
if (`${key}` === "mealImg" && select.value == "file") {
|
||||
reviewObject["mealImg"] = imgDataURL;
|
||||
}
|
||||
}
|
||||
reviewObject["tags"] = [];
|
||||
|
||||
|
@ -99,6 +99,46 @@ function setupUpdate(){
|
||||
tagContainer.append(newTag);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* change the input source of the image between local file and URL
|
||||
* depending on user's selection
|
||||
*/
|
||||
let select = document.getElementById("select");
|
||||
select.addEventListener("change", function() {
|
||||
const input = document.getElementById("source");
|
||||
|
||||
if (select.value == "file") {
|
||||
input.innerHTML = `
|
||||
Source:
|
||||
<input type="file" accept="image/*" id="mealImg" name="mealImg">
|
||||
`;
|
||||
}
|
||||
//TODO: change to photo taking for sprint 3
|
||||
else {
|
||||
input.innerHTML = `
|
||||
Source:
|
||||
<input type="text" id="mealImg" name="mealImg">
|
||||
`;
|
||||
}
|
||||
});
|
||||
|
||||
//addressing sourcing image from local file
|
||||
let imgDataURL = "";
|
||||
document.getElementById("mealImg").addEventListener("change", function() {
|
||||
console.log("reading used");
|
||||
const reader = new FileReader();
|
||||
|
||||
//store image data URL after successful image load
|
||||
reader.addEventListener("load", ()=>{
|
||||
imgDataURL = reader.result;
|
||||
}, false);
|
||||
|
||||
//convert image file into data URL for local storage
|
||||
reader.readAsDataURL(document.getElementById("mealImg").files[0]);
|
||||
});
|
||||
|
||||
|
||||
//Take formdata values as newData when submit
|
||||
form.addEventListener("submit", function(){
|
||||
/*
|
||||
@ -113,6 +153,13 @@ function setupUpdate(){
|
||||
if (`${key}` !== "tag-form") {
|
||||
newData[`${key}`] = `${value}`;
|
||||
}
|
||||
//Account for the case where image is not updated
|
||||
if (`${key}` === "mealImg" && document.getElementById("mealImg").value === "") {
|
||||
newData["mealImg"] = currReview["mealImg"];
|
||||
}
|
||||
else if (`${key}` === "mealImg" && select.value == "file") {
|
||||
newData["mealImg"] = imgDataURL;
|
||||
}
|
||||
}
|
||||
newData["tags"] = [];
|
||||
|
||||
|
@ -39,7 +39,7 @@ describe("test App end to end", async () => {
|
||||
|
||||
describe("test CRUD on simple inputs and default image", () => {
|
||||
|
||||
describe("test create 1 new review", async () => {
|
||||
describe("test create 1 new review", async () => {
|
||||
it("create 1 new review", async () => {
|
||||
// Click the button to create a new review
|
||||
let create_btn = await page.$("#create-btn");
|
||||
@ -229,18 +229,8 @@ describe("test App end to end", async () => {
|
||||
console.log(dialog.message());
|
||||
await dialog.accept();
|
||||
});
|
||||
|
||||
// Get the delete button and click it
|
||||
let delete_btn = await page.$("#delete-btn");
|
||||
await delete_btn.click();
|
||||
await page.waitForNavigation();
|
||||
|
||||
// Check that the card was correctly removed (there should be no remaining cards)
|
||||
review_card = await page.$("#review-card");
|
||||
assert.strictEqual(review_card, null);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
|
@ -2,52 +2,58 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Food Journal</title>
|
||||
<meta charset="UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Food Journal</title>
|
||||
|
||||
<!-- Recipe Card Custom Element -->
|
||||
<script src="assets/scripts/ReviewCard.js" type="module"></script>
|
||||
|
||||
|
||||
<!-- Main Stylesheets & Scripts -->
|
||||
<!-- Temporarily commented out reset.css due to furthur discussion needed on the values of the default config-->
|
||||
<!-- <link rel="stylesheet" href="/static/reset.css" /> -->
|
||||
<link rel="stylesheet" href="./static/homepage.css" />
|
||||
<script src="assets/scripts/main.js" type="module"></script>
|
||||
<!-- Recipe Card Custom Element -->
|
||||
<script src="assets/scripts/ReviewCard.js" type="module"></script>
|
||||
|
||||
<!-- Main Stylesheets & Scripts -->
|
||||
<!-- Temporarily commented out reset.css due to furthur discussion needed on the values of the default config-->
|
||||
<!-- <link rel="stylesheet" href="/static/reset.css" /> -->
|
||||
<link rel="stylesheet" href="./static/homepage.css" />
|
||||
<script src="assets/scripts/main.js" type="module"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class ="Top-Bar">
|
||||
<img src ="./assets/images/icons/Logo.png" alt="logo" />
|
||||
<h1 style="font-family:'Lucida Sans'"> Food Journal </h1>
|
||||
<form id="form">
|
||||
<input type='search' id="seaching" name="searchBar" placeholder="Search journal...">
|
||||
<button class="click" type="search">
|
||||
Search
|
||||
</button>
|
||||
</form>
|
||||
<!--
|
||||
<form id="form">
|
||||
<input type='search' id="seaching" name="searchBar" placeholder="Search journal...">
|
||||
<button class="click" type="search">
|
||||
Search
|
||||
</button>
|
||||
</form>
|
||||
--->
|
||||
</div>
|
||||
<main>
|
||||
<!-- Add Food Entries Here -->
|
||||
<div class="Review-boxes">
|
||||
<h2> Recent Reviews </h2>
|
||||
<img src ="./assets/images/icons/Grouppink.png" alt="CREATE" id="create-btn" onclick="window.location.assign('./CreatePage.html')"></img>
|
||||
|
||||
</div>
|
||||
<div class="Filter-box">
|
||||
</div>
|
||||
<div class="review-container" id="review-container"></div>
|
||||
</main>
|
||||
<!--<button type="button" id="create-btn"><a href='./CreatePage.html'></a>CREATE</button>-->
|
||||
</body>
|
||||
<main>
|
||||
<header>
|
||||
<div class="Top-Bar" style="display: flex; justify-content: center;">
|
||||
<img src ="./assets/images/icons/Logo.png" style="align-self: center;" alt="logo" />
|
||||
<h1 style="font-family:'Lucida Sans';"> Food Journal </h1>
|
||||
<img src ="./assets/images/icons/Logo.png" style="align-self: center;" alt="logo" />
|
||||
</div>
|
||||
</header>
|
||||
<body>
|
||||
|
||||
<!--
|
||||
For mobile: + flex-direction: column-reverse;"
|
||||
~ width: 100% for all divs
|
||||
-->
|
||||
<div style="display: flex; max-height: 100%; ">
|
||||
<div style="width: 20%;"></div>
|
||||
|
||||
<div style="width: 60%;">
|
||||
<div style="display: flex; flex-direction: row; justify-content: center;">
|
||||
<img src ="./assets/images/icons/Grouppink.png" alt="CREATE" style="align-self: center;" id="create-btn" onclick="window.location.assign('./CreatePage.html')"></img>
|
||||
<h2 id="recent-reviews-text"> Recent Reviews </h2>
|
||||
<img src ="./assets/images/icons/Grouppink.png" alt="" style="align-self: center; opacity:0;"></img>
|
||||
</div>
|
||||
|
||||
<div class="review-container" id="review-container"></div>
|
||||
</div>
|
||||
|
||||
<div style="width: 20%;">
|
||||
<form id="form" style="">
|
||||
<input type='search' id="seaching" name="searchBar" placeholder="Search journal...">
|
||||
<button class="click" type="search">
|
||||
Search
|
||||
</button>
|
||||
<div class="Filter-box"></div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</main>
|
||||
</html>
|
||||
|
@ -1,65 +1,53 @@
|
||||
/* homepage.css */
|
||||
/* Color*/
|
||||
body{
|
||||
background-color: #13323b;
|
||||
background-color: #97a5bd;
|
||||
}
|
||||
.Top-Bar{
|
||||
margin-top: -8cm;
|
||||
}
|
||||
.Top-Bar > img{
|
||||
position: relative;
|
||||
top: 7.5cm;
|
||||
}
|
||||
.Top-Bar > h1{
|
||||
position: relative;
|
||||
left: 10.5cm;
|
||||
top: 2.2cm;
|
||||
font-size: 3cm;
|
||||
color: #EAA9BC;
|
||||
|
||||
text-align: center;
|
||||
color: #E4C3D2;
|
||||
font-size: 100px;
|
||||
font-family: 'Lucida Sans';
|
||||
}
|
||||
.Top-Bar > form{
|
||||
position: relative;
|
||||
left: 32cm;
|
||||
float: right;
|
||||
}
|
||||
.Review-boxes {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.Review-boxes > h2 {
|
||||
position: relative;
|
||||
left: 10cm;
|
||||
font-size: 1.5cm;
|
||||
color: #EAA9BC;
|
||||
#recent-reviews-text {
|
||||
font-family: 'Lucida Sans';
|
||||
text-align: center;
|
||||
font-size: 80px;
|
||||
color: #E4C3D2;
|
||||
}
|
||||
.Review-boxes > input {
|
||||
position: relative;
|
||||
left: 20.34cm;
|
||||
top: -3.5cm;
|
||||
}
|
||||
|
||||
img#create-btn {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.Filter-box{
|
||||
width:300px;
|
||||
height:700px;
|
||||
background: #8D4E62;
|
||||
position: relative;
|
||||
left: 29.5cm;
|
||||
top: -5.5cm;
|
||||
background: #e4d9e9;
|
||||
position: absolute;
|
||||
border: 5px solid #99a2c2;
|
||||
}
|
||||
.review-container{
|
||||
display: flex;
|
||||
position: relative;
|
||||
top: -22cm;
|
||||
left: 5cm;
|
||||
max-width: 900px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.review-container > div {
|
||||
background-color: #f1f1f1;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
margin: 10px;
|
||||
text-align: center;
|
||||
line-height: 75px;
|
||||
font-size: 30px;
|
||||
}
|
Loading…
Reference in New Issue
Block a user