Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User page: new following section #1750

Merged
merged 17 commits into from
Jul 24, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
Next Next commit
Add method to follows helper to get followable partial name and argum…
…ents automatically.
  • Loading branch information
Senen committed Jul 18, 2017
commit 57c8887077164f4a2cabc919be33e15654261708
4 changes: 4 additions & 0 deletions app/helpers/follows_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ def entity_icon(entity)
}.invert[entity]
end

def entity_partial(class_name)
class_name.parameterize.gsub('-','_')
end

private

def followed?(followable)
Expand Down
7 changes: 2 additions & 5 deletions app/views/users/_following.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@
<table>
<tbody>
<% @follows.where(followable_type: followable_type).each do |follow| %>
<% if followable_type == "Proposal" %>
<%= render "proposal", proposal: follow.followable %>
<% elsif followable_type == "Budget::Investment" %>
<%= render "budget_investment", budget_investment: follow.followable %>
<% end %>
<%= render entity_partial(followable_type),
entity_partial(followable_type).to_sym => follow.followable %>
<% end %>
</tbody>
</table>
Expand Down
8 changes: 6 additions & 2 deletions app/views/users/_proposal.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@

<% if proposal.retired? %>

<td class="text-center">
<span class="label alert"><%= t('users.proposals.retired') %></span>
</td>

<% elsif author?(proposal) %>

<td class="text-center">
<%= link_to t("users.proposals.send_notification"),
new_proposal_notification_path(proposal_id: proposal.id),
class: 'button hollow' %>
</td>

<% elsif author?(proposal) %>

<td class="text-center">
<% if proposal.retired? %>
<span class="label alert"><%= t('users.proposals.retired') %></span>
Expand Down