-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added possibility to replace only the link text by the provided html … #61
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ angular.module('ui.bootstrap.contextMenu', []) | |
} | ||
|
||
}) | ||
.directive('contextMenu', ["$parse", "$q", "CustomService", "$sce", function ($parse, $q, custom, $sce) { | ||
.directive('contextMenu', ["$parse", "$q", "CustomService", "$sce", "$compile", function ($parse, $q, custom, $sce, $compile) { | ||
|
||
var contextMenus = []; | ||
var $currentContextMenu = null; | ||
|
@@ -32,14 +32,20 @@ angular.module('ui.bootstrap.contextMenu', []) | |
|
||
var $a = $('<a>'); | ||
$a.css("padding-right", "8px"); | ||
$a.attr({ tabindex: '-1', href: '#' }); | ||
$a.attr({tabindex: '-1', href: '#'}); | ||
|
||
if (typeof item[0] === 'string') { | ||
text = item[0]; | ||
} | ||
else if (typeof item[0] === "function") { | ||
text = item[0].call($scope, $scope, event, model); | ||
} else if (typeof item.text !== "undefined") { | ||
} | ||
else if (typeof item.html !== "undefined" && item.replaceTextByHtml) | ||
{ | ||
text = item.compileHtml ? $compile(angular.element(item.html))($scope) : item.html; | ||
} | ||
else if (typeof item.text !== "undefined") | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This curly brace should be moved to previous line for consistency |
||
text = item.text; | ||
} | ||
|
||
|
@@ -71,12 +77,15 @@ angular.module('ui.bootstrap.contextMenu', []) | |
// if first item is a string, then text should be the string. | ||
|
||
var text = defaultItemText; | ||
if (typeof item[0] === 'function' || typeof item[0] === 'string' || typeof item.text !== "undefined") { | ||
if (typeof item[0] === 'function' || typeof item[0] === 'string' || typeof item.text !== "undefined" | ||
|| (typeof item.html !== "undefined" && item.replaceTextByHtml)) | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This curly brace should be moved to previous line for consistency |
||
text = processTextItem($scope, item, text, event, model, $promises, nestedMenu, $); | ||
} | ||
else if (typeof item.html !== "undefined") { | ||
else if (typeof item.html !== "undefined") | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This curly brace should be moved to previous line for consistency |
||
// leave styling open to dev | ||
text = item.html | ||
text = item.compileHtml ? $compile(angular.element(item.html))($scope) : item.html; | ||
} | ||
|
||
$li.append(text); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This curly brace should be moved to previous line for consistency