feat: pull request generation
This commit is contained in:
51
internal/http/handler/webui/common/component/app_page.templ
Normal file
51
internal/http/handler/webui/common/component/app_page.templ
Normal file
@ -0,0 +1,51 @@
|
||||
package component
|
||||
|
||||
type AppPageOptions struct {
|
||||
PageOptions []PageOptionFunc
|
||||
}
|
||||
|
||||
type AppPageOptionFunc func(opts *AppPageOptions)
|
||||
|
||||
func WithPageOptions(funcs ...PageOptionFunc) AppPageOptionFunc {
|
||||
return func(opts *AppPageOptions) {
|
||||
opts.PageOptions = funcs
|
||||
}
|
||||
}
|
||||
|
||||
func NewAppPageOptions(funcs ...AppPageOptionFunc) *AppPageOptions {
|
||||
opts := &AppPageOptions{
|
||||
PageOptions: make([]PageOptionFunc, 0),
|
||||
}
|
||||
for _, fn := range funcs {
|
||||
fn(opts)
|
||||
}
|
||||
return opts
|
||||
}
|
||||
|
||||
templ AppPage(funcs ...AppPageOptionFunc) {
|
||||
{{ opts := NewAppPageOptions(funcs...) }}
|
||||
@Page(opts.PageOptions...) {
|
||||
<div class="container is-fluid">
|
||||
<section class="section">
|
||||
<div class="level is-mobile">
|
||||
<div class="level-left">
|
||||
<h1 class="title is-size-1"><span class="has-text-info-light">Clear</span><span>Case</span></h1>
|
||||
</div>
|
||||
<div class="level-right">
|
||||
<div class="buttons is-right level-item">
|
||||
<a class="button is-medium" href={ BaseURL(ctx, WithPath("/auth/logout")) }><span class="icon"><i class="fa fa-sign-out-alt"></i></span></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tabs is-large is-fullwidth is-boxed">
|
||||
<ul>
|
||||
<li class={ templ.KV("is-active", MatchPath(ctx, "/issue/")) }><a href={ BaseURL(ctx, WithPath("/issue")) }><span class="icon"><i class="fa fa-plus"></i></span>Nouvelle demande</a></li>
|
||||
// <li><a href={ BaseURL(ctx, WithPath("/issue")) }><span class="icon"><i class="fa fa-edit"></i></span>Éditer une demande</a></li>
|
||||
<li class={ templ.KV("is-active", MatchPath(ctx, "/pullrequest/")) }><a href={ CurrentURL(ctx, WithPath("/pullrequest")) }><span class="icon"><i class="fas fa-code-branch"></i></span>Éditer une PR</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
{ children... }
|
||||
</section>
|
||||
</div>
|
||||
}
|
||||
}
|
160
internal/http/handler/webui/common/component/app_page_templ.go
Normal file
160
internal/http/handler/webui/common/component/app_page_templ.go
Normal file
@ -0,0 +1,160 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.3.819
|
||||
package component
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
import templruntime "github.com/a-h/templ/runtime"
|
||||
|
||||
type AppPageOptions struct {
|
||||
PageOptions []PageOptionFunc
|
||||
}
|
||||
|
||||
type AppPageOptionFunc func(opts *AppPageOptions)
|
||||
|
||||
func WithPageOptions(funcs ...PageOptionFunc) AppPageOptionFunc {
|
||||
return func(opts *AppPageOptions) {
|
||||
opts.PageOptions = funcs
|
||||
}
|
||||
}
|
||||
|
||||
func NewAppPageOptions(funcs ...AppPageOptionFunc) *AppPageOptions {
|
||||
opts := &AppPageOptions{
|
||||
PageOptions: make([]PageOptionFunc, 0),
|
||||
}
|
||||
for _, fn := range funcs {
|
||||
fn(opts)
|
||||
}
|
||||
return opts
|
||||
}
|
||||
|
||||
func AppPage(funcs ...AppPageOptionFunc) templ.Component {
|
||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
||||
return templ_7745c5c3_CtxErr
|
||||
}
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var1 == nil {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
opts := NewAppPageOptions(funcs...)
|
||||
templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div class=\"container is-fluid\"><section class=\"section\"><div class=\"level is-mobile\"><div class=\"level-left\"><h1 class=\"title is-size-1\"><span class=\"has-text-info-light\">Clear</span><span>Case</span></h1></div><div class=\"level-right\"><div class=\"buttons is-right level-item\"><a class=\"button is-medium\" href=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var3 templ.SafeURL = BaseURL(ctx, WithPath("/auth/logout"))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var3)))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "\"><span class=\"icon\"><i class=\"fa fa-sign-out-alt\"></i></span></a></div></div></div><div class=\"tabs is-large is-fullwidth is-boxed\"><ul>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var4 = []any{templ.KV("is-active", MatchPath(ctx, "/issue/"))}
|
||||
templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var4...)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "<li class=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var5 string
|
||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(templ.CSSClasses(templ_7745c5c3_Var4).String())
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/http/handler/webui/common/component/app_page.templ`, Line: 1, Col: 0}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "\"><a href=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var6 templ.SafeURL = BaseURL(ctx, WithPath("/issue"))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var6)))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "\"><span class=\"icon\"><i class=\"fa fa-plus\"></i></span>Nouvelle demande</a></li>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var7 = []any{templ.KV("is-active", MatchPath(ctx, "/pullrequest/"))}
|
||||
templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var7...)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "<li class=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var8 string
|
||||
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(templ.CSSClasses(templ_7745c5c3_Var7).String())
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/http/handler/webui/common/component/app_page.templ`, Line: 1, Col: 0}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "\"><a href=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var9 templ.SafeURL = CurrentURL(ctx, WithPath("/pullrequest"))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var9)))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "\"><span class=\"icon\"><i class=\"fas fa-code-branch\"></i></span>Éditer une PR</a></li></ul></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templ_7745c5c3_Var1.Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "</section></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
templ_7745c5c3_Err = Page(opts.PageOptions...).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
var _ = templruntime.GeneratedTemplate
|
Reference in New Issue
Block a user