Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Commit 274716e

Browse files
committed
Makes Addresses in Settings Ordered by Dragging
- Closes #348
1 parent 95f0863 commit 274716e

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

css/obBase.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4818,6 +4818,16 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
48184818
position: relative;
48194819
}
48204820

4821+
.addressBoxDragging .addressBox{
4822+
border-width: 2px;
4823+
border-style: solid;
4824+
}
4825+
4826+
.addressBoxGhost .addressBox{
4827+
border-width: 2px;
4828+
border-style: dashed;
4829+
}
4830+
48214831
.buyAddressWrapper {
48224832
padding: 15px;
48234833
overflow: hidden;

js/templates/settings.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -833,11 +833,10 @@ <h3 class="padding15 margin0 fontWeight500"><%= polyglot.t('Content') %></h3>
833833
<div class="flexRow">
834834
<h3 class="padding15 margin0 fontWeight500"><%= polyglot.t('CurrentAddress') %></h3>
835835
</div>
836-
<div class="flexRow pad5 rowTop15">
836+
<div class="flexRow pad5 rowTop15 js-sortableAddresses">
837837
<% _.each(ob.user.shipping_addresses, function(address, i){ %>
838-
<% console.log(address) %>
839838
<div class="flexCol-4 pad10 row15">
840-
<div class="addressBox custCol-secondary js-address">
839+
<div class="addressBox custCol-secondary custCol-border-background js-address">
841840
<div class="textOpacity1 row40">
842841
<div><%= address.name %></div>
843842
<div><%= address.street %></div>

js/views/settingsVw.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ var __ = require('underscore'),
2020
SMTPConnection = require('smtp-connection'),
2121
MediumEditor = require('medium-editor'),
2222
validateMediumEditor = require('../utils/validateMediumEditor'),
23-
getBTPrice = require('../utils/getBitcoinPrice');
23+
getBTPrice = require('../utils/getBitcoinPrice'),
24+
Sortable = require('sortablejs');
2425

2526
module.exports = pageVw.extend({
2627

@@ -233,6 +234,7 @@ module.exports = pageVw.extend({
233234
placeholder_text_single: window.polyglot.t('chosenJS.placeHolderTextSingle'),
234235
placeholder_text_multiple: window.polyglot.t('chosenJS.placeHolderTextMultiple')
235236
});
237+
236238
$('#settings-image-cropper').cropit({
237239
$preview: self.$('.js-settingsAvatarPreview'),
238240
$fileInput: self.$('#settingsAvatarInput'),
@@ -255,6 +257,7 @@ module.exports = pageVw.extend({
255257
console.log(errorMessage);
256258
}
257259
});
260+
258261
//cache elements used more than once
259262
self.$moderatorFeeInput = self.$('#moderatorFeeInput');
260263
self.$moderatorFeeHolder = self.$('.js-settingsModeratorFee');
@@ -286,6 +289,7 @@ module.exports = pageVw.extend({
286289
console.log(errorMessage);
287290
}
288291
});
292+
289293
if (self.model.get('page').profile.header_hash){
290294
$('#settings-image-cropperBanner').cropit('imageSrc', self.serverUrl +'get_image?hash='+self.model.get('page').profile.header_hash);
291295
self.newBanner = false;
@@ -304,6 +308,12 @@ module.exports = pageVw.extend({
304308
}
305309
});
306310
editor.subscribe('blur', self.validateDescription);
311+
312+
self.sortableAddresses && self.sortableAddresses.destroy();
313+
self.sortableAddresses = Sortable.create(self.$('.js-sortableAddresses')[0], {
314+
chosenClass: "addressBoxDragging",
315+
ghostClass: "addressBoxGhost"
316+
});
307317
});
308318
return this;
309319
},

0 commit comments

Comments
 (0)