Skip to content

Commit

Permalink
Fix for issue #286 - Questionnaires broken due to changes made to cod…
Browse files Browse the repository at this point in the history
…e lists
  • Loading branch information
Charles De Barros committed Jul 26, 2019
1 parent 5591286 commit 6205a9a
Show file tree
Hide file tree
Showing 23 changed files with 46 additions and 17 deletions.
6 changes: 6 additions & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
<base href="/">
</head>
<body data-ng-controller="RootController" data-ng-class="user.role">
<% if notice %>
<div class="alert alert-info"><%= notice %></div>
<% end %>
<% if alert %>
<div class="alert alert-danger"><%= alert %></div>
<% end %>
<%= yield %>

Expand Down
21 changes: 13 additions & 8 deletions app/views/question_items/index.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@ json.array!(@collection) do |question_item|
json.type question_item.class.name
json.instruction question_item.instruction.nil? ? '' : question_item.instruction.text
json.rds question_item.response_domains do |rd|
json.id rd.id
json.type rd.class.name
json.label rd.label
if rd.class == ResponseDomainCode
json.codes rd.codes, :label, :value, :order
else
json.subtype rd.subtype
json.params rd.params
begin
json.id rd.id
json.type rd.class.name
json.label rd.label
if rd.class == ResponseDomainCode
json.codes rd.codes, :label, :value, :order
else
json.subtype rd.subtype
json.params rd.params
end
rescue => err
logger.warn 'response_domain id is nil'
logger.warn err.message
end
end
end

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -110459,6 +110459,9 @@ return /******/ (function(modules) { // webpackBootstrap
}
return results;
})()).sort_by_property();
DataManager.Data.Codes.Categories.$promise.then(function() {
return $scope.categories = DataManager.Data.Codes.Categories;
});
return $timeout(function() {
var offset;
offset = localStorage.getItem('sidebar_scroll');
Expand Down Expand Up @@ -110518,7 +110521,7 @@ return /******/ (function(modules) { // webpackBootstrap
return DataManager.groupResponseDomains();
});
}, function() {
return console.log("error");
return Flash.add('danger', 'Code list failed to update!');
});
return DataManager.Data.ResponseDomains[$routeParams.id] = null;
};
Expand Down Expand Up @@ -111739,7 +111742,7 @@ angular.module("templates").run(["$templateCache", function($templateCache) {
// source: app/assets/javascripts/templates/partials/build/code_lists.html

angular.module("templates").run(["$templateCache", function($templateCache) {
$templateCache.put("partials/build/code_lists.html", '<form novalidate>\n <div class="form-group">\n <label for="a-codelist-label">\n Label\n </label>\n <input\n type="text"\n class="form-control first-field"\n id="a-codelist-label"\n placeholder="Label"\n data-ng-model="current.label"\n data-ng-disabled="!editMode"\n />\n </div>\n\n <div class="checkbox">\n <label>\n <input\n type="checkbox"\n id="a-codelist-rd"\n data-ng-model="current.rd"\n data-ng-disabled="!editMode"\n />\n Response Domain\n </label>\n </div>\n <div data-ng-show="current.rd">\n <div class="form-group">\n <label for="a-codelist-min">\n Min Responses:\n </label>\n <input\n type="number"\n class="form-control"\n id="a-codelist-min"\n placeholder="1"\n data-ng-model="current.min_responses"\n data-ng-disabled="!editMode"\n />\n </div>\n <div class="form-group">\n <label for="a-codelist-max">\n Max Responses:\n </label>\n <input\n type="number"\n class="form-control"\n id="a-codelist-max"\n placeholder="1"\n data-ng-model="current.max_responses"\n data-ng-disabled="!editMode"\n />\n </div>\n </div>\n\n <table class="table table-striped table-condensed">\n <tr>\n <th>ID</th>\n <th>Value</th>\n <th>Category</th>\n <th colspan="3" data-ng-show="editMode"></th>\n </tr>\n <tr data-ng-repeat="code in current.codes | orderBy:\'order\'" class="code">\n <td>\n {{code.id}}\n </td>\n <td>\n <input\n type="text"\n class="form-control code-value"\n placeholder="Value"\n data-ng-model="code.value"\n data-ng-disabled="!editMode"\n />\n </td>\n <td>\n <input\n type="text"\n class="form-control code-label"\n placeholder="Category"\n data-ng-model="code.label"\n data-ng-disabled="!editMode"\n data-uib-typeahead="category.label for category in categories | filter:$viewValue | orderBy:\'label\'"\n data-typeahead-show-hint="true"\n data-typeahead-min-length="2"\n autocomplete="off"\n />\n </td>\n <div class="btn-group" role="group">\n <td>\n <a\n class="btn btn-primary"\n data-ng-click="moveUp(code)"\n data-ng-show="editMode"\n tabindex="-1"\n >\n Up\n </a>\n <a\n class="btn btn-primary"\n data-ng-click="moveDown(code)"\n data-ng-show="editMode"\n tabindex="-1"\n >\n Down\n </a>\n <a\n class="btn btn-danger"\n data-ng-click="removeCode(code)"\n data-ng-show="editMode"\n tabindex="-1"\n >\n Remove\n </a>\n </td>\n </div>\n </tr>\n <tr>\n <td></td>\n <td>\n <input\n type="text"\n class="form-control"\n placeholder="Value"\n data-ng-model="current.newValue"\n data-ng-disabled="!editMode"\n />\n </td>\n <td>\n <input\n type="text"\n class="form-control"\n placeholder="Category"\n data-ng-model="newCategory"\n data-ng-disabled="!editMode"\n />\n </td>\n </tr>\n </table>\n</form>\n\n<div data-ng-if="!newMode">\n <h3 class="sub-header">\n Used by\n </h3>\n\n <table class="table table-striped table-condensed">\n <tr>\n <th>\n ID\n </th>\n <th>\n Type\n </th>\n <th>\n Label\n </th>\n </tr>\n <tr data-ng-repeat="obj in current.used_by">\n <td>\n {{obj.id}}\n </td>\n <td>\n {{obj.type}}\n </td>\n <td>\n {{obj.label}}\n </td>\n </tr>\n </table>\n</div>')
$templateCache.put("partials/build/code_lists.html", '<form novalidate>\n <div class="form-group">\n <label for="a-codelist-label">\n Label\n </label>\n <input\n type="text"\n class="form-control first-field"\n id="a-codelist-label"\n placeholder="Label"\n data-ng-model="current.label"\n data-ng-disabled="!editMode"\n />\n </div>\n\n <div class="checkbox">\n <label>\n <input\n type="checkbox"\n id="a-codelist-rd"\n data-ng-model="current.rd"\n data-ng-disabled="!editMode"\n />\n Response Domain\n </label>\n </div>\n <div data-ng-show="current.rd">\n <div class="form-group">\n <label for="a-codelist-min">\n Min Responses:\n </label>\n <input\n type="number"\n class="form-control"\n id="a-codelist-min"\n placeholder="1"\n data-ng-model="current.min_responses"\n data-ng-disabled="!editMode"\n />\n </div>\n <div class="form-group">\n <label for="a-codelist-max">\n Max Responses:\n </label>\n <input\n type="number"\n class="form-control"\n id="a-codelist-max"\n placeholder="1"\n data-ng-model="current.max_responses"\n data-ng-disabled="!editMode"\n />\n </div>\n </div>\n\n <table class="table table-striped table-condensed">\n <tr>\n <th>ID</th>\n <th>Value</th>\n <th>Category</th>\n <th colspan="3" data-ng-show="editMode"></th>\n </tr>\n <tr data-ng-repeat="code in current.codes | orderBy:\'order\'" class="code">\n <td>\n {{code.id}}\n </td>\n <td>\n <input\n type="text"\n class="form-control code-value"\n placeholder="Value"\n data-ng-model="code.value"\n data-ng-disabled="!editMode"\n />\n </td>\n <td>\n <input\n type="text"\n class="form-control code-label"\n placeholder="Category"\n data-ng-model="code.label"\n data-ng-disabled="!editMode"\n data-uib-typeahead="category.label for category in categories | filter:$viewValue | orderBy:\'label\'"\n data-typeahead-show-hint="true"\n data-typeahead-min-length="2"\n autocomplete="off"\n />\n </td>\n <div class="btn-group" role="group">\n <td>\n <a\n class="btn btn-primary"\n data-ng-click="moveUp(code)"\n data-ng-show="editMode"\n tabindex="-1"\n >\n Up\n </a>\n <a\n class="btn btn-primary"\n data-ng-click="moveDown(code)"\n data-ng-show="editMode"\n tabindex="-1"\n >\n Down\n </a>\n <a\n class="btn btn-danger"\n data-ng-click="removeCode(code)"\n data-ng-show="editMode"\n tabindex="-1"\n >\n Remove\n </a>\n </td>\n </div>\n </tr>\n <tr data-ng-if="editMode">\n <td></td>\n <td>\n <input\n type="text"\n class="form-control"\n placeholder="Value"\n data-ng-model="current.newValue"\n data-ng-disabled="!editMode"\n />\n </td>\n <td>\n <input\n type="text"\n class="form-control"\n placeholder="Category"\n data-ng-model="newCategory"\n data-ng-disabled="!editMode"\n />\n </td>\n </tr>\n </table>\n</form>\n\n<div data-ng-if="!newMode">\n <h3 class="sub-header">\n Used by\n </h3>\n\n <table class="table table-striped table-condensed">\n <tr>\n <th>\n ID\n </th>\n <th>\n Type\n </th>\n <th>\n Label\n </th>\n </tr>\n <tr data-ng-repeat="obj in current.used_by">\n <td>\n {{obj.id}}\n </td>\n <td>\n {{obj.type}}\n </td>\n <td>\n {{obj.label}}\n </td>\n </tr>\n </table>\n</div>')
}]);

// Angular Rails Template
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,9 @@
}
return results;
})()).sort_by_property();
DataManager.Data.Codes.Categories.$promise.then(function() {
return $scope.categories = DataManager.Data.Codes.Categories;
});
return $timeout(function() {
var offset;
offset = localStorage.getItem('sidebar_scroll');
Expand Down Expand Up @@ -1117,7 +1120,7 @@
return DataManager.groupResponseDomains();
});
}, function() {
return console.log("error");
return Flash.add('danger', 'Code list failed to update!');
});
return DataManager.Data.ResponseDomains[$routeParams.id] = null;
};
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@
}
return results;
})()).sort_by_property();
DataManager.Data.Codes.Categories.$promise.then(function() {
return $scope.categories = DataManager.Data.Codes.Categories;
});
return $timeout(function() {
var offset;
offset = localStorage.getItem('sidebar_scroll');
Expand Down Expand Up @@ -335,7 +338,7 @@
return DataManager.groupResponseDomains();
});
}, function() {
return console.log("error");
return Flash.add('danger', 'Code list failed to update!');
});
return DataManager.Data.ResponseDomains[$routeParams.id] = null;
};
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
}
return results;
})()).sort_by_property();
DataManager.Data.Codes.Categories.$promise.then(function() {
return $scope.categories = DataManager.Data.Codes.Categories;
});
return $timeout(function() {
var offset;
offset = localStorage.getItem('sidebar_scroll');
Expand Down Expand Up @@ -79,7 +82,7 @@
return DataManager.groupResponseDomains();
});
}, function() {
return console.log("error");
return Flash.add('danger', 'Code list failed to update!');
});
return DataManager.Data.ResponseDomains[$routeParams.id] = null;
};
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@
}
return results;
})()).sort_by_property();
DataManager.Data.Codes.Categories.$promise.then(function() {
return $scope.categories = DataManager.Data.Codes.Categories;
});
return $timeout(function() {
var offset;
offset = localStorage.getItem('sidebar_scroll');
Expand Down Expand Up @@ -206,7 +209,7 @@
return DataManager.groupResponseDomains();
});
}, function() {
return console.log("error");
return Flash.add('danger', 'Code list failed to update!');
});
return DataManager.Data.ResponseDomains[$routeParams.id] = null;
};
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@
}
return results;
})()).sort_by_property();
DataManager.Data.Codes.Categories.$promise.then(function() {
return $scope.categories = DataManager.Data.Codes.Categories;
});
return $timeout(function() {
var offset;
offset = localStorage.getItem('sidebar_scroll');
Expand Down Expand Up @@ -206,7 +209,7 @@
return DataManager.groupResponseDomains();
});
}, function() {
return console.log("error");
return Flash.add('danger', 'Code list failed to update!');
});
return DataManager.Data.ResponseDomains[$routeParams.id] = null;
};
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
</td>
</div>
</tr>
<tr>
<tr data-ng-if="editMode">
<td></td>
<td>
<input
Expand Down
Binary file not shown.

1 comment on commit 6205a9a

@spuddybike
Copy link
Member

Choose a reason for hiding this comment

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

@charlesdebarros is it possible to include the specific code list that failed to load in the message?

Please sign in to comment.