Permalink
Browse files

If text attribute is given it switches to string, also took out place…

…holder text in template views as we're using a label, and included text type option in template views for one day when we do have a text type
  • Loading branch information...
1 parent cf98bac commit 9e2a69d76a8ce66746f921e9a2d55bd773544160 @larzconwell larzconwell committed Aug 25, 2012
View
@@ -52,11 +52,22 @@ namespace('gen', function () {
type = type.replace(/:.*/g, '');
// Defaults and alias's
- if(!type) type = 'string';
- if(type === 'integer') type = 'int';
- if(type === 'bool') type = 'boolean';
- if(args === 'def') args = 'default';
- if(type === 'default' || type === 'def') {
+ if (!type) {
+ type = 'string';
+ }
+ if (type === 'text') {
+ type = 'string';
@OscarGodson

OscarGodson Aug 26, 2012

Contributor

This is nice :) at least geddy wont die when you start it up for the first time after someone puts "text" in there. 👍

@mde

mde Aug 26, 2012

Contributor

Nice. :)

@larzconwell

larzconwell Aug 26, 2012

Contributor

I even included the spaces in between if () just for you @mde (; Haha

+ }
+ if (type === 'integer') {
+ type = 'int';
+ }
+ if (type === 'bool') {
+ type = 'boolean';
+ }
+ if (args === 'def') {
+ args = 'default';
+ }
+ if (type === 'default' || type === 'def') {
// If the type is `default` assume they want `string`
// type and want this property to be default
type = 'string';
@@ -18,12 +18,14 @@
<div class="controls">
<% if(properties[i].type === 'string') { -%>
<% if(properties[i].name === 'password') { -%>
- <@- contentTag('input', '', {type:'password', class:'span6', placeholder:'enter <%= properties[i].name %>', name:'<%= properties[i].name %>'}) @>
+ <@- contentTag('input', '', {type:'password', class:'span6', name:'<%= properties[i].name %>'}) @>
<% } else { -%>
- <@- contentTag('input', '', {type:'text', class:'span6', placeholder:'enter <%= properties[i].name %>', name:'<%= properties[i].name %>'}) @>
+ <@- contentTag('input', '', {type:'text', class:'span6', name:'<%= properties[i].name %>'}) @>
<% } -%>
+<% } else if(properties[i].type === 'text') { -%>
+ <@- contentTag('textarea', '', {class: 'span6', name: '<%= properties[i].name %>', rows: 10}) @>
<% } else if(properties[i].type === 'number' || properties[i].type === 'int') { -%>
- <@- contentTag('input', '', {type:'number', class:'span2', placeholder:'enter <%= properties[i].name %>', name:'<%= properties[i].name %>'}) @>
+ <@- contentTag('input', '', {type:'number', class:'span2', name:'<%= properties[i].name %>'}) @>
<% } else if(properties[i].type === 'boolean') { -%>
<select name="<%= properties[i].name %>", class="span1">
<option selected>false</option>
@@ -18,12 +18,14 @@
<div class="controls">
<% if(properties[i].type === 'string') { -%>
<% if(properties[i].name === 'password') { -%>
- <@- contentTag('input', '', {type:'password', class:'span6', placeholder:'enter <%= properties[i].name %>', name:'<%= properties[i].name %>'}) @>
+ <@- contentTag('input', '', {type:'password', class:'span6', name:'<%= properties[i].name %>'}) @>
<% } else { -%>
- <@- contentTag('input', <%= names.property.singular %>.<%= properties[i].name %>, {type:'text', class:'span6', placeholder:'enter <%= properties[i].name %>', name:'<%= properties[i].name %>'}) @>
+ <@- contentTag('input', <%= names.property.singular %>.<%= properties[i].name %>, {type:'text', class:'span6', name:'<%= properties[i].name %>'}) @>
<% } -%>
+<% } else if(properties[i].type === 'text') { -%>
+ <@- contentTag('textarea', '', {class: 'span6', name: '<%= properties[i].name %>', rows: 10}) @>
<% } else if(properties[i].type === 'number' || properties[i].type === 'int') { -%>
- <@- contentTag('input', <%= names.property.singular %>.<%= properties[i].name %>, {type:'number', class:'span2', placeholder:'enter <%= properties[i].name %>', name:'<%= properties[i].name %>'}) @>
+ <@- contentTag('input', <%= names.property.singular %>.<%= properties[i].name %>, {type:'number', class:'span2', name:'<%= properties[i].name %>'}) @>
<% } else if(properties[i].type === 'boolean') { -%>
<select name="<%= properties[i].name %>", class="span1">
<@ if(<%= names.property.singular %>.<%= properties[i].name %>) { -@>
@@ -15,12 +15,14 @@
.controls
<% if(properties[i].type === 'string') { -%>
<% if(properties[i].name === 'password') { -%>
- != contentTag('input', '', {type:'password', class:'span6', placeholder:'enter <%= properties[i].name %>', name:'<%= properties[i].name %>'})
+ != contentTag('input', '', {type:'password', class:'span6', name:'<%= properties[i].name %>'})
<% } else { -%>
- != contentTag('input', '', {type:'text', class:'span6', placeholder:'enter <%= properties[i].name %>', name:'<%= properties[i].name %>'})
+ != contentTag('input', '', {type:'text', class:'span6', name:'<%= properties[i].name %>'})
<% } -%>
+<% } else if(properties[i].type === 'text') { -%>
+ != contentTag('textarea', '', {class: 'span6', name: '<%= properties[i].name %>', rows: 10})
<% } else if(properties[i].type === 'number' || properties[i].type === 'int') { -%>
- != contentTag('input', '', {type:'number', class:'span2', placeholder:'enter <%= properties[i].name %>', name:'<%= properties[i].name %>'})
+ != contentTag('input', '', {type:'number', class:'span2', name:'<%= properties[i].name %>'})
<% } else if(properties[i].type === 'boolean') { -%>
select.span1(name="<%= properties[i].name %>")
option(selected) false
@@ -15,12 +15,14 @@
.controls
<% if(properties[i].type === 'string') { -%>
<% if(properties[i].name === 'password') { -%>
- != contentTag('input', '', {type:'password', class:'span6', placeholder:'enter <%= properties[i].name %>', name:'<%= properties[i].name %>'})
+ != contentTag('input', '', {type:'password', class:'span6', name:'<%= properties[i].name %>'})
<% } else { -%>
- != contentTag('input', <%= names.property.singular %>.<%= properties[i].name %>, {type:'text', class:'span6', placeholder:'enter <%= properties[i].name %>', name:'<%= properties[i].name %>'})
+ != contentTag('input', <%= names.property.singular %>.<%= properties[i].name %>, {type:'text', class:'span6', name:'<%= properties[i].name %>'})
<% } -%>
+<% } else if(properties[i].type === 'text') { -%>
+ != contentTag('textarea', '', {class: 'span6', name: '<%= properties[i].name %>', rows: 10})
<% } else if(properties[i].type === 'number' || properties[i].type === 'int') { -%>
- != contentTag('input', <%= names.property.singular %>.<%= properties[i].name %>, {type:'number', class:'span2', placeholder:'enter <%= properties[i].name %>', name:'<%= properties[i].name %>'})
+ != contentTag('input', <%= names.property.singular %>.<%= properties[i].name %>, {type:'number', class:'span2', name:'<%= properties[i].name %>'})
<% } else if(properties[i].type === 'boolean') { -%>
select.span1(name="<%= properties[i].name %>")
if <%= names.property.singular %>.<%= properties[i].name %>

0 comments on commit 9e2a69d

Please sign in to comment.