Merge branch '1017_ntu_ga_rss' of https://github.com/Rulingcom/orbit into 1017_ntu_ga_rss
This commit is contained in:
commit
3cce5ef8e5
|
@ -12,12 +12,11 @@ class Panel::Feed::BackEnd::FeedsController < OrbitBackendController
|
|||
|
||||
def new
|
||||
@feed = AnnouncementFeed.new
|
||||
@categories = BulletinCategory.all
|
||||
end
|
||||
|
||||
def edit
|
||||
@feed = AnnouncementFeed.find(params[:id])
|
||||
@categories = BulletinCategory.all
|
||||
@categories = @feed.categories
|
||||
end
|
||||
|
||||
def create
|
||||
|
|
|
@ -1,3 +1,30 @@
|
|||
<%= form_for @feed, :url => panel_feed_back_end_feed_path, :method => :put, :html => {:class => "form-horizontal"} do |f| %>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
<% end %>
|
||||
<script type="text/javascript">
|
||||
|
||||
var checkboxes = $('.checkbox input');
|
||||
|
||||
$(document).ready(function() {
|
||||
var categories = <%= @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 (checkboxes[0].checked == true) {
|
||||
for (var i = 1; i < checkboxes.length; i++) {
|
||||
checkboxes[i].checked = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
Loading…
Reference in New Issue