Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
Fix merge error
Browse files Browse the repository at this point in the history
  • Loading branch information
nialldonnellyfh committed Apr 24, 2014
1 parent 17ae7bb commit bdc83a9
Show file tree
Hide file tree
Showing 16 changed files with 8,934 additions and 5,932 deletions.
3,098 changes: 1,923 additions & 1,175 deletions dist/feedhenry-forms.js

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions dist/feedhenry-forms.min.js

Large diffs are not rendered by default.

Binary file modified dist/fh-starter-project-latest.zip
Binary file not shown.
1,162 changes: 579 additions & 583 deletions libs/generated/appForms/appForms-backboneRequireJS.js

Large diffs are not rendered by default.

3,054 changes: 1,897 additions & 1,157 deletions libs/generated/appForms/appForms-core.js

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion libs/generated/lawnchair.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,12 @@ Lawnchair.adapter('window-name', (function() {
// not chainable: valid, keys
//
Lawnchair.adapter('dom', (function() {
var storage = window.localStorage
var storage = null;
try{
storage = window.localStorage;
}catch(e){

}
// the indexer is an encapsulation of the helpers needed to keep an ordered index of the keys
var indexer = function(name) {
return {
Expand Down
7 changes: 6 additions & 1 deletion libs/lawnchair/lawnchairLocalStorageAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
// not chainable: valid, keys
//
Lawnchair.adapter('dom', (function() {
var storage = window.localStorage
var storage = null;
try{
storage = window.localStorage;
}catch(e){

}
// the indexer is an encapsulation of the helpers needed to keep an ordered index of the keys
var indexer = function(name) {
return {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fh-js-sdk",
"version": "2.0.3-alpha",
"version": "2.0.4-alpha",
"description": "feedhenry js sdk",
"main": "feedhenry.js",
"browser": {
Expand Down
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<!-- see http://cordova.apache.org/docs/en/3.0.0/plugin_ref_spec.md.html#Plugin%20Specification for element details-->

<js-module src="dist/feedhenry-latest.js" name="FHJSSDK">
<js-module src="dist/feedhenry-forms.js" name="FHJSSDK">
<merges target="$fh" />
</js-module>
</plugin>
310 changes: 153 additions & 157 deletions src/appforms/src/backbone/040-view03Page.js
Original file line number Diff line number Diff line change
@@ -1,170 +1,166 @@
var PageView = BaseView.extend({

viewMap: {
"text": FieldTextView,
"number": FieldNumberView,
"textarea": FieldTextareaView,
"radio": FieldRadioView,
"checkboxes": FieldCheckboxView,
"dropdown": FieldSelectView,
"file": FieldFileView,
"emailAddress": FieldEmailView,
"phone": FieldPhoneView,
"location": FieldGeoView,
"photo": FieldCameraView,
"signature": FieldSignatureView,
"locationMap": FieldMapView,
"dateTime": FieldDateTimeView,
"sectionBreak": FieldSectionBreak,
"url": FieldUrlView
},
templates: {
pageTitle: '<div class="fh_appform_page_title"><%= pageTitle %></div>',
pageDescription: '<div class="fh_appform_page_description"><%= pageDescription%></div>',
section: '<div id="fh_appform_<%= sectionId %>" class="fh_appform_section_area"></div>'
},

initialize: function() {
var self = this;
_.bindAll(this, 'render', "show", "hide");
// Page Model will emit events if user input meets page rule to hide / show the page.
this.model.on("visible", self.show);
this.model.on("hidden", self.hide);
this.render();
},

render: function() {
var self = this;
this.fieldViews = {};
this.sectionViews = {};
// all pages hidden initially
this.$el.empty().addClass('fh_appform_page fh_appform_hidden');

//Need to add the page title and description
this.$el.append(_.template(this.templates.pageDescription, {
pageDescription: this.model.getDescription()
}));

// add to parent before init fields so validation can work
this.options.parentEl.append(this.$el);

var fieldModelList = this.model.getFieldModelList();

var sections = this.model.getSections();

if (sections != null) {
var sectionKey;
for (sectionKey in sections) {
this.$el.append(_.template(this.templates.section, {
"sectionId": sectionKey
}));
}

//Add the section fields
for (sectionKey in sections) {
sections[sectionKey].forEach(function(field, index) {
var fieldType = field.getType();
if (self.viewMap[fieldType]) {

$fh.forms.log.d("*- " + fieldType);

self.fieldViews[field.get('_id')] = new self.viewMap[fieldType]({
parentEl: self.$el,
parentView: self,
model: field,
formView: self.options.formView,
sectionName: sectionKey
});
} else {
$fh.forms.log.w('FIELD NOT SUPPORTED:' + fieldType);
}
});
}
} else {
fieldModelList.forEach(function(field, index) {
if (!field) {
return;
}
var fieldType = field.getType();
if (self.viewMap[fieldType]) {

$fh.forms.log.d("*- " + fieldType);

self.fieldViews[field.get('_id')] = new self.viewMap[fieldType]({
parentEl: self.$el,
parentView: self,
model: field,
formView: self.options.formView
});
} else {
$fh.forms.log.w('FIELD NOT SUPPORTED:' + fieldType);
}
var PageView=BaseView.extend({

viewMap: {
"text": FieldTextView,
"number": FieldNumberView,
"textarea": FieldTextareaView,
"radio": FieldRadioView,
"checkboxes": FieldCheckboxView,
"dropdown": FieldSelectView,
"file": FieldFileView,
"emailAddress": FieldEmailView,
"phone": FieldPhoneView,
"location": FieldGeoView,
"photo": FieldCameraView,
"signature": FieldSignatureView,
"locationMap": FieldMapView,
"dateTime":FieldDateTimeView,
"sectionBreak":FieldSectionBreak,
"url":FieldUrlView
},
templates : {
pageTitle : '<div class="fh_appform_page_title"><%= pageTitle %></div>',
pageDescription: '<div class="fh_appform_page_description"><%= pageDescription%></div>',
section: '<div id="fh_appform_<%= sectionId %>" class="fh_appform_section_area"></div>'
},

initialize: function() {
var self = this;
_.bindAll(this, 'render',"show","hide");
// Page Model will emit events if user input meets page rule to hide / show the page.
this.model.on("visible",self.show);
this.model.on("hidden",self.hide);
this.render();
},

render: function() {
var self = this;
this.fieldViews = {};
this.sectionViews = {};
// all pages hidden initially
this.$el.empty().addClass('fh_appform_page fh_appform_hidden');

//Need to add the page title and description
this.$el.append(_.template(this.templates.pageDescription, {pageDescription: this.model.getDescription()}));

// add to parent before init fields so validation can work
this.options.parentEl.append(this.$el);

var fieldModelList=this.model.getFieldModelList();

var sections = this.model.getSections();

if(sections != null){
var sectionKey;
for(sectionKey in sections){
this.$el.append(_.template(this.templates.section, {"sectionId": sectionKey}));
}

//Add the section fields
for(sectionKey in sections){
sections[sectionKey].forEach(function(field, index){
var fieldType = field.getType();
if (self.viewMap[fieldType]) {

console.log("*- "+fieldType);

self.fieldViews[field.get('_id')] = new self.viewMap[fieldType]({
parentEl: self.$el,
parentView: self,
model: field,
formView: self.options.formView,
sectionName: sectionKey
});
} else {
console.warn('FIELD NOT SUPPORTED:' + fieldType);
}
});
}
} else {
fieldModelList.forEach(function (field, index) {
if(!field) {
return;
}
},
var fieldType = field.getType();
if (self.viewMap[fieldType]) {

show: function() {
var self = this;
self.$el.removeClass('fh_appform_hidden');
console.log("*- "+fieldType);

for (var fieldViewId in self.fieldViews) {
if (self.fieldViews[fieldViewId].mapResize) {
self.fieldViews[fieldViewId].mapResize();
}
self.fieldViews[field.get('_id')] = new self.viewMap[fieldType]({
parentEl: self.$el,
parentView: self,
model: field,
formView: self.options.formView
});
} else {
console.warn('FIELD NOT SUPPORTED:' + fieldType);
}
},
});
}
},

hide: function() {
this.$el.addClass('fh_appform_hidden');
},
show: function () {
var self = this;
self.$el.removeClass('fh_appform_hidden');

showField: function(id) {
// show field if it's on this page
if (this.fieldViews[id]) {
this.fieldViews[id].show();
}
},
for(var fieldViewId in self.fieldViews){
if(self.fieldViews[fieldViewId].mapResize){
self.fieldViews[fieldViewId].mapResize();
}
}
},

hideField: function(id) {
// hide field if it's on this page
if (this.fieldViews[id]) {
this.fieldViews[id].hide();
}
},
hide: function () {
this.$el.addClass('fh_appform_hidden');
},

isValid: function() {
// only validate form inputs on this page that are visible or type=hidden, or have validate_ignore class
var validateEls = this.$el.find('.fh_appform_field_input').not('.validate_ignore]:hidden');
return validateEls.length ? validateEls.valid() : true;
showField: function (id) {
// show field if it's on this page
if (this.fieldViews[id]) {
this.fieldViews[id].show();
}
},

// checkRules: function () {
// var self = this;
// var result = {};
//
// var rules = {
// SkipToPage: function (rulePasses, params) {
// var pageToSkipTo = params.Setting.Page;
// if (rulePasses) {
// result.skipToPage = pageToSkipTo;
// }
// }
// };
//
// // iterate over page rules, if any, calling relevant rule function
// _(this.model.get('Rules') || []).forEach(function (rule, index) {
// // get element that rule condition is based on
// var jqEl = self.$el.find('#Field' + rule.condition.FieldName + ',' + '#radioField' + rule.condition.FieldName);
// rule.fn = rules[rule.Type];
// if(jqEl.data("type") === 'radio') {
// var rEl = self.$el.find('#Field' + rule.condition.FieldName + '_' + index);
// rEl.wufoo_rules('exec', rule);
// } else {
// jqEl.wufoo_rules('exec', rule);
// }
// });
//
// return result;
// }
hideField: function (id) {
// hide field if it's on this page
if (this.fieldViews[id]) {
this.fieldViews[id].hide();
}
},

isValid: function () {
// only validate form inputs on this page that are visible or type=hidden, or have validate_ignore class
var validateEls = this.$el.find('.fh_appform_field_input').not('.validate_ignore]:hidden');
return validateEls.length ? validateEls.valid() : true;
}

// checkRules: function () {
// var self = this;
// var result = {};
//
// var rules = {
// SkipToPage: function (rulePasses, params) {
// var pageToSkipTo = params.Setting.Page;
// if (rulePasses) {
// result.skipToPage = pageToSkipTo;
// }
// }
// };
//
// // iterate over page rules, if any, calling relevant rule function
// _(this.model.get('Rules') || []).forEach(function (rule, index) {
// // get element that rule condition is based on
// var jqEl = self.$el.find('#Field' + rule.condition.FieldName + ',' + '#radioField' + rule.condition.FieldName);
// rule.fn = rules[rule.Type];
// if(jqEl.data("type") === 'radio') {
// var rEl = self.$el.find('#Field' + rule.condition.FieldName + '_' + index);
// rEl.wufoo_rules('exec', rule);
// } else {
// jqEl.wufoo_rules('exec', rule);
// }
// });
//
// return result;
// }

});
Loading

0 comments on commit bdc83a9

Please sign in to comment.