Change feed form style.

This commit is contained in:
BoHung Chiu 2021-06-03 11:17:26 +08:00
parent f34be54da0
commit cf8e48bc1b
4 changed files with 35 additions and 26 deletions

View File

@ -470,7 +470,14 @@ class Admin::AnnouncementsController < OrbitAdminController
end
def feed_params
params.require(:bulletin_feed).permit!
feed_params = params.require(:bulletin_feed).permit!
if feed_params[:tag_ids].nil?
feed_params[:tag_ids] = []
end
if feed_params[:category_ids].nil?
feed_params[:category_ids] = []
end
feed_params
end
def settings_params

View File

@ -14,45 +14,45 @@
<div class="tags">
<h4><%=t(:tags)%></h4>
<div id="tags-list">
<ul class="tags-groups checkbox-card module-tags">
<div class="tags-groups checkbox-card module-tags">
<% @module_app.tags.each do |tag| %>
<li class="filter-item module">
<label class="filter-item module <%= @announcement_feed.tag_ids.include?(tag.id.to_s) ? "active" : "" %>">
<p class='card pull-left <%= @announcement_feed.tag_ids.include?(tag.id.to_s) ? "active" : "" %>'>
<input type="checkbox" <%= @announcement_feed.tag_ids.include?(tag.id.to_s) ? "checked=checked" : "" %> class="tag-checkbox" value="<%= tag.id.to_s %>" name="bulletin_feed[tag_ids][]">
</p>
<a href="#" onclick="return false;">
<div>
<% @site_in_use_locales.each_with_index do |locale,index| %>
<span class="tag"><%= tag.name_translations[locale] %></span>
<% if index < (@site_in_use_locales.count - 1) %>
/
<% end %>
<% end %>
</a>
</li>
</div>
</label>
<% end %>
</ul>
</div>
</div>
</div>
<div class="categories">
<h4><%=t(:category)%></h4>
<div id="categories-list">
<ul class="tags-groups checkbox-card module-categories">
<div class="tags-groups checkbox-card module-categories">
<% @module_app.categories.each do |category| %>
<li class="filter-item module">
<label class="filter-item module <%= @announcement_feed.category_ids.include?(category.id.to_s) ? "active" : "" %>">
<p class="card pull-left <%= @announcement_feed.category_ids.include?(category.id.to_s) ? "active" : "" %>">
<input type="checkbox" class="tag-checkbox" <%= @announcement_feed.category_ids.include?(category.id.to_s) ? "checked=checked" : "" %> value="<%= category.id.to_s %>" name="bulletin_feed[category_ids][]">
</p>
<a href="#" onclick="return false;">
<div>
<% @site_in_use_locales.each_with_index do |locale,index| %>
<span class="tag"><%= category.title_translations[locale] %></span>
<% if index < (@site_in_use_locales.count - 1) %>
/
<% end %>
<% end %>
</a>
</li>
</div>
</label>
<% end %>
</ul>
</div>
</div>
</div>
</fieldset>

View File

@ -14,45 +14,45 @@
<div class="tags">
<h4><%=t(:tags)%></h4>
<div id="tags-list">
<ul class="tags-groups checkbox-card module-tags">
<div class="tags-groups checkbox-card module-tags">
<% @module_app.tags.each do |tag| %>
<li class="filter-item module">
<label class="filter-item module">
<p class="card pull-left">
<input type="checkbox" class="tag-checkbox" value="<%= tag.id.to_s %>" name="bulletin_feed[tag_ids][]">
</p>
<a href="#" onclick="return false;">
<div>
<% @site_in_use_locales.each_with_index do |locale,index| %>
<span class="tag"><%= tag.name_translations[locale] %></span>
<% if index < (@site_in_use_locales.count - 1) %>
/
<% end %>
<% end %>
</a>
</li>
</div>
</label>
<% end %>
</ul>
</div>
</div>
</div>
<div class="categories">
<h4><%=t(:category)%></h4>
<div id="categories-list">
<ul class="tags-groups checkbox-card module-categories">
<div class="tags-groups checkbox-card module-categories">
<% @module_app.categories.each do |category| %>
<li class="filter-item module">
<label class="filter-item module">
<p class="card pull-left">
<input type="checkbox" class="tag-checkbox" value="<%= category.id.to_s %>" name="bulletin_feed[category_ids][]">
</p>
<a href="#" onclick="return false;">
<div>
<% @site_in_use_locales.each_with_index do |locale,index| %>
<span class="tag"><%= category.title_translations[locale] %></span>
<% if index < (@site_in_use_locales.count - 1) %>
/
<% end %>
<% end %>
</a>
</li>
</div>
</label>
<% end %>
</ul>
</div>
</div>
</div>
</fieldset>

View File

@ -91,8 +91,10 @@
$(".tag-checkbox").on("click",function(){
if($(this).is(":checked")){
$(this).parent().addClass("active");
$(this).parent().parent().addClass("active");
}else{
$(this).parent().removeClass("active");
$(this).parent().parent().removeClass("active");
}
})