Skip to content

Commit 05db46f

Browse files
committed
merge with master
2 parents a537335 + 0d9305f commit 05db46f

5 files changed

Lines changed: 35 additions & 4 deletions

File tree

doc/source/howtos.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
How to write Python in PythonScript
2-
===================================
1+
How to write Python in PythonJS
2+
===============================
33

4-
How to use PythonScript ?
4+
How to use PythonJS ?
55
-------------------------
66

7-
Install PythonScriptTranslator:
7+
Install ``pythonjs``:
88

99
.. code-block:: sh
1010
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
submit = jQuery("input[type='submit']")
2+
3+
4+
def on_add():
5+
input = jQuery("input[type='text']")
6+
task = input.val() # fetch the value of the input
7+
if task:
8+
# if it's not empty add it to the list
9+
tasks = jQuery('#tasks')
10+
tasks.append("<li>" + task + "</li>")
11+
# empty the input field
12+
input.val('')
13+
14+
15+
submit.click(on_add)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<h1>List of Tasks</h1>
2+
<ul id="tasks">
3+
</ul>
4+
<h1>Add a task</h1>
5+
<input type="text" /><input type="submit" value="Add" />
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<script src="jquery.js"></script>
2+
<script src="pythonjs.js"></script>
3+
<script src="app.js"></script>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<h1>List of Tasks</h1>
2+
<ul id="tasks">
3+
<li>Task one [<span>done</span>]</li>
4+
<li>Task two [<span>done</span>]</li>
5+
<li>Two three [<span>done</span>]</li>
6+
</ul>
7+
<h1>Add a task</h1>
8+
<input type="text" /><input type="submit" value="Add" />

0 commit comments

Comments
 (0)