Allow supervisors to write a note associated with their projects #8

Merged
ansv7779 merged 10 commits from 3399-supervisor-project-note into develop 2024-07-10 13:43:27 +02:00
3 changed files with 5 additions and 3 deletions
Showing only changes of commit 9f583f9e7a - Show all commits

View File

@ -5,7 +5,7 @@
<div wicket:id="edit_note_modal"></div> <div wicket:id="edit_note_modal"></div>
<span wicket:id="shortened_note"></span> <span wicket:id="shortened_note"></span>
<wicket:container wicket:id="full_note"></wicket:container> <wicket:container wicket:id="full_note"></wicket:container>
<a wicket:id="view_note">[view/edit note]</a> <a wicket:id="view_note"><wicket:message key="note.view.edit"/></a>
</wicket:panel> </wicket:panel>
</body> </body>
</html> </html>

View File

@ -0,0 +1,2 @@
note.modal.title=View/edit note for ${title}
note.view.edit=View/edit note

View File

@ -16,6 +16,7 @@ import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.model.IModel; import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel; import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.Model; import org.apache.wicket.model.Model;
import org.apache.wicket.model.StringResourceModel;
import se.su.dsv.scipro.components.LargeModalWindow; import se.su.dsv.scipro.components.LargeModalWindow;
import se.su.dsv.scipro.components.MaxLengthLabel; import se.su.dsv.scipro.components.MaxLengthLabel;
import se.su.dsv.scipro.components.ModalWindowPlus; import se.su.dsv.scipro.components.ModalWindowPlus;
@ -63,7 +64,7 @@ public class ProjectNoteColumn extends AbstractExportableColumn<Project, String>
super(id, model); super(id, model);
ansv7779 marked this conversation as resolved
Review

Use of String.format could work here?
Example
modal.setTitle(model.map(Project::getTitle).map(projectTitle -> String.format("View/Edit note for %s", projectTitle)));

What do you think?

Use of String.format could work here? Example ```modal.setTitle(model.map(Project::getTitle).map(projectTitle -> String.format("View/Edit note for %s", projectTitle)));``` What do you think?
Review

Replaced with proper i18n

Replaced with proper i18n
ModalWindowPlus modal = new LargeModalWindow("edit_note_modal"); ModalWindowPlus modal = new LargeModalWindow("edit_note_modal");
modal.setTitle(model.map(Project::getTitle).map(projectTitle -> "View/Edit note for " + projectTitle)); modal.setTitle(new StringResourceModel("note.modal.title", this, model));
modal.setContent(componentId -> new ViewAndEditNoteForm(componentId, model)); modal.setContent(componentId -> new ViewAndEditNoteForm(componentId, model));
add(modal); add(modal);
@ -91,7 +92,6 @@ public class ProjectNoteColumn extends AbstractExportableColumn<Project, String>
modal.show(target); modal.show(target);
} }
}; };
noteLink.setBody(Model.of("View/Edit note"));
add(noteLink); add(noteLink);
} }
} }