New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Widgets] "previous page" becomes a target #186

Closed
wants to merge 1 commit into
base: master
from
Jump to file or symbol
Failed to load files and symbols.
+40 −20
Diff settings

Always

Just for now

[Widgets] "previous page" becomes a target

  • Loading branch information...
maxyu committed Aug 3, 2012
commit 69dee1080bd46f0f8466b91ef15b64375289edc7
View
@@ -61,13 +61,29 @@ var DEBUG = true,
attrName = BWidget.getPropertyHTMLAttribute(node.getType(), propName);
propValue = newValue || node.getProperty(propName);
attrValue = propValue;
if (typeof attrName === "function") {
attrName = attrName(propValue);
}
if (typeof attrName === "object") {
attrMap = attrName;
attrName = attrMap.name;
if (typeof attrMap.value === "function")
attrValue = attrMap.value(propValue);
else
attrValue = attrMap.value[propValue];
attrValue = attrMap.value;
switch(typeof(attrValue)) {
case "function":
attrValue = attrValue(propValue);
break;
case "object":
attrValue = attrValue[propValue];
break;
case "string":
break;
case "undefined":
break;
case "boolean":
break;
default:
throw "attrValue type can not be handled";
}
}
return {"name": attrName,
"value": attrValue};
View
@@ -391,6 +391,7 @@
var o, items = "", pages, id,
value = e.data.value, p = e.data.p;
items += '<li>previous page</li>';
pages = ADM.getDesignRoot().getChildren();
for (o = 0; o < pages.length; o++) {
id = pages[o].getProperty('id');
@@ -423,10 +424,14 @@
default:
// handle property has options
if (options[p]) {
$('<select size="1">')
.attr('id', valueId)
.addClass('title')
.appendTo(value);
$('<select size="1">').attr('id', valueId)
.addClass('title')
.appendTo(value);
if(type === 'Button' && p === 'opentargetas'
&& node.getProperty('target') ===
'previous page') {
value.find('#'+valueId).attr('disabled', 'disabled');
}
//add options to select list
for (o in options[p]) {
//TODO make it simple
@@ -466,8 +471,12 @@
value = validValue($(this),
BWidget.getPropertyType(node.getType(), updated));
ret = ADM.setProperty(node, updated, value);
type = node.getType();
if(ret.result === false) {
$(this).val(node.getProperty(updated));
} else if(type === "Button" &&
value === "previous page") {
ADM.setProperty(node, "opentargetas", "default");
}
event.stopPropagation();
return false;
View
@@ -660,7 +660,13 @@ var BWidgetRegistry = {
target: {
type: "targetlist",
defaultValue: "",
htmlAttribute: "href"
htmlAttribute: function(value) {
if (value === "previous page") {
return {"name": "data-rel", "value": "back"};
} else {
return {"name": "href", "value": value};
}
}
},
opentargetas : {
type: "string",
@@ -702,17 +708,6 @@ var BWidgetRegistry = {
defaultValue: "slide",
htmlAttribute: "data-transition"
},
back: {
type: "boolean",
defaultValue: false,
htmlAttribute: {
name: "data-rel",
value: {
"true": "back",
"false": ""
}
}
},
corners: {
type: "boolean",
defaultValue: true,
ProTip! Use n and p to navigate between commits in a pull request.