Separate announcement and news
This commit is contained in:
parent
63ee8eaca9
commit
b8f52fa1ec
|
@ -27,8 +27,10 @@ class Admin::PagePartsController < ApplicationController
|
|||
@r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag
|
||||
@tag_objects = @r_tag.classify.constantize.all rescue nil
|
||||
case @module_app.key
|
||||
when 'bulletin'
|
||||
when 'announcement'
|
||||
@categories = BulletinCategory.all
|
||||
when 'news'
|
||||
@categories = NewsBulletinCategory.all
|
||||
when 'web_resource'
|
||||
@categories = WebLinkCategory.all
|
||||
end
|
||||
|
@ -67,6 +69,8 @@ class Admin::PagePartsController < ApplicationController
|
|||
case @module_app.key
|
||||
when 'announcement'
|
||||
@categories = BulletinCategory.all
|
||||
when 'news'
|
||||
@categories = NewsBulletinCategory.all
|
||||
when 'web_resource'
|
||||
@categories = WebLinkCategory.all
|
||||
end
|
||||
|
|
|
@ -31,7 +31,18 @@ class Admin::PagesController < ApplicationController
|
|||
@designs = Design.all.entries
|
||||
@design = @item.design ? @item.design : @designs.first
|
||||
@app_frontend_urls = @item.module_app.app_pages if @item.module_app
|
||||
@categories = BulletinCategory.all if @item.module_app && @item.module_app.key.eql?('announcement')
|
||||
if @item.module_app
|
||||
case @item.module_app.key
|
||||
when 'announcement'
|
||||
@categories = BulletinCategory.all
|
||||
when 'news'
|
||||
@categories = NewsBulletinCategory.all
|
||||
when 'web_resource'
|
||||
@categories = WebLinkCategory.all
|
||||
end
|
||||
else
|
||||
@categories = nil
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
|
|
|
@ -33,9 +33,9 @@ class PagesController < ApplicationController
|
|||
|
||||
def index_from_link
|
||||
if params[:page]
|
||||
redirect_to "/#{@item.full_name}?page=#{params[:page]}"
|
||||
redirect_to "/#{@item.full_name}?page=#{params[:page]}&category_id=#{params[:category_id]}&tag_id=#{params[:tag_id]}"
|
||||
else
|
||||
redirect_to "/#{@item.full_name}"
|
||||
redirect_to "/#{@item.full_name}?category_id=#{params[:category_id]}&tag_id=#{params[:tag_id]}"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -51,11 +51,11 @@ class PagesController < ApplicationController
|
|||
|
||||
def get_item
|
||||
module_app = ModuleApp.first(:conditions => {:key => params[:app_name]})
|
||||
if params[:category_id]
|
||||
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id]})
|
||||
else
|
||||
# if params[:category_id]
|
||||
# @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id]})
|
||||
# else
|
||||
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action]})
|
||||
end
|
||||
# end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -25,8 +25,8 @@ module OrbitBackendHelper
|
|||
content_tag :thead do
|
||||
content_tag :tr, :class => "sort-header" do
|
||||
concat (content_tag :th, :class => "span1 strong" do
|
||||
check_box_tag :check_all
|
||||
link_to content_tag(:i, nil, :class => "icon-trash"), '#', :class => "list-remove"
|
||||
concat check_box_tag :check_all
|
||||
concat link_to content_tag(:i, nil, :class => "icon-trash"), '#', :class => "list-remove"
|
||||
end) if delete_all
|
||||
titles.each do |title|
|
||||
concat render_title(title[0], title[1], title[2], title[3])
|
||||
|
|
|
@ -1 +1 @@
|
|||
<%= select 'page_part', 'category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => (@part ? @part[:category] : nil) if @categories && @categories.size > 0 %>
|
||||
<%= select 'page_part', 'category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => (@part ? @part[:category] : nil), :include_blank => true if @categories && @categories.size > 0 %>
|
|
@ -27,7 +27,7 @@
|
|||
<%= t('admin.module_app') %>
|
||||
<%= render :partial => "app_selector", :locals => { :f => f } %>
|
||||
<span id="app_page_url"><%= select('page','app_frontend_url', @app_frontend_urls, :selected => @item.app_frontend_url ) rescue ''%> </span>
|
||||
<span id="app_page_category"><%= select('page','category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => @item[:category] ) rescue ''%> </span>
|
||||
<span id="app_page_category"><%= select('page','category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => @item[:category], :include_blank => true ) rescue ''%> </span>
|
||||
</p>
|
||||
<p>
|
||||
<%= f.label :is_published, "#{t('admin.is_published')} ?" %>
|
||||
|
|
|
@ -16,6 +16,18 @@
|
|||
|
||||
<% end -%>
|
||||
|
||||
<%= content_tag :li, :class => active_for_controllers('news_bulletins', '/panel/news/back_end/tags', 'news_bulletin_categorys', 'news_approvals') do -%>
|
||||
<%= link_to content_tag(:i, nil, :class => 'icons-announcement') + 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('news.all_articles'), panel_news_back_end_news_bulletins_path), :class => active_for_action('news_bulletins', 'index') %>
|
||||
<%= content_tag :li, link_to(t('news.add_new'), new_panel_news_back_end_news_bulletin_path), :class => active_for_action('news_bulletins', 'new') %>
|
||||
<%= content_tag :li, link_to(t('news.categories'), panel_news_back_end_news_bulletin_categorys_path), :class => active_for_action('news_bulletin_categorys', 'index') %>
|
||||
<%= content_tag :li, link_to(t('news.tags'), panel_news_back_end_tags_path), :class => active_for_action('/panel/news/back_end/tags', 'index') %>
|
||||
<%= content_tag :li, link_to(t('news.news_bulletin.approval_setting'), panel_news_back_end_news_approval_setting_path), :class => active_for_action('news_approvals', 'setting') if (is_manager? rescue nil) %>
|
||||
<% end -%>
|
||||
|
||||
<% end -%>
|
||||
|
||||
<%#= content_tag :li, :class => active_for_controllers('users') do -%>
|
||||
<%#= link_to content_tag(:i, nil, :class => 'icons-member') + t('admin.member'), admin_users_path %>
|
||||
<%# end -%>
|
||||
|
|
|
@ -43,7 +43,9 @@ module ParserFrontEnd
|
|||
ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}"
|
||||
ret << "/#{id}" if id
|
||||
ret << "?inner=true&page_id=#{page.id}"
|
||||
ret << "&category_id=#{page.category}" if page[:category]
|
||||
# ret << "&category_id=#{page.category}" if page[:category]
|
||||
ret << "&category_id=#{params[:category_id]}" if !params[:category_id].blank?
|
||||
ret << "&tag_id=#{params[:tag_id]}" if !params[:tag_id].blank?
|
||||
ret << "'></div>"
|
||||
else
|
||||
part = page.page_parts.detect{ |p| p.name.to_s == content['name'].to_s } rescue nil
|
||||
|
@ -51,8 +53,15 @@ module ParserFrontEnd
|
|||
when 'text'
|
||||
ret << part.i18n_variable[I18n.locale] rescue ''
|
||||
when 'module_widget'
|
||||
if part[:category]
|
||||
ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true&category_id=#{part[:category]}'></div>"
|
||||
# if part[:category]
|
||||
# ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true&category_id=#{part[:category]}'></div>"
|
||||
# else
|
||||
# ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true'></div>"
|
||||
# end
|
||||
if !params[:category_id].blank?
|
||||
ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true&category_id=#{params[:category_id]}'></div>"
|
||||
elsif !params[:tag_id].blank?
|
||||
ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true&tag_id=#{params[:tag_id]}'></div>"
|
||||
else
|
||||
ret << "<div class='dymanic_load' path='/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true'></div>"
|
||||
end
|
||||
|
|
|
@ -11,8 +11,10 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
|
|||
def index
|
||||
|
||||
date_now = Time.now
|
||||
if params[:category_id]
|
||||
if !params[:category_id].blank?
|
||||
@bulletins = Bulletin.can_display.where(: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(10)
|
||||
elsif !params[:tag_id].blank?
|
||||
@bulletins = AnnouncementTag.find(params[:tag_id]).bulletins.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(10)
|
||||
else
|
||||
@bulletins = Bulletin.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(10)
|
||||
end
|
||||
|
|
|
@ -13,8 +13,10 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
|
|||
# deadline
|
||||
# @bulletin_categorys = BulletinCategory.first;
|
||||
# @bulletins = Bulletin.widget_datas(@bulletin_categorys.id).limit(9)
|
||||
if params[:category_id]
|
||||
if !params[:category_id].blank?
|
||||
@bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).widget_datas.limit(9)
|
||||
elsif !params[:tag_id].blank?
|
||||
@bulletins = AnnouncementTag.find(params[:tag_id]).bulletins.can_display.widget_datas.limit(9) rescue nil
|
||||
else
|
||||
@bulletins = Bulletin.can_display.widget_datas.limit(9)
|
||||
end
|
||||
|
@ -40,6 +42,11 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
|
|||
@selected_tag = AnnouncementTag.find(params[:tag_id])
|
||||
@web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(5) rescue nil
|
||||
end
|
||||
|
||||
def bulletins_side_bar
|
||||
@tags = AnnouncementTag.all
|
||||
get_categorys
|
||||
end
|
||||
|
||||
|
||||
protected
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<!-- <div class="search"> <input type="text" onfocus="this.value='';this.searchClickFlag=true;" onblur="if(this.value==''){this.value='公告搜尋';this.searchClickFlag=false;}" value="公告搜尋" id="q" class="search_key" name="q"/> <input type="submit" name="sa" id="sa" class="sa" value="." /> </div> -->
|
||||
<div class="category_list">
|
||||
<h3 class="h3"><%= t('announcement.categories') %></h3>
|
||||
<ul class="list">
|
||||
<% @bulletin_categorys.each do |category| %>
|
||||
<li>
|
||||
<%= link_to category.i18n_variable[I18n.locale], panel_announcement_front_end_bulletins_path(:category_id => category.id) %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tag_cloud">
|
||||
<h3 class="h3"><%= t('announcement.tag_cloud') %></h3>
|
||||
<ul class="cloud">
|
||||
<% @tags.each do |tag| %>
|
||||
<li class="hot<%#=rand(4) + 1%>">
|
||||
<%= link_to tag[I18n.locale], panel_announcement_front_end_bulletins_path(:tag_id => tag.id) %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- <div class="clear"></div> -->
|
||||
<!-- <div class="rss_feed">
|
||||
<a href="" class="rssimg"> Rss feed </a>
|
||||
</div> -->
|
|
@ -58,6 +58,7 @@ en:
|
|||
announcement:
|
||||
all_articles: List
|
||||
add_new: Add
|
||||
categories: Categories
|
||||
sure?: Sure?
|
||||
campus_news: Campus News
|
||||
more: more+
|
||||
|
@ -79,6 +80,8 @@ en:
|
|||
approval_setting_window_title: 'Unit'
|
||||
approval_user_list: 'Approval Users'
|
||||
cate_auth: Category Authorization
|
||||
tag_cloud: Tag cloud
|
||||
|
||||
# admin:
|
||||
# action: Action
|
||||
# add_language: Add language
|
||||
|
|
|
@ -61,7 +61,8 @@ zh_tw:
|
|||
approval_setting_window_title: '單位'
|
||||
approval_user_list: '審核者'
|
||||
cate_auth: '分類授權'
|
||||
|
||||
tag_cloud: 標籤雲
|
||||
|
||||
bulletin:
|
||||
last_modified: 最後修改於
|
||||
tags: 標籤
|
||||
|
|
|
@ -39,6 +39,7 @@ Rails.application.routes.draw do
|
|||
match "bulletins_and_web_links" => "bulletins#bulletins_and_web_links"
|
||||
match "reload_bulletins" => "bulletins#reload_bulletins"
|
||||
match "reload_web_links" => "bulletins#reload_web_links"
|
||||
match "bulletins_side_bar" => "bulletins#bulletins_side_bar"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
.bundle/
|
||||
log/*.log
|
||||
pkg/
|
||||
test/dummy/db/*.sqlite3
|
||||
test/dummy/log/*.log
|
||||
test/dummy/tmp/
|
|
@ -0,0 +1,17 @@
|
|||
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'
|
|
@ -0,0 +1,20 @@
|
|||
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.
|
|
@ -0,0 +1,3 @@
|
|||
= News
|
||||
|
||||
This project rocks and uses MIT-LICENSE.
|
|
@ -0,0 +1,39 @@
|
|||
#!/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
|
|
@ -0,0 +1,9 @@
|
|||
// This is a manifest file that'll be compiled into including all the files listed below.
|
||||
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
||||
// be included in the compiled file accessible from http://example.com/assets/application.js
|
||||
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
||||
// the compiled file.
|
||||
//
|
||||
//= require jquery
|
||||
//= require jquery_ujs
|
||||
//= require news_link
|
|
@ -0,0 +1,45 @@
|
|||
$(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");
|
||||
}
|
||||
});
|
||||
});
|
|
@ -0,0 +1,23 @@
|
|||
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
|
41
vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_approvals_controller.rb
vendored
Normal file
41
vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_approvals_controller.rb
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
class Panel::News::BackEnd::NewsApprovalsController < OrbitBackendController
|
||||
before_filter :authenticate_user!
|
||||
include AdminHelper
|
||||
|
||||
def setting
|
||||
@news_bulletin_categorys = NewsBulletinCategory.all
|
||||
if params.has_key?(:category_id)
|
||||
first_category = NewsBulletinCategory.find params[:category_id]
|
||||
if params[:commit] == 'Update'
|
||||
privilege_users = params[:users].collect{|key,value| User.find key } rescue []
|
||||
preload_object_auth_ary = first_category.object_auths.where(title: 'fact_check') || (first_category.object_auths.create :title=> 'fact_check')
|
||||
preload_object_auth = preload_object_auth_ary.first
|
||||
preload_object_auth.privilege_users = privilege_users
|
||||
preload_object_auth.save!
|
||||
end
|
||||
else
|
||||
first_category = @news_bulletin_categorys.first
|
||||
end
|
||||
preload_object_auth = first_category.object_auths.where(title: 'fact_check').empty?? (first_category.object_auths.create! :title=> 'fact_check') : first_category.object_auths.where(title: 'fact_check')
|
||||
@users_array = preload_object_auth.first.privilege_users rescue []
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def update_setting
|
||||
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def get_categorys(id = nil)
|
||||
@news_bulletin_categorys = []
|
||||
if(is_manager? || is_admin?)
|
||||
@news_bulletin_categorys = (id ? NewsBulletinCategory.find(id).to_a : NewsBulletinCategory.excludes('disabled' => true))
|
||||
elsif is_sub_manager?
|
||||
@news_bulletin_categorys = NewsBulletinCategory.authed_for_user(current_user,'submit_new')
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,118 @@
|
|||
class Panel::News::BackEnd::NewsBulletinCategorysController < OrbitBackendController
|
||||
|
||||
def index
|
||||
@news_bulletin_categorys = NewsBulletinCategory.all
|
||||
@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])
|
||||
@i18n_variable = @news_bulletin_category.i18n_variable
|
||||
|
||||
@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.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.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(panel_news_back_end_news_bulletin_categorys_url) }
|
||||
# format.xml { head :ok }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,48 @@
|
|||
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
|
|
@ -0,0 +1,49 @@
|
|||
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
|
408
vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb
vendored
Normal file
408
vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb
vendored
Normal file
|
@ -0,0 +1,408 @@
|
|||
class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
|
||||
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
|
||||
def index
|
||||
# @news_bulletins = NewsBulletin.all
|
||||
# @news_bulletins = NewsBulletin.desc("postdate desc")
|
||||
get_categorys(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_bulletins = (params[:sort] || @filter) ? get_sorted_and_filtered("news_bulletin") : NewsBulletin.all.page(params[:page]).per(10)
|
||||
@news_bulletin_categories = NewsBulletinCategory.all
|
||||
|
||||
@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
|
||||
@news_bulletin = NewsBulletin.new
|
||||
|
||||
@link_url = panel_news_back_end_news_bulletins_path
|
||||
|
||||
# @news_bulletin.news_bulletin_files.build
|
||||
# @news_bulletin.news_bulletin_files.new
|
||||
|
||||
get_categorys
|
||||
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_categorys
|
||||
get_tags
|
||||
end
|
||||
end
|
||||
|
||||
# POST /news_bulletins
|
||||
# POST /news_bulletins.xml
|
||||
def create
|
||||
|
||||
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
|
||||
format.js { render 'create_news_bulletin_file' }
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
@news_bulletin = NewsBulletin.new(params[:news_bulletin])
|
||||
|
||||
@news_bulletin.create_user_id = current_user.id
|
||||
@news_bulletin.update_user_id = current_user.id
|
||||
|
||||
respond_to do |format|
|
||||
if @news_bulletin.save
|
||||
# format.html { redirect_to(panel_news_back_end_news_bulletin_url(@news_bulletin), :notice => t('news.create_news_bulletin_success')) }
|
||||
format.html { redirect_to(panel_news_back_end_news_bulletins_url, :notice => t('news.create_news_bulletin_success')) }
|
||||
format.xml { render :xml => @news_bulletin, :status => :created, :location => @news_bulletin }
|
||||
format.js
|
||||
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])
|
||||
# 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])
|
||||
# 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.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
|
||||
|
||||
respond_to do |format|
|
||||
if @news_bulletin.update_attributes(params[:news_bulletin])
|
||||
# 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('news_bulletin.update_news_bulletin_success')) }
|
||||
format.js { render 'toggle_enable' }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
get_tags
|
||||
get_categorys
|
||||
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|
|
||||
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
|
||||
get_tags
|
||||
end
|
||||
|
||||
def delete
|
||||
if params[:to_delete]
|
||||
news_bulletins = NewsBulletin.any_in(:_id => params[:to_delete]).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 get_categorys(id = nil)
|
||||
@news_bulletin_categorys = []
|
||||
if(is_manager? || is_admin?)
|
||||
@news_bulletin_categorys = (id ? NewsBulletinCategory.find(id).to_a : NewsBulletinCategory.excludes('disabled' => true))
|
||||
elsif is_sub_manager?
|
||||
@news_bulletin_categorys = NewsBulletinCategory.authed_for_user(current_user,'submit_new')
|
||||
end
|
||||
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)
|
||||
end
|
||||
|
||||
def get_sorted_and_filtered_news_bulletins
|
||||
news_bulletins = NewsBulletin.all
|
||||
case params[:sort]
|
||||
when 'postdate', 'deadline'
|
||||
news_bulletins = news_bulletins.order_by([params[:sort], params[:direction]])
|
||||
when 'category'
|
||||
category_ids = news_bulletins.distinct(:news_bulletin_category_id)
|
||||
categories = NewsBulletinCategory.find(category_ids) rescue nil
|
||||
if categories
|
||||
h = Hash.new
|
||||
categories.each { |category| h[category.i18n_variable[I18n.locale]] = category.id }
|
||||
sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse!
|
||||
sorted_categorys = sorted.collect {|a| news_bulletins.where(:news_bulletin_category_id => a[1]).entries }
|
||||
news_bulletins = sorted_categorys.flatten!
|
||||
end
|
||||
when 'title'
|
||||
h = Array.new
|
||||
news_bulletins.each { |news_bulletin| h << [news_bulletin.title[I18n.locale].downcase, news_bulletin] }
|
||||
sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse!
|
||||
news_bulletins = sorted.collect {|a| a[1] }
|
||||
when 'status'
|
||||
news_bulletins = news_bulletins.order_by(:is_top, params[:direction]).order_by(:is_hot, params[:direction]).order_by(:is_hidden, params[:direction]).order_by(:is_pending, params[:direction]).order_by(:is_checked, params[:direction]).order_by(:is_rejected, params[:direction])
|
||||
when 'update_user_id'
|
||||
user_ids = news_bulletins.distinct(:update_user_id)
|
||||
users = User.find(user_ids) rescue nil
|
||||
if users
|
||||
h = Array.new
|
||||
users.each { |user| h << [user.name, user.id] }
|
||||
sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse!
|
||||
sorted_users = sorted.collect {|a| news_bulletins.where(:update_user_id => a[1]).entries }
|
||||
news_bulletins = sorted_users.flatten
|
||||
end
|
||||
when 'tags'
|
||||
a = Array.new
|
||||
NewsTag.all.order_by(I18n.locale, params[:direction]).each { |tag| a << tag.news_bulletins }
|
||||
a.flatten!
|
||||
a.uniq!
|
||||
tmp = Array.new
|
||||
news_bulletins.where(:tag_ids => []).each { |news_bulletin| tmp << [news_bulletin.title[I18n.locale].downcase, news_bulletin] }
|
||||
sorted = params[:direction].eql?('asc') ? tmp.sort : tmp.sort.reverse!
|
||||
sorted_titles = sorted.collect {|a| a[1] }
|
||||
a = params[:direction].eql?('asc') ? (sorted_titles + a) : (a + sorted_titles)
|
||||
news_bulletins = a.flatten
|
||||
end
|
||||
if @filter
|
||||
@filter.each do |key, value|
|
||||
case key
|
||||
when 'status'
|
||||
a = Array.new
|
||||
news_bulletins.each do |news_bulletin|
|
||||
value.each do |v|
|
||||
case v
|
||||
when 'pending'
|
||||
a << news_bulletin if news_bulletin.is_checked.nil?
|
||||
when 'rejected'
|
||||
a << news_bulletin if news_bulletin.is_checked.eql?(false)
|
||||
else
|
||||
a << news_bulletin if news_bulletin[v]
|
||||
end
|
||||
end
|
||||
end
|
||||
news_bulletins = a.uniq
|
||||
when 'categories'
|
||||
a = Array.new
|
||||
news_bulletins.each do |news_bulletin|
|
||||
a << news_bulletin if value.include?(news_bulletin.news_bulletin_category.id.to_s)
|
||||
end
|
||||
news_bulletins = a.uniq
|
||||
when 'tags'
|
||||
a = Array.new
|
||||
news_bulletins.each do |news_bulletin|
|
||||
news_bulletin.tags.each do |tag|
|
||||
a << news_bulletin if value.include?(tag.id.to_s)
|
||||
end
|
||||
end
|
||||
news_bulletins = a.uniq
|
||||
end if value.size > 0
|
||||
end
|
||||
end
|
||||
Kaminari.paginate_array(news_bulletins).page(params[:page]).per(10)
|
||||
end
|
||||
|
||||
end
|
8
vendor/built_in_modules/news/app/controllers/panel/news/back_end/tags_controller.rb
vendored
Normal file
8
vendor/built_in_modules/news/app/controllers/panel/news/back_end/tags_controller.rb
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
class Panel::News::BackEnd::TagsController < Admin::TagsController
|
||||
|
||||
def initialize
|
||||
super
|
||||
@app_title = 'news'
|
||||
end
|
||||
|
||||
end
|
38
vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb
vendored
Normal file
38
vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController
|
||||
|
||||
def initialize
|
||||
super
|
||||
@app_title = 'news'
|
||||
end
|
||||
|
||||
# GET /news_bulletins
|
||||
# GET /news_bulletins.xml
|
||||
|
||||
def index
|
||||
date_now = Time.now
|
||||
if !params[:category_id].blank?
|
||||
@news_bulletins = NewsBulletin.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(10)
|
||||
elsif !params[:tag_id].blank?
|
||||
@news_bulletins = NewsTag.find(params[:tag_id]).news_bulletins.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(10)
|
||||
else
|
||||
@news_bulletins = NewsBulletin.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(10)
|
||||
end
|
||||
|
||||
get_categorys
|
||||
|
||||
@current_category = NewsBulletinCategory.from_id(params[:category_id]) rescue nil
|
||||
end
|
||||
|
||||
def show
|
||||
@news_bulletin = NewsBulletin.can_display.where(_id: params[:id]).first
|
||||
get_categorys
|
||||
end
|
||||
|
||||
|
||||
protected
|
||||
|
||||
def get_categorys
|
||||
@news_bulletin_categorys = NewsBulletinCategory.excludes('disabled' => true)
|
||||
end
|
||||
|
||||
end
|
58
vendor/built_in_modules/news/app/controllers/panel/news/widget/news_bulletins_controller.rb
vendored
Normal file
58
vendor/built_in_modules/news/app/controllers/panel/news/widget/news_bulletins_controller.rb
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
class Panel::News::Widget::NewsBulletinsController < OrbitWidgetController
|
||||
|
||||
def initialize
|
||||
super
|
||||
@app_title = 'news'
|
||||
end
|
||||
|
||||
# GET /news_bulletins
|
||||
# GET /news_bulletins.xml
|
||||
|
||||
def index
|
||||
|
||||
# deadline
|
||||
# @news_bulletin_categorys = NewsBulletinCategory.first;
|
||||
# @news_bulletins = NewsBulletin.widget_datas(@news_bulletin_categorys.id).limit(9)
|
||||
if !params[:category_id].blank?
|
||||
@news_bulletins = NewsBulletin.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.can_display.widget_datas.limit(9) rescue nil
|
||||
else
|
||||
@news_bulletins = NewsBulletin.can_display.widget_datas.limit(9)
|
||||
end
|
||||
|
||||
get_categorys
|
||||
|
||||
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.can_display.page(params[:page]).per(5) rescue nil
|
||||
@web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(5) rescue nil
|
||||
render :layout => 'module_widget'
|
||||
end
|
||||
|
||||
def reload_news_bulletins
|
||||
@selected_tag = NewsTag.find(params[:tag_id])
|
||||
@news_bulletins = @selected_tag.get_visible_news_bulletins.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.page(params[:page]).per(5) rescue nil
|
||||
end
|
||||
|
||||
def news_bulletins_side_bar
|
||||
@tags = NewsTag.all
|
||||
get_categorys
|
||||
end
|
||||
|
||||
|
||||
protected
|
||||
|
||||
def get_categorys
|
||||
@news_bulletin_categorys = NewsBulletinCategory.excludes('disabled' => true)
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,182 @@
|
|||
# encoding: utf-8
|
||||
|
||||
class NewsBulletin
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include Mongoid::MultiParameterAttributes
|
||||
|
||||
has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
has_one :subtitle, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
has_one :text, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
has_and_belongs_to_many :tags, :class_name => "NewsTag"
|
||||
|
||||
field :postdate , :type => Date
|
||||
field :deadline , :type => Date
|
||||
# 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 :not_checked_reason
|
||||
|
||||
field :public, :type => Boolean, :default => true
|
||||
|
||||
scope :can_display,where(is_checked: true)
|
||||
|
||||
mount_uploader :image, ImageUploader
|
||||
|
||||
belongs_to :news_bulletin_category
|
||||
|
||||
# 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_presence_of :title
|
||||
|
||||
before_save :set_key, :update_status
|
||||
|
||||
after_save :save_news_bulletin_links
|
||||
after_save :save_news_bulletin_files
|
||||
|
||||
|
||||
def self.search( search = nil, category_id = nil )
|
||||
if category_id.to_s.size > 0 and search.to_s.size > 0
|
||||
key = /#{search}/
|
||||
find(:all, :conditions => {title: key, news_bulletin_category_id: category_id}).desc( :is_top, :postdate )
|
||||
elsif category_id.to_s.size > 0 and search.to_s.size < 1
|
||||
find(:all, :conditions => {news_bulletin_category_id: category_id}).desc( :is_top, :postdate )
|
||||
elsif search.to_s.size > 0 and category_id.to_s.size < 1
|
||||
key = /#{search}/
|
||||
find(:all, :conditions => {title: key}).desc( :is_top, :postdate )
|
||||
else
|
||||
find(:all).desc( :is_top, :postdate)
|
||||
end
|
||||
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} ).desc( :is_top, :postdate)
|
||||
else
|
||||
any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate)
|
||||
end
|
||||
|
||||
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_checked
|
||||
end
|
||||
|
||||
def is_pending?
|
||||
self.is_pending
|
||||
end
|
||||
|
||||
def is_rejected?
|
||||
self.is_rejected
|
||||
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 title
|
||||
@title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
|
||||
end
|
||||
|
||||
def subtitle
|
||||
@subtitle ||= I18nVariable.first(:conditions => {:key => 'subtitle', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
|
||||
end
|
||||
|
||||
def text
|
||||
@text ||= I18nVariable.first(:conditions => {:key => 'text', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
|
||||
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
|
||||
|
||||
protected
|
||||
|
||||
def set_key
|
||||
if title.new_record?
|
||||
title.key = 'title'
|
||||
end
|
||||
if subtitle.new_record?
|
||||
subtitle.key = 'subtitle'
|
||||
end
|
||||
if text.new_record?
|
||||
text.key = 'text'
|
||||
end
|
||||
end
|
||||
|
||||
def update_status
|
||||
if !self.is_pending && !self.is_checked
|
||||
self.is_pending = false
|
||||
self.is_rejected = true
|
||||
self.is_checked = false
|
||||
elsif self.is_checked
|
||||
self.is_pending = false
|
||||
self.is_rejected = false
|
||||
self.is_checked = true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
|
@ -0,0 +1,25 @@
|
|||
# encoding: utf-8
|
||||
|
||||
class NewsBulletinCategory
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include OrbitCoreLib::ObjectAuthable
|
||||
|
||||
ObjectAuthTitlesOptions = %W{submit_new fact_check}
|
||||
AfterObjectAuthUrl = '/panel/news/back_end/news_bulletin_categorys'
|
||||
# include Mongoid::MultiParameterAttributes
|
||||
|
||||
PAYMENT_TYPES = [ "List", "Picture" ]
|
||||
|
||||
field :key
|
||||
field :display
|
||||
|
||||
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
|
||||
has_many :news_bulletins
|
||||
|
||||
def self.from_id(id)
|
||||
NewsBulletinCategory.find(id) rescue nil
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,40 @@
|
|||
class NewsBulletinFile
|
||||
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
mount_uploader :file, AssetUploader
|
||||
|
||||
# field :filetitle
|
||||
# field :description
|
||||
has_one :filetitle, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
has_one :description, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
|
||||
# field :to_save, :type => Boolean
|
||||
field :should_destroy, :type => Boolean
|
||||
|
||||
belongs_to :news_bulletin
|
||||
# embedded_in :news_bulletin
|
||||
|
||||
before_save :set_key
|
||||
|
||||
def filetitle
|
||||
@filetitle ||= I18nVariable.first(:conditions => {:key => 'filetitle', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
|
||||
end
|
||||
|
||||
def description
|
||||
@description ||= I18nVariable.first(:conditions => {:key => 'description', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def set_key
|
||||
if filetitle.new_record?
|
||||
filetitle.key = 'filetitle'
|
||||
end
|
||||
if description.new_record?
|
||||
description.key = 'description'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,15 @@
|
|||
class NewsBulletinLink
|
||||
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
field :url
|
||||
# field :name
|
||||
|
||||
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
|
||||
|
||||
field :should_destroy, :type => Boolean
|
||||
|
||||
# embedded_in :news_bulletin
|
||||
belongs_to :news_bulletin
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
class NewsTag < Tag
|
||||
|
||||
has_and_belongs_to_many :news_bulletins
|
||||
|
||||
|
||||
def get_visible_news_bulletins(sort = :name)
|
||||
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
|
||||
|
||||
end
|
46
vendor/built_in_modules/news/app/views/panel/news/back_end/fact_checks/setting.html.erb
vendored
Normal file
46
vendor/built_in_modules/news/app/views/panel/news/back_end/fact_checks/setting.html.erb
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
<% content_for :page_specific_css do %>
|
||||
<%= stylesheet_link_tag "inc/permission-checkbox" %>
|
||||
<% end %>
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<<<<<<< HEAD
|
||||
<%= javascript_include_tag "bootstrap" %>
|
||||
<%#= javascript_include_tag "inc/permission-checkbox" %>
|
||||
<%#= javascript_include_tag "inc/search" %>
|
||||
=======
|
||||
<%= javascript_include_tag "inc/permission-checkbox" %>
|
||||
<%= javascript_include_tag "inc/search" %>
|
||||
>>>>>>> 291d5e3a03ba7da62ceb5e3b18012f0c9198dfba
|
||||
<% end %>
|
||||
<%#= label_tag :fact_check_setting, t("news.news_bulletin.fact_check_setting") %>
|
||||
<%= 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("news.news_bulletin.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("admin.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>
|
|
@ -0,0 +1,15 @@
|
|||
<h1><%= news_bulletin_category.key %></h1>
|
||||
<table>
|
||||
<tr>
|
||||
<th><%= t('news_bulletin.status') %></th>
|
||||
<th><%= t('news_bulletin.category') %></th>
|
||||
<th><%= t('news_bulletin.title') %></th>
|
||||
<th><%= t('news_bulletin.postdate') %></th>
|
||||
<th><%= t('news_bulletin.deadline') %></th>
|
||||
<th><%= t('news_bulletin.action') %></th>
|
||||
</tr>
|
||||
|
||||
<% news_bulletin_category.news_bulletins.each do |post| %>
|
||||
<%= render :partial => 'panel/news/back_end/news_bulletins/news_bulletins', :locals => {:post => post,:approval_allow=>true} %>
|
||||
<% end %>
|
||||
</table>
|
|
@ -0,0 +1,26 @@
|
|||
<%= content_tag :div ,:id => "users_checkbox_ary",:class => 'clear' do -%>
|
||||
<% sys_users = User.all -%>
|
||||
<% sys_users.each do |user| -%>
|
||||
|
||||
<div class="checkblock">
|
||||
|
||||
<% user.sub_roles.each do |sr| %>
|
||||
<div class="for_unit" style="display:none;"> <%= sr.key %></div>
|
||||
<% end %>
|
||||
<%= content_tag :div,:data=>{'original-title'=>t('news.news_bulletin.approval_setting_window_title'),:content => "#{user.sub_roles.collect{|sr| sr.key}.join(',')}"},:class=>"checkbox clear" do %>
|
||||
<div class="check-icon">
|
||||
</div>
|
||||
<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 -%>
|
||||
<%= check_box_tag "[users][#{user.id}]", 'true',users.include?(user),:class => "check" -%>
|
||||
<%end -%>
|
||||
</div>
|
||||
|
||||
<% end -%>
|
||||
<% end -%>
|
50
vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/index.html.erb.can_del
vendored
Normal file
50
vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/index.html.erb.can_del
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
<%= render 'panel/news/back_end/news_bulletins/filter' %>
|
||||
<table id="bulettin_sort_list" class="table main-list">
|
||||
<%= render 'panel/news/back_end/news_bulletins/news_bulletins' %>
|
||||
</table>
|
||||
<div class="form-actions">
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_news_back_end_news_bulletin_path, :class => 'btn btn-primary' %>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<% content_for :secondary do %>
|
||||
<%#= render :partial => '/panel/news/back_end/news_secondary' %>
|
||||
<% end -%>
|
||||
|
||||
<%= flash_messages %>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<fieldset><legend><%= t('news_bulletin.search') %></legend>
|
||||
|
||||
<%= form_for :news_bulletin, :action => 'search', :method => 'get', :url => panel_news_back_end_news_bulletins_path do |f| %>
|
||||
|
||||
<%#= f.select :news_bulletin_category_id, @news_bulletin_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ] },{ :include_blank => t('news_bulletin.select') }%>
|
||||
|
||||
Category <%#= select_tag "category_id", options_for_select(@news_bulletin_categorys.collect{|t| [t.i18n_variable[I18n.locale], t.id]}), :prompt => t('news_bulletin.select') %>
|
||||
|
||||
KeyWord <%#= text_field_tag :search, params[:search], :id => 'search_field' %>
|
||||
|
||||
<%= submit_tag "Search", :name => nil %>
|
||||
|
||||
<% end %>
|
||||
|
||||
|
||||
</fieldset>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<h1><%= t('news_bulletin.list_news') %></h1>
|
||||
|
||||
<div id="check_block">
|
||||
<h1>Check Please</h1>
|
||||
<%#= render :partial => "list_table", :collection => @news_bulletin_categorys_check,:as => :news_bulletin_category%>
|
||||
</div>
|
||||
<br />
|
||||
|
||||
-->
|
40
vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/setting.html.erb
vendored
Normal file
40
vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/setting.html.erb
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
<% 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" %>
|
||||
<% end %>
|
||||
<%#= label_tag :fact_check_setting, t("news.news_bulletin.fact_check_setting") %>
|
||||
<%= 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("news.news_bulletin.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("admin.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
vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/setting.js.erb
vendored
Normal file
1
vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/setting.js.erb
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
$("#users_checkbox_ary").replaceWith('<%= (render :partial => 'privilege_user', :locals => {:users => @users_array}).html_safe%>');
|
|
@ -0,0 +1,37 @@
|
|||
<% # encoding: utf-8 %>
|
||||
|
||||
<%= form_for(@news_bulletin_category, :remote => true, :url => @url) do |f| %>
|
||||
|
||||
<h2><%= (@news_bulletin_category.new_record? ? 'Add' : 'Edit') %></h2>
|
||||
|
||||
<div id="widget-title">
|
||||
<%= f.label :key %>
|
||||
<%= f.text_field :key %>
|
||||
</div>
|
||||
|
||||
<div id="widget-title">
|
||||
<%= f.fields_for :i18n_variable, (@news_bulletin_category.new_record? ? @news_bulletin_category.build_i18n_variable : @news_bulletin_category.i18n_variable) do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<div class="control-group">
|
||||
<%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :class => 'input-xxlarge' %>
|
||||
</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 %>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
<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">
|
||||
<li><%= link_to t('news_bulletin_category.edit'), edit_panel_news_back_end_news_bulletin_category_path(news_bulletin_category), :remote => true %></li>
|
||||
<li><%= link_to t('news_bulletin_category.delete'), panel_news_back_end_news_bulletin_category_path(news_bulletin_category), :confirm => t('news.sure?'), :method => :delete, :remote => true %></li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td><%= news_bulletin_category.i18n_variable[locale] rescue nil %></td>
|
||||
<% end %>
|
||||
</tr>
|
|
@ -0,0 +1,28 @@
|
|||
<% # 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 :i18n_variable, news_bulletin_category.i18n_variable 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' %>
|
||||
</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>
|
|
@ -0,0 +1,2 @@
|
|||
$('<%= j render :partial => 'news_bulletin_category', :collection => [@news_bulletin_category] %>').appendTo('#news_bulletin_categorys').hide().fadeIn();
|
||||
$("#new_news_bulletin_category")[0].reset();
|
|
@ -0,0 +1 @@
|
|||
$("#<%= dom_id @news_bulletin_category %>").remove();
|
|
@ -0,0 +1,7 @@
|
|||
<h1><%= t('news.editing_news_class') %></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 %>
|
|
@ -0,0 +1 @@
|
|||
$("#form > form").replaceWith("<%= j render "form" %>");
|
|
@ -0,0 +1,23 @@
|
|||
|
||||
<%= flash_messages %>
|
||||
|
||||
<table id="news_bulletin_categorys" class="table main-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="span1-2"><%= t('news_bulletin_category.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" %></div>
|
||||
|
||||
|
||||
|
19
vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/new.html.erb
vendored
Normal file
19
vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/new.html.erb
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
<% content_for :secondary do %>
|
||||
<%= render :partial => '/panel/news/back_end/news_secondary' %>
|
||||
<% end -%>
|
||||
|
||||
<%= flash_messages %>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<h1><%= t('news_bulletin_category.new_news_class') %></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 %>
|
||||
|
|
@ -0,0 +1 @@
|
|||
$("#form > form").replaceWith("<%= j render "form" %>");
|
|
@ -0,0 +1,4 @@
|
|||
$("#<%= 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();
|
|
@ -0,0 +1,3 @@
|
|||
<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 js_history" %>
|
||||
</div>
|
37
vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_file.html.erb
vendored
Normal file
37
vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_file.html.erb
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
<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 :filetitle %>
|
||||
|
||||
<%= 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>
|
37
vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_filter.html.erb
vendored
Normal file
37
vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_filter.html.erb
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
<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("news.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("news.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("news.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 %>
|
|
@ -0,0 +1,6 @@
|
|||
<div class="accordion-inner" data-toggle="buttons-checkbox">
|
||||
<% @news_bulletin_categories.each do |category| -%>
|
||||
<%= link_to category.i18n_variable[I18n.locale], 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 js_history#{is_filter_active?('categories', category.id)}" %>
|
||||
<% end -%>
|
||||
</div>
|
||||
<%= render :partial => 'clear_filters', :locals => {:type => 'categories'} %>
|
|
@ -0,0 +1,9 @@
|
|||
<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 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 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 js_history#{is_filter_active?('status', 'is_hidden')}" %>
|
||||
<%= 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 js_history#{is_filter_active?('status', 'is_pending')}" %>
|
||||
<%= 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 js_history#{is_filter_active?('status', 'is_checked')}" %>
|
||||
<%= 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 js_history#{is_filter_active?('status', 'is_rejected')}" %>
|
||||
</div>
|
||||
<%= render :partial => 'clear_filters', :locals => {:type => 'status'} %>
|
|
@ -0,0 +1,6 @@
|
|||
<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 js_history#{is_filter_active?('tags', tag.id)}" %>
|
||||
<% end -%>
|
||||
</div>
|
||||
<%= render :partial => 'clear_filters', :locals => {:type => 'tags'} %>
|
310
vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb
vendored
Normal file
310
vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb
vendored
Normal file
|
@ -0,0 +1,310 @@
|
|||
<% # encoding: utf-8 %>
|
||||
|
||||
<!--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>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, :width=> "456", :height=>'700' rescue ''%>
|
||||
<% else %>
|
||||
<img class="pull-left upload-picture" src="/assets/default-img.png" />
|
||||
<% end %>
|
||||
|
||||
</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>
|
||||
<br>
|
||||
<input name='fu' class="input-medium" type="text">
|
||||
<br>
|
||||
<% if @news_bulletin.image.file %>
|
||||
<%= f.check_box :remove_image %>
|
||||
<%= t('news.刪除已上傳檔案') %>
|
||||
<% 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> Date</h3>
|
||||
<div class="widget-content clear">
|
||||
<div class="control-group">
|
||||
<label class="control-label">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">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>
|
||||
|
||||
<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>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('hot') %>
|
||||
<% end -%>
|
||||
<%= content_tag :label,:class => "checkbox inline" do -%>
|
||||
<%= f.check_box :is_hidden %>
|
||||
<%= t('hide') %>
|
||||
<% end -%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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>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] %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% 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>
|
||||
|
||||
<h3 class="widget-title"><i class="icons-link icons-white"></i>Audit</h3>
|
||||
<div class="widget-content">
|
||||
|
||||
<% if is_manager? || @news_bulletin.news_bulletin_category.authed_users('fact_check').include?(current_user) || current_user.admin? %>
|
||||
<div class="controls">
|
||||
<%= f.label :approval_stat, t('news.news_bulletin.approval_stat') %>
|
||||
<%= content_tag :label,:class => "radio inline" do -%>
|
||||
<%= f.radio_button :is_checked, true , {:class => 'privacy'} %>
|
||||
<%= t('news.news_bulletin.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('news.news_bulletin.approval_not_pass') %>
|
||||
<% end -%>
|
||||
<div class="select-role">
|
||||
<%= label :is_checked_false, t('news.news_bulletin.approval_not_pass_reason') %>
|
||||
<%= f.text_field :not_checked_reason %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
</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">
|
||||
|
||||
<%= f.label :category %>
|
||||
<%= f.select :news_bulletin_category_id, @news_bulletin_categorys.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %>
|
||||
|
||||
<ul class="nav nav-tabs">
|
||||
<%# @site_valid_locales.each_with_index do |locale, i| %>
|
||||
<% site_valid_locales_default_head.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_default_head.each_with_index do |locale, i| %>
|
||||
|
||||
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :title %>
|
||||
<%= f.fields_for :title, (@news_bulletin.new_record? ? @news_bulletin.build_title : @news_bulletin.title ) do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_field locale, :class=>'post-title' %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="editor">
|
||||
<%= f.label :subtitle %>
|
||||
<%= f.fields_for :subtitle, (@news_bulletin.new_record? ? @news_bulletin.build_subtitle : @news_bulletin.subtitle ) do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_area locale, :style=>"width:100%", :class => 'tinymce_textarea' %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="editor">
|
||||
<%= f.label :text %>
|
||||
<%= f.fields_for :text, (@news_bulletin.new_record? ? @news_bulletin.build_text : @news_bulletin.text ) do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_area locale, :style=>"width:100%", :class => 'tinymce_textarea' %>
|
||||
<% 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>Link</h3>
|
||||
<div class="widget-content">
|
||||
|
||||
<div id='news_bulletin_links' class="news_bulletin_links_block">
|
||||
|
||||
<table class="table table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>URL</th>
|
||||
<th>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>File</h3>
|
||||
<div class="widget-content">
|
||||
|
||||
<div id='news_bulletin_files' class="news_bulletin_files_block">
|
||||
|
||||
<table class="table table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>File</th>
|
||||
<th>Name</th>
|
||||
<th><%= t('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>
|
||||
</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">
|
||||
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
|
||||
<%= 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>
|
||||
$('#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));
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
|
@ -0,0 +1,72 @@
|
|||
|
||||
<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 => 'btn', :target => '_blank', :title => t(:view)} ) : '' %>
|
||||
</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 :filetitle, (form_news_bulletin_file.new_record? ? form_news_bulletin_file.build_filetitle : form_news_bulletin_file.filetitle ) 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}" %>
|
||||
</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, (form_news_bulletin_file.new_record? ? form_news_bulletin_file.build_description : form_news_bulletin_file.description ) 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}" %>
|
||||
</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 %>
|
||||
<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>
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
|
||||
<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 :i18n_variable, (form_news_bulletin_link.new_record? ? form_news_bulletin_link.build_i18n_variable : form_news_bulletin_link.i18n_variable) 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" %>
|
||||
</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 %>
|
||||
<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>
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
<tr id="<%= dom_id list_news_bulletin_file %>">
|
||||
<td><%= list_news_bulletin_file.file.file ? ( link_to list_news_bulletin_file.filetitle.zh_tw, list_news_bulletin_file.file.url, {:target => '_blank', :title => list_news_bulletin_file.description.zh_tw} ) : list_news_bulletin_file.filetitle.zh_tw %></td>
|
||||
<td><%= list_news_bulletin_file.file.file ? ( link_to list_news_bulletin_file.filetitle.en, list_news_bulletin_file.file.url, {:target => '_blank', :title => list_news_bulletin_file.description.en} ) : list_news_bulletin_file.filetitle.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>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<tr id="<%= dom_id list_news_bulletin_link %>">
|
||||
<td><%= link_to list_news_bulletin_link.i18n_variable.zh_tw, list_news_bulletin_link.url, :target => '_blank' %></td>
|
||||
<td><%= link_to list_news_bulletin_link.i18n_variable.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>
|
|
@ -0,0 +1,67 @@
|
|||
<tr id="<%= dom_id news_bulletin %>" class="with_action">
|
||||
<td><%= check_box_tag 'to_delete[]', news_bulletin.id, false, :class => "checkbox_in_list" %></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(: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.i18n_variable[I18n.locale] %></td>
|
||||
<td>
|
||||
<%= link_to news_bulletin.title[I18n.locale], panel_news_front_end_news_bulletin_path(news_bulletin, :category_id => news_bulletin.news_bulletin_category.id) rescue ''%>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<% if current_user.admin? || (!news_bulletin.is_rejected? && !news_bulletin.is_checked?) %>
|
||||
<li><%= link_to t('news_bulletin.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>
|
||||
<%#= debugger %>
|
||||
<%#= a=1 %>
|
||||
<% if (news_bulletin.news_bulletin_category.authed_users('fact_check').include?(current_user) or is_manager?) and !news_bulletin.is_expired? %>
|
||||
<li><%= link_to t('news.news_bulletin.approval'), edit_panel_news_back_end_news_bulletin_path(news_bulletin) %></li><%#= #TODO add ancher so user can quick access into that part %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<li class="dropdown"><%= link_to t('news_bulletin.delete'), panel_news_back_end_news_bulletin_path(news_bulletin), :confirm => t('news.sure?'), :method => :delete, :remote => true %></li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td><%= news_bulletin.postdate %></td>
|
||||
<td><%= (news_bulletin.deadline) ? news_bulletin.deadline : t('news_bulletin.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><%= User.from_id(news_bulletin.update_user_id).name rescue ''%></td>
|
||||
</tr>
|
||||
<tr id="<%= dom_id news_bulletin, :edit %>" class="qe-block hide" />
|
|
@ -0,0 +1,51 @@
|
|||
<% # 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 :filetitle, (@news_bulletin_file.new_record? ? @news_bulletin_file.build_filetitle : @news_bulletin_file.filetitle ) 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" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= f.fields_for :description, (@news_bulletin_file.new_record? ? @news_bulletin_file.build_description : @news_bulletin_file.description ) 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" %>
|
||||
</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 %>
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<% # 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 :i18n_variable, (@news_bulletin_link.new_record? ? @news_bulletin_link.build_i18n_variable : @news_bulletin_link.i18n_variable) 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 %>
|
||||
</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 %>
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th class="span1"></th>
|
||||
<th class="span1-2"></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-3"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbody_news_bulletins" class="sort-holder">
|
||||
<%= render :partial => 'news_bulletin', :collection => @news_bulletins %>
|
||||
</tbody>
|
10
vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_quick_edit.html.erb
vendored
Normal file
10
vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_quick_edit.html.erb
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
<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>
|
|
@ -0,0 +1,62 @@
|
|||
<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.i18n_variable[I18n.locale], t.id ]}, {}, :class => 'input-large' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="widget-title">
|
||||
<%= f.fields_for :title, news_bulletin.title 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' %>
|
||||
</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, {}, :class => 'input-small' %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label"><%= t(:end) %></label>
|
||||
<div class="controls">
|
||||
<%= f.date_select :deadline, {}, :class => 'input-small' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<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(: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>
|
||||
<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>
|
|
@ -0,0 +1,26 @@
|
|||
<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>
|
|
@ -0,0 +1,27 @@
|
|||
<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>
|
|
@ -0,0 +1,25 @@
|
|||
<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">
|
||||
<img class="pull-left upload-picture" src="" />
|
||||
</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('news.刪除已上傳檔案') %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,14 @@
|
|||
<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] %>
|
||||
</label>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,7 @@
|
|||
<%= render_sort_bar(true, ['status', ['is_top', 'is_hot', 'is_hidden', 'is_pending', 'is_checked', 'is_rejected'], 'span1-2', 'news_bulletin.status'],
|
||||
['category', 'news_bulletin_category', 'span1-2', 'news_bulletin.category'],
|
||||
['title', 'title','span7', 'news_bulletin.title'],
|
||||
['start_date', 'postdate', 'span1-2', 'news_bulletin.start_date'],
|
||||
['end_date', 'deadline', 'span1-2', 'news_bulletin.end_date'],
|
||||
['tags', 'tags', 'span1-2', 'news_bulletin.tags'],
|
||||
['last_modified', 'update_user_id','span1-3', 'news_bulletin.last_modified']).html_safe %>
|
|
@ -0,0 +1,2 @@
|
|||
$("#modal-file").modal('hide');
|
||||
$('<%= j render :partial => 'list_news_bulletin_file', :collection => [@news_bulletin_file] %>').appendTo('#news_bulletin_files').hide().fadeIn();
|
|
@ -0,0 +1,2 @@
|
|||
$("#modal-link").modal('hide');
|
||||
$('<%= j render :partial => 'list_news_bulletin_link', :collection => [@news_bulletin_link] %>').appendTo('#news_bulletin_links').hide().fadeIn();
|
1
vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/destroy.js.erb
vendored
Normal file
1
vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/destroy.js.erb
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
$("#<%= dom_id @news_bulletin %>").remove();
|
10
vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/edit.html.erb
vendored
Normal file
10
vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/edit.html.erb
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
<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.editing_news') %></li>
|
||||
</ul>
|
||||
<div id="poststuff">
|
||||
<%= form_for @news_bulletin, :url => panel_news_back_end_news_bulletin_path(@news_bulletin), :html => {:class => 'clear'} do |f| %>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
<% end %>
|
||||
</div>
|
|
@ -0,0 +1 @@
|
|||
$("#modal-file").html("<%= j render "news_bulletin_file_qe" %>");
|
|
@ -0,0 +1 @@
|
|||
$("#modal-file").html("<%= j render "news_bulletin_file_qe" %>");
|
31
vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/index.html.erb
vendored
Normal file
31
vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/index.html.erb
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
<%= form_for :news_bulletins, :url => delete_panel_news_back_end_news_bulletins_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]), :html => {:id => 'delete_all'}, :remote => true do %>
|
||||
<%= render 'filter' %>
|
||||
<table id="bulettin_sort_list" class="table main-list">
|
||||
<%= render 'news_bulletins' %>
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
<div id="news_bulletin_pagination">
|
||||
<%= paginate @news_bulletins, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]} %>
|
||||
</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>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_news_back_end_news_bulletin_path, :class => 'btn btn-primary' %>
|
||||
</div>
|
||||
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "news_bulletin_form" %>
|
||||
<% end %>
|
||||
|
7
vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/index.js.erb
vendored
Normal file
7
vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/index.js.erb
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
$("#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} %>");
|
|
@ -0,0 +1 @@
|
|||
$("#modal-link").html("<%= j render "news_bulletin_link_qe" %>");
|
|
@ -0,0 +1 @@
|
|||
$("#modal-link").html("<%= j render "news_bulletin_link_qe" %>");
|
|
@ -0,0 +1,2 @@
|
|||
$("#<%= dom_id @news_bulletin, :edit %>").show()
|
||||
$("#<%= dom_id @news_bulletin, :edit %>").html("<%= j render :partial => 'quick_edit', :locals => {:type => @type} %>")
|
5
vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/new.html.erb
vendored
Normal file
5
vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/new.html.erb
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
<div id="poststuff">
|
||||
<%= form_for @news_bulletin, :url => panel_news_back_end_news_bulletins_path do |f| %>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
<% end %>
|
||||
</div>
|
49
vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/show.html.erb
vendored
Normal file
49
vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/show.html.erb
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
<ul>
|
||||
<li>
|
||||
<b><%= t('news.category') %></b>
|
||||
<%= @news_bulletin.news_bulletin_category.i18n_variable[I18n.locale] %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('news.postdate') %></b>
|
||||
<%= @news_bulletin.postdate %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('news.title') %></b>
|
||||
<%= @news_bulletin.title[I18n.locale] %>
|
||||
</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('news.subtitle') %></b>
|
||||
<%= @news_bulletin.subtitle[I18n.locale].html_safe %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('news.text') %></b>
|
||||
<%= @news_bulletin.text[I18n.locale].html_safe %>
|
||||
</li>
|
||||
<li>
|
||||
<li>
|
||||
<b><%= t('news.link') %></b>
|
||||
<% @news_bulletin.news_bulletin_links.each do | blink | %>
|
||||
<%= link_to blink.i18n_variable[I18n.locale], blink.url, :target => '_blank' %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('news.file') %></b>
|
||||
<% @news_bulletin.news_bulletin_files.each do | bfile | %>
|
||||
<%= link_to bfile.filetitle[I18n.locale], bfile.file.url, {:target => '_blank', :title => bfile.description[I18n.locale]} if bfile.file.file %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('news.張貼者') %></b>
|
||||
<%= User.find(@news_bulletin.create_user_id).name %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('news.最後修改時間') %></b>
|
||||
<%= @news_bulletin.updated_at %>
|
||||
</li>
|
||||
|
||||
|
||||
<%= link_back %>
|
|
@ -0,0 +1,3 @@
|
|||
$("#enable_<%= @news_bulletin.id %>").toggle();
|
||||
$("#disable_<%= @news_bulletin.id %>").toggle();
|
||||
$("#news_bulletin_<%= @news_bulletin.id %>").toggleClass('disable');
|
|
@ -0,0 +1,2 @@
|
|||
$("#modal-file").modal('hide');
|
||||
$("#<%= dom_id @news_bulletin_file %>").replaceWith("<%= j render :partial => 'list_news_bulletin_file', :collection => [@news_bulletin_file] %>");
|
|
@ -0,0 +1,2 @@
|
|||
$("#modal-link").modal('hide');
|
||||
$("#<%= dom_id @news_bulletin_link %>").replaceWith("<%= j render :partial => 'list_news_bulletin_link', :collection => [@news_bulletin_link] %>");
|
33
vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.html.erb
vendored
Normal file
33
vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.html.erb
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
<% # encoding: utf-8 %>
|
||||
|
||||
<%= flash_messages %>
|
||||
|
||||
<% if @current_category %>
|
||||
<h1 class="h1"><%= @current_category.i18n_variable[I18n.locale] + t('news.news_bulletin.list_lower') %></h1>
|
||||
<% else %>
|
||||
<h1 class="h1"><%= t('news.list_news') %></h1>
|
||||
<% end %>
|
||||
|
||||
|
||||
<table class="table table-bordered">
|
||||
<tr>
|
||||
<th><%= t('news.news_bulletin.category') %></th>
|
||||
<th><%= t('news.news_bulletin.title') %></th>
|
||||
<th><%= t('news.news_bulletin.postdate') %></th>
|
||||
</tr>
|
||||
|
||||
<% @news_bulletins.each do |post| %>
|
||||
<tr>
|
||||
<td><%= post.news_bulletin_category.i18n_variable[I18n.locale] %></td>
|
||||
<td><%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post) %>
|
||||
<%#= link_to post.title, panel_news_back_end_news_bulletin_path(post) %>
|
||||
</td>
|
||||
<td><%= post.postdate %></td>
|
||||
</tr>
|
||||
|
||||
<% end %>
|
||||
|
||||
</table>
|
||||
|
||||
<%= paginate @news_bulletins, :params => {:inner => 'false'} %>
|
||||
|
71
vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb
vendored
Normal file
71
vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb
vendored
Normal file
|
@ -0,0 +1,71 @@
|
|||
<% # encoding: utf-8 %>
|
||||
<h1 class="h1"><%= @news_bulletin.title[I18n.locale] %></h1>
|
||||
<div class="info">
|
||||
<div class="info1">
|
||||
<span class="date"><%= @news_bulletin.postdate %></span>
|
||||
|
|
||||
<a href="" class="unit"><%= User.find(@news_bulletin.create_user_id).name %></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="news_image">
|
||||
<%#= 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 %>
|
||||
</div>
|
||||
<div class="news_paragraph">
|
||||
<%= @news_bulletin.text[I18n.locale].html_safe %>
|
||||
</div>
|
||||
<div class="fb">
|
||||
<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nccu.edu.tw&send=false&layout=standard&width=450&show_faces=false&action=like&colorscheme=light&font&height=35&appId=263319013700607" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe>
|
||||
</div>
|
||||
<!--
|
||||
<p id="notice"><%= flash_messages %></p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<b><%= t('news.category') %></b>
|
||||
<%= @news_bulletin.news_bulletin_category.i18n_variable[I18n.locale] %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('news.postdate') %></b>
|
||||
<%= @news_bulletin.postdate %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('news.title') %></b>
|
||||
<%= @news_bulletin.title[I18n.locale] %>
|
||||
</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('news.subtitle') %></b>
|
||||
<%= @news_bulletin.subtitle[I18n.locale].html_safe %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('news.text') %></b>
|
||||
<%= @news_bulletin.text[I18n.locale].html_safe %>
|
||||
</li>
|
||||
<li>
|
||||
<li>
|
||||
<b><%= t('news.link') %></b>
|
||||
<% @news_bulletin.news_bulletin_links.each do | blink | %>
|
||||
<%= link_to blink.name, blink.url, :target => '_blank' %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('news.file') %></b>
|
||||
<% @news_bulletin.news_bulletin_files.each do | bfile | %>
|
||||
<%= link_to bfile.filetitle, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('news.張貼者') %></b>
|
||||
<%= User.find(@news_bulletin.create_user_id).name %>
|
||||
</li>
|
||||
<li>
|
||||
<b><%= t('news.最後修改時間') %></b>
|
||||
<%= @news_bulletin.updated_at.strftime("%Y-%m-%d %H:%I:%S") %>
|
||||
</li>
|
||||
-->
|
||||
|
||||
<%#= link_back %>
|
10
vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/_news_bulletins.html.erb
vendored
Normal file
10
vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/_news_bulletins.html.erb
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
<% @news_bulletins.each do |news_bulletin| %>
|
||||
<li>
|
||||
<%= link_to news_bulletin.title[I18n.locale], panel_news_front_end_news_bulletin_path(news_bulletin, :category_id => news_bulletin.news_bulletin_category_id) %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<div class='pagination'>
|
||||
<%= link_to_previous_page @news_bulletins, 'Previous Page', :params => {:controller => 'widget/news_bulletins', :action => 'reload_news_bulletins', :tag_id => @selected_tag.id}, :remote => true, :class => 'previous' %>
|
||||
<%= link_to_next_page @news_bulletins, 'Next Page', :params => {:controller => 'widget/news_bulletins', :action => 'reload_news_bulletins', :tag_id => @selected_tag.id}, :remote => true, :class => 'next' %>
|
||||
</div>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue