summaryrefslogtreecommitdiff
path: root/src/ui/ui_projects.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/ui_projects.cpp')
-rw-r--r--src/ui/ui_projects.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/ui/ui_projects.cpp b/src/ui/ui_projects.cpp
index dddf881..37cf5d8 100644
--- a/src/ui/ui_projects.cpp
+++ b/src/ui/ui_projects.cpp
@@ -35,8 +35,10 @@ void ui_setup_projects()
static void draw_project_form()
{
+ float widthAvailable = ImGui::GetContentRegionAvail().x;
+ bool viewing_only = (current_view_state == view_state::VIEW);
static const char* selected_country = NULL;
-
+
if (ImGui::Button(localize("form.back"))) {
current_view_state = view_state::LIST;
active_project = administration_project_create_empty();
@@ -44,20 +46,15 @@ static void draw_project_form()
return;
}
ImGui::Spacing();
-
- bool viewing_only = (current_view_state == view_state::VIEW);
-
ImGui::BeginDisabled();
-
- float widthAvailable = ImGui::GetContentRegionAvail().x;
+
+ a_err last_err = administration_project_is_valid(active_project);
ImGui::SetNextItemWidth(widthAvailable*0.2f);
ImGui::InputText(localize("project.form.identifier"), active_project.id, IM_ARRAYSIZE(active_project.id));
if (!viewing_only) ImGui::EndDisabled();
-
- ImGui::SetNextItemWidth(widthAvailable*0.5f);
- ImGui::InputTextWithHint(localize("project.form.description"), localize("project.form.description"), active_project.description, IM_ARRAYSIZE(active_project.description));
- ImGui::SameLine();ui_helper_draw_required_tag();
+
+ ImGui::FormInputTextWithErrorHint(localize("project.form.description"), &active_project, active_project.description, IM_ARRAYSIZE(active_project.description), last_err & A_ERR_MISSING_DESCRIPTION);
if (viewing_only) ImGui::EndDisabled();