Skip to content

Commit

Permalink
Extracted "spaced" util out of the "inline" util.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmihajlovski committed Mar 23, 2015
1 parent eb2d240 commit ee8fe01
Showing 1 changed file with 10 additions and 4 deletions.
Expand Up @@ -729,16 +729,22 @@ private static Object display(Iterator<?> it) {
return wrap;
}

public static Tag inline(Object... contents) {
Tag ctrls = div().class_("form-group");
public static Object[] spaced(Object... contents) {
Object[] arr = new Object[2 * contents.length - 1];

int index = 0;
for (int i = 0; i < contents.length; i++) {
if (i > 0) {
ctrls = ctrls.append(NBSP);
arr[index++] = NBSP;
}
ctrls = ctrls.append(contents[i]);
arr[index++] = contents[i];
}

return arr;
}

public static Tag inline(Object... contents) {
Tag ctrls = div(spaced(contents)).class_("form-group");
return form(ctrls).class_("form-inline");
}

Expand Down

0 comments on commit ee8fe01

Please sign in to comment.