Announcement Categories in Mobile settings
This commit is contained in:
parent
2b4fa96b74
commit
7f4d4ae93f
|
@ -71,12 +71,11 @@ class Admin::SitesController < OrbitBackendController
|
||||||
end
|
end
|
||||||
|
|
||||||
def responsive_setting
|
def responsive_setting
|
||||||
@bulletins = Bulletin.all
|
@module = ModuleApp.where(:key => "announcement").first
|
||||||
@bulletin_categories = []
|
# @categories=[]
|
||||||
@bulletins.each do |bulletin|
|
# @module.categories.each do |c|
|
||||||
@bulletin_categories << bulletin.get_bulletin_category
|
# @categories << c
|
||||||
end
|
# end
|
||||||
@categories = @bulletin_categories
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,15 @@ class MobileController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def announcement
|
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')
|
@page_title = t('mobile.bulletin')
|
||||||
date_now = Time.now
|
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
|
end
|
||||||
|
|
||||||
def announcement_content
|
def announcement_content
|
||||||
|
|
|
@ -26,6 +26,16 @@
|
||||||
</div>
|
</div>
|
||||||
</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">
|
<div class="control-group">
|
||||||
<label class="control-label muted"><%= I18n.t('site.mobile_api_openness_on') %></label>
|
<label class="control-label muted"><%= I18n.t('site.mobile_api_openness_on') %></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
|
@ -42,4 +52,30 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<%end%>
|
<%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">
|
<section class="main-menu">
|
||||||
<ul class="clear">
|
<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>
|
<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>
|
<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>
|
<li><%= link_to content_tag(:i, nil, :class => "icons-newspaper") + content_tag(:span, t('mobile.page')), mobile_page_path(:app => params[:app]) %></li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
|
@ -3,7 +3,6 @@
|
||||||
<%= image_tag image.file.url, width: @ad_banner.width, height: @ad_banner.height %>
|
<%= image_tag image.file.url, width: @ad_banner.width, height: @ad_banner.height %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% if @site.enable_announcement_mobile %>
|
|
||||||
<div class="newlist clear">
|
<div class="newlist clear">
|
||||||
<% @bulletins.each do |bulletin| %>
|
<% @bulletins.each do |bulletin| %>
|
||||||
<div class="newitem">
|
<div class="newitem">
|
||||||
|
@ -18,7 +17,6 @@
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
|
||||||
<script type='text/javascript'>
|
<script type='text/javascript'>
|
||||||
$(function(){
|
$(function(){
|
||||||
if($("#slideshow-<%= @ad_banner.title.dehumanize %> img").length > 1){
|
if($("#slideshow-<%= @ad_banner.title.dehumanize %> img").length > 1){
|
||||||
|
|
Loading…
Reference in New Issue