LPM-81: Assign to me

This commit is contained in:
Ine Maria Nilssen Aanonsen
2026-03-17 15:47:40 +01:00
parent 9f85b1e6f8
commit 6f452a5f9e
2 changed files with 28 additions and 8 deletions

View File

@@ -12,12 +12,27 @@ templ AssigneeForm(props AssigneeFormProps) {
hx-patch={ props.PatchAction } hx-patch={ props.PatchAction }
hx-swap="innerHTML" hx-swap="innerHTML"
> >
@base.Input(base.InputProps{ <div class="form-control">
Name: "assignee", <label class="label cursor-pointer justify-start gap-2">
Type: "text", <input
Placeholder: "Enter assingee", type="checkbox"
Value: props.Assignee, name="assign_me"
}) value="me"
<button class="btn btn-primary mt-2" type="submit">Set Assignee</button> class="checkbox checkbox-primary"
if props.Assignee == "Me" {
checked
}
/>
<span class="label-text">Assign this issue to me</span>
</label>
if props.Assignee != "" {
<p class="text-xs mt-1 opacity-70">
Current assignee: { props.Assignee }
</p>
}
</div>
<button class="btn btn-primary mt-4" type="submit">
Update Assignee
</button>
</form> </form>
} }

View File

@@ -196,7 +196,12 @@ func UpdateIssue(w http.ResponseWriter, r *http.Request) {
func UpdateAssignee(w http.ResponseWriter, r *http.Request) { func UpdateAssignee(w http.ResponseWriter, r *http.Request) {
issue := r.Context().Value(issueKey).(*models.Issue) issue := r.Context().Value(issueKey).(*models.Issue)
assignee := r.FormValue("assignee") assignMe := r.FormValue("assign_me")
assignee := ""
if assignMe != "" {
assignee = "Me"
}
if err := App(r).Issues.UpdateIssue(r.Context(), issue.ID, map[string]any{"assignee": assignee}, ""); err != nil { if err := App(r).Issues.UpdateIssue(r.Context(), issue.ID, map[string]any{"assignee": assignee}, ""); err != nil {
http.Error(w, "Failed to update assignee", http.StatusInternalServerError) http.Error(w, "Failed to update assignee", http.StatusInternalServerError)