From 8695b7a30b7de9d3e9ce5d480dee28bc9e65622d Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 21 Jan 2016 14:31:53 +0300 Subject: [PATCH] refactor(profilePage): use ui-bootrap for modal --- src/app/pages/profile/ProfileModalCtrl.js | 19 +++++++++ src/app/pages/profile/ProfilePageCtrl.js | 14 +++++-- src/app/pages/profile/profile.html | 3 +- .../pages/profile/profileModal.directive.js | 26 ------------ src/app/pages/profile/profileModal.html | 41 +++++++++---------- 5 files changed, 49 insertions(+), 54 deletions(-) create mode 100644 src/app/pages/profile/ProfileModalCtrl.js delete mode 100644 src/app/pages/profile/profileModal.directive.js diff --git a/src/app/pages/profile/ProfileModalCtrl.js b/src/app/pages/profile/ProfileModalCtrl.js new file mode 100644 index 0000000..0391cc1 --- /dev/null +++ b/src/app/pages/profile/ProfileModalCtrl.js @@ -0,0 +1,19 @@ +/** + * @author a.demeshko + * created on 21.01.2016 + */ +(function () { + 'use strict'; + + angular.module('BlurAdmin.pages.profile') + .controller('ProfileModalCtrl', ProfileModalCtrl); + + /** @ngInject */ + function ProfileModalCtrl($scope, $uibModalInstance) { + $scope.link = ''; + $scope.ok = function () { + $uibModalInstance.close($scope.link); + }; + } + +})(); \ No newline at end of file diff --git a/src/app/pages/profile/ProfilePageCtrl.js b/src/app/pages/profile/ProfilePageCtrl.js index 8e117f1..43f767e 100644 --- a/src/app/pages/profile/ProfilePageCtrl.js +++ b/src/app/pages/profile/ProfilePageCtrl.js @@ -6,10 +6,10 @@ 'use strict'; angular.module('BlurAdmin.pages.profile') - .controller('ProfilePageCtrl', ProfilePageCtrl); + .controller('ProfilePageCtrl', ProfilePageCtrl); /** @ngInject */ - function ProfilePageCtrl($scope, fileReader, $filter) { + function ProfilePageCtrl($scope, fileReader, $filter, $uibModal) { $scope.picture = $filter('profilePicture')('Nasta'); $scope.removePicture = function () { @@ -65,8 +65,14 @@ item.href = undefined; }; - $scope.showModal = function () { - $('#profileModal').modal('show'); + $scope.showModal = function (item) { + $uibModal.open({ + animation: false, + controller: 'ProfileModalCtrl', + templateUrl: 'app/pages/profile/profileModal.html' + }).result.then(function (link) { + item.href = link; + }); }; $scope.getFile = function () { diff --git a/src/app/pages/profile/profile.html b/src/app/pages/profile/profile.html index 06eeb3b..acc2c51 100644 --- a/src/app/pages/profile/profile.html +++ b/src/app/pages/profile/profile.html @@ -143,7 +143,7 @@
- + {{ item.name }} @@ -215,4 +215,3 @@
- \ No newline at end of file diff --git a/src/app/pages/profile/profileModal.directive.js b/src/app/pages/profile/profileModal.directive.js deleted file mode 100644 index 291e5ba..0000000 --- a/src/app/pages/profile/profileModal.directive.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * @author v.lugovsky - * created on 16.12.2015 - */ -(function () { - 'use strict'; - - angular.module('BlurAdmin.pages.profile') - .service('profileModal', profileModal); - - /** @ngInject */ - function profileModal() { - return { - restrict: 'EA', - replace: true, - link: function ($scope) { - $scope.link = ""; - $scope.bindProfile = function(){ - $scope.link = ""; - }; - }, - templateUrl: 'app/pages/profile/profileModal.html' - }; - } - -})(); diff --git a/src/app/pages/profile/profileModal.html b/src/app/pages/profile/profileModal.html index 33ba7aa..306d189 100644 --- a/src/app/pages/profile/profileModal.html +++ b/src/app/pages/profile/profileModal.html @@ -1,23 +1,20 @@ -