diff --git a/app/controllers/panel/announcement/widget/bulletins_controller.rb b/app/controllers/panel/announcement/widget/bulletins_controller.rb index cb7df5b..53de013 100644 --- a/app/controllers/panel/announcement/widget/bulletins_controller.rb +++ b/app/controllers/panel/announcement/widget/bulletins_controller.rb @@ -166,5 +166,25 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController def bulletins_search_block @part = PagePart.find params[:part_id] end - + + + def sync_data + @create_users = ( params[:dept].blank? or !params[:dept].kind_of?(Array)) ? [] : User.where(:sid.in => params[:dept]).collect{|p| p.id} + @page_num = params[:page_num].blank? ? '10' : params[:page_num] + @bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.where(:category_id.nin => ['53abbd0b45ef444e6a0001a0','53abbd2045ef444e6a00095d','53abbd0745ef444e6a000001'], :create_user_id.in => @create_users).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num) + end + + def show_sync_data + @bulletin = Bulletin.all.can_display.where(_id: params[:id]).first + if @bulletin and !@bulletin.disable? + if @bulletin.enabled_for_lang(I18n.locale.to_s) + impressionist(@bulletin) + else + render :text => "
#{t('sys.can_not_display_due_to_no_context')}
".html_safe + end + else + render :nothing => true, :status => 403 + end + end + end diff --git a/app/views/panel/announcement/widget/bulletins/show_sync_data.html.erb b/app/views/panel/announcement/widget/bulletins/show_sync_data.html.erb new file mode 100644 index 0000000..003d58a --- /dev/null +++ b/app/views/panel/announcement/widget/bulletins/show_sync_data.html.erb @@ -0,0 +1,110 @@ +<% # encoding: utf-8 %> + + + +

<%= @bulletin.title %>

+
+
+ <%= t('announcement.categories') %> : <%= @bulletin.category.title rescue nil %> + <%= display_date_time(@bulletin.postdate) %> + <% + unit_field = User.get_member_list_attribute_field("staff","unit") + unit = User.get_member_list_attribute_value(@bulletin.create_user_id,unit_field.id).get_value_by_locale(I18n.locale) rescue nil + %> + <%= t('announcement.default_widget.bulletin_create_dept') + ": " + unit unless unit.blank? %> + <%= dislpay_view_count(@bulletin) %> +
+
+
+ <%= @bulletin.text.html_safe rescue '' %> +
+
+ <% if @bulletin.bulletin_links.size > 0 %> +
+ + +
+ <% end %> + <% if @bulletin.bulletin_files.size > 0 %> +
+ +
+ <% @bulletin.bulletin_files.each do | bfile | %> + <%= link_to bfile.title, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %> + <% end %> +
+
+ <% end %> +
+ +<%= share_links(@bulletin, 'announcement') %> \ No newline at end of file diff --git a/app/views/panel/announcement/widget/bulletins/sync_data.html.erb b/app/views/panel/announcement/widget/bulletins/sync_data.html.erb new file mode 100644 index 0000000..e66aea3 --- /dev/null +++ b/app/views/panel/announcement/widget/bulletins/sync_data.html.erb @@ -0,0 +1,103 @@ +<% # encoding: utf-8 %> + + + + + + + + + + + + + + +<% @bulletins.each_with_index do |post, i| %> + > + + + + <% + unit_field = User.get_member_list_attribute_field("staff","unit") + unit = User.get_member_list_attribute_value(post.create_user_id,unit_field.id).get_value_by_locale(I18n.locale) rescue nil + %> + + + +<% end %> + +
<%= t('announcement.categories') %><%= t('announcement.default_widget.title') %><%= t('announcement.default_widget.postdate') %><%= t('announcement.default_widget.bulletin_create_dept') %>
<%= post.category.title rescue nil %><%= post.title %><%= display_date(post.postdate) %><%= unit %>
+ +<%= paginate( @bulletins, :param_name => :page_main, :params => {:inner => 'false'} ) rescue nil if params[:show_page].blank? %> + + diff --git a/config/routes.rb b/config/routes.rb index 83f0a19..2e01411 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -40,6 +40,8 @@ Rails.application.routes.draw do match "reload_web_links" => "bulletins#reload_web_links" match "bulletins_side_bar" => "bulletins#bulletins_side_bar" match "bulletins_search_block" => "bulletins#bulletins_search_block" + match "sync_data" => "bulletins#sync_data",:as => :sync_data,:via => :get + match "show_sync_data/:id" => "bulletins#show_sync_data",:as => :show_sync_data,:via => :get end namespace :api do get "categories_tags.json" => "bulletins#get_categories_tags"