Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #2 from derDieDasJojo/master

added draggables
  • Loading branch information...
commit e75307f26de0258ccf059f9dc9057786464f1dd7 2 parents 5cdc95a + 039ce64
Adam Koprowski authored July 16, 2012
2  Makefile
@@ -13,7 +13,7 @@ OTHER_DEPENDS =
13 13
 
14 14
 #Compiler variables
15 15
 OPACOMPILER = opa
16  
-MINIMAL_VERSION = 1150
  16
+MINIMAL_VERSION = 0
17 17
 FLAG = --minimal-version $(MINIMAL_VERSION) -v
18 18
 PORT = 8080
19 19
 
1  README.markdown
Source Rendered
@@ -4,6 +4,7 @@ This is a project binding [jQuery UI](http://jqueryui.com) and porting its demos
4 4
 For now the only working functionality is:
5 5
 
6 6
 * Sortables (default demo)
  7
+* Draggables
7 8
 
8 9
 Want to help?
9 10
 
24  jquery-ui-demo.opa
@@ -2,7 +2,27 @@ import jQueryUI
2 2
 
3 3
 //type demo_page = { string name, ( -> xhtml) show }
4 4
 //type demo = { string name, list(demo_page) pages }
  5
+module Draggable {
  6
+  demo =
  7
+    { name: "Draggable"
  8
+    , pages:
  9
+        [ {name: "drag"            , show: on_update_demo }
  10
+        ]
  11
+    }
  12
+
  13
+
5 14
 
  15
+  client function on_update_demo(){
  16
+    function mk_draggable(_) {
  17
+      jQueryUI.Draggable.mk_draggable(#draggable)
  18
+      //return js_void;
  19
+    }
  20
+
  21
+    <div id=draggable style="background:#cccccc" onready={mk_draggable}>bla</div>
  22
+
  23
+  }
  24
+
  25
+}
6 26
 module Sortable {
7 27
 
8 28
   demo =
@@ -52,7 +72,7 @@ module Sortable {
52 72
 
53 73
 }
54 74
 
55  
-demos = [Sortable.demo]
  75
+demos = [Sortable.demo, Draggable.demo]
56 76
 
57 77
 function mk_demo(demo) {
58 78
   function show_demo(gen)(_event) {
@@ -86,7 +106,7 @@ function page() {
86 106
 
87 107
 Server.start(Server.http,
88 108
   [ {resources: @static_resource_directory("resources")}
89  
-  , {register: ["resources/bootstrap.css", "resources/style.css", "resources/bootstrap.js"]}
  109
+  , {register:{css: ["resources/bootstrap.css", "resources/style.css", "resources/bootstrap.js"]}}
90 110
   , {title: "JQuery-UI in Opa", ~page}
91 111
   ]
92 112
 )
6  packages/jQueryUI/jQueryUI.opa
@@ -20,5 +20,11 @@ module jQueryUI {
20 20
     }
21 21
 
22 22
   }
  23
+  module Draggable {
  24
+    function void mk_draggable(dom) {
  25
+      elt = Dom.of_selection(dom)
  26
+      %%JQueryUI.mk_draggable%%(elt)
23 27
 
  28
+    }
  29
+  }
24 30
 }
2  packages/jQueryUI/jQueryUI/Makefile
@@ -2,7 +2,7 @@
2 2
 # USER VARIABLES
3 3
 MKLIB = opa-plugin-builder
4 4
 PLUGNAME = jQueryUI.opp
5  
-SRC = jQueryUI.js ui/jquery.ui.widget.js ui/jquery.ui.core.js ui/jquery.ui.mouse.js ui/jquery.ui.sortable.js
  5
+SRC = jQueryUI.js ui/jquery.ui.widget.js ui/jquery.ui.core.js ui/jquery.ui.mouse.js ui/jquery.ui.sortable.js ui/jquery.ui.draggable.js
6 6
      #ui/jquery-ui.js
7 7
 
8 8
 ########################################
6  packages/jQueryUI/jQueryUI/jQueryUI.js
@@ -20,3 +20,9 @@
20 20
 return dom.bind( "sortupdate", function(event, ui) { on_update(); } );
21 21
 }
22 22
 
  23
+##register mk_draggable: Dom.private.element -> void
  24
+##args(dom)
  25
+{
  26
+    dom.draggable();
  27
+    return js_void;
  28
+}

0 notes on commit e75307f

Please sign in to comment.
Something went wrong with that request. Please try again.