Require authors to fill in background, literature, problem, method, and interests when submitting ideas #72

Merged
niat8586 merged 7 commits from student-idea-form-required-fields into develop 2025-01-17 09:45:28 +01:00
3 changed files with 26 additions and 31 deletions
Showing only changes of commit 5ca13d5d32 - Show all commits

View File

@ -172,6 +172,11 @@ public class DataInitializer implements Lifecycle {
stina_student = createStudent(STUDENT_2); stina_student = createStudent(STUDENT_2);
sid_student = createStudent(STUDENT_3); sid_student = createStudent(STUDENT_3);
simon_student = createStudent(STUDENT_4); simon_student = createStudent(STUDENT_4);
// Used to test submitting ideas
// can not be used as author on any idea
// can not be used as author on any project
createStudent("Stig");
} }
private User createStudent(String firstName) { private User createStudent(String firstName) {

View File

@ -8,6 +8,7 @@
<wicket:panel> <wicket:panel>
<div class="mb-3"> <div class="mb-3">
<label class="col-form-label" wicket:for="background">Background</label> <label class="col-form-label" wicket:for="background">Background</label>
<div wicket:id="background_feedback"></div>
<textarea wicket:id="background" class="form-control" rows="4"></textarea> <textarea wicket:id="background" class="form-control" rows="4"></textarea>
<small class="form-text text-body-secondary"> <small class="form-text text-body-secondary">
Describe the background of your topic, preferably both theoretical, empirical and/or practical. Describe the background of your topic, preferably both theoretical, empirical and/or practical.
@ -16,6 +17,7 @@
<div class="mb-3"> <div class="mb-3">
<label class="col-form-label" wicket:for="literature">Literature</label> <label class="col-form-label" wicket:for="literature">Literature</label>
<div wicket:id="literature_feedback"></div>
<textarea wicket:id="literature" class="form-control" rows="4"></textarea> <textarea wicket:id="literature" class="form-control" rows="4"></textarea>
<small class="form-text text-body-secondary"> <small class="form-text text-body-secondary">
Describe the connection to your background, for example literature, theory and methodology related to the topic, courses that you have taken that relates to the topic. Describe the connection to your background, for example literature, theory and methodology related to the topic, courses that you have taken that relates to the topic.
@ -24,6 +26,7 @@
<div class="mb-3"> <div class="mb-3">
<label class="col-form-label" wicket:for="problem">Problem</label> <label class="col-form-label" wicket:for="problem">Problem</label>
<div wicket:id="problem_feedback"></div>
<textarea wicket:id="problem" class="form-control" rows="4"></textarea> <textarea wicket:id="problem" class="form-control" rows="4"></textarea>
<small class="form-text text-body-secondary"> <small class="form-text text-body-secondary">
Here you describe the problem you want to address and solve by your work, preferably formulated as a research question. Here you describe the problem you want to address and solve by your work, preferably formulated as a research question.
@ -32,6 +35,7 @@
<div class="mb-3"> <div class="mb-3">
<label class="col-form-label" wicket:for="method">Method</label> <label class="col-form-label" wicket:for="method">Method</label>
<div wicket:id="method_feedback"></div>
<textarea wicket:id="method" class="form-control" rows="4"></textarea> <textarea wicket:id="method" class="form-control" rows="4"></textarea>
<small class="form-text text-body-secondary"> <small class="form-text text-body-secondary">
The method you plan to use in order to solve the problem and answer the research question. The method you plan to use in order to solve the problem and answer the research question.
@ -40,6 +44,7 @@
<div class="mb-3"> <div class="mb-3">
<label class="col-form-label" wicket:for="interests">My interests</label> <label class="col-form-label" wicket:for="interests">My interests</label>
<div wicket:id="interests_feedback"></div>
<textarea wicket:id="interests" class="form-control" rows="4"></textarea> <textarea wicket:id="interests" class="form-control" rows="4"></textarea>
<small class="form-text text-body-secondary"> <small class="form-text text-body-secondary">
Please note that when you propose your own topic, it is not guaranteed that your topic will be approved. In that case, you will be assigned a different topic by your supervisor. Specify which topics of interest you have, relating to the research fields or the courses that you have taken at DSV. Please note that when you propose your own topic, it is not guaranteed that your topic will be approved. In that case, you will be assigned a different topic by your supervisor. Specify which topics of interest you have, relating to the research fields or the courses that you have taken at DSV.

View File

@ -1,6 +1,7 @@
package se.su.dsv.scipro.match; package se.su.dsv.scipro.match;
import org.apache.wicket.markup.html.form.TextArea; import org.apache.wicket.markup.html.form.TextArea;
import org.apache.wicket.markup.html.panel.ComponentFeedbackPanel;
import org.apache.wicket.markup.html.panel.Panel; import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel; import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LambdaModel; import org.apache.wicket.model.LambdaModel;
@ -12,36 +13,20 @@ public class IdeaTholanderCompletionPanel extends Panel {
super(id, model); super(id, model);
final IModel<TholanderBox> tholanderBox = model.map(Idea::getTholanderBox); final IModel<TholanderBox> tholanderBox = model.map(Idea::getTholanderBox);
final StringValidator lengthValidator = StringValidator.maximumLength(TholanderBox.MAX_CHARS); textField("background", LambdaModel.of(tholanderBox, TholanderBox::getBackground, TholanderBox::setBackground));
add( textField("literature", LambdaModel.of(tholanderBox, TholanderBox::getLiterature, TholanderBox::setLiterature));
new TextArea<>( textField("problem", LambdaModel.of(tholanderBox, TholanderBox::getProblem, TholanderBox::setProblem));
"background", textField("method", LambdaModel.of(tholanderBox, TholanderBox::getMethod, TholanderBox::setMethod));
LambdaModel.of(tholanderBox, TholanderBox::getBackground, TholanderBox::setBackground) textField("interests", LambdaModel.of(tholanderBox, TholanderBox::getInterests, TholanderBox::setInterests));
).add(lengthValidator) }
);
add( private void textField(String id, IModel<String> model) {
new TextArea<>( TextArea<String> textArea = new TextArea<>(id, model);
"literature", textArea.add(StringValidator.maximumLength(TholanderBox.MAX_CHARS));
LambdaModel.of(tholanderBox, TholanderBox::getLiterature, TholanderBox::setLiterature) textArea.setRequired(true);
).add(lengthValidator) add(textArea);
);
add( ComponentFeedbackPanel feedback = new ComponentFeedbackPanel(id + "_feedback", textArea);
new TextArea<>( add(feedback);
"problem",
LambdaModel.of(tholanderBox, TholanderBox::getProblem, TholanderBox::setProblem)
).add(lengthValidator)
);
add(
new TextArea<>(
"method",
LambdaModel.of(tholanderBox, TholanderBox::getMethod, TholanderBox::setMethod)
).add(lengthValidator)
);
add(
new TextArea<>(
"interests",
LambdaModel.of(tholanderBox, TholanderBox::getInterests, TholanderBox::setInterests)
).add(lengthValidator)
);
} }
} }