-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conflicts: bower.json
- Loading branch information
Showing
25 changed files
with
614 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,29 +10,32 @@ define(['js/form', 'globalize'], function(Form) { | |
|
||
'use strict'; | ||
|
||
var language = 'de', | ||
form = new Form($('#contact-form')); | ||
|
||
require(['cultures/globalize.culture.' + language], function() { | ||
Globalize.culture(language); | ||
}.bind(this)); | ||
var language = 'en', | ||
$contactForm = $('#contact-form'), | ||
form = new Form($contactForm); | ||
|
||
if (language !== 'en') { | ||
require(['cultures/globalize.culture.' + language], function() { | ||
Globalize.culture(language); | ||
}.bind(this)); | ||
} | ||
|
||
form.mapper.addCollectionFilter('phones', function(item) { | ||
return item.phone !== ''; | ||
}); | ||
|
||
$('#contact-form').on('form-collection-init', function(e, property) { | ||
$contactForm.on('form-collection-init', function(e, property) { | ||
console.log(property, 'initiated'); | ||
}); | ||
|
||
$('#contact-form').on('submit', function() { | ||
$contactForm.on('submit', function() { | ||
console.log(form.mapper.getData()); | ||
|
||
return false; | ||
}); | ||
|
||
$('#send-mapperid').on('click', function() { | ||
console.log(form.mapper.getData(true)); | ||
console.log(form.mapper.getData(undefined,true)); | ||
|
||
return false; | ||
}); | ||
|
@@ -50,7 +53,22 @@ define(['js/form', 'globalize'], function(Form) { | |
}); | ||
|
||
$('#addemail').on('click', function() { | ||
form.mapper.addToCollection('emails', {email:'[email protected]'}); | ||
form.mapper.addToCollection('emails', {email:'[email protected]'}).then(function($element) { | ||
console.log($element); | ||
}); | ||
}); | ||
|
||
$('#addempty').on('click', function() { | ||
form.mapper.addToCollection('empty', {value:'dudldu'}).then(function($element) { | ||
console.log($element); | ||
}); | ||
}); | ||
|
||
$('#removeempty').on('click', function() { | ||
var mapperId = $('body').find('*[data-mapper-property-tpl=empty-tpl]').eq(0).attr('data-mapper-id'); | ||
if (mapperId) { | ||
form.mapper.removeFromCollection(parseInt(mapperId,10)); | ||
} | ||
}); | ||
|
||
$('#addemailend').on('click', function() { | ||
|
@@ -89,6 +107,7 @@ define(['js/form', 'globalize'], function(Form) { | |
lastName: 'Wachter', | ||
birthDay: '2013-09-18T08:05:00', | ||
wage: 1500, | ||
disabled: 1, | ||
country: { | ||
id: 2, | ||
name: 'CH' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
requirejs.config({ | ||
baseUrl: '../../../', | ||
paths: { | ||
'globalize': 'bower_components/globalize/lib/globalize', | ||
'cultures': 'bower_components/globalize/lib/cultures' | ||
} | ||
}); | ||
|
||
define(['js/form', 'globalize'], function(Form) { | ||
var language = 'de', form; | ||
|
||
require(['cultures/globalize.culture.' + language], function() { | ||
Globalize.culture(language); | ||
}.bind(this)); | ||
|
||
form = new Form($('#content-form'), {debug: true}); | ||
|
||
$('#content-form').on('submit', function() { | ||
console.log(form.mapper.getData()); | ||
return false; | ||
}); | ||
|
||
$('#set-data').on('click', function() { | ||
form.mapper.setData({ | ||
id: '5', | ||
title: 'Titel', | ||
country:'en', | ||
url: '/testurl', | ||
article: 'asdfasdf', | ||
region: { | ||
id: '5', | ||
name: 'Tirol' | ||
} | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title></title> | ||
<link href="../../../css/validation.css" rel="stylesheet"> | ||
<link href="../../../assets/css/husky.min.css" rel="stylesheet"> | ||
|
||
<style type="text/css"> | ||
#content { | ||
margin-left: auto; | ||
margin-right: auto; | ||
width: 800px; | ||
margin-top: 100px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
|
||
<div id="content"> | ||
<form id="content-form" class="grid"> | ||
<div class="grid-row"> | ||
<label for="country" class="pointer required">Title</label> | ||
<span id="country" data-form="true" data-type="hiddenData" data-mapper-property="region" data-type-id="id" data-type-default-value="my return value"></span> | ||
</div> | ||
<input type="submit" value="SEND"/> | ||
<input type="button" value="SET" id="set-data"/> | ||
</form> | ||
</div> | ||
|
||
<script src="../../../assets/js/jquery.js"></script> | ||
<script src="../../../assets/js/underscore.js"></script> | ||
<script data-main="app.js" type="text/javascript" src="../../../assets/js/require.js"></script> | ||
</body> | ||
</html> |
Oops, something went wrong.