From 12a87e65e8f2b491dd56253a0cdf86ebcac41dae Mon Sep 17 00:00:00 2001 From: Duo Tao Date: Wed, 7 Sep 2016 15:06:31 -0500 Subject: [PATCH 01/12] almost there --- app/views/partials/detail.user.listings.pug | 4 +-- app/views/partials/detail.user.pug | 31 ++++++++++----------- public/scripts/main.js | 3 +- public/styles/index.css | 12 ++++---- public/styles/partials/_details.scss | 14 +++++----- 5 files changed, 31 insertions(+), 33 deletions(-) diff --git a/app/views/partials/detail.user.listings.pug b/app/views/partials/detail.user.listings.pug index 7f29d63..1b2499c 100644 --- a/app/views/partials/detail.user.listings.pug +++ b/app/views/partials/detail.user.listings.pug @@ -35,7 +35,7 @@ td.make-an-offer(ng-class="(currentUser && offersDict[listing.listingID]) ? 'com button.edit( type="button", ng-if="listing.userID == currentUser.userID", - ng-click="openListingPane(listing)", + ng-click="openListingPane(listing, index)", ng-hide="removingListingID == listing.listingID") ✎ button.delete( type="button", @@ -47,4 +47,4 @@ td.make-an-offer(ng-class="(currentUser && offersDict[listing.listingID]) ? 'com p Did it sell? button.confirm(type="button", ng-click="removeListing(listing, true)") Yes button.no(type="button", ng-click="removeListing(listing, false)") No - button.cancel(type="button", ng-click="closeRemovingListing()") Cancel \ No newline at end of file + button.cancel(type="button", ng-click="closeRemovingListing()") Cancel diff --git a/app/views/partials/detail.user.pug b/app/views/partials/detail.user.pug index cad22fe..867ded6 100644 --- a/app/views/partials/detail.user.pug +++ b/app/views/partials/detail.user.pug @@ -26,7 +26,7 @@ div.user-about ng-disabled="disabledComponents.newUserInfo", ng-model="newUserInfo.familyName") p.stats - span Class year: + span Class year: select#grad-year( ng-model="newUserInfo.gradYear" ng-options="x for x in gradYears" ) h4 Bio textarea( @@ -123,7 +123,6 @@ div.user-settings(ng-if="user.userID == currentUser.userID && editingUser") p#account-links a.logout(href, ng-click="logout()") Log Out - | a.delete(href, ng-click="deleteAccount()") Delete My Account... div.watchlist-wrapper(ng-if="user.userID == currentUser.userID") @@ -153,7 +152,7 @@ div.watchlist-wrapper(ng-if="user.userID == currentUser.userID") div.listings div.tabs - button(ng-click="whichListings = 'both'", ng-class="{'active': whichListings=='both'}") + button(ng-click="whichListings = 'both'", ng-class="{'active': whichListings=='both'}") | All Listings button(ng-click="whichListings = 'selling'", ng-class="{'active': whichListings=='selling'}") | Selling @@ -168,18 +167,9 @@ div.listings th.price.sortable(ng-click="handleReorder('price')", ng-class="{'active':listingOrder=='price','reversed':reverseSort}") Price th.contact {{ user.userID == currentUser.userID ? 'Edit' : 'Offer'}} tbody(ng-if="whichListings=='both'") - tr(ng-repeat="listing in user.listings | orderBy:listingOrder:reverseSort", + tr(ng-repeat="(index, listing) in user.listings | orderBy:listingOrder:reverseSort", ng-include="'partials/detail.user.listings'") - - tbody(ng-if="whichListings=='selling'") - tr(ng-repeat="listing in user.listings | filter:{sellingPrice:'!!'} | orderBy:listingOrder:reverseSort", - ng-include="'partials/detail.user.listings'") - - tbody(ng-if="whichListings=='renting'") - tr(ng-repeat="listing in user.listings | filter:{rentingPrice:'!!'} | orderBy:listingOrder:reverseSort", - ng-include="'partials/detail.user.listings'") - tfoot(ng-if="user.userID == currentUser.userID") - tr.make-listing(ng-class="{'inactive':!listingPaneOpen}") + tr.make-listing(ng-if="user.userID == currentUser.userID" ng-class="{'inactive':!listingPaneOpen}") td.label(colspan="2") Edit my listing for "{{ newListing.bookName | limitTo: 20 }}{{newListing.bookName.length > 20 ? '…' : ''}}": td.condition select( @@ -195,7 +185,7 @@ div.listings ng-model="newListing.selling", ng-disabled="newListing.selling && !newListing.renting" ) - span.label Sell for + span.label Sell for input#sellingPriceInput.price( type="text", ng-model="newListing.sellingPrice", @@ -210,7 +200,7 @@ div.listings ng-model="newListing.renting", ng-disabled="!newListing.selling && newListing.renting" ) - span.label Rent for + span.label Rent for input#rentingPriceInput.price( type="text", ng-model="newListing.rentingPrice", @@ -222,6 +212,13 @@ div.listings button.confirm(type="submit") span.symbol ✓ | Update! + tbody(ng-if="whichListings=='selling'") + tr(ng-repeat="listing in user.listings | filter:{sellingPrice:'!!'} | orderBy:listingOrder:reverseSort", + ng-include="'partials/detail.user.listings'") + tbody(ng-if="whichListings=='renting'") + tr(ng-repeat="listing in user.listings | filter:{rentingPrice:'!!'} | orderBy:listingOrder:reverseSort", + ng-include="'partials/detail.user.listings'") + tfoot(ng-if="user.userID == currentUser.userID") tr.add-listing: td(colspan="5") div(ng-if="!currentUser") a(href, ng-click="openAccount()") Sign in @@ -277,4 +274,4 @@ div.modal-wrapper( div.progress div(style="width:{{avatar.progress}}%") {{avatar.progress? (avatar.progress < 100 ? avatar.progress + '%' : 'Saving...'): '' }} button.cancel(ng-click="closeAvatarModal()") - span.symbol Cancel \ No newline at end of file + span.symbol Cancel diff --git a/public/scripts/main.js b/public/scripts/main.js index edf0720..987703a 100644 --- a/public/scripts/main.js +++ b/public/scripts/main.js @@ -1276,10 +1276,11 @@ hitsTheBooks.controller('userPageController', function($scope, $state, $timeout, } } - $scope.openListingPane = function(listing) { + $scope.openListingPane = function(listing, index) { // initializes the listing pane with correct settings // cast prices to checkmarks -- should this be done elsewhere? //copy the deets of the user's listing into the panel + console.log(index); $scope.newListing = { bookName : listing.book.name, condition : $scope.conditionOptions[listing.condition], diff --git a/public/styles/index.css b/public/styles/index.css index 1ee0e21..dfc3d7e 100644 --- a/public/styles/index.css +++ b/public/styles/index.css @@ -1044,19 +1044,19 @@ table.listings { border-bottom: none; } table.listings tbody table.price-table tr:first-child { border-bottom: 1px solid #eee; } - table.listings tfoot tr.make-listing { + table.listings tbody tr.make-listing { background-color: #fffcf5; } - table.listings tfoot tr.make-listing p { + table.listings tbody tr.make-listing p { text-align: center; } - table.listings tfoot tr.make-listing span.label { + table.listings tbody tr.make-listing span.label { width: 4.5em; display: inline-block; } - table.listings tfoot tr.make-listing input.price { + table.listings tbody tr.make-listing input.price { width: 2em; } - table.listings tfoot tr.make-listing td.condition a { + table.listings tbody tr.make-listing td.condition a { display: inline-block; margin-top: 15px; } - table.listings tfoot tr.make-listing.inactive { + table.listings tbody tr.make-listing.inactive { display: none; } table.listings tfoot tr.add-listing td { text-align: center; diff --git a/public/styles/partials/_details.scss b/public/styles/partials/_details.scss index 205cc68..4ed654d 100644 --- a/public/styles/partials/_details.scss +++ b/public/styles/partials/_details.scss @@ -266,7 +266,7 @@ table.listings{ font-size: 16px; } } - + td.make-an-offer.complete-wrapper{ background-color: #f7f7f7; @@ -357,6 +357,9 @@ table.listings{ // height: 1.5em; // } } + tr.make-listing.inactive{ + display:none; + } } tfoot{ // background-color: white; @@ -378,9 +381,6 @@ table.listings{ margin-top: 15px; } } - tr.make-listing.inactive{ - display:none; - } tr.add-listing{ td{ text-align: center; @@ -492,7 +492,7 @@ div#user-image{ div.user-about{ h2, h3, h4, .edit-names{ - font-family: 'Droid Sans', serif; + font-family: 'Droid Sans', serif; } h2{ margin-top: 0; @@ -701,11 +701,11 @@ form.about small{ font-size: 10pt; float: left; a.delete{ - color: #b51f1f; + color: #b51f1f; } a.logout{ color: black; margin-right: 2em; } margin-bottom: 0; -} \ No newline at end of file +} From d55e34c52d7845a75a2cbbf6c5b73ed8424fbdca Mon Sep 17 00:00:00 2001 From: Duo Tao Date: Wed, 7 Sep 2016 16:00:47 -0500 Subject: [PATCH 02/12] catch up the scss --- public/styles/index.css | 4 ++-- public/styles/partials/_details.scss | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/public/styles/index.css b/public/styles/index.css index dfc3d7e..3625826 100644 --- a/public/styles/index.css +++ b/public/styles/index.css @@ -1044,6 +1044,8 @@ table.listings { border-bottom: none; } table.listings tbody table.price-table tr:first-child { border-bottom: 1px solid #eee; } + table.listings tbody tr.make-listing.inactive { + display: none; } table.listings tbody tr.make-listing { background-color: #fffcf5; } table.listings tbody tr.make-listing p { @@ -1056,8 +1058,6 @@ table.listings { table.listings tbody tr.make-listing td.condition a { display: inline-block; margin-top: 15px; } - table.listings tbody tr.make-listing.inactive { - display: none; } table.listings tfoot tr.add-listing td { text-align: center; border-bottom: none; diff --git a/public/styles/partials/_details.scss b/public/styles/partials/_details.scss index 4ed654d..49e8ca1 100644 --- a/public/styles/partials/_details.scss +++ b/public/styles/partials/_details.scss @@ -360,9 +360,6 @@ table.listings{ tr.make-listing.inactive{ display:none; } - } - tfoot{ - // background-color: white; tr.make-listing{ background-color: $row-highlight-color; p{ @@ -381,6 +378,8 @@ table.listings{ margin-top: 15px; } } + } + tfoot{ tr.add-listing{ td{ text-align: center; From 15a60c36094ca6301d3cd7b9c678c21753dd6d84 Mon Sep 17 00:00:00 2001 From: Duo Tao Date: Wed, 7 Sep 2016 16:05:09 -0500 Subject: [PATCH 03/12] removed the indices --- app/views/partials/detail.user.listings.pug | 2 +- app/views/partials/detail.user.pug | 2 +- public/scripts/main.js | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/views/partials/detail.user.listings.pug b/app/views/partials/detail.user.listings.pug index 1b2499c..02822d2 100644 --- a/app/views/partials/detail.user.listings.pug +++ b/app/views/partials/detail.user.listings.pug @@ -35,7 +35,7 @@ td.make-an-offer(ng-class="(currentUser && offersDict[listing.listingID]) ? 'com button.edit( type="button", ng-if="listing.userID == currentUser.userID", - ng-click="openListingPane(listing, index)", + ng-click="openListingPane(listing)", ng-hide="removingListingID == listing.listingID") ✎ button.delete( type="button", diff --git a/app/views/partials/detail.user.pug b/app/views/partials/detail.user.pug index 867ded6..40d3883 100644 --- a/app/views/partials/detail.user.pug +++ b/app/views/partials/detail.user.pug @@ -167,7 +167,7 @@ div.listings th.price.sortable(ng-click="handleReorder('price')", ng-class="{'active':listingOrder=='price','reversed':reverseSort}") Price th.contact {{ user.userID == currentUser.userID ? 'Edit' : 'Offer'}} tbody(ng-if="whichListings=='both'") - tr(ng-repeat="(index, listing) in user.listings | orderBy:listingOrder:reverseSort", + tr(ng-repeat="listing in user.listings | orderBy:listingOrder:reverseSort", ng-include="'partials/detail.user.listings'") tr.make-listing(ng-if="user.userID == currentUser.userID" ng-class="{'inactive':!listingPaneOpen}") td.label(colspan="2") Edit my listing for "{{ newListing.bookName | limitTo: 20 }}{{newListing.bookName.length > 20 ? '…' : ''}}": diff --git a/public/scripts/main.js b/public/scripts/main.js index 987703a..edf0720 100644 --- a/public/scripts/main.js +++ b/public/scripts/main.js @@ -1276,11 +1276,10 @@ hitsTheBooks.controller('userPageController', function($scope, $state, $timeout, } } - $scope.openListingPane = function(listing, index) { + $scope.openListingPane = function(listing) { // initializes the listing pane with correct settings // cast prices to checkmarks -- should this be done elsewhere? //copy the deets of the user's listing into the panel - console.log(index); $scope.newListing = { bookName : listing.book.name, condition : $scope.conditionOptions[listing.condition], From 3d75e4a5ba39664c1004501202836581740b6c3f Mon Sep 17 00:00:00 2001 From: Duo Tao Date: Wed, 7 Sep 2016 16:50:07 -0500 Subject: [PATCH 04/12] fixed a marginal bug --- app/views/partials/detail.book.edit.pug | 46 +++++++++++++++++++ app/views/partials/detail.user.pug | 61 +++---------------------- public/scripts/main.js | 4 +- 3 files changed, 54 insertions(+), 57 deletions(-) create mode 100644 app/views/partials/detail.book.edit.pug diff --git a/app/views/partials/detail.book.edit.pug b/app/views/partials/detail.book.edit.pug new file mode 100644 index 0000000..f9c8221 --- /dev/null +++ b/app/views/partials/detail.book.edit.pug @@ -0,0 +1,46 @@ +tr.make-listing(ng-if="user.userID == currentUser.userID" ng-class="{'inactive':!listingPaneOpen}") + td.label(colspan="2") Edit my listing for "{{ newListing.bookName | limitTo: 20 }}{{newListing.bookName.length > 20 ? '…' : ''}}": + td.condition + select( + ng-model="newListing.condition", + ng-options="opt.name for opt in conditionOptions track by opt.code" + ) + a.dashed.tooltip(title="{{conditionDescriptions[newListing.condition.code]}}") Definition + td + p + input( + type="checkbox", + id="sellbox", + ng-model="newListing.selling", + ng-disabled="newListing.selling && !newListing.renting" + ) + span.label Sell for + input#sellingPriceInput.price( + type="text", + ng-model="newListing.sellingPrice", + ng-change="validateSellingPrice()" + placeholder="$12", + ng-disabled="!newListing.selling" + ) + p + input( + type="checkbox", + id="rentbox", + ng-model="newListing.renting", + ng-disabled="!newListing.selling && newListing.renting" + ) + span.label Rent for + input#rentingPriceInput.price( + type="text", + ng-model="newListing.rentingPrice", + ng-change="validateRentingPrice()", + placeholder="$12", + ng-disabled="!newListing.renting" + ) + td.confirm + button.confirm(type="submit") + span.symbol ✓ + | Update! + button.cancel(type="button", ng-if="listingPaneOpen && currentUser", ng-click="closeListingPane()") + span.symbol × + | Cancel diff --git a/app/views/partials/detail.user.pug b/app/views/partials/detail.user.pug index 40d3883..8bd9abe 100644 --- a/app/views/partials/detail.user.pug +++ b/app/views/partials/detail.user.pug @@ -167,71 +167,22 @@ div.listings th.price.sortable(ng-click="handleReorder('price')", ng-class="{'active':listingOrder=='price','reversed':reverseSort}") Price th.contact {{ user.userID == currentUser.userID ? 'Edit' : 'Offer'}} tbody(ng-if="whichListings=='both'") - tr(ng-repeat="listing in user.listings | orderBy:listingOrder:reverseSort", - ng-include="'partials/detail.user.listings'") - tr.make-listing(ng-if="user.userID == currentUser.userID" ng-class="{'inactive':!listingPaneOpen}") - td.label(colspan="2") Edit my listing for "{{ newListing.bookName | limitTo: 20 }}{{newListing.bookName.length > 20 ? '…' : ''}}": - td.condition - select( - ng-model="newListing.condition", - ng-options="opt.name for opt in conditionOptions track by opt.code" - ) - a.dashed.tooltip(title="{{conditionDescriptions[newListing.condition.code]}}") Definition - td - p - input( - type="checkbox", - id="sellbox", - ng-model="newListing.selling", - ng-disabled="newListing.selling && !newListing.renting" - ) - span.label Sell for - input#sellingPriceInput.price( - type="text", - ng-model="newListing.sellingPrice", - ng-change="validateSellingPrice()" - placeholder="$12", - ng-disabled="!newListing.selling" - ) - p - input( - type="checkbox", - id="rentbox", - ng-model="newListing.renting", - ng-disabled="!newListing.selling && newListing.renting" - ) - span.label Rent for - input#rentingPriceInput.price( - type="text", - ng-model="newListing.rentingPrice", - ng-change="validateRentingPrice()", - placeholder="$12", - ng-disabled="!newListing.renting" - ) - td.confirm - button.confirm(type="submit") - span.symbol ✓ - | Update! + tr(ng-include="'partials/detail.user.listings'" ng-repeat-start="listing in user.listings | orderBy:listingOrder:reverseSort") + tr(ng-if='newListing.listingID == listing.listingID' ng-include='partials/detail.book.edit' ng-repeat-end) tbody(ng-if="whichListings=='selling'") tr(ng-repeat="listing in user.listings | filter:{sellingPrice:'!!'} | orderBy:listingOrder:reverseSort", ng-include="'partials/detail.user.listings'") tbody(ng-if="whichListings=='renting'") tr(ng-repeat="listing in user.listings | filter:{rentingPrice:'!!'} | orderBy:listingOrder:reverseSort", ng-include="'partials/detail.user.listings'") - tfoot(ng-if="user.userID == currentUser.userID") + tfoot tr.add-listing: td(colspan="5") - div(ng-if="!currentUser") - a(href, ng-click="openAccount()") Sign in + div(ng-if="currentUser==null") + a(href='#', ng-click="openAccount()") Sign in | to add a listing - button.cancel(type="button", ng-if="listingPaneOpen && currentUser", ng-click="closeListingPane()") - span.symbol × - | Cancel - div(ng-if="!listingPaneOpen && currentUser") + div(ng-if="currentUser!=null") a(ui-sref="main") Search for a book | to add a listing - button.edit(type="button", ng-if="!listingPaneOpen && currentUser && currUserListing", ng-click="openListingPane()") - span.symbol ✎ - | Edit Listing div.modal-wrapper( ng-class="{'visible':offer.active}", diff --git a/public/scripts/main.js b/public/scripts/main.js index edf0720..1a77765 100644 --- a/public/scripts/main.js +++ b/public/scripts/main.js @@ -1290,6 +1290,7 @@ hitsTheBooks.controller('userPageController', function($scope, $state, $timeout, renting : (listing.rentingPrice != null), listingID : listing.listingID }; + console.log($scope.newListing.listingID); $scope.listingPaneOpen = true; } @@ -1338,8 +1339,7 @@ hitsTheBooks.controller('userPageController', function($scope, $state, $timeout, }, function (err) { console.log(err); }); -} - + } }); // Top-level shit From 72f66651c65f2c5c839e20c3606d65909396d68d Mon Sep 17 00:00:00 2001 From: Duo Tao Date: Wed, 7 Sep 2016 20:40:07 -0500 Subject: [PATCH 05/12] fixed this one but make another bug --- app/views/partials/detail.book.edit.pug | 46 ------------------- .../partials/detail.user.listings.edit.pug | 45 ++++++++++++++++++ app/views/partials/detail.user.pug | 6 ++- 3 files changed, 49 insertions(+), 48 deletions(-) delete mode 100644 app/views/partials/detail.book.edit.pug create mode 100644 app/views/partials/detail.user.listings.edit.pug diff --git a/app/views/partials/detail.book.edit.pug b/app/views/partials/detail.book.edit.pug deleted file mode 100644 index f9c8221..0000000 --- a/app/views/partials/detail.book.edit.pug +++ /dev/null @@ -1,46 +0,0 @@ -tr.make-listing(ng-if="user.userID == currentUser.userID" ng-class="{'inactive':!listingPaneOpen}") - td.label(colspan="2") Edit my listing for "{{ newListing.bookName | limitTo: 20 }}{{newListing.bookName.length > 20 ? '…' : ''}}": - td.condition - select( - ng-model="newListing.condition", - ng-options="opt.name for opt in conditionOptions track by opt.code" - ) - a.dashed.tooltip(title="{{conditionDescriptions[newListing.condition.code]}}") Definition - td - p - input( - type="checkbox", - id="sellbox", - ng-model="newListing.selling", - ng-disabled="newListing.selling && !newListing.renting" - ) - span.label Sell for - input#sellingPriceInput.price( - type="text", - ng-model="newListing.sellingPrice", - ng-change="validateSellingPrice()" - placeholder="$12", - ng-disabled="!newListing.selling" - ) - p - input( - type="checkbox", - id="rentbox", - ng-model="newListing.renting", - ng-disabled="!newListing.selling && newListing.renting" - ) - span.label Rent for - input#rentingPriceInput.price( - type="text", - ng-model="newListing.rentingPrice", - ng-change="validateRentingPrice()", - placeholder="$12", - ng-disabled="!newListing.renting" - ) - td.confirm - button.confirm(type="submit") - span.symbol ✓ - | Update! - button.cancel(type="button", ng-if="listingPaneOpen && currentUser", ng-click="closeListingPane()") - span.symbol × - | Cancel diff --git a/app/views/partials/detail.user.listings.edit.pug b/app/views/partials/detail.user.listings.edit.pug new file mode 100644 index 0000000..1c4edef --- /dev/null +++ b/app/views/partials/detail.user.listings.edit.pug @@ -0,0 +1,45 @@ +td.label(colspan="2") Edit my listing for "{{ newListing.bookName | limitTo: 20 }}{{newListing.bookName.length > 20 ? '…' : ''}}": +td.condition + select( + ng-model="newListing.condition", + ng-options="opt.name for opt in conditionOptions track by opt.code" + ) + a.dashed.tooltip(title="{{conditionDescriptions[newListing.condition.code]}}") Definition +td + p + input( + type="checkbox", + id="sellbox", + ng-model="newListing.selling", + ng-disabled="newListing.selling && !newListing.renting" + ) + span.label Sell for + input#sellingPriceInput.price( + type="text", + ng-model="newListing.sellingPrice", + ng-change="validateSellingPrice()" + placeholder="$12", + ng-disabled="!newListing.selling" + ) + p + input( + type="checkbox", + id="rentbox", + ng-model="newListing.renting", + ng-disabled="!newListing.selling && newListing.renting" + ) + span.label Rent for + input#rentingPriceInput.price( + type="text", + ng-model="newListing.rentingPrice", + ng-change="validateRentingPrice()", + placeholder="$12", + ng-disabled="!newListing.renting" + ) +td.confirm + button.confirm(type="submit") + span.symbol ✓ + | Update! +button.cancel(type="button", ng-if="listingPaneOpen && currentUser", ng-click="closeListingPane()") + span.symbol × + | Cancel diff --git a/app/views/partials/detail.user.pug b/app/views/partials/detail.user.pug index 8bd9abe..2d4e727 100644 --- a/app/views/partials/detail.user.pug +++ b/app/views/partials/detail.user.pug @@ -168,13 +168,15 @@ div.listings th.contact {{ user.userID == currentUser.userID ? 'Edit' : 'Offer'}} tbody(ng-if="whichListings=='both'") tr(ng-include="'partials/detail.user.listings'" ng-repeat-start="listing in user.listings | orderBy:listingOrder:reverseSort") - tr(ng-if='newListing.listingID == listing.listingID' ng-include='partials/detail.book.edit' ng-repeat-end) + tr.make-listing(ng-if='newListing.listingID == listing.listingID' ng-include="'partials/detail.user.listings.edit'" ng-repeat-end) tbody(ng-if="whichListings=='selling'") - tr(ng-repeat="listing in user.listings | filter:{sellingPrice:'!!'} | orderBy:listingOrder:reverseSort", + tr(ng-repeat-start="listing in user.listings | filter:{sellingPrice:'!!'} | orderBy:listingOrder:reverseSort", ng-include="'partials/detail.user.listings'") + tr.make-listing(ng-if='newListing.listingID == listing.listingID' ng-include="'partials/detail.user.listings.edit'" ng-repeat-end) tbody(ng-if="whichListings=='renting'") tr(ng-repeat="listing in user.listings | filter:{rentingPrice:'!!'} | orderBy:listingOrder:reverseSort", ng-include="'partials/detail.user.listings'") + tr.make-listing(ng-if='newListing.listingID == listing.listingID' ng-include="'partials/detail.user.listings.edit'" ng-repeat-end) tfoot tr.add-listing: td(colspan="5") div(ng-if="currentUser==null") From 359bef127aedfada8f890e9b47846630e51663a9 Mon Sep 17 00:00:00 2001 From: Duo Tao Date: Thu, 8 Sep 2016 09:07:29 -0500 Subject: [PATCH 06/12] up to here everything is right --- app/views/partials/detail.user.listings.edit.pug | 3 --- app/views/partials/detail.user.pug | 6 +++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/views/partials/detail.user.listings.edit.pug b/app/views/partials/detail.user.listings.edit.pug index 1c4edef..2695699 100644 --- a/app/views/partials/detail.user.listings.edit.pug +++ b/app/views/partials/detail.user.listings.edit.pug @@ -40,6 +40,3 @@ td.confirm button.confirm(type="submit") span.symbol ✓ | Update! -button.cancel(type="button", ng-if="listingPaneOpen && currentUser", ng-click="closeListingPane()") - span.symbol × - | Cancel diff --git a/app/views/partials/detail.user.pug b/app/views/partials/detail.user.pug index 2d4e727..0a85bd3 100644 --- a/app/views/partials/detail.user.pug +++ b/app/views/partials/detail.user.pug @@ -168,7 +168,11 @@ div.listings th.contact {{ user.userID == currentUser.userID ? 'Edit' : 'Offer'}} tbody(ng-if="whichListings=='both'") tr(ng-include="'partials/detail.user.listings'" ng-repeat-start="listing in user.listings | orderBy:listingOrder:reverseSort") - tr.make-listing(ng-if='newListing.listingID == listing.listingID' ng-include="'partials/detail.user.listings.edit'" ng-repeat-end) + tr.make-listing(ng-if='newListing.listingID == listing.listingID && listingPaneOpen && currentUser' ng-include="'partials/detail.user.listings.edit'") + tr.add-listing(ng-if="newListing.listingID == listing.listingID && listingPaneOpen && currentUser", ng-repeat-end): td(colspan="5") + button.cancel(type="button", ng-click="closeListingPane()") + span.symbol × + | Cancel tbody(ng-if="whichListings=='selling'") tr(ng-repeat-start="listing in user.listings | filter:{sellingPrice:'!!'} | orderBy:listingOrder:reverseSort", ng-include="'partials/detail.user.listings'") From 9d1530a3409160933f1badc0875db9299e9e0ca3 Mon Sep 17 00:00:00 2001 From: Duo Tao Date: Thu, 8 Sep 2016 10:54:35 -0500 Subject: [PATCH 07/12] everything is right up to now --- public/styles/index.css | 13 +++++++++++++ public/styles/partials/_details.scss | 20 ++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/public/styles/index.css b/public/styles/index.css index 3625826..ce4271d 100644 --- a/public/styles/index.css +++ b/public/styles/index.css @@ -1031,6 +1031,19 @@ table.listings { table.listings tbody td { height: 80px; padding: 0; } + table.listings tbody tr.add-listing td { + text-align: center; + border-bottom: none; + padding: 0; } + table.listings tbody tr.add-listing td button { + font-style: italic; + font-family: 'Droid Serif', Serif; + width: 100%; + height: 2.5em; } + table.listings tbody tr.add-listing td button span.symbol { + font-size: 16px; + display: inline-block; + vertical-align: middle; } table.listings tbody table.price-table { width: 100%; height: 79px; diff --git a/public/styles/partials/_details.scss b/public/styles/partials/_details.scss index 49e8ca1..7c7253e 100644 --- a/public/styles/partials/_details.scss +++ b/public/styles/partials/_details.scss @@ -324,6 +324,26 @@ table.listings{ height: $listing-row-height; padding:0; } + tr.add-listing{ + td{ + text-align: center; + border-bottom: none; + padding: 0; + + $footer-el-height: 2.5em; + button { + font-style: italic; + font-family: 'Droid Serif', Serif; + width: 100%; + height: $footer-el-height; + span.symbol{ + font-size: 16px; + display: inline-block; + vertical-align: middle; + } + } + } + } table.price-table{ width: 100%; height:79px; From 20d09a1694720a057aea29738196285261d09af9 Mon Sep 17 00:00:00 2001 From: Duo Tao Date: Thu, 8 Sep 2016 11:05:19 -0500 Subject: [PATCH 08/12] get the cancel button style --- public/styles/index.css | 2 -- public/styles/partials/_details.scss | 3 --- 2 files changed, 5 deletions(-) diff --git a/public/styles/index.css b/public/styles/index.css index ce4271d..980c2d7 100644 --- a/public/styles/index.css +++ b/public/styles/index.css @@ -1029,11 +1029,9 @@ table.listings { width: 50%; display: inline-block; } table.listings tbody td { - height: 80px; padding: 0; } table.listings tbody tr.add-listing td { text-align: center; - border-bottom: none; padding: 0; } table.listings tbody tr.add-listing td button { font-style: italic; diff --git a/public/styles/partials/_details.scss b/public/styles/partials/_details.scss index 7c7253e..40b1876 100644 --- a/public/styles/partials/_details.scss +++ b/public/styles/partials/_details.scss @@ -321,15 +321,12 @@ table.listings{ } tbody{ td{ - height: $listing-row-height; padding:0; } tr.add-listing{ td{ text-align: center; - border-bottom: none; padding: 0; - $footer-el-height: 2.5em; button { font-style: italic; From cf65d62ec7f8af1bbba3f60311d02c1828e5e34e Mon Sep 17 00:00:00 2001 From: Duo Tao Date: Thu, 8 Sep 2016 11:08:28 -0500 Subject: [PATCH 09/12] removed the log --- public/scripts/main.js | 1 - 1 file changed, 1 deletion(-) diff --git a/public/scripts/main.js b/public/scripts/main.js index 1a77765..1b03d15 100644 --- a/public/scripts/main.js +++ b/public/scripts/main.js @@ -1290,7 +1290,6 @@ hitsTheBooks.controller('userPageController', function($scope, $state, $timeout, renting : (listing.rentingPrice != null), listingID : listing.listingID }; - console.log($scope.newListing.listingID); $scope.listingPaneOpen = true; } From cdbe860e38bb353a64c53e63e4d4449f1254f7aa Mon Sep 17 00:00:00 2001 From: Duo Tao Date: Thu, 8 Sep 2016 11:27:37 -0500 Subject: [PATCH 10/12] think i fixed it --- public/styles/index.css | 14 ++++++++++++++ public/styles/partials/_details.scss | 21 +++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/public/styles/index.css b/public/styles/index.css index 980c2d7..03ced3b 100644 --- a/public/styles/index.css +++ b/public/styles/index.css @@ -1069,6 +1069,20 @@ table.listings { table.listings tbody tr.make-listing td.condition a { display: inline-block; margin-top: 15px; } + table.listings tfoot tr.make-listing.inactive { + display: none; } + table.listings tfoot tr.make-listing { + background-color: #fffcf5; } + table.listings tfoot tr.make-listing p { + text-align: center; } + table.listings tfoot tr.make-listing span.label { + width: 4.5em; + display: inline-block; } + table.listings tfoot tr.make-listing input.price { + width: 2em; } + table.listings tfoot tr.make-listing td.condition a { + display: inline-block; + margin-top: 15px; } table.listings tfoot tr.add-listing td { text-align: center; border-bottom: none; diff --git a/public/styles/partials/_details.scss b/public/styles/partials/_details.scss index 40b1876..fc72e02 100644 --- a/public/styles/partials/_details.scss +++ b/public/styles/partials/_details.scss @@ -397,6 +397,27 @@ table.listings{ } } tfoot{ + tr.make-listing.inactive{ + display:none; + } + tr.make-listing{ + background-color: $row-highlight-color; + p{ + text-align: center; + } + span.label{ + width: 4.5em; + display: inline-block; + } + input.price{ + width:2em; + } + + td.condition a { + display: inline-block; + margin-top: 15px; + } + } tr.add-listing{ td{ text-align: center; From f5c8d99c30042415294ec02d905ac44cf5663bcb Mon Sep 17 00:00:00 2001 From: Duo Tao Date: Thu, 8 Sep 2016 11:41:41 -0500 Subject: [PATCH 11/12] user detail listings: renting and selling listings --- app/views/partials/detail.user.pug | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/app/views/partials/detail.user.pug b/app/views/partials/detail.user.pug index 0a85bd3..e045499 100644 --- a/app/views/partials/detail.user.pug +++ b/app/views/partials/detail.user.pug @@ -176,11 +176,19 @@ div.listings tbody(ng-if="whichListings=='selling'") tr(ng-repeat-start="listing in user.listings | filter:{sellingPrice:'!!'} | orderBy:listingOrder:reverseSort", ng-include="'partials/detail.user.listings'") - tr.make-listing(ng-if='newListing.listingID == listing.listingID' ng-include="'partials/detail.user.listings.edit'" ng-repeat-end) + tr.make-listing(ng-if='newListing.listingID == listing.listingID && listingPaneOpen && currentUser' ng-include="'partials/detail.user.listings.edit'") + tr.add-listing(ng-if="newListing.listingID == listing.listingID && listingPaneOpen && currentUser", ng-repeat-end): td(colspan="5") + button.cancel(type="button", ng-click="closeListingPane()") + span.symbol × + | Cancel tbody(ng-if="whichListings=='renting'") - tr(ng-repeat="listing in user.listings | filter:{rentingPrice:'!!'} | orderBy:listingOrder:reverseSort", + tr(ng-repeat-start="listing in user.listings | filter:{rentingPrice:'!!'} | orderBy:listingOrder:reverseSort", ng-include="'partials/detail.user.listings'") - tr.make-listing(ng-if='newListing.listingID == listing.listingID' ng-include="'partials/detail.user.listings.edit'" ng-repeat-end) + tr.make-listing(ng-if='newListing.listingID == listing.listingID && listingPaneOpen && currentUser' ng-include="'partials/detail.user.listings.edit'") + tr.add-listing(ng-if="newListing.listingID == listing.listingID && listingPaneOpen && currentUser", ng-repeat-end): td(colspan="5") + button.cancel(type="button", ng-click="closeListingPane()") + span.symbol × + | Cancel tfoot tr.add-listing: td(colspan="5") div(ng-if="currentUser==null") From 2d27c1838b436b6a9272eef1e642af8e81dc7da2 Mon Sep 17 00:00:00 2001 From: Duo Tao Date: Thu, 8 Sep 2016 12:35:19 -0500 Subject: [PATCH 12/12] removed unnecessary changes --- app/views/partials/detail.user.pug | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/partials/detail.user.pug b/app/views/partials/detail.user.pug index e045499..1e69375 100644 --- a/app/views/partials/detail.user.pug +++ b/app/views/partials/detail.user.pug @@ -191,10 +191,10 @@ div.listings | Cancel tfoot tr.add-listing: td(colspan="5") - div(ng-if="currentUser==null") - a(href='#', ng-click="openAccount()") Sign in + div(ng-if="!currentUser") + a(href, ng-click="openAccount()") Sign in | to add a listing - div(ng-if="currentUser!=null") + div(ng-if="currentUser") a(ui-sref="main") Search for a book | to add a listing