Permalink
Browse files

destroy competition form in separate partial

  • Loading branch information...
NoryDev committed Aug 13, 2016
1 parent 3397971 commit d16768f51ef4de7cf306289079c4dea8e7dd80d3
@@ -27,7 +27,6 @@ def apply?
end
def destroy?
# record.id && user && record.author == user && record.users.none?
true
record.id && user && record.author == user && record.users.none?
end
end
@@ -0,0 +1,12 @@
<% if policy(competition).destroy? %>
<div class="panel panel-danger marged-mini">
<div class="panel-heading">
<strong><%= t('competitions.show.destroy.panel') %></strong>
</div>
<div class="panel-body">
<p><strong><%= t('competitions.show.destroy.title') %></strong></p>
<%= link_to t('competitions.show.destroy.title'), competition_path(competition), method: 'delete', class: "btn btn-danger pull-right" %>
<p><%= t('competitions.show.destroy.text') %></p>
</div>
</div>
<% end %>
@@ -211,16 +211,3 @@
<%= f.button :submit, class: "btn btn-primary" %> <%= link_to t('cancel'), :back, class: "btn" %>
<% end %>
<% if policy(competition).destroy? %>
<div class="panel panel-danger marged-mini">
<div class="panel-heading">
<strong><%= t('competitions.show.destroy.panel') %></strong>
</div>
<div class="panel-body">
<p><strong><%= t('competitions.show.destroy.title') %></strong></p>
<%= link_to t('competitions.show.destroy.title'), competition_path(competition), method: 'delete', class: "btn btn-danger pull-right" %>
<p><%= t('competitions.show.destroy.text') %></p>
</div>
</div>
<% end %>
@@ -12,6 +12,7 @@
<h3><%= t('.title') %></h3>
<%= render 'form', competition: @form %>
<%= render 'destroy_form', competition: @competition %>
</div>
</div>
</div>
@@ -96,6 +96,7 @@
</div>
<div role="tabpanel" class="tab-pane" id="settings">
<%= render 'form', competition: @form %>
<%= render 'destroy_form', competition: @competition %>
</div>
<% end %>
</div>

0 comments on commit d16768f

Please sign in to comment.