Skip to content

Conversation

soul4code
Copy link

  • random order of load/add steps when using templates for wzStep directive
  • Nested wizards. Loading childwizard steps directive before run directive link function.

- random ordering when using templates for step directive
- Nested wizards. Loading childwizard steps  directive before run directive link function.
@jacobscarter
Copy link
Collaborator

@magnitronus I will get this merged as soon as I can, thanks.

@raftheunis87
Copy link

@jacobscarter Any news on the merge? I currently have the following issue:

<wizard on-finish="finishedWizard()" hide-indicators="true" current-step="currentPage"> <wz-step title="{{page.label}}" ng-repeat="page in pages | orderBy:sequenceSort" class="clearfix"> <div ng-repeat="question in page.questions"> <question my-question="question" my-assignment-id="assignmentId" page="page" ng-model="question" class="questionMargin"></question> </div> {{page.sequence}} <button class="btn btn-primary pull-left" ng-click="cancel()">Annuleer</button> <button class="btn btn-primary pull-right" type="submit" wz-next>Volgende</button> </wz-step> </wizard>

The ng-repeat gets an ordered data-set. I even added an extra orderBy to make sure everything is ordered, but the steps still are randomly shown.

@nfantone
Copy link

@raftheunis87 That should work. Your ng-repeat is iterating over an array declared on your controller (pages), while the wizard keeps its own array in its own isolated scope. Steps get added as soon as each wzStep directive is created, and since you are ordering the steps declaration they should show accordingly.

Try using single quotes in the orderBy filter.

ng-repeat="page in pages | orderBy:'sequenceSort'"

(see the docs: https://docs.angularjs.org/api/ng/filter/orderBy)

@lauraschoebel
Copy link

is there any development on this? I'm having a similar issue with my wizard consisting of 3 steps, where the 2nd step is an ng-repeat. Due to issues discussed above the wizard orders it Step 1, Step 3, and then the Step 2 ng-repeats. I saw that the fix above contains a solution with orderIndex but the current version doesn't seem to support his yet. Any help would be appreciated.

@jacobscarter
Copy link
Collaborator

Can you fix merge conflicts, I will get it merged after, sorry for the huge delay

},
require: '^wizard',
templateUrl: function(element, attributes) {
return attributes.template || "step.html";
},
link: function($scope, $element, $attrs, wizard) {
$scope.title = $scope.title || $scope.wzTitle;
wizard.addStep($scope);

//for nested wizards. Add step when tempate for wizard is ready.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

template not tempate

}
else {
$rootScope.$on('mgo-angular-wizard.transcluded', function($event, wzName){
if (wizard.name==wzName) wizard.addStep($scope);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use {} in your if statement. Please add space on either side of ==

@@ -15,30 +15,74 @@ angular.module('mgo-angular-wizard').directive('wizard', function() {
return attributes.template || "wizard.html";
},

link: function($scope, $element, $attributes){

var get_stepnodes = function (parent)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{ on same like as argument declaration please

{
var matchingElements = [];
var allElements = parent[0].getElementsByTagName('*');
for (var i = 0, n = allElements.length; i < n; i++)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for (var i = 0; i < allElements.length; i++)

for (var i = 0, n = allElements.length; i < n; i++)
{
var current = allElements[i],
$current = angular.element(current);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

declare variable, correct whitespace.

$current = angular.element(current);

if (!_.isUndefined($current.attr('wz-step')) || current.nodeName.toLowerCase()=='wz-step' || $current.hasClass('step'))
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{ on same line as ()

var thisModule = this;

$scope.$watch('transcluded', function(val){
if (val) thisModule.transcluded = true;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add {}

@@ -143,7 +200,7 @@ angular.module('mgo-angular-wizard').directive('wizard', function() {
function unselectAll() {
//traverse steps array and set each "selected" property to false
_.each($scope.steps, function (step) {
step.selected = false;
if (step) step.selected = false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{} on new line

@jacobscarter
Copy link
Collaborator

jacobscarter commented Jun 6, 2017

@magnitronus can you please fix your syntax to match the coding style of the other contributors for consistency, can you please rebase your branch off our master so you will have the updates that fix issues with automated CI checks failing, can you please write unit tests to cover your new functionality, can you please remove the dist files from your PR, as a reminder we have our contribution guidelines here: https://github.com/angular-wizard/angular-wizard/blob/master/CHANGELOG.md

@nfantone
Copy link

nfantone commented Jun 9, 2017

@jacobscarter Sorry to intrude and jump in here, but... what if instead of you acting as a human linter, we actually configure and use one? From my humble POV, you cannot enforce a particular coding style to contributors when you yourself don't (or your project doesn't).

On a related note, if you want to avoid contributors/members pushing specific files to the repo, those should be clearly ignored in .gitignore. Otherwise, you'll most likely end up correcting this time and again. Besides, the fact that you are checking build results into the repository is odd/confusing, to say the least.

Also, the link to the contribution guidelines should be: https://github.com/angular-wizard/angular-wizard/blob/master/CONTRIBUTE.md. You pointed to the changelog there.

@jacobscarter
Copy link
Collaborator

@nfantone great points, would you like to make a PR updating the gitignore and adding jslint?

@jacobscarter
Copy link
Collaborator

On second thought, the gitignore would prevent updated build files from pushing when appropriate (unless you have an idea for that). However I like the linter idea and would love to see that incorporated. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants