Remove news and fix default_url in ImageUploader
This commit is contained in:
parent
0d26f48c9a
commit
475642d375
|
@ -1,29 +0,0 @@
|
||||||
<%#= encoding: utf-8 %>
|
|
||||||
$(document).ready(function(){
|
|
||||||
//alert("News Loaded");
|
|
||||||
|
|
||||||
$('.news_bulletin_links_block a.delete').live('click', function(){
|
|
||||||
$(this).parents('.list_item').remove();
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.news_bulletin_files_block a.delete').live('click', function(){
|
|
||||||
$(this).parents('.list_item').remove();
|
|
||||||
});
|
|
||||||
|
|
||||||
$(document).on('click', '.action a.remove_existing_record', function(){
|
|
||||||
if(confirm("<%= I18n.t(:sure?)%>")){
|
|
||||||
$(this).next('.should_destroy').attr('value', 1);
|
|
||||||
$("tr#" + $(this).prev().attr('value')).hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$(document).on('click', '.quick_edit_cancel', function(){
|
|
||||||
tr = $(this).attr('rel');
|
|
||||||
$('#' + tr).hide();
|
|
||||||
$("tr#news_bulletin_file_" + $(this).prev().attr('value')).hide();
|
|
||||||
$("tr#news_bulletin_link_" + $(this).prev().attr('value')).hide();
|
|
||||||
});
|
|
||||||
$('.reject_info').tooltip({
|
|
||||||
placement : 'bottom'
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -5,9 +5,9 @@ class Admin::DashboardsController < OrbitBackendController
|
||||||
# before_filter :is_admin?
|
# before_filter :is_admin?
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@module_app_contents, @module_app_contents_total = get_module_app_count('bulletin', 'news_bulletin', 'page_context', 'web_link')
|
@module_app_contents, @module_app_contents_total = get_module_app_count('bulletin', 'page_context', 'web_link')
|
||||||
@recent_updated = get_recently_updated('bulletin', 'news_bulletin', 'page_context', 'web_link')
|
@recent_updated = get_recently_updated('bulletin', 'page_context', 'web_link')
|
||||||
@most_visited = get_most_visited('bulletin', 'news_bulletin', 'page_context')
|
@most_visited = get_most_visited('bulletin', 'page_context')
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
|
@ -4,8 +4,6 @@ module Admin::DashboardsHelper
|
||||||
case title
|
case title
|
||||||
when 'bulletin'
|
when 'bulletin'
|
||||||
panel_announcement_front_end_bulletins_path
|
panel_announcement_front_end_bulletins_path
|
||||||
when 'news_bulletin'
|
|
||||||
panel_news_front_end_news_bulletins_path
|
|
||||||
when'page_context'
|
when'page_context'
|
||||||
panel_page_content_front_end_page_contexts_path
|
panel_page_content_front_end_page_contexts_path
|
||||||
when'web_link'
|
when'web_link'
|
||||||
|
@ -17,8 +15,6 @@ module Admin::DashboardsHelper
|
||||||
case object.class.to_s.underscore
|
case object.class.to_s.underscore
|
||||||
when 'bulletin'
|
when 'bulletin'
|
||||||
panel_announcement_front_end_bulletin_path(object)
|
panel_announcement_front_end_bulletin_path(object)
|
||||||
when 'news_bulletin'
|
|
||||||
panel_news_front_end_news_bulletin_path(object)
|
|
||||||
when'page_context'
|
when'page_context'
|
||||||
"/#{object.page.path}"
|
"/#{object.page.path}"
|
||||||
when'web_link'
|
when'web_link'
|
||||||
|
|
|
@ -260,13 +260,8 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def share_links(object, key)
|
def share_links(object, key)
|
||||||
# js = ''
|
|
||||||
# js << "<meta property='og:title' content='#{object.title}' />\n" rescue ''
|
|
||||||
# js << "<meta property='og:description' content='#{object.subtitle}' />\n" rescue ''
|
|
||||||
# js << "<meta property='og:image' content='#{object.image.url}' />\n" rescue ''
|
|
||||||
content_tag :div, :class => 'fb' do
|
content_tag :div, :class => 'fb' do
|
||||||
concat social_share_button_tag(object.title, :fb_url => generate_fb_url(object,key), :image => "http://#{request.env['HTTP_HOST']}#{object.image.url if !object.image.blank?}")
|
concat social_share_button_tag(object.title, :fb_url => generate_fb_url(object,key), :image => "http://#{request.env['HTTP_HOST']}#{object.image_url}")
|
||||||
# concat javascript_tag "$('head').append('#{j js}');"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ class ImageUploader < CarrierWave::Uploader::Base
|
||||||
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
||||||
# end
|
# end
|
||||||
def default_url
|
def default_url
|
||||||
Site.first.default_image.url rescue "-sign-in-logo.png"
|
[version_name, (Site.first.default_image.file.url rescue "sign-in-logo.png")].compact.join('_')
|
||||||
end
|
end
|
||||||
|
|
||||||
# Process files as they are uploaded:
|
# Process files as they are uploaded:
|
||||||
|
|
|
@ -20,19 +20,6 @@
|
||||||
|
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
<%= content_tag :li, :class =>( active_for_controllers('news_bulletins', '/panel/news/back_end/tags', 'news_bulletin_categorys', 'news_approvals')|| active_for_app_auth('news') || active_for_ob_auths_object("NewsBulletinCategory")) do -%>
|
|
||||||
<%= link_to content_tag(:i, nil, :class => 'icons-announcement') + content_tag(:span, t('admin.news')), panel_news_back_end_news_bulletins_path %>
|
|
||||||
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('news_bulletins', '/panel/news/back_end/tags', 'news_bulletin_categorys', 'news_approvals')) do -%>
|
|
||||||
<%= content_tag :li, link_to((t('announcement.all_articles') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_news_back_end_news_bulletins_path), :class => active_for_action('news_bulletins', 'index') if (is_manager? rescue nil)%>
|
|
||||||
<%= content_tag :li, link_to((t('announcement.add_new') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, new_panel_news_back_end_news_bulletin_path), :class => active_for_action('news_bulletins', 'new') if (is_manager? rescue nil) %>
|
|
||||||
<%= content_tag :li, link_to((t('announcement.categories') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_news_back_end_news_bulletin_categorys_path), :class => active_for_action('news_bulletin_categorys', 'index') || active_for_ob_auths_object("NewsBulletinCategory") if (is_manager? rescue nil) %>
|
|
||||||
<%= content_tag :li, link_to((t('announcement.tags') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_news_back_end_tags_path), :class => active_for_action('/panel/news/back_end/tags', 'index') if (is_manager? rescue nil)%>
|
|
||||||
<%= content_tag :li, link_to((t('announcement.bulletin.approval_setting') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_news_back_end_approval_setting_path), :class => active_for_action('news_approvals', 'setting') if (is_manager? rescue nil) %>
|
|
||||||
<%= content_tag :li, link_to((t('admin.module.authorization') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe,admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: "news"}))), :class => active_for_app_auth('news') if (is_admin? rescue nil) %>
|
|
||||||
<% end -%>
|
|
||||||
|
|
||||||
<% end -%>
|
|
||||||
|
|
||||||
<%#= content_tag :li, :class => active_for_controllers('users') do -%>
|
<%#= content_tag :li, :class => active_for_controllers('users') do -%>
|
||||||
<%#= link_to content_tag(:i, nil, :class => 'icons-member') + t('admin.member'), admin_users_path %>
|
<%#= link_to content_tag(:i, nil, :class => 'icons-member') + t('admin.member'), admin_users_path %>
|
||||||
<%# end -%>
|
<%# end -%>
|
||||||
|
|
|
@ -19,10 +19,7 @@ namespace :data_migration do
|
||||||
NewsBulletinCategory.all.each{|bc| bc.disable=false;bc.save!}
|
NewsBulletinCategory.all.each{|bc| bc.disable=false;bc.save!}
|
||||||
end
|
end
|
||||||
|
|
||||||
task :add_search_widget_to_news_and_announcement => :environment do
|
task :add_search_widget_to_announcement => :environment do
|
||||||
app = ModuleApp.first({:conditions=>{:title => 'news'}})
|
|
||||||
app.widgets << "news_bulletins_search_block" if !app.widgets.include?("news_bulletins_search_block")
|
|
||||||
app.save!
|
|
||||||
app = ModuleApp.first({:conditions=>{:title => 'Announcement'}})
|
app = ModuleApp.first({:conditions=>{:title => 'Announcement'}})
|
||||||
app.widgets << "bulletins_search_block" if !app.widgets.include?("bulletins_search_block")
|
app.widgets << "bulletins_search_block" if !app.widgets.include?("bulletins_search_block")
|
||||||
app.save!
|
app.save!
|
||||||
|
|
|
@ -81,69 +81,6 @@ namespace :migrate do
|
||||||
p '====================================================='
|
p '====================================================='
|
||||||
p '====================================================='
|
p '====================================================='
|
||||||
|
|
||||||
p 'Start NewsBulletin'
|
|
||||||
news_bulletins = NewsBulletin.admin_manager_all
|
|
||||||
i = 1
|
|
||||||
news_bulletins.each do |news_bulletin|
|
|
||||||
p "#{i}/#{news_bulletins.size} - #{news_bulletin.id}"
|
|
||||||
title = I18nVariable.first(:conditions => {:key => 'title', :language_value_id => news_bulletin.id, :language_value_type => news_bulletin.class})
|
|
||||||
news_bulletin.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
|
||||||
subtitle = I18nVariable.first(:conditions => {:key => 'subtitle', :language_value_id => news_bulletin.id, :language_value_type => news_bulletin.class})
|
|
||||||
news_bulletin.subtitle_translations = {'en' => subtitle['en'], 'zh_tw' => subtitle['zh_tw']} if subtitle
|
|
||||||
text = I18nVariable.first(:conditions => {:key => 'text', :language_value_id => news_bulletin.id, :language_value_type => news_bulletin.class})
|
|
||||||
news_bulletin.text_translations = {'en' => text['en'], 'zh_tw' => text['zh_tw']} if text
|
|
||||||
p news_bulletin.save(:validate => false)
|
|
||||||
i += 1
|
|
||||||
end
|
|
||||||
p 'End NewsBulletin'
|
|
||||||
|
|
||||||
p '====================================================='
|
|
||||||
|
|
||||||
p 'Start NewsBulletinCategory'
|
|
||||||
categories = NewsBulletinCategory.admin_manager_all
|
|
||||||
i = 1
|
|
||||||
categories.each do |category|
|
|
||||||
p "#{i}/#{categories.size} - #{category.id}"
|
|
||||||
title = I18nVariable.first(:conditions => {:language_value_id => category.id, :language_value_type => category.class})
|
|
||||||
category.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
|
||||||
p category.save(:validate => false)
|
|
||||||
i += 1
|
|
||||||
end
|
|
||||||
p 'End NewsBulletinCategory'
|
|
||||||
|
|
||||||
p '====================================================='
|
|
||||||
|
|
||||||
p 'Start NewsBulletinFile'
|
|
||||||
files = NewsBulletinFile.all
|
|
||||||
i = 1
|
|
||||||
files.each do |file|
|
|
||||||
p "#{i}/#{files.size} - #{file.id}"
|
|
||||||
description = I18nVariable.first(:conditions => {:language_value_id => file.id, :language_value_type => file.class})
|
|
||||||
file.description_translations = {'en' => description['en'], 'zh_tw' => description['zh_tw']} if description
|
|
||||||
title = I18nVariable.first(:conditions => {:language_value_id => file.id, :language_value_type => file.class})
|
|
||||||
file.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
|
||||||
p file.save(:validate => false)
|
|
||||||
i += 1
|
|
||||||
end
|
|
||||||
p 'End NewsBulletinFile'
|
|
||||||
|
|
||||||
p '====================================================='
|
|
||||||
|
|
||||||
p 'Start NewsBulletinLink'
|
|
||||||
links = NewsBulletinLink.all
|
|
||||||
i = 1
|
|
||||||
links.each do |link|
|
|
||||||
p "#{i}/#{links.size} - #{link.id}"
|
|
||||||
title = I18nVariable.first(:conditions => {:language_value_id => link.id, :language_value_type => link.class})
|
|
||||||
link.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title
|
|
||||||
p link.save(:validate => false)
|
|
||||||
i += 1
|
|
||||||
end
|
|
||||||
p 'End NewsBulletinLink'
|
|
||||||
|
|
||||||
p '====================================================='
|
|
||||||
p '====================================================='
|
|
||||||
|
|
||||||
p 'Start PageContext'
|
p 'Start PageContext'
|
||||||
page_contexts = PageContext.all
|
page_contexts = PageContext.all
|
||||||
i = 1
|
i = 1
|
||||||
|
|
|
@ -15,7 +15,6 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
end
|
end
|
||||||
|
|
||||||
def preview
|
def preview
|
||||||
#@preview_obj = Preview.create(:object=>params[:news_bulletin],:expired_at=>DateTime.now+30.minutes,:preview_at_link=>"panel_news_front_end_news_bulletin_path",:object_class_type=>"NewsBulletin")
|
|
||||||
bulletin = Bulletin.new params
|
bulletin = Bulletin.new params
|
||||||
@preview_obj = bulletin.to_preview
|
@preview_obj = bulletin.to_preview
|
||||||
@preview_obj.save
|
@preview_obj.save
|
||||||
|
|
|
@ -10,6 +10,7 @@ class Bulletin
|
||||||
BelongsToCategory = :bulletin_category
|
BelongsToCategory = :bulletin_category
|
||||||
include OrbitCoreLib::BelongsToCategoryMayDisable
|
include OrbitCoreLib::BelongsToCategoryMayDisable
|
||||||
include OrbitCoreLib::Preview
|
include OrbitCoreLib::Preview
|
||||||
|
|
||||||
is_impressionable :counter_cache => { :column_name => :view_count }
|
is_impressionable :counter_cache => { :column_name => :view_count }
|
||||||
|
|
||||||
field :title, localize: true
|
field :title, localize: true
|
||||||
|
@ -21,7 +22,6 @@ class Bulletin
|
||||||
field :postdate , :type => DateTime
|
field :postdate , :type => DateTime
|
||||||
field :deadline , :type => DateTime
|
field :deadline , :type => DateTime
|
||||||
# field :url
|
# field :url
|
||||||
field :cache_dept,type: Hash
|
|
||||||
|
|
||||||
field :create_user_id
|
field :create_user_id
|
||||||
field :update_user_id, :class_name => "User"
|
field :update_user_id, :class_name => "User"
|
||||||
|
@ -42,12 +42,6 @@ class Bulletin
|
||||||
scope :available_for_lang, ->(locale){ where("available_for_#{locale}".to_sym => true) }
|
scope :available_for_lang, ->(locale){ where("available_for_#{locale}".to_sym => true) }
|
||||||
|
|
||||||
mount_uploader :image, ImageUploader
|
mount_uploader :image, ImageUploader
|
||||||
|
|
||||||
|
|
||||||
# belongs_to :unit_list_for_anc
|
|
||||||
|
|
||||||
# embeds_many :bulletin_links, :cascade_callbacks => true
|
|
||||||
# embeds_many :bulletin_files, :cascade_callbacks => true
|
|
||||||
|
|
||||||
has_many :bulletin_links, :autosave => true, :dependent => :destroy
|
has_many :bulletin_links, :autosave => true, :dependent => :destroy
|
||||||
has_many :bulletin_files, :autosave => true, :dependent => :destroy
|
has_many :bulletin_files, :autosave => true, :dependent => :destroy
|
||||||
|
@ -58,9 +52,6 @@ class Bulletin
|
||||||
validates :title, :at_least_one => true
|
validates :title, :at_least_one => true
|
||||||
|
|
||||||
before_save :check_deadline, :update_avliable_language, :clean_values
|
before_save :check_deadline, :update_avliable_language, :clean_values
|
||||||
before_create :update_avliable_language
|
|
||||||
|
|
||||||
before_save :fetch_dept
|
|
||||||
|
|
||||||
searchable do
|
searchable do
|
||||||
text :titles do
|
text :titles do
|
||||||
|
@ -240,10 +231,6 @@ class Bulletin
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch_dept
|
|
||||||
self.cache_dept = (User.find(self.create_user_id).cache_dept rescue nil) if self.new_record?
|
|
||||||
end
|
|
||||||
|
|
||||||
def clean_values
|
def clean_values
|
||||||
self.bulletin_links.each do |link|
|
self.bulletin_links.each do |link|
|
||||||
|
|
|
@ -7,6 +7,38 @@
|
||||||
|
|
||||||
<div id="sub-wiget">
|
<div id="sub-wiget">
|
||||||
|
|
||||||
|
<div id="widget-picture" class="widget-box">
|
||||||
|
<div class="widget-action clear">
|
||||||
|
<a class="action"><i title="Upload pictures" class="icon-exclamation-sign icon-white tip"></i></a>
|
||||||
|
</div>
|
||||||
|
<h3 class="widget-title"><i class="icons-picture icons-white"></i><%= t('nccu.picture') %></h3>
|
||||||
|
<div class="widget-content clear">
|
||||||
|
<div class="control-group">
|
||||||
|
<!-- <img class="pull-left upload-picture" src="/assets/default-img.png" /> -->
|
||||||
|
<div class="upload-picture">
|
||||||
|
<% if @bulletin.image %>
|
||||||
|
<%= image_tag @bulletin.image rescue ''%>
|
||||||
|
<% else %>
|
||||||
|
<img class="pull-left upload-picture" src="/assets/default-img.png" />
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<span class="alert widgetInfo"><%= t("ad.widget_info_for_ad_image_size", :best_size=> "290px x 150px") %></span>
|
||||||
|
<div class="controls file-upload input-prepend">
|
||||||
|
<%= t(:browse) %>
|
||||||
|
<%= f.file_field :image, :id => "input-upload", :class => '', :onchange => "document.getElementById('fu').innerHTML = this.form.fu.value = this.value;" %>
|
||||||
|
<!-- <span id='fu' class="file-name"></span>
|
||||||
|
<br>
|
||||||
|
<input name='fu' class="input-medium" type="text">
|
||||||
|
<br> -->
|
||||||
|
<% if @bulletin.image.file %>
|
||||||
|
<%= f.check_box :remove_image %>
|
||||||
|
<%= t(:delete_file) %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="widget-date" class="widget-box widget-size-300">
|
<div id="widget-date" class="widget-box widget-size-300">
|
||||||
<div class="widget-action clear">
|
<div class="widget-action clear">
|
||||||
<a href="#" class="action"><i title="Set the announcement to start and end dates" class="icon-exclamation-sign icon-white tip"></i></a>
|
<a href="#" class="action"><i title="Set the announcement to start and end dates" class="icon-exclamation-sign icon-white tip"></i></a>
|
||||||
|
@ -127,6 +159,13 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="editor">
|
||||||
|
<%= f.label :subtitle, t(:subtitle) %>
|
||||||
|
<%= f.fields_for :subtitle_translations do |f| %>
|
||||||
|
<%= I18nVariable.from_locale(locale) %>
|
||||||
|
<%= f.text_area locale, :rows => 5, :style=>"width:100%", :value => (@bulletin.subtitle_translations[locale] rescue nil) %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="editor">
|
<div class="editor">
|
||||||
<%= f.label :text ,t(:text)%>
|
<%= f.label :text ,t(:text)%>
|
||||||
|
@ -214,23 +253,6 @@
|
||||||
<p><%= t("sys.limit_of_upload_file_size",:best_size => '3MB') %></p>
|
<p><%= t("sys.limit_of_upload_file_size",:best_size => '3MB') %></p>
|
||||||
<p><%= t("sys.preview_only_for_img") %></p>
|
<p><%= t("sys.preview_only_for_img") %></p>
|
||||||
</div>
|
</div>
|
||||||
<fieldset>
|
|
||||||
<input type="hidden" id="MAX_FILE_SIZE" name="MAX_FILE_SIZE" value="300000" />
|
|
||||||
<div id="filedrag">
|
|
||||||
<div class="point">Drop files here
|
|
||||||
<span>or</span>
|
|
||||||
<label class="file-select" for="fileselect">select from a folder
|
|
||||||
<!-- <input type="file" class="upload" id="fileselect" name="fileselect[]" multiple="multiple" /> -->
|
|
||||||
<%= f.fields_for @bulletin.bulletin_files.build do |f| %>
|
|
||||||
<%= f.file_field :file, :multiple => true, :class => 'upload', :id => 'fileselect' %>
|
|
||||||
<% end %>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="submitbutton">
|
|
||||||
<button type="submit">Upload Files</button>
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
<div>
|
<div>
|
||||||
<table class="table table-condensed">
|
<table class="table table-condensed">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
|
@ -16,12 +16,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="news_bulletin_file_qe">
|
|
||||||
<div id="modal-file" class="modal fade">
|
|
||||||
<%#= render :partial => "bulletin_file_qe" %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<% content_for :page_specific_javascript do %>
|
<% content_for :page_specific_javascript do %>
|
||||||
<%= javascript_include_tag "bulletin_form" %>
|
<%= javascript_include_tag "bulletin_form" %>
|
||||||
<%= javascript_include_tag "/static/jquery.cycle.all.latest.js" %>
|
<%= javascript_include_tag "/static/jquery.cycle.all.latest.js" %>
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
.bundle/
|
|
||||||
log/*.log
|
|
||||||
pkg/
|
|
||||||
test/dummy/db/*.sqlite3
|
|
||||||
test/dummy/log/*.log
|
|
||||||
test/dummy/tmp/
|
|
|
@ -1,17 +0,0 @@
|
||||||
source "http://rubygems.org"
|
|
||||||
|
|
||||||
# Declare your gem's dependencies in news.gemspec.
|
|
||||||
# Bundler will treat runtime dependencies like base dependencies, and
|
|
||||||
# development dependencies will be added by default to the :development group.
|
|
||||||
gemspec
|
|
||||||
|
|
||||||
# jquery-rails is used by the dummy application
|
|
||||||
gem "jquery-rails"
|
|
||||||
|
|
||||||
# Declare any dependencies that are still in development here instead of in
|
|
||||||
# your gemspec. These might include edge Rails or gems from your path or
|
|
||||||
# Git. Remember to move these dependencies to your gemspec before releasing
|
|
||||||
# your gem to rubygems.org.
|
|
||||||
|
|
||||||
# To use debugger
|
|
||||||
# gem 'ruby-debug19', :require => 'ruby-debug'
|
|
|
@ -1,20 +0,0 @@
|
||||||
Copyright 2011 YOURNAME
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
a copy of this software and associated documentation files (the
|
|
||||||
"Software"), to deal in the Software without restriction, including
|
|
||||||
without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be
|
|
||||||
included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
@ -1,3 +0,0 @@
|
||||||
= News
|
|
||||||
|
|
||||||
This project rocks and uses MIT-LICENSE.
|
|
|
@ -1,39 +0,0 @@
|
||||||
#!/usr/bin/env rake
|
|
||||||
begin
|
|
||||||
require 'bundler/setup'
|
|
||||||
rescue LoadError
|
|
||||||
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
|
||||||
end
|
|
||||||
begin
|
|
||||||
require 'rdoc/task'
|
|
||||||
rescue LoadError
|
|
||||||
require 'rdoc/rdoc'
|
|
||||||
require 'rake/rdoctask'
|
|
||||||
RDoc::Task = Rake::RDocTask
|
|
||||||
end
|
|
||||||
|
|
||||||
RDoc::Task.new(:rdoc) do |rdoc|
|
|
||||||
rdoc.rdoc_dir = 'rdoc'
|
|
||||||
rdoc.title = 'News'
|
|
||||||
rdoc.options << '--line-numbers'
|
|
||||||
rdoc.rdoc_files.include('README.rdoc')
|
|
||||||
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
||||||
end
|
|
||||||
|
|
||||||
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
|
||||||
load 'rails/tasks/engine.rake'
|
|
||||||
|
|
||||||
|
|
||||||
Bundler::GemHelper.install_tasks
|
|
||||||
|
|
||||||
require 'rake/testtask'
|
|
||||||
|
|
||||||
Rake::TestTask.new(:test) do |t|
|
|
||||||
t.libs << 'lib'
|
|
||||||
t.libs << 'test'
|
|
||||||
t.pattern = 'test/**/*_test.rb'
|
|
||||||
t.verbose = false
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
task :default => :test
|
|
|
@ -1,45 +0,0 @@
|
||||||
$(document).ready(function(){
|
|
||||||
var topic1="0px";
|
|
||||||
var topic2="-948px";
|
|
||||||
var topic3="-1896px";
|
|
||||||
var topic_page=1;
|
|
||||||
$(".topic_prev").addClass("topic_prev_first");
|
|
||||||
$(document).on("click", ".topic_prev", function() {
|
|
||||||
if (topic_page !=1){
|
|
||||||
topic_page-=1;
|
|
||||||
}else{
|
|
||||||
}
|
|
||||||
if (topic_page == 1){
|
|
||||||
$("#topic_list").stop().animate({"left": topic1}, "slow");
|
|
||||||
$(".topic_prev").addClass("topic_prev_first");
|
|
||||||
}
|
|
||||||
if (topic_page == 2){
|
|
||||||
$("#topic_list").stop().animate({"left": topic2}, "slow");
|
|
||||||
$(".topic_prev").removeClass("topic_prev_first");
|
|
||||||
$(".topic_next").removeClass("topic_next_last");
|
|
||||||
}
|
|
||||||
if (topic_page == 3){
|
|
||||||
$("#topic_list").stop().animate({"left": topic3}, "slow");
|
|
||||||
$(".topic_prev").removeClass("topic_next_last");
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
$(document).on("click", ".topic_next", function() {
|
|
||||||
if (topic_page >=1 && topic_page <=2){
|
|
||||||
topic_page+=1;
|
|
||||||
}else{
|
|
||||||
}
|
|
||||||
if (topic_page == 1){
|
|
||||||
$("#topic_list").stop().animate({"left": topic1}, "slow");
|
|
||||||
$(".topic_prev").addClass("topic_prev_first");
|
|
||||||
}
|
|
||||||
if (topic_page == 2){
|
|
||||||
$("#topic_list").stop().animate({"left": topic2}, "slow");
|
|
||||||
$(".topic_prev").removeClass("topic_prev_first");
|
|
||||||
}
|
|
||||||
if (topic_page == 3){
|
|
||||||
$("#topic_list").stop().animate({"left": topic3}, "slow");
|
|
||||||
$(".topic_next").addClass("topic_next_last");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,23 +0,0 @@
|
||||||
class ApplicationController < ActionController::Base
|
|
||||||
protect_from_forgery
|
|
||||||
before_filter :set_locale
|
|
||||||
|
|
||||||
# Set I18n.locale
|
|
||||||
def set_locale
|
|
||||||
# update session if passed
|
|
||||||
session[:locale] = params[:locale] if params[:locale]
|
|
||||||
|
|
||||||
# set locale based on session or default
|
|
||||||
begin
|
|
||||||
# check if locale is valid for non site pages
|
|
||||||
if !VALID_LOCALES.include?(session[:locale])
|
|
||||||
I18n.locale = I18n.default_locale
|
|
||||||
else
|
|
||||||
I18n.locale = session[:locale]
|
|
||||||
end
|
|
||||||
rescue
|
|
||||||
I18n.locale = I18n.default_locale
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,71 +0,0 @@
|
||||||
class Panel::News::BackEnd::NewsApprovalsController < OrbitBackendController
|
|
||||||
before_filter :authenticate_user!
|
|
||||||
before_filter :is_admin?
|
|
||||||
include AdminHelper
|
|
||||||
|
|
||||||
def preview_and_approve
|
|
||||||
@news_bulletin = NewsBulletin.find params[:news_bulletin_id]
|
|
||||||
end
|
|
||||||
|
|
||||||
def approve
|
|
||||||
notice = ""
|
|
||||||
@news_bulletin = NewsBulletin.find params[:news_bulletin_id]
|
|
||||||
@news_bulletin.proc_check(params[:news_bulletin][:is_checked],params[:news_bulletin][:not_checked_reason])
|
|
||||||
@news_bulletin.de_pending
|
|
||||||
if @news_bulletin.save
|
|
||||||
notice = t('approval.pass')
|
|
||||||
else
|
|
||||||
notice = t('approval.not_pass')
|
|
||||||
end
|
|
||||||
redirect_to(panel_news_back_end_news_bulletins_url,:notice => notice)
|
|
||||||
end
|
|
||||||
|
|
||||||
def setting
|
|
||||||
@sys_users = User.all(conditions: {admin: false}).includes(:avatar)
|
|
||||||
@news_bulletin_categorys = NewsBulletinCategory.all
|
|
||||||
@options_from_collection_for_select_news_bulletin_categorys = @news_bulletin_categorys.collect{|bc| [bc.title,bc.id] }
|
|
||||||
if params.has_key? :news_category
|
|
||||||
@news_bulletin_categorys = NewsBulletinCategory.find params[:news_category][:id]
|
|
||||||
else
|
|
||||||
@news_bulletin_categorys = @news_bulletin_categorys.first
|
|
||||||
end
|
|
||||||
preload_object_auth = @news_bulletin_categorys.get_object_auth_by_title('fact_check')
|
|
||||||
@users_array = preload_object_auth.privilege_users rescue []
|
|
||||||
respond_to do |format|
|
|
||||||
format.html
|
|
||||||
format.js
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def update_setting
|
|
||||||
object_auth = update_setting_by_params
|
|
||||||
if object_auth.save!
|
|
||||||
flash[:notice] = t('update.success_')
|
|
||||||
else
|
|
||||||
flash[:notice] = t('update.fail')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def user_list
|
|
||||||
@news_bulletin_category = NewsBulletinCategory.find params[:news_category][:id]
|
|
||||||
end
|
|
||||||
|
|
||||||
protected
|
|
||||||
def update_setting_by_params
|
|
||||||
category = NewsBulletinCategory.find params[:news_category][:id]
|
|
||||||
privilege_users = params[:users].collect{|key,value| User.find key } rescue []
|
|
||||||
object_auth_ary = category.object_auths.where(title: 'fact_check') || (category.object_auths.create :title=> 'fact_check')
|
|
||||||
object_auth = object_auth_ary.first
|
|
||||||
object_auth.privilege_users = privilege_users
|
|
||||||
object_auth
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_categorys(id = nil)
|
|
||||||
@news_bulletin_categorys = []
|
|
||||||
if(is_manager? || is_admin?)
|
|
||||||
@news_bulletin_categorys = (id ? NewsBulletinCategory.find(id).to_a : NewsBulletinCategory.all)
|
|
||||||
elsif is_sub_manager?
|
|
||||||
@news_bulletin_categorys = NewsBulletinCategory.authed_for_user(current_user,'submit_new')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,133 +0,0 @@
|
||||||
class Panel::News::BackEnd::NewsBulletinCategorysController < OrbitBackendController
|
|
||||||
include OrbitControllerLib::DivisionForDisable
|
|
||||||
before_filter :force_order_for_visitor,:only=>[:index]
|
|
||||||
before_filter :force_order_for_user,:except => [:index]
|
|
||||||
before_filter :for_app_sub_manager,:except => [:index]
|
|
||||||
|
|
||||||
|
|
||||||
def index
|
|
||||||
@news_bulletin_categorys = get_categories_for_index("NewsBulletinCategory")
|
|
||||||
#TODO 需要做 manager ,admin 才可以 all. 其他 available就好
|
|
||||||
|
|
||||||
@news_bulletin_category = NewsBulletinCategory.new(:display => 'List')
|
|
||||||
|
|
||||||
@url = panel_news_back_end_news_bulletin_categorys_path
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html # index.html.erb
|
|
||||||
# format.xml { render :xml => @news_bulletins }
|
|
||||||
format.js
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# GET /news_bulletins/1
|
|
||||||
# GET /news_bulletins/1.xml
|
|
||||||
def show
|
|
||||||
@news_bulletin_category = NewsBulletinCategory.find(params[:id])
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html # show.html.erb
|
|
||||||
# format.xml { render :xml => @news_bulletin_category }
|
|
||||||
format.js
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# GET /news_bulletins/new
|
|
||||||
# GET /news_bulletins/new.xml
|
|
||||||
def new
|
|
||||||
@news_bulletin_category = NewsBulletinCategory.new(:display => 'List')
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html # new.html.erb
|
|
||||||
# format.xml { render :xml => @news_bulletin_category }
|
|
||||||
format.js
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def quick_edit
|
|
||||||
# debugger
|
|
||||||
|
|
||||||
@news_bulletin_category = NewsBulletinCategory.find(params[:news_bulletin_category_id])
|
|
||||||
|
|
||||||
@url = panel_news_back_end_news_bulletin_category_path(@news_bulletin_category)
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.js
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
# GET /news_bulletins/1/edit
|
|
||||||
def edit
|
|
||||||
@news_bulletin_category = NewsBulletinCategory.find(params[:id])
|
|
||||||
|
|
||||||
@url = panel_news_back_end_news_bulletin_category_path(@news_bulletin_category)
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html
|
|
||||||
format.js
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# POST /news_bulletins
|
|
||||||
# POST /news_bulletins.xml
|
|
||||||
def create
|
|
||||||
@news_bulletin_category = NewsBulletinCategory.new(params[:news_bulletin_category])
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
if @news_bulletin_category.save
|
|
||||||
# format.html { redirect_to @news_bulletin_category, notice: 'Entry was successfully created.' }
|
|
||||||
format.html { redirect_to(panel_news_back_end_news_bulletin_categorys_url, :notice => t('news_bulletin.create_news_bulletin_category_success')) }
|
|
||||||
# format.xml { render :xml => @news_bulletin_category, :status => :created, :location => @news_bulletin_category }
|
|
||||||
format.js
|
|
||||||
else
|
|
||||||
format.html { render :action => "new" }
|
|
||||||
# format.xml { render :xml => @news_bulletin_category.errors, :status => :unprocessable_entity }
|
|
||||||
format.js { render action: "new" }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# PUT /news_bulletins/1
|
|
||||||
# PUT /news_bulletins/1.xml
|
|
||||||
def update
|
|
||||||
@news_bulletin_category = NewsBulletinCategory.find(params[:id])
|
|
||||||
|
|
||||||
@url = panel_news_back_end_news_bulletin_category_path(@news_bulletin_category)
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
if @news_bulletin_category.update_attributes(params[:news_bulletin_category])
|
|
||||||
# format.html { redirect_to(panel_news_back_end_news_bulletin_category_url(@news_bulletin_category), :notice => t('news_bulletin_category.update_news_bulletin_category_success')) }
|
|
||||||
# format.html { redirect_to(panel_news_back_end_news_bulletin_categorys_url, :notice => t('news_bulletin_category.update_news_bulletin_category_success')) }
|
|
||||||
# format.xml { head :ok }
|
|
||||||
format.js
|
|
||||||
else
|
|
||||||
format.html { render :action => "edit" }
|
|
||||||
format.js { render :action => "edit" }
|
|
||||||
# format.xml { render :xml => @news_bulletin_category.errors, :status => :unprocessable_entity }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# DELETE /news_bulletins/1
|
|
||||||
# DELETE /news_bulletins/1.xml
|
|
||||||
def destroy
|
|
||||||
@news_bulletin_category = NewsBulletinCategory.find(params[:id])
|
|
||||||
@news_bulletin_category.disable = @news_bulletin_category.disable ? false : true
|
|
||||||
|
|
||||||
if @news_bulletin_category.save!
|
|
||||||
expire_page(:controller=>'panel/news/widget/news_bulletins' , :action=>'home_banner')
|
|
||||||
respond_to do |format|
|
|
||||||
flash[:notice] = t("update.success_")
|
|
||||||
# flash[:error] += @bulletin_category.disable ? t(enable) : t(disable)
|
|
||||||
format.html { redirect_to(panel_announcement_back_end_news_bulletin_categorys_url) }
|
|
||||||
# format.xml { head :ok }
|
|
||||||
format.js
|
|
||||||
end
|
|
||||||
else
|
|
||||||
flash[:error] = t("update.fail")
|
|
||||||
format.html { render :action => "index" }
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,48 +0,0 @@
|
||||||
class Panel::News::BackEnd::NewsBulletinFilesController < ApplicationController
|
|
||||||
|
|
||||||
layout 'new_admin'
|
|
||||||
|
|
||||||
def index
|
|
||||||
@news_bulletin_files = NewsBulletinFile.all
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html # index.html.erb
|
|
||||||
# format.xml { render :xml => @news_bulletins }
|
|
||||||
format.js
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
# POST /news_bulletins
|
|
||||||
# POST /news_bulletins.xml
|
|
||||||
def create
|
|
||||||
@news_bulletin_file = NewsBulletinFile.new(params[:news_bulletin_file])
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
if @news_bulletin_file.save
|
|
||||||
format.html { redirect_to(panel_news_back_end_news_bulletins_url) }
|
|
||||||
format.js
|
|
||||||
else
|
|
||||||
format.html { render :action => "new" }
|
|
||||||
format.js { render action: "new" }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# PUT /news_bulletins/1
|
|
||||||
# PUT /news_bulletins/1.xml
|
|
||||||
def update
|
|
||||||
@news_bulletin_file = NewsBulletinFile.find(params[:id])
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
if @news_bulletin_file.update_attributes(params[:news_bulletin_file])
|
|
||||||
format.html { redirect_to(panel_news_back_end_news_bulletins_url) }
|
|
||||||
format.js
|
|
||||||
else
|
|
||||||
format.html { render :action => "edit" }
|
|
||||||
format.js { render :action => "edit" }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,49 +0,0 @@
|
||||||
class Panel::News::BackEnd::NewsBulletinLinksController < ApplicationController
|
|
||||||
|
|
||||||
layout 'new_admin'
|
|
||||||
|
|
||||||
def index
|
|
||||||
@news_bulletin_links = NewsBulletinLink.all
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html # index.html.erb
|
|
||||||
# format.xml { render :xml => @news_bulletins }
|
|
||||||
format.js
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
# POST /news_bulletins
|
|
||||||
# POST /news_bulletins.xml
|
|
||||||
def create
|
|
||||||
@news_bulletin_link = NewsBulletinLink.new(params[:news_bulletin_link])
|
|
||||||
# @news_bulletin_link.news_bulletin_id = params[:news_bulletin_link][:news_bulletin_id]
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
if @news_bulletin_link.save
|
|
||||||
format.html { redirect_to(panel_news_back_end_news_bulletins_url) }
|
|
||||||
format.js
|
|
||||||
else
|
|
||||||
format.html { render :action => "new" }
|
|
||||||
format.js { render action: "new" }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# PUT /news_bulletins/1
|
|
||||||
# PUT /news_bulletins/1.xml
|
|
||||||
def update
|
|
||||||
@news_bulletin_link = NewsBulletinLink.find(params[:id])
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
if @news_bulletin_link.update_attributes(params[:news_bulletin_link])
|
|
||||||
format.html { redirect_to(panel_news_back_end_news_bulletins_url) }
|
|
||||||
format.js
|
|
||||||
else
|
|
||||||
format.html { render :action => "edit" }
|
|
||||||
format.js { render :action => "edit" }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,407 +0,0 @@
|
||||||
class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
|
||||||
include OrbitControllerLib::DivisionForDisable
|
|
||||||
|
|
||||||
# before_filter :for_admin_only,:only => [:]
|
|
||||||
# before_filter :for_app_manager,:only => [:index,:show,]
|
|
||||||
before_filter :force_order_for_visitor,:only=>[:index,:show,:get_sorted_and_filtered_news_bulletins]
|
|
||||||
before_filter :force_order_for_user,:except => [:index,:show,:get_sorted_and_filtered_news_bulletins]
|
|
||||||
before_filter :for_app_sub_manager,:except => [:index,:show,:get_sorted_and_filtered_news_bulletins]
|
|
||||||
before_filter :only => [ :new,:edit,:update,:create] do |controller|
|
|
||||||
controller.get_categorys('NewsBulletinCategory')
|
|
||||||
controller.get_unit_list
|
|
||||||
end
|
|
||||||
before_filter :clean_values, :only => [:create, :update]
|
|
||||||
|
|
||||||
def preview
|
|
||||||
#@preview_obj = Preview.create(:object=>params[:news_bulletin],:expired_at=>DateTime.now+30.minutes,:preview_at_link=>"panel_news_front_end_news_bulletin_path",:object_class_type=>"NewsBulletin")
|
|
||||||
news_bulletin = NewsBulletin.new params
|
|
||||||
@preview_obj = news_bulletin.to_preview
|
|
||||||
@preview_obj.save
|
|
||||||
render '/shared/preview/preview.html.erb', :layout=>false
|
|
||||||
end
|
|
||||||
|
|
||||||
def index
|
|
||||||
# @news_bulletins = NewsBulletin.all
|
|
||||||
# @news_bulletins = NewsBulletin.desc("postdate desc")
|
|
||||||
get_categorys("NewsBulletinCategory",params[:news_bulletin_category_id])
|
|
||||||
get_tags
|
|
||||||
|
|
||||||
@filter = params[:filter]
|
|
||||||
new_filter = params[:new_filter]
|
|
||||||
|
|
||||||
if @filter && params[:clear]
|
|
||||||
@filter.delete(params[:type])
|
|
||||||
elsif @filter && new_filter
|
|
||||||
if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s)
|
|
||||||
@filter[new_filter[:type]].delete(new_filter[:id].to_s)
|
|
||||||
elsif @filter.has_key?(new_filter[:type])
|
|
||||||
@filter[new_filter[:type]] << new_filter[:id].to_s
|
|
||||||
else
|
|
||||||
@filter.merge!({new_filter[:type] => [new_filter[:id].to_s]})
|
|
||||||
end
|
|
||||||
elsif new_filter
|
|
||||||
@filter = {new_filter[:type] => [new_filter[:id].to_s]}
|
|
||||||
end
|
|
||||||
|
|
||||||
# @news_bulletins = NewsBulletin.where("news_bulletin_category_id" => params[:news_bulletin_category_id]).desc("postdate") if params[:news_bulletin_category_id]
|
|
||||||
|
|
||||||
# @news_bulletins = NewsBulletin.search(params[:search], params[:category_id])
|
|
||||||
# @news_bulletins = NewsBulletin.all.order_by([params[:sort], params[:direction]])
|
|
||||||
|
|
||||||
|
|
||||||
# @news_bulletins = (params[:sort] || @filter) ? get_sorted_and_filtered_news_bulletins : NewsBulletin.all.page(params[:page]).per(10)
|
|
||||||
|
|
||||||
@news_bulletin_categories = get_categories_for_index("NewsBulletinCategory")
|
|
||||||
@news_bulletin_category_ids = @news_bulletin_categories.collect{|t| t.id.to_s} + [nil]
|
|
||||||
|
|
||||||
|
|
||||||
@news_bulletins = (params[:sort] || @filter) ? get_sorted_and_filtered("news_bulletin",:news_bulletin_category_id.in => @news_bulletin_category_ids) : get_viewable("news_bulletin",:news_bulletin_category_id.in => @news_bulletin_category_ids)
|
|
||||||
|
|
||||||
@news_bulletin_link = NewsBulletinLink.new
|
|
||||||
@link_url = panel_news_back_end_news_bulletins_path
|
|
||||||
|
|
||||||
@news_bulletin_file = NewsBulletinFile.new
|
|
||||||
@file_url = panel_news_back_end_news_bulletins_path
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html # index.html.erb
|
|
||||||
format.js { }
|
|
||||||
format.xml { render :xml => @news_bulletins }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# GET /news_bulletins/1
|
|
||||||
# GET /news_bulletins/1.xml
|
|
||||||
def show
|
|
||||||
@news_bulletin = NewsBulletin.find(params[:id])
|
|
||||||
get_tags
|
|
||||||
# get_categorys
|
|
||||||
|
|
||||||
# @news_bulletin_categorys = NewsBulletinCategory.where("_id" => params[:id])
|
|
||||||
|
|
||||||
# if params[:id]
|
|
||||||
# @news_bulletins = NewsBulletin.where("news_bulletin_category_id" => params[:id])
|
|
||||||
# else
|
|
||||||
# @news_bulletins = NewsBulletin.desc("postdate desc")
|
|
||||||
# end
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html # show.html.erb
|
|
||||||
format.xml { render :xml => @news_bulletin }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# GET /news_bulletins/new
|
|
||||||
# GET /news_bulletins/new.xml
|
|
||||||
def new
|
|
||||||
if(session[:in_validate_object].blank?)
|
|
||||||
@news_bulletin = NewsBulletin.new
|
|
||||||
else
|
|
||||||
@news_bulletin = session[:in_validate_object]
|
|
||||||
session[:in_validate_object] = {}
|
|
||||||
end
|
|
||||||
@link_url = panel_news_back_end_news_bulletins_path
|
|
||||||
|
|
||||||
# @news_bulletin.news_bulletin_files.build
|
|
||||||
# @news_bulletin.news_bulletin_files.new
|
|
||||||
|
|
||||||
get_tags
|
|
||||||
respond_to do |format|
|
|
||||||
format.html # new.html.erb
|
|
||||||
format.xml { render :xml => @news_bulletin }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# GET /news_bulletins/1/edit
|
|
||||||
def edit
|
|
||||||
@news_bulletin = NewsBulletin.find(params[:id])
|
|
||||||
if !current_user.admin? && (@news_bulletin.is_rejected? || @news_bulletin.is_checked?)
|
|
||||||
redirect_to :action => :index
|
|
||||||
else
|
|
||||||
# @summary_variable = @news_bulletin.summary_variable
|
|
||||||
|
|
||||||
@link_url = panel_news_back_end_news_bulletin_path(@news_bulletin)
|
|
||||||
|
|
||||||
get_tags
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# POST /news_bulletins
|
|
||||||
# POST /news_bulletins.xml
|
|
||||||
def create
|
|
||||||
get_tags
|
|
||||||
|
|
||||||
if params[:news_bulletin_link]
|
|
||||||
|
|
||||||
@news_bulletin_link = NewsBulletinLink.new(params[:news_bulletin_link])
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
if @news_bulletin_link.save
|
|
||||||
format.js { render 'create_news_bulletin_link' }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
elsif params[:news_bulletin_file]
|
|
||||||
|
|
||||||
@news_bulletin_file = NewsBulletinFile.new(params[:news_bulletin_file])
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
if @news_bulletin_file.save
|
|
||||||
expire_page(:controller=>'panel/news/widget/news_bulletins' , :action=>'home_banner')
|
|
||||||
format.js { render 'create_news_bulletin_file' }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
@news_bulletin = NewsBulletin.new(params[:news_bulletin])
|
|
||||||
@news_bulletin.deadline = nil if (@news_bulletin.deadline < @news_bulletin.postdate rescue nil)
|
|
||||||
|
|
||||||
@news_bulletin.create_user_id = current_user.id
|
|
||||||
@news_bulletin.update_user_id = current_user.id
|
|
||||||
|
|
||||||
if(is_manager? || is_admin?)
|
|
||||||
@news_bulletin.is_checked = true
|
|
||||||
@news_bulletin.is_rejected = false
|
|
||||||
@news_bulletin.de_pending
|
|
||||||
end
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
if @news_bulletin.save
|
|
||||||
expire_page(:controller=>'panel/news/widget/news_bulletins' , :action=>'home_banner')
|
|
||||||
format.html { redirect_to(panel_news_back_end_news_bulletins_url, :notice => t('news_bulletin.create_news_bulletin_success')) }
|
|
||||||
format.xml { render :xml => @news_bulletin, :status => :created, :location => @news_bulletin }
|
|
||||||
format.js
|
|
||||||
#format.json {render :json => {"success"=>"true","redirect_url"=>panel_news_back_end_news_bulletins_url,"notice" => t('news_bulletin.create_news_bulletin_success')}}
|
|
||||||
else
|
|
||||||
format.html { render :action => "new" }
|
|
||||||
format.xml { render :xml => @news_bulletin.errors, :status => :unprocessable_entity }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
def link_quick_add
|
|
||||||
# debugger
|
|
||||||
|
|
||||||
@news_bulletin_link = NewsBulletinLink.new
|
|
||||||
@link_url = panel_news_back_end_news_bulletins_path
|
|
||||||
|
|
||||||
@news_bulletin_link.news_bulletin_id = params[:news_bulletin_id]
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.js
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
def link_quick_edit
|
|
||||||
# debugger
|
|
||||||
@news_bulletin_link = NewsBulletinLink.find(params[:news_bulletin_id])
|
|
||||||
|
|
||||||
@link_url = panel_news_back_end_news_bulletin_path(@news_bulletin_link)
|
|
||||||
|
|
||||||
# @news_bulletin = NewsBulletin.find(params[:news_bulletin_id])
|
|
||||||
|
|
||||||
# @link_url = panel_news_back_end_news_bulletin_path(@news_bulletin)
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.js
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
def file_quick_add
|
|
||||||
# debugger
|
|
||||||
|
|
||||||
@news_bulletin_file = NewsBulletinFile.new
|
|
||||||
@file_url = panel_news_back_end_news_bulletins_path
|
|
||||||
|
|
||||||
@news_bulletin_file.news_bulletin_id = params[:news_bulletin_id]
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.js
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
def file_quick_edit
|
|
||||||
# debugger
|
|
||||||
@news_bulletin_file = NewsBulletinFile.find(params[:news_bulletin_id])
|
|
||||||
|
|
||||||
@file_url = panel_news_back_end_news_bulletin_path(@news_bulletin_file)
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.js
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# PUT /news_bulletins/1
|
|
||||||
# PUT /news_bulletins/1.xml
|
|
||||||
def update
|
|
||||||
if params[:news_bulletin_link]
|
|
||||||
|
|
||||||
@news_bulletin_link = NewsBulletinLink.find(params[:id])
|
|
||||||
|
|
||||||
@link_url = panel_news_back_end_news_bulletin_path(@news_bulletin_link)
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
if @news_bulletin_link.update_attributes(params[:news_bulletin_link])
|
|
||||||
expire_page(:controller=>'panel/news/widget/news_bulletins' , :action=>'home_banner')
|
|
||||||
# format.html { redirect_to(panel_news_back_end_news_bulletins_url) }
|
|
||||||
format.js { render 'update_news_bulletin_link' }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
elsif params[:news_bulletin_file]
|
|
||||||
|
|
||||||
@news_bulletin_file = NewsBulletinFile.find(params[:id])
|
|
||||||
|
|
||||||
@file_url = panel_news_back_end_news_bulletin_path(@news_bulletin_file)
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
if @news_bulletin_file.update_attributes(params[:news_bulletin_file])
|
|
||||||
expire_page(:controller=>'panel/news/widget/news_bulletins' , :action=>'home_banner')
|
|
||||||
# format.html { redirect_to(panel_news_back_end_news_bulletins_url) }
|
|
||||||
format.js { render 'update_news_bulletin_file' }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
@news_bulletin = NewsBulletin.find(params[:id])
|
|
||||||
@news_bulletin.deadline = nil if (@news_bulletin.deadline < @news_bulletin.postdate rescue nil)
|
|
||||||
|
|
||||||
@news_bulletin.update_user_id = current_user.id
|
|
||||||
|
|
||||||
# @news_bulletin.image.clear if params[:news_bulletin][:image_del] == '1'
|
|
||||||
# if params[:news_bulletin][:image_del] == '1'
|
|
||||||
# @news_bulletin.remove_image!
|
|
||||||
# @news_bulletin.image_del = nil
|
|
||||||
# params[:news_bulletin][:image_del] = nil
|
|
||||||
# end
|
|
||||||
delete_out_invalid_date_from_params
|
|
||||||
respond_to do |format|
|
|
||||||
if @news_bulletin.update_attributes(params[:news_bulletin])
|
|
||||||
if(is_manager? || is_admin?)
|
|
||||||
@news_bulletin.is_checked = true
|
|
||||||
@news_bulletin.is_rejected = false
|
|
||||||
@news_bulletin.de_pending!
|
|
||||||
end
|
|
||||||
expire_page(:controller=>'panel/news/widget/news_bulletins' , :action=>'home_banner')
|
|
||||||
# format.html { redirect_to(panel_news_back_end_news_bulletin_url(@news_bulletin), :notice => t('news_bulletin.update_news_bulletin_success')) }
|
|
||||||
format.html { redirect_to(panel_news_back_end_news_bulletins_url, :notice => t('update.success_')) }
|
|
||||||
format.js { render 'toggle_enable' }
|
|
||||||
format.xml { head :ok }
|
|
||||||
else
|
|
||||||
get_tags
|
|
||||||
|
|
||||||
format.html { render :action => "edit" }
|
|
||||||
format.xml { render :xml => @news_bulletin.errors, :status => :unprocessable_entity }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
# DELETE /news_bulletins/1
|
|
||||||
# DELETE /news_bulletins/1.xml
|
|
||||||
def destroy
|
|
||||||
@news_bulletin = NewsBulletin.find(params[:id])
|
|
||||||
# @news_bulletin.news_bulletin_files.destroy
|
|
||||||
@news_bulletin.destroy
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
expire_page(:controller=>'panel/news/widget/news_bulletins' , :action=>'home_banner')
|
|
||||||
format.html { redirect_to(panel_news_back_end_news_bulletins_url) }
|
|
||||||
# format.xml { head :ok }
|
|
||||||
format.js
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# def top_edit
|
|
||||||
|
|
||||||
# NewsBulletin.where(id: params[:id]).update_all( is_top: true )
|
|
||||||
# respond_to do |format|
|
|
||||||
# format.html { redirect_to(panel_news_back_end_news_bulletins_url) }
|
|
||||||
# format.xml { head :ok }
|
|
||||||
# end
|
|
||||||
|
|
||||||
# end
|
|
||||||
|
|
||||||
|
|
||||||
def load_quick_edit
|
|
||||||
@news_bulletin = NewsBulletin.find(params[:id])
|
|
||||||
@type = params[:type]
|
|
||||||
@news_bulletin_categories = NewsBulletinCategory.all
|
|
||||||
#TODO 需要做 manager ,admin 才可以 all. 其他 available就好
|
|
||||||
|
|
||||||
get_tags
|
|
||||||
end
|
|
||||||
|
|
||||||
def delete
|
|
||||||
if params[:ids]
|
|
||||||
news_bulletins = NewsBulletin.any_in(:_id => params[:ids]).delete_all
|
|
||||||
end
|
|
||||||
redirect_to panel_news_back_end_news_bulletins_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
protected
|
|
||||||
|
|
||||||
def delete_out_invalid_date_from_params
|
|
||||||
if((params[:news_bulletin]["deadline(1i)"] && params[:news_bulletin]["deadline(1i)"].blank?) or (params[:news_bulletin]["deadline(2i)"] && params[:news_bulletin]["deadline(2i)"].blank?) or (params[:news_bulletin]["deadline(3i)"] && params[:news_bulletin]["deadline(3i)"].blank?))
|
|
||||||
params[:news_bulletin].delete("deadline(1i)")
|
|
||||||
params[:news_bulletin].delete("deadline(2i)")
|
|
||||||
params[:news_bulletin].delete("deadline(3i)")
|
|
||||||
@news_bulletin.deadline = nil
|
|
||||||
end rescue nil
|
|
||||||
end
|
|
||||||
|
|
||||||
# def get_categories_for_index(id = nil)
|
|
||||||
# @news_bulletin_categories = []
|
|
||||||
# if(is_manager? || is_admin?)
|
|
||||||
# @news_bulletin_categories = (id ? NewsBulletinCategory.admin_manager_all.find(id).to_a : NewsBulletinCategory.admin_manager_all)
|
|
||||||
# elsif is_sub_manager?
|
|
||||||
# @news_bulletin_categories = NewsBulletinCategory.all
|
|
||||||
# end
|
|
||||||
# @news_bulletin_categories
|
|
||||||
# end
|
|
||||||
|
|
||||||
# def get_categorys(id = nil)
|
|
||||||
# @news_bulletin_categorys = []
|
|
||||||
# @unit_list_for_anc = UnitListForAnc.all
|
|
||||||
# if(is_manager? || is_admin?)
|
|
||||||
# @news_bulletin_categorys = (id ? NewsBulletinCategory.admin_manager_all.find(id).to_a : NewsBulletinCategory.admin_manager_all)
|
|
||||||
# elsif is_sub_manager?
|
|
||||||
# @news_bulletin_categorys = NewsBulletinCategory.all.authed_for_user(current_user,'submit')
|
|
||||||
# end
|
|
||||||
# if @news_bulletin_categorys.empty? && params[:action] != "index"
|
|
||||||
# flash[:alert] = t("news_bulletin.error.no_avilb_cate_for_posting")
|
|
||||||
# redirect_to :action => :index
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
def get_unit_list
|
|
||||||
@unit_list_for_anc = UnitListForAnc.all
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_tags
|
|
||||||
module_app = ModuleApp.first(:conditions => {:key => 'news'})
|
|
||||||
@tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc) rescue []
|
|
||||||
end
|
|
||||||
|
|
||||||
def clean_values
|
|
||||||
if params[:news_bulletin]
|
|
||||||
params[:news_bulletin][:news_bulletin_links_attributes].each_with_index do |link, index|
|
|
||||||
params[:news_bulletin][:news_bulletin_links_attributes].delete(index.to_s) if link[1]['url'].blank? and link[1]['title'].blank?
|
|
||||||
end rescue nil
|
|
||||||
params[:news_bulletin][:news_bulletin_files_attributes].each_with_index do |link, index|
|
|
||||||
params[:news_bulletin][:news_bulletin_files_attributes].delete(index.to_s) if link[1]['file'].blank? and link[1]['title'].blank?
|
|
||||||
end rescue nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,8 +0,0 @@
|
||||||
class Panel::News::BackEnd::TagsController < Admin::TagsController
|
|
||||||
|
|
||||||
def initialize
|
|
||||||
super
|
|
||||||
@app_title = 'news'
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,83 +0,0 @@
|
||||||
class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController
|
|
||||||
|
|
||||||
def initialize
|
|
||||||
super
|
|
||||||
@app_title = 'news'
|
|
||||||
end
|
|
||||||
|
|
||||||
# GET /news_bulletins
|
|
||||||
# GET /news_bulletins.xml
|
|
||||||
|
|
||||||
def index_news_bulletins_by_unit
|
|
||||||
@page = Page.find(params[:page_id]) rescue nil
|
|
||||||
@news_bulletins=NewsBulletin.all.available_for_lang(I18n.locale).can_display.where("unit_list_for_anc_id"=>params[:name]).page( params[:page_main]).per(15).page( params[:page_main]).per(10)
|
|
||||||
render :index
|
|
||||||
end
|
|
||||||
|
|
||||||
def index
|
|
||||||
@page = Page.find(params[:page_id]) rescue nil
|
|
||||||
if !params[:search_query].blank?
|
|
||||||
# search_cond = {:is_checked=>true,:is_hidden=>false,:is_pending=>false,:is_pending=>false}
|
|
||||||
# search_cond.merge!({:news_bulletin_category_id => "#{params[:category_id]}" }) if !params[:category_id].blank?
|
|
||||||
@search = NewsBulletin.solr_search do
|
|
||||||
fulltext params[:search_query]
|
|
||||||
with(:frontend_search,true)
|
|
||||||
with(:available_lang).any_of([I18n.locale.to_s])
|
|
||||||
end
|
|
||||||
|
|
||||||
search_result = @search.results.collect{|result| result.id}
|
|
||||||
@news_bulletins = NewsBulletin.all.available_for_lang(I18n.locale).can_display.any_in(_id:search_result).desc(:postdate).page( params[:page_main]).per(10)
|
|
||||||
else
|
|
||||||
date_now = Time.now
|
|
||||||
if !params[:category_id].blank? && !params[:tag_id].blank?
|
|
||||||
@tag = NewsTag.find(params[:tag_id]) rescue nil
|
|
||||||
@tag = NewsTag.where(key: params[:tag_id])[0] unless @tag
|
|
||||||
@news_bulletins = @tag.news_bulletins.available_for_lang(I18n.locale).can_display.where(:news_bulletin_category_id => params[:category_id]).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)
|
|
||||||
@current_category = NewsBulletinCategory.from_id(params[:category_id]) rescue nil
|
|
||||||
elsif !params[:category_id].blank?
|
|
||||||
@news_bulletins = NewsBulletin.all.available_for_lang(I18n.locale).can_display.where(:news_bulletin_category_id => params[:category_id]).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)
|
|
||||||
@current_category = NewsBulletinCategory.from_id(params[:category_id]) rescue nil
|
|
||||||
elsif !params[:tag_id].blank?
|
|
||||||
@tag = NewsTag.find(params[:tag_id]) rescue nil
|
|
||||||
@tag = NewsTag.where(key: params[:tag_id])[0] unless @tag
|
|
||||||
@news_bulletins = @tag.news_bulletins.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)
|
|
||||||
else
|
|
||||||
@news_bulletins = NewsBulletin.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
|
|
||||||
impressionist(@tag) if @tag
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def show
|
|
||||||
if params[:preview] == "true"
|
|
||||||
preview_content
|
|
||||||
else
|
|
||||||
''
|
|
||||||
@news_bulletin = NewsBulletin.all.can_display.where(_id: params[:id]).first
|
|
||||||
if !@news_bulletin.disable? and !@news_bulletin.is_rejected
|
|
||||||
if @news_bulletin.enabled_for_lang(I18n.locale.to_s)
|
|
||||||
impressionist(@news_bulletin)
|
|
||||||
get_categorys
|
|
||||||
else
|
|
||||||
render :text => "<div class='alert alert-error'>#{t('sys.can_not_display_due_to_no_context')}</div>".html_safe
|
|
||||||
end
|
|
||||||
else
|
|
||||||
render :nothing => true, :status => 403
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def preview_content
|
|
||||||
@news_bulletin = NewsBulletin.find params[:id] rescue nil
|
|
||||||
@news_bulletin = Preview.find(params[:id]).get_virtual_object if @news_bulletin.nil?
|
|
||||||
get_categorys
|
|
||||||
end
|
|
||||||
|
|
||||||
protected
|
|
||||||
|
|
||||||
def get_categorys
|
|
||||||
@news_bulletin_categorys = NewsBulletinCategory.all
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,73 +0,0 @@
|
||||||
class Panel::News::Widget::NewsBulletinsController < OrbitWidgetController
|
|
||||||
# caches_page :home_banner
|
|
||||||
|
|
||||||
def initialize
|
|
||||||
super
|
|
||||||
@app_title = 'news'
|
|
||||||
end
|
|
||||||
|
|
||||||
# GET /news_bulletins
|
|
||||||
# GET /news_bulletins.xml
|
|
||||||
|
|
||||||
def index
|
|
||||||
@title = params[:part_title]
|
|
||||||
date_now = Time.now
|
|
||||||
if !params[:category_id].blank?
|
|
||||||
@news_bulletins = NewsBulletin.all.available_for_lang(I18n.locale).can_display.where(:news_bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(5)
|
|
||||||
@current_category = NewsBulletinCategory.from_id(params[:category_id]) rescue nil
|
|
||||||
elsif !params[:tag_id].blank?
|
|
||||||
@tag = NewsTag.find(params[:tag_id]) rescue nil
|
|
||||||
@tag = NewsTag.where(key: params[:tag_id])[0] unless @tag
|
|
||||||
@news_bulletins = @tag.news_bulletins.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]).per(5) rescue nil
|
|
||||||
else
|
|
||||||
@news_bulletins = NewsBulletin.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]).per(5)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
def news_bulletins_and_web_links
|
|
||||||
@tags = NewsTag.all
|
|
||||||
@selected_tag = NewsTag.find(params[:id]) rescue @tags[0]
|
|
||||||
@news_bulletins = @selected_tag.get_visible_news_bulletins(:postdate).available_for_lang(I18n.locale).can_display.page(params[:page]).per(5) rescue nil
|
|
||||||
@web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links(:created_at).page(params[:page]).per(5) rescue nil
|
|
||||||
end
|
|
||||||
|
|
||||||
def reload_news_bulletins
|
|
||||||
@selected_tag = NewsTag.find(params[:tag_id])
|
|
||||||
@news_bulletins = @selected_tag.get_visible_news_bulletins(:postdate).available_for_lang(I18n.locale).can_display.page(params[:page]).per(5) rescue nil
|
|
||||||
end
|
|
||||||
|
|
||||||
def reload_web_links
|
|
||||||
@selected_tag = NewsTag.find(params[:tag_id])
|
|
||||||
@web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links(:created_at).page(params[:page]).per(5) rescue nil
|
|
||||||
end
|
|
||||||
|
|
||||||
def news_bulletins_side_bar
|
|
||||||
@tags_and_class = NewsTag.sorted_for_cloud
|
|
||||||
get_categorys
|
|
||||||
end
|
|
||||||
|
|
||||||
def news_bulletins_search_block
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
def home_banner
|
|
||||||
if !params[:category_id].blank?
|
|
||||||
@news_bulletins = NewsBulletin.all.available_for_lang(I18n.locale).can_display.where(:news_bulletin_category_id => params[:category_id]).widget_datas.limit(9)
|
|
||||||
elsif !params[:tag_id].blank?
|
|
||||||
@news_bulletins = NewsTag.find(params[:tag_id]).news_bulletins.available_for_lang(I18n.locale).can_display.widget_datas.limit(9) rescue nil
|
|
||||||
else
|
|
||||||
@news_bulletins = NewsBulletin.all.available_for_lang(I18n.locale).can_display.widget_datas.limit(9)
|
|
||||||
end
|
|
||||||
get_categorys
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
protected
|
|
||||||
|
|
||||||
def get_categorys
|
|
||||||
@news_bulletin_categorys = NewsBulletinCategory.all
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,17 +0,0 @@
|
||||||
module Panel::News::BackEnd::NewsBulletinCategorysHelper
|
|
||||||
include ActionView::Helpers::UrlHelper
|
|
||||||
|
|
||||||
|
|
||||||
def show_news_cate_permission_link(news_bulletin_category)
|
|
||||||
type = 'submit'
|
|
||||||
oa = news_bulletin_category.get_object_auth_by_title(type)
|
|
||||||
if oa.nil?
|
|
||||||
news_bulletin_category.object_auths.new(title: type ).save
|
|
||||||
oa = news_bulletin_category.get_object_auth_by_title(type)
|
|
||||||
end
|
|
||||||
# link_to t(:category_auth), edit_admin_object_auth_path(oa)
|
|
||||||
link_to t(:category_auth),admin_object_auth_ob_auth_path(oa)
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,33 +0,0 @@
|
||||||
module Panel::News::BackEnd::NewsBulletinsHelper
|
|
||||||
def news_show_reject_reason(news_bulletin)
|
|
||||||
by_news_bulletin = news_bulletin.is_rejected
|
|
||||||
by_user = (((news_bulletin.create_user_id == current_user.id) rescue nil) or is_manager? or is_admin?)
|
|
||||||
by_news_bulletin && by_user
|
|
||||||
end
|
|
||||||
def news_show_form_status_field(news_bulletin)
|
|
||||||
#by_news_bulletin = (!news_bulletin.is_expired? and news_bulletin.is_pending?)
|
|
||||||
by_user = ((news_bulletin.news_bulletin_category.authed_users('fact_check').include?(current_user) rescue nil) or is_manager? or is_admin?)
|
|
||||||
by_user
|
|
||||||
end
|
|
||||||
|
|
||||||
def news_show_approval_link(news_bulletin)
|
|
||||||
by_news_bulletin = (!news_bulletin.is_expired? and news_bulletin.is_pending?)
|
|
||||||
by_user = ((news_bulletin.news_bulletin_category.authed_users('fact_check').include?(current_user) rescue nil) or is_manager? or is_admin?)
|
|
||||||
by_news_bulletin and by_user
|
|
||||||
end
|
|
||||||
|
|
||||||
def news_show_delete_link(news_bulletin)
|
|
||||||
by_news_bulletin = current_user.nil? ? false : (news_bulletin.create_user_id == current_user.id)
|
|
||||||
by_user = (is_manager? or is_admin?)
|
|
||||||
by_news_bulletin or by_user
|
|
||||||
end
|
|
||||||
|
|
||||||
def show_news_bulletin_title_at_index (news_bulletin)
|
|
||||||
if news_bulletin.is_checked?
|
|
||||||
link_to news_bulletin.title, panel_news_front_end_news_bulletin_path(news_bulletin, :category_id => news_bulletin.news_bulletin_category.id) rescue ''
|
|
||||||
else
|
|
||||||
news_bulletin.title
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,291 +0,0 @@
|
||||||
# encoding: utf-8
|
|
||||||
|
|
||||||
class NewsBulletin
|
|
||||||
include Mongoid::Document
|
|
||||||
include Mongoid::Timestamps
|
|
||||||
include Mongoid::MultiParameterAttributes
|
|
||||||
include Sunspot::Mongo
|
|
||||||
include Impressionist::Impressionable
|
|
||||||
|
|
||||||
BelongsToCategory = :news_bulletin_category
|
|
||||||
include OrbitCoreLib::BelongsToCategoryMayDisable
|
|
||||||
include OrbitCoreLib::Preview
|
|
||||||
# include Tire::Model::Search
|
|
||||||
# include Tire::Model::Callbacks
|
|
||||||
# include Redis::Objects
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#scope :searchable,where(:is_checked=>true,:is_hidden=>false,:is_pending=>false)
|
|
||||||
|
|
||||||
is_impressionable :counter_cache => { :column_name => :view_count }
|
|
||||||
|
|
||||||
field :title, localize: true
|
|
||||||
field :subtitle, localize: true
|
|
||||||
field :text, localize: true
|
|
||||||
has_and_belongs_to_many :tags, :class_name => "NewsTag"
|
|
||||||
|
|
||||||
field :postdate , :type => DateTime
|
|
||||||
field :deadline , :type => DateTime
|
|
||||||
# field :url
|
|
||||||
field :create_user_id
|
|
||||||
field :update_user_id, :class_name => "User"
|
|
||||||
|
|
||||||
field :is_top, :type => Boolean, :default => false
|
|
||||||
field :is_hot, :type => Boolean, :default => false
|
|
||||||
field :is_hidden, :type => Boolean, :default => false
|
|
||||||
field :is_checked, :type => Boolean, :default => false
|
|
||||||
field :is_pending, :type => Boolean, :default => true
|
|
||||||
field :is_rejected, :type => Boolean, :default => false
|
|
||||||
field :view_count, :type => Integer, :default => 0
|
|
||||||
|
|
||||||
field :not_checked_reason
|
|
||||||
|
|
||||||
field :public, :type => Boolean, :default => true
|
|
||||||
|
|
||||||
scope :can_display, where(is_checked: true, is_rejected: false, is_pending: false)
|
|
||||||
scope :available_for_lang, ->(locale){ where("available_for_#{locale}".to_sym => true) }
|
|
||||||
|
|
||||||
mount_uploader :image, ImageUploader
|
|
||||||
|
|
||||||
belongs_to :unit_list_for_anc
|
|
||||||
|
|
||||||
# embeds_many :news_bulletin_links, :cascade_callbacks => true
|
|
||||||
# embeds_many :news_bulletin_files, :cascade_callbacks => true
|
|
||||||
|
|
||||||
has_many :news_bulletin_links, :autosave => true, :dependent => :destroy
|
|
||||||
has_many :news_bulletin_files, :autosave => true, :dependent => :destroy
|
|
||||||
|
|
||||||
accepts_nested_attributes_for :news_bulletin_files, :allow_destroy => true
|
|
||||||
accepts_nested_attributes_for :news_bulletin_links, :allow_destroy => true
|
|
||||||
|
|
||||||
validates :title, :at_least_one => true
|
|
||||||
|
|
||||||
before_save :check_deadline
|
|
||||||
before_save :update_avliable_language, :clean_tags
|
|
||||||
|
|
||||||
after_save :save_news_bulletin_links
|
|
||||||
after_save :save_news_bulletin_files
|
|
||||||
|
|
||||||
# Tire.index 'news_bulletin' do
|
|
||||||
# delete
|
|
||||||
# create :mappings =>{
|
|
||||||
# :news_bulletin_by_title => {
|
|
||||||
# :properties=> {
|
|
||||||
# :title => { :type => 'string', :index => 'not_analyzed', :include_in_all => false },
|
|
||||||
# :body => {}
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
# :news_bulletin_by_body => {
|
|
||||||
# :properties=> {
|
|
||||||
# :body => { :type => 'string', :index => 'not_analyzed', :include_in_all => false },
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
# end
|
|
||||||
# mapping do
|
|
||||||
# indexes :title, :analyzer => 'cjk', :boost => 10
|
|
||||||
# indexes :sub_titles, :analyzer => 'cjk', :boost => 5
|
|
||||||
# indexes :text, :analyzer => 'cjk'
|
|
||||||
# end
|
|
||||||
def type
|
|
||||||
"news_bulletin"
|
|
||||||
end
|
|
||||||
|
|
||||||
searchable do
|
|
||||||
text :titles do
|
|
||||||
title_translations.to_a.collect{|t| t[1]}
|
|
||||||
end
|
|
||||||
text :texts do
|
|
||||||
text_translations.to_a.collect{|t| Nokogiri::HTML(t[1]).text}
|
|
||||||
end
|
|
||||||
integer :view_count
|
|
||||||
|
|
||||||
string :available_lang , :multiple => true do
|
|
||||||
VALID_LOCALES.collect{|t| enabled_for_lang(t.to_sym) ? t : nil}.delete_if{|t| t.nil?}
|
|
||||||
end
|
|
||||||
|
|
||||||
boolean :frontend_search do
|
|
||||||
( !is_hidden && !is_pending && is_checked && !is_rejected )
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
string :news_bulletin_category_id
|
|
||||||
end
|
|
||||||
|
|
||||||
# redis_search_index(:title_field => :s_title,
|
|
||||||
# :alias_field => :s_title_en,
|
|
||||||
# :score_field => :view_count,
|
|
||||||
# :condition_fields => [:is_checked,:is_hidden,:news_bulletin_category_id,:is_pending],
|
|
||||||
# :ext_fields =>[])
|
|
||||||
|
|
||||||
# def gen_title_for_search
|
|
||||||
# # [s_title,s_title_en,s_text_en,s_text_zh_tw].join(' ')
|
|
||||||
# end
|
|
||||||
|
|
||||||
# def s_title
|
|
||||||
# self.
|
|
||||||
# end
|
|
||||||
|
|
||||||
# def s_title_was
|
|
||||||
# self.title_was["zh_tw"]
|
|
||||||
# end
|
|
||||||
|
|
||||||
# def s_title_en
|
|
||||||
# self.title_translations["en"]
|
|
||||||
# end
|
|
||||||
|
|
||||||
# def s_title_en_was
|
|
||||||
# self.title_was["en"]
|
|
||||||
# end
|
|
||||||
|
|
||||||
# def s_text_en
|
|
||||||
# Nokogiri::HTML(self.text.en).text
|
|
||||||
# end
|
|
||||||
# def s_text_zh_tw
|
|
||||||
# Nokogiri::HTML(self.text.zh_tw).text
|
|
||||||
# end
|
|
||||||
def share_item
|
|
||||||
Item.first(conditions:{name: 'news'})
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.widget_datas( category_id = nil )
|
|
||||||
|
|
||||||
date_now = Time.now
|
|
||||||
|
|
||||||
# find(:all, :conditions => {:postdate => {"$lte" => Date.today}, deadline: nil} ).desc( :is_top, :postdate)
|
|
||||||
# where( :postdate.lte => date_now ).where( :deadline => nil ).desc(:is_top, :postdate)
|
|
||||||
# any_of({ :title => "test" },{:deadline => nil, :title => "123"})
|
|
||||||
|
|
||||||
if category_id.to_s.size > 0
|
|
||||||
find(:all, :conditions => {news_bulletin_category_id: category_id}).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).any_of(is_hot: true, is_top: true).desc(:postdate)
|
|
||||||
else
|
|
||||||
any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).any_of(is_hot: true, is_top: true).desc(:postdate)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
def proc_check(check,not_pass_info = "")
|
|
||||||
self.is_checked = true
|
|
||||||
if check =="true"
|
|
||||||
self.is_rejected = false
|
|
||||||
elsif check == "false"
|
|
||||||
self.is_rejected = true
|
|
||||||
self.not_checked_reason = not_pass_info
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def enabled_for_lang(lang)
|
|
||||||
eval("self.available_for_#{lang}")
|
|
||||||
end
|
|
||||||
|
|
||||||
def de_pending
|
|
||||||
self.is_pending = false
|
|
||||||
end
|
|
||||||
|
|
||||||
def de_pending!
|
|
||||||
de_pending
|
|
||||||
self.save!
|
|
||||||
end
|
|
||||||
|
|
||||||
def is_expired?
|
|
||||||
Date.today > self.deadline ? true : false rescue false
|
|
||||||
#some dates might sat as nil so rescue false
|
|
||||||
end
|
|
||||||
|
|
||||||
def is_top?
|
|
||||||
self.is_top
|
|
||||||
end
|
|
||||||
|
|
||||||
def is_hot?
|
|
||||||
self.is_hot
|
|
||||||
end
|
|
||||||
|
|
||||||
def is_hidden?
|
|
||||||
self.is_hidden
|
|
||||||
end
|
|
||||||
|
|
||||||
def is_checked?
|
|
||||||
!self.is_pending && self.is_checked && (self.is_rejected == false)
|
|
||||||
end
|
|
||||||
|
|
||||||
def is_pending?
|
|
||||||
self.is_pending
|
|
||||||
end
|
|
||||||
|
|
||||||
def is_rejected?
|
|
||||||
!self.is_pending && self.is_rejected && (self.is_rejected == true)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def save_news_bulletin_links
|
|
||||||
self.news_bulletin_links.each do |t|
|
|
||||||
if t.should_destroy
|
|
||||||
t.destroy
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def save_news_bulletin_files
|
|
||||||
self.news_bulletin_files.each do |t|
|
|
||||||
if t.should_destroy
|
|
||||||
t.destroy
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.filter(news_bulletins)
|
|
||||||
news_bulletins.each do |news_bulletin|
|
|
||||||
p "#{news_bulletin.id}/#{news_bulletin.is_top}/#{news_bulletin.is_hot}/#{news_bulletin.is_hidden}"
|
|
||||||
end
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
def sorted_tags
|
|
||||||
tags.order_by(I18n.locale, :asc)
|
|
||||||
end
|
|
||||||
|
|
||||||
def to_preview
|
|
||||||
preview_object = Preview.new(:expired_at=>DateTime.now+30.minutes,:preview_at_link=>"panel_news_front_end_news_bulletin_path",:object_class_type=>"NewsBulletin")
|
|
||||||
preview_object.preview_files.build(:file=>self.news_bulletin["image"],:field_name_for_rebuild=>'image')
|
|
||||||
|
|
||||||
|
|
||||||
self.news_bulletin["news_bulletin_files_attributes"].each_with_index do |atr,idx|
|
|
||||||
preview_object.preview_files.build(:file=>self.news_bulletin["news_bulletin_files_attributes"][idx.to_s],:field_name_for_rebuild=>'news_bulletin_files',:file_in_array=>true)
|
|
||||||
end unless self.news_bulletin["news_bulletin_files_attributes"].nil?
|
|
||||||
|
|
||||||
self.news_bulletin["news_bulletin_links_attributes"].each_with_index do |atr,idx|
|
|
||||||
preview_object.preview_associations.build(:object=>self.news_bulletin["news_bulletin_links_attributes"][idx.to_s],:field_name_for_rebuild=>'news_bulletin_links',:object_in_array=>true)
|
|
||||||
end unless self.news_bulletin["news_bulletin_links_attributes"].nil?
|
|
||||||
|
|
||||||
preview_object.object = self.news_bulletin.except("news_bulletin_files_attributes","image","news_bulletin_links_attributes")
|
|
||||||
preview_object
|
|
||||||
end
|
|
||||||
|
|
||||||
protected
|
|
||||||
|
|
||||||
def update_avliable_language
|
|
||||||
VALID_LOCALES.each do |locale|
|
|
||||||
if (title_translations[locale].blank? rescue true)
|
|
||||||
self["available_for_#{locale}".to_sym] = false
|
|
||||||
else
|
|
||||||
self["available_for_#{locale}".to_sym] = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def check_deadline
|
|
||||||
if(!self.deadline.nil? and (self.deadline < self.postdate ))
|
|
||||||
self.deadline = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def clean_tags
|
|
||||||
self.tag_ids.delete('')
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,30 +0,0 @@
|
||||||
# encoding: utf-8
|
|
||||||
|
|
||||||
class NewsBulletinCategory
|
|
||||||
include Mongoid::Document
|
|
||||||
include Mongoid::Timestamps
|
|
||||||
include OrbitCoreLib::ObjectAuthable
|
|
||||||
include OrbitCoreLib::ObjectDisable
|
|
||||||
|
|
||||||
ObjectAuthTitlesOptions = %W{submit_new fact_check}
|
|
||||||
AfterObjectAuthUrl = '/panel/news/back_end/news_bulletin_categorys'
|
|
||||||
# include Mongoid::MultiParameterAttributes
|
|
||||||
|
|
||||||
PAYMENT_TYPES = [ "List", "Picture" ]
|
|
||||||
APP_NAME = 'news'
|
|
||||||
|
|
||||||
field :key
|
|
||||||
field :display
|
|
||||||
|
|
||||||
field :title, localize: true
|
|
||||||
has_many :news_bulletins
|
|
||||||
|
|
||||||
def pp_object
|
|
||||||
title
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.from_id(id)
|
|
||||||
NewsBulletinCategory.find(id) rescue nil
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,17 +0,0 @@
|
||||||
class NewsBulletinFile
|
|
||||||
|
|
||||||
include Mongoid::Document
|
|
||||||
include Mongoid::Timestamps
|
|
||||||
|
|
||||||
mount_uploader :file, AssetUploader
|
|
||||||
|
|
||||||
field :title, localize: true
|
|
||||||
field :description, localize: true
|
|
||||||
|
|
||||||
# field :to_save, :type => Boolean
|
|
||||||
field :should_destroy, :type => Boolean
|
|
||||||
|
|
||||||
belongs_to :news_bulletin
|
|
||||||
# embedded_in :news_bulletin
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,23 +0,0 @@
|
||||||
class NewsBulletinLink
|
|
||||||
|
|
||||||
include Mongoid::Document
|
|
||||||
include Mongoid::Timestamps
|
|
||||||
|
|
||||||
field :url
|
|
||||||
field :title, localize: true
|
|
||||||
|
|
||||||
field :should_destroy, :type => Boolean
|
|
||||||
|
|
||||||
belongs_to :news_bulletin
|
|
||||||
|
|
||||||
before_validation :add_http
|
|
||||||
validates :url, :presence => true, :format => /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix
|
|
||||||
|
|
||||||
protected
|
|
||||||
|
|
||||||
def add_http
|
|
||||||
unless self.url[/^http:\/\//] || self.url[/^https:\/\//]
|
|
||||||
self.url = 'http://' + self.url
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,13 +0,0 @@
|
||||||
class NewsTag < Tag
|
|
||||||
has_and_belongs_to_many :news_bulletins
|
|
||||||
|
|
||||||
def get_visible_news_bulletins(sort = :title)
|
|
||||||
date_now = Time.now
|
|
||||||
self.news_bulletins.where(:is_hidden => false).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc(:is_top, sort)
|
|
||||||
end
|
|
||||||
|
|
||||||
def news_bulletins
|
|
||||||
NewsBulletin.all.any_in(:_id => news_bulletin_ids)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,40 +0,0 @@
|
||||||
<% content_for :page_specific_css do %>
|
|
||||||
<%= stylesheet_link_tag "inc/permission-checkbox" %>
|
|
||||||
<% end %>
|
|
||||||
<% content_for :page_specific_javascript do %>
|
|
||||||
<%= javascript_include_tag "bootstrap" %>
|
|
||||||
<%= javascript_include_tag "inc/permission-checkbox" %>
|
|
||||||
<%= javascript_include_tag "inc/search" %>
|
|
||||||
<% end %>
|
|
||||||
<%= form_tag('', :remote => true) %>
|
|
||||||
<div class="subnav">
|
|
||||||
<ul class="nav nav-pills filter">
|
|
||||||
<li class="accordion-group">
|
|
||||||
<div class="form-search" style="margin: 5px 10px;">
|
|
||||||
<%= label_tag :category, t(:category) %>
|
|
||||||
<%= select_tag "category_id", options_from_collection_for_select(@news_bulletin_categorys, "id", "key") %>
|
|
||||||
<%= search_field_tag 'user_filter' %>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<%#= label_tag :role, t(:roles) %>
|
|
||||||
<div class="clear">
|
|
||||||
<%= content_tag :div do -%>
|
|
||||||
<% form_tag :action => "update_setting" do %>
|
|
||||||
<%= render :partial => "privilege_user", :locals => {:users => @users_array} %>
|
|
||||||
<div class="form-actions pagination-centered">
|
|
||||||
<%= submit_tag "Update", :class => 'btn' %>
|
|
||||||
</div>
|
|
||||||
<% end -%>
|
|
||||||
<% end -%>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/javascript" charset="utf-8">
|
|
||||||
var availableTags = [];
|
|
||||||
$(function() {
|
|
||||||
|
|
||||||
$('#category_id').change(function() {
|
|
||||||
$(this).parents('form').submit();
|
|
||||||
});
|
|
||||||
</script>
|
|
|
@ -1,69 +0,0 @@
|
||||||
<% if news_bulletin -%>
|
|
||||||
|
|
||||||
<div class="modal hide fade in banner-preview" id="news_bulletin-<%=news_bulletin.id%>">
|
|
||||||
<div class="modal-header">
|
|
||||||
<a class="close" data-dismiss="modal">×</a>
|
|
||||||
<h3><%= t("modal.preview") %></h3>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<p class="news_bulletin_slideshow">
|
|
||||||
<iframe src=<%= panel_news_front_end_news_bulletin_path(news_bulletin, :category_id => news_bulletin.news_bulletin_category.id ,:preview=>true) %> style="width:1024px;height:300px" >
|
|
||||||
|
|
||||||
</iframe>
|
|
||||||
|
|
||||||
<%# preview_block_ad_images_helper(news_bulletin).each do |ad_image| -%>
|
|
||||||
<%#= image_tag ad_image.file,:alt => (ad_image.title[locale] || " "),:time_to_next => news_bulletin.transition_msec,:link_open=> ad_image.link_open, :link_url =>((ad_image.out_link || news_bulletin.context || " ")) %>
|
|
||||||
<%# end -%>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
|
|
||||||
<%= form_for news_bulletin, :url => panel_news_back_end_news_bulletin_approve_path(news_bulletin),:method => :post, :html => {:class => 'clear'} do |f| %>
|
|
||||||
<%= f.label :approval_stat, t('approval.stat') %>
|
|
||||||
<%= content_tag :label,:class => "radio inline" do -%>
|
|
||||||
<%= f.radio_button :is_checked, true , {:class => 'privacy'} %>
|
|
||||||
<%= t('approval.pass') %>
|
|
||||||
<% end -%>
|
|
||||||
<%= content_tag :label,:class => "radio inline" do -%>
|
|
||||||
<%= f.radio_button :is_checked, false, (!@news_bulletin.is_checked ? {:checked => true, :class => 'privacy'} : {})%>
|
|
||||||
<%= t('approval.not_pass') %>
|
|
||||||
<% end -%>
|
|
||||||
|
|
||||||
<%= label :is_checked_false, t('approval.not_pass_reason') %>
|
|
||||||
<%= f.text_field :not_checked_reason %>
|
|
||||||
<%= f.submit t(:submit_approval),:class=>"btn"%>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<a href="#" class="btn" data-dismiss="modal"><%= t("modal.close") %></a>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<script type="text/javascript" src="/static/kernel.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(document).ready(function() {
|
|
||||||
|
|
||||||
// $("#news_bulletin-<%#=news_bulletin.title.dehumanize%>").on("show", function () {
|
|
||||||
// $("#news_bulletin-<%#=news_bulletin.title.dehumanize%>").find(".news_bulletin_slideshow").cycle({delay: -1000, fx: "<%#= news_bulletin.ad_fx.nil?? "fade": news_bulletin.ad_fx %>", timeoutFn: getTimeout });
|
|
||||||
// });
|
|
||||||
$(".modal").on("hidden", function () {
|
|
||||||
$("#show_preview").remove();
|
|
||||||
});
|
|
||||||
|
|
||||||
$("iframe").load(function(){
|
|
||||||
// Get the body element
|
|
||||||
var frameBody = $("iframe").contents().find("body");
|
|
||||||
|
|
||||||
// Get all links inside the BODY tag
|
|
||||||
$('a', frameBody).click(function(e){
|
|
||||||
//Disable all default actions
|
|
||||||
e.preventDefault();
|
|
||||||
});
|
|
||||||
$('input', frameBody).attr("disabled", true);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<% end -%>
|
|
|
@ -1,44 +0,0 @@
|
||||||
<% if news_bulletin_category -%>
|
|
||||||
|
|
||||||
<div class="modal hide fade in" id="news_bulletin_category-<%=news_bulletin_category.id%>">
|
|
||||||
<div class="modal-header">
|
|
||||||
<a class="close" data-dismiss="modal">×</a>
|
|
||||||
<h3><%= t("approval.user_list") %></h3>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<div class="clear">
|
|
||||||
<% news_bulletin_category.get_object_auth_by_title('fact_check').auth_users.each do |user| %>
|
|
||||||
<div class="checkbox clear checked">
|
|
||||||
<div class='member-avatar'>
|
|
||||||
<% if user.avatar? %>
|
|
||||||
<%= image_tag(user.avatar.thumb.url,:class => "member-img") %>
|
|
||||||
<% else %>
|
|
||||||
<%= image_tag "person.png",:class => "member-img" %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
<%= label_tag "lab-user-#{user.id}", (user.name rescue ''),:class=>"member-name",:id=>nil -%>
|
|
||||||
</div>
|
|
||||||
<% end -%>
|
|
||||||
<divl>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<a href="#" class="btn" data-dismiss="modal"><%= t("modal.close") %></a>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<script type="text/javascript" src="/static/kernel.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(document).ready(function() {
|
|
||||||
|
|
||||||
$("#news_bulletin_category-<%=news_bulletin_category.id%>").on("show", function () {
|
|
||||||
});
|
|
||||||
$(".modal").on("hidden", function () {
|
|
||||||
$("#show_preview").remove();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<% end -%>
|
|
|
@ -1,5 +0,0 @@
|
||||||
$('#show_preview').html("<%= escape_javascript(render(:partial => 'modal_approve',:locals => {:news_bulletin => @news_bulletin})) %>");
|
|
||||||
var start_modal_with_id = "news_bulletin-<%=@news_bulletin.id%>";
|
|
||||||
$("#"+start_modal_with_id).css("width","1050px");
|
|
||||||
$("#"+start_modal_with_id).css("height","768px");
|
|
||||||
$("#"+start_modal_with_id).css("margin","-270px 0 0 -550px");
|
|
|
@ -1,53 +0,0 @@
|
||||||
<% content_for :page_specific_css do %>
|
|
||||||
<%= stylesheet_link_tag "inc/permission-checkbox" %>
|
|
||||||
<% end %>
|
|
||||||
<% content_for :page_specific_javascript do %>
|
|
||||||
<%= javascript_include_tag "inc/permission-checkbox" %>
|
|
||||||
<%= javascript_include_tag "inc/search" %>
|
|
||||||
<%= javascript_include_tag "inc/modal-preview" %>
|
|
||||||
<% end %>
|
|
||||||
<%= form_tag('', :remote => true,:class => "prevent_enter_submit_form") %>
|
|
||||||
<div class="subnav clear">
|
|
||||||
<ul class="nav nav-pills filter pull-left">
|
|
||||||
<li class="accordion-group">
|
|
||||||
<div class="form-search" style="margin: 5px 10px;">
|
|
||||||
<%= label_tag :category, t(:category) %>
|
|
||||||
<%= select "news_category",'id', @options_from_collection_for_select_news_bulletin_categorys %>
|
|
||||||
<%= search_field_tag 'user_filter' %>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<%= link_to t("approval.user_list"), panel_news_back_end_approval_user_list_path , :class=>'preview_trigger btn btn-success pull-right'%>
|
|
||||||
</div>
|
|
||||||
<%#= label_tag :role, t(:roles) %>
|
|
||||||
<div class="clear">
|
|
||||||
<%= content_tag :div do -%>
|
|
||||||
<% form_tag panel_news_back_end_approval_setting_path do %>
|
|
||||||
<%= render :partial => "layouts/users_checkbox_ary" %>
|
|
||||||
<div class="form-actions form-fixed pagination-right">
|
|
||||||
<%= submit_tag t(:update_), :class => 'btn btn-primary' %>
|
|
||||||
</div>
|
|
||||||
<% end -%>
|
|
||||||
<% end -%>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/javascript" charset="utf-8">
|
|
||||||
var availableTags = [];
|
|
||||||
$(document).ready(function() {
|
|
||||||
|
|
||||||
$(".prevent_enter_submit_form").bind("keypress", function(e) {
|
|
||||||
if (e.keyCode == 13) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#news_category_id').change(function() {
|
|
||||||
$.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
dataType: "script",
|
|
||||||
url:$(this).parents("from").attr("href"),
|
|
||||||
data:$(this).parents("form").serialize()
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
|
@ -1,2 +0,0 @@
|
||||||
$("#users_checkbox_ary").replaceWith('<%= escape_javascript(render :partial=> "layouts/users_checkbox_ary" )%>');
|
|
||||||
permissionCheckbox();
|
|
|
@ -1 +0,0 @@
|
||||||
alert( "<% flash.each do |key, msg| %><%= msg %><% end%>");
|
|
|
@ -1,2 +0,0 @@
|
||||||
$('#show_preview').html("<%= escape_javascript(render(:partial => 'modal_list',:locals => {:news_bulletin_category => @news_bulletin_category})) %>");
|
|
||||||
var start_modal_with_id = "news_bulletin_category-<%=@news_bulletin_category.id%>"
|
|
|
@ -1,55 +0,0 @@
|
||||||
<% content_for :page_specific_css do %>
|
|
||||||
<%= stylesheet_link_tag "inc/permission-checkbox" %>
|
|
||||||
<% end %>
|
|
||||||
<% content_for :page_specific_javascript do %>
|
|
||||||
<%= javascript_include_tag "inc/permission-checkbox" %>
|
|
||||||
<%= javascript_include_tag "inc/search" %>
|
|
||||||
<%= javascript_include_tag "inc/modal-preview" %>
|
|
||||||
<% end %>
|
|
||||||
<%= form_tag('', :remote => true,:class => "prevent_enter_submit_form") %>
|
|
||||||
<div class="subnav clear">
|
|
||||||
<ul class="nav nav-pills filter pull-left">
|
|
||||||
<li class="accordion-group">
|
|
||||||
<div class="form-search" style="margin: 5px 10px;">
|
|
||||||
<%= label_tag :category, t(:category) %>
|
|
||||||
<%= select "category",'id',@options_from_collection_for_select_bulletin_categorys %>
|
|
||||||
<%= search_field_tag 'user_filter' %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<%= link_to t(:submit_user_list), panel_news_back_end_news_bulletin_category_user_list_path , :class=>'preview_trigger btn btn-success pull-right'%>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<%#= label_tag :role, t(:roles) %>
|
|
||||||
<div class="clear">
|
|
||||||
<%= content_tag :div do -%>
|
|
||||||
<% form_tag panel_news_back_end_news_bulletin_category_setting_path do %>
|
|
||||||
<%= render :partial => "privilege_user", :locals => {:users => @users_array} %>
|
|
||||||
<div class="form-actions form-fixed pagination-right">
|
|
||||||
<%= submit_tag "Update", :class => 'btn btn-primary' %>
|
|
||||||
</div>
|
|
||||||
<% end -%>
|
|
||||||
<% end -%>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/javascript" charset="utf-8">
|
|
||||||
var availableTags = [];
|
|
||||||
$(document).ready(function() {
|
|
||||||
|
|
||||||
$(".prevent_enter_submit_form").bind("keypress", function(e) {
|
|
||||||
if (e.keyCode == 13) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#category_id').change(function() {
|
|
||||||
$.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
dataType: "script",
|
|
||||||
url:$(this).parents("from").attr("href"),
|
|
||||||
data:$(this).parents("form").serialize()
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
|
@ -1,37 +0,0 @@
|
||||||
<% # encoding: utf-8 %>
|
|
||||||
|
|
||||||
<%= form_for(@news_bulletin_category, :remote => true, :url => @url) do |f| %>
|
|
||||||
|
|
||||||
<h2><%= (@news_bulletin_category.new_record? ? t(:edit) : t(:add)) %></h2>
|
|
||||||
|
|
||||||
<div id="widget-title">
|
|
||||||
<%= f.label :key, t(:key) %>
|
|
||||||
<%= f.text_field :key %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="widget-title">
|
|
||||||
<%= f.fields_for :title_translations do |f| %>
|
|
||||||
<% @site_valid_locales.each do |locale| %>
|
|
||||||
<div class="control-group">
|
|
||||||
<%= label_tag "name-#{locale}", "#{t(:name)}-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
|
|
||||||
<div class="controls">
|
|
||||||
<%= f.text_field locale, :class => 'input-xxlarge', :value => (@news_bulletin_category.title_translations[locale] rescue nil) %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="widget-title">
|
|
||||||
<%#= f.label :display %>
|
|
||||||
<%#= f.radio_button :display, "List" List%>
|
|
||||||
<%#= f.radio_button :display, "Picture" Picture%>
|
|
||||||
<%# <br />顯示方式是設定在前台頁面時,資訊所呈現的樣式 %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-actions">
|
|
||||||
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
|
|
||||||
<tr id="<%= dom_id news_bulletin_category %>" class="with_action">
|
|
||||||
<td>
|
|
||||||
<%= news_bulletin_category.key %>
|
|
||||||
<div class="quick-edit">
|
|
||||||
<ul class="nav nav-pills hide">
|
|
||||||
<% if is_admin?%>
|
|
||||||
<li><%= link_to t(:edit), edit_panel_news_back_end_news_bulletin_category_path(news_bulletin_category), :remote => true %></li>
|
|
||||||
<li><%= link_to show_toggle_archive_btn(news_bulletin_category), panel_news_back_end_news_bulletin_category_path(news_bulletin_category), :confirm => t(:sure?), :method => :delete, :remote => true,:class=>"archive_toggle" %></li>
|
|
||||||
<% end %>
|
|
||||||
<%if is_manager? || is_admin? %>
|
|
||||||
<li><%= show_news_cate_permission_link(news_bulletin_category) %></li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<% @site_valid_locales.each do |locale| %>
|
|
||||||
<td><%= news_bulletin_category.title_translations[locale] rescue nil %></td>
|
|
||||||
<% end %>
|
|
||||||
</tr>
|
|
|
@ -1,28 +0,0 @@
|
||||||
<% # encoding: utf-8 %>
|
|
||||||
|
|
||||||
<div id="qe-basic" class="qe-edit-div">
|
|
||||||
|
|
||||||
<div id="widget-title">
|
|
||||||
<%= f.label :key %>
|
|
||||||
<%= f.text_field :key %>
|
|
||||||
</div>
|
|
||||||
<div id="widget-title">
|
|
||||||
<%= f.fields_for :title_translations do |f| %>
|
|
||||||
<% @site_valid_locales.each do |locale| %>
|
|
||||||
<div class="control-group">
|
|
||||||
<%= label_tag "title-#{locale}", "Title-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
|
|
||||||
<div class="controls">
|
|
||||||
<%= f.text_field locale, :class => 'input-xxlarge', :value => (news_bulletin_category.title_translations[locale] rescue nil) %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="widget-title">
|
|
||||||
<%= f.label :display %>
|
|
||||||
<%= f.radio_button :display, "List" %>List
|
|
||||||
<%= f.radio_button :display, "Picture" %>Picture
|
|
||||||
<br />顯示方式是設定在前台頁面時,資訊所呈現的樣式
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -1,2 +0,0 @@
|
||||||
$('<%= j render :partial => 'news_bulletin_category', :collection => [@news_bulletin_category] %>').appendTo('#news_bulletin_categorys').hide().fadeIn();
|
|
||||||
$("#new_news_bulletin_category")[0].reset();
|
|
|
@ -1 +0,0 @@
|
||||||
$("#<%= dom_id @news_bulletin_category %>").find(".archive_toggle").text("<%= show_toggle_archive_btn(@news_bulletin_category) %> ");
|
|
|
@ -1,7 +0,0 @@
|
||||||
<h1><%= t('news_bulletin.editing_news_category') %></h1>
|
|
||||||
|
|
||||||
<%= form_for @news_bulletin_category, :url => panel_news_back_end_news_bulletin_category_path(@news_bulletin_category) do |f| %>
|
|
||||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= link_back %>
|
|
|
@ -1 +0,0 @@
|
||||||
$("#form > form").replaceWith("<%= j render "form" %>");
|
|
|
@ -1,23 +0,0 @@
|
||||||
|
|
||||||
<%= flash_messages %>
|
|
||||||
|
|
||||||
<table id="news_bulletin_categorys" class="table main-list">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th class="span1-2"><%= t(:key) %></th>
|
|
||||||
<% @site_valid_locales.each do |locale| %>
|
|
||||||
<th class="span1-2"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th>
|
|
||||||
<% end %>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
|
|
||||||
<%= render :partial => 'news_bulletin_category', :collection => @news_bulletin_categorys %>
|
|
||||||
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<div id="form"><%= render :partial => "form" if is_manager? %></div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
<% content_for :secondary do %>
|
|
||||||
<%= render :partial => '/panel/news/back_end/news_secondary' %>
|
|
||||||
<% end -%>
|
|
||||||
|
|
||||||
<%= flash_messages %>
|
|
||||||
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<h1><%= t('news_bulletin.new_news_category') %></h1>
|
|
||||||
<%= form_for @news_bulletin_category, :url => panel_news_back_end_news_bulletin_categorys_path do |f| %>
|
|
||||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= link_back %>
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
$("#form > form").replaceWith("<%= j render "form" %>");
|
|
|
@ -1,4 +0,0 @@
|
||||||
$("#<%= dom_id @news_bulletin_category %>").replaceWith("<%= j render :partial => 'news_bulletin_category', :collection => [@news_bulletin_category] %>");
|
|
||||||
<% @news_bulletin_category = NewsBulletinCategory.new(:display => 'List') # reset for new form %>
|
|
||||||
$(".edit_news_bulletin_category").replaceWith("<%= j render "form" %>")
|
|
||||||
$(".new_news_bulletin_category")[0].reset();
|
|
|
@ -1,3 +0,0 @@
|
||||||
<div class="filter-clear">
|
|
||||||
<%= link_to content_tag(:i, nil, :class => 'icons-brush-large') + t(:clear), panel_news_back_end_news_bulletins_path(:filter => @filter, :sort => params[:sort], :direction => params[:direction], :clear => true, :type => type), :class => "btn btn-small js_history" %>
|
|
||||||
</div>
|
|
|
@ -1,37 +0,0 @@
|
||||||
<div id='add_news_bulletin_files'>
|
|
||||||
|
|
||||||
<% news_bulletin_files.each do | news_bulletin_file | %>
|
|
||||||
|
|
||||||
<%= fields_for 'news_bulletin[news_bulletin_files][]', news_bulletin_file, :index => nil do |f| %>
|
|
||||||
|
|
||||||
<div id="<%= "news_bulletin_#{news_bulletin_file.id}" if !news_bulletin_file.new_record? %>" class='list_item'>
|
|
||||||
<div class="field">
|
|
||||||
<%= f.label :file %>
|
|
||||||
<%#= file_field_tag 'news_bulletin[file]' %>
|
|
||||||
<%= f.file_field :file %>
|
|
||||||
|
|
||||||
<%= f.label :file_title %>
|
|
||||||
<%= f.text_field :title %>
|
|
||||||
|
|
||||||
<%= f.label :file_description %>
|
|
||||||
<%= f.text_field :description %>
|
|
||||||
|
|
||||||
<span class="action">
|
|
||||||
<% if news_bulletin_file.new_record? %>
|
|
||||||
<a href="#" class="delete"><%= t(:delete) %></a>
|
|
||||||
<% else %>
|
|
||||||
<%= f.hidden_field :id %>
|
|
||||||
<% if news_bulletin_file.is_built_in? %>
|
|
||||||
<a href="#" class="switch" id="<%= news_bulletin_file.id %>"></a>
|
|
||||||
<% else %>
|
|
||||||
<a href="#" class="remove_existing_record"><%= t(:delete) %></a>
|
|
||||||
<%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
|
@ -1,37 +0,0 @@
|
||||||
<div id='filter' class="subnav">
|
|
||||||
<ul class="nav nav-pills filter">
|
|
||||||
<li class="accordion-group">
|
|
||||||
<div class="accordion-heading">
|
|
||||||
<a href="#collapse-status" data-toggle="collapse" data-parent=".filters" class="accordion-toggle"><%= t(:status) %> <b class="web-symbol"></b></a>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li class="accordion-group">
|
|
||||||
<div class="accordion-heading">
|
|
||||||
<a href="#collapse-category" data-toggle="collapse" data-parent=".filters" class="accordion-toggle"><%= t(:categories) %> <b class="web-symbol"></b></a>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li class="accordion-group">
|
|
||||||
<div class="accordion-heading">
|
|
||||||
<a href="#collapse-tags" data-toggle="collapse" data-parent=".filters" class="accordion-toggle"><%= t(:tags) %> <b class="web-symbol"></b></a>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<div class="filters">
|
|
||||||
<div class="accordion-body collapse" id="collapse-status">
|
|
||||||
<%= render 'filter_status' %>
|
|
||||||
</div>
|
|
||||||
<div class="accordion-body collapse" id="collapse-category">
|
|
||||||
<%= render 'filter_categories' %>
|
|
||||||
</div>
|
|
||||||
<div class="accordion-body collapse" id="collapse-tags">
|
|
||||||
<%= render 'filter_tags' %>
|
|
||||||
</div>
|
|
||||||
<div id="sort_headers" class="table-label">
|
|
||||||
<%= render 'sort_headers' %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<% content_for :page_specific_javascript do %>
|
|
||||||
<%= javascript_include_tag "sort_header" %>
|
|
||||||
<% end %>
|
|
|
@ -1,6 +0,0 @@
|
||||||
<div class="accordion-inner" data-toggle="buttons-checkbox">
|
|
||||||
<% @news_bulletin_categories.each do |category| -%>
|
|
||||||
<%= link_to category.title, panel_news_back_end_news_bulletins_path(:filter => @filter, :new_filter => {:type => 'categories', :id => category.id}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('categories', category.id)}" %>
|
|
||||||
<% end -%>
|
|
||||||
</div>
|
|
||||||
<%= render :partial => 'clear_filters', :locals => {:type => 'categories'} %>
|
|
|
@ -1,9 +0,0 @@
|
||||||
<div class="accordion-inner" data-toggle="buttons-checkbox">
|
|
||||||
<%= link_to t(:top), panel_news_back_end_news_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_top'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('status', 'is_top')}" %>
|
|
||||||
<%= link_to t(:hot), panel_news_back_end_news_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_hot'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('status', 'is_hot')}" %>
|
|
||||||
<%= link_to t(:hidden), panel_news_back_end_news_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_hidden'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('status', 'is_hidden')}" unless(is_guest?)%>
|
|
||||||
<%= link_to t(:pending), panel_news_back_end_news_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_pending'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('status', 'is_pending')}" if(is_manager?) %>
|
|
||||||
<%= link_to t(:passed), panel_news_back_end_news_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_checked'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('status', 'is_checked')}" if(is_manager?)%>
|
|
||||||
<%= link_to t(:rejected), panel_news_back_end_news_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_rejected'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('status', 'is_rejected')}" if(is_manager?)%>
|
|
||||||
</div>
|
|
||||||
<%= render :partial => 'clear_filters', :locals => {:type => 'status'} %>
|
|
|
@ -1,6 +0,0 @@
|
||||||
<div class="accordion-inner" data-toggle="buttons-checkbox">
|
|
||||||
<% @tags.each do |tag| -%>
|
|
||||||
<%= link_to tag[I18n.locale], panel_news_back_end_news_bulletins_path(:filter => @filter, :new_filter => {:type => 'tags', :id => tag.id}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('tags', tag.id)}" %>
|
|
||||||
<% end -%>
|
|
||||||
</div>
|
|
||||||
<%= render :partial => 'clear_filters', :locals => {:type => 'tags'} %>
|
|
|
@ -1,308 +0,0 @@
|
||||||
<% # encoding: utf-8 %>
|
|
||||||
<% content_for :page_specific_javascript do -%>
|
|
||||||
<%= javascript_include_tag "inc/modal-preview" %>
|
|
||||||
<% end -%>
|
|
||||||
<!--Widget start-->
|
|
||||||
<%= f.error_messages %>
|
|
||||||
<div id="sub-wiget">
|
|
||||||
<div id="widget-picture" class="widget-box">
|
|
||||||
<div class="widget-action clear">
|
|
||||||
<a class="action"><i title="Upload pictures" class="icon-exclamation-sign icon-white tip"></i></a>
|
|
||||||
</div>
|
|
||||||
<h3 class="widget-title"><i class="icons-picture icons-white"></i><%= t('nccu.picture') %></h3>
|
|
||||||
<div class="widget-content clear">
|
|
||||||
<div class="control-group">
|
|
||||||
<!-- <img class="pull-left upload-picture" src="/assets/default-img.png" /> -->
|
|
||||||
<div class="upload-picture">
|
|
||||||
<% if @news_bulletin.image %>
|
|
||||||
<%= image_tag @news_bulletin.image rescue ''%>
|
|
||||||
<% else %>
|
|
||||||
<img class="pull-left upload-picture" src="/assets/default-img.png" />
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
<span class="alert widgetInfo"><%= t("ad.widget_info_for_ad_image_size", :best_size=> "290px x 150px") %></span>
|
|
||||||
<div class="controls file-upload input-prepend">
|
|
||||||
<%= t(:browse) %>
|
|
||||||
<%= f.file_field :image, :id => "input-upload", :class => '', :onchange => "document.getElementById('fu').innerHTML = this.form.fu.value = this.value;" %>
|
|
||||||
<!-- <span id='fu' class="file-name"></span>
|
|
||||||
<br>
|
|
||||||
<input name='fu' class="input-medium" type="text">
|
|
||||||
<br> -->
|
|
||||||
<% if @news_bulletin.image.file %>
|
|
||||||
<%= f.check_box :remove_image %>
|
|
||||||
<%= t(:delete_file) %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div id="widget-date" class="widget-box widget-size-300">
|
|
||||||
<div class="widget-action clear">
|
|
||||||
<a href="#" class="action"><i title="Set the news to start and end dates" class="icon-exclamation-sign icon-white tip"></i></a>
|
|
||||||
</div>
|
|
||||||
<h3 class="widget-title"><i class="icons-calendar icons-white"></i><%= t('nccu.date') %></h3>
|
|
||||||
<div class="widget-content clear">
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label"><%= t(:start) %></label>
|
|
||||||
<div class="controls">
|
|
||||||
<%= f.date_select :postdate, {:use_month_numbers => true, :order => [:day, :month, :year] }, {:class => 'input-small'} %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label"><%= t(:end) %></label>
|
|
||||||
<div class="controls">
|
|
||||||
<%= f.date_select :deadline, {:use_month_numbers => true, :prompt => { :month => 'Month', :day => 'Day', :year => 'Year'}, :order => [:day, :month, :year] }, {:class => 'input-small'} %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<% if news_show_form_status_field( @news_bulletin)%>
|
|
||||||
<div id="widget-status" class="widget-box widget-size-300">
|
|
||||||
<div class="widget-action clear">
|
|
||||||
<a class="action"><i title="Setting the news state" class="icon-exclamation-sign icon-white tip"></i></a>
|
|
||||||
</div>
|
|
||||||
<h3 class="widget-title"><i class="icons-star-thin icons-white"></i><%= t(:status) %></h3>
|
|
||||||
<div class="widget-content clear">
|
|
||||||
<div class="controls">
|
|
||||||
<%= content_tag :label,:class => "checkbox inline" do -%>
|
|
||||||
<%= f.check_box :is_top %>
|
|
||||||
<%= t('top') %>
|
|
||||||
<% end -%>
|
|
||||||
<%= content_tag :label,:class => "checkbox inline" do -%>
|
|
||||||
<%= f.check_box :is_hot %>
|
|
||||||
<%= t('news_bulletin.hot') %>
|
|
||||||
<% end -%>
|
|
||||||
<%= content_tag :label,:class => "checkbox inline" do -%>
|
|
||||||
<%= f.check_box :is_hidden %>
|
|
||||||
<%= t('hide') %>
|
|
||||||
<% end -%>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
<div id="widget-tags" class="widget-box widget-size-300">
|
|
||||||
<div class="widget-action clear">
|
|
||||||
<a class="action"><i title="Setting" class="icon-cog icon-white tip"></i></a>
|
|
||||||
</div>
|
|
||||||
<h3 class="widget-title"><i class="icons-tag icons-white"></i><%= t('nccu.tags') %></h3>
|
|
||||||
<div class="widget-content clear form-horizontal">
|
|
||||||
<% @tags.each do |tag| %>
|
|
||||||
<%= content_tag :label,:class => "checkbox inline" do -%>
|
|
||||||
<%= check_box_tag 'news_bulletin[tag_ids][]', tag.id, @news_bulletin.tag_ids.include?(tag.id)%>
|
|
||||||
<%= tag[I18n.locale] %>
|
|
||||||
<%= hidden_field_tag 'news_bulletin[tag_ids][]', '' %>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% if @news_bulletin.is_rejected %>
|
|
||||||
<div id="widget-rejected" class="widget-box widget-size-300">
|
|
||||||
<div class="widget-action clear">
|
|
||||||
<a class="action"><i title="Rejected Report" class="icon-cog icon-white tip"></i></a>
|
|
||||||
</div>
|
|
||||||
<h3 class="widget-title"><i class="icons-tag icons-white"></i><%= t('approval.stat') %></h3>
|
|
||||||
<div class="widget-content clear form-horizontal">
|
|
||||||
<%= @news_bulletin.not_checked_reason rescue t("rejected_reason_empty") %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
<% if params[:action] != 'new' %>
|
|
||||||
<div id="widget-audit" class="widget-box">
|
|
||||||
<div class="widget-action clear">
|
|
||||||
<a class="action"><i title="A" class="icon-exclamation-sign icon-white tip"></i></a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<% elsif current_user.admin? %>
|
|
||||||
<%= f.hidden_field :is_checked,:value => true%>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<!--Wiget End-->
|
|
||||||
<!--Post Start-->
|
|
||||||
|
|
||||||
<div id="post-body">
|
|
||||||
<div id="post-body-content" class="clear">
|
|
||||||
<%= alert_block_tag(t("activerecord.errors.template.body"),session[:in_validate_object].errors.messages) unless session[:in_validate_object].blank? %>
|
|
||||||
<%= f.label :unit_list_for_anc,t(:unit_name)%>
|
|
||||||
<%= f.select :unit_list_for_anc_id,@unit_list_for_anc.collect{|t| [ t.title, t.id ]}, {:prompt => t("news_bulletin.ut_prompt")}, :class => "input-medium" %>
|
|
||||||
|
|
||||||
<%= f.label :category,t(:category) %>
|
|
||||||
<%= f.select :news_bulletin_category_id, @news_bulletin_categorys.collect{|t| [ t.title, t.id ]}, {}, :class => "input-medium" %>
|
|
||||||
|
|
||||||
<ul class="nav nav-tabs">
|
|
||||||
<%# @site_valid_locales.each_with_index do |locale, i| %>
|
|
||||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
|
||||||
<li <%= ( i == 0 ) ? " class=active" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div class="tab-content">
|
|
||||||
|
|
||||||
<%# @site_valid_locales.each_with_index do |locale, i| %>
|
|
||||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
|
||||||
|
|
||||||
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
|
||||||
|
|
||||||
<div class="title">
|
|
||||||
<%= f.label :title, t(:title)%>
|
|
||||||
<%= f.fields_for :title_translations do |f| %>
|
|
||||||
<%= I18nVariable.from_locale(locale) %>
|
|
||||||
<%= f.text_field locale, :class=>'post-title', :value => (@news_bulletin.title_translations[locale] rescue nil) %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="editor">
|
|
||||||
<%= f.label :subtitle, t(:subtitle) %>
|
|
||||||
<%= f.fields_for :subtitle_translations do |f| %>
|
|
||||||
<%= I18nVariable.from_locale(locale) %>
|
|
||||||
<%= f.text_area locale, :rows => 5, :style=>"width:100%", :value => (@news_bulletin.subtitle_translations[locale] rescue nil) %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="editor">
|
|
||||||
<%= f.label :text, t(:text) %>
|
|
||||||
<%= f.fields_for :text_translations do |f| %>
|
|
||||||
<%= I18nVariable.from_locale(locale) %>
|
|
||||||
<%= f.text_area locale, :style=>"width:100%", :class => 'tinymce_textarea', :value => (@news_bulletin.text_translations[locale] rescue nil) %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="main-wiget">
|
|
||||||
<div id="widget-link" class="widget-box">
|
|
||||||
<div class="widget-action clear">
|
|
||||||
<a class="action"><i title="Add a reference link" class="icon-exclamation-sign icon-white tip"></i></a>
|
|
||||||
</div>
|
|
||||||
<h3 class="widget-title"><i class="icons-link icons-white"></i><%= t(:link) %></h3>
|
|
||||||
<div class="widget-content">
|
|
||||||
|
|
||||||
<div id='news_bulletin_links' class="news_bulletin_links_block">
|
|
||||||
|
|
||||||
<table class="table table-condensed">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th><%= t('nccu.url') %></th>
|
|
||||||
<th><%= t('nccu.link_name') %></th>
|
|
||||||
<th class="span1"></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tfoot>
|
|
||||||
<tr>
|
|
||||||
<td style="text-align:center" colspan="4">
|
|
||||||
<div id='add_news_bulletin_link' class="info_input news_bulletin_links_block">
|
|
||||||
<%= hidden_field_tag 'news_bulletin_link_field_count', @news_bulletin.news_bulletin_links.count %>
|
|
||||||
<a class="add"><span class="btn btn-primary btn-small"><i class="icon-plus icon-white"></i><%= t(:add) %></span></a>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tfoot>
|
|
||||||
<tbody>
|
|
||||||
|
|
||||||
<% @news_bulletin.news_bulletin_links.each_with_index do |news_bulletin_link, i| %>
|
|
||||||
<%#= fields_for "news_bulletin[news_bulletin_links][]", news_bulletin_link do |f| %>
|
|
||||||
<%= f.fields_for :news_bulletin_links, news_bulletin_link do |f| %>
|
|
||||||
<%= render :partial => 'form_news_bulletin_link', :object => news_bulletin_link, :locals => {:f => f, :i => i} %>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="widget-file" class="widget-box">
|
|
||||||
<div class="widget-action clear">
|
|
||||||
<a class="action"><i title="Added to the file" class="icon-exclamation-sign icon-white tip"></i></a>
|
|
||||||
</div>
|
|
||||||
<h3 class="widget-title"><i class="icons-paperclip icons-white"></i><%= t('nccu.file') %></h3>
|
|
||||||
<div class="widget-content">
|
|
||||||
|
|
||||||
<div id='news_bulletin_files' class="news_bulletin_files_block">
|
|
||||||
|
|
||||||
<table class="table table-condensed">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th><%= t('nccu.selected_file') %></th>
|
|
||||||
<th><%= t('nccu.file_name') %></th>
|
|
||||||
<th><%= t('nccu.file_description') %></th>
|
|
||||||
<th class="span1"></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tfoot>
|
|
||||||
<tr>
|
|
||||||
<td style="text-align:center" colspan="4">
|
|
||||||
<div id='add_news_bulletin_file' class="info_input news_bulletin_files_block">
|
|
||||||
<%= hidden_field_tag 'news_bulletin_file_field_count', @news_bulletin.news_bulletin_files.count %>
|
|
||||||
<a class="add"><span class="btn btn-primary btn-small"><i class="icon-plus icon-white"></i><%= t(:add) %></span></a>
|
|
||||||
<p><%= t("sys.limit_of_upload_file_size",:best_size => '3MB') %></p>
|
|
||||||
<p><%= t("sys.preview_only_for_img") %></p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tfoot>
|
|
||||||
<tbody>
|
|
||||||
|
|
||||||
<% @news_bulletin.news_bulletin_files.each_with_index do |news_bulletin_file, i| %>
|
|
||||||
<%#= fields_for "news_bulletin[news_bulletin_files][]", news_bulletin_file do |f| %>
|
|
||||||
<%= f.fields_for :news_bulletin_files, news_bulletin_file do |f| %>
|
|
||||||
<%= render :partial => 'form_news_bulletin_file', :object => news_bulletin_file, :locals => {:f => f, :i => i} %>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--Post End-->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-actions">
|
|
||||||
<%= button_tag t("preview"), :id=>"button_for_preview", :name=>"commit", :class=>'btn post_preview two_btn',:type=>:button, :url=>preview_panel_news_back_end_news_bulletins_path %>
|
|
||||||
<%= f.submit t('submit'), :class=>'btn btn-primary two_btn' %>
|
|
||||||
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<% content_for :page_specific_javascript do %>
|
|
||||||
<%= javascript_include_tag "inc/jquery.imagesloaded.js" %>
|
|
||||||
<script>
|
|
||||||
$(document).ready(function() {
|
|
||||||
$('#add_news_bulletin_link a.add').live('click', function(){
|
|
||||||
var new_id = $(this).prev().attr('value');
|
|
||||||
var old_id = new RegExp("new_news_bulletin_links", "g");
|
|
||||||
$(this).prev().attr('value', parseInt(new_id) + 1);
|
|
||||||
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_news_bulletin_link', f, :news_bulletin_links) %>").replace(old_id, new_id));
|
|
||||||
});
|
|
||||||
$('#add_news_bulletin_file a.add').live('click', function(){
|
|
||||||
var new_id = $(this).prev().attr('value');
|
|
||||||
var old_id = new RegExp("new_news_bulletin_files", "g");
|
|
||||||
$(this).prev().attr('value', parseInt(new_id) + 1);
|
|
||||||
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_news_bulletin_file', f, :news_bulletin_files) %>").replace(old_id, new_id));
|
|
||||||
});
|
|
||||||
$('.for_preview').popover({ html : true });
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<% end %>
|
|
|
@ -1,73 +0,0 @@
|
||||||
|
|
||||||
<tr id="<%= "news_bulletin_file_#{form_news_bulletin_file.id}" if !form_news_bulletin_file.new_record? %>" class='list_item'>
|
|
||||||
<td>
|
|
||||||
<div class="control-group">
|
|
||||||
<div class="controls">
|
|
||||||
<%= f.file_field :file %>
|
|
||||||
<%= form_news_bulletin_file.file.file ? ( link_to t(:view), form_news_bulletin_file.file.url, {:class => 'for_preview btn', :target => '_blank', :title => t(:view)}.merge(file_picture_preview_setting(form_news_bulletin_file.file.url)) ) : '' %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
<div class="tab-content">
|
|
||||||
|
|
||||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
|
||||||
|
|
||||||
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
|
||||||
|
|
||||||
<%= f.fields_for :title_translations do |f| %>
|
|
||||||
<div class="control-group">
|
|
||||||
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
|
|
||||||
<div class="controls">
|
|
||||||
<%= f.text_field locale, :id => "link-#{locale}", :value => (form_news_bulletin_file.title_translations[locale] rescue nil) %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
<div class="tab-content">
|
|
||||||
|
|
||||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
|
||||||
|
|
||||||
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
|
||||||
|
|
||||||
<%= f.fields_for :description_translations do |f| %>
|
|
||||||
<div class="control-group">
|
|
||||||
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
|
|
||||||
<div class="controls">
|
|
||||||
<%= f.text_field locale, :id => "link-#{locale}", :value => (form_news_bulletin_file.description_translations[locale] rescue nil) %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<span class="action">
|
|
||||||
<% if form_news_bulletin_file.new_record? %>
|
|
||||||
<a class="delete"><i class="icon-remove"></i></a>
|
|
||||||
<% else %>
|
|
||||||
<%= f.hidden_field :id %>
|
|
||||||
<%= hidden_field_tag :tr, (dom_id form_news_bulletin_file) %>
|
|
||||||
<a class="remove_existing_record"><i class="icon-remove"></i></a>
|
|
||||||
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
|
|
||||||
<% end %>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
|
|
||||||
<tr id="<%= "news_bulletin_link_#{form_news_bulletin_link.id}" if !form_news_bulletin_link.new_record? %>" class='list_item'>
|
|
||||||
|
|
||||||
<td>
|
|
||||||
<div class="control-group">
|
|
||||||
<div class="controls">
|
|
||||||
<%= f.text_field :url %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="tab-content">
|
|
||||||
|
|
||||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
|
||||||
|
|
||||||
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
|
||||||
|
|
||||||
<%= f.fields_for :title_translations do |f| %>
|
|
||||||
<div class="control-group">
|
|
||||||
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
|
|
||||||
<div class="controls">
|
|
||||||
<%= f.text_field locale, :id => "link-#{locale}", :class => "input-xlarge", :value => (form_news_bulletin_link.title_translations[locale] rescue nil) %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<span class="action">
|
|
||||||
<% if form_news_bulletin_link.new_record? %>
|
|
||||||
<a class="delete"><i class="icon-remove"></i></a>
|
|
||||||
<% else %>
|
|
||||||
<%= f.hidden_field :id %>
|
|
||||||
<%= hidden_field_tag :tr, (dom_id form_news_bulletin_link) %>
|
|
||||||
<a class="remove_existing_record"><i class="icon-remove"></i></a>
|
|
||||||
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
|
|
||||||
<% end %>
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
|
@ -1,22 +0,0 @@
|
||||||
|
|
||||||
<tr id="<%= dom_id list_news_bulletin_file %>">
|
|
||||||
<td><%= list_news_bulletin_file.file.file ? ( link_to list_news_bulletin_file.title_translations['zh_tw'], list_news_bulletin_file.file.url, {:target => '_blank', :title => list_news_bulletin_file.description_translations['zh_tw']} ) : list_news_bulletin_file.title_translations['zh_tw'] %></td>
|
|
||||||
<td><%= list_news_bulletin_file.file.file ? ( link_to list_news_bulletin_file.title_translations['en'], list_news_bulletin_file.file.url, {:target => '_blank', :title => list_news_bulletin_file.description_translations['en']} ) : list_news_bulletin_file.title_translations['en'] %></td>
|
|
||||||
<td>
|
|
||||||
<a href="<%= panel_news_back_end_news_bulletin_file_quick_edit_path(list_news_bulletin_file) %>#modal-file" data-toggle="modal" data-remote="true" class="action"><i class="icon-pencil"></i></a>
|
|
||||||
<span class="action">
|
|
||||||
<%= fields_for "news_bulletin[news_bulletin_files_attributes][]", list_news_bulletin_file, :index => list_news_bulletin_file_counter do |f| %>
|
|
||||||
<%= f.hidden_field :id %>
|
|
||||||
<%= hidden_field_tag :tr, (dom_id list_news_bulletin_file) %>
|
|
||||||
<a class="remove_existing_record"><i class="icon-remove"></i></a>
|
|
||||||
<%= f.hidden_field :_destroy, :value => nil , :class => 'should_destroy' %>
|
|
||||||
<% end %>
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
<tr id="<%= dom_id list_news_bulletin_link %>">
|
|
||||||
<td><%= link_to list_news_bulletin_link.title_translations['zh_tw'], list_news_bulletin_link.url, :target => '_blank' %></td>
|
|
||||||
<td><%= link_to list_news_bulletin_link.title_translations['en'], list_news_bulletin_link.url, :target => '_blank' %></td>
|
|
||||||
<td>
|
|
||||||
<a href="<%= panel_news_back_end_news_bulletin_link_quick_edit_path(list_news_bulletin_link) %>#modal-link" data-toggle="modal" data-remote="true" class="action"><i class="icon-pencil"></i></a>
|
|
||||||
<span class="action">
|
|
||||||
<%= fields_for "news_bulletin[news_bulletin_links_attributes][]", list_news_bulletin_link, :index => list_news_bulletin_link_counter do |f| %>
|
|
||||||
<%= f.hidden_field :id %>
|
|
||||||
<%= hidden_field_tag :tr, (dom_id list_news_bulletin_link) %>
|
|
||||||
<a class="remove_existing_record"><i class="icon-remove"></i></a>
|
|
||||||
<%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
|
|
||||||
<% end %>
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
|
@ -1,76 +0,0 @@
|
||||||
<tr id="<%= dom_id news_bulletin %>" class="with_action">
|
|
||||||
<td>
|
|
||||||
<% if (news_bulletin.create_user_id == current_or_guest_user.id) || is_manager? %>
|
|
||||||
<%= check_box_tag 'to_delete[]', news_bulletin.id, false, :class => "checkbox_in_list" %>
|
|
||||||
<% end -%>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div class="label-group">
|
|
||||||
<div class="label-td">
|
|
||||||
<% if news_bulletin.is_top? %>
|
|
||||||
<span class="label label-success"><%= t(:top) %></span>
|
|
||||||
<% end %>
|
|
||||||
<% if news_bulletin.is_hot? %>
|
|
||||||
<span class="label label-important"><%= t('news_bulletin.hot') %></span>
|
|
||||||
<% end %>
|
|
||||||
<% if news_bulletin.is_hidden? %>
|
|
||||||
<span class="label"><%= t(:hidden) %></span>
|
|
||||||
<% end %>
|
|
||||||
<% if news_bulletin.is_pending? %>
|
|
||||||
<span class="label"><%= t(:pending) %></span>
|
|
||||||
<% end %>
|
|
||||||
<% if news_bulletin.is_checked? %>
|
|
||||||
<span class="label"><%= t(:passed) %></span>
|
|
||||||
<% end %>
|
|
||||||
<% if news_bulletin.is_rejected? %>
|
|
||||||
<span class="label"><%= t(:rejected) %></span>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<!-- <td><%= news_bulletin.news_bulletin_category.title rescue nil %></td> -->
|
|
||||||
<td> <%= show_news_bulletin_title_at_index news_bulletin%>
|
|
||||||
<div class="quick-edit">
|
|
||||||
<ul class="nav nav-pills hide">
|
|
||||||
<% if (news_bulletin.create_user_id == current_or_guest_user.id) || is_manager? %>
|
|
||||||
<% if current_or_guest_user.admin? || (!news_bulletin.is_rejected? && !news_bulletin.is_checked?) %>
|
|
||||||
<li><%= link_to t(:edit), edit_panel_news_back_end_news_bulletin_path(news_bulletin) %></li>
|
|
||||||
<li class="dropdown">
|
|
||||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle"><%= t(:quick_edit) %><b class="caret"></b></a>
|
|
||||||
<ul class="dropdown-menu" id="menu1">
|
|
||||||
<li><%= link_to t(:basic), load_quick_edit_panel_news_back_end_news_bulletin_path(news_bulletin, :type => 'basic'), :remote => true %></li>
|
|
||||||
<li><%= link_to t(:picture), load_quick_edit_panel_news_back_end_news_bulletin_path(news_bulletin, :type => 'picture'), :remote => true %></li>
|
|
||||||
<li><%= link_to t(:tags), load_quick_edit_panel_news_back_end_news_bulletin_path(news_bulletin, :type => 'tags'), :remote => true %></li>
|
|
||||||
<li><%#= link_to t(:link), load_quick_edit_panel_news_back_end_news_bulletin_path(news_bulletin, :type => 'links'), :remote => true %></li>
|
|
||||||
<li><%#= link_to t(:file_), load_quick_edit_panel_news_back_end_news_bulletin_path(news_bulletin, :type => 'files'), :remote => true %></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
<% if news_show_delete_link(news_bulletin) %>
|
|
||||||
<li class="dropdown"><%= link_to t(:delete), panel_news_back_end_news_bulletin_path(news_bulletin), :confirm => t(:sure?), :method => :delete, :remote => true %></li>
|
|
||||||
<% end %>
|
|
||||||
<% if news_show_approval_link(news_bulletin) %>
|
|
||||||
<li><%= link_to t(:approval_), panel_news_back_end_news_bulletin_approval_preview_path(news_bulletin),:class => 'preview_trigger' %></li><%#= #TODO add ancher so user can quick access into that part %>
|
|
||||||
<% end %>
|
|
||||||
<% if news_show_reject_reason(news_bulletin)%>
|
|
||||||
<li><%= link_to t(:rejected_reason)+truncate(news_bulletin.not_checked_reason, :length => 10),'#',:rel=>"tooltip" ,'data-original-title'=> (wrap_string_with(news_bulletin.not_checked_reason, :line_width => 24)),:class=>'reject_info' %></li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td><%= display_date(news_bulletin.postdate) %></td>
|
|
||||||
<td><%= (news_bulletin.deadline) ? display_date(news_bulletin.deadline) : t(:no_deadline) %></td>
|
|
||||||
<td>
|
|
||||||
<div class="label-group">
|
|
||||||
<div class="label-td">
|
|
||||||
<% news_bulletin.sorted_tags.each do |tag| %>
|
|
||||||
<span class="label label-tags"><%= tag[I18n.locale] %></span>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td><%= news_bulletin.view_count rescue nil %></td>
|
|
||||||
<td><%= news_bulletin.unit_list_for_anc.title rescue nil %> </td>
|
|
||||||
</tr>
|
|
||||||
<tr id="<%= dom_id news_bulletin, :edit %>" class="qe-block hide" />
|
|
|
@ -1,51 +0,0 @@
|
||||||
<% # encoding: utf-8 %>
|
|
||||||
|
|
||||||
<%= form_for @news_bulletin_file, :url => @file_url, :html => {:id => 'ajaxForm', :multipart => true} do |f| %>
|
|
||||||
|
|
||||||
<div class="modal-header">
|
|
||||||
<a class="close" data-dismiss="modal">×</a>
|
|
||||||
<h3><%= (@news_bulletin_file.new_record? ? 'Add File' : 'Edit File') %></h3>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body form-horizontal">
|
|
||||||
<div class="control-group">
|
|
||||||
<div class="controls">
|
|
||||||
<%= f.file_field :file %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<%= f.fields_for :title_translations do |f| %>
|
|
||||||
<% @site_valid_locales.each do |locale| %>
|
|
||||||
<div class="control-group">
|
|
||||||
<label for="file-<%= locale %>" class="control-label">Name <%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
|
|
||||||
<div class="controls">
|
|
||||||
<%= f.text_field locale, :id => "file-#{locale}", :class => "input-xlarge", :value => (@news_bulletin_file.title_translations[locale] rescue nil) %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= f.fields_for :description_translations do |f| %>
|
|
||||||
<% @site_valid_locales.each do |locale| %>
|
|
||||||
<div class="control-group">
|
|
||||||
<label for="file-<%= locale %>" class="control-label">Description <%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
|
|
||||||
<div class="controls">
|
|
||||||
<%= f.text_field locale, :id => "file-#{locale}", :class => "input-xlarge", :value => (@news_bulletin_file.description_translations[locale] rescue nil) %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal-footer">
|
|
||||||
<%= hidden_field_tag 'news_bulletin_file[news_bulletin_id]', @news_bulletin_file.news_bulletin_id %>
|
|
||||||
<a class="btn btn-primary" id='ajax_form_submit'><%= t('submit')%></a>
|
|
||||||
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
<% # encoding: utf-8 %>
|
|
||||||
|
|
||||||
<%= form_for(@news_bulletin_link, :remote => true, :url => @link_url) do |f| %>
|
|
||||||
|
|
||||||
<div class="modal-header">
|
|
||||||
<a class="close" data-dismiss="modal">×</a>
|
|
||||||
<h3><%= (@news_bulletin_link.new_record? ? 'Add Link' : 'Edit Link') %></h3>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body form-horizontal">
|
|
||||||
<div class="control-group">
|
|
||||||
<label for="http" class="control-label">URL</label>
|
|
||||||
<div class="controls">
|
|
||||||
<%= f.text_field :url %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<%= f.fields_for :title_translations do |f| %>
|
|
||||||
<% @site_valid_locales.each do |locale| %>
|
|
||||||
<div class="control-group">
|
|
||||||
<%= label_tag "link-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
|
|
||||||
<div class="controls">
|
|
||||||
<%#= f.text_field locale, :class => 'input-xxlarge' %>
|
|
||||||
<%= f.text_field locale, :value => (@news_bulletin_link.title_translations[locale] rescue nil) %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<%= hidden_field_tag 'news_bulletin_link[news_bulletin_id]', @news_bulletin_link.news_bulletin_id %>
|
|
||||||
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
|
|
||||||
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th class="span1"></th>
|
|
||||||
<th class="span1-2"></th>
|
|
||||||
<th class="span7"></th>
|
|
||||||
<th class="span1-2"></th>
|
|
||||||
<th class="span1-2"></th>
|
|
||||||
<th class="span1-2"></th>
|
|
||||||
<th class="span1-2"></th>
|
|
||||||
<th class="span1-3"></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody id="tbody_news_bulletins" class="sort-holder">
|
|
||||||
<%= render :partial => 'news_bulletin', :collection => @news_bulletins %>
|
|
||||||
</tbody>
|
|
|
@ -1,10 +0,0 @@
|
||||||
<td colspan="8">
|
|
||||||
<legend><%= t(:quick_edit) %> - <span class='qe_title'></span><%= t(type) %></legend>
|
|
||||||
<%= form_for @news_bulletin, :url => panel_news_back_end_news_bulletin_path(@news_bulletin), :html => {:class => 'form-horizontal'} do |f| %>
|
|
||||||
<%= render :partial => "panel/news/back_end/news_bulletins/quick_edit_#{@type}", :locals => { :f => f, :news_bulletin => @news_bulletin } %>
|
|
||||||
<div class="form-actions">
|
|
||||||
<%= f.submit t(:submit), :class => 'btn btn-primary' %>
|
|
||||||
<%= f.submit t(:cancel), :class => 'btn quick_edit_cancel', :type => 'reset', :rel => dom_id(@news_bulletin, :edit) %>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</td>
|
|
|
@ -1,65 +0,0 @@
|
||||||
<div id="qe-basic" class="qe-edit-div">
|
|
||||||
<div id="widget-category">
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label"><%= t(:category) %></label>
|
|
||||||
<div class="controls">
|
|
||||||
<%= f.select :news_bulletin_category_id, @news_bulletin_categories.collect {|t| [ t.title, t.id ]}, {}, :class => 'input-large' %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="widget-title">
|
|
||||||
<%= f.fields_for :title_translations do |f| %>
|
|
||||||
<% @site_valid_locales.each do |locale| %>
|
|
||||||
<div class="control-group">
|
|
||||||
<%= label_tag "title-#{locale}", "#{t(:title)}-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
|
|
||||||
<div class="controls">
|
|
||||||
<%= f.text_field locale, :class => 'input-xxlarge', :value => (news_bulletin.title_translations[locale] rescue nil) %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="widget-date">
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label"><%= t(:start) %></label>
|
|
||||||
<div class="controls">
|
|
||||||
<%= f.date_select :postdate, { :use_month_numbers => true, :order => [:day, :month, :year] }, :class => 'input-small' %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label"><%= t(:end) %></label>
|
|
||||||
<div class="controls">
|
|
||||||
<%= f.date_select :deadline, { :use_month_numbers => true, :prompt => { :month => 'Month', :day => 'Day', :year => 'Year'}, :order => [:day, :month, :year] }, :class => 'input-small' %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% if news_show_form_status_field(@news_bulletin)%>
|
|
||||||
<div id="widget-status">
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label"><%= t(:status) %></label>
|
|
||||||
<div class="controls">
|
|
||||||
<label class="checkbox inline"><%= f.check_box :is_hot %><%= t('news_bulletin.hot') %></label>
|
|
||||||
<label class="checkbox inline"><%= f.check_box :is_top %><%= t(:top) %></label>
|
|
||||||
<label class="checkbox inline"><%= f.check_box :is_hidden %><%= t(:hidden) %></label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end -%>
|
|
||||||
|
|
||||||
<!-- <div id="widget-role">
|
|
||||||
<div class="control-group">
|
|
||||||
<label class="control-label">Role</label>
|
|
||||||
<div class="controls">
|
|
||||||
<label class="radio inline"><%= f.radio_button :public, true, :class => 'privacy' %>Public</label>
|
|
||||||
<label class="radio inline"><%= f.radio_button :public, false, :class => 'privacy' %>Private</label>
|
|
||||||
<div class="well select-role" style="display:<%= news_bulletin.public ? 'none' : 'block' %>;">
|
|
||||||
<label class="checkbox inline"><input type="checkbox" value="student">Student</label>
|
|
||||||
<label class="checkbox inline"><input type="checkbox" value="teacher">Teacher</label>
|
|
||||||
<label class="checkbox inline"><input type="checkbox" value="staff">Staff</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
</div>
|
|
|
@ -1,26 +0,0 @@
|
||||||
<div id="qe-file" class="qe-edit-div">
|
|
||||||
<div id="widget-file">
|
|
||||||
<div class="control-group">
|
|
||||||
<table id="news_bulletin_files" class="table table-condensed">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Chinese</th>
|
|
||||||
<th>English</th>
|
|
||||||
<th class="span1"></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tfoot>
|
|
||||||
<tr>
|
|
||||||
<td style="text-align:center" colspan="3">
|
|
||||||
<a class="btn btn-primary btn-small" href="<%= panel_news_back_end_news_bulletin_file_quick_add_path(news_bulletin) %>#modal-file" data-toggle="modal" data-remote="true"><i class="icon-plus icon-white"></i> <%= t('add')%></a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tfoot>
|
|
||||||
<tbody>
|
|
||||||
<%= render :partial => 'list_news_bulletin_file', :collection => news_bulletin.news_bulletin_files %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -1,27 +0,0 @@
|
||||||
<div id="qe-link" class="qe-edit-div">
|
|
||||||
<div id="widget-link">
|
|
||||||
<div class="control-group">
|
|
||||||
<table id="news_bulletin_links" class="table table-condensed">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Chinese</th>
|
|
||||||
<th>English</th>
|
|
||||||
<th class="span1"></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tfoot>
|
|
||||||
<tr>
|
|
||||||
<td style="text-align:center" colspan="3">
|
|
||||||
<a class="btn btn-primary btn-small" href="<%= panel_news_back_end_news_bulletin_link_quick_add_path(news_bulletin) %>#modal-link" data-toggle="modal" data-remote="true"><i class="icon-plus icon-white"></i> <%= t('add')%></a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tfoot>
|
|
||||||
<tbody>
|
|
||||||
<%= render :partial => 'list_news_bulletin_link', :collection => news_bulletin.news_bulletin_links %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -1,25 +0,0 @@
|
||||||
<div id="qe-picture" class="qe-edit-div">
|
|
||||||
<div id="widget-picture clear">
|
|
||||||
<div class="control-group">
|
|
||||||
<!--<label class="control-label">Picture</label>-->
|
|
||||||
<div class="control-group">
|
|
||||||
<div class="controls upload-picture">
|
|
||||||
<%= image_tag(@news_bulletin.image.url , :class => "pull-left") if @news_bulletin.image? %>
|
|
||||||
</div>
|
|
||||||
<div class="controls file-upload input-prepend">
|
|
||||||
<label class="control-label add-on btn" for="input-upload">
|
|
||||||
<%= t(:browse) %>
|
|
||||||
<%= f.file_field :image, :id => "input-upload", :class => 'upload', :onchange => "document.getElementById('fu').innerHTML = this.form.fu.value = this.value;" %>
|
|
||||||
</label>
|
|
||||||
<span id='fu' class="file-name"></span>
|
|
||||||
<input name='fu' class="input-medium qe-picture-rename" type="text">
|
|
||||||
<br>
|
|
||||||
<% if news_bulletin.image.file %>
|
|
||||||
<%= f.check_box :remove_image %>
|
|
||||||
<%= t(:delete_file) %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -1,15 +0,0 @@
|
||||||
<div id="qe-tags" class="qe-edit-div">
|
|
||||||
<div id="widget-tags">
|
|
||||||
<div class="controls">
|
|
||||||
<div class="form-horizontal">
|
|
||||||
<% @tags.each do |tag| %>
|
|
||||||
<label class="checkbox inline">
|
|
||||||
<%= check_box_tag 'news_bulletin[tag_ids][]', tag.id, news_bulletin.tag_ids.include?(tag.id)%>
|
|
||||||
<%= tag[I18n.locale] %>
|
|
||||||
<%= hidden_field_tag 'news_bulletin[tag_ids][]', '' %>
|
|
||||||
</label>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -1,8 +0,0 @@
|
||||||
<%= render_sort_bar(true, delete_panel_news_back_end_news_bulletins_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]),
|
|
||||||
['status', ['is_top', 'is_hot', 'is_hidden', 'is_pending', 'is_checked', 'is_rejected'], 'span1-2', :status],
|
|
||||||
['title', 'title','span7', :title],
|
|
||||||
['start_date', 'postdate', 'span1-2', :start_date],
|
|
||||||
['end_date', 'deadline', 'span1-2', :end_date],
|
|
||||||
['tags', 'tags', 'span1-2', :tags],
|
|
||||||
['view_count', 'view_count','span1-2', :view_count],
|
|
||||||
['unit_list_for_anc', 'unit_list_for_anc','span1-3', :unit_name]).html_safe %>
|
|
|
@ -1,2 +0,0 @@
|
||||||
$("#modal-file").modal('hide');
|
|
||||||
$('<%= j render :partial => 'list_news_bulletin_file', :collection => [@news_bulletin_file] %>').appendTo('#news_bulletin_files').hide().fadeIn();
|
|
|
@ -1,2 +0,0 @@
|
||||||
$("#modal-link").modal('hide');
|
|
||||||
$('<%= j render :partial => 'list_news_bulletin_link', :collection => [@news_bulletin_link] %>').appendTo('#news_bulletin_links').hide().fadeIn();
|
|
|
@ -1 +0,0 @@
|
||||||
$("#<%= dom_id @news_bulletin %>").remove();
|
|
|
@ -1,13 +0,0 @@
|
||||||
<!-- <ul class="breadcrumb">
|
|
||||||
<li><span>Home</span><span class="divider">/</span></li>
|
|
||||||
<li><span>Library</span><span class="divider">/</span></li>
|
|
||||||
<li class="text-blue"><%= t('news_bulletin.editing_news') %></li>
|
|
||||||
</ul> -->
|
|
||||||
<div id="poststuff">
|
|
||||||
<%= form_for @news_bulletin, :url => panel_news_back_end_news_bulletin_path(@news_bulletin), :html => {:class => 'clear nccu_ajax_form'} do |f| %>
|
|
||||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
<% content_for :page_specific_javascript do %>
|
|
||||||
<%= javascript_include_tag "news_bulletin_form" %>
|
|
||||||
<% end %>
|
|
|
@ -1 +0,0 @@
|
||||||
$("#modal-file").html("<%= j render "news_bulletin_file_qe" %>");
|
|
|
@ -1 +0,0 @@
|
||||||
$("#modal-file").html("<%= j render "news_bulletin_file_qe" %>");
|
|
|
@ -1,30 +0,0 @@
|
||||||
<%= render 'filter' %>
|
|
||||||
<table id="bulettin_sort_list" class="table main-list">
|
|
||||||
<%= render 'news_bulletins' %>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<div class="form-actions form-fixed pagination-right">
|
|
||||||
<%= link_to(content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:add), new_panel_news_back_end_news_bulletin_path, :class => 'btn btn-primary pull-right' )if (is_manager? rescue nil)%>
|
|
||||||
<div id="news_bulletin_pagination" class="paginationFixed">
|
|
||||||
<%= paginate @news_bulletins, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]} %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="news_bulletin_link_qe">
|
|
||||||
<div id="modal-link" class="modal fade">
|
|
||||||
<%#= render :partial => "news_bulletin_link_qe" %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="news_bulletin_file_qe">
|
|
||||||
<div id="modal-file" class="modal fade">
|
|
||||||
<%#= render :partial => "news_bulletin_file_qe" %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<% content_for :page_specific_javascript do %>
|
|
||||||
<%= javascript_include_tag "news_bulletin_form" %>
|
|
||||||
<%= javascript_include_tag "/static/jquery.cycle.all.latest.js" %>
|
|
||||||
<%= javascript_include_tag "inc/modal-preview" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
$("#collapse-status").html("<%= j render 'filter_status' %>");
|
|
||||||
$("#collapse-category").html("<%= j render 'filter_categories' %>");
|
|
||||||
$("#collapse-tags").html("<%= j render 'filter_tags' %>");
|
|
||||||
$("#delete_all").attr("action", "<%= delete_panel_news_back_end_news_bulletins_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]) %>");
|
|
||||||
$("#sort_headers").html("<%= j render 'sort_headers' %>");
|
|
||||||
$("#tbody_news_bulletins").html("<%= j render :partial => 'news_bulletin', :collection => @news_bulletins %>");
|
|
||||||
$("#news_bulletin_pagination").html("<%= j paginate @news_bulletins, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>");
|
|
|
@ -1 +0,0 @@
|
||||||
$("#modal-link").html("<%= j render "news_bulletin_link_qe" %>");
|
|
|
@ -1 +0,0 @@
|
||||||
$("#modal-link").html("<%= j render "news_bulletin_link_qe" %>");
|
|
|
@ -1,2 +0,0 @@
|
||||||
$("#<%= dom_id @news_bulletin, :edit %>").show()
|
|
||||||
$("#<%= dom_id @news_bulletin, :edit %>").html("<%= j render :partial => 'quick_edit', :locals => {:type => @type} %>")
|
|
|
@ -1,5 +0,0 @@
|
||||||
<div id="poststuff">
|
|
||||||
<%= form_for @news_bulletin, :url => panel_news_back_end_news_bulletins_path,:html=>{ :class=>"nccu_ajax_form"} do |f| %>
|
|
||||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
|
@ -1,49 +0,0 @@
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<b><%= t(:category) %></b>
|
|
||||||
<%= @news_bulletin.news_bulletin_category.title rescue nil %>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<b><%= t(:postdate) %></b>
|
|
||||||
<%= display_date(@news_bulletin.postdate) %>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<b><%= t(:title) %></b>
|
|
||||||
<%= @news_bulletin.title %>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<%#= image_tag(@news_bulletin.image.url, :size => "320x240") if @news_bulletin.image.file %>
|
|
||||||
<%= link_to image_tag(@news_bulletin.image.url, :size => "320x240"), @news_bulletin.image.url, {:target => '_blank', :title => @news_bulletin.image_identifier} if @news_bulletin.image.file %>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<b><%= t(:subtitle) %></b>
|
|
||||||
<%= @news_bulletin.subtitle.html_safe rescue '' %>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<b><%= t(:text) %></b>
|
|
||||||
<%= @news_bulletin.text.html_safe rescue '' %>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<li>
|
|
||||||
<b><%= t(:link) %></b>
|
|
||||||
<% @news_bulletin.news_bulletin_links.each do | blink | %>
|
|
||||||
<%= link_to blink.title, blink.url, :target => '_blank' %>
|
|
||||||
<% end %>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<b><%= t(:file) %></b>
|
|
||||||
<% @news_bulletin.news_bulletin_files.each do | bfile | %>
|
|
||||||
<%= link_to bfile.title, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
|
|
||||||
<% end %>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<b><%= t(:posted_by) %></b>
|
|
||||||
<%= User.find(@news_bulletin.create_user_id).name %>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<b><%= t(:last_modified) %></b>
|
|
||||||
<%= display_date(@news_bulletin.updated_at) %>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
|
|
||||||
<%= link_back %>
|
|
|
@ -1,3 +0,0 @@
|
||||||
$("#enable_<%= @news_bulletin.id %>").toggle();
|
|
||||||
$("#disable_<%= @news_bulletin.id %>").toggle();
|
|
||||||
$("#news_bulletin_<%= @news_bulletin.id %>").toggleClass('disable');
|
|
|
@ -1,2 +0,0 @@
|
||||||
$("#modal-file").modal('hide');
|
|
||||||
$("#<%= dom_id @news_bulletin_file %>").replaceWith("<%= j render :partial => 'list_news_bulletin_file', :collection => [@news_bulletin_file] %>");
|
|
|
@ -1,2 +0,0 @@
|
||||||
$("#modal-link").modal('hide');
|
|
||||||
$("#<%= dom_id @news_bulletin_link %>").replaceWith("<%= j render :partial => 'list_news_bulletin_link', :collection => [@news_bulletin_link] %>");
|
|
|
@ -1,37 +0,0 @@
|
||||||
<% # encoding: utf-8 %>
|
|
||||||
|
|
||||||
<%= flash_messages %>
|
|
||||||
|
|
||||||
<h1 class="h1"><%= @page.title rescue nil %></h1>
|
|
||||||
|
|
||||||
<% if !params[:name].blank?%>
|
|
||||||
<%= t("search.unit_get",:unit_name => UnitListForAnc.find(params[:name]).title,:item_num=>@news_bulletins.count) %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if @news_bulletins.blank? and !params[:search_query].blank? %>
|
|
||||||
<%=render :partial => 'shared/search_not_found' %>
|
|
||||||
<% elsif !params[:search_query].blank? %>
|
|
||||||
<%= t("search.result_get",:search_word => params[:search_query],:item_num=>@news_bulletins.count) %>
|
|
||||||
<% end %>
|
|
||||||
<table class="table table-bordered">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<th class="span2"><%= t('news_bulletin.news_bulletin.image') %></th>
|
|
||||||
<th><%= t(:text) %></th>
|
|
||||||
<th class="span2 pagination-right"><%= t('news_bulletin.news_bulletin.postdate') %></th>
|
|
||||||
</tr>
|
|
||||||
<% @news_bulletins.each do |post| %>
|
|
||||||
<tr>
|
|
||||||
<td class="img"><%= image_tag post.image.url %></td>
|
|
||||||
<td>
|
|
||||||
<%= link_to post.title, panel_news_front_end_news_bulletin_path(post), :class => 'news_title' %>
|
|
||||||
<%= post.subtitle.html_safe rescue '' %>
|
|
||||||
</td>
|
|
||||||
<td class="date"><%= display_date(post.postdate) %></td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<%= paginate @news_bulletins, :param_name => :page_main, :params => {:inner => 'false'} %>
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue