Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HARMONY
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Amel Abdic
HARMONY
Commits
70f39b5d
Commit
70f39b5d
authored
1 year ago
by
jensilo
Browse files
Options
Downloads
Patches
Plain Diff
make all templates visible upon opening search modal
parent
fe0476b9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/app/eiffel/web.go
+17
-9
17 additions, 9 deletions
src/app/eiffel/web.go
templates/eiffel/_modal-template-search.go.html
+9
-5
9 additions, 5 deletions
templates/eiffel/_modal-template-search.go.html
with
26 additions
and
14 deletions
src/app/eiffel/web.go
+
17
−
9
View file @
70f39b5d
...
@@ -67,7 +67,8 @@ type TemplateFormData struct {
...
@@ -67,7 +67,8 @@ type TemplateFormData struct {
// SearchTemplateData contains templates to render as search results and a flag indicating if the query was too short.
// SearchTemplateData contains templates to render as search results and a flag indicating if the query was too short.
type
SearchTemplateData
struct
{
type
SearchTemplateData
struct
{
Templates
[]
*
template
.
Template
Templates
[]
*
template
.
Template
// Deprecated this is expected to be unnecessary with the current implementation of EIFFEL
QueryTooShort
bool
QueryTooShort
bool
}
}
...
@@ -181,8 +182,21 @@ func renderElicitationPage(io web.IO, data TemplateFormData, success []string, e
...
@@ -181,8 +182,21 @@ func renderElicitationPage(io web.IO, data TemplateFormData, success []string, e
}
}
func
searchModal
(
appCtx
*
hctx
.
AppCtx
,
webCtx
*
web
.
Ctx
)
http
.
Handler
{
func
searchModal
(
appCtx
*
hctx
.
AppCtx
,
webCtx
*
web
.
Ctx
)
http
.
Handler
{
templateRepository
:=
util
.
UnwrapType
[
template
.
Repository
](
appCtx
.
Repository
(
template
.
RepositoryName
))
return
web
.
NewController
(
appCtx
,
webCtx
,
func
(
io
web
.
IO
)
error
{
return
web
.
NewController
(
appCtx
,
webCtx
,
func
(
io
web
.
IO
)
error
{
return
io
.
Render
(
nil
,
"eiffel.template.search.modal"
,
"eiffel/_modal-template-search.go.html"
)
ctx
:=
io
.
Context
()
templates
,
err
:=
templateRepository
.
FindByQueryForTypeAndUser
(
ctx
,
""
,
BasicTemplateType
,
user
.
MustCtxUser
(
ctx
))
if
err
!=
nil
&&
!
errors
.
Is
(
err
,
persistence
.
ErrNotFound
)
{
return
io
.
InlineError
(
web
.
ErrInternal
,
err
)
}
return
io
.
Render
(
&
SearchTemplateData
{
Templates
:
templates
},
"eiffel.template.search.modal"
,
"eiffel/_modal-template-search.go.html"
,
"eiffel/_template-search-result.go.html"
,
)
})
})
}
}
...
@@ -197,13 +211,7 @@ func searchTemplate(appCtx *hctx.AppCtx, webCtx *web.Ctx) http.Handler {
...
@@ -197,13 +211,7 @@ func searchTemplate(appCtx *hctx.AppCtx, webCtx *web.Ctx) http.Handler {
}
}
query
:=
request
.
FormValue
(
"search"
)
query
:=
request
.
FormValue
(
"search"
)
if
len
(
query
)
<
3
{
// query too short was removed as it is expected to be unnecessary
return
io
.
Render
(
&
SearchTemplateData
{
QueryTooShort
:
true
},
"eiffel.template.search.result"
,
"eiffel/_template-search-result.go.html"
,
)
}
ctx
:=
io
.
Context
()
ctx
:=
io
.
Context
()
templates
,
err
:=
templateRepository
.
FindByQueryForTypeAndUser
(
ctx
,
query
,
BasicTemplateType
,
user
.
MustCtxUser
(
ctx
))
templates
,
err
:=
templateRepository
.
FindByQueryForTypeAndUser
(
ctx
,
query
,
BasicTemplateType
,
user
.
MustCtxUser
(
ctx
))
...
...
This diff is collapsed.
Click to expand it.
templates/eiffel/_modal-template-search.go.html
+
9
−
5
View file @
70f39b5d
{{ define "eiffel.template.search.modal" }}
{{ define "eiffel.template.search.modal" }}
<div
class=
"modal-dialog modal-lg"
>
<div
class=
"modal-dialog
modal-dialog-scrollable
modal-lg"
>
<div
class=
"modal-content"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<div
class=
"modal-header"
>
<h1
class=
"modal-title fs-5"
id=
"eiffelTemplateSearchLabel"
>
{{ t "eiffel.elicitation.template.search.title" }}
</h1>
<h1
class=
"modal-title fs-5"
id=
"eiffelTemplateSearchLabel"
>
{{ t "eiffel.elicitation.template.search.title" }}
</h1>
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
<div
class=
"modal-body"
>
<div
class=
"modal-body"
>
<div
class=
"mb-3"
>
<div
class=
"mb-3"
>
<input
id=
"eiffelTemplateSearchInput"
<input
id=
"eiffelTemplateSearchInput"
name=
"search"
type=
"search"
class=
"form-control"
name=
"search"
type=
"search"
class=
"form-control
border-dark-subtle
"
hx-post=
"/eiffel/elicitation/templates/search"
hx-post=
"/eiffel/elicitation/templates/search"
hx-trigger=
"input changed delay:300ms, search"
hx-trigger=
"input changed delay:300ms, search"
hx-target=
"#eiffelTemplateSearchResults"
hx-target=
"#eiffelTemplateSearchResults"
...
@@ -26,9 +26,13 @@
...
@@ -26,9 +26,13 @@
</tr>
</tr>
</thead>
</thead>
<tbody
id=
"eiffelTemplateSearchResults"
>
<tbody
id=
"eiffelTemplateSearchResults"
>
<tr>
{{ if not .Data.Templates }}
<td
class=
"text-center"
colspan=
"4"
>
{{ t "eiffel.elicitation.template.search.start" }}
</td>
<tr>
</tr>
<td
class=
"text-center"
colspan=
"4"
>
{{ t "eiffel.elicitation.template.search.start" }}
</td>
</tr>
{{ else }}
{{ template "eiffel.template.search.result" . }}
{{ end }}
</tbody>
</tbody>
</table>
</table>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment