Open
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?
mnfmnfm
reviewed
Sep 7, 2017
| 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 |
| // 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.
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); |
| <div id="search-results"></div> | ||
|
|
||
| <!-- SRP starts here | ||
| <div class="container search"> |
| 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.
doesn't work for actually uploading images: you don't send the image file data to the server
| $.ajax({ | ||
| method: 'GET', | ||
| url: '/api/searchpage', | ||
| }) |
| console.log('ERROR during the editedProfileHeaderData returned data', err); | ||
| }); | ||
| // closes the save icon | ||
| $('.edit-save-header').toggle(); |
There was a problem hiding this comment.
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>
.
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.