Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
DDA
dda-wizard
Commits
df281886
Commit
df281886
authored
Aug 10, 2016
by
Hellmich, Christoph
Browse files
Move element configuration to a new file
parent
d3dc7bb7
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/main/webapp/index.html
View file @
df281886
...
...
@@ -147,6 +147,7 @@
<script
src=
"scripts/app/wizardEditor/wizardEditor-wizard-delete-dialog.controller.js"
></script>
<script
src=
"scripts/components/wizardEditor/simpleConditional/simpleConditional-directive.js"
></script>
<script
src=
"scripts/components/wizardEditor/templateImporter/templateImporter.controller.js"
></script>
<script
src=
"scripts/components/wizardEditor/element.config.js"
></script>
<script
src=
"scripts/components/wizardEditor/tree.service.js"
></script>
<script
src=
"scripts/components/auth/services/sessions.service.js"
></script>
<script
src=
"scripts/components/auth/provider/auth.session.service.js"
></script>
...
...
src/main/webapp/scripts/app/wizardEditor/wizardEditor.controller.js
View file @
df281886
'
use strict
'
;
angular
.
module
(
'
ddaApp
'
)
.
constant
(
'
customElements
'
,
[
{
'
fieldName
'
:
'
simpleConditional
'
,
'
category
'
:
'
Wizard
'
,
'
fieldOptions
'
:
{
'
displayName
'
:
'
Conditional
'
,
'
hidden
'
:
false
,
'
nolabel
'
:
false
}
},
{
'
fieldName
'
:
'
checkbox
'
,
// = Ordnername in components/wizardEditor/
'
category
'
:
'
⚠ Development
'
,
'
fieldOptions
'
:
{
'
displayName
'
:
'
Checkbox
'
}
},
{
'
fieldName
'
:
'
checkboxlist
'
,
'
category
'
:
'
⚠ Development
'
,
'
fieldOptions
'
:
{
'
displayName
'
:
'
Checkbox List
'
}
},
{
'
fieldName
'
:
'
templateImporter
'
,
'
category
'
:
'
⚠ Development
'
,
'
fieldOptions
'
:
{
'
displayName
'
:
'
Template Importer
'
}
}
])
.
constant
(
'
validationMessages
'
,
{
// 'date' : 'Invalid date',
// 'dateMin' : 'Date value too low',
// 'dateMax' : 'Date value too high',
// 'max' : 'The value {{ field.schema && ("should be less than " + field.schema.validation.max) || field.state.$viewValue + " is too high" }}'
})
.
constant
(
'
validationPattern
'
,
{
// 'Integer': '/^-{0,1}\\d+$/'
})
.
config
(
function
(
fgConfigProvider
,
FgField
,
customElements
,
validationMessages
,
validationPattern
)
{
for
(
var
i
=
0
;
i
<
customElements
.
length
;
i
++
)
{
var
element
=
customElements
[
i
];
var
fieldTemplate
=
new
FgField
(
element
.
fieldName
,
element
.
fieldOptions
);
var
templateUrl
=
'
scripts/components/wizardEditor/
'
+
element
.
fieldName
+
'
/
'
+
element
.
fieldName
+
'
-template.ng.html
'
;
var
propertiesUrl
=
'
scripts/components/wizardEditor/
'
+
element
.
fieldName
+
'
/
'
+
element
.
fieldName
+
'
-properties.ng.html
'
;
fgConfigProvider
.
fields
.
add
(
fieldTemplate
,
element
.
category
,
templateUrl
,
propertiesUrl
);
}
fgConfigProvider
.
validation
.
message
(
validationMessages
);
fgConfigProvider
.
validation
.
pattern
(
validationPattern
);
})
.
controller
(
'
WizardEditorController
'
,
function
(
$scope
,
$state
,
entity
,
Wizard
,
Step
,
Element
,
treeService
)
{
var
deletedFields
=
[];
$scope
.
formDirty
=
false
;
// TODO: use $dirty, or something else
...
...
@@ -124,13 +69,13 @@ angular.module('ddaApp')
var
changingFormWatcher
=
watchFormChanging
();
changingFormWatcher
(
true
);
var
onSaveError
=
function
(
result
)
{
var
onSaveError
=
function
(
result
)
{
console
.
log
(
'
onSaveError
'
);
console
.
log
(
result
);
};
function
loadFields
(
step
)
{
if
(
!
step
)
{
if
(
!
step
)
{
$scope
.
selectedStep
=
null
;
$scope
.
myForm
=
{
schema
:
{
...
...
@@ -139,7 +84,9 @@ angular.module('ddaApp')
};
return
;
}
Step
.
elements
({
'
id
'
:
step
.
id
},
function
(
elements
)
{
Step
.
elements
({
'
id
'
:
step
.
id
},
function
(
elements
)
{
$scope
.
myForm
.
schema
.
fields
=
elements
;
$scope
.
selectedStep
=
step
;
deletingFieldWatcher
(
false
);
...
...
@@ -157,13 +104,16 @@ angular.module('ddaApp')
i
;
for
(
i
=
0
;
i
<
deletedFields
.
length
;
i
++
)
{
Element
.
delete
({
'
id
'
:
deletedFields
[
i
].
id
});
Element
.
delete
({
'
id
'
:
deletedFields
[
i
].
id
});
}
var
counter
=
0
;
function
count
()
{
counter
++
;
if
(
counter
===
fields
.
length
)
{
if
(
counter
===
fields
.
length
)
{
loadFields
(
$scope
.
selectedStep
);
}
}
...
...
@@ -171,11 +121,11 @@ angular.module('ddaApp')
for
(
i
=
0
;
i
<
fields
.
length
;
i
++
)
{
var
element
=
fields
[
i
];
element
.
step
=
{
'
id
'
:
$scope
.
selectedStep
.
id
'
id
'
:
$scope
.
selectedStep
.
id
};
element
.
formRow
=
i
;
if
(
!
element
.
id
)
{
if
(
!
element
.
id
)
{
Element
.
save
(
element
,
count
,
onSaveError
);
// TODO: onSaveError
}
else
{
Element
.
update
(
element
,
count
,
onSaveError
);
// TODO: onSaveError
...
...
@@ -205,7 +155,7 @@ angular.module('ddaApp')
$scope
.
wizards
=
result
;
});
if
(
$state
.
params
.
id
)
{
if
(
$state
.
params
.
id
)
{
Wizard
.
steps
({
id
:
$state
.
params
.
id
},
function
(
steps
)
{
...
...
src/main/webapp/scripts/components/wizardEditor/element.config.js
0 → 100644
View file @
df281886
'
use strict
'
;
angular
.
module
(
'
ddaApp
'
)
.
constant
(
'
customElements
'
,
[{
'
fieldName
'
:
'
simpleConditional
'
,
// = Ordnername in components/wizardEditor/
'
category
'
:
'
Wizard
'
,
'
fieldOptions
'
:
{
'
displayName
'
:
'
Conditional
'
,
'
hidden
'
:
false
,
'
nolabel
'
:
false
}
},
{
'
fieldName
'
:
'
checkbox
'
,
'
category
'
:
'
⚠ Development
'
,
'
fieldOptions
'
:
{
'
displayName
'
:
'
Checkbox
'
}
},
{
'
fieldName
'
:
'
checkboxlist
'
,
'
category
'
:
'
⚠ Development
'
,
'
fieldOptions
'
:
{
'
displayName
'
:
'
Checkbox List
'
}
},
{
'
fieldName
'
:
'
templateImporter
'
,
'
category
'
:
'
⚠ Development
'
,
'
fieldOptions
'
:
{
'
displayName
'
:
'
Template Importer
'
}
}])
.
constant
(
'
validationMessages
'
,
{
// 'date' : 'Invalid date',
// 'dateMin' : 'Date value too low',
// 'dateMax' : 'Date value too high',
// 'max' : 'The value {{ field.schema && ("should be less than " + field.schema.validation.max) || field.state.$viewValue + " is too high" }}'
})
.
constant
(
'
validationPattern
'
,
{
// 'Integer': '/^-{0,1}\\d+$/'
})
.
config
(
function
(
fgConfigProvider
,
FgField
,
customElements
,
validationMessages
,
validationPattern
)
{
for
(
var
i
=
0
;
i
<
customElements
.
length
;
i
++
)
{
var
element
=
customElements
[
i
];
var
fieldTemplate
=
new
FgField
(
element
.
fieldName
,
element
.
fieldOptions
);
var
templateUrl
=
'
scripts/components/wizardEditor/
'
+
element
.
fieldName
+
'
/
'
+
element
.
fieldName
+
'
-template.ng.html
'
;
var
propertiesUrl
=
'
scripts/components/wizardEditor/
'
+
element
.
fieldName
+
'
/
'
+
element
.
fieldName
+
'
-properties.ng.html
'
;
fgConfigProvider
.
fields
.
add
(
fieldTemplate
,
element
.
category
,
templateUrl
,
propertiesUrl
);
}
fgConfigProvider
.
validation
.
message
(
validationMessages
);
fgConfigProvider
.
validation
.
pattern
(
validationPattern
);
});
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment