Skip to content

Commit

Permalink
Merge pull request #386 from rdmorganiser/fix_values_in_project_quest…
Browse files Browse the repository at this point in the history
…ions

Resolve addtional values in project_questions
  • Loading branch information
jochenklar committed Oct 8, 2021
2 parents 332bedb + 5c6898e commit e4a018d
Show file tree
Hide file tree
Showing 15 changed files with 480 additions and 384 deletions.
Binary file modified rdmo/locale/de/LC_MESSAGES/django.mo
Binary file not shown.
837 changes: 455 additions & 382 deletions rdmo/locale/de/LC_MESSAGES/django.po

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ angular.module('project_questions')
future.values[question.attribute][valueset.set_prefix][valueset.set_index] = service.initCheckbox(question, future.values[question.attribute][valueset.set_prefix][valueset.set_index]);
}

// init the widget for every value
angular.forEach(future.values[question.attribute][valueset.set_prefix][valueset.set_index], function(value) {
service.initWidget(question, value);
});
Expand Down Expand Up @@ -1342,6 +1343,12 @@ angular.module('project_questions')
}
}

service.visibleValues = function(attribute, set_prefix, set_index) {
return $filter('filter')(service.values[attribute][set_prefix][set_index], function(value) {
return (angular.isUndefined(value.removed) || !value.removed)
});
}

return service;

}]);
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<div class="form-group" ng-if="question.widget_type === 'autocomplete'">
{% include 'projects/project_questions_question_label.html' %}
{% include 'projects/project_questions_question_help.html' %}
{% include 'projects/project_questions_question_warning.html' %}

<div ng-if="question.is_collection">
{% include 'projects/project_questions_add_field_help.html' %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<div class="form-group" ng-if="question.widget_type === 'checkbox'">
{% include 'projects/project_questions_question_label.html' %}
{% include 'projects/project_questions_question_help.html' %}
{% include 'projects/project_questions_question_warning.html' %}

<div class="checkbox-control">
<div class="checkbox" ng-repeat="option in question.options" ng-hide="valueset.hidden.optionsets[option.optionset]">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<div class="form-group" ng-if="question.widget_type === 'date'">
{% include 'projects/project_questions_question_label.html' %}
{% include 'projects/project_questions_question_help.html' %}
{% include 'projects/project_questions_question_warning.html' %}

<div ng-if="question.is_collection">
{% include 'projects/project_questions_add_field_help.html' %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<div class="form-group" ng-if="question.widget_type === 'file'">
{% include 'projects/project_questions_question_label.html' %}
{% include 'projects/project_questions_question_help.html' %}
{% include 'projects/project_questions_question_warning.html' %}

<div ng-if="question.is_collection">
{% include 'projects/project_questions_add_field_help.html' %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<div class="form-group" ng-if="question.widget_type === 'radio'">
{% include 'projects/project_questions_question_label.html' %}
{% include 'projects/project_questions_question_help.html' %}
{% include 'projects/project_questions_question_warning.html' %}

<div ng-if="question.is_collection">
{% include 'projects/project_questions_add_field_help.html' %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<div class="form-group" ng-if="question.widget_type === 'range'">
{% include 'projects/project_questions_question_label.html' %}
{% include 'projects/project_questions_question_help.html' %}
{% include 'projects/project_questions_question_warning.html' %}

<div ng-if="question.is_collection">
{% include 'projects/project_questions_add_field_help.html' %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<div class="form-group" ng-if="question.widget_type === 'select'">
{% include 'projects/project_questions_question_label.html' %}
{% include 'projects/project_questions_question_help.html' %}
{% include 'projects/project_questions_question_warning.html' %}

<div ng-if="question.is_collection">
{% include 'projects/project_questions_add_field_help.html' %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<div class="form-group" ng-if="question.widget_type === 'text'">
{% include 'projects/project_questions_question_label.html' %}
{% include 'projects/project_questions_question_help.html' %}
{% include 'projects/project_questions_question_warning.html' %}

<div ng-if="question.is_collection">
{% include 'projects/project_questions_add_field_help.html' %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<div class="form-group" ng-if="question.widget_type === 'textarea'">
{% include 'projects/project_questions_question_label.html' %}
{% include 'projects/project_questions_question_help.html' %}
{% include 'projects/project_questions_question_warning.html' %}

<div ng-if="question.is_collection">
{% include 'projects/project_questions_add_field_help.html' %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<div class="form-group" ng-if="question.widget_type === 'yesno'">
{% include 'projects/project_questions_question_label.html' %}
{% include 'projects/project_questions_question_help.html' %}
{% include 'projects/project_questions_question_warning.html' %}

<div ng-if="question.is_collection">
{% include 'projects/project_questions_add_field_help.html' %}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% load i18n %}

<p class="text-warning"
ng-show="!question.is_collection && service.visibleValues(question.attribute, valueset.set_prefix, valueset.set_index).length > 1">
{% trans 'Warning: Multiple answers exist in the database. This can happen due some technical problem in the past. You can remove unwanted answers using the "Remove item" field (<i class="fa fa-times"></i>). Please contact support if the problem persists.' %}
</p>
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{% load i18n %}

<a href="" class="close" tabindex="-1" ng-if="question.is_collection"
<a href="" class="close" tabindex="-1"
title="{% blocktrans with name='{$ question.verbose_name $}' %}Remove {{ name }}{% endblocktrans %}"
ng-click="service.removeValue(question.attribute, valueset.set_prefix, valueset.set_index, $index)"
ng-hide="!question.is_collection || service.project.read_only">
ng-show="(question.is_collection || service.visibleValues(question.attribute, valueset.set_prefix, valueset.set_index).length > 1) && !service.project.read_only">

<i class="fa fa-times" aria-hidden="true"></i>
</a>

0 comments on commit e4a018d

Please sign in to comment.