Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion demo/angular-hovercard.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Angular hovercard directive.
* @version v1.0.3 - 2015-06-29
* @version v1.0.3 - 2015-10-20
* @link https://github.com/yaru22/angular-hovercard
* @author Brian Park <[email protected]>
* @license MIT License, http://www.opensource.org/licenses/MIT
Expand Down
27 changes: 24 additions & 3 deletions demo/angular-hovercard.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Angular hovercard directive.
* @version v1.0.3 - 2015-06-29
* @version v1.0.3 - 2015-10-20
* @link https://github.com/yaru22/angular-hovercard
* @author Brian Park <[email protected]>
* @license MIT License, http://www.opensource.org/licenses/MIT
Expand Down Expand Up @@ -58,14 +58,35 @@ angular.module('yaru22.hovercard', ['yaru22.hovercard.tmpls']).directive('hoverc
$scope.hoverCardStyle.left = '-1em';
$scope.hoverCardStyle.right = '';
}
} // if (placement)
}
// if (placement)
var triggerEvent = 'mouseenter';
if ($attrs.trigger) {
triggerEvent = $attrs.trigger;
}
var show = function () {
$scope.show.card = true;
if ($scope.onHoverIn) {
$scope.onHoverIn();
}
};
$scope.showMouse = function () {
if (triggerEvent === 'mouseenter') {
show();
}
};
$scope.showClick = function () {
if (triggerEvent === 'click') {
show();
}
};
} // link function
};
});
angular.module('yaru22.hovercard.tmpls', []).run([
'$templateCache',
function ($templateCache) {
'use strict';
$templateCache.put('template/angular-hovercard.tmpl', '<div class=angular-hovercard ng-mouseenter="showCard = true; onHoverIn()" ng-mouseleave="showCard = false; onHoverOut()"><label class=angular-hovercard-label ng-class="{ \'angular-hovercard-active\': showCard }" ng-style=hoverLabelStyle ng-transclude></label><div class=angular-hovercard-detail ng-class="{ \'angular-hovercard-active\': showCard }" ng-include=hoverTmplUrl ng-style=hoverCardStyle></div></div>');
$templateCache.put('template/angular-hovercard.tmpl', '<div class=angular-hovercard ng-click=showClick() ng-mouseenter=showMouse() ng-mouseleave="show.card = false; onHoverOut()"><label class=angular-hovercard-label ng-class="{ \'angular-hovercard-active\': show.card }" ng-style=hoverLabelStyle ng-transclude></label><div class=angular-hovercard-detail ng-class="{ \'angular-hovercard-active\': show.card }" ng-include=hoverTmplUrl ng-style=hoverCardStyle></div></div>');
}
]);
2 changes: 1 addition & 1 deletion dist/angular-hovercard.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Angular hovercard directive.
* @version v1.0.3 - 2015-06-29
* @version v1.0.3 - 2015-10-20
* @link https://github.com/yaru22/angular-hovercard
* @author Brian Park <[email protected]>
* @license MIT License, http://www.opensource.org/licenses/MIT
Expand Down
27 changes: 24 additions & 3 deletions dist/angular-hovercard.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Angular hovercard directive.
* @version v1.0.3 - 2015-06-29
* @version v1.0.3 - 2015-10-20
* @link https://github.com/yaru22/angular-hovercard
* @author Brian Park <[email protected]>
* @license MIT License, http://www.opensource.org/licenses/MIT
Expand Down Expand Up @@ -58,14 +58,35 @@ angular.module('yaru22.hovercard', ['yaru22.hovercard.tmpls']).directive('hoverc
$scope.hoverCardStyle.left = '-1em';
$scope.hoverCardStyle.right = '';
}
} // if (placement)
}
// if (placement)
var triggerEvent = 'mouseenter';
if ($attrs.trigger) {
triggerEvent = $attrs.trigger;
}
var show = function () {
$scope.show.card = true;
if ($scope.onHoverIn) {
$scope.onHoverIn();
}
};
$scope.showMouse = function () {
if (triggerEvent === 'mouseenter') {
show();
}
};
$scope.showClick = function () {
if (triggerEvent === 'click') {
show();
}
};
} // link function
};
});
angular.module('yaru22.hovercard.tmpls', []).run([
'$templateCache',
function ($templateCache) {
'use strict';
$templateCache.put('template/angular-hovercard.tmpl', '<div class=angular-hovercard ng-mouseenter="showCard = true; onHoverIn()" ng-mouseleave="showCard = false; onHoverOut()"><label class=angular-hovercard-label ng-class="{ \'angular-hovercard-active\': showCard }" ng-style=hoverLabelStyle ng-transclude></label><div class=angular-hovercard-detail ng-class="{ \'angular-hovercard-active\': showCard }" ng-include=hoverTmplUrl ng-style=hoverCardStyle></div></div>');
$templateCache.put('template/angular-hovercard.tmpl', '<div class=angular-hovercard ng-click=showClick() ng-mouseenter=showMouse() ng-mouseleave="show.card = false; onHoverOut()"><label class=angular-hovercard-label ng-class="{ \'angular-hovercard-active\': show.card }" ng-style=hoverLabelStyle ng-transclude></label><div class=angular-hovercard-detail ng-class="{ \'angular-hovercard-active\': show.card }" ng-include=hoverTmplUrl ng-style=hoverCardStyle></div></div>');
}
]);
4 changes: 2 additions & 2 deletions dist/angular-hovercard.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions src/angular-hovercard.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,31 @@ angular.module('yaru22.hovercard', [
$scope.hoverCardStyle.right = '';
}
} // if (placement)

var triggerEvent = 'mouseenter';
if ($attrs.trigger) {
triggerEvent = $attrs.trigger;
}

var show = function() {
$scope.show.card = true;
if ($scope.onHoverIn) {
$scope.onHoverIn();
}
};

$scope.showMouse = function () {
if (triggerEvent === 'mouseenter') {
show();
}
};

$scope.showClick = function () {
if (triggerEvent === 'click') {
show();
}
};

} // link function
};
});
8 changes: 4 additions & 4 deletions template/angular-hovercard.tmpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="angular-hovercard" ng-mouseenter="showCard = true; onHoverIn()" ng-mouseleave="showCard = false; onHoverOut()">
<label class="angular-hovercard-label" ng-class="{ 'angular-hovercard-active': showCard }" ng-style="hoverLabelStyle" ng-transclude></label>
<div class="angular-hovercard-detail" ng-class="{ 'angular-hovercard-active': showCard }" ng-include="hoverTmplUrl" ng-style="hoverCardStyle"></div>
</div>
<div class="angular-hovercard" ng-click="showClick()" ng-mouseenter="showMouse()" ng-mouseleave="show.card = false; onHoverOut()">
<label class="angular-hovercard-label" ng-class="{ 'angular-hovercard-active': show.card }" ng-style="hoverLabelStyle" ng-transclude></label>
<div class="angular-hovercard-detail" ng-class="{ 'angular-hovercard-active': show.card }" ng-include="hoverTmplUrl" ng-style="hoverCardStyle"></div>
</div>
4 changes: 2 additions & 2 deletions test/unit/hovercardSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ describe('hovercard', function() {


it('should create a label', inject(function() {
var label = elm.find('.angular-hovercard-label');
var label = angular.element(elm[0].querySelector('.angular-hovercard-label')); //elm.find('.angular-hovercard-label');

expect(label).to.have.length(1);
expect(label.eq(0).text().trim()).to.equal('Brian Park');
}));

it('should load template specified on hover-tmpl-url', inject(function() {
var detail = elm.find('.angular-hovercard-detail');
var detail = angular.element(elm[0].querySelector('.angular-hovercard-detail'));

expect(detail).to.have.length(1);
expect(detail.eq(0).text().trim()).to.equal('Hover card detail.');
Expand Down