Merge pull request #66 from jroyal/feature-allow-custom-profile-pic

Feature allow custom profile pic
This commit is contained in:
drzoidberg33 2015-08-15 15:59:02 +02:00
commit 375bd733f1
4 changed files with 51 additions and 5 deletions

View file

@ -37,6 +37,15 @@ DOCUMENTATION :: END
</div>
<p class="help-block">Replace all occurances of the username with this name.</p>
</div>
<div class="form-group">
<label for="profile_url">Profile Picture URL</label>
<div class="row">
<div class="col-xs-6">
<input type="text" class="form-control" id="profile_url" name="profile_url" value="${data['thumb']}">
</div>
</div>
<p class="help-block">Change the users profile picture in plexpy. You should save the URL if you would like to go back as this replaces the existing one.</p>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="do_notify" name="do_notify" value="1" ${data['do_notify']}> Enable notifications
@ -63,6 +72,7 @@ DOCUMENTATION :: END
// Set new friendly name
$("#save_user_name").click(function() {
var friendly_name = $("#friendly_name").val();
var thumb = $("#profile_url").val();
var do_notify = 0;
var keep_history = 0;
if ($("#do_notify").is(":checked")) {
@ -75,7 +85,7 @@ DOCUMENTATION :: END
% if data['user_id']:
$.ajax({
url: 'edit_user',
data: {user_id: '${data['user_id']}', friendly_name: friendly_name, do_notify: do_notify, keep_history: keep_history},
data: {user_id: '${data['user_id']}', friendly_name: friendly_name, do_notify: do_notify, keep_history: keep_history, thumb: thumb},
cache: false,
async: true,
success: function(data) {
@ -83,12 +93,13 @@ DOCUMENTATION :: END
if ($.trim(friendly_name) !== '') {
$(".set-username").html(friendly_name);
}
$("#user-profile-thumb").attr('src', thumb);
}
});
% else:
$.ajax({
url: 'edit_user',
data: {user: '${data['user']}', friendly_name: friendly_name, do_notify: do_notify, keep_history: keep_history},
data: {user: '${data['user']}', friendly_name: friendly_name, do_notify: do_notify, keep_history: keep_history, thumb: thumb},
cache: false,
async: true,
success: function(data) {
@ -96,6 +107,7 @@ DOCUMENTATION :: END
if ($.trim(friendly_name) !== '') {
$(".set-username").html(friendly_name);
}
$("#user-profile-thumb").attr('src', thumb);
}
});
% endif

View file

@ -41,7 +41,7 @@ from plexpy import helpers
<div class="table-card-back">
<div class="user-info-wrapper">
<div class="user-info-poster-face" id="user-gravatar">
<img src="${data['thumb']}" height="80px" width="80px">
<img id="user-profile-thumb" src="${data['thumb']}" height="80px" width="80px">
</div>
<div class="user-info-username">
<span class="set-username">${data['friendly_name']}</span> <span id="edit-user-tooltip" data-target="tooltip" title="Edit user details"><a href="#" data-toggle="modal" data-target="#edit-user-modal" id="toggle-edit-user-modal"><i class="fa fa-pencil"></i></a></span>