Rename the variable 't' used for our TableBuilder views

Aperta
#1,713 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
71/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
html, internationalization, rails, ruby

Direzione di ricerca

Search the view code for TableBuilder blocks using do |t| and calls to t.column; first inspect the ERB example in the issue and distinguish the table handle from the I18N translation helper. Rename only the dynamic table handle consistently (for example, to dt) throughout the affected views. Done when those handles no longer conflict with translation calls.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Priority: Normal Refactoring

In our ERB view code, we often use a custom TableBuilder framework designed by Tarek and Nicolas a long time ago.

The ERB code contains things like this:

<%=
  dynamic_scoped_table(@sites,
    :id    => 'sites_table',
    :class => [ :resource_list ],
    :scope => @scope
  ) do |t|
%>
  <%
    t.column(t('.columns.name'), :name,
      :sortable => true,
    ) { |s| link_to_site_if_accessible(s) }

    t.column(t('.columns.description'), :description,
      :sortable => true,
    ) { |s| overlay_description(s.description) }
(etc etc)

The problem is that the variable used to carry around the dynamic table object is just called 't' (see the 6th line that says do |t| and t is also the name of the I18N translation helper.

We can immediately see the confusion that this can cause at this line:

t.column(t('.columns.name'), :name, etc etc

where the two t mean completely different things.

This issue is to go through the view code and replace the dynamic table helper handle name everywhere, so that it is called 'dt' or 'dynt' instead of just 't'.

Problem identified by Hugues.

Lingua principale
Ruby
Stelle
82
Fork
64
Merge medio
6g 13h
PR unite (30g)
36

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di aces/cbrain

Tutte le issue di aces/cbrain

Issue simili

Altre issue su Ruby

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.