datarockets / rails-views

MIT License
7 stars 0 forks source link

Render Collection with index #11

Open roman-dubrovsky opened 7 years ago

roman-dubrovsky commented 7 years ago

= concept("welcome/top_participant/cell", collection: top5_users_game_sessions)

Also need to add the element index in the collection

DDKatch commented 5 years ago

@roman-dubrovsky now we can go with smth like this: TableForSmthCell view part:

- collection.each_with_index do |element, index|
  = concept('welcome/top_participant/cell', element: {element, index})
- end

and we can archive the same functionality.

roman-dubrovsky commented 5 years ago

@DDKatch heh, I don't remember anything about this issue 😕

AleksSenkou commented 5 years ago

Sounds reasonable thing to have for me.

We can go with:

= concept("welcome/top_participant/cell", collection: top5_users_game_sessions, index: true)

And mark index as false by default

Thoughts?

DDKatch commented 5 years ago

@AleksSenkou I thought that according to namespace 'welcome/top_participant/cell' it should represent single model for each element from collection. But even if it's for collection, what view we should use for a single one?

AleksSenkou commented 5 years ago

@DDKatch yeah, it represents single model for each element from collection

AleksSenkou commented 5 years ago

@DDKatch please, leave here a summary of yesterday's discussion

DDKatch commented 5 years ago

@AleksSenkou I got your point that it's more convenient to use separate logic for that.