-
Notifications
You must be signed in to change notification settings - Fork 54
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
Ray's Personal API work #25
base: master
Are you sure you want to change the base?
Conversation
raybchoi
commented
Sep 5, 2017
- Please note that the about me and social network section does not work.
- If there is an easier way to do toggles that would be great along with an easier way of showing the back button?
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.
Looks awesome.
const db = require('../models'); | ||
|
||
|
||
// GET renderSearchResults => on load of the page what to be able to render the search results page which loads the 10 people in the database |
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.
Commented out code :(
// function that ONLY sends back ones that are NOT marked for delation => used for initial SRP | ||
function searchResultsPage(req, res) { | ||
console.log('SRP is getting data') | ||
db.Profile.find({}, function(err, allProfiles) { |
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.
db.Profile.find({markedForDeletion: false}, ...)
console.log('showOneProfile in controller had an error', err); | ||
} | ||
// send back the Profile info the DB via json file | ||
res.json(foundProfile); |
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.
indentation is off, should be one left
<div id="search-results"></div> | ||
|
||
<!-- SRP starts here | ||
<div class="container search"> |
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.
so much commented out code
let newProfileHeaderTitle = $('.modal-input-for-profile-title').val(); | ||
let newProfileHeaderWorkpalce = $('.modal-input-for-profile-workPlace').val(); | ||
let newProfileHeaderQuote = $('.modal-input-for-profile-quote').val(); | ||
let newProfileHeaderImg ='/images/userimages/' + $('.modal-input-for-file').val().split('\\').pop(); |
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.
doesn't work for actually uploading images: you don't send the image file data to the server
$.ajax({ | ||
method: 'GET', | ||
url: '/api/searchpage', | ||
}) |
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.
could use a function for this
console.log('ERROR during the editedProfileHeaderData returned data', err); | ||
}); | ||
// closes the save icon | ||
$('.edit-save-header').toggle(); |
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.
Give one class to all of those elements called ".toggle" and then just take everything with that class and toggle it.
Missed my train. Will be a few minutes late.
…On Thu, Sep 7, 2017 at 4:08 PM Michelle Ferreirae ***@***.***> wrote:
***@***.**** commented on this pull request.
Looks awesome.
------------------------------
In controllers/profileController.js
<#25 (comment)>
:
> @@ -0,0 +1,107 @@
+/************
+ * DATABASE *
+ ************/
+
+const db = require('../models');
+
+
+// GET renderSearchResults => on load of the page what to be able to render the search results page which loads the 10 people in the database
Commented out code :(
------------------------------
In controllers/profileController.js
<#25 (comment)>
:
> + // append profileSRP from the SRP section
+ // fill in the correct user information
+
+// Function to send back everything
+ // function searchResultsPage(req, res) {
+ // console.log('SRP is getting data')
+ // db.Profile.find({}, function(err, allProfiles) {
+ // res.json(allProfiles)
+ // })
+ // res.status(200)
+ // };
+
+// function that ONLY sends back ones that are NOT marked for delation => used for initial SRP
+function searchResultsPage(req, res) {
+ console.log('SRP is getting data')
+ db.Profile.find({}, function(err, allProfiles) {
db.Profile.find({markedForDeletion: false}, ...)
------------------------------
In controllers/profileController.js
<#25 (comment)>
:
> + });
+ res.json(arrayOfProfilesToBeShown);
+ console.log('DONT SEND BACK', arrayOfProfilesMarkedForDeletion);
+ });
+};
+
+// GET (SEND user ID) and renderProfile need to be able to click on a person, take that id and route them to a profile page
+
+function showOneProfile(req, res) {
+ console.log('showOneProfile Route is getting hit', req.params.profileId);
+ db.Profile.findById(req.params.profileId, function(err, foundProfile) {
+ if (err) {
+ console.log('showOneProfile in controller had an error', err);
+ }
+ // send back the Profile info the DB via json file
+ res.json(foundProfile);
indentation is off, should be one left
------------------------------
In views/index.html
<#25 (comment)>
:
> + <input class='modal-input-for-profile-header modal-input-for-file' type="file" id='input-file' type="file"></input>
+ </div>
+ <div class="modal-footer">
+ <a type='submit' href="#!" class="modal-action modal-close waves-effect waves-purple btn-flat save-new-user">Save</a>
+ <a href="#!" class="modal-action modal-close waves-effect waves-purple btn-flat">Cancel</a>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+
+ <div id="search-results"></div>
+
+<!-- SRP starts here
+ <div class="container search">
so much commented out code
------------------------------
In public/scripts/app.js
<#25 (comment)>
:
> });
+
+let createNewUser = function() {
+
+ // go and get each of the value from the input field. The initial value of each field was populated automatically by using the 'value=' in the input tag of the html
+ let newProfileHeaderName = $('.modal-input-for-profile-name').val();
+ let newProfileHeaderTitle = $('.modal-input-for-profile-title').val();
+ let newProfileHeaderWorkpalce = $('.modal-input-for-profile-workPlace').val();
+ let newProfileHeaderQuote = $('.modal-input-for-profile-quote').val();
+ let newProfileHeaderImg ='/images/userimages/' + $('.modal-input-for-file').val().split('\\').pop();
doesn't work for actually uploading images: you don't send the image file
data to the server
------------------------------
In public/scripts/app.js
<#25 (comment)>
:
> + <span class='search-card-span quote' name='quote' value=''>${searchResult.quote}</span>
+ </div>
+ </div>
+ </div>
+ </div>
+ `
+ // append it with a fadeIn
+ $('#search-results').append(srpCardHtml).hide().fadeIn(100);
+};
+
+// re-render the Search Results page when going from the profile page back to the SRP
+let reRenderSrp = function(){
+ $.ajax({
+ method: 'GET',
+ url: '/api/searchpage',
+ })
could use a function for this
------------------------------
In public/scripts/app.js
<#25 (comment)>
:
> +
+ $.ajax({
+ method: 'PUT',
+ url: `/api/searchpage/${currentProfileId}`,
+ data: editedProfileHeaderData,
+ })
+ .then(function(updatedEditedData) {
+ console.log('DATA returned from editedProfileHeaderData', updatedEditedData);
+ // send back the updated data do can pass it through a similar render function again. This time will have another function b/c one is coming from the SRP and the other is coming from the profile page
+ renderProfileAfterEdit(updatedEditedData);
+ })
+ .catch(function(err) {
+ console.log('ERROR during the editedProfileHeaderData returned data', err);
+ });
+ // closes the save icon
+ $('.edit-save-header').toggle();
Give one class to all of those elements called ".toggle" and then just
take everything with that class and toggle it.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#25 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/Ac--Y44Qco6siFjvBy-ac7ZGobCrqXNwks5sgHeBgaJpZM4PNMQl>
.
|