refactor(profilePage): use ui-bootrap for modal

pull/3/head
alex 2016-01-21 14:31:53 +03:00
parent 59adfd15a3
commit 8695b7a30b
5 changed files with 49 additions and 54 deletions

View File

@ -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);
};
}
})();

View File

@ -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 () {

View File

@ -143,7 +143,7 @@
<div class="social-profiles row clearfix">
<div class="col-md-3 col-sm-4" ng-repeat="item in socialProfiles">
<a class="sn-link" href ng-click="showModal()" ng-if="!item.href">
<a class="sn-link" href ng-click="showModal(item)" ng-if="!item.href">
<i class="socicon {{ item.icon }}"></i>
<span>{{ item.name }}</span>
</a>
@ -215,4 +215,3 @@
</div>
</div>
</div>
<profile-modal></profile-modal>

View File

@ -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'
};
}
})();

View File

@ -1,23 +1,20 @@
<div class="modal profile-modal fade" id="profileModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<em class="ion-ios-close-empty sn-link-close"></em>
</button>
<h4 class="modal-title" id="myModalLabel">Add Account</h4>
</div>
<form name="linkForm">
<div class="modal-body">
<p>Paste a link to your profile into the box below</p>
<div class="form-group">
<input type="text" class="form-control" placeholder="Link to Profile" ng-model="link">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal" ng-click="bindProfile()">Save changes</button>
</div>
</form>
</div>
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" ng-click="$dismiss()" aria-label="Close">
<em class="ion-ios-close-empty sn-link-close"></em>
</button>
<h4 class="modal-title" id="myModalLabel">Add Account</h4>
</div>
</div>
<form name="linkForm">
<div class="modal-body">
<p>Paste a link to your profile into the box below</p>
<div class="form-group">
<input type="text" class="form-control" placeholder="Link to Profile" ng-model="link">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" ng-click="ok(link)">Save changes</button>
</div>
</form>
</div>