Skip to content

Commit

Permalink
Ability to highlight block names
Browse files Browse the repository at this point in the history
  • Loading branch information
Boris Staal committed Jan 26, 2013
1 parent c30cb29 commit 71c71c1
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 10 deletions.
11 changes: 7 additions & 4 deletions lib/foundry-xray/app/assets/javascripts/application.js.coffee
Expand Up @@ -134,13 +134,16 @@ class Application
elements = $('.naming')
drawer = @drawer

elements.click ->
active = $(@).hasClass('active')
needle = @innerHTML
elements.filter('.link').click ->
element = $(@)
active = element.hasClass('active')
needle = element.attr("data-naming") || @innerHTML
elements.removeClass('active')

unless active
elements.filter(-> @innerHTML == needle).addClass('active')
elements.filter(->
($(@).attr("data-naming") || @innerHTML) == needle
).addClass('active')

drawer.repaint()

Expand Down
2 changes: 1 addition & 1 deletion lib/foundry-xray/app/views/nodes/argument.jst.mustache
@@ -1 +1 @@
{{{type}}} <span class='naming'>%{{name}}</span>
{{{type}}} <span class='naming link'>%{{name}}</span>
2 changes: 1 addition & 1 deletion lib/foundry-xray/app/views/nodes/block.jst.mustache
@@ -1,4 +1,4 @@
{{name}}:<br/>
<span class="naming link" data-naming="%{{name}}">{{name}}</span>:<br/>
<blockquote>
{{{instructions}}}
</blockquote>
@@ -1,3 +1,3 @@
<div>
{{{type}}} <span class='naming'>%{{name}}</span> = <b>{{opcode}}</b> {{parameters}} {{{operands}}}
{{{type}}} <span class='naming link'>%{{name}}</span> = <b>{{opcode}}</b> {{parameters}} {{{operands}}}
</div>
@@ -1 +1 @@
<span class='naming'>%{{name}}</span>
<span class='naming link'>%{{name}}</span>
@@ -1 +1 @@
<a href="javascript:app.jumpToBlock('{{name}}')">label %{{name}}</a>
<a href="javascript:app.jumpToBlock('{{name}}')">label <span class="naming">%{{name}}</span></a>
@@ -1 +1 @@
<span class='naming'>%{{name}}</span>
<span class='naming link'>%{{name}}</span>

0 comments on commit 71c71c1

Please sign in to comment.