evolutility
Advanced tools
Comparing version 0.1.0 to 0.2.0
{ | ||
"name": "evolutility", | ||
"version": "0.1.0", | ||
"version": "0.2", | ||
"dependencies": { | ||
@@ -5,0 +5,0 @@ "jquery": "2.1.1", |
@@ -1,2 +0,2 @@ | ||
/* evolutility v0.1 sample UI-models and data: todo, addressbook, wine cellar. */ | ||
var todo_ui={id:"evol-todo",label:"To Do",entity:"task",entities:"tasks",icon:"todo.gif",leadfield:"title",elements:[{type:"panel",label:"Task",width:62,elements:[{id:"title",type:"text",label:"Title",required:!0,placeholder:"Call John",css:"FieldMain",maxlength:255,width:100,viewmany:!0},{id:"duedate",type:"date",label:"Due Date",width:62,viewmany:!0},{id:"category",type:"lov",label:"Category",width:38,viewmany:!0,list:[{id:"home",text:"Home"},{id:"work",text:"Work"},{id:"fun",text:"Fun"},{id:"others",text:"Others"},{id:"misc",text:"Misc."}]}]},{type:"panel",label:"Status",width:38,elements:[{id:"priority",type:"lov",label:"Priority",required:!0,width:100,viewmany:!0,list:[{id:"1",text:"1 - ASAP"},{id:"2",text:"2 - Urgent"},{id:"3",text:"3 - Important"},{id:"4",text:"4 - Medium"},{id:"5",text:"5 - Low"}]},{id:"complete",type:"boolean",label:"Complete",width:100,viewmany:!0}]},{type:"panel",label:"Notes",width:100,elements:[{id:"notes",type:"textmultiline",label:"Notes",maxlength:1e3,width:100,height:6,viewmany:!1}]}]},todo_data=[{id:"322",title:"Add routing to Evolutility",priority:"2",category:"others",complete:!1,notes:"Use Backbone router."},{id:"304",title:"Fix open bugs",duedate:"2014-07-25",priority:"3",category:"work",complete:!1,notes:"bla bla"},{id:"335",title:"Testing App",duedate:"2014-06-11",priority:"3",category:"work",complete:!1,notes:"test"},{id:"343",title:"Prepare demo",duedate:"2014-05-12",priority:"1",category:"work",complete:!1,notes:"Check this out"},{id:"344",title:"Test latest code",priority:"5",category:"misc",complete:!0,notes:"notes for my test todo task."},{id:"346",title:"Car wash",priority:"4",category:"work",complete:!1,notes:""},{id:"347",title:"Watch Inception",duedate:"2014-01-10",priority:"5",category:"fun",complete:!0,notes:""},{id:"348",title:"Test TODO",duedate:"2015-01-01",priority:"1",category:"work",complete:!0,notes:"Test TODO "}],contacts_LOVs={categories:[{id:"1",text:"Work"},{id:"2",text:"Fun"},{id:"3",text:"Travel"},{id:"4",text:"Business"},{id:"5",text:"Cars"},{id:"6",text:"Sport"},{id:"7",text:"Misc."}],states:[{id:"AL",text:"Alabama"},{id:"AK",text:"Alaska"},{id:"AZ",text:"Arizona"},{id:"AR",text:"Arkansas"},{id:"CA",text:"California"},{id:"CO",text:"Colorado"},{id:"CT",text:"Connecticut"},{id:"DE",text:"Delaware"},{id:"DC",text:"District of Columbia"},{id:"FL",text:"Florida"},{id:"GA",text:"Georgia"},{id:"HI",text:"Hawaii"},{id:"ID",text:"Idaho"},{id:"IL",text:"Illinois"},{id:"IN",text:"Indiana"},{id:"IA",text:"Iowa"},{id:"KS",text:"Kansas"},{id:"KY",text:"Kentucky"},{id:"LA",text:"Louisiana"},{id:"ME",text:"Maine"},{id:"MD",text:"Maryland"},{id:"MA",text:"Massachusetts"},{id:"MI",text:"Michigan"},{id:"MN",text:"Minnesota"},{id:"MS",text:"Mississippi"},{id:"MO",text:"Missouri"},{id:"MT",text:"Montana"},{id:"NE",text:"Nebraska"},{id:"NV",text:"Nevada"},{id:"NH",text:"New Hampshire"},{id:"NJ",text:"New Jersey"},{id:"NM",text:"New Mexico"},{id:"NY",text:"New York"},{id:"NC",text:"North Carolina"},{id:"ND",text:"North Dakota"},{id:"OH",text:"Ohio"},{id:"OK",text:"Oklahoma"},{id:"OR",text:"Oregon"},{id:"PA",text:"Pennsylvania"},{id:"RI",text:"Rhode Island"},{id:"SC",text:"South Carolina"},{id:"SD",text:"South Dakota"},{id:"TN",text:"Tennessee"},{id:"TX",text:"Texas"},{id:"UT",text:"Utah"},{id:"VT",text:"Vermont"},{id:"VA",text:"Virginia"},{id:"WA",text:"Washington"},{id:"WV",text:"West Virginia"},{id:"WI",text:"Wisconsin"},{id:"WY",text:"Wyoming"}],countries:[{text:"Afghanistan",id:"AF"},{text:"Åland Islands",id:"AX"},{text:"Albania",id:"AL"},{text:"Algeria",id:"DZ"},{text:"American Samoa",id:"AS"},{text:"Andorra",id:"AD"},{text:"Angola",id:"AO"},{text:"Anguilla",id:"AI"},{text:"Antarctica",id:"AQ"},{text:"Antigua and Barbuda",id:"AG"},{text:"Argentina",id:"AR"},{text:"Armenia",id:"AM"},{text:"Aruba",id:"AW"},{text:"Australia",id:"AU"},{text:"Austria",id:"AT"},{text:"Azerbaijan",id:"AZ"},{text:"Bahamas",id:"BS"},{text:"Bahrain",id:"BH"},{text:"Bangladesh",id:"BD"},{text:"Barbados",id:"BB"},{text:"Belarus",id:"BY"},{text:"Belgium",id:"BE"},{text:"Belize",id:"BZ"},{text:"Benin",id:"BJ"},{text:"Bermuda",id:"BM"},{text:"Bhutan",id:"BT"},{text:"Bolivia",id:"BO"},{text:"Bosnia and Herzegovina",id:"BA"},{text:"Botswana",id:"BW"},{text:"Bouvet Island",id:"BV"},{text:"Brazil",id:"BR"},{text:"British Indian Ocean Territory",id:"IO"},{text:"Brunei Darussalam",id:"BN"},{text:"Bulgaria",id:"BG"},{text:"Burkina Faso",id:"BF"},{text:"Burundi",id:"BI"},{text:"Cambodia",id:"KH"},{text:"Cameroon",id:"CM"},{text:"Canada",id:"CA"},{text:"Cape Verde",id:"CV"},{text:"Cayman Islands",id:"KY"},{text:"Central African Republic",id:"CF"},{text:"Chad",id:"TD"},{text:"Chile",id:"CL"},{text:"China",id:"CN"},{text:"Christmas Island",id:"CX"},{text:"Cocos (Keeling) Islands",id:"CC"},{text:"Colombia",id:"CO"},{text:"Comoros",id:"KM"},{text:"Congo",id:"CG"},{text:"Congo, The Democratic Republic of the",id:"CD"},{text:"Cook Islands",id:"CK"},{text:"Costa Rica",id:"CR"},{text:"Cote D'Ivoire",id:"CI"},{text:"Croatia",id:"HR"},{text:"Cuba",id:"CU"},{text:"Cyprus",id:"CY"},{text:"Czech Republic",id:"CZ"},{text:"Denmark",id:"DK"},{text:"Djibouti",id:"DJ"},{text:"Dominica",id:"DM"},{text:"Dominican Republic",id:"DO"},{text:"Ecuador",id:"EC"},{text:"Egypt",id:"EG"},{text:"El Salvador",id:"SV"},{text:"Equatorial Guinea",id:"GQ"},{text:"Eritrea",id:"ER"},{text:"Estonia",id:"EE"},{text:"Ethiopia",id:"ET"},{text:"Falkland Islands (Malvinas)",id:"FK"},{text:"Faroe Islands",id:"FO"},{text:"Fiji",id:"FJ"},{text:"Finland",id:"FI"},{text:"France",id:"FR"},{text:"French Guiana",id:"GF"},{text:"French Polynesia",id:"PF"},{text:"French Southern Territories",id:"TF"},{text:"Gabon",id:"GA"},{text:"Gambia",id:"GM"},{text:"Georgia",id:"GE"},{text:"Germany",id:"DE"},{text:"Ghana",id:"GH"},{text:"Gibraltar",id:"GI"},{text:"Greece",id:"GR"},{text:"Greenland",id:"GL"},{text:"Grenada",id:"GD"},{text:"Guadeloupe",id:"GP"},{text:"Guam",id:"GU"},{text:"Guatemala",id:"GT"},{text:"Guernsey",id:"GG"},{text:"Guinea",id:"GN"},{text:"Guinea-Bissau",id:"GW"},{text:"Guyana",id:"GY"},{text:"Haiti",id:"HT"},{text:"Heard Island and Mcdonald Islands",id:"HM"},{text:"Holy See (Vatican City State)",id:"VA"},{text:"Honduras",id:"HN"},{text:"Hong Kong",id:"HK"},{text:"Hungary",id:"HU"},{text:"Iceland",id:"IS"},{text:"India",id:"IN"},{text:"Indonesia",id:"ID"},{text:"Iran, Islamic Republic Of",id:"IR"},{text:"Iraq",id:"IQ"},{text:"Ireland",id:"IE"},{text:"Isle of Man",id:"IM"},{text:"Israel",id:"IL"},{text:"Italy",id:"IT"},{text:"Jamaica",id:"JM"},{text:"Japan",id:"JP"},{text:"Jersey",id:"JE"},{text:"Jordan",id:"JO"},{text:"Kazakhstan",id:"KZ"},{text:"Kenya",id:"KE"},{text:"Kiribati",id:"KI"},{text:"Korea, Democratic People'S Republic of",id:"KP"},{text:"Korea, Republic of",id:"KR"},{text:"Kuwait",id:"KW"},{text:"Kyrgyzstan",id:"KG"},{text:"Lao People'S Democratic Republic",id:"LA"},{text:"Latvia",id:"LV"},{text:"Lebanon",id:"LB"},{text:"Lesotho",id:"LS"},{text:"Liberia",id:"LR"},{text:"Libyan Arab Jamahiriya",id:"LY"},{text:"Liechtenstein",id:"LI"},{text:"Lithuania",id:"LT"},{text:"Luxembourg",id:"LU"},{text:"Macao",id:"MO"},{text:"Macedonia, The Former Yugoslav Republic of",id:"MK"},{text:"Madagascar",id:"MG"},{text:"Malawi",id:"MW"},{text:"Malaysia",id:"MY"},{text:"Maldives",id:"MV"},{text:"Mali",id:"ML"},{text:"Malta",id:"MT"},{text:"Marshall Islands",id:"MH"},{text:"Martinique",id:"MQ"},{text:"Mauritania",id:"MR"},{text:"Mauritius",id:"MU"},{text:"Mayotte",id:"YT"},{text:"Mexico",id:"MX"},{text:"Micronesia, Federated States of",id:"FM"},{text:"Moldova, Republic of",id:"MD"},{text:"Monaco",id:"MC"},{text:"Mongolia",id:"MN"},{text:"Montserrat",id:"MS"},{text:"Morocco",id:"MA"},{text:"Mozambique",id:"MZ"},{text:"Myanmar",id:"MM"},{text:"Namibia",id:"NA"},{text:"Nauru",id:"NR"},{text:"Nepal",id:"NP"},{text:"Netherlands",id:"NL"},{text:"Netherlands Antilles",id:"AN"},{text:"New Caledonia",id:"NC"},{text:"New Zealand",id:"NZ"},{text:"Nicaragua",id:"NI"},{text:"Niger",id:"NE"},{text:"Nigeria",id:"NG"},{text:"Niue",id:"NU"},{text:"Norfolk Island",id:"NF"},{text:"Northern Mariana Islands",id:"MP"},{text:"Norway",id:"NO"},{text:"Oman",id:"OM"},{text:"Pakistan",id:"PK"},{text:"Palau",id:"PW"},{text:"Palestinian Territory, Occupied",id:"PS"},{text:"Panama",id:"PA"},{text:"Papua New Guinea",id:"PG"},{text:"Paraguay",id:"PY"},{text:"Peru",id:"PE"},{text:"Philippines",id:"PH"},{text:"Pitcairn",id:"PN"},{text:"Poland",id:"PL"},{text:"Portugal",id:"PT"},{text:"Puerto Rico",id:"PR"},{text:"Qatar",id:"QA"},{text:"Reunion",id:"RE"},{text:"Romania",id:"RO"},{text:"Russian Federation",id:"RU"},{text:"RWANDA",id:"RW"},{text:"Saint Helena",id:"SH"},{text:"Saint Kitts and Nevis",id:"KN"},{text:"Saint Lucia",id:"LC"},{text:"Saint Pierre and Miquelon",id:"PM"},{text:"Saint Vincent and the Grenadines",id:"VC"},{text:"Samoa",id:"WS"},{text:"San Marino",id:"SM"},{text:"Sao Tome and Principe",id:"ST"},{text:"Saudi Arabia",id:"SA"},{text:"Senegal",id:"SN"},{text:"Serbia and Montenegro",id:"CS"},{text:"Seychelles",id:"SC"},{text:"Sierra Leone",id:"SL"},{text:"Singapore",id:"SG"},{text:"Slovakia",id:"SK"},{text:"Slovenia",id:"SI"},{text:"Solomon Islands",id:"SB"},{text:"Somalia",id:"SO"},{text:"South Africa",id:"ZA"},{text:"South Georgia and the South Sandwich Islands",id:"GS"},{text:"Spain",id:"ES"},{text:"Sri Lanka",id:"LK"},{text:"Sudan",id:"SD"},{text:"Suriname",id:"SR"},{text:"Svalbard and Jan Mayen",id:"SJ"},{text:"Swaziland",id:"SZ"},{text:"Sweden",id:"SE"},{text:"Switzerland",id:"CH"},{text:"Syrian Arab Republic",id:"SY"},{text:"Taiwan, Province of China",id:"TW"},{text:"Tajikistan",id:"TJ"},{text:"Tanzania, United Republic of",id:"TZ"},{text:"Thailand",id:"TH"},{text:"Timor-Leste",id:"TL"},{text:"Togo",id:"TG"},{text:"Tokelau",id:"TK"},{text:"Tonga",id:"TO"},{text:"Trinidad and Tobago",id:"TT"},{text:"Tunisia",id:"TN"},{text:"Turkey",id:"TR"},{text:"Turkmenistan",id:"TM"},{text:"Turks and Caicos Islands",id:"TC"},{text:"Tuvalu",id:"TV"},{text:"Uganda",id:"UG"},{text:"Ukraine",id:"UA"},{text:"United Arab Emirates",id:"AE"},{text:"United Kingdom",id:"GB"},{text:"United States",id:"US"},{text:"United States Minor Outlying Islands",id:"UM"},{text:"Uruguay",id:"UY"},{text:"Uzbekistan",id:"UZ"},{text:"Vanuatu",id:"VU"},{text:"Venezuela",id:"VE"},{text:"Viet Nam",id:"VN"},{text:"Virgin Islands, British",id:"VG"},{text:"Virgin Islands, U.S.",id:"VI"},{text:"Wallis and Futuna",id:"WF"},{text:"Western Sahara",id:"EH"},{text:"Yemen",id:"YE"},{text:"Zambia",id:"ZM"},{text:"Zimbabwe",id:"ZW"}]},contacts_ui={id:"evol-contact",label:"Address book",icon:"contact.gif",entity:"contact",entities:"contacts",leadfield:function(a){return a.get("firstname")+" "+a.get("lastname")},elements:[{type:"panel",label:"Identity",width:62,elements:[{type:"text",id:"lastname",label:"Lastname",maxlength:50,required:!0,css:"FieldMain",width:"62",viewmany:!0},{type:"text",id:"firstname",label:"Firstname",maxlength:50,required:!0,css:"FieldMain",width:38,viewmany:!0},{type:"text",id:"jobtitle",label:"Title",maxlength:50,width:62},{type:"text",id:"company",label:"Company",maxlength:50,width:38,viewmany:!0},{type:"email",id:"email",label:"email",maxlength:255,width:100,viewmany:!0},{type:"url",id:"web",label:"web",maxlength:255,width:100}]},{type:"panel",label:"Contact Info",width:38,elements:[{type:"text",id:"phone",label:"Work Phone",maxlength:20,width:100},{type:"text",id:"phonehome",label:"Home Phone",maxlength:20,width:100},{type:"text",id:"phonecell",label:"Cell.",maxlength:20,width:100,mini:"1"},{type:"text",id:"fax",label:"Fax",maxlength:20,width:100}]},{type:"panel",label:"Address",width:62,elements:[{type:"text",id:"address1",label:"Address",maxlength:150,width:100},{type:"text",id:"address2",label:"",labellist:"Address 2",maxlength:150,width:100},{type:"text",id:"city",label:"City",maxlength:100,width:62},{type:"lov",id:"state",label:"State",maxlength:3,width:15,list:contacts_LOVs.states},{type:"text",id:"zip",label:"Zip",maxlength:12,width:23},{type:"lov",id:"country",label:"Country",maxlength:60,width:100,list:contacts_LOVs.countries}]},{type:"panel",label:"Misc.",width:38,elements:[{type:"lov",id:"category",label:"Category",width:100,viewmany:!0,list:contacts_LOVs.categories},{type:"text",id:"custom1",label:"Custom 1",maxlength:250,width:100},{type:"text",id:"custom2",label:"Custom 2",maxlength:250,width:100},{type:"text",id:"custom3",label:"Custom 3",maxlength:250,width:100}]}]},contacts_data=[{id:"690",lastname:"Smallwood",firstname:"Vincent",jobtitle:"Director",company:"EasyDoesIt",email:"vsw@EasyDoesIt.com",phone:"415 234 4323",phonehome:"415 378 3577",phonecell:"415 135 3454",web:"http://EasyDoesIt.com",address1:"12, Liverpool Street",city:"San Francisco",state:"CA",zip:"94123",country:"US",category:"4"},{id:"733",lastname:"Shackleford ",firstname:"Rusty ",email:"rustyshackleford@gmail.com",phone:"",address1:"123 Main Street",city:"Dallas",state:"TX",zip:"",country:"US",category:"3"},{id:"749",lastname:"Test",firstname:"Testing",jobtitle:"QA Engineer",company:"Testing evol-utility",email:"test@test.com",phone:"423 233 3523",phonehome:"423 523 4523",phonecell:"242342",fax:"3423423",url:"sdfsdf",address1:"5665 Poplar Street",city:"San Jose",state:"CA",zip:"93112",country:"US",category:"3"},{id:"759",lastname:"Reina Moyano",firstname:"Sergio",jobtitle:"Mr",company:"Innova Creaciones",email:"sreina@innovacreaciones.es",phone:"411 444 2222",phonehome:"411 576 4566",phonecell:"411 579 4566",fax:"411 444 2224",address1:"654 Union Street",address2:"#203",city:"San Francisco",state:"CA",zip:"94567",country:"US",category:"3"},{id:"770",lastname:"Paulus",firstname:"Henry",jobtitle:"",company:"TEST the TEST",phone:"652 491 2345",address1:"1234 That Street",city:"",state:"",zip:"",country:"US",category:"2"},{id:"775",lastname:"Dupond",firstname:"Patrick",jobtitle:"Sales Manager",company:"Au Bon Pain",email:"pdupond@aubonpain.fr",phone:"45 456 414 45",url:"http://aubonpain.fr",city:"Paris",country:"FR",category:"1"},{id:"779",lastname:"Doe",firstname:"John",company:"Evolutility",email:"evolutility@evolutility.org",url:"http://www.evol-utility.org"},{id:"802",lastname:"Martin",firstname:"Paul",jobtitle:"President",company:"Acme Corp",email:"pm@acme.com",phone:"444 580 7007",phonehome:"449 512 0230",phonecell:"589 499 2065",fax:"",url:"",address1:"123 Redville Lane",city:"Musnonville",state:"NH",zip:"03434",country:"",category:"1"},{id:"812",lastname:"Munar",firstname:"Roman",jobtitle:"Mr",company:"Informatics",email:"romano@yehey.com",phone:"322 234 5143",phonehome:"322 784 3453",phonecell:"322 538 2568",fax:"322 234 5345",url:"http://roman.munar.com",address1:"Washington",address2:"Buendia",city:"Makati",state:"",zip:"1300",country:"PH",category:"3"}],winecellar_lovs={bottleSize:[{id:750,text:"750 ml"},{id:500,text:"500 ml"},{id:375,text:"375 cl"},{id:1500,text:"1.5 L"},{id:3e3,text:"3.0 L"},{id:6e3,text:"6.0 L"},{id:8e3,text:"8.0 L"}],grape:[{id:"chard",text:"Chardonnay"},{id:"shiraz",text:"Shiraz"},{id:"merlo",text:"Merlot"},{id:"pino",text:"Pinot Noir"},{id:"cab",text:"Cabernet"},{id:"zin",text:"Zinfandel"},{id:"sauv",text:"Sauvignon"},{id:"cabsau",text:"Cabernet Sauvignon"},{id:"aligo",text:"Aligoté"},{id:"alva",text:"Alvarinho"},{id:"bf",text:"Blanc Fumé"},{id:"bual",text:"Bual"},{id:"carg",text:"Carignan"},{id:"chass",text:"Chasselas"},{id:"cb",text:"Chemin Blanc"},{id:"cin",text:"Cinsault"},{id:"clair",text:"Clairette"},{id:"colomb",text:"Colombard"},{id:"counoi",text:"Counoise"},{id:"fdt",text:"Fendant"},{id:"fb",text:"Folle Blanche"},{id:"f",text:"Fürmint"},{id:"gamay",text:"Gamay"},{id:"gewurz",text:"Gewürztraminer"},{id:"graub",text:"Grauburgunder"},{id:"grct",text:"Grechetto"},{id:"gb",text:"Grenache Blanc"},{id:"gn",text:"Grenache Noir"},{id:"gp",text:"Gros Plan"},{id:"gv",text:"Grüner Veltliner"},{id:"ir",text:"Italienischer Riestling"},{id:"ka",text:"Kadarka"},{id:"ker",text:"Kerner"},{id:"mcb",text:"Macabeo"},{id:"malm",text:"Malmsey"},{id:"malv",text:"Malvasier"},{id:"mars",text:"Marsanne"},{id:"mdb",text:"Melon de Bourgogne"},{id:"mourv",text:"Mourvèdre"},{id:"mt",text:"Müller-Thurgau"},{id:"mu1",text:"Muscadelle"},{id:"mu2",text:"Muscadet"},{id:"mu3",text:"Musca"},{id:"mu4",text:"Musca d'Alsace"},{id:"mu5",text:"Muskateller"},{id:"neb",text:"Nebbiolo"},{id:"pal",text:"Palomino"},{id:"px",text:"Pedro Ximérez"},{id:"pv",text:"Petit Verdot"},{id:"pb",text:"Pinot Blanc"},{id:"pg",text:"Pinot Gris"},{id:"pn",text:"Pinot Noir"},{id:"pi",text:"Pinotage"},{id:"riesling",text:"Riesling"},{id:"rul",text:"Ruländer"},{id:"sang",text:"Sangiovese"},{id:"sb",text:"Sauvignon Blanc"},{id:"sc",text:"Scheurebe"},{id:"sem",text:"Sémilion"},{id:"ser",text:"Sercial"},{id:"sb2",text:"Seyval Blanc"},{id:"sieg",text:"Siegerrebe"},{id:"silv",text:"Silvaner"},{id:"spa",text:"Spätburgunder"},{id:"steen",text:"Steen"},{id:"syrah",text:"Syrah"},{id:"temp",text:"Tempranillo"},{id:"tokay",text:"Tokay"},{id:"tram",text:"Traminer"},{id:"treb",text:"Trebbiano"},{id:"ub",text:"Ugni Blanc"},{id:"verd",text:"Verdejo"},{id:"verdh",text:"Verdelho"},{id:"verm",text:"Vermentino"},{id:"vern",text:"Vernaccia"},{id:"vio",text:"Viognier"},{id:"viu",text:"Viura"},{id:"w",text:"Weißburgunder"}],type:[{id:"red",text:"Red",icon:"wine/winered.gif"},{id:"white",text:"White",icon:"wine/winewhite.gif"},{id:"sweet",text:"Sweet",icon:"wine/winesweet.gif"},{id:"spark",text:"Sparkling",icon:"wine/winespark.gif"},{id:"rose",text:"Rose",icon:"wine/winerose.gif"}],score:[{id:0,text:""},{id:1,text:"*"},{id:2,text:"**"},{id:3,text:"***"},{id:4,text:"****"},{id:5,text:"*****"}],country:[{id:"AR",text:"Argentina"},{id:"AT",text:"Austria"},{id:"BG",text:"Bulgaria"},{id:"CA",text:"Canada"},{id:"CL",text:"Chile"},{id:"CY",text:"Cyprus"},{id:"FR",text:"France"},{id:"DE",text:"Germany"},{id:"GR",text:"Greece"},{id:"HU",text:"Hungary"},{id:"IT",text:"Italy"},{id:"LU",text:"Luxembourg"},{id:"NZ",text:"New Zealand"},{id:"PT",text:"Portugal"},{id:"ZA",text:"South Africa"},{id:"ES",text:"Spain"},{id:"CH",text:"Switzerland"},{id:"US",text:"United States"}]},winecellar_ui={id:"evol-winecellar",entity:"wine",entities:"wines",label:"Wine Cellar",icon:"wine.gif",leadfield:function(a){return a.get("name")+" "+a.get("vintage")},elements:[{type:"panel",label:"Wine",width:100,elements:[{id:"name",type:"text",label:"Name",required:!0,maxlength:150,viewmany:!0,width:62,help:"Name of the wine as indicated on the label."},{id:"vintage",type:"integer",label:"Vintage",required:!0,maxlength:4,viewmany:!0,width:38,min:1900,max:2020,help:"Year the wine was produced."}]},{type:"tab",label:"General",elements:[{type:"panel",label:"Wine",width:80,elements:[{id:"winery",type:"text",label:"Winery",maxlength:100,required:!0,viewmany:!0,width:"62",help:"The establishment where this wine is made."},{id:"bsize",type:"lov",label:"Bottle Size",labellist:"Bottle",width:38,list:winecellar_lovs.bottleSize},{id:"grape",type:"lov",label:"Grape",viewmany:!1,width:62,list:winecellar_lovs.grape},{id:"type",type:"lov",label:"Type",viewmany:!0,width:38,list:winecellar_lovs.type},{id:"appellation",type:"text",label:"Appellation",width:100,help:"An appellation is a legally defined and protected geographical indication used to identify where the grapes for a wine were grown."},{id:"country",type:"lov",label:"Country",width:32,list:winecellar_lovs.country},{id:"region",type:"text",label:"Region",maxlength:100,width:30},{id:"area",type:"text",label:"Area",maxlength:100,width:38}]},{type:"panel",label:"Bottle Label",width:20,elements:[{id:"label_img",type:"image",label:"Label",maxlength:200,width:100,viewmany:!0}]}]},{type:"tab",label:"Purchase",elements:[{type:"panel",label:"Purchase",width:100,elements:[{id:"buying_date",type:"date",label:"Buying Date",width:40},{id:"price",type:"money",label:"Price",viewmany:!0,width:30},{id:"value",type:"money",label:"Value",width:30},{id:"purchased",type:"integer",label:"Bottles Purchased",labellist:"Purchased",maxlength:10,width:40},{id:"remaining",type:"integer",label:"Remaining",labeledit:"Bottles Remaining",maxlength:10,width:60,viewcharts:!1},{id:"notes",type:"textmultiline",label:"Notes",maxlength:150,width:100,height:2}]}]},{type:"tab",label:"Drinking and Score",elements:[{type:"panel",label:"Drinking",width:62,elements:[{id:"drink_from",type:"integer",label:"Drink from (year)",placeholder:"2013",labellist:"Drink",maxlength:10,viewmany:!0,width:50,min:1900,max:2100},{id:"drink_to",type:"integer",label:"to",maxlength:4,width:50,min:1900,max:"2100"},{id:"peak_from",type:"integer",label:"Peak from",labellist:"Peak",maxlength:4,width:50,min:1900,max:2100},{id:"peak_to",type:"integer",label:"to",maxlength:4,width:50,min:1900,max:2100},{id:"meal",type:"textmultiline",label:"Meal",maxlength:200,width:100,height:2}]},{type:"panel",label:"Score",width:38,elements:[{id:"score",type:"lov",label:"My Score",labellist:"Score",list:winecellar_lovs.score,maxlength:100,width:100},{id:"score_parker",type:"integer",label:"Parker",min:50,max:100,maxlength:3,width:100},{id:"score_winespectator",type:"integer",label:"WineSpectator",min:0,max:100,maxlength:3,width:100}]}]},{type:"tab",label:"Wine Tasting",elements:[{type:"panel-list",id:"degustations",attr:"degustation",label:"Degustations",width:100,elements:[{id:"ddate",type:"date",label:"Date",maxlength:20,viewmany:!0,required:!0},{id:"robe",type:"text",label:"Robe",maxlength:100,viewmany:!0},{id:"nose",type:"text",label:"Nose",maxlength:100,viewmany:!0},{id:"taste",type:"text",label:"Taste",maxlength:100,viewmany:!0},{id:"notes",type:"textmultiline",label:"Note",maxlength:300,viewmany:!0,width:100,height:2}]}]},{type:"tab",label:"Notes",elements:[{type:"panel",label:"Comments",width:100,elements:[{id:"comments",type:"textmultiline",label:"Comments",maxlength:500,width:100,height:8}]}]}]},winecellar_data=[{name:"Macrostie",label_img:"wine/macrostie.gif",vintage:2008,winery:"Mc Williams",bsize:"750",type:"red",price:20,grape:"chard",appellation:"",country:"US",region:"Sonoma",area:"",buying_date:"2008-05-12",value:24,purchased:24,remaining:16,notes:"",drink_from:2009,drink_to:2020,peak_from:2014,peak_to:2017,meal:"",score:"",score_parker:null,score_winespectator:null,comments:"",degustation:[{ddate:"2008-05-08",robe:"light",nose:"fruity",taste:"fruity",notes:"too young"},{ddate:"2011-03-10",robe:"light",nose:"light fruit",taste:"",notes:""},{ddate:"2012-12-12",robe:"light",nose:"light fruit",taste:"",notes:"Great"}]},{name:"Château d'Yquem",label_img:"wine/yquem.gif",vintage:2012,winery:"Lur Saluces",bsize:"750",type:"white",grape:"sem",price:399,value:460,drink_from:2012,drink_to:2017,purchased:3,remaining:1,country:"FR",region:"Bordeaux",area:"Sauternes and Barsac",score_parker:92,score_winespectator:94,degustation:[{ddate:"2012-04-23",robe:"golden",nose:"fruity",taste:"incredible"},{ddate:"2013-24-12",robe:"clear",nose:"strong and sweet",taste:"outstanding"}]},{name:"Château St Jean",label_img:"wine/stjean.gif",vintage:2008,winery:"Ch St Jean",bsize:"750",type:"red",price:34,value:32,purchased:12,remaining:5,drink_from:2009,grape:"shiraz",country:"FR",score_parker:68,score_winespectator:72,degustation:[{ddate:"2013-24-12",robe:"thick",nose:"strong",taste:"good",notes:"Great w/ beef."}]},{name:"Vine Cliff",label_img:"wine/vinecliff.gif",vintage:2013,winery:"Vine Cliff",bsize:"750",type:"red",price:28,drink_from:2014,grape:"merlo",country:"US",score_parker:67,score_winespectator:62,degustation:[{ddate:"2013-05-05",robe:"light",nose:"strong",taste:"good"},{ddate:"2013-08-05",robe:"light",nose:"strong",taste:"good"},{ddate:"2013-08-18",robe:"light",nose:"strong",taste:"ok"}]},{name:"Château Montelena",label_img:"wine/montelena.gif",vintage:2005,winery:"Château Montelena",bsize:"1500",grape:"merlo",type:"red",drink_from:2005,region:"California",price:62,value:32,purchased:12,remaining:8,country:"US",score_parker:64,score_winespectator:64}]; | ||
/* evolutility v0.2 sample UI-models and data: todo, addressbook, wine cellar. */ | ||
var todo_ui={id:"todo",label:"To Do",entity:"task",entities:"tasks",icon:"todo.gif",leadfield:"title",elements:[{type:"panel",label:"Task",width:62,elements:[{id:"title",type:"text",label:"Title",required:!0,placeholder:"Call John",css:"FieldMain",maxlength:255,width:100,viewmany:!0},{id:"duedate",type:"date",label:"Due Date",width:62,viewmany:!0},{id:"category",type:"lov",label:"Category",width:38,viewmany:!0,list:[{id:"home",text:"Home"},{id:"work",text:"Work"},{id:"fun",text:"Fun"},{id:"others",text:"Others"},{id:"misc",text:"Misc."}]}]},{type:"panel",label:"Status",width:38,elements:[{id:"priority",type:"lov",label:"Priority",required:!0,width:100,viewmany:!0,list:[{id:"1",text:"1 - ASAP"},{id:"2",text:"2 - Urgent"},{id:"3",text:"3 - Important"},{id:"4",text:"4 - Medium"},{id:"5",text:"5 - Low"}]},{id:"complete",type:"boolean",label:"Complete",width:100,viewmany:!0}]},{type:"panel",label:"Notes",width:100,elements:[{id:"notes",type:"textmultiline",label:"Notes",maxlength:1e3,width:100,height:6,viewmany:!1}]}]},todo_data=[{id:"322",title:"Add routing to Evolutility",priority:"2",category:"others",complete:!1,notes:"Use Backbone router."},{id:"304",title:"Fix open bugs",duedate:"2014-07-25",priority:"3",category:"work",complete:!1,notes:"bla bla"},{id:"335",title:"Testing App",duedate:"2014-06-11",priority:"3",category:"work",complete:!1,notes:"test"},{id:"343",title:"Prepare demo",duedate:"2014-05-12",priority:"1",category:"work",complete:!1,notes:"Check this out"},{id:"344",title:"Test latest code",priority:"5",category:"misc",complete:!0,notes:"notes for my test todo task."},{id:"346",title:"Car wash",priority:"4",category:"work",complete:!1,notes:""},{id:"347",title:"Watch Inception",duedate:"2014-01-10",priority:"5",category:"fun",complete:!0,notes:""},{id:"348",title:"Test TODO",duedate:"2015-01-01",priority:"1",category:"work",complete:!0,notes:"Test TODO "}],contacts_LOVs={categories:[{id:"1",text:"Work"},{id:"2",text:"Fun"},{id:"3",text:"Travel"},{id:"4",text:"Business"},{id:"5",text:"Cars"},{id:"6",text:"Sport"},{id:"7",text:"Misc."}],states:[{id:"AL",text:"Alabama"},{id:"AK",text:"Alaska"},{id:"AZ",text:"Arizona"},{id:"AR",text:"Arkansas"},{id:"CA",text:"California"},{id:"CO",text:"Colorado"},{id:"CT",text:"Connecticut"},{id:"DE",text:"Delaware"},{id:"DC",text:"District of Columbia"},{id:"FL",text:"Florida"},{id:"GA",text:"Georgia"},{id:"HI",text:"Hawaii"},{id:"ID",text:"Idaho"},{id:"IL",text:"Illinois"},{id:"IN",text:"Indiana"},{id:"IA",text:"Iowa"},{id:"KS",text:"Kansas"},{id:"KY",text:"Kentucky"},{id:"LA",text:"Louisiana"},{id:"ME",text:"Maine"},{id:"MD",text:"Maryland"},{id:"MA",text:"Massachusetts"},{id:"MI",text:"Michigan"},{id:"MN",text:"Minnesota"},{id:"MS",text:"Mississippi"},{id:"MO",text:"Missouri"},{id:"MT",text:"Montana"},{id:"NE",text:"Nebraska"},{id:"NV",text:"Nevada"},{id:"NH",text:"New Hampshire"},{id:"NJ",text:"New Jersey"},{id:"NM",text:"New Mexico"},{id:"NY",text:"New York"},{id:"NC",text:"North Carolina"},{id:"ND",text:"North Dakota"},{id:"OH",text:"Ohio"},{id:"OK",text:"Oklahoma"},{id:"OR",text:"Oregon"},{id:"PA",text:"Pennsylvania"},{id:"RI",text:"Rhode Island"},{id:"SC",text:"South Carolina"},{id:"SD",text:"South Dakota"},{id:"TN",text:"Tennessee"},{id:"TX",text:"Texas"},{id:"UT",text:"Utah"},{id:"VT",text:"Vermont"},{id:"VA",text:"Virginia"},{id:"WA",text:"Washington"},{id:"WV",text:"West Virginia"},{id:"WI",text:"Wisconsin"},{id:"WY",text:"Wyoming"}],countries:[{text:"Afghanistan",id:"AF"},{text:"Åland Islands",id:"AX"},{text:"Albania",id:"AL"},{text:"Algeria",id:"DZ"},{text:"American Samoa",id:"AS"},{text:"Andorra",id:"AD"},{text:"Angola",id:"AO"},{text:"Anguilla",id:"AI"},{text:"Antarctica",id:"AQ"},{text:"Antigua and Barbuda",id:"AG"},{text:"Argentina",id:"AR"},{text:"Armenia",id:"AM"},{text:"Aruba",id:"AW"},{text:"Australia",id:"AU"},{text:"Austria",id:"AT"},{text:"Azerbaijan",id:"AZ"},{text:"Bahamas",id:"BS"},{text:"Bahrain",id:"BH"},{text:"Bangladesh",id:"BD"},{text:"Barbados",id:"BB"},{text:"Belarus",id:"BY"},{text:"Belgium",id:"BE"},{text:"Belize",id:"BZ"},{text:"Benin",id:"BJ"},{text:"Bermuda",id:"BM"},{text:"Bhutan",id:"BT"},{text:"Bolivia",id:"BO"},{text:"Bosnia and Herzegovina",id:"BA"},{text:"Botswana",id:"BW"},{text:"Bouvet Island",id:"BV"},{text:"Brazil",id:"BR"},{text:"British Indian Ocean Territory",id:"IO"},{text:"Brunei Darussalam",id:"BN"},{text:"Bulgaria",id:"BG"},{text:"Burkina Faso",id:"BF"},{text:"Burundi",id:"BI"},{text:"Cambodia",id:"KH"},{text:"Cameroon",id:"CM"},{text:"Canada",id:"CA"},{text:"Cape Verde",id:"CV"},{text:"Cayman Islands",id:"KY"},{text:"Central African Republic",id:"CF"},{text:"Chad",id:"TD"},{text:"Chile",id:"CL"},{text:"China",id:"CN"},{text:"Christmas Island",id:"CX"},{text:"Cocos (Keeling) Islands",id:"CC"},{text:"Colombia",id:"CO"},{text:"Comoros",id:"KM"},{text:"Congo",id:"CG"},{text:"Congo, The Democratic Republic of the",id:"CD"},{text:"Cook Islands",id:"CK"},{text:"Costa Rica",id:"CR"},{text:"Cote D'Ivoire",id:"CI"},{text:"Croatia",id:"HR"},{text:"Cuba",id:"CU"},{text:"Cyprus",id:"CY"},{text:"Czech Republic",id:"CZ"},{text:"Denmark",id:"DK"},{text:"Djibouti",id:"DJ"},{text:"Dominica",id:"DM"},{text:"Dominican Republic",id:"DO"},{text:"Ecuador",id:"EC"},{text:"Egypt",id:"EG"},{text:"El Salvador",id:"SV"},{text:"Equatorial Guinea",id:"GQ"},{text:"Eritrea",id:"ER"},{text:"Estonia",id:"EE"},{text:"Ethiopia",id:"ET"},{text:"Falkland Islands (Malvinas)",id:"FK"},{text:"Faroe Islands",id:"FO"},{text:"Fiji",id:"FJ"},{text:"Finland",id:"FI"},{text:"France",id:"FR"},{text:"French Guiana",id:"GF"},{text:"French Polynesia",id:"PF"},{text:"French Southern Territories",id:"TF"},{text:"Gabon",id:"GA"},{text:"Gambia",id:"GM"},{text:"Georgia",id:"GE"},{text:"Germany",id:"DE"},{text:"Ghana",id:"GH"},{text:"Gibraltar",id:"GI"},{text:"Greece",id:"GR"},{text:"Greenland",id:"GL"},{text:"Grenada",id:"GD"},{text:"Guadeloupe",id:"GP"},{text:"Guam",id:"GU"},{text:"Guatemala",id:"GT"},{text:"Guernsey",id:"GG"},{text:"Guinea",id:"GN"},{text:"Guinea-Bissau",id:"GW"},{text:"Guyana",id:"GY"},{text:"Haiti",id:"HT"},{text:"Heard Island and Mcdonald Islands",id:"HM"},{text:"Holy See (Vatican City State)",id:"VA"},{text:"Honduras",id:"HN"},{text:"Hong Kong",id:"HK"},{text:"Hungary",id:"HU"},{text:"Iceland",id:"IS"},{text:"India",id:"IN"},{text:"Indonesia",id:"ID"},{text:"Iran, Islamic Republic Of",id:"IR"},{text:"Iraq",id:"IQ"},{text:"Ireland",id:"IE"},{text:"Isle of Man",id:"IM"},{text:"Israel",id:"IL"},{text:"Italy",id:"IT"},{text:"Jamaica",id:"JM"},{text:"Japan",id:"JP"},{text:"Jersey",id:"JE"},{text:"Jordan",id:"JO"},{text:"Kazakhstan",id:"KZ"},{text:"Kenya",id:"KE"},{text:"Kiribati",id:"KI"},{text:"Korea, Democratic People'S Republic of",id:"KP"},{text:"Korea, Republic of",id:"KR"},{text:"Kuwait",id:"KW"},{text:"Kyrgyzstan",id:"KG"},{text:"Lao People'S Democratic Republic",id:"LA"},{text:"Latvia",id:"LV"},{text:"Lebanon",id:"LB"},{text:"Lesotho",id:"LS"},{text:"Liberia",id:"LR"},{text:"Libyan Arab Jamahiriya",id:"LY"},{text:"Liechtenstein",id:"LI"},{text:"Lithuania",id:"LT"},{text:"Luxembourg",id:"LU"},{text:"Macao",id:"MO"},{text:"Macedonia, The Former Yugoslav Republic of",id:"MK"},{text:"Madagascar",id:"MG"},{text:"Malawi",id:"MW"},{text:"Malaysia",id:"MY"},{text:"Maldives",id:"MV"},{text:"Mali",id:"ML"},{text:"Malta",id:"MT"},{text:"Marshall Islands",id:"MH"},{text:"Martinique",id:"MQ"},{text:"Mauritania",id:"MR"},{text:"Mauritius",id:"MU"},{text:"Mayotte",id:"YT"},{text:"Mexico",id:"MX"},{text:"Micronesia, Federated States of",id:"FM"},{text:"Moldova, Republic of",id:"MD"},{text:"Monaco",id:"MC"},{text:"Mongolia",id:"MN"},{text:"Montserrat",id:"MS"},{text:"Morocco",id:"MA"},{text:"Mozambique",id:"MZ"},{text:"Myanmar",id:"MM"},{text:"Namibia",id:"NA"},{text:"Nauru",id:"NR"},{text:"Nepal",id:"NP"},{text:"Netherlands",id:"NL"},{text:"Netherlands Antilles",id:"AN"},{text:"New Caledonia",id:"NC"},{text:"New Zealand",id:"NZ"},{text:"Nicaragua",id:"NI"},{text:"Niger",id:"NE"},{text:"Nigeria",id:"NG"},{text:"Niue",id:"NU"},{text:"Norfolk Island",id:"NF"},{text:"Northern Mariana Islands",id:"MP"},{text:"Norway",id:"NO"},{text:"Oman",id:"OM"},{text:"Pakistan",id:"PK"},{text:"Palau",id:"PW"},{text:"Palestinian Territory, Occupied",id:"PS"},{text:"Panama",id:"PA"},{text:"Papua New Guinea",id:"PG"},{text:"Paraguay",id:"PY"},{text:"Peru",id:"PE"},{text:"Philippines",id:"PH"},{text:"Pitcairn",id:"PN"},{text:"Poland",id:"PL"},{text:"Portugal",id:"PT"},{text:"Puerto Rico",id:"PR"},{text:"Qatar",id:"QA"},{text:"Reunion",id:"RE"},{text:"Romania",id:"RO"},{text:"Russian Federation",id:"RU"},{text:"RWANDA",id:"RW"},{text:"Saint Helena",id:"SH"},{text:"Saint Kitts and Nevis",id:"KN"},{text:"Saint Lucia",id:"LC"},{text:"Saint Pierre and Miquelon",id:"PM"},{text:"Saint Vincent and the Grenadines",id:"VC"},{text:"Samoa",id:"WS"},{text:"San Marino",id:"SM"},{text:"Sao Tome and Principe",id:"ST"},{text:"Saudi Arabia",id:"SA"},{text:"Senegal",id:"SN"},{text:"Serbia and Montenegro",id:"CS"},{text:"Seychelles",id:"SC"},{text:"Sierra Leone",id:"SL"},{text:"Singapore",id:"SG"},{text:"Slovakia",id:"SK"},{text:"Slovenia",id:"SI"},{text:"Solomon Islands",id:"SB"},{text:"Somalia",id:"SO"},{text:"South Africa",id:"ZA"},{text:"South Georgia and the South Sandwich Islands",id:"GS"},{text:"Spain",id:"ES"},{text:"Sri Lanka",id:"LK"},{text:"Sudan",id:"SD"},{text:"Suriname",id:"SR"},{text:"Svalbard and Jan Mayen",id:"SJ"},{text:"Swaziland",id:"SZ"},{text:"Sweden",id:"SE"},{text:"Switzerland",id:"CH"},{text:"Syrian Arab Republic",id:"SY"},{text:"Taiwan, Province of China",id:"TW"},{text:"Tajikistan",id:"TJ"},{text:"Tanzania, United Republic of",id:"TZ"},{text:"Thailand",id:"TH"},{text:"Timor-Leste",id:"TL"},{text:"Togo",id:"TG"},{text:"Tokelau",id:"TK"},{text:"Tonga",id:"TO"},{text:"Trinidad and Tobago",id:"TT"},{text:"Tunisia",id:"TN"},{text:"Turkey",id:"TR"},{text:"Turkmenistan",id:"TM"},{text:"Turks and Caicos Islands",id:"TC"},{text:"Tuvalu",id:"TV"},{text:"Uganda",id:"UG"},{text:"Ukraine",id:"UA"},{text:"United Arab Emirates",id:"AE"},{text:"United Kingdom",id:"GB"},{text:"United States",id:"US"},{text:"United States Minor Outlying Islands",id:"UM"},{text:"Uruguay",id:"UY"},{text:"Uzbekistan",id:"UZ"},{text:"Vanuatu",id:"VU"},{text:"Venezuela",id:"VE"},{text:"Viet Nam",id:"VN"},{text:"Virgin Islands, British",id:"VG"},{text:"Virgin Islands, U.S.",id:"VI"},{text:"Wallis and Futuna",id:"WF"},{text:"Western Sahara",id:"EH"},{text:"Yemen",id:"YE"},{text:"Zambia",id:"ZM"},{text:"Zimbabwe",id:"ZW"}]},contacts_ui={id:"contact",label:"Address book",icon:"contact.gif",entity:"contact",entities:"contacts",leadfield:function(a){return a.get("firstname")+" "+a.get("lastname")},elements:[{type:"panel",label:"Identity",width:62,elements:[{type:"text",id:"lastname",label:"Lastname",maxlength:50,required:!0,css:"FieldMain",width:"62",viewmany:!0},{type:"text",id:"firstname",label:"Firstname",maxlength:50,required:!0,css:"FieldMain",width:38,viewmany:!0},{type:"text",id:"jobtitle",label:"Title",maxlength:50,width:62},{type:"text",id:"company",label:"Company",maxlength:50,width:38,viewmany:!0},{type:"email",id:"email",label:"email",maxlength:255,width:100,viewmany:!0},{type:"url",id:"web",label:"web",maxlength:255,width:100}]},{type:"panel",label:"Contact Info",width:38,elements:[{type:"text",id:"phone",label:"Work Phone",maxlength:20,width:100},{type:"text",id:"phonehome",label:"Home Phone",maxlength:20,width:100},{type:"text",id:"phonecell",label:"Cell.",maxlength:20,width:100,mini:"1"},{type:"text",id:"fax",label:"Fax",maxlength:20,width:100}]},{type:"panel",label:"Address",width:62,elements:[{type:"text",id:"address1",label:"Address",maxlength:150,width:100},{type:"text",id:"address2",label:"",labellist:"Address 2",maxlength:150,width:100},{type:"text",id:"city",label:"City",maxlength:100,width:62},{type:"lov",id:"state",label:"State",maxlength:3,width:15,list:contacts_LOVs.states},{type:"text",id:"zip",label:"Zip",maxlength:12,width:23},{type:"lov",id:"country",label:"Country",maxlength:60,width:100,list:contacts_LOVs.countries}]},{type:"panel",label:"Misc.",width:38,elements:[{type:"lov",id:"category",label:"Category",width:100,viewmany:!0,list:contacts_LOVs.categories},{type:"text",id:"custom1",label:"Custom 1",maxlength:250,width:100},{type:"text",id:"custom2",label:"Custom 2",maxlength:250,width:100},{type:"text",id:"custom3",label:"Custom 3",maxlength:250,width:100}]}]},contacts_data=[{id:"690",lastname:"Smallwood",firstname:"Vincent",jobtitle:"Director",company:"EasyDoesIt",email:"vsw@EasyDoesIt.com",phone:"415 234 4323",phonehome:"415 378 3577",phonecell:"415 135 3454",web:"http://EasyDoesIt.com",address1:"12, Liverpool Street",city:"San Francisco",state:"CA",zip:"94123",country:"US",category:"4"},{id:"733",lastname:"Shackleford ",firstname:"Rusty ",email:"rustyshackleford@gmail.com",phone:"",address1:"123 Main Street",city:"Dallas",state:"TX",zip:"",country:"US",category:"3"},{id:"749",lastname:"Test",firstname:"Testing",jobtitle:"QA Engineer",company:"Testing evol-utility",email:"test@test.com",phone:"423 233 3523",phonehome:"423 523 4523",phonecell:"242342",fax:"3423423",url:"sdfsdf",address1:"5665 Poplar Street",city:"San Jose",state:"CA",zip:"93112",country:"US",category:"3"},{id:"759",lastname:"Reina Moyano",firstname:"Sergio",jobtitle:"Mr",company:"Innova Creaciones",email:"sreina@innovacreaciones.es",phone:"411 444 2222",phonehome:"411 576 4566",phonecell:"411 579 4566",fax:"411 444 2224",address1:"654 Union Street",address2:"#203",city:"San Francisco",state:"CA",zip:"94567",country:"US",category:"3"},{id:"770",lastname:"Paulus",firstname:"Henry",jobtitle:"",company:"TEST the TEST",phone:"652 491 2345",address1:"1234 That Street",city:"",state:"",zip:"",country:"US",category:"2"},{id:"775",lastname:"Dupond",firstname:"Patrick",jobtitle:"Sales Manager",company:"Au Bon Pain",email:"pdupond@aubonpain.fr",phone:"45 456 414 45",url:"http://aubonpain.fr",city:"Paris",country:"FR",category:"1"},{id:"779",lastname:"Doe",firstname:"John",company:"Evolutility",email:"evolutility@evolutility.org",url:"http://www.evol-utility.org"},{id:"802",lastname:"Martin",firstname:"Paul",jobtitle:"President",company:"Acme Corp",email:"pm@acme.com",phone:"444 580 7007",phonehome:"449 512 0230",phonecell:"589 499 2065",fax:"",url:"",address1:"123 Redville Lane",city:"Musnonville",state:"NH",zip:"03434",country:"",category:"1"},{id:"812",lastname:"Munar",firstname:"Roman",jobtitle:"Mr",company:"Informatics",email:"romano@yehey.com",phone:"322 234 5143",phonehome:"322 784 3453",phonecell:"322 538 2568",fax:"322 234 5345",url:"http://roman.munar.com",address1:"Washington",address2:"Buendia",city:"Makati",state:"",zip:"1300",country:"PH",category:"3"}],winecellar_lovs={bottleSize:[{id:750,text:"750 ml"},{id:500,text:"500 ml"},{id:375,text:"375 cl"},{id:1500,text:"1.5 L"},{id:3e3,text:"3.0 L"},{id:6e3,text:"6.0 L"},{id:8e3,text:"8.0 L"}],grape:[{id:"chard",text:"Chardonnay"},{id:"shiraz",text:"Shiraz"},{id:"merlo",text:"Merlot"},{id:"pino",text:"Pinot Noir"},{id:"cab",text:"Cabernet"},{id:"zin",text:"Zinfandel"},{id:"sauv",text:"Sauvignon"},{id:"cabsau",text:"Cabernet Sauvignon"},{id:"aligo",text:"Aligoté"},{id:"alva",text:"Alvarinho"},{id:"bf",text:"Blanc Fumé"},{id:"bual",text:"Bual"},{id:"carg",text:"Carignan"},{id:"chass",text:"Chasselas"},{id:"cb",text:"Chemin Blanc"},{id:"cin",text:"Cinsault"},{id:"clair",text:"Clairette"},{id:"colomb",text:"Colombard"},{id:"counoi",text:"Counoise"},{id:"fdt",text:"Fendant"},{id:"fb",text:"Folle Blanche"},{id:"f",text:"Fürmint"},{id:"gamay",text:"Gamay"},{id:"gewurz",text:"Gewürztraminer"},{id:"graub",text:"Grauburgunder"},{id:"grct",text:"Grechetto"},{id:"gb",text:"Grenache Blanc"},{id:"gn",text:"Grenache Noir"},{id:"gp",text:"Gros Plan"},{id:"gv",text:"Grüner Veltliner"},{id:"ir",text:"Italienischer Riestling"},{id:"ka",text:"Kadarka"},{id:"ker",text:"Kerner"},{id:"mcb",text:"Macabeo"},{id:"malm",text:"Malmsey"},{id:"malv",text:"Malvasier"},{id:"mars",text:"Marsanne"},{id:"mdb",text:"Melon de Bourgogne"},{id:"mourv",text:"Mourvèdre"},{id:"mt",text:"Müller-Thurgau"},{id:"mu1",text:"Muscadelle"},{id:"mu2",text:"Muscadet"},{id:"mu3",text:"Musca"},{id:"mu4",text:"Musca d'Alsace"},{id:"mu5",text:"Muskateller"},{id:"neb",text:"Nebbiolo"},{id:"pal",text:"Palomino"},{id:"px",text:"Pedro Ximérez"},{id:"pv",text:"Petit Verdot"},{id:"pb",text:"Pinot Blanc"},{id:"pg",text:"Pinot Gris"},{id:"pn",text:"Pinot Noir"},{id:"pi",text:"Pinotage"},{id:"riesling",text:"Riesling"},{id:"rul",text:"Ruländer"},{id:"sang",text:"Sangiovese"},{id:"sb",text:"Sauvignon Blanc"},{id:"sc",text:"Scheurebe"},{id:"sem",text:"Sémilion"},{id:"ser",text:"Sercial"},{id:"sb2",text:"Seyval Blanc"},{id:"sieg",text:"Siegerrebe"},{id:"silv",text:"Silvaner"},{id:"spa",text:"Spätburgunder"},{id:"steen",text:"Steen"},{id:"syrah",text:"Syrah"},{id:"temp",text:"Tempranillo"},{id:"tokay",text:"Tokay"},{id:"tram",text:"Traminer"},{id:"treb",text:"Trebbiano"},{id:"ub",text:"Ugni Blanc"},{id:"verd",text:"Verdejo"},{id:"verdh",text:"Verdelho"},{id:"verm",text:"Vermentino"},{id:"vern",text:"Vernaccia"},{id:"vio",text:"Viognier"},{id:"viu",text:"Viura"},{id:"w",text:"Weißburgunder"}],type:[{id:"red",text:"Red",icon:"wine/winered.gif"},{id:"white",text:"White",icon:"wine/winewhite.gif"},{id:"sweet",text:"Sweet",icon:"wine/winesweet.gif"},{id:"spark",text:"Sparkling",icon:"wine/winespark.gif"},{id:"rose",text:"Rose",icon:"wine/winerose.gif"}],score:[{id:0,text:""},{id:1,text:"*"},{id:2,text:"**"},{id:3,text:"***"},{id:4,text:"****"},{id:5,text:"*****"}],country:[{id:"AR",text:"Argentina"},{id:"AT",text:"Austria"},{id:"BG",text:"Bulgaria"},{id:"CA",text:"Canada"},{id:"CL",text:"Chile"},{id:"CY",text:"Cyprus"},{id:"FR",text:"France"},{id:"DE",text:"Germany"},{id:"GR",text:"Greece"},{id:"HU",text:"Hungary"},{id:"IT",text:"Italy"},{id:"LU",text:"Luxembourg"},{id:"NZ",text:"New Zealand"},{id:"PT",text:"Portugal"},{id:"ZA",text:"South Africa"},{id:"ES",text:"Spain"},{id:"CH",text:"Switzerland"},{id:"US",text:"United States"}]},winecellar_ui={id:"winecellar",entity:"wine",entities:"wines",label:"Wine Cellar",icon:"wine.gif",leadfield:function(a){return a.get("name")+" "+a.get("vintage")},elements:[{type:"panel",label:"Wine",width:100,elements:[{id:"name",type:"text",label:"Name",required:!0,maxlength:150,viewmany:!0,width:62,help:"Name of the wine as indicated on the label."},{id:"vintage",type:"integer",label:"Vintage",required:!0,maxlength:4,viewmany:!0,width:38,min:1900,max:2020,help:"Year the wine was produced."}]},{type:"tab",label:"General",elements:[{type:"panel",label:"Wine",width:80,elements:[{id:"winery",type:"text",label:"Winery",maxlength:100,required:!0,viewmany:!0,width:"62",help:"The establishment where this wine is made."},{id:"bsize",type:"lov",label:"Bottle Size",labellist:"Bottle",width:38,list:winecellar_lovs.bottleSize},{id:"grape",type:"lov",label:"Grape",viewmany:!1,width:62,list:winecellar_lovs.grape},{id:"type",type:"lov",label:"Type",viewmany:!0,width:38,list:winecellar_lovs.type},{id:"appellation",type:"text",label:"Appellation",width:100,help:"An appellation is a legally defined and protected geographical indication used to identify where the grapes for a wine were grown."},{id:"country",type:"lov",label:"Country",width:32,list:winecellar_lovs.country},{id:"region",type:"text",label:"Region",maxlength:100,width:30},{id:"area",type:"text",label:"Area",maxlength:100,width:38}]},{type:"panel",label:"Bottle Label",width:20,elements:[{id:"label_img",type:"image",label:"Label",maxlength:200,width:100,viewmany:!0}]}]},{type:"tab",label:"Purchase",elements:[{type:"panel",label:"Purchase",width:100,elements:[{id:"buying_date",type:"date",label:"Buying Date",width:40},{id:"price",type:"money",label:"Price",viewmany:!0,width:30},{id:"value",type:"money",label:"Value",width:30},{id:"purchased",type:"integer",label:"Bottles Purchased",labellist:"Purchased",maxlength:10,width:40},{id:"remaining",type:"integer",label:"Remaining",labeledit:"Bottles Remaining",maxlength:10,width:60,viewcharts:!1},{id:"notes",type:"textmultiline",label:"Notes",maxlength:150,width:100,height:2}]}]},{type:"tab",label:"Drinking and Score",elements:[{type:"panel",label:"Drinking",width:62,elements:[{id:"drink_from",type:"integer",label:"Drink from (year)",labellist:"Drink",labelcharts:"Drink from",placeholder:"2012",maxlength:10,viewmany:!0,width:50,min:1900,max:2100},{id:"drink_to",type:"integer",label:"to",labelcharts:"Drink to",maxlength:4,width:50,min:1900,max:"2100"},{id:"peak_from",type:"integer",label:"Peak from",labellist:"Peak",maxlength:4,width:50,min:1900,max:2100},{id:"peak_to",type:"integer",label:"to",labelcharts:"Peak to",maxlength:4,width:50,min:1900,max:2100},{id:"meal",type:"textmultiline",label:"Meal",maxlength:200,width:100,height:2}]},{type:"panel",label:"Score",width:38,elements:[{id:"score",type:"lov",label:"My Score",labellist:"Score",list:winecellar_lovs.score,maxlength:100,width:100},{id:"score_parker",type:"integer",label:"Parker",min:50,max:100,maxlength:3,width:100},{id:"score_winespectator",type:"integer",label:"WineSpectator",min:0,max:100,maxlength:3,width:100}]}]},{type:"tab",label:"Wine Tasting",elements:[{type:"panel-list",id:"degustations",attr:"degustation",label:"Degustations",width:100,elements:[{id:"ddate",type:"date",label:"Date",maxlength:20,viewmany:!0,required:!0},{id:"robe",type:"text",label:"Robe",maxlength:100,viewmany:!0},{id:"nose",type:"text",label:"Nose",maxlength:100,viewmany:!0},{id:"taste",type:"text",label:"Taste",maxlength:100,viewmany:!0},{id:"notes",type:"textmultiline",label:"Note",maxlength:300,viewmany:!0,width:100,height:2}]}]},{type:"tab",label:"Notes",elements:[{type:"panel",label:"Comments",width:100,elements:[{id:"comments",type:"textmultiline",label:"Comments",maxlength:500,width:100,height:8}]}]}]},winecellar_data=[{name:"Macrostie",label_img:"wine/macrostie.gif",vintage:2008,winery:"Mc Williams",bsize:"750",type:"red",price:20,grape:"chard",appellation:"",country:"US",region:"Sonoma",area:"",buying_date:"2008-05-12",value:24,purchased:24,remaining:16,notes:"",drink_from:2009,drink_to:2020,peak_from:2014,peak_to:2017,meal:"",score:"",score_parker:null,score_winespectator:null,comments:"",degustation:[{ddate:"2008-05-08",robe:"light",nose:"fruity",taste:"fruity",notes:"too young"},{ddate:"2011-03-10",robe:"light",nose:"light fruit",taste:"",notes:""},{ddate:"2012-12-12",robe:"light",nose:"light fruit",taste:"",notes:"Great"}]},{name:"Château d'Yquem",label_img:"wine/yquem.gif",vintage:2012,winery:"Lur Saluces",bsize:"750",type:"white",grape:"sem",price:399,value:460,drink_from:2012,drink_to:2017,purchased:3,remaining:1,country:"FR",region:"Bordeaux",area:"Sauternes and Barsac",score_parker:92,score_winespectator:94,degustation:[{ddate:"2012-04-23",robe:"golden",nose:"fruity",taste:"incredible"},{ddate:"2013-24-12",robe:"clear",nose:"strong and sweet",taste:"outstanding"}]},{name:"Château St Jean",label_img:"wine/stjean.gif",vintage:2008,winery:"Ch St Jean",bsize:"750",type:"red",price:34,value:32,purchased:12,remaining:5,drink_from:2009,grape:"shiraz",country:"FR",score_parker:68,score_winespectator:72,degustation:[{ddate:"2013-24-12",robe:"thick",nose:"strong",taste:"good",notes:"Great w/ beef."}]},{name:"Vine Cliff",label_img:"wine/vinecliff.gif",vintage:2013,winery:"Vine Cliff",bsize:"750",type:"red",price:28,drink_from:2014,grape:"merlo",country:"US",score_parker:67,score_winespectator:62,degustation:[{ddate:"2013-05-05",robe:"light",nose:"strong",taste:"good"},{ddate:"2013-08-05",robe:"light",nose:"strong",taste:"good"},{ddate:"2013-08-18",robe:"light",nose:"strong",taste:"ok"}]},{name:"Château Montelena",label_img:"wine/montelena.gif",vintage:2005,winery:"Château Montelena",bsize:"1500",grape:"merlo",type:"red",drink_from:2005,region:"California",price:62,value:32,purchased:12,remaining:8,country:"US",score_parker:64,score_winespectator:64}]; |
@@ -63,2 +63,3 @@ module.exports = function (grunt) { | ||
'js/one-*.js', | ||
'!js/one-wizard.js', // NOT ! here | ||
'js/action.js', | ||
@@ -68,3 +69,4 @@ 'js/action-*.js', | ||
//'js/navbar.js', | ||
'js/toolbar.js' | ||
'js/toolbar.js', | ||
'js/shell.js' | ||
//'js/ui-models/dico/field.js' | ||
@@ -71,0 +73,0 @@ ], |
@@ -10,3 +10,3 @@ /*! *************************************************************************** | ||
var evoLangXpt = Evol.i18n.export; | ||
var i18nXpt = Evol.i18n.export; | ||
@@ -22,3 +22,2 @@ Evol.ViewAction.Export = Backbone.View.extend({ | ||
'click button': 'click_button' | ||
// TODO #tbrevol-xpt-format is a bug if change prefix... | ||
}, | ||
@@ -30,14 +29,10 @@ | ||
many: true, | ||
//style: 'normal', | ||
prefix: 'tbr' | ||
prefix: 'xpt', | ||
formats: ['CSV', 'TAB', 'HTML', 'XML', 'SQL', 'JSON'] | ||
}, | ||
initialize: function (opts) { | ||
_.extend(this.options, opts); | ||
this.options=_.extend({}, this.options, opts); | ||
this.uiModel = this.options.uiModel; | ||
this.render(); | ||
var e = this.$el; | ||
//### html ### | ||
//e.addClass('Panel table table-bordered'); | ||
e.addClass('Panel'); | ||
this._preview('CSV'); | ||
@@ -58,13 +53,14 @@ return this; | ||
prefix = opts.prefix || '', | ||
fields = this.getFields(); | ||
fields = this.getFields(), | ||
iMax = fields.length; | ||
//string fieldName, fieldlabel, expOut, buffer; | ||
h.push('<div class="evol-xpt-form"><div class="evol-xpt-flds"><fieldset>'); | ||
//### list of columns to export ######################################### | ||
h.push('<div class="evol-id">', EvoUI.label('', evoLangXpt.ExportFields),'</div>'/*, | ||
'<div>',EvoUI.input.checkbox('showID','1'), '<label for="showID">', evoLangXpt.IDkey, '</label>','</div>'*/ | ||
h.push('<div class="evol-id">', EvoUI.label('', i18nXpt.xpFields),'</div>'/*, | ||
'<div>',EvoUI.input.checkbox('showID','1'), '<label for="showID">', i18nXpt.IDkey, '</label>','</div>'*/ | ||
); | ||
for (var i = 0, iMax = fields.length; i < iMax; i++) { | ||
var f = fields[i], | ||
fLabel = f.label, | ||
_.each(fields, function(f, i){ | ||
var fLabel = f.labelexport || f.label || f.labellist, | ||
fID = 'fx-' + f.id; | ||
@@ -74,54 +70,53 @@ if (fLabel === null || fLabel === '') { | ||
} | ||
h.push('<div><input type="checkbox" value="1" id="', fID, '" checked="true"><label class="checkbox" for="', fID, '">', fLabel, '</label></div>'); | ||
h.push('<div><label class="checkbox"><input type="checkbox" value="1" id="', fID, '" checked="checked">', fLabel, '</label></div>'); | ||
if (i == 10 && iMax > 14){ | ||
h.push(EvoExport.html_more2(evoLangXpt.AllFields)); | ||
h.push(EvoExport.html_more2(i18nXpt.allFields)); | ||
} | ||
} | ||
}); | ||
if (iMax > 14){ | ||
h.push('</div>'); | ||
} | ||
h.push('</fieldset></div><div class="evol-xpt-para">'); // table = 2 columns | ||
//##### export formats ######################################## | ||
var fId = prefix + 'evol-xpt-format', | ||
myLabels = evoLangXpt.ExportFormats.split('-'); | ||
h.push('<label for="', fId, '">', evoLangXpt.ExportFormat, '</label>', | ||
EvoUI.input.select(fId, '', 'evol-xpt-format', false, [ | ||
{id: 'CSV', text: myLabels[0]}, | ||
{id: 'TAB', text: myLabels[3]}, | ||
{id: 'HTML', text: myLabels[1]}, | ||
{id: 'JSON', text: myLabels[5]}, | ||
{id: 'SQL', text: myLabels[2]}, | ||
{id: 'XML', text: myLabels[4]} | ||
]) | ||
); | ||
formatsList = [];//.split('-'); | ||
h.push('<label for="', fId, '">', i18nXpt.format, '</label>'); | ||
_.each(opts.formats, function(format){ | ||
formatsList.push({id: format, text: i18nXpt['format'+format]}); | ||
}); | ||
h.push(EvoUI.input.select(fId, '', 'evol-xpt-format', false, formatsList)); | ||
fId = prefix + "FLH"; | ||
h.push('<div class="evol-xpt-opts">'); | ||
//# field (shared b/w formats - header ####### | ||
h.push('<div class="evol-FLH clearfix">'); | ||
//h.push('<label>', evoLangXpt.ExportHeader, '</label>'); | ||
h.push(EvoUI.input.checkbox(fId, true), EvoUI.fieldLabelSpan(fId, evoLangXpt.ExportFirstLine)); | ||
//##### CSV, TAB - First line for field names ####### | ||
h.push('</div><div id="', prefix, 'CSV">'); | ||
//# field - separator | ||
//# - csv - any separator ####### | ||
h.push('<div data-id="csv2" class="evol-w120">', | ||
h.push('<div class="evol-xpt-opts">', | ||
//# field (shared b/w formats - header ####### | ||
'<div class="evol-FLH clearfix">', | ||
//h.push('<label>', i18nXpt.header, '</label>'); | ||
'<label>', EvoUI.input.checkbox(fId, true), i18nXpt.firstLine, '</label>', | ||
//##### CSV, TAB - First line for field names ####### | ||
'</div><div id="', prefix, 'CSV">', | ||
//# field - separator | ||
//# - csv - any separator ####### | ||
'<div data-id="csv2" class="evol-w120">', | ||
//EvoExport.html_more2('options'), | ||
//.evol-FLH | ||
EvoUI.fieldLabel('FLS_evol', evoLangXpt.ExportSeparator), | ||
EvoUI.fieldLabel('FLS_evol', i18nXpt.separator), | ||
EvoUI.input.text(prefix+'FLS_evol', ',', 0), | ||
'</div>'); // </div> | ||
h.push('</div>'); | ||
'</div>', // </div> | ||
'</div>'); | ||
_.each(['XML','HTML','SQL','JSON'], function(f){ | ||
h.push('<div id="', prefix, f, '" style="display:none;"></div>'); | ||
}); | ||
h.push('</div>'); | ||
//# Preview ####### | ||
h.push('<label>',evoLangXpt.preview,'</label><div class="evol-xpt-preview">'); | ||
// ## Samples | ||
h.push('<textarea class="Field evol-xpt-val form-control"></textarea>'); | ||
h.push('</div></div></div></div>'); | ||
// ## Download button | ||
h.push('<div class="evol-buttons form-actions">', | ||
EvoUI.input.button('cancel', Evol.i18n.Cancel, 'btn-default'), | ||
EvoUI.input.button('export', evoLangXpt.DownloadEntity.replace('{0}', this.options.uiModel.entities), 'btn btn-primary')); | ||
h.push('</div>', | ||
//# Preview ####### | ||
'<label>',i18nXpt.preview,'</label><div class="evol-xpt-preview">', | ||
// ## Samples | ||
'<textarea class="Field evol-xpt-val form-control"></textarea>', | ||
'</div></div></div></div>', | ||
// ## Download button | ||
'<div class="evol-buttons form-actions">', | ||
EvoUI.input.button('cancel', Evol.i18n.Cancel, 'btn-default'), | ||
EvoUI.input.button('export', i18nXpt.DownloadEntity.replace('{0}', this.uiModel.entities), 'btn btn-primary'), | ||
'</div>' | ||
); | ||
return h.join(''); | ||
@@ -151,3 +146,3 @@ }, | ||
if (c.html() === '') { | ||
c.html(EvoExport['form' + xFormat](this.options.uiModel.entity)); | ||
c.html(EvoExport['opts' + xFormat](this.uiModel.entity)); | ||
} | ||
@@ -170,3 +165,3 @@ break; | ||
if(!this.fields){ | ||
this.fields=Evol.Dico.getFields(opts.uiModel,opts.fnFilter,opts.mode); | ||
this.fields=Evol.Dico.getFields(this.uiModel, opts.fnFilter, opts.mode); | ||
} | ||
@@ -178,5 +173,5 @@ return this.fields; | ||
if(this.options.many){ | ||
return Evol.i18n.getLabel('export.ExportEntities', this.options.uiModel.entities); | ||
return Evol.i18n.getLabel('export.ExportEntities', this.uiModel.entities); | ||
}else{ | ||
return Evol.i18n.getLabel('export.ExportEntity', this.options.uiModel.entity); | ||
return Evol.i18n.getLabel('export.ExportEntity', this.uiModel.entity); | ||
} | ||
@@ -187,2 +182,3 @@ }, | ||
var h=[], | ||
$e = this.$('.evol-xpt-val'), | ||
fTypes=Evol.Dico.fieldTypes; | ||
@@ -209,3 +205,3 @@ if(this.model && this.model.collection){ | ||
}); | ||
switch (format) { | ||
switch (format){ | ||
case 'CSV': | ||
@@ -221,4 +217,4 @@ case 'TAB': | ||
if (useHeader) { | ||
_.each(flds, function(f,idx){ | ||
h.push(f.label); | ||
_.each(flds, function(f, idx){ | ||
h.push(f.label); //TODO f.labelexported || f.label, // name when "exported" | ||
if(idx<iMax){ | ||
@@ -232,3 +228,3 @@ h.push(sep); | ||
_.each(data, function(m){ | ||
_.each(flds, function(f,idx){ | ||
_.each(flds, function(f, idx){ | ||
var mj = m.get(f.id); | ||
@@ -272,3 +268,6 @@ if (mj) { | ||
case 'JSON': | ||
h.push(JSON.stringify(this.model.toJSON(), null, 2)); | ||
_.each(data, function(m){ | ||
// TODO only show selected fields | ||
h.push(JSON.stringify(m.toJSON(), null, 2)); | ||
}); | ||
break; | ||
@@ -283,3 +282,3 @@ case 'SQL': | ||
if(sqlTable===''){ | ||
sqlTable = this.options.uiModel.entity.replace(/ /g,'_'); | ||
sqlTable = this.uiModel.entity.replace(/ /g,'_'); | ||
} | ||
@@ -308,4 +307,4 @@ _.each(flds, function(f,idx){ | ||
switch(f.type){ | ||
case fTypes.integer: | ||
case fTypes.decimal: | ||
case fTypes.int: | ||
case fTypes.dec: | ||
case fTypes.money: | ||
@@ -348,3 +347,3 @@ h.push(fValue?fValue:'NULL'); | ||
case 'XML': | ||
var elemName = this.$('#evoRoot').val() || this.options.uiModel.entity.replace(/ /g,'_'), | ||
var elemName = this.$('#evoRoot').val() || this.uiModel.entity.replace(/ /g,'_'), | ||
fv; | ||
@@ -356,3 +355,3 @@ h.push('<xml>\n'); | ||
h.push(f.id, '="'); | ||
if(f.type===fTypes.text || f.type===fTypes.txtm){ | ||
if(f.type===fTypes.text || f.type===fTypes.textml){ | ||
fv=m.get(f.id); | ||
@@ -373,6 +372,9 @@ if(!_.isUndefined(fv)){ | ||
}else{ | ||
h.push(Evol.UI.HTMLMsg(Evol.i18n.nodata,'','info')); | ||
h.push(Evol.i18n.nodata); | ||
} | ||
this.$('.evol-xpt-val') | ||
.html(h.join('')); | ||
if(this.options.many && format==='JSON'){ | ||
$e.html('['+h.join(',\n')+']'); | ||
}else{ | ||
$e.html(h.join('')); | ||
} | ||
}, | ||
@@ -384,3 +386,4 @@ | ||
} else { | ||
this._setValue(value); | ||
// TODO implement setvalue? | ||
//this._setValue(value); | ||
return this; | ||
@@ -394,3 +397,3 @@ } | ||
_.each(flds, function(fe){ | ||
v.push(fe.attr('id')); | ||
v.push(fe.id.substr(3)); | ||
}); | ||
@@ -402,3 +405,3 @@ return v; | ||
var v = { | ||
format: this._bFormat.val(), | ||
format: EvoExport.cFormat, | ||
fields: this._valFields(), | ||
@@ -409,3 +412,3 @@ options: {} | ||
f = ps.eq(0), | ||
fv = !_.isUndefined(f.attr('checked')); | ||
fv = !_.isUndefined(f.prop('checked')); | ||
v.options[f.attr('id')] = fv; | ||
@@ -418,3 +421,3 @@ return v; | ||
if (format === 'XML') { | ||
this.$('#XML').html(EvoExport.formXML(this.options.uiModel.entity)) | ||
this.$('#XML').html(EvoExport.optsXML(this.uiModel.entity)) | ||
.show() | ||
@@ -457,11 +460,11 @@ .siblings().not('.evol-FLH').hide(); | ||
formHTML: function () { | ||
optsHTML: function(){ | ||
return ''; | ||
}, | ||
formXML: function (entity) { | ||
optsXML: function(entity){ | ||
return [ | ||
EvoExport.html_more2('options'), | ||
EvoExport.formEntityName('evoRoot', evoLangXpt.xpXMLroot, entity), | ||
Evol.UI.fieldLabel('evoxpC2X', evoLangXpt.xpColMap), | ||
EvoExport.optEntityName('evoRoot', i18nXpt.XMLroot, entity), | ||
Evol.UI.fieldLabel('evoxpC2X', i18nXpt.xpColMap), | ||
'</div>' | ||
@@ -471,12 +474,12 @@ ].join(''); | ||
formJSON: function () { | ||
optsJSON: function(){ | ||
return ''; | ||
}, | ||
formSQL: function (entity) { | ||
optsSQL: function(entity){ | ||
return [ | ||
EvoExport.html_more2('options'), | ||
EvoExport.formEntityName('evoTable', evoLangXpt.xpSQLTable, entity), | ||
'<div>', Evol.UI.input.checkbox('evoxpTRS2', '0'), Evol.UI.fieldLabelSpan('evoxpTRS2', evoLangXpt.xpSQLId), '</div>', | ||
'<div>', Evol.UI.input.checkbox('evoxpTRS1', '0'), Evol.UI.fieldLabelSpan('evoxpTRS1', evoLangXpt.xpSQLTrans), '</div>', | ||
EvoExport.optEntityName('evoTable', i18nXpt.SQLTable, entity), | ||
'<div>', Evol.UI.input.checkbox('evoxpTRS2', '0'), Evol.UI.fieldLabelSpan('evoxpTRS2', i18nXpt.SQLId), '</div>', | ||
'<div>', Evol.UI.input.checkbox('evoxpTRS1', '0'), Evol.UI.fieldLabelSpan('evoxpTRS1', i18nXpt.SQLTrans), '</div>', | ||
'</div>' | ||
@@ -486,3 +489,3 @@ ].join(''); | ||
formEntityName: function(id,label,entity){ | ||
optEntityName: function(id,label,entity){ | ||
return [ | ||
@@ -489,0 +492,0 @@ Evol.UI.fieldLabel(id, label), |
@@ -47,6 +47,20 @@ /*! *************************************************************************** | ||
initialize: function (opts) { | ||
this.options=_.extend(this.options, opts); | ||
this.options=_.extend({}, this.options, opts); | ||
this.uiModel=this.options.uiModel; | ||
// - if no fields are provided, then get them from the uiModel | ||
if(this.options.uiModel && (!this.options.fields || this.options.fields.length===0)){ | ||
this.options.fields = Evol.Dico.getFields(this.options.uiModel); | ||
if(this.uiModel && (!this.options.fields || this.options.fields.length===0)){ | ||
this.options.fields = _.map(Evol.Dico.getFields(this.uiModel, function(f){ | ||
return f.type!==Evol.Dico.fieldTypes.hidden; | ||
}), | ||
function(f){ | ||
if(f.type!==Evol.Dico.fieldTypes.list){ | ||
return f; | ||
}else{ | ||
return _.extend(f, { | ||
type: Evol.Dico.fieldTypes.lov, | ||
trueType: Evol.Dico.fieldTypes.list | ||
}); | ||
} | ||
}); | ||
} | ||
@@ -147,9 +161,4 @@ return this; | ||
var $this=$(this), | ||
vc=$this.attr('checked'), | ||
allChecks=$this.siblings(); | ||
if(vc=='checked'){ | ||
allChecks.attr('checked',vc); | ||
}else{ | ||
allChecks.removeAttr('checked'); | ||
} | ||
vc=$this.prop('checked'); | ||
Evol.UI.toggleCheckbox($this.siblings(), $this.prop('checked')); | ||
}); | ||
@@ -279,3 +288,3 @@ this._filters=e.find('.evo-zfilters').on('click', 'a', function(){ | ||
var f=fields[i]; | ||
h.push(Evol.UI.input.option(f.id,f.label)); | ||
h.push(Evol.UI.input.option(f.id,f.label || f.labellist)); | ||
} | ||
@@ -330,4 +339,4 @@ h.push('</select>'); | ||
break; | ||
case fTypes.integer: | ||
case fTypes.decimal: | ||
case fTypes.int: | ||
case fTypes.dec: | ||
case fTypes.money: | ||
@@ -392,4 +401,4 @@ h.push(fOption(fOps.sEqual, evoLang.sNumEqual), | ||
case fTypes.time: | ||
case fTypes.integer: | ||
case fTypes.decimal: | ||
case fTypes.int: | ||
case fTypes.dec: | ||
case fTypes.money: | ||
@@ -417,6 +426,6 @@ var iType=(fType==fTypes.date)?'text':fType; | ||
case fTypes.lov: | ||
$value.find('#'+v.split(',').join(',#')).attr('checked', 'checked'); | ||
$value.find('#'+v.split(',').join(',#')).prop('checked', 'checked'); | ||
break; | ||
case fTypes.bool: | ||
$value.find('#value'+v).attr('checked', 'checked'); | ||
$value.find('#value'+v).prop('checked', 'checked'); | ||
break; | ||
@@ -503,4 +512,4 @@ default: | ||
break; | ||
case ft.integer: | ||
case ft.decimal: | ||
case ft.int: | ||
case ft.dec: | ||
case ft.time: | ||
@@ -507,0 +516,0 @@ fv.label=vval; |
@@ -66,2 +66,3 @@ /*! *************************************************************************** | ||
uiModel: uiModel, | ||
pageSize: 20, | ||
titleSelector: '#title' | ||
@@ -68,0 +69,0 @@ }).render(); |
@@ -19,6 +19,6 @@ /*! *************************************************************************** | ||
text: 'text', | ||
txtm: 'textmultiline', | ||
textml: 'textmultiline', | ||
bool: 'boolean', | ||
dec: 'decimal', | ||
integer: 'integer', | ||
int: 'integer', | ||
date: 'date', | ||
@@ -71,5 +71,5 @@ time: 'time', | ||
return $f.prop('checked'); | ||
case ft.integer: | ||
case ft.int: | ||
return parseInt($f.val(),10); | ||
case ft.decimal: | ||
case ft.dec: | ||
case ft.money: | ||
@@ -146,13 +146,13 @@ return parseFloat($f.val()); | ||
isTypeDateOrTime: function(fType){ | ||
return fType == EvoDico.fieldTypes.datetime || EvoDico.fieldTypes.date || fType==EvoDico.fieldTypes.time; | ||
var ft=this.fieldTypes; | ||
return fType == ft.datetime || ft.date || fType == ft.time; | ||
}, | ||
/* | ||
showDesigner: function(id, type, $el, context){ | ||
var $elDes=$('<div class="evodico-'+type+'"></div>'), | ||
model, | ||
uiModel; | ||
//TODO set record | ||
this.getFields (dico_field_ui, function(m){ | ||
return m.get('id')==''; | ||
}) | ||
uiModel=context.options.uiModel; | ||
//TODO set record | ||
context.getFields(dico_field_ui); | ||
switch(type){ | ||
@@ -192,6 +192,7 @@ case 'object': | ||
}); | ||
Evol.UI.HTMLModal(); | ||
return this; | ||
}, | ||
*/ | ||
filterModels: function(models, filters){ | ||
@@ -311,2 +312,6 @@ if(filters.length){ | ||
break; | ||
case fTypes.email: | ||
return Evol.UI.linkEmail(f.id, v); | ||
case fTypes.url: | ||
return Evol.UI.link(f.id, v, v, f.id); | ||
default: | ||
@@ -334,4 +339,4 @@ return v; | ||
h.push('<div class="disabled evo-rdonly" id="',fid); | ||
if(fld.type===fTypes.txtm && fld.height>1){ | ||
h.push('" style="height:', fld.height, 'em;'); | ||
if(fld.type===fTypes.textml && fld.height>1){ | ||
h.push('" style="height:', fld.height, 'em;overflow-y: auto;'); | ||
} | ||
@@ -351,3 +356,3 @@ h.push('">'); | ||
break; | ||
case fTypes.integer: | ||
case fTypes.int: | ||
case fTypes.dec: | ||
@@ -363,3 +368,3 @@ h.push(EvoUI.input.textInt(fid, fv, fld.max, fld.min)); | ||
break; | ||
case fTypes.txtm: | ||
case fTypes.textml: | ||
case fTypes.html: | ||
@@ -397,3 +402,3 @@ // fv = _.escape(fv); | ||
h.push('<div class="input-group">', EvoUI.input.typeFlag(Evol.i18n.sgn_email), | ||
EvoUI.input.text(fid, fv, fld.maxlength, 'evo-field form-control'), '</div>'); | ||
EvoUI.input.text(fid, fv, fld), '</div>'); | ||
} | ||
@@ -405,3 +410,3 @@ break; | ||
} else { | ||
h.push(EvoUI.input.text(fid, fv, fld.maxlength)); | ||
h.push(EvoUI.input.text(fid, fv, fld)); | ||
} | ||
@@ -408,0 +413,0 @@ break; |
@@ -58,2 +58,3 @@ // Evolutility Localization Library ENGLISH | ||
saved: 'Record saved.', | ||
unSavedChanges: 'You have unsaved changes.\nClick OK to navigate without saving your changes.', | ||
DeleteEntity:'Delete {0} "{1}"?', // {0}=entity {1}=leadfield value, | ||
@@ -92,2 +93,3 @@ DeleteEntities: 'Delete {0} {1}?', // delete 5 tasks | ||
decimal:'"{0}" must be a valid decimal numbers.', | ||
money:'"{0}" must be a valid number.', | ||
date:'"{0}" must be a valid date, format must be "MM/DD/YYYY" like "12/24/2014".', | ||
@@ -99,3 +101,3 @@ datetime:'"{0}" must be a valid date/time, format must be "MM/DD/YYYY hh:mm AM/PM" like "12/24/2014 10:30 AM".', | ||
maxlength:'"{0}" must be {1} characters long maximum.', | ||
minlength:'"{0}" must be less than {1} characters long.', | ||
minlength:'"{0}" must be at least {1} characters long.', | ||
minmaxlength:'"{0}" must be between {1} and {2} characters long.', | ||
@@ -117,19 +119,24 @@ regex:'The value "{0}" is not of the expected format.' | ||
preview:'Export preview', | ||
ExportHeader: 'Header', | ||
ExportSeparator: 'Separator', | ||
ExportFirstLine:'First line for field names', | ||
ExportFormat: 'Export format', | ||
ExportFields: 'Fields to include in the export', | ||
header: 'Header', | ||
separator: 'Separator', | ||
firstLine:'First line for field names', | ||
format: 'Export format', | ||
xpFields: 'Fields to include in the export', | ||
IDkey: 'ID - Primary key', | ||
AllFields: 'Show all fields', | ||
ExportFormats: 'Comma separated (CSV, TXT, XLS...)-HTML-SQL Insert Statements (SQL)-Tab separated values (TXT)-XML-Javascript Object Notation (JSON)', | ||
allFields: 'Show all fields', | ||
formatCSV: 'Comma separated (CSV, TXT, XLS...)', | ||
formatHTML: 'HTML', | ||
formatSQL: 'SQL Insert Statements (SQL)', | ||
formatTAB: 'Tab separated values (TXT)', | ||
formatXML: 'XML', | ||
formatJSON: 'Javascript Object Notation (JSON)', | ||
//xpColors:'Header color-Color odd rows-Color even rows', | ||
//xpColMap:'Columns map to', | ||
xpXMLroot:'Element name', // 'Root element name' | ||
XMLroot:'Element name', // 'Root element name' | ||
//xpXMLAttr:'Attributes', | ||
//xpXMLElem:'Elements', | ||
xpSQL:'SQL Options', | ||
xpSQLTable:'Table name', | ||
xpSQLTrans:'Inside transaction', | ||
xpSQLId:'Enable identity insert', | ||
SQL:'SQL Options', | ||
SQLTable:'Table name', | ||
SQLTrans:'Inside transaction', | ||
SQLId:'Enable identity insert', | ||
DownloadEntity:'Download {0}' | ||
@@ -136,0 +143,0 @@ }, |
@@ -16,29 +16,14 @@ /*! *************************************************************************** | ||
customize: function () { | ||
var labels = this.$('h4 > a.evol-nav-id'); | ||
if(this._custOn){ | ||
labels.find('i').remove(); | ||
this._custOn=false; | ||
}else{ | ||
labels.append(Evol.UI.iconCustomize('id','field')); | ||
this._custOn=true; | ||
} | ||
return this; | ||
}, | ||
_render: function (models) { | ||
var h = [], | ||
opts = this.options, | ||
pSize = opts.pageSize || 50, | ||
pSummary = this.pageSummary(0, pSize, models.length); | ||
_render: function (models) { | ||
var h = []; | ||
//if(models && models.length>0){ | ||
var opts = this.options, | ||
uim = opts.uiModel, | ||
pSize = opts.pageSize || 50, | ||
pSummary = this.pageSummary(0, pSize, models.length, uim.entity, uim.entities); | ||
h.push('<div class="evol-many-badges">'); | ||
this.renderBody(h, this.getFields(), pSize, uim.icon, 0,opts.selectable); | ||
h.push(pSummary); | ||
//this._HTMLpagination(h,0, pSize, models.length); | ||
h.push('</div>'); | ||
//}else{ | ||
// h.push(Evol.UI.HTMLMsg(Evol.i18n.nodata,'','info')); | ||
//} | ||
h.push('<div class="evol-many-badges"><div class="evol-badges-body">'); | ||
this._HTMLbody(h, this.getFields(), pSize, this.uiModel.icon, 0, opts.selectable); | ||
h.push('</div>'); | ||
this._HTMLpagination(h, 0, pSize, models.length); | ||
h.push('<div class="evo-many-summary">', pSummary, '</div>'); | ||
h.push('</div>'); | ||
this.$el.html(h.join('')); | ||
@@ -48,15 +33,7 @@ return this; | ||
setPage: function(pageIdx){ | ||
var h = [], | ||
fields = this.getFields(), | ||
opts = this.options, | ||
uim = opts.uiModel, | ||
pSize = opts.pageSize || 20; | ||
this.renderBody(h, fields, pSize, uim.icon, pageIdx, opts.selectable); | ||
this.$('.evol-many-badges').html(h.join('')); | ||
this.$el.trigger('status', this.pageSummary(pageIdx, pSize, this.collection.length ,uim.entity, uim.entities)); | ||
_$body: function(){ | ||
return this.$('.evol-badges-body'); | ||
}, | ||
renderBody: function (h, fields, pSize, icon, pageIdx, selectable) { | ||
_HTMLbody: function (h, fields, pSize, icon, pageIdx, selectable) { | ||
var data = this.collection.models, | ||
@@ -99,5 +76,17 @@ r, | ||
h.push('</div>'); | ||
} | ||
}/*, | ||
customize: function () { | ||
var labels = this.$('h4 > a.evol-nav-id'); | ||
if(this._custOn){ | ||
labels.find('i').remove(); | ||
this._custOn=false; | ||
}else{ | ||
labels.append(Evol.UI.iconCustomize('id','field')); | ||
this._custOn=true; | ||
} | ||
return this; | ||
}*/ | ||
}); | ||
@@ -48,3 +48,3 @@ /*! *************************************************************************** | ||
chartFields = EvoDico.getFields(uiModel, function(f){ | ||
return f.viewcharts || f.type==fTypes.lov || f.type==fTypes.bool || f.type==fTypes.integer; | ||
return f.viewcharts || f.type==fTypes.lov || f.type==fTypes.bool || f.type==fTypes.int; | ||
}); | ||
@@ -83,5 +83,5 @@ | ||
if(f.type===fTypes.lov){ | ||
h.push(EvoUI.Charts.Pie(i18n.getLabel('charts.aByB',entityName,f.label), data, labels, style, sizes)); | ||
h.push(EvoUI.Charts.Pie(i18n.getLabel('charts.aByB', entityName, f.labelcharts || f.label), data, labels, style, sizes)); | ||
}else{ | ||
h.push(EvoUI.Charts.Bars(i18n.getLabel('charts.aB',entityName,f.label), data, labels, style, sizes)); | ||
h.push(EvoUI.Charts.Bars(i18n.getLabel('charts.aB', entityName, f.labelcharts || f.label), data, labels, style, sizes)); | ||
} | ||
@@ -93,4 +93,9 @@ }); | ||
h.push(EvoUI.html.clearer); | ||
}, | ||
setPage: function(){ | ||
// do nothing | ||
// b/c it can be invoked for all view Many | ||
} | ||
}); |
@@ -18,6 +18,6 @@ /*! *************************************************************************** | ||
var h = [], | ||
that = this, | ||
opts = this.options, | ||
selectable = opts.selectable, | ||
fields = this.getFields(), | ||
uim = opts.uiModel, | ||
pSize = opts.pageSize || 50, | ||
@@ -28,16 +28,14 @@ link = (this.options.links!==false), | ||
h.push('<div class="evol-many-list">', | ||
//'<div class="panel ',this.options.style,'">', | ||
'<table class="table table-bordered',link?' table-hover':'','"><thead><tr>'); | ||
'<table class="table table-bordered', link?' table-hover':'', '"><thead><tr>'); | ||
if(selectable){ | ||
h.push('<th>',this._HTMLCheckbox('cbxAll'),'</th>'); | ||
} | ||
for (var i=0; i<fields.length; i++) { | ||
this._HTMLlistHeader(h, fields[i]); | ||
} | ||
_.each(fields, function(field){ | ||
that._HTMLlistHeader(h, field); | ||
}); | ||
h.push('</tr></thead><tbody>'); | ||
this._HTMLlistBody(h, fields, pSize, uim.icon, 0, selectable); | ||
this._HTMLbody(h, fields, pSize, opts.uiModel.icon, 0, selectable); | ||
h.push('</tbody></table>'); | ||
// TODO uncomment & finish it | ||
// h.push(this.pageSummary(opts.pageIndex, pSize, models.length, uim.entity, uim.entities)); | ||
// //this._HTMLpagination(h, 0, pSize, models.length); | ||
this._HTMLpagination(h, 0, pSize, models.length); | ||
h.push('<div class="evo-many-summary">', this.pageSummary(opts.pageIndex, pSize, models.length), '</div>'); | ||
h.push('</div>'); | ||
@@ -47,16 +45,7 @@ this.$el.html(h.join('')); | ||
setPage: function(pageIdx){ | ||
var h=[], | ||
fields = this.getFields(), | ||
opts = this.options, | ||
uim = opts.uiModel, | ||
pSize = opts.pageSize || 20; | ||
this._HTMLlistBody(h, fields, pSize, uim.icon, pageIdx, opts.selectable); | ||
this.$('.table > tbody').html(h.join('')); | ||
//this.options.pageIndex=pageIdx; | ||
this.$el.trigger('status', this.pageSummary(pageIdx, pSize, this.collection.length ,uim.entity, uim.entities)); | ||
return this; | ||
_$body: function(){ | ||
return this.$('.table > tbody'); | ||
}, | ||
_HTMLlistBody: function(h, fields, pSize, icon, pageIdx, selectable){ | ||
_HTMLbody: function(h, fields, pSize, icon, pageIdx, selectable){ | ||
var data = this.collection.models, | ||
@@ -63,0 +52,0 @@ r, |
129
js/many.js
@@ -17,2 +17,3 @@ /*! *************************************************************************** | ||
viewType:'many', | ||
editable: false, | ||
cardinality: 'n', | ||
@@ -33,3 +34,3 @@ | ||
'click .evol-nav-id': 'click_navigate', | ||
'click .evol-sort-icons > i': 'click_sort', | ||
'click .evol-sort-icons>i': 'click_sort', | ||
'click .pagination>li': 'click_pagination', | ||
@@ -42,4 +43,7 @@ 'click .evol-field-label .glyphicon-wrench': 'click_customize', | ||
initialize: function (opts) { | ||
var that=this; | ||
this.options=_.extend(this.options, opts); | ||
var lastSort = localStorage.getItem(opts.uiModel.id+'-sort'), | ||
that=this; | ||
this.options=_.extend({}, this.options, opts); | ||
this.uiModel=this.options.uiModel; | ||
this.pageIndex=this.options.pageIndex; | ||
this.mode=this.options.mode || ''; | ||
@@ -49,3 +53,3 @@ this._filter=[]; | ||
if(this.collection){ | ||
this.collection.on('change', function(model){ | ||
this.collection.on('change', function(){ | ||
that.render(); | ||
@@ -56,2 +60,9 @@ }); | ||
this._custOn=false; | ||
if(lastSort!==null){ | ||
var ls=lastSort.split('-'), | ||
f=this.getField(ls[0]); | ||
if(ls.length>1 && !_.isUndefined(f)){ | ||
this.sortList(f, ls[1]==='down', true); | ||
} | ||
} | ||
}, | ||
@@ -118,3 +129,3 @@ | ||
getTitle: function (){ | ||
return Evol.UI.capitalize(this.options.uiModel.entities); | ||
return Evol.UI.capitalize(this.uiModel.entities); | ||
}, | ||
@@ -124,3 +135,3 @@ | ||
if(!this._fields){ | ||
this._fields=Evol.Dico.getFields(this.options.uiModel, function(f){ | ||
this._fields=Evol.Dico.getFields(this.uiModel, function(f){ | ||
return f.viewmany; | ||
@@ -138,7 +149,33 @@ }); | ||
getField: function (fid){ | ||
if(!this._fieldHash){ | ||
this.getFields(); | ||
} | ||
return this._fieldHash[fid]; | ||
}, | ||
setPage: function(pageIdx){ | ||
var h = [], | ||
fields = this.getFields(), | ||
opts = this.options, | ||
pSize = opts.pageSize, | ||
collecLength =this.collection.length, | ||
pSummary = this.pageSummary(pageIdx, pSize, collecLength); | ||
this._HTMLbody(h, fields, pSize, this.uiModel.icon, pageIdx, opts.selectable); | ||
this._$body().html(h.join('')); | ||
h=[]; | ||
this._HTMLpaginationBody(h, pageIdx, pSize, collecLength); | ||
this.$('.evo-pagination').html(h.join('')); | ||
this.$('.evo-many-summary').html(pSummary); | ||
this.pageIndex = pageIdx; | ||
this.$el.trigger('status', pSummary); | ||
return this; | ||
}, | ||
getPage: function(){ | ||
return this.pageIndex; | ||
}, | ||
_HTMLField: function(f, v){ | ||
return Evol.Dico.HTMLField4Many( f, v, Evol.hashLov, this.options.iconsPath || ''); | ||
return Evol.Dico.HTMLField4Many(f, v, Evol.hashLov, this.options.iconsPath || ''); | ||
}, | ||
@@ -159,8 +196,8 @@ | ||
pageSummary: function (pIdx, pSize, cSize, entity, entities) { | ||
pageSummary: function (pIdx, pSize, cSize) { | ||
if (cSize === 0) { | ||
return cSize + ' ' + entities; | ||
return ''; | ||
} else if (cSize === 1) { | ||
return cSize + ' ' + entity; | ||
}else{ | ||
return cSize + ' ' + this.uiModel.entity; | ||
} else { | ||
var rangeBegin = (pIdx || 0) * pSize + 1, rangeEnd; | ||
@@ -172,37 +209,51 @@ if (pIdx < 1) { | ||
} | ||
return Evol.i18n.range.replace('{0}',rangeBegin) | ||
.replace('{1}',rangeEnd) | ||
.replace('{2}',cSize) | ||
.replace('{3}',entities); | ||
return Evol.i18n.range | ||
.replace('{0}', rangeBegin) | ||
.replace('{1}', rangeEnd) | ||
.replace('{2}', cSize) | ||
.replace('{3}', this.uiModel.entities); | ||
} | ||
}, | ||
/* | ||
_HTMLpagination: function (h, pIdx, pSize, cSize) { | ||
if(cSize>pSize){ | ||
if(cSize > pSize){ | ||
h.push('<ul class="evo-pagination pagination pagination-sm">'); | ||
this._HTMLpaginationBody(h, pIdx, pSize, cSize); | ||
h.push('</ul>'); | ||
} | ||
}, | ||
_HTMLpaginationBody: function (h, pIdx, pSize, cSize){ | ||
if(cSize > pSize){ | ||
var nbPages = Math.ceil(cSize / pSize), | ||
pageId = pIdx + 1, | ||
iMin = pIdx * pSize + 1, | ||
iMax = ((nbPages > 5) ? 5 : nbPages); | ||
pId = pIdx + 1, | ||
iMin, | ||
iMax; | ||
h.push('<ul class="evo-pagination pagination pagination-sm">'); | ||
if(nbPages<6){ | ||
iMin = 1; | ||
iMax = nbPages; | ||
}else { | ||
iMin = pIdx + 1; | ||
iMax = iMin + 5; | ||
} | ||
h.push('<li data-id="prev"', | ||
(pageId===1)?' class="disabled"':'', | ||
(pId===1)?' class="disabled"':'', | ||
'><a href="#">«</a></li>'); | ||
for (var i=iMin; i<iMax+1; i++) { | ||
h.push('<li', | ||
(pageId===i)?' class="active"':'', | ||
(pId===i)?' class="active"':'', | ||
' data-id="', i, '"><a href="#">', i, '</a></li>'); | ||
} | ||
h.push('<li data-id="next"', | ||
(cSize > pageId * pSize)?'':' class="disabled"', | ||
(cSize > pId * pSize)?'':' class="disabled"', | ||
'><a href="#">»</a></li>'); | ||
h.push('</ul>'); | ||
} | ||
},*/ | ||
}, | ||
sortList: function(f, down){ | ||
var collec=this.collection, | ||
ft=Evol.Dico.fieldTypes; | ||
sortList: function(f, down, noRemember){ | ||
var collec = this.collection, | ||
ft = Evol.Dico.fieldTypes; | ||
if(!_.isUndefined(collec)){ | ||
if(f.type==ft.text || f.type==ft.txtm || f.type==ft.email){ | ||
if(f.type==ft.text || f.type==ft.textml || f.type==ft.email){ | ||
collec.comparator = Evol.Dico.bbComparatorText(f.id); | ||
@@ -216,8 +267,8 @@ }else{ | ||
} | ||
if(this.setPage){ | ||
this.setPage(0); | ||
}else{ | ||
this.render(); | ||
this.setPage(0); | ||
var direction = down?'down':'up'; | ||
if(!noRemember){ | ||
localStorage.setItem(this.uiModel.id+'-sort', f.id+'-'+direction); | ||
} | ||
this.$el.trigger('list.sort', {id: f.id, direction:down?'down':'up'}); | ||
this.$el.trigger('list.sort', {id: f.id, direction:direction}); | ||
} | ||
@@ -227,3 +278,3 @@ }, | ||
click_navigate: function (evt) { | ||
evt.type='list.navigate'; | ||
evt.type = 'list.navigate'; | ||
this.$el.trigger(evt, {id: $(evt.currentTarget).closest('[data-mid]').data('mid')}); | ||
@@ -255,7 +306,5 @@ }, | ||
click_selection: function (evt) { | ||
if($(evt.currentTarget).data('id')==='cbxAll'){ | ||
}else{ | ||
//if($(evt.currentTarget).data('id')!=='cbxAll'){ | ||
this.$el.trigger('selection'); | ||
} | ||
//} | ||
}, | ||
@@ -262,0 +311,0 @@ |
@@ -19,5 +19,5 @@ /*! *************************************************************************** | ||
var pref = '#' + this.prefix + '-', | ||
fs=Evol.Dico.getFields(this.options.uiModel, function(m){ | ||
return m.type === 'list'; | ||
}); | ||
fs= _.filter(this.getFields(), function(f){ | ||
return f.type === 'list' && !f.readonly; | ||
}); | ||
_.each(fs, function(f){ | ||
@@ -24,0 +24,0 @@ this.$(pref + f.id).select2( |
@@ -15,5 +15,7 @@ /*! *************************************************************************** | ||
viewName: 'view', | ||
editable: false, | ||
prefix: 'ovw', | ||
getData: function () { | ||
// TODO make JSON obj w/ model limited to fields in uimodel? | ||
return {}; | ||
@@ -33,3 +35,3 @@ }, | ||
$f=that.$(prefix + f.id); | ||
fv=model.get(f.id); | ||
fv=model.get(f.attribute || f.id); | ||
if(model){ | ||
@@ -39,13 +41,17 @@ switch(f.type){ | ||
case fTypes.bool: | ||
case fTypes.email: | ||
case fTypes.url: | ||
case fTypes.html: | ||
$f.html(Evol.Dico.HTMLField4Many(f, fv, Evol.hashLov, iconsPath)); | ||
break; | ||
case fTypes.url: | ||
$f.html(Evol.UI.link(f.id, fv, fv, f.id)); | ||
break; | ||
case fTypes.email: | ||
$f.html(Evol.UI.linkEmail(f.id, fv)); | ||
break; | ||
case fTypes.pix: | ||
$f.html((fv)?('<img src="'+iconsPath+fv+'" class="img-thumbnail">'):('<p>'+Evol.i18n.nopix+'</p>')); | ||
break; | ||
case fTypes.textml: | ||
if(fv){ | ||
$f.html(_.escape(fv).replace(/[\r\n]/g, '</br>')); | ||
}else{ | ||
$f.html(''); | ||
} | ||
break; | ||
default: | ||
@@ -81,3 +87,3 @@ $f.text(Evol.Dico.HTMLField4Many(f, fv, Evol.hashLov, iconsPath) || ' '); | ||
case fTypes.bool: | ||
$f.prop('checked', f.defaultvalue || ''); | ||
$f.prop('checked', f.defaultvalue?'checked':false); | ||
break; | ||
@@ -84,0 +90,0 @@ case fTypes.pix: |
392
js/one.js
@@ -18,2 +18,3 @@ /*! *************************************************************************** | ||
cardinality: '1', | ||
editable: true, | ||
@@ -38,5 +39,8 @@ events: { | ||
initialize: function (opts) { | ||
this.options=_.extend(this.options, opts); | ||
this.mode= opts.mode || this.options.mode || this.viewName; | ||
this._uTitle=(!_.isUndefined(this.options.titleSelector)) && this.options.titleSelector!==''; | ||
this.options=_.extend({}, this.options, opts); | ||
this.mode = opts.mode || this.options.mode || this.viewName; | ||
this.uiModel = this.options.uiModel; | ||
this._tabId = false; | ||
this._uTitle = (!_.isUndefined(this.options.titleSelector)) && this.options.titleSelector!==''; | ||
this._subCollecs=this._subCollecsOK=false; | ||
/* | ||
@@ -57,3 +61,3 @@ if(this.model){ | ||
this.postRender(); | ||
this.setData(this.model); // TODO remove it | ||
this.setData(this.model, true); // TODO remove it | ||
return this; | ||
@@ -69,3 +73,3 @@ }, | ||
if(!this._fields){ | ||
this._fields=Evol.Dico.getFields(this.options.uiModel, this.getFieldsCondition); | ||
this._fields=Evol.Dico.getFields(this.uiModel, this.getFieldsCondition); | ||
this._fieldHash={}; | ||
@@ -81,4 +85,5 @@ var that=this; | ||
getSubCollecs: function (){ | ||
if(!this._subCollecs){ | ||
this._subCollecs=Evol.Dico.getSubCollecs(this.options.uiModel); | ||
if(!this._subCollecsOK){ | ||
this._subCollecs=Evol.Dico.getSubCollecs(this.uiModel); | ||
this._subCollecsOK=true; | ||
} | ||
@@ -92,3 +97,3 @@ return this._subCollecs; | ||
.clearMessages() | ||
.setData(model); | ||
.setData(model, true); | ||
}, | ||
@@ -101,10 +106,8 @@ | ||
setUIModel: function(uimodel) { | ||
this.options.uiModel = uimodel; | ||
var d=this.getData(); | ||
return this | ||
.render() | ||
.setData(d); | ||
this.uiModel = uimodel; | ||
//var d=this.getData(); | ||
return this.clearCache().render(); //.setData(d); | ||
}, | ||
getUIModel: function() { | ||
return this.options.uiModel; | ||
return this.uiModel; | ||
}, | ||
@@ -121,10 +124,10 @@ /* | ||
if(this.model){ | ||
var lf=this.options.uiModel.leadfield; | ||
var lf=this.uiModel.leadfield; | ||
return _.isFunction(lf)?lf(this.model):this.model.get(lf); | ||
}else{ | ||
return Evol.UI.capitalize(this.options.uiModel.entity); | ||
return Evol.UI.capitalize(this.uiModel.entity); | ||
} | ||
}, | ||
getData: function () { | ||
getData: function (skipReadOnlyFields) { | ||
var that = this, | ||
@@ -155,10 +158,17 @@ fs=this.getFields(), | ||
}); | ||
vs[sc.attr]=vs2; | ||
vs[sc.attr||sc.id]=vs2; | ||
}); | ||
} | ||
if(skipReadOnlyFields){ | ||
_.each(this.getFields(),function(f){ | ||
if(f.readonly){ | ||
delete vs[f.id]; | ||
} | ||
}); | ||
} | ||
return vs; | ||
}, | ||
setData: function (model) { | ||
if((!_.isUndefined(model)) && model!==null){ | ||
setData: function (model, isModel) { | ||
if(!_.isUndefined(model) && model!==null){ | ||
var fs = this.getFields(), | ||
@@ -172,40 +182,62 @@ that=this, | ||
newPix; | ||
_.each(fs, function (f) { | ||
$f=that.$(prefix + f.id); | ||
fv=model.get(f.id); | ||
if(model){ | ||
if(f.readonly){ | ||
if(f.type===fTypes.pix){ | ||
newPix=(fv)?('<img src="'+iconsPath+fv+'" class="img-thumbnail">'):('<p class="">'+Evol.i18n.nopix+'</p>'); | ||
$f.val(fv) | ||
.prev().remove(); | ||
$f.before(newPix); | ||
}else{ | ||
$f.text(fv || ''); | ||
} | ||
if(isModel){ | ||
fv=model.get(f.attribute || f.id); | ||
}else{ | ||
fv=model[f.attribute || f.id]; | ||
} | ||
if(f.readonly){ | ||
if(f.type===fTypes.pix){ | ||
newPix=(fv)?('<img src="'+iconsPath+fv+'" class="img-thumbnail">'):('<p class="">'+Evol.i18n.nopix+'</p>'); | ||
$f.val(fv) | ||
.prev().remove(); | ||
$f.before(newPix); | ||
}else{ | ||
switch(f.type) { | ||
switch(f.type){ | ||
case fTypes.lov: | ||
var $fc=$f.children().removeAttr('selected'); | ||
if(fv!==''){ | ||
$fc.filter('[value='+fv+']') | ||
.attr('selected', true); | ||
} | ||
break; | ||
case fTypes.bool: | ||
$f.prop('checked', fv); | ||
case fTypes.email: | ||
case fTypes.url: | ||
$f.html(Evol.Dico.HTMLField4Many(f, fv, Evol.hashLov, iconsPath)); | ||
break; | ||
case fTypes.pix: | ||
newPix=(fv)?('<img src="'+iconsPath+fv+'" class="img-thumbnail">'):('<p class="">'+Evol.i18n.nopix+'</p>'); | ||
$f.val(fv) | ||
.prev().remove(); | ||
$f.before(newPix); | ||
$f.html((fv)?('<img src="'+iconsPath+fv+'" class="img-thumbnail">'):('<p>'+Evol.i18n.nopix+'</p>')); | ||
break; | ||
case fTypes.list: | ||
$f.select2('val', fv); | ||
case fTypes.textml: | ||
$f.html(v.replace(/[\r\n]/g, '<br/>')); | ||
break; | ||
default: | ||
$f.val(fv); | ||
$f.text(Evol.Dico.HTMLField4Many(f, fv, Evol.hashLov, iconsPath) || ' '); | ||
} | ||
} | ||
}else{ | ||
switch(f.type) { | ||
case fTypes.lov: | ||
var $fc=$f.children().removeAttr('selected'); | ||
if(fv!==''){ | ||
$fc.filter('[value='+fv+']') | ||
.attr('selected', true); | ||
} | ||
break; | ||
case fTypes.bool: | ||
if(fv){ | ||
$f.prop('checked', 'checked'); | ||
}else{ | ||
$f.prop('checked', false); | ||
} | ||
break; | ||
case fTypes.pix: | ||
newPix=(fv)?('<img src="'+iconsPath+fv+'" class="img-thumbnail">'):('<p class="">'+Evol.i18n.nopix+'</p>'); | ||
$f.val(fv) | ||
.prev().remove(); | ||
$f.before(newPix); | ||
break; | ||
case fTypes.list: | ||
$f.select2('val', fv); | ||
break; | ||
default: | ||
$f.val(fv); | ||
} | ||
} | ||
@@ -221,2 +253,5 @@ }); | ||
} | ||
}else{ | ||
// TODO show no data msg or something | ||
this.clear(); | ||
} | ||
@@ -255,3 +290,3 @@ return this.setTitle(); | ||
case ft.bool: | ||
$f.prop('checked', defaultVal); | ||
$f.prop('checked', defaultVal?'checked':false); | ||
break; | ||
@@ -285,2 +320,9 @@ case ft.list: | ||
clearCache: function(fid, fvDefault, mode){ | ||
this._fieldHash=null; | ||
this._fields=null; | ||
this._subCollecsOK=false; | ||
return this; | ||
}, | ||
getModelFieldValue: function(fid, fvDefault, mode){ | ||
@@ -294,18 +336,75 @@ if(this.model && this.model.has(fid)){ | ||
isDirty: function(){ | ||
// TODO | ||
/* | ||
var data=this.getData(), | ||
model=this.model; | ||
function nullOrUndef(v){ | ||
return v==='' || _.isUndefined(v) || v===null || v===false; | ||
} | ||
function emptyOrUndef(v){ | ||
return v===null || _.isUndefined(v) || v===[]; | ||
} | ||
if(this.editable){ | ||
var fs= this.getFields(), | ||
ft=Evol.Dico.fieldTypes, | ||
data=this.getData(), | ||
model=this.model, | ||
i, | ||
iMax=fs.length, | ||
subCollecs=this.getSubCollecs(), | ||
noModelVal, | ||
noDataVal; | ||
for(var prop in data){ | ||
if(data[prop] !== model.get(prop)){ | ||
alert('data[prop]='+data[prop]+' - model.get(prop)='+model.get(prop)); //TODO remove this alert | ||
return true; | ||
} | ||
}*/ | ||
for (i = 0; i < iMax; i++) { | ||
var f=fs[i], | ||
prop = f.attribute || f.id, | ||
dataVal = data[prop], | ||
modelVal = model.get(prop); | ||
noModelVal = nullOrUndef(modelVal); | ||
noDataVal = nullOrUndef(dataVal) || (isNaN(dataVal) && (f.type===ft.int || f.type===ft.dec || f.type===ft.money)); | ||
if(_.isArray(modelVal)){ | ||
if(!_.isEqual(modelVal, dataVal)){ | ||
return true; | ||
} | ||
// TODO compare arrays? | ||
}else if(!(dataVal == modelVal || (noDataVal && noModelVal))) { | ||
return true; | ||
} | ||
} | ||
if(subCollecs){ | ||
var scIds=Object.keys(subCollecs); | ||
iMax=scIds.length; | ||
for (i = 0; i<iMax; i++) { | ||
var scId=scIds[i], | ||
dVals=data[scId], | ||
mVals=this.model.get(scId), | ||
fs2=subCollecs[scId].elements; | ||
if(emptyOrUndef(dVals)){ | ||
dVals=[]; | ||
} | ||
if(emptyOrUndef(mVals)){ | ||
mVals=[]; | ||
} | ||
if(dVals.length!==mVals.length){ | ||
return true; | ||
}else{ | ||
for(var r=0;r<dVals.length;r++){ | ||
var dObj = dVals[r], | ||
mObj = mVals[r]; | ||
for(var j=0;j<fs2.length;j++) { | ||
var fid = fs2[j].id, | ||
dv=dObj[fid], | ||
mv=mObj[fid], | ||
dNo=nullOrUndef(dv), | ||
mNo=nullOrUndef(mv); | ||
if(dNo!==mNo || (dv!==mv)){ | ||
return true; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
return false; | ||
}, | ||
showTab: function (tabid) { | ||
var tab = this.$(tabid); | ||
showTab: function (tabId) { | ||
var tab = this.$(tabId); | ||
if (tab.length > 0) { | ||
@@ -315,3 +414,3 @@ tab.siblings('.tab-pane').hide(); | ||
} | ||
tab = this.$('.evol-tabs > li a[href="' + tabid + '"]').parent(); | ||
tab = this.$('.evol-tabs > li a[href="' + tabId + '"]').parent(); | ||
if (tab.length > 0) { | ||
@@ -321,3 +420,4 @@ tab.siblings('li').removeClass('active'); | ||
} | ||
this.$el.trigger('tab.show'); | ||
this._tabId = tabId; | ||
this.$el.trigger('tab.show', {id:tabId}); | ||
return this; | ||
@@ -342,4 +442,3 @@ }, | ||
iPanel = -1, | ||
opts = this.options, | ||
elems = opts.uiModel.elements, | ||
elems = this.uiModel.elements, | ||
iMax = elems.length; | ||
@@ -373,3 +472,3 @@ | ||
}else{ // if(p.type==='panel') | ||
that.renderPanel(h, p, 'p-' + p.id, mode); | ||
that.renderPanel(h, p, 'p-' + ((p.id)?p.id:idx), mode); | ||
} | ||
@@ -430,4 +529,4 @@ } | ||
} | ||
h.push('<div class="panel ', this.options.style, '">', | ||
Evol.UI.HTMLPanelLabel(p.label, pid, 'PanelLabel'), | ||
h.push( | ||
Evol.UI.HTMLPanelBegin(pid, p.label, this.options.style), | ||
'<fieldset data-pid="', pid, '">'); | ||
@@ -459,3 +558,5 @@ if(mode==='mini'){ | ||
} | ||
h.push('</fieldset></div></div>'); | ||
h.push('</fieldset>', | ||
Evol.UI.HTMLPanelEnd(), | ||
'</div>'); | ||
return this; | ||
@@ -466,4 +567,3 @@ }, | ||
h.push('<div style="width:', p.width, '%" class="evol-pnl pull-left" data-pid="', p.id,'">', | ||
'<div class="panel ', this.options.style, '">', | ||
Evol.UI.HTMLPanelLabel(p.label, p.id, 'PanelLabel'), | ||
Evol.UI.HTMLPanelBegin(p.id, p.label, this.options.style), | ||
'<table class="table" data-mid="', p.attr,'"><thead><tr>'); // table-striped | ||
@@ -478,3 +578,5 @@ _.each(p.elements, function (elem) { | ||
this._renderPanelListBody(h, p, null, mode); | ||
h.push('</tbody></table></div></div>'); | ||
h.push('</tbody></table>', | ||
Evol.UI.HTMLPanelEnd(), | ||
'</div>'); | ||
return this; | ||
@@ -552,6 +654,5 @@ }, | ||
if(this._uTitle){ | ||
var opts=this.options, | ||
selector=opts.titleSelector; | ||
var selector=this.options.titleSelector; | ||
if(selector && selector!==''){ | ||
var t,lf=opts.uiModel.leadfield; | ||
var t,lf=this.uiModel.leadfield; | ||
if(title){ | ||
@@ -562,3 +663,3 @@ t=title; | ||
}else{ | ||
t=Evol.UI.capitalize(opts.uiModel.entities); | ||
t=Evol.UI.capitalize(this.uiModel.entities); | ||
} | ||
@@ -586,6 +687,7 @@ $(selector).text(t); | ||
//TODO | ||
//_.each(subCollecs, function (sc) { | ||
//_.each(this._subCollecs, function (sc) { | ||
// var trs=that.$('[data-pid="'+sc.id+'"] tbody > tr'); | ||
// _.each(fs, function(f){ | ||
// }); | ||
//}); | ||
@@ -599,3 +701,3 @@ } | ||
email: /^[\w\.\-]+@[\w\.\-]+\.[\w\.\-]+$/, | ||
integer: /^-?\d+$/, | ||
integer: /^[-+]?\d+$/, | ||
decimalEN: /^\d+(\.\d+)?$/, | ||
@@ -607,3 +709,2 @@ decimalFR: /^\d+(\,\d+)?$/, | ||
checkFields: function (holder, fds) { | ||
var that = this, | ||
@@ -614,11 +715,10 @@ ft = Evol.Dico.fieldTypes, | ||
v, | ||
values = this.getData(); | ||
values = this.getData(true); | ||
function checkType(fd, v) { | ||
function checkType(fd, fv) { | ||
var ft = Evol.Dico.fieldTypes, | ||
fv = _.isArray(v)?'':Evol.UI.trim(v), | ||
i18nVal=Evol.i18n.validation; | ||
if (fv !== '' && !_.isArray(fv)){ // && !isNaN(fv) | ||
if (fv !== '' && !_.isArray(fv)){ | ||
switch (fd.type) { | ||
case ft.integer: | ||
case ft.int: | ||
case ft.email: | ||
@@ -631,6 +731,3 @@ if (!that.valRegEx[fd.type].test(fv)) { | ||
case ft.money: | ||
var regex = that.valRegEx[ft.dec + Evol.i18n.LOCALE]; | ||
if (regex === null) { | ||
regex = that.valRegEx[ft.dec + 'EN']; // default to English with "." | ||
} | ||
var regex = that.valRegEx[ft.dec + Evol.i18n.LOCALE] || that.valRegEx[ft.dec + 'EN']; | ||
if (!regex.test(fv)) | ||
@@ -675,5 +772,8 @@ flagField(fd, i18nVal[fd.type]); | ||
// Check required/empty or check type | ||
if (f.required && (v==='' || | ||
(f.type===ft.integer && isNaN(v)) || | ||
if(!f.readonly){ | ||
// Check required/empty or check type | ||
if (f.required && (v==='' || | ||
(f.type===ft.int && isNaN(v)) || | ||
(f.type===ft.dec && isNaN(v)) || | ||
(f.type===ft.money && isNaN(v)) || | ||
@@ -683,56 +783,61 @@ (f.type===ft.lov && v==='0') || | ||
(f.type===ft.color && v==='#000000'))){ | ||
flagField(f, i18nVal.empty); | ||
} | ||
checkType(f, v); | ||
flagField(f, i18nVal.empty); | ||
} else { | ||
if( !(isNaN(v) && (f.type===ft.int || f.type===ft.dec || f.type===ft.money))) { | ||
checkType(f, v); | ||
} | ||
// Check regexp | ||
if (f.regex !== null && !_.isUndefined(f.regex)) { | ||
var rg = new RegExp(f.regex); | ||
if (!v.match(rg)) { | ||
flagField(f, i18nVal.regex, f.label); | ||
} | ||
} | ||
/* | ||
// Check custom | ||
if (f.jsv !== null) { | ||
var p = eval([f.jsv, '("', that.prefix, f.id, '","', f.label, '")'].join('')); | ||
if (p !== null && p.length > 0) { | ||
flagField(f, p); | ||
} | ||
}*/ | ||
// Check regexp | ||
if (f.regex !== null && !_.isUndefined(f.regex)) { | ||
var rg = new RegExp(f.regex); | ||
if (!v.match(rg)) { | ||
flagField(f, i18nVal.regex, f.label); | ||
} | ||
} | ||
/* | ||
// Check custom | ||
if (f.customvalidation !== null) { | ||
//TODO do not use eval | ||
var p = eval([f.customvalidation, '("', that.prefix, f.id, '","', f.label, '")'].join('')); | ||
if (p !== null && p.length > 0) { | ||
flagField(f, p); | ||
} | ||
}*/ | ||
// Check min & max | ||
if (f.type===ft.integer || f.type===ft.decimal || f.type===ft.money) { | ||
if (v !== '') { | ||
if (f.max !== null && parseFloat(v) > f.max) { | ||
flagField(f, i18nVal.max, f.max); | ||
// Check min & max | ||
if (f.type === ft.int || f.type === ft.dec || f.type === ft.money) { | ||
if (v !== '') { | ||
if (f.max !== null && parseFloat(v) > f.max) { | ||
flagField(f, i18nVal.max, f.max); | ||
} | ||
if (f.min !== null && parseFloat(v) < f.min) { | ||
flagField(f, i18nVal.min, f.min); | ||
} | ||
} | ||
} | ||
if (f.min !== null && parseFloat(v) < f.min) { | ||
flagField(f, i18nVal.min, f.min); | ||
} | ||
} | ||
} | ||
// Check minlength and maxlength | ||
if (_.isString(v) && v.length > 0) { | ||
var ok = true, | ||
len = v.length; | ||
if(len>0){ | ||
if(f.maxlength){ | ||
ok = len <= f.maxlength; | ||
if(!ok){ | ||
if(f.minlength){ | ||
flagField(f, i18nVal.minmaxlength, f.minlength, f.maxlength); | ||
}else{ | ||
flagField(f, i18nVal.maxlength, f.maxlength); | ||
// Check minlength and maxlength | ||
if (_.isString(v) && v.length > 0) { | ||
var ok = true, | ||
len = v.length; | ||
if (len > 0) { | ||
if (f.maxlength) { | ||
ok = len <= f.maxlength; | ||
if (!ok) { | ||
if (f.minlength) { | ||
flagField(f, i18nVal.minmaxlength, f.minlength, f.maxlength); | ||
} else { | ||
flagField(f, i18nVal.maxlength, f.maxlength); | ||
} | ||
} | ||
} | ||
} | ||
if(ok && f.minlength){ | ||
ok = len >= f.minlength; | ||
if(!ok){ | ||
if(f.maxlength){ | ||
flagField(f, i18nVal.minmaxlength, f.minlength, f.maxlength); | ||
}else{ | ||
flagField(f, i18nVal.minlength, f.minlength); | ||
if (ok && f.minlength) { | ||
ok = len >= f.minlength; | ||
if (!ok) { | ||
if (f.maxlength) { | ||
flagField(f, i18nVal.minmaxlength, f.minlength, f.maxlength); | ||
} else { | ||
flagField(f, i18nVal.minlength, f.minlength); | ||
} | ||
} | ||
@@ -742,2 +847,3 @@ } | ||
} | ||
} | ||
@@ -752,3 +858,2 @@ | ||
} | ||
}, | ||
@@ -790,3 +895,3 @@ | ||
if(fld||fld.help){ | ||
if(fld && fld.help){ | ||
var $f=$el.closest('.evol-fld'), | ||
@@ -845,2 +950,10 @@ $fh=$f.find('.help-block'); | ||
setTab: function(tabId){ | ||
this._tabId = tabId; | ||
this.showTab(tabId); | ||
}, | ||
getTab: function(){ | ||
return this._tabId; | ||
}, | ||
click_button: function (evt) { | ||
@@ -892,2 +1005,3 @@ var bId = $(evt.currentTarget).data('id'); | ||
} | ||
this._tabId = id; | ||
}, | ||
@@ -894,0 +1008,0 @@ |
@@ -16,3 +16,3 @@ /*! *************************************************************************** | ||
'list.navigate >div': 'click_navigate', | ||
//'list.paginate >div': 'paginate', | ||
'list.paginate >div': 'paginate', | ||
'action >div': 'action_view', | ||
@@ -49,3 +49,3 @@ 'status >div': 'status_update', | ||
group: false, | ||
customize:false | ||
customize: false | ||
}, | ||
@@ -66,10 +66,10 @@ pageSize:20 | ||
views:[], | ||
viewsHash:{}, | ||
curView:null, | ||
_group:false, | ||
initialize: function (opts) { | ||
_.extend(this.options, opts); | ||
this.options=_.extend(this.options, opts); | ||
this.pageIndex = this.options.pageIndex; | ||
this.uiModel = this.options.uiModel; | ||
this.views=[]; | ||
this.viewsHash={}; | ||
this.tabId=false; | ||
//this._group=false; | ||
}, | ||
@@ -83,2 +83,5 @@ | ||
this.$('.dropdown-toggle').dropdown(); | ||
// TODO remove test below | ||
//this.mId=this.uiModel.id; | ||
return this; | ||
}, | ||
@@ -88,2 +91,3 @@ | ||
var h=[], | ||
eui=Evol.UI.menu, | ||
opts=this.options, | ||
@@ -94,26 +98,5 @@ endMenu='</ul></li>', | ||
function beginMenu(id, icon){ | ||
return ['<li class="dropdown" data-id="',id,'">', | ||
'<a href="#" class="dropdown-toggle" data-toggle="dropdown">',Evol.UI.icon(icon),' <b class="caret"></b></a>', | ||
'<ul class="dropdown-menu evo-dropdown-icons">'].join(''); | ||
} | ||
function link2h(id, label, icon, cardi, style){ | ||
h.push('<li data-id="',id,'"'); | ||
if(cardi){ | ||
h.push(' data-cardi="'+cardi,'"'); | ||
} | ||
if(style!=='label'){ | ||
h.push(' data-toggle="tooltip" data-placement="bottom" title="" data-original-title="',label,'"'); | ||
} | ||
h.push('><a href="#" data-id="',id,'">',Evol.UI.icon(icon)); | ||
if(style!=='tooltip'){ | ||
h.push(' ',label); | ||
} | ||
h.push('</a></li>'); | ||
} | ||
function linkOpt2h (id, label, icon, cardi){ | ||
if(opts.buttons && opts.buttons[id]){ | ||
link2h(id, label, icon, cardi, 'label'); | ||
h.push(eui.hItem(id, label, icon, cardi)); | ||
} | ||
@@ -134,8 +117,7 @@ } | ||
if(opts.toolbar){ | ||
link2h('prev','','chevron-left','x'); | ||
link2h('next','','chevron-right','x'); | ||
h.push('<li class="evo-tb-status" data-cardi="n"></li>'); | ||
h.push('</ul><ul class="nav nav-pills pull-right" data-id="views">'); | ||
h.push(beginMenu('views','eye-open')); | ||
h.push(eui.hItem('prev','','chevron-left','x'), | ||
eui.hItem('next','','chevron-right','x'), | ||
'<li class="evo-tb-status" data-cardi="n"></li>', | ||
'</ul><ul class="nav nav-pills pull-right" data-id="views">'); | ||
h.push(eui.hBegin('views','li','eye-open')); | ||
linkOpt2h('list','List','th-list','n'); | ||
@@ -149,5 +131,5 @@ linkOpt2h('badges','Badges','th-large','n'); | ||
linkOpt2h('json','JSON','barcode','1'); | ||
h.push(endMenu); | ||
h.push(eui.hEnd('li')); | ||
linkOpt2h('customize','','wrench', '1', 'Customize'); | ||
//linkOpt2h('customize','','wrench', '1', 'Customize'); | ||
/* | ||
@@ -181,3 +163,3 @@ if(opts.buttons.customize){ | ||
setView:function(viewName){ | ||
setView:function(viewName, navOk){ | ||
var opts=this.options, | ||
@@ -191,110 +173,129 @@ $e=this.$el, | ||
if(viewName==='new'){ | ||
viewName=this._prevOne?this._prevOne:'edit'; | ||
this.setView(viewName); | ||
this.model=new opts.modelClass(); | ||
this.model.collection=collec; | ||
this.newItem(); | ||
this.curView.options.mode='new'; | ||
}else{ | ||
if($v.length){ | ||
// -- view already exists and was rendered | ||
//if(this.curView.model){ | ||
//TODO debug | ||
this.model=this.curView.model; | ||
//} | ||
//if(navOk || (vw && vw.options.mode==='new' && !vw.isEmpty()) || this._ok2go()){ | ||
//if(vw && vw.getTab){ | ||
// this.tabId = vw.getTab(); | ||
//} | ||
if(viewName==='new'){ | ||
viewName=this._prevOne?this._prevOne:'edit'; | ||
this.setView(viewName, true); | ||
this.model=new opts.modelClass(); | ||
this.model.collection=collec; | ||
this.curView=this.viewsHash[viewName]; | ||
if(this.curView.setCollection){ | ||
this.curView.setCollection(collec); | ||
} | ||
if(this.model && !this.model.isNew()){ | ||
if(this.curView.setModel){ | ||
if(!this.curView.collection && m.collection){ | ||
this.curView.collection=this.model.collection; | ||
this.newItem(); | ||
vw.options.mode='new'; | ||
}else{ | ||
if($v.length){ | ||
// -- view already exists and was rendered | ||
this.model=vw.model; | ||
if(vw.model){ | ||
//TODO debug | ||
this.model.collection=collec; | ||
} | ||
vw=this.viewsHash[viewName]; | ||
if(vw.setCollection){ | ||
vw.setCollection(collec); | ||
} | ||
if(this.model && !this.model.isNew()){ | ||
if(vw.setModel){ | ||
if(!vw.collection){ | ||
vw.collection=this.model.collection; | ||
} | ||
vw.setModel(this.model); | ||
}else{ | ||
vw.model = this.model; | ||
} | ||
this.curView.setModel(this.model); | ||
}else{ | ||
this.curView.model = this.model; | ||
if(vw.setTitle){ | ||
vw.setTitle(); | ||
} | ||
if(vw.cardinality==='n' && vw.setPage){ | ||
vw.setPage(this.pageIndex); | ||
} | ||
}else if(vw.clear){ | ||
vw.clear(); | ||
} | ||
if(this.curView.setTitle){ | ||
this.curView.setTitle(); | ||
this.$('[data-id="views"] > li').removeClass('evo-sel') // TODO optimize | ||
.filter('[data-id="'+viewName+'"]').addClass('evo-sel'); | ||
this.curView=vw; | ||
this._keepTab(viewName); | ||
$v.show() | ||
.siblings().not('.evo-toolbar,.evo-filters,.clearfix').hide(); | ||
}else{ | ||
// -- create new instance of the view | ||
$v=$('<div data-vid="evolw-'+viewName+'"></div>'); | ||
$e.children().not('.evo-toolbar,.evo-filters,.clearfix').hide(); | ||
$e.append($v); | ||
config = { | ||
el: $v, | ||
mode: viewName, | ||
model: this.model, | ||
collection: collec, | ||
uiModel: this.uiModel, | ||
style: opts.style, | ||
pageSize: opts.pageSize || 20, | ||
pageIndex: this.pageIndex || 0, | ||
titleSelector: opts.titleSelector | ||
}; | ||
this.$('[data-id="new"]').show(); | ||
this.$('[data-id="views"] > li').removeClass('evo-sel') // TODO optimize | ||
.filter('[data-id="'+viewName+'"]').addClass('evo-sel'); | ||
switch(viewName){ | ||
// --- one --- | ||
case 'view': | ||
case 'edit': | ||
case 'mini': | ||
case 'json': | ||
case 'wiz': | ||
var vwPrev = null, | ||
cData; | ||
if(vw && vw.editable){ | ||
vwPrev = vw; | ||
cData=vw.getData(); | ||
} | ||
vw = new Evol.ViewOne[this.modesHash[viewName]](config) | ||
.render(); | ||
this._prevOne=viewName; | ||
this._keepTab(viewName); | ||
//if(vwPrev && vw.cardinality==='1'){ | ||
// vw.setData(cData); | ||
//} | ||
break; | ||
// --- many --- | ||
case 'charts': | ||
case 'badges': | ||
case 'list': | ||
vw = new Evol.ViewMany[this.modesHash[viewName]](config) | ||
.render(); | ||
this._prevMany=viewName; | ||
vw.setTitle(); | ||
if(viewName!='charts' && this.pageIndex > 0){ | ||
//var pIdx=this.curView.getPage(); | ||
vw.setPage(this.pageIndex || 0); | ||
} | ||
//this.$el.trigger('status', this.pageSummary(pageIdx, pSize, this.collection.length)); | ||
break; | ||
// --- actions --- | ||
case 'export': | ||
vw = new Evol.ViewAction.Export(config); | ||
$v.addClass('panel panel-info') | ||
.slideDown(); | ||
break; | ||
} | ||
if(this.curView.cardinality==='n' && this.curView.setPage){ | ||
this.curView.setPage(this.options.pageIndex); | ||
} | ||
}else if(this.curView.clear){ | ||
this.curView.clear(); | ||
this.curView=vw; | ||
this.viewsHash[viewName]=vw; | ||
$(this.options.titleSelector) | ||
.html(this.curView.getTitle()); | ||
} | ||
this.$('[data-id="views"] > li').removeClass('evo-sel') // TODO optimize | ||
.filter('[data-id="'+viewName+'"]').addClass('evo-sel'); | ||
$v.show() | ||
.siblings().not('.evo-toolbar,.evo-filters,.clearfix').hide(); | ||
} | ||
if(this.curView.cardinality==='n'){ // TODO do not always change flag | ||
this.showFilter(false); | ||
}else{ | ||
// -- create new instance of the view | ||
$v=$('<div data-vid="evolw-'+viewName+'"></div>'); | ||
$e.children().not('.evo-toolbar,.evo-filters,.clearfix').hide(); | ||
$e.append($v); | ||
config = { | ||
el: $v, | ||
mode: viewName, | ||
model: this.model, | ||
collection: collec, | ||
uiModel: opts.uiModel, | ||
style: opts.style, | ||
pageSize: opts.pageSize || 20, | ||
pageIndex: opts.pageIndex || 0, | ||
titleSelector: opts.titleSelector | ||
}; | ||
this.$('[data-id="new"]').show(); | ||
this.$('[data-id="views"] > li').removeClass('evo-sel') // TODO optimize | ||
.filter('[data-id="'+viewName+'"]').addClass('evo-sel'); | ||
switch(viewName){ | ||
// --- one --- | ||
case 'view': | ||
case 'edit': | ||
case 'mini': | ||
case 'json': | ||
case 'wiz': | ||
vw = new Evol.ViewOne[this.modesHash[viewName]](config) | ||
.render(); | ||
this._prevOne=viewName; | ||
break; | ||
// --- many --- | ||
case 'charts': | ||
case 'badges': | ||
case 'list': | ||
vw = new Evol.ViewMany[this.modesHash[viewName]](config) | ||
//vw = new Evol.ViewMany.JSON(config) | ||
.render(); | ||
this._prevMany=viewName; | ||
vw.setTitle(); | ||
if(viewName!='charts' && this.options.pageIndex > 0){ | ||
vw.setPage(this.options.pageIndex || 0); | ||
} | ||
//this.$el.trigger('status', this.pageSummary(pageIdx, pSize, this.collection.length ,uim.entity, uim.entities)); | ||
break; | ||
// --- actions --- | ||
case 'export': | ||
vw = new Evol.ViewAction.Export(config); | ||
$v.addClass('panel panel-info') | ||
.slideDown(); | ||
break; | ||
} | ||
this.curView=vw; | ||
this.viewsHash[viewName]=vw; | ||
$(this.options.titleSelector).html(this.curView.getTitle()); | ||
//if(this.curView.viewName==='wizard'){ | ||
// this.curView.stepIndex(0); | ||
//} | ||
this.hideFilter(); | ||
} | ||
} | ||
if(this.curView.cardinality==='n'){ // TODO do not always change flag | ||
this.showFilter(false); | ||
}else{ | ||
if(this.curView.viewName==='wizard'){ | ||
this.curView.stepIndex(0); | ||
} | ||
this.hideFilter(); | ||
} | ||
this.setIcons(viewName); | ||
this.setIcons(viewName); | ||
//} | ||
return this; | ||
}, | ||
}, | ||
@@ -305,2 +306,19 @@ getView:function(){ | ||
setTitle: function(){ | ||
if(this.curView){ | ||
if(this.curView.viewName==='export'){ | ||
$(this.options.titleSelector) | ||
.html(this.curView.getTitle()); | ||
}else{ | ||
this.curView.setTitle(); | ||
} | ||
} | ||
}, | ||
_keepTab: function(viewName){ | ||
if(this.tabId && (viewName=='view'||viewName=='edit'||viewName=='mini')){ | ||
this.curView.setTab(this.tabId); | ||
} | ||
}, | ||
getToolbarButtons: function(){ | ||
@@ -325,2 +343,3 @@ if(!this._toolbarButtons){ | ||
var setVisible=Evol.UI.setVisible; | ||
function oneMany(showOne, showMany){ | ||
@@ -350,3 +369,3 @@ setVisible(tbBs.ones, showOne); | ||
oneMany(false, false); | ||
if(this.model.isNew()){ | ||
if(this.model && this.model.isNew()){ | ||
$('.evo-dropdown-icons>li[data-cardi="1"]').show(); | ||
@@ -383,4 +402,3 @@ } | ||
el: $ff, | ||
//uiModel: this.options.uiModel, | ||
fields: Evol.Dico.getFields(this.options.uiModel) | ||
uiModel: this.uiModel | ||
}).render(); | ||
@@ -431,5 +449,5 @@ $ff.on('change.filter', function(){ | ||
getData: function(){ | ||
getData: function(skipReadOnlyFields){ | ||
if(this.curView){ | ||
return this.curView.getData(); | ||
return this.curView.getData(skipReadOnlyFields); | ||
} | ||
@@ -480,7 +498,7 @@ return null; | ||
if(msg===''){ | ||
var entityName=this.options.uiModel.entity; | ||
var entityName=this.uiModel.entity; | ||
if(this.model.isNew()){ | ||
var collec=this.collection; | ||
if(collec){ | ||
collec.create(this.getData(), { | ||
collec.create(this.getData(true), { | ||
success: function(m){ | ||
@@ -490,4 +508,4 @@ fnSuccess(m); | ||
}, | ||
error:function(err){ | ||
alert('error'); | ||
error:function(m, err){ | ||
alert('error in "saveItem"'); | ||
} | ||
@@ -497,7 +515,7 @@ }); | ||
}else{ | ||
alert('Can\'t save record b/c no collection is specified.'); //TODO pretty | ||
alert('Can\'t save record b/c no collection is specified.'); //TODO use bootstrap modal | ||
} | ||
}else{ | ||
// TODO fix bug w/ insert when filter applied => dup record | ||
this.model.set(this.getData()); | ||
this.model.set(this.getData(true)); | ||
this.model.save('','',{ | ||
@@ -508,4 +526,4 @@ success: function(m){ | ||
}, | ||
error:function(err){ | ||
alert('error'); | ||
error:function(m, err){ | ||
alert('error in "saveItem"'); | ||
} | ||
@@ -530,3 +548,3 @@ }); | ||
return this.curView.clear() | ||
.setTitle(Evol.i18n.getLabel('NewEntity', this.options.uiModel.entity, vw.getTitle())); | ||
.setTitle(Evol.i18n.getLabel('NewEntity', this.uiModel.entity, vw.getTitle())); | ||
}, | ||
@@ -536,3 +554,3 @@ | ||
var i18n=Evol.i18n, | ||
entityName=this.options.uiModel.entity, | ||
entityName=this.uiModel.entity, | ||
entityValue=this.curView.getTitle(); | ||
@@ -561,7 +579,7 @@ | ||
if(newModel){ | ||
newModel.collection=collec; | ||
newModel.collection = collec; | ||
} | ||
delModel.destroy({ | ||
success:function(){ | ||
if(collec.length===0){ | ||
if(newModel===null || collec.length===0){ | ||
that.curView.clear(); | ||
@@ -574,4 +592,4 @@ }else{ | ||
}, | ||
error:function(err){ | ||
alert('error'); | ||
error:function(m, err){ | ||
alert('error in "deleteItem"'); | ||
} | ||
@@ -584,3 +602,3 @@ }); | ||
if(selection.length>0){ | ||
if (confirm(i18n.getLabel('DeleteEntities', selection.length, this.options.uiModel.entities))) { | ||
if (confirm(i18n.getLabel('DeleteEntities', selection.length, this.uiModel.entities))) { | ||
//TODO | ||
@@ -633,3 +651,6 @@ | ||
case 'export': | ||
alert('Sorry, no demo server yet...'); | ||
alert( | ||
'Sorry, no demo server yet...\n\n' + | ||
JSON.stringify(this.curView.val(), null, 2) | ||
); | ||
break; | ||
@@ -644,19 +665,19 @@ case 'save': | ||
paginate: function(bId, ui){ | ||
if(ui){//TODO no need? event? | ||
bId=ui; | ||
if(ui){ | ||
bId=ui.id; | ||
} | ||
var pIdx=this.options.pageIndex || 0; | ||
var pIdx=this.pageIndex || 0; | ||
if(bId==='prev'){ | ||
pIdx=(pIdx>0)?pIdx-1:0; | ||
}else if(bId==='next'){ | ||
if((pIdx+1)*(this.options.pageSize||20)<this.collection.length){ | ||
if((pIdx+1)*(this.options.pageSize)<this.curView.collection.length){ | ||
pIdx++; | ||
} | ||
}else{ | ||
var bIdx=parseInt(bId,10); | ||
var bIdx=parseInt(bId, 10); | ||
if(bIdx>0){ | ||
pIdx=bIdx; | ||
pIdx=bIdx-1; | ||
} | ||
} | ||
this.options.pageIndex=pIdx; | ||
this.pageIndex=pIdx; | ||
if(this.curView.setPage){ | ||
@@ -682,2 +703,12 @@ this.curView.setPage(pIdx); | ||
}, | ||
/* | ||
_ok2go: function(){ | ||
if(this.curView && this.curView.editable && this.curView.isDirty && this.curView.isDirty()){ | ||
if(confirm(Evol.i18n.unSavedChanges)){ | ||
return true; | ||
} | ||
return false; | ||
} | ||
return true; | ||
},*/ | ||
@@ -711,6 +742,5 @@ click_toolbar: function(evt, ui){ | ||
if(this.curView.cardinality==='1'){ | ||
if(this.curView.isDirty && this.curView.isDirty()){ | ||
// TODO prompt for save changes | ||
} | ||
this.browse(toolId); | ||
//if(this._ok2go()){ | ||
this.browse(toolId); | ||
//} | ||
}else if(this.curView.cardinality==='n'){ | ||
@@ -733,5 +763,5 @@ this.paginate(toolId); | ||
click_navigate: function(evt,ui){ | ||
click_navigate: function(evt, ui){ | ||
evt.stopImmediatePropagation(); | ||
var m=this.collection.get(ui.id); | ||
evt.stopImmediatePropagation(); | ||
this.model=m; | ||
@@ -759,7 +789,7 @@ this.setView('view');//(this._prevOne || 'edit'); | ||
} | ||
this.setStatus(ccSel+' / '+ccAll+' '+this.options.uiModel.entities); | ||
this.setStatus(ccSel+' / '+ccAll+' '+this.uiModel.entities); | ||
}else{ | ||
collec=this.collection; | ||
this._filteredCollection=null; | ||
this.setStatus(collec.length+' '+this.options.uiModel.entities); | ||
this.setStatus(collec.length+' '+this.uiModel.entities); | ||
} | ||
@@ -766,0 +796,0 @@ this.curView.setCollection(collec); |
@@ -22,3 +22,3 @@ /*! *************************************************************************** | ||
Pie: function (label, data, labels, style, sizes){ | ||
var size=sizes?sizes:'360x200'; | ||
var size=sizes?sizes:'390x200'; | ||
var urlGoogleChart = [this.URL,'?chd=t:', | ||
@@ -33,3 +33,3 @@ data.join(','), | ||
Bars: function (label, data, labels, style, sizes){ | ||
var size=sizes?sizes:'350x200'; | ||
var size=sizes?sizes:'360x200'; | ||
var maxCount = _.max(data), | ||
@@ -36,0 +36,0 @@ urlGoogleChart = [this.URL,'?chbh=a&chs=',size,'&cht=bvg&chco=3a87ad,d9edf7&chds=0,', |
@@ -315,3 +315,3 @@ var contacts_LOVs = { | ||
var contacts_ui = { | ||
id: 'evol-contact', | ||
id: 'contact', | ||
label: 'Address book', | ||
@@ -318,0 +318,0 @@ icon: 'contact.gif', |
var bottleSizes=[ | ||
{id:750, text: '750 ml'}, | ||
{id:500, text: '500 ml'}, | ||
{id:375, text: '375 cl'}, | ||
{id:1500, text: '1.5 L'}, | ||
{id:3000, text: '3.0 L'}, | ||
{id:6000, text: '6.0 L'}, | ||
{id:8000, text: '8.0 L'} | ||
var testLOV=[ | ||
{text:'yotta',id:'Y'}, | ||
{text:'zetta',id:'Z'}, | ||
{text:'exa',id:'E'}, | ||
{text:'peta',id:'P'}, | ||
{text:'tera',id:'T'}, | ||
{text:'giga',id:'G'}, | ||
{text:'mega',id:'M'}, | ||
{text:'kilo',id:'k'}, | ||
{text:'hecto',id:'h'}, | ||
{text:'deca',id:'da'} | ||
]; | ||
var degustationFields = [ | ||
{id: 'str1', type: 'text', label: 'Text 1', maxlength: 100, viewmany: '1'}, | ||
{id: 'str2', type: 'text', label: 'Text 2', maxlength: 100, viewmany: '1'}, | ||
{id: 'str3', type: 'text', label: 'Text 3', maxlength: 100, viewmany: '1'} | ||
]; | ||
var fieldsPanelList = [ | ||
{id: 'pl1f1', type: 'text', label: 'Name', maxlength: 100, viewmany: '1'}, | ||
{id: 'pl1f2', type: 'text', label: 'Text 2', maxlength: 100, viewmany: '1'}, | ||
{id: 'pl1f3', type: 'lov', label: 'Sizes', list: testLOV, viewmany: '1'} | ||
], | ||
fieldsPanelList2 = [ | ||
{id: 'pl2f1', type: 'text', label: 'Name', maxlength: 100, viewmany: '1'}, | ||
{id: 'pl2f3', type: 'date', label: 'Date', viewmany: '1'}, | ||
{id: 'pl2f4', type: 'boolean', label: 'Bool', viewmany: '1'}, | ||
{id: 'pl2f2', type: 'text', label: 'Text 2', maxlength: 100, viewmany: '1'} | ||
]; | ||
function fieldTypePanel(id, label, labelPanel){ | ||
var labelP = labelPanel || label || id, | ||
fields=[ | ||
{ | ||
id: id, | ||
type: id, | ||
label: label, | ||
required: true, | ||
viewmany: true, | ||
width: 100 | ||
}, | ||
{ | ||
id: id+'3', | ||
attribute: id, | ||
readonly: true, | ||
help: 'The field "' + label+' 3" is readonly.', | ||
type: id, | ||
label: label+' 3', | ||
width: 100 | ||
}, | ||
{ | ||
id: id+'2', | ||
type: id, | ||
label: label+' 2', | ||
width: 100 | ||
} | ||
]; | ||
if(id==='list' || id==='lov'){ | ||
fields= _.each(fields, function(f){ | ||
f.list=testLOV; | ||
}); | ||
}else if(id==='hidden'){ | ||
fields[0].required=false; | ||
} | ||
return { | ||
type: 'panel', | ||
label: labelP, | ||
width: 33, | ||
elements: fields | ||
}; | ||
} | ||
var test_ui = { | ||
@@ -26,3 +79,3 @@ entity: 'test', | ||
type: 'panel', | ||
label: 'Panel 1', | ||
label: 'Testing Evolutility', | ||
width: 100, | ||
@@ -33,20 +86,7 @@ elements: [ | ||
type: 'text', | ||
label: 'Name', | ||
label: 'Title', | ||
required: true, | ||
maxlength: '150', | ||
viewmany: true, | ||
width: 42 | ||
}, | ||
{ | ||
id:'name2', | ||
type: 'text', | ||
label: 'Text 2', | ||
width: '38' | ||
}, | ||
{ | ||
id:'name3', | ||
type: 'text', | ||
label: 'Text (readonly)', | ||
readonly: '1', | ||
width: '20' | ||
width: 100 | ||
} | ||
@@ -57,200 +97,9 @@ ] | ||
type: 'tab', | ||
label: 'General', | ||
label: 'Text & Lists', | ||
elements: [ | ||
{ | ||
type: 'panel', | ||
label: 'Strings', | ||
width: 100, | ||
elements: [ | ||
{ | ||
id:'str5', | ||
type: 'text', | ||
label: 'Name 5', | ||
required: true, | ||
maxlength: '150', | ||
width: 42 | ||
}, | ||
{ | ||
id:'str6', | ||
type: 'email', | ||
required: true, | ||
label: 'email', | ||
width: '38' | ||
}, | ||
{ | ||
id:'str7', | ||
type: 'text', | ||
label: 'More text', | ||
readonly: '1', | ||
width: '20' | ||
} | ||
] | ||
}, | ||
{ | ||
type: 'panel', | ||
label: 'Date', | ||
width: 33, | ||
elements: [ | ||
{ | ||
type: 'date', | ||
id:'fd1', | ||
label: 'Date 1', | ||
required: true, | ||
width: 100 | ||
}, | ||
{ | ||
type: 'date', | ||
id:'fd2', | ||
label: 'Date 2', | ||
width: 100 | ||
}, | ||
{ | ||
type: 'datetime', | ||
id:'fdt', | ||
label: 'DateTime field', | ||
maxlength: 100, | ||
required: true, | ||
width: 100 | ||
}, | ||
{ | ||
type: 'time', | ||
id:'ft', | ||
label: 'Time field', | ||
maxlength: 100, | ||
required: true, | ||
width: 100 | ||
} | ||
] | ||
}, | ||
{ | ||
type: 'panel', | ||
eindex: '1', | ||
label: 'LOVs', | ||
width: '33', | ||
elements: [ | ||
{ | ||
type: 'lov', | ||
id:'bsize', | ||
label: 'Bottle (LOV)', | ||
required: true, | ||
width: 100, | ||
list:bottleSizes, | ||
viewmany:true | ||
}, | ||
{ | ||
type: 'lov', | ||
id:'bsize2', | ||
label: 'Bottle Size again', | ||
labellist: 'Bottle', | ||
width: 100, | ||
list:bottleSizes | ||
}, | ||
{ | ||
type: 'lov', | ||
id:'grape', | ||
label: 'Grape (big LOV)', | ||
viewmany: false, | ||
width: 100, | ||
list:[ | ||
{text: 'Chardonnay'}, | ||
{text: 'Shiraz'}, | ||
{text: 'Merlot'}, | ||
{text: 'Pinot Noir'}, | ||
{text: 'Cabernet'}, | ||
{text: 'Zinfandel'}, | ||
{text: 'Sauvignon'}, | ||
{text: 'Cabernet Sauvignon'}, | ||
{text: 'Aligoté'}, | ||
{text: 'Alvarinho'}, | ||
{text: 'Blanc Fumé'}, | ||
{text: 'Bual'}, | ||
{text: 'Carignan'}, | ||
{text: 'Chasselas'}, | ||
{text: 'Chemin Blanc'}, | ||
{text: 'Cinsault'}, | ||
{text: 'Clairette'}, | ||
{text: 'Colombard'}, | ||
{text: 'Counoise'}, | ||
{text: 'Fendant'}, | ||
{text: 'Folle Blanche'}, | ||
{text: 'Fürmint'}, | ||
{text: 'Gamay'}, | ||
{text: 'Gewürztraminer'}, | ||
{text: 'Grauburgunder'}, | ||
{text: 'Grechetto'}, | ||
{text: 'Grenache Blanc'}, | ||
{text: 'Grenache Noir'}, | ||
{text: 'Gros Plan'}, | ||
{text: 'Grüner Veltliner'}, | ||
{text: 'Italienischer Riestling'}, | ||
{text: 'Kadarka'}, | ||
{text: 'Kerner'}, | ||
{text: 'Macabeo'}, | ||
{text: 'Malmsey'}, | ||
{text: 'Malvasier'}, | ||
{text: 'Marsanne'}, | ||
{text: 'Melon de Bourgogne'}, | ||
{text: 'Mourvèdre'}, | ||
{text: 'Müller-Thurgau'}, | ||
{text: 'Muscadelle'}, | ||
{text: 'Muscadet'}, | ||
{text: 'Musca'}, | ||
{text: 'Musca d\'Alsace'}, | ||
{text: 'Muskateller'}, | ||
{text: 'Nebbiolo'}, | ||
{text: 'Palomino'}, | ||
{text: 'Pedro Ximérez'}, | ||
{text: 'Petit Verdot'}, | ||
{text: 'Pinot Blanc'}, | ||
{text: 'Pinot Gris'}, | ||
{text: 'Pinot Noir'}, | ||
{text: 'Pinotage'}, | ||
{text: 'Riesling'}, | ||
{text: 'Ruländer'}, | ||
{text: 'Sangiovese'}, | ||
{text: 'Sauvignon Blanc'}, | ||
{text: 'Scheurebe'}, | ||
{text: 'Sémilion'}, | ||
{text: 'Sercial'}, | ||
{text: 'Seyval Blanc'}, | ||
{text: 'Siegerrebe'}, | ||
{text: 'Silvaner'}, | ||
{text: 'Spätburgunder'}, | ||
{text: 'Steen'}, | ||
{text: 'Syrah'}, | ||
{text: 'Tempranillo'}, | ||
{text: 'Tokay'}, | ||
{text: 'Traminer'}, | ||
{text: 'Trebbiano'}, | ||
{text: 'Ugni Blanc'}, | ||
{text: 'Verdejo'}, | ||
{text: 'Verdelho'}, | ||
{text: 'Vermentino'}, | ||
{text: 'Vernaccia'}, | ||
{text: 'Viognier'}, | ||
{text: 'Viura'}, | ||
{text: 'Weißburgunder'} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
type: 'panel', | ||
eindex: '1', | ||
label: 'List', | ||
width: '34', | ||
elements: [ | ||
{ | ||
type: 'list', | ||
id:'bsizelist', | ||
label: 'Bottles (List)', | ||
width: 100, | ||
list:bottleSizes, | ||
viewmany: true | ||
} | ||
] | ||
} | ||
fieldTypePanel('text', 'Text'), | ||
fieldTypePanel('lov', 'List', 'List (value)'), | ||
fieldTypePanel('list', 'List mv', 'List (multiple values)'), | ||
fieldTypePanel('textmultiline', 'Large Text'), | ||
fieldTypePanel('html', 'HTML') | ||
] | ||
@@ -260,97 +109,16 @@ }, | ||
type: 'tab', | ||
label: 'Date & Time', | ||
elements: [ | ||
fieldTypePanel('date', 'Date'), | ||
fieldTypePanel('time', 'Time'), | ||
fieldTypePanel('datetime', 'Date and Time') | ||
] | ||
}, | ||
{ | ||
type: 'tab', | ||
label: 'Numbers', | ||
elements: [ | ||
{ | ||
type: 'panel', | ||
id: 'pnl1', | ||
label: 'Integers', | ||
width: 34, | ||
elements: [ | ||
{ | ||
type: 'integer', | ||
id:'int1', | ||
label: 'Integer (min=0 max=10)', | ||
required: true, | ||
maxlength: 10, | ||
min: 0, | ||
max: 10, | ||
width:100 | ||
}, | ||
{ | ||
type: 'integer', | ||
id:'int2', | ||
label: 'Integer 2', | ||
width:100 | ||
} | ||
] | ||
}, | ||
{ | ||
type: 'panel', | ||
eindex: '1', | ||
label: 'Decimals', | ||
width: '33', | ||
elements: [ | ||
{ | ||
type: 'decimal', | ||
id:'dec1', | ||
label: 'Decimal 1', | ||
required: true, | ||
width:100 | ||
}, | ||
{ | ||
type: 'decimal', | ||
id:'dec2', | ||
label: 'Decimal 2', | ||
maxlength: 10, | ||
search: '1', | ||
viewmany: false, | ||
width:100 | ||
}, | ||
{ | ||
type: 'money', | ||
id:'money', | ||
label: 'Money', | ||
maxlength: 10, | ||
search: '1', | ||
viewmany: true, | ||
required: true, | ||
width:100 | ||
} | ||
] | ||
}, | ||
{ | ||
type: 'panel', | ||
eindex: '1', | ||
label: 'Colors', | ||
width: '33', | ||
elements: [ | ||
{ | ||
type: 'color', | ||
id:'color1', | ||
label: 'Color', | ||
required: true, | ||
width: 50, | ||
viewmany:true | ||
}, | ||
{ | ||
type: 'color', | ||
id:'color2', | ||
label: 'Color 2', | ||
width: 50 | ||
}, | ||
{ | ||
type: 'color', | ||
id:'color3', | ||
label: 'Color 3', | ||
width: 50 | ||
}, | ||
{ | ||
type: 'color', | ||
id:'color4', | ||
label: 'Color 4', | ||
width: 50 | ||
} | ||
] | ||
} | ||
fieldTypePanel('integer', 'Integer'), | ||
fieldTypePanel('decimal', 'Decimal'), | ||
fieldTypePanel('money', 'Money') | ||
] | ||
@@ -360,37 +128,7 @@ }, | ||
type: 'tab', | ||
label: 'Notes', | ||
label: 'Checkbox & links', | ||
elements: [ | ||
{ | ||
type: 'panel', | ||
id: 'bigtxt1', | ||
label: 'Comments', | ||
width: 66, | ||
elements: [ | ||
{ | ||
id: 'notes', | ||
type: 'textmultiline', | ||
label: 'Comments', | ||
maxlength: '300', | ||
width: 100, | ||
height: '8' | ||
} | ||
] | ||
}, | ||
{ | ||
type: 'panel', | ||
label: 'An Image', | ||
width: 34, | ||
elements: [ | ||
{ | ||
id:'pix', | ||
type: 'image', | ||
label: 'Image', | ||
maxlength: 200, | ||
width: 100, | ||
viewmany: false | ||
} | ||
] | ||
} | ||
fieldTypePanel('boolean', 'Boolean'), | ||
fieldTypePanel('email', 'email'), | ||
fieldTypePanel('url', 'url') | ||
] | ||
@@ -400,4 +138,13 @@ }, | ||
type: 'tab', | ||
label: '2 Collections', | ||
label: 'Image & Color', | ||
elements: [ | ||
fieldTypePanel('image', 'Image'), | ||
fieldTypePanel('color', 'Color'), | ||
fieldTypePanel('hidden', 'Hidden') | ||
] | ||
}, | ||
{ | ||
type: 'tab', | ||
label: 'Collections', | ||
elements: [ | ||
{ | ||
@@ -409,3 +156,3 @@ type: 'panel-list', | ||
width: 100, | ||
elements: degustationFields | ||
elements: fieldsPanelList | ||
}, | ||
@@ -418,102 +165,5 @@ { | ||
width: 100, | ||
elements: degustationFields | ||
elements: fieldsPanelList2 | ||
} | ||
] | ||
}, | ||
{ | ||
type: 'tab', | ||
label: 'Read Only', | ||
elements: [ | ||
{ | ||
type: 'panel', | ||
label: 'Read Only Fields', | ||
width: 100, | ||
elements: [ | ||
{ | ||
id:'txtro', | ||
type: 'text', | ||
label: 'Text', | ||
readonly: true, | ||
width: 33 | ||
}, | ||
{ | ||
id:'txtml', | ||
type: 'textmultiline', | ||
label: 'Big Text', | ||
readonly: true, | ||
width: 67 | ||
}, | ||
{ | ||
type: 'date', | ||
id:'fd1ro', | ||
label: 'Date 1', | ||
readonly: true, | ||
width: 33 | ||
}, | ||
{ | ||
type: 'datetime', | ||
id:'fdtro', | ||
label: 'DateTime field', | ||
maxlength: 100, | ||
readonly: true, | ||
width: 33 | ||
}, | ||
{ | ||
type: 'time', | ||
id:'ftro', | ||
label: 'Time field', | ||
maxlength: 100, | ||
readonly: true, | ||
width: 34 | ||
}, | ||
{ | ||
type: 'lov', | ||
id:'bsizero', | ||
label: 'Bottle Size (LOV)', | ||
labellist: 'Bottle', | ||
readonly: true, | ||
width: 33, | ||
list:bottleSizes | ||
}, | ||
{ | ||
type: 'boolean', | ||
id:'bro', | ||
label: 'Boolean', | ||
maxlength: 100, | ||
readonly: true, | ||
width: 33 | ||
}, | ||
{ | ||
type: 'email', | ||
id:'emailro', | ||
label: 'email', | ||
readonly: true, | ||
width: 34 | ||
}, | ||
{ | ||
type: 'integer', | ||
id:'int5', | ||
label: 'Integer', | ||
readonly: true, | ||
width: 33, | ||
list:bottleSizes | ||
}, | ||
{ | ||
type: 'decimal', | ||
id:'decro', | ||
label: 'Decimal', | ||
readonly: true, | ||
width: 33 | ||
}, | ||
{ | ||
type: 'money', | ||
id:'moneyfield1', | ||
label: 'Money', | ||
maxlength: 100, | ||
readonly: true, | ||
width: 34 | ||
} | ||
] | ||
} | ||
] | ||
} | ||
@@ -520,0 +170,0 @@ ] |
var todo_ui = { | ||
id: 'evol-todo', | ||
id: 'todo', | ||
label: 'To Do', | ||
@@ -5,0 +5,0 @@ entity: 'task', |
@@ -136,3 +136,3 @@ var winecellar_lovs = { | ||
var winecellar_ui = { | ||
id: 'evol-winecellar', | ||
id: 'winecellar', | ||
entity: 'wine', | ||
@@ -339,4 +339,5 @@ entities: 'wines', | ||
label: 'Drink from (year)', | ||
placeholder: '2013', | ||
labellist: 'Drink', | ||
labelcharts: 'Drink from', | ||
placeholder: '2012', | ||
maxlength: 10, | ||
@@ -352,2 +353,3 @@ viewmany: true, | ||
label: 'to', | ||
labelcharts: 'Drink to', | ||
maxlength: 4, | ||
@@ -372,2 +374,3 @@ width: 50, | ||
label: 'to', | ||
labelcharts: 'Peak to', | ||
maxlength: 4, | ||
@@ -374,0 +377,0 @@ width: 50, |
@@ -0,1 +1,5 @@ | ||
function showIfNumber(m, uim){ | ||
return m.get('type')==='integer' || m.get('type')==='decimal'|| m.get('type')==='money'; | ||
} | ||
var dico_field_ui = { | ||
@@ -5,7 +9,8 @@ icon: "edi_fld.png", | ||
entities: "fields", | ||
leadfield: 'label', | ||
elements: [ | ||
{ | ||
type: "panel", | ||
label: "Field", | ||
width: 100, | ||
label: "Definition", | ||
width: 62, | ||
elements: [ | ||
@@ -22,100 +27,67 @@ { | ||
viewmany: true, | ||
width: 100 | ||
} | ||
] | ||
}, | ||
{ | ||
type: "tab", | ||
label: "Definition", | ||
elements: [ | ||
width: 62 | ||
}, | ||
{ | ||
type: "panel", | ||
label: "Validation", | ||
width: 100, | ||
elements: [ | ||
{ | ||
id: 'type', | ||
label: "Type", | ||
help: "User Type for the field on screen. Text, or emails can be char, varchar or nvarchar...", | ||
type: "lov", | ||
list:[ | ||
{id:'text',text:"text", icon:'ft-txt.gif'}, | ||
{id:'textmultiline',text:"textmultiline", icon:'ft-txtml.gif'}, | ||
{id:'boolean',text:"boolean", icon:'ft-bool.gif'}, | ||
{id:'decimal',text:"decimal", icon:'ft-dec.gif'}, | ||
{id:'money',text:"money", icon:'ft-money.gif'}, | ||
{id:'integer',text:"integer", icon:'ft-int.gif'}, | ||
{id:'date',text:"date", icon:'ft-date.gif'}, | ||
{id:'time',text:"time", icon:'ft-time.gif'}, | ||
{id:'datetime',text:"datetime", icon:'ft-datehm.gif'}, | ||
{id:'image',text:"image", icon:'ft-img.gif'}, | ||
{id:'document',text:"document", icon:'ft-doc.gif'}, | ||
{id:'color',text:"color", icon:'ft-color.gif'}, | ||
{id:'lov',text:"lov", icon:'ft-lov.gif'}, | ||
{id:'formula',text:"formula", icon:'ft-.gif'}, | ||
{id:'html',text:"html", icon:'ft-htm.gif'}, | ||
{id:'email',text:"email", icon:'ft-email.gif'}, | ||
{id:'url',text:"url", icon:'ft-url.gif'} | ||
], | ||
maxlength: 100, | ||
required: true, | ||
viewmany: true, | ||
width: 62 | ||
}, | ||
{ | ||
id:'required', | ||
label: "Required", | ||
defaultvalue: false, | ||
help: "Mandatory field", | ||
type: "boolean", | ||
maxlength: 100, | ||
viewmany: true, | ||
width: 38, | ||
img: "checkr.gif" | ||
}, | ||
{ | ||
id:'maxlength', | ||
label: "Max. length", | ||
help: "Maximum number of characters allowed", | ||
type: "integer", | ||
maxlength: 100, | ||
width: 62 | ||
}, | ||
{ | ||
id:'readonly', | ||
label: "Read only", | ||
defaultvalue:false, | ||
help: "Users can view this field value but cannot modify it", | ||
type: "boolean", | ||
maxlength: 100, | ||
width: 38, | ||
img: "checkr.gif" | ||
}, | ||
{ | ||
id:'maxvalue', | ||
label: "Maximum value", | ||
conditions: [{ | ||
'visible': function(m,uim){ | ||
return m.get('type')==='integer' || m.get('type')==='decimal'; | ||
} | ||
}], | ||
labellist: "Max.", | ||
type: "integer", | ||
maxlength: 4, | ||
width: 62 | ||
}, | ||
{ | ||
id:'minvalue', | ||
label: "Minimum value", | ||
conditions: [{ | ||
'visible': function(m,uim){ | ||
return m.get('type')==='integer' || m.get('type')==='decimal'; | ||
} | ||
}], | ||
labellist: "Min.", | ||
type: "integer", | ||
maxlength: 4, | ||
width: 38 | ||
} | ||
] | ||
id: 'type', | ||
label: "Type", | ||
help: "User Type for the field on screen.", | ||
type: "lov", | ||
list:[ | ||
{id:'text',text:"text", icon:'ft-txt.gif'}, | ||
{id:'textmultiline',text:"textmultiline", icon:'ft-txtml.gif'}, | ||
{id:'boolean',text:"boolean", icon:'ft-bool.gif'}, | ||
{id:'decimal',text:"decimal", icon:'ft-dec.gif'}, | ||
{id:'money',text:"money", icon:'ft-money.gif'}, | ||
{id:'integer',text:"integer", icon:'ft-int.gif'}, | ||
{id:'date',text:"date", icon:'ft-date.gif'}, | ||
{id:'time',text:"time", icon:'ft-time.gif'}, | ||
{id:'datetime',text:"datetime", icon:'ft-datehm.gif'}, | ||
{id:'image',text:"image", icon:'ft-img.gif'}, | ||
{id:'document',text:"document", icon:'ft-doc.gif'}, | ||
{id:'color',text:"color", icon:'ft-color.gif'}, | ||
{id:'lov',text:"lov", icon:'ft-lov.gif'}, | ||
{id:'formula',text:"formula", icon:'ft-.gif'}, | ||
{id:'html',text:"html", icon:'ft-htm.gif'}, | ||
{id:'email',text:"email", icon:'ft-email.gif'}, | ||
{id:'url',text:"url", icon:'ft-url.gif'} | ||
], | ||
maxlength: 100, | ||
required: true, | ||
viewmany: true, | ||
width: 38 | ||
}, | ||
{ | ||
id: "attribute", | ||
label: "Attribute", | ||
help: "Attribute name in the Backbone model", | ||
required: true, | ||
type: "text", | ||
maxlength: 100, | ||
width: 62 | ||
}, | ||
{ | ||
id: 'colpix', | ||
label: "ID", | ||
labellist: "ID", | ||
type: "text", | ||
help: 'Field ID in UI = prefix + ID', | ||
maxlength: 100, | ||
width: 38 | ||
}, | ||
{ | ||
id:'format', | ||
label: "Format", | ||
type: "text", | ||
help: "example '$ 0.00'", | ||
maxlength: 30, | ||
width: 62 | ||
}, | ||
{ | ||
id: 'css', | ||
label: "CSS", | ||
labellist: "CSS Edit", | ||
help: "Stylesheet class name for the field for the edit view.", | ||
type: "text", | ||
maxlength: 20, | ||
width: 38 | ||
} | ||
@@ -125,65 +97,63 @@ ] | ||
{ | ||
type: "tab", | ||
label: "Display", | ||
type: "panel", | ||
label: "Validation", | ||
width: 38, | ||
elements: [ | ||
{ | ||
type: "panel", | ||
label: "Display", | ||
width: 100, | ||
elements: [ | ||
{ | ||
id:'position', | ||
label: "Position", | ||
help: "Integer (do not have to be consecutive)", | ||
type: "integer", | ||
maxlength: 3, | ||
width: 38 | ||
}, | ||
{ | ||
id:'height', | ||
label: "Height", | ||
help: "Height in number of lines (for ''Textmultiline'' fields)", | ||
type: "integer", | ||
maxlength: 3, | ||
defaultvalue: 1, | ||
max:30, | ||
width: 32 | ||
}, | ||
{ | ||
id:'width', | ||
label: "Width", | ||
defaultvalue: 100, | ||
help: "Relative width of the field (in percentage)", | ||
type: "integer", | ||
format: "0 '%'", | ||
maxlength: 3, | ||
width: 30 | ||
}, | ||
{ | ||
id:'format', | ||
label: "Format", | ||
type: "text", | ||
help: "example '$ 0.00'", | ||
maxlength: "30", | ||
width: "38" | ||
}, | ||
{ | ||
id: 'css', | ||
label: "CSS Field Edit", | ||
labellist: "CSS Edit", | ||
help: "Stylesheet class name for the field in edit mode.", | ||
type: "text", | ||
maxlength: 20, | ||
width: 32 | ||
}, | ||
{ | ||
id:'viewmany', | ||
label: "List", | ||
help: "Field shows in lists", | ||
labellist: "List", | ||
type: "boolean", | ||
viewmany: true, | ||
width: 100 | ||
} | ||
] | ||
id:'required', | ||
label: "Required", | ||
//defaultvalue: false, | ||
help: "Mandatory field", | ||
type: "boolean", | ||
viewmany: true, | ||
width: 50, | ||
img: "checkr.gif" | ||
}, | ||
{ | ||
id:'readonly', | ||
label: "Read only", | ||
defaultvalue:false, | ||
help: "Users can view this field value but cannot modify it", | ||
type: "boolean", | ||
width: 50, | ||
img: "checkr.gif" | ||
}, | ||
{ | ||
id:'minlength', | ||
label: "Min. length", | ||
help: "Minimum number of characters required", | ||
type: "integer", | ||
width: 50 | ||
}, | ||
{ | ||
id:'maxlength', | ||
label: "Max. length", | ||
help: "Maximum number of characters allowed", | ||
type: "integer", | ||
maxlength: 7, | ||
width: 50 | ||
}, | ||
{ | ||
id:'minvalue', | ||
label: "Min. value", | ||
help: "Minimum value allowed for the field", | ||
conditions: [{ | ||
'visible': showIfNumber | ||
}], | ||
labellist: "Min.", | ||
type: "integer", | ||
maxlength: 4, | ||
width: 50 | ||
}, | ||
{ | ||
id:'maxvalue', | ||
label: "Max. value", | ||
help: "Maximum value allowed for the field", | ||
conditions: [{ | ||
'visible': showIfNumber | ||
}], | ||
labellist: "Max.", | ||
type: "integer", | ||
maxlength: 4, | ||
width: 50 | ||
} | ||
@@ -193,30 +163,42 @@ ] | ||
{ | ||
type: "tab", | ||
id: 'tab-model', | ||
label: "Model", | ||
type: "panel", | ||
label: "Layout", | ||
width: 62, | ||
elements: [ | ||
{ | ||
type: "panel", | ||
id: 'map', | ||
optional: "1", | ||
label: "Model", | ||
width: 100, | ||
elements: [ | ||
{ | ||
id: "attribute", | ||
label: "Attribute", | ||
help: "Attribute name in the Backbone model", | ||
required: true, | ||
type: "text", | ||
maxlength: 100, | ||
width: 100 | ||
}, | ||
{ | ||
id: 'colpix', | ||
label: "UI name", | ||
type: "text", | ||
maxlength: 100, | ||
width: 100 | ||
} | ||
] | ||
id:'position', | ||
label: "Position", | ||
help: "Integer (do not have to be consecutive)", | ||
type: "integer", | ||
maxlength: 3, | ||
width: 62 | ||
}, | ||
{ | ||
id:'viewmany', | ||
label: "List", | ||
help: "Field shows in lists", | ||
labellist: "List", | ||
type: "boolean", | ||
viewmany: true, | ||
width: 38 | ||
}, | ||
{ | ||
id:'height', | ||
label: "Height", | ||
help: "Height in number of lines (for ''Textmultiline'' fields)", | ||
type: "integer", | ||
maxlength: 3, | ||
defaultvalue: 1, | ||
max:30, | ||
width: 62 | ||
}, | ||
{ | ||
id:'width', | ||
label: "Width", | ||
defaultvalue: 100, | ||
help: "Relative width of the field (in percentage)", | ||
type: "integer", | ||
format: "0 '%'", | ||
maxlength: 3, | ||
width: 38 | ||
} | ||
@@ -226,20 +208,14 @@ ] | ||
{ | ||
type: "tab", | ||
label: "User Help", | ||
type: "panel", | ||
label: "Field Help", | ||
width: 38, | ||
elements: [ | ||
{ | ||
type: "panel", | ||
label: "Field Help", | ||
id: 'help', | ||
label: "Help", | ||
help: "Help on the field for edition", | ||
type: "textmultiline", | ||
maxlength: 500, | ||
width: 100, | ||
elements: [ | ||
{ etype: 'field', | ||
id: 'help', | ||
label: "Help", | ||
help: "Help on the field for edition", | ||
type: "textmultiline", | ||
maxlength: 500, | ||
width: 100, | ||
height: 8 | ||
} | ||
] | ||
height: 6 | ||
} | ||
@@ -246,0 +222,0 @@ ] |
43
js/ui.js
@@ -223,2 +223,11 @@ /*! *************************************************************************** | ||
toggleCheckbox: function($cb, v){ | ||
if(v){ | ||
$cb.prop('checked', 'checked'); | ||
}else{ | ||
//$cb.removeProp('checked'); | ||
$cb.prop('checked', false); | ||
} | ||
}, | ||
// --- links --- | ||
@@ -261,5 +270,34 @@ link: function (id, label, url, target) { | ||
// --- menu --- | ||
menu: { | ||
hBegin: function (id, tag, icon){ | ||
return ['<', tag,' class="dropdown" data-id="',id,'">', | ||
'<a href="#" class="dropdown-toggle" data-toggle="dropdown">',Evol.UI.icon(icon),' <b class="caret"></b></a>', | ||
'<ul class="dropdown-menu evo-dropdown-icons">'].join(''); | ||
}, | ||
hEnd: function(tag){ | ||
return '</ul></' + tag + '>'; | ||
}, | ||
hItem: function(id, label, icon, cardi, style){ | ||
var h=[]; | ||
h.push('<li data-id="',id,'"'); | ||
if(cardi){ | ||
h.push(' data-cardi="'+cardi,'"'); | ||
} | ||
if(style!=='label'){ | ||
h.push(' data-toggle="tooltip" data-placement="bottom" title="" data-original-title="',label,'"'); | ||
} | ||
h.push('><a href="#" data-id="',id,'">',Evol.UI.icon(icon)); | ||
if(style!=='tooltip'){ | ||
h.push(' ',label); | ||
} | ||
h.push('</a></li>'); | ||
return h.join(''); | ||
} | ||
}, | ||
// --- panels --- | ||
HTMLPanelLabel: function (label) { | ||
HTMLPanelBegin: function (pid, label, css) { | ||
return [ | ||
'<div data-pid="', pid, '" class="panel ', css, '">', | ||
'<div class="panel-heading">', Evol.UI.icon('chevron-up', 'evol-title-toggle'), | ||
@@ -269,2 +307,5 @@ '<h3 class="panel-title">', label, '</h3></div>' | ||
}, | ||
HTMLPanelEnd: function () { | ||
return '</div>'; | ||
}, | ||
@@ -271,0 +312,0 @@ HTMLEmptyPanel: function(id, css, style){ |
{ | ||
"name": "evolutility", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"copyright": "(c) 2014 Olivier Giulieri", | ||
@@ -5,0 +5,0 @@ "license": "AGPL-3.0", |
@@ -14,3 +14,3 @@ # evolutility.js | ||
All UI-models use the same [API or vocabulary](http://evoluteur.github.io/evolutility/doc/ui-model.html) with words like "tabs", "panels", "panel-list", "fields" rather than "INPUT" and "DIV" to describe UI elements. | ||
All UI-models use the same [API or vocabulary](http://evoluteur.github.io/evolutility/doc/ui-model.html) with words like "field", "panel" and "tab" rather than "INPUT" and "DIV" to describe UI elements. | ||
@@ -29,4 +29,3 @@ UI Models for the demo apps: | ||
* Views for a collection (many): List, Badges, Charts. | ||
* Views for actions on one record or a collection: Export, Filter. | ||
TODO: add Dashboards and Mass update... | ||
* Views for actions on one record or a collection: Export, Filter (will add later Dashboards, Mass update, clone...). | ||
@@ -33,0 +32,0 @@ Web demo of [all views](http://evoluteur.github.io/evolutility/index.html) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1981892
99
13795
59