Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PersonView, FamilyView ui changes #1863 #2026

Merged
merged 5 commits into from
Mar 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions src/FamilyView.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,14 @@
<div class="box box-primary">
<div class="box-body">
<div class="image-container">
<img data-src="<?= SystemURLs::getRootPath() ?>/api/families/<?= $family->getId() ?>/thumbnail"
data-name="<?= $family->getName()?>" alt="" class="initials-image img-circle img-responsive profile-user-img"/>
<img data-src="<?= SystemURLs::getRootPath() ?>/api/families/<?= $family->getId() ?>/photo"
data-name="<?= $family->getName()?>" alt="" class="initials-image img-rounded img-responsive profile-user-img profile-family-img"/>
<?php if ($bOkToEdit): ?>
<div class="after">
<div class="buttons">
<a class="hide" id="view-larger-image-btn" href="#" title="<?= gettext("View Photo") ?>">
<i class="fa fa-search-plus"></i>
</a>&nbsp;
<a href="#" data-toggle="modal" data-target="#upload-image" title="<?= gettext("Upload Photo") ?>">
<i class="fa fa-camera"></i>
</a>&nbsp;
Expand Down Expand Up @@ -909,6 +912,7 @@ class="fa fa-cart-plus"></i> <?= gettext("Add All Family Members to Cart") ?></a

<!-- Modal -->
<div id="photoUploader"></div>

<div class="modal fade" id="confirm-delete-image" tabindex="-1" role="dialog" aria-labelledby="delete-Image-label"
aria-hidden="true">
<div class="modal-dialog">
Expand Down Expand Up @@ -998,7 +1002,8 @@ class="btn btn-success"><i class="fa fa-check"></i> <?= gettext("Verified In Per
} ?>
<script src="<?= SystemURLs::getRootPath() ?>/skin/jquery-photo-uploader/PhotoUploader.js" type="text/javascript"></script>
<link href="<?= SystemURLs::getRootPath() ?>/skin/jquery-photo-uploader/PhotoUploader.css" rel="stylesheet">
<script src="<?= SystemURLs::getRootPath() ?>/skin/js/FamilyView.js"></script>
<script src="<?= SystemURLs::getRootPath() ?>/skin/js/FamilyView.js" type="text/javascript"></script>
<script src="<?= SystemURLs::getRootPath() ?>/skin/js/MemberView.js" type="text/javascript"></script>
<script>
window.CRM.currentFamily = <?= $iFamilyID ?>;
window.CRM.currentActive = <?= (empty($fam_DateDeactivated) ? 'true' : 'false') ?>;
Expand Down Expand Up @@ -1050,14 +1055,29 @@ class="btn btn-success"><i class="fa fa-check"></i> <?= gettext("Verified In Per
});

window.CRM.photoUploader = $("#photoUploader").PhotoUploader({
url: window.CRM.root + "/api/families/<?= $iFamilyID ?>/photo",
url: window.CRM.root + "/api/families/" + familyId + "/photo",
maxPhotoSize: window.CRM.maxUploadSize,
photoHeight: 400,
photoWidth: 400,
done: function(e) {
location.reload();
}
});


contentExists(window.CRM.root + "/api/families/" + familyId + "/photo", function(success) {
if (success) {
$("#view-larger-image-btn").removeClass('hide');

$("#view-larger-image-btn").click(function() {
bootbox.alert({
title: "<?= gettext('Family Photo') ?>",
message: '<img class="img-rounded img-responsive center-block" src="<?= SystemURLs::getRootPath() ?>/api/families/' + familyId + '/photo" />',
backdrop: true
});
});
}
});

});
</script>
Expand Down
26 changes: 25 additions & 1 deletion src/PersonView.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,14 @@
<div class="box box-primary">
<div class="box-body box-profile">
<div class="image-container">
<img data-name="<?= $person->getFullName()?>" data-src = "<?= SystemURLs::getRootPath().'/api/persons/'.$person->getId().'/thumbnail' ?>" class="initials-image profile-user-img img-responsive img-circle">
<img data-name="<?= $person->getFullName()?>" data-src ="<?= SystemURLs::getRootPath().'/api/persons/'.$person->getId().'/photo' ?>"
class="initials-image profile-user-img img-responsive img-rounded profile-user-img-md">
<?php if ($bOkToEdit): ?>
<div class="after">
<div class="buttons">
<a id="view-larger-image-btn" class="hide" href="#" title="<?= gettext("View Photo") ?>">
<i class="fa fa-search-plus"></i>
</a>&nbsp;
<a href="#" class="" data-toggle="modal" data-target="#upload-image" title="<?= gettext("Upload Photo") ?>">
<i class="fa fa-camera"></i>
</a>&nbsp;
Expand Down Expand Up @@ -928,6 +932,7 @@ class="form-control select2" style="width:100%" data-placeholder="Select ...">
</div>
<script src="<?= SystemURLs::getRootPath() ?>/skin/jquery-photo-uploader/PhotoUploader.js" type="text/javascript"></script>
<link href="<?= SystemURLs::getRootPath() ?>/skin/jquery-photo-uploader/PhotoUploader.css" rel="stylesheet">
<script src="<?= SystemURLs::getRootPath() ?>/skin/js/MemberView.js" type="text/javascript"></script>
<script>
var person_ID = <?= $iPersonID ?>;
function GroupRemove(Group, Person) {
Expand Down Expand Up @@ -993,6 +998,25 @@ function GroupAdd() {
};
$("#assigned-volunteer-opps-table").DataTable(options);
$("#assigned-properties-table").DataTable(options);


contentExists(window.CRM.root + "/api/persons/" + person_ID + "/photo", function(success) {
if (success) {
$("#view-larger-image-btn").removeClass('hide');

$("#view-larger-image-btn").click(function() {
bootbox.alert({
title: "<?= gettext('Photo') ?>",
message: '<img class="img-rounded img-responsive center-block" src="<?= SystemURLs::getRootPath() ?>/api/persons/' + person_ID + '/photo" />',
backdrop: true
});
});
}
});




});


Expand Down
14 changes: 14 additions & 0 deletions src/skin/js/MemberView.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
function contentExists(contentUrl, callback) {
$.ajax({
method :"HEAD",
url: contentUrl,
processData: false,
global:false,
success: function(data, textStatus, jqXHR){
callback(true, data, textStatus, jqXHR);
},
error: function(jqXHR, textStatus, errorThrown) {
callback(false, jqXHR, textStatus, errorThrown);
}
});
}
22 changes: 12 additions & 10 deletions src/skin/scss/_imageOverlay.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,27 @@
}
.image-container .after {
position: absolute;
top: 0;
left: 0;
bottom: 0;
left: 1px;
width: 100%;
height: 100%;
display: none;
height: 44px;
display: block;
color: #FFF;
}
.image-container:hover .after {
.image-container:hover .after .buttons {
display: block;
background: rgba(0, 0, 0, .6);
}
.image-container .after .buttons {
font-size: 1.7em;
position: absolute;
top: 40%;
height: 40px;
width: 100%;
width: 80%;
max-width: 180px;
text-align:center;
background: rgba(0, 0, 0, .2);
margin-left:auto;
margin-right:auto;
display:block;
}
.image-container .after .buttons a {
color: #EEE;
}
}
10 changes: 8 additions & 2 deletions src/skin/scss/_profileImage.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
.profile-user-img{
.profile-user-img {
height:100px;
}

.profile-family-img, .profile-user-img-md {
height:160px;
width:200px;
border:0;
}

.user-image{
height:auto;
max-width:100%;
border-radius:50%;
}
}