add feed category mutilple checkbox

This commit is contained in:
thomaschen 2013-11-22 15:49:45 +08:00
parent 9de2778869
commit a93cb71d86
4 changed files with 58 additions and 12 deletions

View File

@ -11,7 +11,7 @@ class Panel::Feed::BackEnd::FeedsController < OrbitBackendController
end end
def new def new
@feed = AnnouncementFeed.new @feed = AnnouncementFeed.new
@categories = BulletinCategory.all @categories = BulletinCategory.all
end end
@ -22,7 +22,7 @@ class Panel::Feed::BackEnd::FeedsController < OrbitBackendController
def create def create
@feed = AnnouncementFeed.new(params[:announcement_feed]) @feed = AnnouncementFeed.new(params[:announcement_feed])
if @feed.save if @feed.save
redirect_to panel_feed_back_end_feeds_url redirect_to panel_feed_back_end_feeds_url
else else

View File

@ -4,6 +4,5 @@ class AnnouncementFeed
field :link, type: String field :link, type: String
field :name, type: String field :name, type: String
field :category
end end

View File

@ -17,8 +17,62 @@
<div class="control-group"> <div class="control-group">
<label class="control-label" for="inputURL"><%= t('feed.choose') %>:</label> <label class="control-label" for="inputURL"><%= t('feed.choose') %>:</label>
<div class="controls"> <div class="controls">
<%= f.select(:category, options_for_select([["#{t('feed.all')}", "all"]] + <%= content_tag :label,:class => "checkbox inline" do -%>
@categories.all.collect {|c| [ c.title, c.title ] })) %> <%= check_box("announcement_feed", "categories", {:multiple => true}, "c1", nil) %>
<%= label_tag "全部" %>
<% end -%>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box("announcement_feed", "categories", {:multiple => true}, "c2", nil) %>
<%= label_tag "緊急" %>
<% end -%>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box("announcement_feed", "categories", {:multiple => true}, "c3", nil) %>
<%= label_tag "一般" %>
<% end -%>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box("announcement_feed", "categories", {:multiple => true}, "c4", nil) %>
<%= label_tag "研討會" %>
<% end -%>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box("announcement_feed", "categories", {:multiple => true}, "c5", nil) %>
<%= label_tag "演講" %>
<% end -%>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box("announcement_feed", "categories", {:multiple => true}, "c6", nil) %>
<%= label_tag "活動" %>
<% end -%>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box("announcement_feed", "categories", {:multiple => true}, "c7", nil) %>
<%= label_tag "徵才" %>
<% end -%>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box("announcement_feed", "categories", {:multiple => true}, "c8", nil) %>
<%= label_tag "招標" %>
<% end -%>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box("announcement_feed", "categories", {:multiple => true}, "c9", nil) %>
<%= label_tag "拖吊" %>
<% end -%>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box("announcement_feed", "categories", {:multiple => true}, "c10", nil) %>
<%= label_tag "校外" %>
<% end -%>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box("announcement_feed", "categories", {:multiple => true}, "c11", nil) %>
<%= label_tag "過期" %>
<% end -%>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box("announcement_feed", "categories", {:multiple => true}, "c12", nil) %>
<%= label_tag "H1N1" %>
<% end -%>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box("announcement_feed", "categories", {:multiple => true}, "c13", nil) %>
<%= label_tag "失物招領" %>
<% end -%>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box("announcement_feed", "categories", {:multiple => true}, "c14", nil) %>
<%= label_tag "近期" %>
<% end -%>
</div> </div>
</div> </div>

View File

@ -1,7 +0,0 @@
<% @client_videos.videos.each do |v| %>
<tr class="with_action">
<% @video = v.video_id.split(/tag:youtube.com,2008:video:+/).last %>
<% @vd = UnvlogIt.new("https://www.youtube.com/watch?v=#{@video}")%>
<td><%= @vd.embed_html(400, 300).html_safe %></td>
<td><%= @vd.title %></td>
<%end%>