Skip to content

Commit

Permalink
Merge pull request #85 from ezraroi/84-in-profile-page-compare-all-us…
Browse files Browse the repository at this point in the history
…ers-you-follow

added
  • Loading branch information
ezraroi authored Jul 13, 2024
2 parents 2108eb2 + c94affc commit 013be89
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 4 deletions.
20 changes: 20 additions & 0 deletions Mundialito/Client/lib/html2canvas.min.js

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions Mundialito/Client/src/Users/UserProfile.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@ <h4><i class="fa fa-user"></i> {{profileUser.Name}} Profile</h4>
</div>
</div>
</div>
<div class="row" data-access-level="Admin">
<dic class="col-md-12">
<div class="panel panel-info" cg-busy="getSocialPromise">
<div class="panel-heading"><i class="fa-solid fa-user-tie"></i> Admin Actions</div>
<div class="panel-body">
<div class="list-group">
<a class="list-group-item" target="" href="mailto:{{::profileUser.Email}}?subject=Hello From {{::mundialitoApp.appName}}"><i class="fa-solid fa-envelope"></i> Send Mail</a>
<a class="list-group-item" id="capture" ng-click="capture()" href="" ><i class="fa-solid fa-print"></i> Captue Profile</a>
</div>
</div>
</div>
</dic>
</div>
<div class="row">
<div class="col-md-12">
<div class="panel panel-info" cg-busy="getSocialPromise">
Expand Down
17 changes: 17 additions & 0 deletions Mundialito/Client/src/Users/UserProfileCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,21 @@ angular.module('mundialitoApp').controller('UserProfileCtrl', ['$scope', '$log',
$log.error('Failed to compare users', err);
Alert.error('Failed to compare users: ' + err);
});

$scope.capture = () => {
html2canvas(document.body).then((canvas) => {
// Convert the canvas to a data URL
var dataURL = canvas.toDataURL('image/png');

// Create a temporary link element
var link = document.createElement('a');
link.href = dataURL;
link.download = $scope.profileUser.Username + '.png';

// Trigger the download
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
});
}
}]);
3 changes: 2 additions & 1 deletion Mundialito/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ gulp.task('compress-lib', function () {
"Client/lib/angular-key-value-editor.js",
"Client/lib/compiled-templates.js",
"Client/lib/ng-sortable.js",
"Client/lib/angular-bootstrap-toggle.js"
"Client/lib/angular-bootstrap-toggle.js",
"Client/lib/html2canvas.min.js",
])
.pipe(concat('lib.js'))
.pipe(minify())
Expand Down
13 changes: 13 additions & 0 deletions Mundialito/wwwroot/App/Users/UserProfile.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@ <h4><i class="fa fa-user"></i> {{profileUser.Name}} Profile</h4>
</div>
</div>
</div>
<div class="row" data-access-level="Admin">
<dic class="col-md-12">
<div class="panel panel-info" cg-busy="getSocialPromise">
<div class="panel-heading"><i class="fa-solid fa-user-tie"></i> Admin Actions</div>
<div class="panel-body">
<div class="list-group">
<a class="list-group-item" target="_blank" href="mailto:{{::profileUser.Email}}?subject=Hello From {{::mundialitoApp.appName}}"><i class="fa-solid fa-envelope"></i> Send Mail</a>
<a class="list-group-item" id="capture" ng-click="capture()" href="" ><i class="fa-solid fa-print"></i> Captue Profile</a>
</div>
</div>
</div>
</dic>
</div>
<div class="row">
<div class="col-md-12">
<div class="panel panel-info" cg-busy="getSocialPromise">
Expand Down
2 changes: 1 addition & 1 deletion Mundialito/wwwroot/js/app-min.js

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions Mundialito/wwwroot/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2514,6 +2514,23 @@ angular.module('mundialitoApp').controller('UserProfileCtrl', ['$scope', '$log',
$log.error('Failed to compare users', err);
Alert.error('Failed to compare users: ' + err);
});

$scope.capture = () => {
html2canvas(document.body).then((canvas) => {
// Convert the canvas to a data URL
var dataURL = canvas.toDataURL('image/png');

// Create a temporary link element
var link = document.createElement('a');
link.href = dataURL;
link.download = $scope.profileUser.Username + '.png';

// Trigger the download
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
});
}
}]);

'use strict';
Expand Down
2 changes: 1 addition & 1 deletion Mundialito/wwwroot/lib/lib-min.js

Large diffs are not rendered by default.

22 changes: 21 additions & 1 deletion Mundialito/wwwroot/lib/lib.js

Large diffs are not rendered by default.

0 comments on commit 013be89

Please sign in to comment.