63 lines
1.8 KiB
Plaintext
63 lines
1.8 KiB
Plaintext
|
<%= form_for @feed, :url => panel_feed_back_end_feed_path, :method => :put, :html => {:class => "form-horizontal"} do |f| %>
|
||
|
|
||
|
<legend><h3 style="margin-left: 10px;"><%= t('feed.channel') %></h3></legend>
|
||
|
<fieldset style="margin-left: -25px;">
|
||
|
|
||
|
<div class="control-group">
|
||
|
<label class="control-label" for="inputURL"><%= t('feed.current_rss') %>:</label>
|
||
|
<div class="controls">
|
||
|
<h4><%= @feed.name %></h4>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="control-group">
|
||
|
<label class="control-label" for="inputURL"><%= t('feed.choose') %>:</label>
|
||
|
<div class="controls">
|
||
|
<% @categories.each_with_index do |category, i| %>
|
||
|
<%= content_tag :label, :class => "checkbox inline" do -%>
|
||
|
<%= check_box("announcement_feed", "categories", {:multiple => true, :id => i}, category, nil) %>
|
||
|
<label for="<%= i %>"><%= category %></label>
|
||
|
<% end -%>
|
||
|
<% end %>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="control-group">
|
||
|
<div class="controls">
|
||
|
<%= f.submit t("submit"), :class => "btn btn-primary" %>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</fieldset>
|
||
|
<% 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;
|
||
|
}
|
||
|
});
|
||
|
|
||
|
$('.controls').find('h4').css({'margin-top': '5px'})
|
||
|
});
|
||
|
|
||
|
</script>
|