Skip to content

Commit

Permalink
Moving "set profile photo" to photo detail page. Closes photo#1539
Browse files Browse the repository at this point in the history
  • Loading branch information
jmathai committed Aug 26, 2014
1 parent 3acbd26 commit b763fc5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
},
events : {
'click .permission.edit': 'permission',
'click .profile': 'profile',
'click .rotate': 'rotate',
'click .share': 'share'
},
Expand All @@ -116,6 +117,18 @@
model.set('permission', model.get('permission') == 0 ? 1 : 0, {silent:false});
model.save();
},
profile: function(ev) {
ev.preventDefault();
var el = $(ev.currentTarget), id = el.attr('data-id'),
ownerModel = op.data.store.Profiles.get(TBX.profiles.getOwner()),
viewerModel = op.data.store.Profiles.get(TBX.profiles.getViewer());
ownerModel.set('photoId', id, {silent:true});
ownerModel.save(null, {error: TBX.notification.display.generic.error, success: function(){ TBX.notification.show('Your profile photo was successfully updated.', 'flash', 'confirm'); }});
if(TBX.profiles.getOwner() !== TBX.profiles.getViewer()) {
viewerModel.set('photoId', id, {silent:true});
viewerModel.save();
}
},
rotate: function(ev) {
ev.preventDefault();
var $el = $(ev.currentTarget), model = this.model, id = model.get('id'), size = '870x870', value='90';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
'click .album.edit': 'album',
'click .delete.edit': 'delete_',
'click .permission.edit': 'permission',
'click .profile.edit': 'profile',
'click .pin.edit': 'pin',
'click .share': 'share'
},
Expand All @@ -73,18 +72,6 @@
count = batch.length();
TBX.notification.show(TBX.format.sprintf(TBX.strings.batchConfirm, count, count > 1 ? 's' : ''), 'flash', 'confirm');
},
profile: function(ev) {
ev.preventDefault();
var el = $(ev.currentTarget), id = el.attr('data-id'),
ownerModel = op.data.store.Profiles.get(TBX.profiles.getOwner()),
viewerModel = op.data.store.Profiles.get(TBX.profiles.getViewer());
ownerModel.set('photoId', id, {silent:true});
ownerModel.save(null, {error: TBX.notification.display.generic.error, success: function(){ TBX.notification.show('Your profile photo was successfully updated.', 'flash', 'confirm'); }});
if(TBX.profiles.getOwner() !== TBX.profiles.getViewer()) {
viewerModel.set('photoId', id, {silent:true});
viewerModel.save();
}
},
share: function(ev) {
ev.preventDefault();
var $el = $(ev.currentTarget), id = $el.attr('data-id');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,15 +288,18 @@

<script type="tmpl/underscore" id="photo-detail-meta-tmpl">
<ul>
<li><a class="permission<?php if($isAdmin) { ?> edit<?php } ?>" href="#"><i class="icon-<%= permission == 0 ? 'lock' : 'unlock' %>"></i> <%= permission == 0 ? 'Private' : 'Public' %></i></a></li>
<?php if($isAdmin) { ?>
<li><a href="#" class="share trigger" data-id="<%= id %>"><i class="icon-share-alt"></i> Share</i></a></li>
<?php } ?>
<li><a class="permission<?php if($isAdmin) { ?> edit<?php } ?>" href="#"><i class="icon-<%= permission == 0 ? 'lock' : 'unlock' %>"></i> <%= permission == 0 ? 'Private' : 'Public' %></i></a></li>
<?php if($isAdmin) { ?>
<li><a class="rotate" href="#"><i class="icon-rotate-right"></i> Rotate</a></li>
<?php } ?>
<?php if($isAdmin || $this->config->site->allowOriginalDownload == 1) { ?>
<li><a href="<%= pathDownload %>" class="download trigger"><i class="icon-download"></i> Download</i></a></li>
<?php } ?>
<?php if($isAdmin) { ?>
<li><a class="rotate" href="#"><i class="icon-rotate-right"></i> Rotate</a></li>
<li><a class="profile" href="#" data-id="<%= id %>"><i class="icon-user profile"></i> Profile Photo</a></li>
<?php } ?>
</ul>
</script>
Expand Down

0 comments on commit b763fc5

Please sign in to comment.