Skip to content

Commit

Permalink
Add option to revealToggle to always reveal
Browse files Browse the repository at this point in the history
Sometimes we don't want such a button to toggle the target, but just to
show it.

Addendum to #229
  • Loading branch information
LFDM committed Jul 6, 2014
1 parent 8647839 commit 474807d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/js/arethusa.core/directives/reveal_toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ angular.module('arethusa.core').directive('revealToggle', function() {
restrict: 'A',
link: function(scope, element, attrs) {
var tId = attrs.revealToggle;
var alwaysReveal = attrs.alwaysReveal;

function el() {
return angular.element(document.getElementById(tId));
}

element.bind('click', function() {
var t = el();
if (t.hasClass('hide')) {
if (alwaysReveal || t.hasClass('hide')) {
t.removeClass('hide');
t.trigger('show-' + tId);
} else {
Expand Down
1 change: 1 addition & 0 deletions app/templates/arethusa.morph/morph_form_attributes.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<a
mirror-morph-form="form"
reveal-toggle="mfc{{ tokenId }}"
always-reveal="true"
token-id="tokenId">
Create new
</a>
Expand Down

0 comments on commit 474807d

Please sign in to comment.