Skip to content

Commit

Permalink
Merge pull request #6 from douglaszaltron/master
Browse files Browse the repository at this point in the history
Changes to the file to use to compress the file
  • Loading branch information
ennedigi committed Mar 19, 2016
2 parents c33c8d6 + 849fbf0 commit 72790d6
Showing 1 changed file with 72 additions and 85 deletions.
157 changes: 72 additions & 85 deletions dist/ion-floating-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,68 @@
* Licensed under the MIT license. Please see LICENSE for more information.
*
*/



(function() {
'use strict';

ionFloatingButton.$inject = ['$scope'];
function ionFloatingButton($scope){
$scope.buttonColor = $scope.buttonColor || '#2AC9AA';
$scope.icon = $scope.icon || 'ion-plus';
$scope.iconColor = $scope.iconColor || '#fff';
$scope.hasFooter = $scope.hasFooter || false;
if ($scope.hasFooter) {
$scope.bottomValue = '60px';
} else {
$scope.bottomValue = '20px';
}
}

ionFloatingMenu.$inject = ['$scope'];
function ionFloatingMenu($scope){
$scope.isOpen = false;
$scope.open = function() {
$scope.isOpen = !$scope.isOpen;
if ($scope.isOpen) {
$scope.setOpen();
} else {
$scope.setClose();
}
};
$scope.setOpen = function() {
$scope.buttonColor = menuOpenColor;
$scope.icon = menuOpenIcon;
$scope.iconColor = menuOpenIconColor;
};
$scope.setClose = function() {
$scope.buttonColor = menuColor;
$scope.icon = menuIcon;
$scope.iconColor = menuIconColor;
};
var menuColor = $scope.menuColor || '#2AC9AA';
var menuIcon = $scope.menuIcon || 'ion-plus';
var menuIconColor = $scope.menuIconColor || '#fff';
var menuOpenColor = $scope.menuOpenColor || '#2AC9AA';
var menuOpenIcon = $scope.menuOpenIcon || 'ion-minus';
var menuOpenIconColor = $scope.menuOpenIconColor || '#fff';
$scope.setClose();
$scope.hasFooter = $scope.hasFooter || false;
if ($scope.hasFooter) {
$scope.bottomValue = '60px';
} else {
$scope.bottomValue = '20px';
}
}

ionFloatingItem.$inject = ['$scope'];
function ionFloatingItem($scope){
$scope.buttonColor = $scope.buttonColor || '#2AC9AA';
$scope.iconColor = $scope.iconColor || '#fff';
}

angular.module('ion-floating-menu', [])

.directive('ionFloatingButton', function () {

return {
restrict: 'E',
scope: {
Expand All @@ -24,40 +80,18 @@ angular.module('ion-floating-menu', [])
buttonClass: '@?',
icon: '@?',
iconColor: '@?',
hasFooter: '=?',
right: '@?',
left: '@?',
bottom: '@?'},
template: '<ul id="floating-button" ng-style="{\'bottom\' : \'{{bottomValue}}\', \'right\' : \'{{right}}\', \'left\' : \'{{left}}\'}">' +
'<li ng-class="buttonClass" ng-style="{\'background-color\': \'{{buttonColor}}\' }">' +
'<a ng-click="click()"><i class="icon menu-icon" ng-class="{ \'{{icon}}\' : true}" ng-style="{\'color\': \'{{iconColor}}\' }"></i></a>' +
hasFooter: '=?'},
template: '<ul id="floating-button" ng-style="{\'bottom\' : \'{{bottomValue}}\' }">' +
'<li ng-class="buttonClass" ng-style="{\'background-color\': buttonColor }">' +
'<a ng-click="click()"><i class="icon menu-icon" ng-class="{ \'{{icon}}\' : true}" ng-style="{\'color\': iconColor }"></i></a>' +
'</li>' +
'</ul>',
replace: true,
transclude: true,
controller: function ($scope) {
$scope.buttonColor = $scope.buttonColor || '#2AC9AA';
$scope.icon = $scope.icon || 'ion-plus';
$scope.iconColor = $scope.iconColor || '#fff';
$scope.hasFooter = $scope.hasFooter || false;

if (!$scope.left){
$scope.right = $scope.right || '20px';
}

if ($scope.hasFooter && !$scope.bottom) {
$scope.bottomValue = '60px';
} else if (!$scope.hasFooter && !$scope.bottom) {
$scope.bottomValue = '20px';
} else {
//Override the bottom value
$scope.bottomValue = $scope.bottom;
}
}
controller: ionFloatingButton
};
})
.directive('ionFloatingMenu', function () {

return {
restrict: 'E',
scope: {
Expand All @@ -67,70 +101,25 @@ angular.module('ion-floating-menu', [])
menuColor: '@?',
menuIcon: '@?',
menuIconColor: '@?',
hasFooter: '=?',
left: '@?',
right: '@?',
bottom: '@?'
hasFooter: '=?'
},
template: '<ul id="floating-menu" \n\
ng-style="{\'bottom\' : \'{{bottomValue}}\', \'right\' : \'{{right}}\', \'left\' : \'{{left}}\'}" \n\
ng-style="{\'bottom\' : \'{{bottomValue}}\'}" \n\
ng-class="{\'active\' : isOpen}" \n\
ng-click="open()">' +
'<div ng-transclude></div>' +
'<span><li class="menu-button icon menu-icon" ng-class="icon" ng-style="{\'background-color\' : \'{{buttonColor}}\', \'color\': \'{{iconColor}}\' }"></li></span>' +
'<span><li class="menu-button icon menu-icon" ng-class="icon" ng-style="{\'background-color\' : buttonColor, \'color\': iconColor}"></li></span>' +
'</ul>',
replace: true,
transclude: true,
link: function (scope, element, attrs, ctrl, transclude)
{
element.find('div').replaceWith(transclude());
},
controller: function ($scope) {
$scope.isOpen = false;
$scope.open = function () {
$scope.isOpen = !$scope.isOpen;
if ($scope.isOpen) {
$scope.setOpen();
} else {
$scope.setClose();
}
};
$scope.setOpen = function () {
$scope.buttonColor = menuOpenColor;
$scope.icon = menuOpenIcon;
$scope.iconColor = menuOpenIconColor;
};
$scope.setClose = function () {
$scope.buttonColor = menuColor;
$scope.icon = menuIcon;
$scope.iconColor = menuIconColor;
};
var menuColor = $scope.menuColor || '#2AC9AA';
var menuIcon = $scope.menuIcon || 'ion-plus';
var menuIconColor = $scope.menuIconColor || '#fff';
var menuOpenColor = $scope.menuOpenColor || '#2AC9AA';
var menuOpenIcon = $scope.menuOpenIcon || 'ion-minus';
var menuOpenIconColor = $scope.menuOpenIconColor || '#fff';
$scope.setClose();

if (!$scope.left){
$scope.right = $scope.right || '20px';
}

//Has a footer
if ($scope.hasFooter && !$scope.bottom) {
$scope.bottomValue = '60px';
} else if (!$scope.hasFooter && !$scope.bottom) {
$scope.bottomValue = '20px';
} else {
//Override the bottom value
$scope.bottomValue = $scope.bottom;
}
}
controller: ionFloatingMenu
};
})
.directive('ionFloatingItem', function () {

return {
restrict: 'E',
require: ['^ionFloatingMenu'],
Expand All @@ -144,12 +133,10 @@ angular.module('ion-floating-menu', [])
textClass: '@?'},
template:
'<li ng-click="click()" ng-class="buttonClass" ng-style="{\'background-color\': buttonColor }">' +
'<span ng-if="text" class="label-container"><span class="label" ng-class="textClass" ng-bind="text"></span></span><i class="icon menu-icon" ng-class="{ \'{{icon}}\' : true}" ng-style="{\'color\': \'{{iconColor}}\' }"></i>' +
'<span ng-if="text" class="label-container"><span class="label" ng-class="textClass" ng-bind="text"></span></span><i class="icon menu-icon" ng-class="{ \'{{icon}}\' : true}" ng-style="{\'color\': iconColor }"></i>' +
'</li>',
replace: true,
controller: function ($scope) {
$scope.buttonColor = $scope.buttonColor || '#2AC9AA';
$scope.iconColor = $scope.iconColor || '#fff';
}
controller: ionFloatingItem
};
});
})();

0 comments on commit 72790d6

Please sign in to comment.