diff --git a/app/controllers/admin/sites_controller.rb b/app/controllers/admin/sites_controller.rb
index ecc5535c..0c2be0b6 100644
--- a/app/controllers/admin/sites_controller.rb
+++ b/app/controllers/admin/sites_controller.rb
@@ -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
diff --git a/app/controllers/mobile_controller.rb b/app/controllers/mobile_controller.rb
index 546000ac..9d3cfeae 100644
--- a/app/controllers/mobile_controller.rb
+++ b/app/controllers/mobile_controller.rb
@@ -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
diff --git a/app/views/admin/sites/responsive_setting.html.erb b/app/views/admin/sites/responsive_setting.html.erb
index ebec8299..5d9ba8cf 100644
--- a/app/views/admin/sites/responsive_setting.html.erb
+++ b/app/views/admin/sites/responsive_setting.html.erb
@@ -26,6 +26,16 @@
+
+
Select Announcement Categories
+
+ <% @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 %>
+
+
+
+
<%= I18n.t('site.mobile_api_openness_on') %>
@@ -42,4 +52,30 @@
- <%end%>
\ No newline at end of file
+ <%end%>
+
+<% content_for :page_specific_javascript do %>
+
+<% end %>
\ No newline at end of file
diff --git a/app/views/mobile/_menu.mobile.erb b/app/views/mobile/_menu.mobile.erb
index 57fbf0c6..ec92ea84 100644
--- a/app/views/mobile/_menu.mobile.erb
+++ b/app/views/mobile/_menu.mobile.erb
@@ -1,9 +1,7 @@
<%= link_to content_tag(:i, nil, :class => "icons-house") + content_tag(:span, t('mobile.home')), mobile_path(:app => params[:app]) %>
- <% if @site.enable_announcement_mobile %>
<%= link_to content_tag(:i, nil, :class => "icons-megaphone") + content_tag(:span, t('mobile.bulletin')), mobile_announcement_path(:app => params[:app]) %>
- <% end %>
<%= link_to content_tag(:i, nil, :class => "icons-newspaper") + content_tag(:span, t('mobile.page')), mobile_page_path(:app => params[:app]) %>
\ No newline at end of file
diff --git a/app/views/mobile/index.mobile.erb b/app/views/mobile/index.mobile.erb
index e841b0cf..57c30430 100644
--- a/app/views/mobile/index.mobile.erb
+++ b/app/views/mobile/index.mobile.erb
@@ -3,7 +3,6 @@
<%= image_tag image.file.url, width: @ad_banner.width, height: @ad_banner.height %>
<% end %>
-<% if @site.enable_announcement_mobile %>
<% @bulletins.each do |bulletin| %>
@@ -18,7 +17,6 @@
<% end %>
-<% end %>