From 67b50ed567b993c17ed2f9e50c92dccf34ea2e7f Mon Sep 17 00:00:00 2001 From: Duncan Lock Date: Wed, 20 May 2015 18:41:05 -0700 Subject: [PATCH 1/2] Updated demo index.html to source everything from bower_components Was previously getting components from a mixture of locations - CDNs, github and the local bower_components - despite everything being available locally in bower_components. I updated it to source everything from the local bower_components folder This is more consistent and ensures that the demo is using the correct versions of all components, rather than a mixture. --- index.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index 398a5cb..4253528 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ angular-form-builder - + @@ -12,13 +12,13 @@ - - - + + + - - + + From 0f2c78d3201d33464f86e97ce2515f8cb63e2099 Mon Sep 17 00:00:00 2001 From: Duncan Lock Date: Wed, 20 May 2015 20:42:48 -0700 Subject: [PATCH 2/2] Modularize & improve the popover templates - Move the Cancel, Delete & Save buttons out into a variable, and use this in the templates, instead of duplicating this in every template. - Improve the markup & style of the buttons; use words instead of icons for Saev & Delete - simpler, cleaner and larger tap/click targets. - Add an 'x' button at the top right to close/cancel the popover; keep Cancel button for now. - Improve the scss for the buttons & popovers in general; min-height for the contents, to minimize jumping around; tidy up & improve margins. --- components/default-components.coffee | 117 ++++++++---------------- dist/angular-form-builder-components.js | 26 ++++-- dist/angular-form-builder.css | 2 +- src/angular-form-builder.scss | 20 ++++ 4 files changed, 77 insertions(+), 88 deletions(-) diff --git a/components/default-components.coffee b/components/default-components.coffee index 8cd1438..81a5aae 100644 --- a/components/default-components.coffee +++ b/components/default-components.coffee @@ -1,3 +1,20 @@ +popoverButtons = + """ +
+
+ + + + + +
+ """ + +popoverCloseX = + """ + + """ + angular.module 'builder.components', ['builder', 'validator.rules'] .config ['$builderProvider', ($builderProvider) -> @@ -64,12 +81,7 @@ angular.module 'builder.components', ['builder', 'validator.rules'] -
-
- - - -
+ #{popoverButtons} """ @@ -106,6 +118,7 @@ angular.module 'builder.components', ['builder', 'validator.rules'] """ popoverTemplate: """ + #{popoverCloseX}
@@ -200,13 +213,10 @@ angular.module 'builder.components', ['builder', 'validator.rules']
-
-
- - - -
+ +
+ #{popoverButtons} """ @@ -237,10 +247,9 @@ angular.module 'builder.components', ['builder', 'validator.rules'] """ popoverTemplate: """ + #{popoverCloseX}
-
-
- -
-
- - - -
+ #{popoverButtons} """ # ---------------------------------------- @@ -388,6 +391,7 @@ angular.module 'builder.components', ['builder', 'validator.rules'] """ popoverTemplate: """ + #{popoverCloseX}
@@ -502,14 +506,8 @@ angular.module 'builder.components', ['builder', 'validator.rules']
- -
-
- - - -
+ #{popoverButtons} """ # ---------------------------------------- @@ -537,6 +535,7 @@ angular.module 'builder.components', ['builder', 'validator.rules'] """ popoverTemplate: """ + #{popoverCloseX}
@@ -625,14 +624,8 @@ angular.module 'builder.components', ['builder', 'validator.rules']
- -
-
- - - -
+ #{popoverButtons} """ # ---------------------------------------- @@ -669,6 +662,7 @@ angular.module 'builder.components', ['builder', 'validator.rules'] """ popoverTemplate: """ + #{popoverCloseX}
@@ -758,14 +752,8 @@ angular.module 'builder.components', ['builder', 'validator.rules']
- -
-
- - - -
+ #{popoverButtons} """ # ---------------------------------------- @@ -799,6 +787,7 @@ angular.module 'builder.components', ['builder', 'validator.rules'] """ popoverTemplate: """ + #{popoverCloseX}
@@ -889,14 +878,8 @@ angular.module 'builder.components', ['builder', 'validator.rules']
- -
-
- - - -
+ #{popoverButtons} """ # ---------------------------------------- @@ -934,6 +917,7 @@ angular.module 'builder.components', ['builder', 'validator.rules'] """ popoverTemplate: """ + #{popoverCloseX}
@@ -1032,14 +1016,8 @@ angular.module 'builder.components', ['builder', 'validator.rules']
- -
-
- - - -
+ #{popoverButtons} """ # ---------------------------------------- @@ -1073,6 +1051,7 @@ angular.module 'builder.components', ['builder', 'validator.rules'] """ popoverTemplate: """ + #{popoverCloseX}
@@ -1162,14 +1141,8 @@ angular.module 'builder.components', ['builder', 'validator.rules']
- -
-
- - - -
+ #{popoverButtons} """ @@ -1201,6 +1174,7 @@ angular.module 'builder.components', ['builder', 'validator.rules'] # """ # popoverTemplate: # """ + # #{popoverCloseX} #
# #
@@ -1257,14 +1231,8 @@ angular.module 'builder.components', ['builder', 'validator.rules'] #
# # - # - #
- #
- # - # - # - #
#
+ # #{popoverButtons} # """ # ---------------------------------------- @@ -1294,6 +1262,7 @@ angular.module 'builder.components', ['builder', 'validator.rules'] """ popoverTemplate: """ + #{popoverCloseX}
@@ -1383,13 +1352,7 @@ angular.module 'builder.components', ['builder', 'validator.rules']
- -
-
- - - -
+ #{popoverButtons} """ ] diff --git a/dist/angular-form-builder-components.js b/dist/angular-form-builder-components.js index 5172607..210fc66 100644 --- a/dist/angular-form-builder-components.js +++ b/dist/angular-form-builder-components.js @@ -1,4 +1,10 @@ (function() { + var popoverButtons, popoverCloseX; + + popoverButtons = "
\n
\n \n\n \n\n \n
"; + + popoverCloseX = ""; + angular.module('builder.components', ['builder', 'validator.rules']).config([ '$builderProvider', function($builderProvider) { $builderProvider.registerComponent('message', { @@ -6,7 +12,7 @@ placeholder: 'Rich Content', label: 'Rich Content', template: "
\n
\n Text Message\n
\n
\n
", - popoverTemplate: "
\n\n
\n\n \n \n\n \n
\n
\n
\n \n \n
\n \n
\n
\n
\n
\n
\n

this element if

\n \n \n \n
\n
\n
\n
\n
\n
\n\n
\n
\n \n \n \n
\n
" + popoverTemplate: "
\n\n
\n\n \n \n\n \n
\n
\n
\n \n \n
\n \n
\n
\n
\n
\n
\n

this element if

\n \n \n \n
\n
\n
\n
\n
\n
\n\n " + popoverButtons + "\n
" }); $builderProvider.registerComponent('email', { group: 'Basic', @@ -16,7 +22,7 @@ required: false, readOnly: false, template: "
\n \n
\n
\n @\n \n
\n
\n @\n \n
\n
\n
\n {{description}}\n
\n
\n
", - popoverTemplate: "
\n\n
\n\n \n \n\n \n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n
\n
\n
\n
\n \n
\n
\n \n
\n
0\">\n \n \n
\n
\n
\n
\n

this element if

\n \n \n \n
\n
\n\n
\n\n
0\">\n \n
\n Add {{rule.points}} points if this field {{rule.predicate | predicate}} {{rule.value}} \n
\n
\n
\n
\n Add\n \n points\n
\n
\n\n
\n
\n if this field\n \n
\n
\n\n
\n \n \n \n \n
\n

{{rulesErrorMessage}}

\n\n
\n\n
\n
\n
\n \n \n \n
\n" + popoverTemplate: "" + popoverCloseX + "\n
\n\n
\n\n \n \n\n \n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n
\n
\n
\n
\n \n
\n
\n \n
\n
0\">\n \n \n
\n
\n
\n
\n

this element if

\n \n \n \n
\n
\n\n
\n\n
0\">\n \n
\n Add {{rule.points}} points if this field {{rule.predicate | predicate}} {{rule.value}} \n
\n
\n
\n
\n Add\n \n points\n
\n
\n\n
\n
\n if this field\n \n
\n
\n\n
\n \n \n \n \n
\n

{{rulesErrorMessage}}

\n\n
\n\n
\n\n\n\n" + popoverButtons }); $builderProvider.registerComponent('date', { group: 'Basic', @@ -26,7 +32,7 @@ disableWeekends: false, readOnly: false, template: "
\n \n
\n \n
\n
\n {{description}}\n
\n
\n
", - popoverTemplate: "
\n\n
\n\n \n \n\n \n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n
\n
\n
\n
\n \n
\n
\n \n
\n
0\">\n \n \n
\n
\n
\n
\n Date is in next\n
\n
\n \n
\n
\n days\n
\n
\n
\n
\n
\n
\n

this element if

\n \n \n \n
\n
\n
\n\n
0\">\n \n
\n Add {{rule.points}} points if this field {{rule.predicate | predicate}} {{rule.value}} \n
\n
\n
\n
\n Add\n \n points\n
\n
\n\n
\n
\n if this field\n \n
\n
\n\n
\n \n \n \n \n
\n

{{rulesErrorMessage}}

\n\n
\n\n
\n
\n\n
\n
\n \n \n \n
\n
" + popoverTemplate: "" + popoverCloseX + "\n
\n
\n \n \n\n \n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n
\n
\n
\n
\n \n
\n
\n \n
\n
0\">\n \n \n
\n
\n
\n
\n Date is in next\n
\n
\n \n
\n
\n days\n
\n
\n
\n
\n
\n
\n

this element if

\n \n \n \n
\n
\n
\n\n
0\">\n \n
\n Add {{rule.points}} points if this field {{rule.predicate | predicate}} {{rule.value}} \n
\n
\n
\n
\n Add\n \n points\n
\n
\n\n
\n
\n if this field\n \n
\n
\n\n
\n \n \n \n \n
\n

{{rulesErrorMessage}}

\n\n
\n\n
\n
\n
\n" + popoverButtons }); $builderProvider.registerComponent('text', { group: 'Basic', @@ -52,7 +58,7 @@ } ], template: "
\n \n
\n \n
\n
\n {{description}}\n
\n
\n
", - popoverTemplate: "
\n\n
\n\n \n \n\n \n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
\n \n
\n
\n
\n
\n \n
\n
0\">\n \n \n
\n
\n
\n \n
\n
\n \n
\n
\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n

this element if

\n \n \n \n
\n
\n
\n\n
0\">\n \n
\n Add {{rule.points}} points if this field {{rule.predicate | predicate}} {{rule.value}} \n
\n
\n
\n
\n Add\n \n points\n
\n
\n\n
\n
\n if this field\n \n
\n
\n\n
\n \n \n \n \n
\n

{{rulesErrorMessage}}

\n\n
\n
\n
\n\n
\n
\n \n \n \n
\n
" + popoverTemplate: "" + popoverCloseX + "\n
\n\n
\n\n \n \n\n \n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n \n \n
\n
\n \n
\n
\n
\n
\n \n
\n
0\">\n \n \n
\n
\n
\n \n
\n
\n \n
\n
\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n

this element if

\n \n \n \n
\n
\n
\n\n
0\">\n \n
\n Add {{rule.points}} points if this field {{rule.predicate | predicate}} {{rule.value}} \n
\n
\n
\n
\n Add\n \n points\n
\n
\n\n
\n
\n if this field\n \n
\n
\n\n
\n \n \n \n \n
\n

{{rulesErrorMessage}}

\n\n
\n
\n
\n
\n" + popoverButtons }); $builderProvider.registerComponent('area', { group: 'Basic', @@ -62,7 +68,7 @@ required: false, readOnly: false, template: "
\n \n
\n