2015-05-01 10:40:25 -04:00
|
|
|
angularIO.directive('biocard', function($rootScope, $timeout, $mdDialog) {
|
2015-05-01 09:48:52 -04:00
|
|
|
return {
|
|
|
|
restrict: 'A',
|
|
|
|
scope: {},
|
2015-06-07 08:23:30 -04:00
|
|
|
link: function(scope, element, attrs) {
|
2015-05-05 12:56:18 -04:00
|
|
|
// SET SCOPE VALUES
|
|
|
|
scope.name = attrs.name;
|
|
|
|
scope.pic = attrs.pic;
|
|
|
|
scope.bio = attrs.bio;
|
|
|
|
scope.twitter = attrs.twitter;
|
|
|
|
scope.website = attrs.website;
|
2015-05-01 09:48:52 -04:00
|
|
|
|
2015-05-05 12:56:18 -04:00
|
|
|
// CLOSE MODAL METHOD
|
|
|
|
scope.closeDialog = function() {
|
|
|
|
$mdDialog.hide();
|
|
|
|
};
|
|
|
|
|
|
|
|
// OPEN BIO WHEN CLICKING ON CARD
|
2015-05-01 10:40:25 -04:00
|
|
|
element.on('click', function($event) {
|
2015-05-01 09:48:52 -04:00
|
|
|
$mdDialog.show({
|
|
|
|
parent: angular.element(document.body),
|
|
|
|
targetEvent: $event,
|
2015-06-07 08:23:30 -04:00
|
|
|
scope: scope.$new(), // Uses prototypal inheritance to gain access to parent scope
|
2015-05-05 12:56:18 -04:00
|
|
|
preserveScope: true,
|
2015-05-01 09:48:52 -04:00
|
|
|
template:
|
|
|
|
'<md-dialog class="modal" aria-label="List dialog">' +
|
|
|
|
' <md-content>' +
|
2015-05-05 12:56:18 -04:00
|
|
|
' <img class="left" src="{{pic}}" />' +
|
|
|
|
' <h3 class="text-headline">{{name}}</h3>' +
|
|
|
|
' <div class="modal-social">' +
|
|
|
|
' <a ng-show="twitter" class="button button-subtle button-small" href="https://twitter.com/{{twitter}}" md-button>Twitter</a>' +
|
|
|
|
' <a ng-show="website" class="button button-subtle button-small" href="{{website}}" md-button>Website</a>' +
|
|
|
|
' </div>' +
|
|
|
|
' <p class="text-body">{{bio}}</p>' +
|
2015-05-01 09:48:52 -04:00
|
|
|
' </md-content>' +
|
|
|
|
' <div class="md-actions">' +
|
|
|
|
' <md-button ng-click="closeDialog()">' +
|
|
|
|
' Close Bio' +
|
|
|
|
' </md-button>' +
|
|
|
|
' </div>' +
|
2015-05-05 12:56:18 -04:00
|
|
|
'</md-dialog>'
|
2015-05-01 09:48:52 -04:00
|
|
|
});
|
2015-05-01 10:40:25 -04:00
|
|
|
});
|
2015-05-01 09:48:52 -04:00
|
|
|
}
|
|
|
|
};
|
2015-06-07 08:23:30 -04:00
|
|
|
});
|