This repository has been archived by the owner on Aug 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
#6 created a Client-side functionality for the Helpful and Not Helpfu… #15
Merged
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
3a1775c
#6 created a Client-side functionality for the Helpful and Not Helpfu…
Yjohn 9a2df7b
Add the rating route
7190222
Take the FS from the code
a0fc622
added the issues number #7
4316157
#6 creating client side functionality, listen all the buttons ...
Yjohn a05f380
#6 created a Client-side functionality for the Helpful and Not Helpfu…
Yjohn 50e5cff
#6 creating client side functionality, listen all the buttons ...
Yjohn bbef6b1
fixing the function of receiveResponse
Yjohn 351e281
change the name of not helpful to unhelpful
Yjohn 5e50f6f
change from string to validate JSON object by using JSON.parse
Yjohn 1ab3054
fixing the merge conflict
Yjohn 81d61c8
format the document
Yjohn ea75504
#6 display the total number of People
Yjohn 724f010
change the variable name for total entiries
Yjohn 53cc818
#6 adding loading animation when the button clicked
Yjohn 99bd9e5
change the attributes to be displayed
Yjohn afb3936
#6 change the loading ID to the class
Yjohn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
var helpful = 0; | ||
var unhelpful = 0; | ||
var total = 0; | ||
var display = document.getElementById("displayCount"); | ||
var totalNumber = document.getElementById("totalNumber") | ||
document.getElementById("Button1").addEventListener("click", function (event) { | ||
//var temp = event.target; | ||
helpful++; | ||
total++; | ||
display.innerHTML = helpful; | ||
totalNumber.innerHTML = total; | ||
}); | ||
document.getElementById("Button2").addEventListener("click", function (event) { | ||
unhelpful++; | ||
total++; | ||
totalNumber.innerHTML = total; | ||
}); | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,23 +8,23 @@ | |
</button> | ||
</form> | ||
{{#if entries}} | ||
<ul class="entry-list"> | ||
{{#each entries}} | ||
<li class="entry"> | ||
<h2 class="entry__question"> | ||
{{this.question}} | ||
</h2> | ||
<div class="entry__answer"> | ||
{{{this.answer}}} | ||
</div> | ||
<div class="entry__help"> | ||
{{this.helpful}}/?? people found this helpful. Was this entry helpful? | ||
<button class="button button--small">Yes</button> | ||
<button class="button button--small">No</button> | ||
</div> | ||
</li> | ||
{{/each}} | ||
</ul> | ||
<ul class="entry-list"> | ||
{{#each entries}} | ||
<li class="entry"> | ||
<h2 class="entry__question"> | ||
{{this.question}} | ||
</h2> | ||
<div class="entry__answer"> | ||
{{{this.answer}}} | ||
</div> | ||
<div class="entry__help"> | ||
<span id="displayCount">{{this.helpful}}</span>/<span id="totalNumber"></span> people found this helpful. Was this entry helpful? | ||
<button id="Button1" class="button button--small">Yes</button> | ||
<button id="Button2" class="button button--small">No</button> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
</div> | ||
</li> | ||
{{/each}} | ||
</ul> | ||
{{/if}} | ||
<div class="add"> | ||
<p class="add__prompt">Still haven't found your answer? Why not ask a question?</p> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,5 +14,6 @@ | |
</header> | ||
{{{body}}} | ||
</div> | ||
<script src="/main.js"></script> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The indentation doesn't look right here. Try formatting the document. |
||
</body> | ||
</html> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're going to run into problems using
getElementById
, because everyid
on an HTML page must be completely unique. You can't have two elements with the sameid
.Learn about querySelectorAll which allows you to select by class name and other attributes.
You'll face the same problem with your global
helpful
andtotal
vars. If each question has it's own values, you'll need a way to store those values separately.