From f491378a1977356519653b833a8ce895ef9067c0 Mon Sep 17 00:00:00 2001 From: yongfeng wu Date: Thu, 5 Jul 2012 16:58:44 +0800 Subject: [PATCH 1/8] [Widgets] Fixed Bug: The background image resizes upon insertion of many widgets, distorting itself --- src/js/widgets.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/widgets.js b/src/js/widgets.js index 89a5a08a..e8815875 100644 --- a/src/js/widgets.js +++ b/src/js/widgets.js @@ -222,9 +222,9 @@ var BWidgetRegistry = { name: "style", value: function (propValue) { return "background-image:url('" + propValue + "');" + - "background-attachment:scroll;" + + "background-attachment:fixed;" + "background-repeat:no-repeat;" + - "background-size:cover;"; + "background-size:100% 100%;"; } } } From 64d8e26f232b84978d5a61c4f24a19e2f18ae1f6 Mon Sep 17 00:00:00 2001 From: Xuqing Kuang Date: Mon, 9 Jul 2012 15:13:43 +0800 Subject: [PATCH 2/8] [General] Added a jquery-plugin for serializing form data to JSON object. --- FILES | 1 + index.html | 1 + src/js/jquery-plugins.js | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 src/js/jquery-plugins.js diff --git a/FILES b/FILES index 015231fd..aa92e48e 100644 --- a/FILES +++ b/FILES @@ -18,6 +18,7 @@ Intel src/js/pageTemplate.js APLv2 N/A Intel src/js/panel.js APLv2 N/A jQuery src/js/jquery-workarounds.js MIT, GPLv2 [6] & Intel & APLv2 +Intel src/js/jquery-plugins.js APLv2 N/A Intel src/js/main.js APLv2 N/A Intel src/js/composer.js APLv2 N/A Intel src/js/codeview-mode.js APLv2 N/A diff --git a/index.html b/index.html index 21e8d05e..7d82e987 100644 --- a/index.html +++ b/index.html @@ -34,6 +34,7 @@ + diff --git a/src/js/jquery-plugins.js b/src/js/jquery-plugins.js new file mode 100644 index 00000000..5770cc5e --- /dev/null +++ b/src/js/jquery-plugins.js @@ -0,0 +1,37 @@ +/* + * Rapid Interface Builder (RIB) - A simple WYSIWYG HTML5 app creator + * Copyright (c) 2011, Intel Corporation. + * + * This program is licensed under the terms and conditions of the + * Apache License, version 2.0. The full text of the Apache License is at + * http://www.apache.org/licenses/LICENSE-2.0 + * + */ + +"use strict"; + +/** + * Serialize form data to JSON object. + * + * Usage: + * $('form').serializeJSON(); + * >> {'a': 'a', 'b': 'b'} + * + */ + +$.fn.serializeJSON = function() +{ + var out = {}; + var arr = this.serializeArray(); + $.each(arr, function() { + if (out[this.name] !== undefined) { + if (!out[this.name].push) { + out[this.name] = [out[this.name]]; + } + out[this.name].push(this.value || ''); + } else { + out[this.name] = this.value || ''; + } + }); + return out; +}; From 2ab7d2d3f3cd1e3365c59f513abce91a4a28df94 Mon Sep 17 00:00:00 2001 From: "Xiaoyang Yu (Max)" Date: Wed, 11 Jul 2012 14:08:40 +0800 Subject: [PATCH 3/8] [Widgets] Add more properties --- src/js/widgets.js | 128 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 106 insertions(+), 22 deletions(-) diff --git a/src/js/widgets.js b/src/js/widgets.js index d807309a..64a5209e 100644 --- a/src/js/widgets.js +++ b/src/js/widgets.js @@ -40,6 +40,11 @@ var BCommonProperties = { defaultValue: "left", htmlAttribute: "data-iconpos" }, + inline: { + type: "boolean", + defaultValue: false, + htmlAttribute: "data-inline", + }, mini: { type: "boolean", defaultValue: false, @@ -51,6 +56,18 @@ var BCommonProperties = { } } }, + nativecontrol: { + displayName: "native control", + type: "boolean", + defaultValue: false, + htmlAttribute: { + name: "data-role", + value: { + true: "none", + false: "" + } + } + }, position: { type: "string", options: [ "default", "fixed" ], @@ -62,7 +79,14 @@ var BCommonProperties = { options: [ "default", "a", "b", "c", "d", "e" ], defaultValue: "default", htmlAttribute: "data-theme" - } + }, + track_theme: { + displayName: "track theme", + type: "string", + options: [ "default", "a", "b", "c", "d", "e" ], + defaultValue: "default", + htmlAttribute: "data-track-theme", + }, }; /** @@ -292,7 +316,12 @@ var BWidgetRegistry = { autoGenerate: "page", htmlAttribute: "id" }, - theme: BCommonProperties.theme + theme: BCommonProperties.theme, + title: { + type: "string", + defaultValue: "", + htmlAttribute: "data-title", + } }, redirect: { zone: "content", @@ -599,6 +628,12 @@ var BWidgetRegistry = { iconpos: $.extend({}, BCommonProperties.iconpos, { invalidIn: "Navbar" }), + iconshadow: { + displayName: "icon shadow", + type: "boolean", + defaultValue: true, + htmlAttribute: "data-iconshadow", + }, mini: BCommonProperties.mini, active: { type: "boolean", @@ -612,12 +647,9 @@ var BWidgetRegistry = { } }, theme: BCommonProperties.theme, - inline: { - type: "boolean", - defaultValue: false, - htmlAttribute: "data-inline", + inline: $.extend({}, BCommonProperties.inline, { invalidIn: "Navbar" - }, + }), transition: { type: "string", options: [ "slide", "slideup", "slidedown", "pop", "fade", @@ -635,7 +667,17 @@ var BWidgetRegistry = { "false": "" } } - } + }, + corners: { + type: "boolean", + defaultValue: true, + htmlAttribute: "data-corners" + }, + shadow: { + type: "boolean", + defaultValue: true, + htmlAttribute: "data-shadow", + }, }, template: '%TEXT%' }, @@ -775,14 +817,18 @@ var BWidgetRegistry = { theme: $.extend({}, BCommonProperties.theme, { htmlSelector: "input" }), - track_theme: $.extend({}, BCommonProperties.theme, { - displayName: "track theme", - htmlAttribute: "data-track-theme", + track_theme: $.extend({}, BCommonProperties.track_theme, { htmlSelector: "input" }), disabled: $.extend({}, BCommonProperties.disabled, { htmlSelector: "input" - }) + }), + highlight: { + type: "boolean", + defaultValue: false, + htmlAttribute: "data-highlight", + htmlSelector: "input", + }, }, editable: { selector: "label", @@ -859,7 +905,10 @@ var BWidgetRegistry = { }, disabled: $.extend({}, BCommonProperties.disabled, { htmlSelector: "input" - }) + }), + nativecontrol: $.extend({}, BCommonProperties.nativecontrol, { + htmlSelector: "input" + }), }, template: '
' }, @@ -891,7 +940,8 @@ var BWidgetRegistry = { type: "string", defaultValue: "" }, - disabled: BCommonProperties.disabled + disabled: BCommonProperties.disabled, + nativecontrol: BCommonProperties.nativecontrol, }, template: '' }, @@ -922,12 +972,17 @@ var BWidgetRegistry = { }, mini: BCommonProperties.mini, theme: BCommonProperties.theme, - disabled: BCommonProperties.disabled + track_theme: BCommonProperties.track_theme, + disabled: BCommonProperties.disabled, + nativecontrol: BCommonProperties.nativecontrol, }, template: '', - // jQM generates a div next to the slider, which is the element actually - // clicked when users try to click the flip toggle switch. - delegate: "next" + delegate: function (domNode, admNode) { + if(admNode.getProperty("nativecontrol") === true) + return $(domNode); + else + return $(domNode).next(); + }, }, /** @@ -1001,7 +1056,12 @@ var BWidgetRegistry = { htmlAttribute: "multiple" }, mini: BCommonProperties.mini, - disabled: BCommonProperties.disabled + disabled: BCommonProperties.disabled, + inline: BCommonProperties.inline, + icon: BCommonProperties.icon, + iconpos: $.extend({}, BCommonProperties.iconpos, { + defaultValue: "right" + }), }, zones: [ { @@ -1127,7 +1187,8 @@ var BWidgetRegistry = { }, checked: BCommonProperties.checked, theme: BCommonProperties.theme, - disabled: BCommonProperties.disabled + disabled: BCommonProperties.disabled, + nativecontrol: BCommonProperties.nativecontrol, }, delegate: 'parent', template: function (node) { @@ -1259,6 +1320,16 @@ var BWidgetRegistry = { htmlAttribute: "data-filter" }, theme: BCommonProperties.theme, + filter_theme: $.extend({}, BCommonProperties.theme, { + displayName: "filter theme", + htmlAttribute: "data-filter-theme" + }), + filter_placeholder: { + displayName: "filter placeholder", + type: "string", + defaultValue: "Filter items...", + htmlAttribute: "data-filter-placeholder" + }, divider: { displayName: "divider theme", type: "string", @@ -1303,6 +1374,12 @@ var BWidgetRegistry = { type: "string", defaultValue: "List Item" }, + filtertext: { + displayName: "filter text", + type: "string", + defaultValue: "List Item", + htmlAttribute: "data-filtertext", + }, theme: BCommonProperties.theme }, template: '
  • %TEXT%
  • ' @@ -1630,7 +1707,13 @@ var BWidgetRegistry = { content_theme: $.extend({}, BCommonProperties.theme, { displayName: "content theme", htmlAttribute: "data-content-theme" - }) + }), + collapsed: { + type: "boolean", + defaultValue: true, + htmlAttribute: "data-collapsed", + }, + iconpos: BCommonProperties.iconpos, }, zones: [ { @@ -1666,7 +1749,8 @@ var BWidgetRegistry = { content_theme: $.extend({}, BCommonProperties.theme, { displayName: "content theme", htmlAttribute: "data-content-theme" - }) + }), + iconpos: BCommonProperties.iconpos, }, zones: [ { From 53ecc5c0e2d08996128d91e04696433fded8eace Mon Sep 17 00:00:00 2001 From: "Xiaoyang Yu (Max)" Date: Wed, 11 Jul 2012 17:01:33 +0800 Subject: [PATCH 4/8] [Widgets] Use "true" instead of true --- src/js/widgets.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/widgets.js b/src/js/widgets.js index 64a5209e..6ecfce8b 100644 --- a/src/js/widgets.js +++ b/src/js/widgets.js @@ -63,8 +63,8 @@ var BCommonProperties = { htmlAttribute: { name: "data-role", value: { - true: "none", - false: "" + "true": "none", + "false": "" } } }, From d4d2d0d2418a163f16717dc5ede350189363fef5 Mon Sep 17 00:00:00 2001 From: John Chen Date: Mon, 25 Jun 2012 16:37:46 +0800 Subject: [PATCH 5/8] [General] Implement msg-box and overide alert and confirm Also refactor css definitions for 'Add device' dialog so that it can be resued by msg-box. --- FILES | 1 + index.html | 1 + src/css/builder.css | 14 +++++---- src/js/msg-box.js | 67 ++++++++++++++++++++++++++++++++++++++++++++ src/js/views/live.js | 2 +- 5 files changed, 78 insertions(+), 7 deletions(-) create mode 100644 src/js/msg-box.js diff --git a/FILES b/FILES index 015231fd..637ed04b 100644 --- a/FILES +++ b/FILES @@ -23,6 +23,7 @@ Intel src/js/composer.js APLv2 N/A Intel src/js/codeview-mode.js APLv2 N/A Intel src/js/devices.js APLv2 N/A Intel src/js/projects.js APLv2 N/A +Intel src/js/msg-box.js APLv2 N/A Intel src/js/views/live.js APLv2 N/A Intel src/js/views/widget.js APLv2 N/A Intel src/js/views/outline.js APLv2 N/A diff --git a/index.html b/index.html index 21e8d05e..e0042ee9 100644 --- a/index.html +++ b/index.html @@ -25,6 +25,7 @@ + diff --git a/src/css/builder.css b/src/css/builder.css index b87caf01..b1f57612 100644 --- a/src/css/builder.css +++ b/src/css/builder.css @@ -1329,13 +1329,15 @@ div.propertyItems label[for|=id] { size: 4; } -.deviceSetting #buttonSet{ - position: absolute; - bottom: 0px; - width: 100%; +p.title { + margin-left:1em; + margin-right: 1em; +} +#buttonSet { + text-align: center; } -.deviceSetting #buttonSet * { - margin: 0 1em 3em 1em; +#buttonSet * { + margin: 1.5em 1em 1.5em 1em; min-width: 25%; } diff --git a/src/js/msg-box.js b/src/js/msg-box.js new file mode 100644 index 00000000..2a88914b --- /dev/null +++ b/src/js/msg-box.js @@ -0,0 +1,67 @@ +/* + * Rapid Interface Builder (RIB) - A simple WYSIWYG HTML5 app creator + * Copyright (c) 2011-2012, Intel Corporation. + * + * This program is licensed under the terms and conditions of the + * Apache License, version 2.0. The full text of the Apache License is at + * http://www.apache.org/licenses/LICENSE-2.0 + * + */ +"use strict"; + +$.rib = $.rib || {}; +/** + * Show a simple message box + * + * @param {String} msg The message that needs to be shown + * @param {Object} buttons The buttons to be shown in the dialog + * and their corresponding callbacks + * For example: {'OK': callback1; "Cancel": callback2} + * @return {None}. + */ +$.rib.msgbox = function (msg, buttons){ + var dlg = $("
    ").append('

    ' + + msg + '

    '), + buttonSet; + var i = 0; + if (buttons) { + buttonSet = $('
    ').appendTo(dlg); + $.each(buttons, function (caption, callback) { + buttonSet.append($('