From 05e29e9ef21fc654bb0932db47062c23a9e182d7 Mon Sep 17 00:00:00 2001 From: yongfeng wu Date: Mon, 25 Jun 2012 14:16:06 +0800 Subject: [PATCH 1/2] [Serialize] Support htmlAttrbute value as a function --- src/js/serialize.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/js/serialize.js b/src/js/serialize.js index b015012b..6df7af7a 100644 --- a/src/js/serialize.js +++ b/src/js/serialize.js @@ -126,7 +126,10 @@ var DEBUG = true, if (typeof attrName === "object") { var attrMap = attrName; attrName = attrMap.name; - attrValue = attrMap.value[propValue]; + if (typeof attrMap.value === "function") + attrValue = attrMap.value(propValue); + else + attrValue = attrMap.value[propValue]; } if (attrName) { propDefault = BWidget.getPropertyDefault(type, p); From ac9d20288e8f4264d7a027277c0d934a9b203f1e Mon Sep 17 00:00:00 2001 From: yongfeng wu Date: Wed, 6 Jun 2012 11:11:06 +0800 Subject: [PATCH 2/2] [Widget] Support background images Page, Header and Footer have been supported, other widget can inherit the "Background" widget to get background support --- src/js/widgets.js | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/js/widgets.js b/src/js/widgets.js index 0839c5fa..89a5a08a 100644 --- a/src/js/widgets.js +++ b/src/js/widgets.js @@ -209,14 +209,34 @@ var BWidgetRegistry = { } ], }, - + /** + *Support background images using
+ */ + Background:{ + parent: "Base", + properties: { + background: { + type: "string", + defaultValue: "", + htmlAttribute: { + name: "style", + value: function (propValue) { + return "background-image:url('" + propValue + "');" + + "background-attachment:scroll;" + + "background-repeat:no-repeat;" + + "background-size:cover;"; + } + } + } + } + }, /** * Represents a page or dialog in the application. Includes "top" zone * for an optional header, "content" zone for the Content area, and "bottom" * zone for an optional footer. */ Page: { - parent: "Base", + parent: "Background", allowIn: "Design", template: function (node) { var prop, code = $('
'); @@ -273,7 +293,7 @@ var BWidgetRegistry = { * for optional buttons, and "bottom" zone for an optional navbar. */ Header: { - parent: "Base", + parent: "Background", allowIn: "Page", dragHeader: true, paletteImageName: "jqm_header.svg", @@ -342,7 +362,7 @@ var BWidgetRegistry = { * Represents a footer object at the bottom of a page. */ Footer: { - parent: "Base", + parent: "Background", allowIn: "Page", dragHeader: true, paletteImageName: "jqm_footer.svg",