| 251 | } |
| 252 | |
| 253 | func (l *loader) loadView(controllerKey, actionKey, actionRoute string) *View { |
| 254 | viewDir := path.Join("view", controllerKey) |
| 255 | des, err := fs.ReadDir(l.fsys, viewDir) |
| 256 | if err != nil { |
| 257 | if errors.Is(err, fs.ErrNotExist) { |
| 258 | return nil |
| 259 | } |
| 260 | l.Bail(fmt.Errorf("controller: unable read view directory %q . %w", viewDir, err)) |
| 261 | } |
| 262 | for _, de := range des { |
| 263 | name := de.Name() |
| 264 | ext := path.Ext(name) |
| 265 | if ext != ".svelte" { |
| 266 | continue |
| 267 | } |
| 268 | base := strings.TrimSuffix(path.Base(name), ext) |
| 269 | key := path.Base(actionKey) |
| 270 | if base != key { |
| 271 | continue |
| 272 | } |
| 273 | l.imports.Add(l.module.Import("bud/internal/web/view")) |
| 274 | return &View{ |
| 275 | Route: actionRoute, |
| 276 | } |
| 277 | } |
| 278 | return nil |
| 279 | } |
| 280 | |
| 281 | func (l *loader) loadActionParams(params []*parser.Param) (inputs []*ActionParam) { |
| 282 | numParams := len(params) |