waffle for arthurmaciel added by andyjpb on Thu Jun 11 16:33:51 2015

btn.widget.scm:
-----
(markup . `(button (@
  ,@(if id `((id ,id)) '())
  (class "btn " ,class)
  (type ,type)
  (value ,value)
  ,@(if formnovalidate
    `((formnovalidate)) '())
  ,@(if tooltip
    `((data-tooltip ,tooltip)) '()))
  ,(and icon
    `(i (@ (class " glyphicon glyphicon-" ,icon))))
  ,@contents)
)
(attributes . (
  (id #f)
  (class "")
  (tooltip #f)
  (type "submit")
  (formnovalidate #f)
  (icon #f)
  (contents "Button")
  (value "no-value")))
-----

editable.widget.scm:
-----
(markup . `(div (@ (class "editable " ,(and disabled "editable-disabled")) (data-widget "editable"))
	,(if disabled
	   contents
     `(textarea (@
     	(placeholder ,placeholder)
		  (data-autoresize)
		  (rows ,(if single "1" "5"))
		  ,(and submit-name
		    `(data-submit-name ,submit-name))
		  ,(and submit-value
		    `(data-submit-value ,submit-value))
		  ,input-attr)
			,contents)))
)
(attributes . (
	(disabled #f)
 	(single #t)
 	(placeholder "")
 	(input-attr ())
 	(submit-name #f)
 	(submit-value #f)))
-----

dashboard-chart.widget:
-----
(markup . (begin (use medea)
  `(dashboard-widget (@ (title ,title) (type "chart") (size (,(min (first size) 4) ,(min (second size) 4))))
    (div (@
      (class "dashboard-chart--container")
      (data-chart-type ,type)
      (data-chart-options ,(json->string options))
      (data-chart-xaxis ,(json->string xaxis))
      (data-chart-yaxis ,(json->string yaxis))
      (data-chart-datasets ,(json->string datasets))))))
)
(attributes . (
  (size (2 2)) ; Limited to a max of (4 2)
  (title #f)
  (type "chart")
  (options #())
  (xaxis #())
  (yaxis #())
  (datasets #())))
(javascript-require .(
  ("jquery.min.js" "highcharts.js")
  ("highcharts.js" "knweb.js")))
-----


code:


(load-widgets-from-directory (conc (resource-path) "/widgets/") ".widget.scm")

(generate-scripts-widget "/scripts/")

(waffle-sxml->html 
  `(html
      (head (scripts))
      (body
        (btn))))