Announcement Categories in Mobile settings
This commit is contained in:
parent
2b4fa96b74
commit
7f4d4ae93f
|
@ -71,12 +71,11 @@ class Admin::SitesController < OrbitBackendController
|
|||
end
|
||||
|
||||
def responsive_setting
|
||||
@bulletins = Bulletin.all
|
||||
@bulletin_categories = []
|
||||
@bulletins.each do |bulletin|
|
||||
@bulletin_categories << bulletin.get_bulletin_category
|
||||
end
|
||||
@categories = @bulletin_categories
|
||||
@module = ModuleApp.where(:key => "announcement").first
|
||||
# @categories=[]
|
||||
# @module.categories.each do |c|
|
||||
# @categories << c
|
||||
# end
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -12,9 +12,15 @@ class MobileController < ApplicationController
|
|||
end
|
||||
|
||||
def announcement
|
||||
@module = ModuleApp.where(:key => "announcement").first
|
||||
category=[]
|
||||
@module.categories.each do |c|
|
||||
puts category << c.id.to_s
|
||||
end
|
||||
@page_title = t('mobile.bulletin')
|
||||
date_now = Time.now
|
||||
@bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page(params[:page_main]).per(15)
|
||||
bulletin = Bulletin.where(:category_id.in => category).available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page(params[:page_main]).per(15)
|
||||
# @bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page(params[:page_main]).per(15)
|
||||
end
|
||||
|
||||
def announcement_content
|
||||
|
|
|
@ -26,6 +26,16 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label muted">Select Announcement Categories</label>
|
||||
<div class="controls">
|
||||
<% @module.categories.each do |category| %>
|
||||
<%= check_box_tag "site[announcement_category][]", category.id.to_s, @site.announcement_category.include?(category), :class=>"toggle-check", :data => { :title => "#{category.title}", disabled: true }, "data-deploy"=>"inline", :checked => (@site.announcement_category.include?(category.id.to_s)) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= I18n.t('site.mobile_api_openness_on') %></label>
|
||||
<div class="controls">
|
||||
|
@ -43,3 +53,29 @@
|
|||
|
||||
</fieldset>
|
||||
<%end%>
|
||||
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<script type="text/javascript">
|
||||
|
||||
$(".language-nav li a").click(function(){window.location.hash = $(this).attr("href")});
|
||||
|
||||
$(document).ready(function(){
|
||||
// Disable default language if language detection enbaled
|
||||
$("#site_enable_language_detection").change(function(){
|
||||
if ( !$(this).parent().hasClass("disable") ){
|
||||
$.each($( "input[name='site[default_locale]']" ),function(){
|
||||
if ( !$(this).parent().hasClass("disable") ) $(this).parent().toggleClass('disable');
|
||||
$(this).toggleClass('disable');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Disable language detection if default language enbaled
|
||||
$.each($( "input[name='site[default_locale]']" ),function(){
|
||||
$(this).click(function(){
|
||||
$("#site_enable_language_detection").parent().addClass('disable');
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
|
@ -1,9 +1,7 @@
|
|||
<section class="main-menu">
|
||||
<ul class="clear">
|
||||
<li><%= link_to content_tag(:i, nil, :class => "icons-house") + content_tag(:span, t('mobile.home')), mobile_path(:app => params[:app]) %></li>
|
||||
<% if @site.enable_announcement_mobile %>
|
||||
<li><%= link_to content_tag(:i, nil, :class => "icons-megaphone") + content_tag(:span, t('mobile.bulletin')), mobile_announcement_path(:app => params[:app]) %></li>
|
||||
<% end %>
|
||||
<li><%= link_to content_tag(:i, nil, :class => "icons-newspaper") + content_tag(:span, t('mobile.page')), mobile_page_path(:app => params[:app]) %></li>
|
||||
</ul>
|
||||
</section>
|
|
@ -3,7 +3,6 @@
|
|||
<%= image_tag image.file.url, width: @ad_banner.width, height: @ad_banner.height %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% if @site.enable_announcement_mobile %>
|
||||
<div class="newlist clear">
|
||||
<% @bulletins.each do |bulletin| %>
|
||||
<div class="newitem">
|
||||
|
@ -18,7 +17,6 @@
|
|||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<script type='text/javascript'>
|
||||
$(function(){
|
||||
if($("#slideshow-<%= @ad_banner.title.dehumanize %> img").length > 1){
|
||||
|
|
Reference in New Issue