Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add comment #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions dist/Renderer.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class Renderer {
renderData (data) {
let source = $("#data-template").html();
let template = Handlebars.compile(source)
let html = template({results: results})
$(".results").empty().append(html)
}
}
renderData(data) {
let source = $("#data-template").html();
let template = Handlebars.compile(source);
let html = template({ results: results });
$(".results").empty().append(html);
}
}
5 changes: 4 additions & 1 deletion dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
</head>

<body>

<div id="main-comment">
<textarea id="comment-input" placeholder="Enter your comment"></textarea>
<button id="comment-subment">submet</button>
</div>
<script src="./jquery/dist/jquery.js"></script>
<script src="./handlebars/dist/handlebars.js"></script>
<script src="DataModel.js"></script>
Expand Down
14 changes: 12 additions & 2 deletions dist/main.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
const dataModel = new DataModel()
const renderer = new Renderer()
const saveComment = function () {
const comment = $("#comment-input").val();
console.log(comment);
$.post("/comment", {coment: comment}, function (response) {});
};

$("#comment-subment").on("click", function () {
saveComment();
$("#comment-input").val("");
});


2 changes: 1 addition & 1 deletion dist/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
}

body{
background-image: linear-gradient(#3498db, #2980b9);
background-image: linear-gradient(#37da76, #2980b9);
background-attachment: fixed;
}

Expand Down
Loading