orbit-feed/app/views/panel/feed/back_end/feeds/new.html.erb

32 lines
784 B
Plaintext

<%= form_for @feed, :url => panel_feed_back_end_feeds_path, :html => { :class=>"form-horizontal"} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>
<script type="text/javascript">
$(function() {
var $checkboxes = $('.checkbox').find('input');
var categories = <%= @current_categories.to_json.html_safe %>;
for (var i = 0; i < $checkboxes.length; i++) {
if ($.inArray($checkboxes[i].value, categories) != -1) {
$checkboxes[i].checked = true;
} else {
continue;
}
}
$checkboxes.on('click', function() {
if ($(this).val() == "全部") {
for (var i = 1; i < $checkboxes.length; i++) {
$checkboxes[i].checked = false;
}
} else {
$checkboxes[0].checked = false;
}
});
});
</script>