Use local variables in user profile partials

This way we'll be able to render the partials from places like a
component.
This commit is contained in:
Javi Martín
2021-09-03 20:22:20 +02:00
parent 274abaf290
commit 67a13d5fea
6 changed files with 16 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
<%= render "following" if @follows.present? %> <%= render "following", user: @user, follows: @follows if @follows.present? %>
<%= render "proposals" if @proposals.present? && feature?(:proposals) %> <%= render "proposals", proposals: @proposals if @proposals.present? && feature?(:proposals) %>
<%= render "debates" if @debates.present? && feature?(:debates) %> <%= render "debates", debates: @debates if @debates.present? && feature?(:debates) %>
<%= render "budget_investments" if @budget_investments.present? && feature?(:budgets) %> <%= render "budget_investments", budge_investments: @budge_investments if @budge_investments.present? && feature?(:budgets) %>
<%= render "comments" if @comments.present? %> <%= render "comments", comments: @comments if @comments.present? %>

View File

@@ -6,10 +6,10 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% @budget_investments.each do |budget_investment| %> <% budget_investments.each do |budget_investment| %>
<%= render "budget_investment", budget_investment: budget_investment %> <%= render "budget_investment", budget_investment: budget_investment %>
<% end %> <% end %>
</tbody> </tbody>
</table> </table>
<%= paginate @budget_investments %> <%= paginate budget_investments %>

View File

@@ -5,7 +5,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% @comments.each do |comment| %> <% comments.each do |comment| %>
<tr id="comment_<%= comment.id %>"> <tr id="comment_<%= comment.id %>">
<td> <td>
<%= comment_commentable_title(comment) %> <%= comment_commentable_title(comment) %>
@@ -17,4 +17,4 @@
</tbody> </tbody>
</table> </table>
<%= paginate @comments %> <%= paginate comments %>

View File

@@ -5,7 +5,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% @debates.each do |debate| %> <% debates.each do |debate| %>
<tr id="debate_<%= debate.id %>"> <tr id="debate_<%= debate.id %>">
<td> <td>
<%= link_to debate.title, debate %> <%= link_to debate.title, debate %>
@@ -15,4 +15,4 @@
</tbody> </tbody>
</table> </table>
<%= paginate @debates %> <%= paginate debates %>

View File

@@ -1,12 +1,12 @@
<div class="row following margin-top" data-equalizer data-equalize-on="medium"> <div class="row following margin-top" data-equalizer data-equalize-on="medium">
<div class="small-12 medium-8 column" data-equalizer-watch> <div class="small-12 medium-8 column" data-equalizer-watch>
<ul class="menu simple clear"> <ul class="menu simple clear">
<% @follows.each do |followable_type, follows| %> <% follows.each do |followable_type, follows| %>
<li><%= link_to followable_type_title(followable_type), "##{followable_type_title(followable_type).parameterize.underscore}" %></li> <li><%= link_to followable_type_title(followable_type), "##{followable_type_title(followable_type).parameterize.underscore}" %></li>
<% end %> <% end %>
</ul> </ul>
<% @follows.each do |followable_type, follows| %> <% follows.each do |followable_type, follows| %>
<h3 id="<%= followable_type_title(followable_type).parameterize.underscore %>"> <h3 id="<%= followable_type_title(followable_type).parameterize.underscore %>">
<span class="icon-<%= followable_icon(followable_type) %>"></span> <span class="icon-<%= followable_icon(followable_type) %>"></span>
@@ -22,6 +22,6 @@
</div> </div>
<div class="small-12 medium-4 column interests" data-equalizer-watch> <div class="small-12 medium-4 column interests" data-equalizer-watch>
<%= render "interests", user: @user if valid_interests_access? %> <%= render "interests", user: user if valid_interests_access? %>
</div> </div>
</div> </div>

View File

@@ -7,10 +7,10 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% @proposals.each do |proposal| %> <% proposals.each do |proposal| %>
<%= render "proposal", proposal: proposal %> <%= render "proposal", proposal: proposal %>
<% end %> <% end %>
</tbody> </tbody>
</table> </table>
<%= paginate @proposals %> <%= paginate proposals %>