2428 - Added anchor directive
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2020-10-16 10:40:45 +02:00
parent 0fbbe9b2ae
commit 6412f29685
3 changed files with 36 additions and 2 deletions

View File

@ -0,0 +1,32 @@
import ngModule from '../module';
/**
* Allows changing state for nested anchor
*
* @param {Object} $parse
* @param {Object} $state
* @return {Object} The directive
*/
export function directive($parse, $state) {
return {
restrict: 'A',
link: function($scope, $element, $attrs) {
const state = $scope.$eval($attrs.vnAnchor);
// const element = $element[0];
$element.on('click', event => {
const params = [];
for (let param in state.params)
console.log(param);
// $state.go(state.url, state.params);
event.preventDefault();
event.stopPropagation();
});
}
};
}
directive.$inject = ['$parse', '$state'];
ngModule.directive('vnAnchor', directive);

View File

@ -15,3 +15,4 @@ import './smart-table';
import './droppable';
import './http-click';
import './http-submit';
import './anchor';

View File

@ -40,8 +40,7 @@
vn-tooltip="Client frozen"
icon="icon-frozen">
</vn-icon-button>
<vn-icon-button
ng-click="$ctrl.filterTickets(client, $event)"
<vn-icon-button vn-anchor="{url: 'ticket.index', params: {q: {clientFk: client.id}}}"
vn-tooltip="Client tickets"
icon="icon-ticket">
</vn-icon-button>
@ -51,6 +50,8 @@
icon="desktop_windows">
</vn-icon-button>
</vn-item-section>
<!-- ng-click="$ctrl.filterTickets(client, $event)" -->
</a>
</div>
</vn-card>