Skip to content

Instantly share code, notes, and snippets.

@thatbudakguy
Created September 13, 2017 17:55
Show Gist options
  • Save thatbudakguy/27833d888dbf4481a327efbe188d0587 to your computer and use it in GitHub Desktop.
Save thatbudakguy/27833d888dbf4481a327efbe188d0587 to your computer and use it in GitHub Desktop.
Linfield primo-explore custom.js
(function(){
"use strict";
'use strict';
/************************************* BEGIN Bootstrap Script ************************************/
var app = angular.module('viewCustom', ['forceServicesPageAuth', 'toggleInstitutions']);
/************************************* END Bootstrap Script ************************************/
app.component('prmSearchBookmarkFilterAfter', {
bindings: {},
template: '<div class="chat"><a ng-href="http://www.linfield.edu/linfield-libraries/nicholson-info/im-reference.html" target="new_window"><img src="http://www.linfield.edu/assets/images/library/helpchat-red.png" height=“35px” border=“0px” title=“Help”></img></a></div>'
});
angular.module('toggleInstitutions', []).component('prmAlmaMoreInstAfter', {
template: '\n\t\t<md-button class="md-raised" ng-click="toggleLibs()" id="summitButton" aria-controls="summitLinks" aria-expanded="false" aria-label="Show/Hide Summit Libraries">\n \t\t\t{{ showLibs ? \'Hide Libraries\' : \'Show Libraries\' }}\n \t\t\t<span aria-hidden="true">{{showLibs ? \'&laquo;\' : \'&raquo;\' }}</span>\n\t\t</md-button>',
controller: ['$scope', function ($scope) {
this.$onInit = function () {
$scope.showLibs = false;
$scope.button = angular.element(document.querySelector('prm-alma-more-inst-after button'));
$scope.tabs = angular.element(document.querySelector('prm-alma-more-inst md-tabs'));
$scope.tabs.attr('id', 'summitLinks');
$scope.tabs.addClass('hide');
$scope.button.parent().after($scope.tabs);
$scope.toggleLibs = function () {
$scope.showLibs = !$scope.showLibs;
if ($scope.tabs.hasClass('hide')) {
$scope.tabs.removeClass('hide');
$scope.button.attr("aria-expanded", "true");
} else {
$scope.tabs.addClass('hide');
$scope.button.attr("aria-expanded", "false");
}
};
};
}]
});
angular.module('forceServicesPageAuth', []).component('prmAuthenticationAfter', {
bindings: { parentCtrl: '<' },
controller: ['$location', function ($location) {
if (($location.search().isSerivcesPage || $location.search().isServicesPage) && !this.parentCtrl.isLoggedIn) {
this.parentCtrl.loginService.handleLoginClick();
}
}]
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment