Skip to content

Commit 9d222e9

Browse files
committed
Add directive to pull data from inputs and inject into code block
1 parent 0303e86 commit 9d222e9

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

app/index.jade

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ html(class="no-js", lang="en", ng-app="neo4jApp", ng-controller="MainCtrl")
151151
script(src='scripts/directives/fullscreen.js')
152152
script(src='scripts/directives/exportable.js')
153153
script(src='scripts/directives/helpUrl.js')
154+
script(src='scripts/directives/inputToCodeBlock.js')
154155
script(src='scripts/directives/helpTopic.js')
155156
script(src='scripts/directives/playTopic.js')
156157
script(src='scripts/directives/execTopic.js')
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
###!
2+
Copyright (c) 2002-2016 "Neo Technology,"
3+
Network Engine for Objects in Lund AB [http://neotechnology.com]
4+
5+
This file is part of Neo4j.
6+
7+
Neo4j is free software: you can redistribute it and/or modify
8+
it under the terms of the GNU General Public License as published by
9+
the Free Software Foundation, either version 3 of the License, or
10+
(at your option) any later version.
11+
12+
This program is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
GNU General Public License for more details.
16+
17+
You should have received a copy of the GNU General Public License
18+
along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
###
20+
21+
'use strict';
22+
23+
# Requires jQuery
24+
angular.module('neo4jApp.directives')
25+
.directive('article', ['$rootScope',($rootScope) ->
26+
restrict: 'E'
27+
link: (scope, element, attrs) ->
28+
element.on 'keyup', 'input[value-for]', (e) ->
29+
key = e.currentTarget.attributes.getNamedItem('value-for').value
30+
angular.element(".code span[value-key=#{key}]").text(e.currentTarget.value)
31+
$rootScope.$apply() unless $rootScope.$$phase
32+
])

0 commit comments

Comments
 (0)