Last active
March 6, 2017 15:56
-
-
Save AnithaPal/b2aa2eaeea1adace3df4ba1b6b3eb0c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- content_for :item_title do | |
= link_to unit.name, unit | |
= content_for :actions do | |
= edit_button(unit) | |
= destroy_button(unit) | |
= link_to replicate_unit_path(unit), remote: true, class: 'btn btn-default replicate-unit' do | |
%i.fa.fa-copy | |
= label_group 'Issues' do | |
- if unit.alerts? | |
.tag.tag-danger | |
%i.fa.fa-exclamation-triangle | |
= unit.alerts.count | |
- else | |
.tag.tag-success | |
%i.fa.fa-check | |
0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% if @unit_replica.valid? %> | |
$('ul').append("<%= j render 'unit', locals: {unit: @unit_replica} %>"); | |
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
$("link").click(function(event){ | |
$.ajax({ | |
type:'get', | |
url: "replicate.js" | |
}); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def replicate | |
authorize @unit | |
@unit_replica = @unit.replicate_unit | |
authorize @unit_replica | |
# redirect_to account_units_path | |
respond_to do |format| | |
format.html { redirect_to referer, notice: 'Unit copied' } | |
# format.js {} | |
format.js | |
end | |
# render nothing: true, status: 200, content_type: 'text/html' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment