code-corps / code-corps/code-corps-ember

Discussion: Reconsider the route/template structure for donate and thank-you

Ouverte
#1,122 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
Difficulty: Medium
Langage dominant
JavaScript
Étoiles
120
Forks
75
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

# Problem

Right now, our route structure is as follows:

```
project.hbs
project/
index.hbs
settings.hbs
tasks.hbs
donate.hbs
thank-you.
```

`project.hbs` is just an `{{outlet}}`. `index`, `settings` and `tasks` share most of the same layout, but the code needs to be duplicated because `donate` and `thank-you` have a completely different layout.

This is somewhat confusing by itself. An additional, unfortunate side-effect is that the `index`, `settings` and `tasks` share the same `project-details` component, which internally, defines a `joinProject`action. This action can't be handled at route level, because it's used in 3 different routes. Instead, right now, it's handled by the component internally.

I'm really not sure what the best architecture here is, but it doesn't feel right. I think `project.hbs` should have the outlet for the varying content, but it should also have the default project layout components such as the header, etc. The subroutes should either share the layout or not be subroutes, or we should find a third way to render it.

That means that our options are either:

- `donate` and `thank-you` should not be part of the project route structure.
- `donate` and `thank-you` can be part of the project route structure, but should then share the project layout
- we should add a named outlet to our application route. "Layoutless" routes such as `donate` and `thank-you` should render directly into this named outlet. This gives us an explicit way to specify a route as layoutless. We could use the route's [`renderTemplate` hook](http://emberjs.com/api/classes/Ember.Route.html#method_renderTemplate) to achieve this behavior

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Examinez la structure indiquée de project.hbs et de project/{index,settings,tasks,donate,thank-you}.hbs, en vous concentrant sur le layout dupliqué et sur l’action joinProject du composant project-details. Lisez la documentation du hook renderTemplate d’Ember et comparez les trois options de routing de l’issue. Le travail est terminé lorsqu’une structure de routes/layout est sélectionnée et documentée, qu’elle évite le code de layout dupliqué et qu’elle attribue clairement la responsabilité de l’action.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
javascript
Domaine
frontend
Type d'issue
Refactorisation
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
20/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.