Sfoglia il codice sorgente

New data-control-checkbox

Javi Jimenez Villar 13 anni fa
parent
commit
3574ae5eee
2 ha cambiato i file con 8 aggiunte e 3 eliminazioni
  1. 1 3
      src/boot/Lungo.Boot.Data.coffee
  2. 7 0
      src/modules/Lungo.Attributes.coffee

+ 1 - 3
src/boot/Lungo.Boot.Data.coffee

@@ -32,9 +32,7 @@ Lungo.Boot.Data = do(lng = Lungo) ->
       el = lng.dom(children)
       _bindDataAttribute el, el.data(key), attribute.html
 
-
   _bindDataAttribute = (element, value, html) ->
-    html_binded = html.replace(BINDING.START + BINDING.KEY + BINDING.END, value)
-    element.prepend html_binded
+    element.prepend html.replace(/\{\{value\}\}/g, value)
 
   init: init

+ 7 - 0
src/modules/Lungo.Attributes.coffee

@@ -42,6 +42,13 @@ Lungo.Attributes =
     selector: "header"
     html: "<span class=\"title centered\">{{value}}</span>"
 
+  "control-checkbox":
+    selector: "*"
+    html: """
+      <input type="checkbox" value="None" id="{{value}}" />
+      <label for="{{value}}"></label>
+    """
+
   loading:
     selector: "*"
     html: """