Skip to content

Commit

Permalink
add ability to handle RadioGroup and LabelGroup.
Browse files Browse the repository at this point in the history
  • Loading branch information
ramnathv committed Jul 1, 2016
1 parent 281e840 commit 75c61f8
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions R/toYaml.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ toYaml.TextBox = function(type, g){
}

toYaml.BooleanGroup = function(type, g){
x = xmlToList(g)
x <- if (is.list(g)) g else xmlToList(g)
list(
dataName = x$Name,
type = "CheckBox",
Expand Down Expand Up @@ -106,9 +106,28 @@ toKeyValuePairs <- function(x){
}
}

toYaml.LabelGroup <- function(type, g2){
x <- xmlToList(g2)
x1 <- x$Questions
x2 <- lapply(x1, function(y){
toYaml(structure(y$Type, class = y$Type), y)
})
}

toYaml.RadioGroup = function(type, g){
x <- if (is.list(g)) g else xmlToList(g)
list(
dataName = x$Name,
type = "RadioButton",
text = x$Description,
group = 'radioTest1',
default = tolower(bool_map(x$Default[['value']]))
)
}

renderToYaml <- function(g){
x = xmlToList(g)
types = c("FileBrowse", "TextBox", "BooleanGroup", "ListBox", "NumericUpDown", "Date")
types = c("FileBrowse", "TextBox", "BooleanGroup", "ListBox", "NumericUpDown", "Date", "RadioGroup")
if (x$Type %in% types){
toYaml(structure(x$Type, class = x$Type), g)
} else {
Expand Down

0 comments on commit 75c61f8

Please sign in to comment.