1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-12 14:23:32 +00:00

action buttons component

This commit is contained in:
Kyle Spearrin
2017-10-16 14:45:47 -04:00
parent 276be2fa87
commit ad285a7605
14 changed files with 199 additions and 198 deletions

View File

@@ -1,18 +1,41 @@
angular
.module('bit.components')
.component('actionButtonsComponent', {
.component('actionButtons', {
bindings: {
uri: '<'
cipher: '<',
showView: '<',
onView: '&'
},
template: '',
controller: function (stateService) {
this.$onInit = (function () {
}).bind(this);
templateUrl: 'app/components/views/actionButtons.html',
controller: function (i18nService, $analytics, constantsService, toastr, $timeout, $window, utilsService) {
var ctrl = this;
this.$onChanges = (function () {
}).bind(this);
ctrl.$onInit = function () {
ctrl.i18n = i18nService;
ctrl.constants = constantsService;
ctrl.launch = function () {
$timeout(function () {
if (ctrl.cipher.login.uri.startsWith('http://') || ctrl.cipher.login.uri.startsWith('https://')) {
$analytics.eventTrack('Launched Website From Listing');
chrome.tabs.create({ url: ctrl.cipher.login.uri });
if (utilsService.inPopup($window)) {
$window.close();
}
}
});
};
ctrl.clipboardError = function (e) {
toastr.info(i18n.browserNotSupportClipboard);
};
ctrl.clipboardSuccess = function (e, type, aType) {
e.clearSelection();
$analytics.eventTrack('Copied ' + aType);
toastr.info(type + i18nService.valueCopied);
};
};
}
});