Merge branch 'master' into ldap

Conflicts:
	Gemfile
	Gemfile.lock
	config/application.rb
	vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb
	vendor/built_in_modules/new_blog/app/controllers/panel/new_blog/widget/posts_controller.rb
	vendor/built_in_modules/page_content/app/controllers/panel/page_content/front_end/page_contexts_controller.rb
	vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/front_end/web_links_controller.rb
	vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/widget/web_links_controller.rb
This commit is contained in:
Christophe Vilayphiou 2012-03-19 14:27:15 +08:00
commit 47215693c4
88 changed files with 1908 additions and 1581 deletions

View File

@ -1,11 +1,12 @@
source 'http://rubygems.org'
gem 'rails', '>=3.1.0', '<3.2.0'
gem "brakeman"
gem 'bson_ext'
gem 'carrierwave'
gem 'carrierwave-mongoid', :require => 'carrierwave/mongoid'
gem 'devise'
gem "net-ldap", "~> 0.3.1"
gem 'devise', '1.5.3'
gem 'exception_notification' # Send error trace
gem 'execjs'
gem 'jquery-rails'
@ -14,7 +15,9 @@ gem 'kaminari', :git => 'git://github.com/amatsuda/kaminari.git'
gem 'mini_magick'
gem 'mongoid'
gem "mongo_session_store-rails3"
gem 'mysql2'
gem "net-ldap", "~> 0.3.1"
gem 'radius'
gem 'rake'
gem 'ruby-debug19'
@ -22,7 +25,7 @@ gem 'rubyzip'
gem 'sinatra'
gem 'sprockets'
gem 'tinymce-rails'
gem 'therubyracer'
gem 'therubyracer' if RUBY_PLATFORM.downcase.include?("linux")

View File

@ -10,48 +10,55 @@ GIT
GEM
remote: http://rubygems.org/
specs:
actionmailer (3.1.3)
actionpack (= 3.1.3)
actionmailer (3.1.4)
actionpack (= 3.1.4)
mail (~> 2.3.0)
actionpack (3.1.3)
activemodel (= 3.1.3)
activesupport (= 3.1.3)
actionpack (3.1.4)
activemodel (= 3.1.4)
activesupport (= 3.1.4)
builder (~> 3.0.0)
erubis (~> 2.7.0)
i18n (~> 0.6)
rack (~> 1.3.5)
rack (~> 1.3.6)
rack-cache (~> 1.1)
rack-mount (~> 0.8.2)
rack-test (~> 0.6.1)
sprockets (~> 2.0.3)
activemodel (3.1.3)
activesupport (= 3.1.3)
activemodel (3.1.4)
activesupport (= 3.1.4)
builder (~> 3.0.0)
i18n (~> 0.6)
activerecord (3.1.3)
activemodel (= 3.1.3)
activesupport (= 3.1.3)
arel (~> 2.2.1)
activerecord (3.1.4)
activemodel (= 3.1.4)
activesupport (= 3.1.4)
arel (~> 2.2.3)
tzinfo (~> 0.3.29)
activeresource (3.1.3)
activemodel (= 3.1.3)
activesupport (= 3.1.3)
activesupport (3.1.3)
activeresource (3.1.4)
activemodel (= 3.1.4)
activesupport (= 3.1.4)
activesupport (3.1.4)
multi_json (~> 1.0)
archive-tar-minitar (0.5.2)
arel (2.2.1)
arel (2.2.3)
bcrypt-ruby (3.0.1)
bcrypt-ruby (3.0.1-x86-mingw32)
bson (1.5.2)
bson_ext (1.5.2)
bson (= 1.5.2)
brakeman (1.5.1)
activesupport
erubis (~> 2.6)
haml (~> 3.0)
i18n
ruby2ruby (~> 1.2)
ruport (~> 1.6)
sass (~> 3.0)
bson (1.6.1)
bson_ext (1.6.1)
bson (~> 1.6.1)
builder (3.0.0)
carrierwave (0.5.8)
activesupport (~> 3.0)
carrierwave-mongoid (0.1.3)
carrierwave (>= 0.5.6)
mongoid (~> 2.1)
chronic (0.6.6)
chronic (0.6.7)
coffee-rails (3.1.1)
coffee-script (>= 2.2.0)
railties (~> 3.1.0)
@ -59,6 +66,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.2.0)
color (1.4.1)
columnize (0.3.6)
database_cleaner (0.7.1)
delorean (1.2.0)
@ -73,41 +81,50 @@ GEM
actionmailer (>= 3.0.4)
execjs (1.3.0)
multi_json (~> 1.0)
factory_girl (2.5.0)
activesupport
factory_girl_rails (1.6.0)
factory_girl (~> 2.5.0)
factory_girl (2.6.3)
activesupport (>= 2.3.9)
factory_girl_rails (1.7.0)
factory_girl (~> 2.6.0)
railties (>= 3.0.0)
fastercsv (1.5.4)
haml (3.1.4)
hike (1.2.1)
hoe (2.16.1)
rake (~> 0.8)
i18n (0.6.0)
jquery-rails (1.0.19)
railties (~> 3.0)
thor (~> 0.14)
json (1.6.5)
libv8 (3.3.10.4)
linecache19 (0.5.12)
ruby_core_source (>= 0.1.4)
mail (2.3.0)
mail (2.3.3)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.17.2)
mini_magick (3.4)
subexec (~> 0.2.1)
mongo (1.5.2)
bson (= 1.5.2)
mongoid (2.4.2)
mongo (1.6.1)
bson (~> 1.6.1)
mongo_session_store-rails3 (3.0.5)
actionpack (>= 3.0)
mongo
mongoid (2.4.6)
activemodel (~> 3.1)
mongo (~> 1.3)
tzinfo (~> 0.3.22)
multi_json (1.0.4)
mysql2 (0.3.11)
mysql2 (0.3.11-x86-mingw32)
net-ldap (0.3.1)
multi_json (1.1.0)
orm_adapter (0.0.6)
pdf-writer (1.1.8)
color (>= 1.4.0)
transaction-simple (~> 1.3)
polyglot (0.3.3)
rack (1.3.6)
rack-cache (1.1)
rack-cache (1.2)
rack (>= 0.4)
rack-mount (0.8.3)
rack (>= 1.0.0)
@ -117,18 +134,18 @@ GEM
rack
rack-test (0.6.1)
rack (>= 1.0)
radius (0.7.1)
rails (3.1.3)
actionmailer (= 3.1.3)
actionpack (= 3.1.3)
activerecord (= 3.1.3)
activeresource (= 3.1.3)
activesupport (= 3.1.3)
radius (0.7.3)
rails (3.1.4)
actionmailer (= 3.1.4)
actionpack (= 3.1.4)
activerecord (= 3.1.4)
activeresource (= 3.1.4)
activesupport (= 3.1.4)
bundler (~> 1.0)
railties (= 3.1.3)
railties (3.1.3)
actionpack (= 3.1.3)
activesupport (= 3.1.3)
railties (= 3.1.4)
railties (3.1.4)
actionpack (= 3.1.4)
activesupport (= 3.1.4)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
@ -157,18 +174,27 @@ GEM
columnize (>= 0.3.1)
linecache19 (>= 0.5.11)
ruby-debug-base19 (>= 0.11.19)
ruby2ruby (1.3.1)
ruby_parser (~> 2.0)
sexp_processor (~> 3.0)
ruby_core_source (0.1.5)
archive-tar-minitar (>= 0.5.2)
rubyzip (0.9.5)
sass (3.1.12)
ruby_parser (2.3.1)
sexp_processor (~> 3.0)
rubyzip (0.9.6.1)
ruport (1.6.3)
fastercsv
pdf-writer (= 1.1.8)
sass (3.1.15)
sass-rails (3.1.5)
actionpack (~> 3.1.0)
railties (~> 3.1.0)
sass (~> 3.1.10)
tilt (~> 1.3.2)
sexp_processor (3.1.0)
shoulda-matchers (1.0.0)
simplecov (0.5.4)
multi_json (~> 1.0.3)
simplecov (0.6.1)
multi_json (~> 1.0)
simplecov-html (~> 0.5.3)
simplecov-html (0.5.3)
sinatra (1.3.2)
@ -183,26 +209,26 @@ GEM
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
subexec (0.2.1)
therubyracer (0.9.9)
libv8 (~> 3.3.10)
thor (0.14.6)
tilt (1.3.3)
tinymce-rails (3.4.8)
railties (>= 3.1)
transaction-simple (1.4.0)
hoe (>= 1.1.7)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.31)
uglifier (1.2.2)
tzinfo (0.3.32)
uglifier (1.2.3)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
warden (1.1.0)
warden (1.1.1)
rack (>= 1.0)
watchr (0.7)
win32-api (1.4.8-x86-mingw32)
win32-process (0.6.5)
windows-pr (>= 1.1.2)
windows-api (0.4.0)
windows-api (0.4.1)
win32-api (>= 1.4.5)
windows-pr (1.2.1)
win32-api (>= 1.4.5)
@ -213,19 +239,21 @@ PLATFORMS
x86-mingw32
DEPENDENCIES
brakeman
bson_ext
carrierwave
carrierwave-mongoid
coffee-rails
database_cleaner
delorean
devise
devise (= 1.5.3)
exception_notification
execjs
factory_girl_rails
jquery-rails
kaminari!
mini_magick
mongo_session_store-rails3
mongoid
mysql2
net-ldap (~> 0.3.1)
@ -242,7 +270,6 @@ DEPENDENCIES
sinatra
spork
sprockets
therubyracer
tinymce-rails
uglifier
watchr

View File

@ -5,4 +5,4 @@ require File.expand_path('../config/application', __FILE__)
require 'rake/dsl_definition'
require 'rake'
PrototypeR4::Application.load_tasks
Orbit::Application.load_tasks

View File

@ -1,12 +1,15 @@
$('.bulletin_urls_block a.delete').live('click', function(){
$(this).parents('.list_item').remove();
$('.bulletin_links_block a.remove_existing_record').live('click', function(){
//$(this).parents('.list_item').remove();
$(this).parents('tr.list_item').remove();
});
$('.bulletin_files_block a.delete').live('click', function(){
$(this).parents('.list_item').remove();
$('.bulletin_files_block a.remove_existing_record').live('click', function(){
//$(this).parents('.list_item').remove();
$(this).parents('tr.list_item').remove();
});
$('.action a.remove_existing_record').live('click', function(){
$(this).next('.should_destroy').attr('value', 1);
$("#bulletin_" + $(this).prev().attr('value')).hide();
//$("#bulletin_" + $(this).prev().attr('value')).hide();
$("tr#bulletin_" + $(this).prev().attr('value')).hide();
});

View File

@ -52,12 +52,15 @@ $(document).ready(function(){
/*tinyscrollbar&windows-Size*/
resize();
$('#main-sidebar').css("height", viewportheight-40);
$('#main-sidebar .viewport').css("height", viewportheight-40);
var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-2;
$('#main-sidebar').css("height", viewportheight-30);
$('#main-sidebar .viewport').css("height", viewportheight-30);
$('.post-title').css("width", viewportwidth-495);
$('#main-wrap > .subnav').css("width", viewportwidth-$mainWrapMarginLeft)
$('#main-sidebar').tinyscrollbar();
$('.detal-list').tinyscrollbar();
$('#main-sidebar').tinyscrollbar({size:(viewportheight-44)});
$('#main-sidebar').tinyscrollbar({size:(viewportheight-34)});
mainTablePosition()
/*isotope*/
var $container = $('#isotope');

View File

@ -145,6 +145,7 @@ body{
background-color: #101010;
bottom: 0;
color: #FFFFFF;
display:none;
font-size: 11px;
padding: 10px;
position: fixed;

View File

@ -0,0 +1,8 @@
class SessionsController < Devise::SessionsController
def create
super
reset_session
end
end

View File

@ -4,6 +4,7 @@ class OrbitBackendController< ApplicationController
# before_filter {|c| c.front_end_available(@app_title)}
before_filter :check_user_can_use,:except => [:public]
include OrbitCoreLib::PermissionUnility
include AdminHelper
layout 'admin'

View File

@ -1,7 +1,7 @@
class OrbitFrontendComponentController< ApplicationController
before_filter :setup_vars
before_filter {|c| c.front_end_available(@app_title)}
layout 'module_widget'
layout :false
def setup_vars
@app_title = request.fullpath.split('/')[2]

View File

@ -30,8 +30,12 @@ class PagesController < ApplicationController
end
def index_from_link
if params[:page]
redirect_to "/#{@item.full_name}?page=#{params[:page]}"
else
redirect_to "/#{@item.full_name}"
end
end
def show_from_link
redirect_to "/#{@item.full_name}?id=#{params[:id]}"

12
app/models/session.rb Normal file
View File

@ -0,0 +1,12 @@
class Session
include Mongoid::Document
include Mongoid::Timestamps
def self.sweep(time = 1.hour)
if time.is_a?(String)
time = time.split.inject { |count, unit| count.to_i.send(unit) }
end
delete_all "updated_at < '#{time.ago.to_s(:db)}' OR created_at < '#{2.days.ago.to_s(:db)}'"
end
end

View File

@ -9,6 +9,7 @@
<%= content_tag :li, link_to(t('admin.add_new'), new_panel_announcement_back_end_bulletin_path), :class => active_for_action('bulletins', 'new') %>
<%= content_tag :li, link_to(t('admin.categories'), panel_announcement_back_end_bulletin_categorys_path), :class => active_for_action('bulletin_categorys', 'index') %>
<%= content_tag :li, link_to(t('admin.tags'), panel_announcement_back_end_tags_path), :class => active_for_action('tags', 'index') %>
<%= content_tag :li, link_to(t('announcement.bulletin.fact_check_setting'), panel_announcement_back_end_fact_checks_setting_path), :class => active_for_action('tags', 'index') %>
<% end -%>
<% end -%>
@ -16,16 +17,25 @@
<%= link_to content_tag(:i, nil, :class => 'icons-member') + t('admin.member'), admin_users_path %>
<% end -%>
<%= content_tag :li, :class => active_for_controllers(nil) do -%>
<%= content_tag :li, :class => active_for_controllers('page_contexts') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-page') + t('admin.page'), panel_page_content_back_end_page_contexts_path %>
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('page_contexts')) do -%>
<%= content_tag :li, link_to(t('admin.all_articles'), panel_page_content_back_end_page_contexts_path), :class => active_for_action('page_context', 'index') %>
<% end -%>
<% end -%>
<%= content_tag :li, :class => active_for_controllers('designs') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-window-block') + t('admin.design'), admin_designs_path %>
<% end -%>
<%= content_tag :li, :class => active_for_controllers(nil) do -%>
<%= content_tag :li, :class => active_for_controllers('web_links', 'tags', 'web_link_categorys') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.link'), panel_web_resource_back_end_web_links_path %>
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('web_links', 'tags', 'web_link_categorys')) do -%>
<%= content_tag :li, link_to(t('admin.all_articles'), panel_web_resource_back_end_web_links_path), :class => active_for_action('web_link', 'index') %>
<%= content_tag :li, link_to(t('admin.add_new'), new_panel_web_resource_back_end_web_link_path), :class => active_for_action('web_link', 'new') %>
<%= content_tag :li, link_to(t('admin.categories'), panel_web_resource_back_end_web_link_categorys_path), :class => active_for_action('web_link_categorys', 'index') %>
<%= content_tag :li, link_to(t('admin.tags'), panel_web_resource_back_end_tags_path), :class => active_for_action('tags', 'index') %>
<% end -%>
<% end -%>
<%= content_tag :li, :class => active_for_controllers(nil) do -%>

View File

@ -1,4 +1,4 @@
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run PrototypeR4::Application
run Orbit::Application

View File

@ -13,13 +13,13 @@ require 'sprockets/railtie'
# or test environments.
Bundler.require *Rails.groups(:assets) if defined?(Bundler)
module PrototypeR4
module Orbit
class Application < Rails::Application
# Add directories for plugins
config.paths["vendor/plugins"] += %W(#{config.root}/vendor/built_in_modules)
config.paths["vendor/plugins"] += %W(#{config.root}/vendor/downloaded_modules)
config.paths.app.views << "app/views/devise"
config.paths["app/views"] += %W(#{config.root}/app/views/devise)
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers

View File

@ -4,4 +4,4 @@ require 'yaml'
YAML::ENGINE.yamler = 'syck'
# Initialize the rails application
PrototypeR4::Application.initialize!
Orbit::Application.initialize!

View File

@ -1,4 +1,4 @@
PrototypeR4::Application.configure do
Orbit::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on

View File

@ -1,4 +1,4 @@
PrototypeR4::Application.configure do
Orbit::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The production environment is meant for finished, "live" apps.

View File

@ -1,4 +1,4 @@
PrototypeR4::Application.configure do
Orbit::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's

View File

@ -4,4 +4,4 @@
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
PrototypeR4::Application.config.secret_token = 'cbf6409102b30cb9f4da455ee08c3a7e9d8b2a3d32a0e5b59a354dad03f469d363a8127ef4b7bc3b1afa632d7cf947a1e59e09022d2d4cd8df1f4fa521d7ec07'
Orbit::Application.config.secret_token = 'cbf6409102b30cb9f4da455ee08c3a7e9d8b2a3d32a0e5b59a354dad03f469d363a8127ef4b7bc3b1afa632d7cf947a1e59e09022d2d4cd8df1f4fa521d7ec07'

View File

@ -4,4 +4,4 @@
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
PrototypeR4::Application.config.secret_token = 'b8d78ecaf3086ebfc1ba42e912acba60d85cf3d789d933e117770e1a045a12911f121ff012a234982abb446c8b8c768052eea4bf8b2d5d336be821e2c25d8cdb'
Orbit::Application.config.secret_token = 'b8d78ecaf3086ebfc1ba42e912acba60d85cf3d789d933e117770e1a045a12911f121ff012a234982abb446c8b8c768052eea4bf8b2d5d336be821e2c25d8cdb'

View File

@ -1,8 +1,3 @@
# Be sure to restart your server when you modify this file.
PrototypeR4::Application.config.session_store :cookie_store, :key => '_prototype_R4_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails generate session_migration")
# PrototypeR4::Application.config.session_store :active_record_store
Orbit::Application.config.session_store :mongoid_store

View File

@ -1,4 +1,4 @@
PrototypeR4::Application.routes.draw do
Orbit::Application.routes.draw do
devise_for :users,:controllers => {:sessions => 'sessions'}

View File

@ -100,7 +100,7 @@ module ParserBackEnd
ret = ''
if (tag.attributes["main"] == "true" && !page.module_app.nil?)
ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}?inner=true&page_id=#{page.id}"
ret << "&bulletin_category_id=#{page.category}" if page[:category]
ret << "&category_id=#{page.category}" if page[:category]
ret << "'></div>"
else
part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s }

View File

@ -62,6 +62,7 @@ module ParserFrontEnd
c.define_tag 'stylesheets' do |tag|
res = ''
res << "<link href='/assets/bootstrap.css.erb' rel='stylesheet' type='text/css'/>"
res << "<link href='/assets/bootstrap-orbit.css' rel='stylesheet' type='text/css'/>"
res << "<link href='/assets/style.css.erb' rel='stylesheet' type='text/css'/>"
res << "<link href='#{page.design.reset_css.file.url}' rel='stylesheet' type='text/css' />" if page.design.reset_css
res << "<link href='#{page.design.default_css.file.url}' rel='stylesheet' type='text/css' /> " if page.design.default_css
@ -127,7 +128,7 @@ 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 << "&bulletin_category_id=#{page.category}" if page[:category]
ret << "&category_id=#{page.category}" if page[:category]
ret << "'></div>"
else
part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s } rescue nil

View File

@ -11,12 +11,12 @@ namespace :anc do
bulletin_category_3.create_i18n_variable(:en => "MattCheckChrisPreview", :zh_tw => 'MattCheckChrisPreview')
bulletin_1 = Bulletin.create(:title => "C1P1",:status => nil,:subtitle => "",:text => "value",:postadate => Time.now,:deadline => nil,:bulletin_category => bulletin_category_1 )
bulletin_2 = Bulletin.create(:title => "C1P2",:status => nil,:subtitle => "",:text => "value",:postadate => Time.now,:deadline => nil,:bulletin_category => bulletin_category_1 )
bulletin_3 = Bulletin.create(:title => "C2P1",:status => nil,:subtitle => "",:text => "value",:postadate => Time.now,:deadline => nil,:bulletin_category => bulletin_category_2 )
bulletin_4 = Bulletin.create(:title => "C2P2",:status => nil,:subtitle => "",:text => "value",:postadate => Time.now,:deadline => nil,:bulletin_category => bulletin_category_2 )
bulletin_5 = Bulletin.create(:title => "C3P1",:status => nil,:subtitle => "",:text => "value",:postadate => Time.now,:deadline => nil,:bulletin_category => bulletin_category_3 )
bulletin_6 = Bulletin.create(:title => "C3P2",:status => nil,:subtitle => "",:text => "value",:postadate => Time.now,:deadline => nil,:bulletin_category => bulletin_category_3 )
bulletin_1 = Bulletin.create(:title => "C1P1",:status => nil,:subtitle => "",:text => "value",:post_date => Time.now,:deadline => nil,:bulletin_category => bulletin_category_1 )
bulletin_2 = Bulletin.create(:title => "C1P2",:status => nil,:subtitle => "",:text => "value",:post_date => Time.now,:deadline => nil,:bulletin_category => bulletin_category_1 )
bulletin_3 = Bulletin.create(:title => "C2P1",:status => nil,:subtitle => "",:text => "value",:post_date => Time.now,:deadline => nil,:bulletin_category => bulletin_category_2 )
bulletin_4 = Bulletin.create(:title => "C2P2",:status => nil,:subtitle => "",:text => "value",:post_date => Time.now,:deadline => nil,:bulletin_category => bulletin_category_2 )
bulletin_5 = Bulletin.create(:title => "C3P1",:status => nil,:subtitle => "",:text => "value",:post_date => Time.now,:deadline => nil,:bulletin_category => bulletin_category_3 )
bulletin_6 = Bulletin.create(:title => "C3P2",:status => nil,:subtitle => "",:text => "value",:post_date => Time.now,:deadline => nil,:bulletin_category => bulletin_category_3 )
end
end

View File

@ -0,0 +1,14 @@
class Panel::Announcement::BackEnd::BulletinLinksController < ApplicationController
layout 'new_admin'
def index
@bulletin_links = BulletinLink.all
respond_to do |format|
format.html # index.html.erb
# format.xml { render :xml => @bulletins }
format.js
end
end

View File

@ -1,5 +1,4 @@
class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
include AdminHelper
layout 'new_admin'
before_filter :authenticate_user!
@ -9,6 +8,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
# @bulletins = Bulletin.all
# @bulletins = Bulletin.desc("postdate desc")
get_categorys(params[:bulletin_category_id])
get_tags
# @bulletins = Bulletin.where("bulletin_category_id" => params[:bulletin_category_id]).desc("postdate") if params[:bulletin_category_id]
@ -17,9 +17,6 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
@bulletins = params[:sort] ? get_sorted_bulletins : Bulletin.all
@bulletin_categories = BulletinCategory.all
module_app = ModuleApp.first(:conditions => {:key => 'announcement'})
@tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc)
respond_to do |format|
format.html # index.html.erb
format.js
@ -31,6 +28,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
# GET /bulletins/1.xml
def show
@bulletin = Bulletin.find(params[:id])
get_tags
# get_categorys
# @bulletin_categorys = BulletinCategory.where("_id" => params[:id])
@ -52,10 +50,13 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
def new
@bulletin = Bulletin.new
@link_url = panel_announcement_back_end_bulletins_path
# @bulletin.bulletin_files.build
# @bulletin.bulletin_files.new
get_categorys
get_tags
respond_to do |format|
format.html # new.html.erb
@ -67,7 +68,11 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
def edit
@bulletin = Bulletin.find(params[:id])
# @summary_variable = @bulletin.summary_variable
@link_url = panel_announcement_back_end_bulletin_path(@bulletin)
get_categorys
get_tags
end
# POST /bulletins
@ -90,6 +95,32 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
end
end
def link_quick_add
# debugger
@bulletin = Bulletin.find(params[:bulletin_id])
@link_url = panel_announcement_back_end_bulletins_path
respond_to do |format|
format.js
end
end
def link_quick_edit
# debugger
@bulletin = Bulletin.find(params[:bulletin_id])
@link_url = panel_announcement_back_end_bulletin_path(@bulletin)
respond_to do |format|
format.js
end
end
# PUT /bulletins/1
# PUT /bulletins/1.xml
def update
@ -98,11 +129,11 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
@bulletin.update_user_id = current_user.id
# @bulletin.image.clear if params[:bulletin][:image_del] == '1'
if params[:bulletin][:image_del] == '1'
@bulletin.remove_image!
# if params[:bulletin][:image_del] == '1'
# @bulletin.remove_image!
# @bulletin.image_del = nil
params[:bulletin][:image_del] = nil
end
# params[:bulletin][:image_del] = nil
# end
respond_to do |format|
if @bulletin.update_attributes(params[:bulletin]) && @bulletin.save
@ -153,6 +184,16 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
end
end
def get_tags
module_app = ModuleApp.first(:conditions => {:key => 'announcement'})
@tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc)
end
def get_tags
module_app = ModuleApp.first(:conditions => {:key => 'announcement'})
@tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc)
end
def get_sorted_bulletins
bulletins = Bulletin.all
case params[:sort]
@ -195,7 +236,6 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
a.flatten!
a.uniq
end
end

View File

@ -1,38 +1,76 @@
class Panel::Announcement::BackEnd::FactChecksController < OrbitBackendController
before_filter :authenticate_user!
include AdminHelper
layout 'admin'
# layout 'admin'
layout 'new_admin'
def index
@bulletin_categorys_submit_new = []
@bulletin_categorys_check =[]
if is_admin? || is_manager?
#@bulletin_categorys_submit_new = BulletinCategory.all
@bulletin_categorys_check = BulletinCategory.all
# elsif is_sub_manager?
# @bulletin_categorys_submit_new = BulletinCategory.authed_for_user(current_user,'submit_new')
# @bulletin_categorys_check = BulletinCategory.authed_for_user(current_user,'fact_check')
def setting
@bulletin_categorys = BulletinCategory.all
if params.has_key?(:category_id)
first_category = BulletinCategory.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 = @bulletin_categorys.first
end
preload_object_auth = first_category.object_auths.where(title: 'fact_check') || (first_category.object_auths.create :title=> 'fact_check')
@users_array = preload_object_auth.first.privilege_users rescue []
respond_to do |format|
format.html
format.js
end
end
def new
def update_setting
end
def create
# def index
# get_categorys(params[:bulletin_category_id])
#
# @bulletins = params[:sort] ? get_sorted_bulletins : Bulletin.all
# @bulletin_categories = BulletinCategory.all
#
# module_app = ModuleApp.first(:conditions => {:key => 'announcement'})
# @tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc)
#
# respond_to do |format|
# format.html # index.html.erb
# format.js
# format.xml { render :xml => @bulletins }
# end
# end
#
# def new
#
# end
#
# def create
#
# end
#
# def update
#
# end
#
# def edit
#
# end
#
# def destroy
#
# end
protected
def get_categorys(id = nil)
@bulletin_categorys = []
if(is_manager? || is_admin?)
@bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true))
elsif is_sub_manager?
@bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new')
end
def update
end
def edit
end
def destroy
end
end

View File

@ -11,15 +11,15 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
def index
date_now = Time.now
if params[:bulletin_category_id]
@bulletins = Bulletin.where(:bulletin_category_id => params[:bulletin_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)
if params[:category_id]
@bulletins = Bulletin.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)
else
@bulletins = Bulletin.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 = BulletinCategory.from_id(params[:bulletin_category_id]) rescue nil
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
end
def show

View File

@ -28,6 +28,7 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
@selected_tag = AnnouncementTag.find(params[:id]) rescue @tags[0]
@bulletins = @selected_tag.get_visible_bulletins.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_bulletins

View File

@ -0,0 +1,101 @@
# encoding: utf-8
class Bulletin
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::MultiParameterAttributes
# field :category_id, :type => Integer
field :title
# has_one :title_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
# has_one :subtitle_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
# has_one :text_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
field :subtitle
field :text
field :postdate , :type => Date
field :deadline , :type => Date
# field :url
field :create_user_id
field :update_user_id
field :is_top, :type => Boolean, :default => false
mount_uploader :image, ImageUploader
belongs_to :bulletin_category
embeds_many :bulletin_links, :cascade_callbacks => true
embeds_many :bulletin_files, :cascade_callbacks => true
# has_many :bulletin_files, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :bulletin_files, :allow_destroy => true
accepts_nested_attributes_for :bulletin_links, :allow_destroy => true
# validates_presence_of :title_variable
validates_presence_of :title
after_save :save_bulletin_links
after_save :save_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, 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 => {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
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"})
any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).limit(5)
end
def is_top?
self.is_top
end
def save_bulletin_links
self.bulletin_links.each do |t|
if t.should_destroy
t.destroy
end
end
end
def save_bulletin_files
self.bulletin_files.each do |t|
if t.should_destroy
t.destroy
end
end
end
end

View File

@ -19,6 +19,9 @@ class Bulletin
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 :not_checked_reason
field :public, :type => Boolean, :default => true
@ -26,10 +29,11 @@ class Bulletin
belongs_to :bulletin_category
embeds_many :bulletin_links, :cascade_callbacks => true
embeds_many :bulletin_files, :cascade_callbacks => true
# embeds_many :bulletin_links, :cascade_callbacks => true
# embeds_many :bulletin_files, :cascade_callbacks => true
# has_many :bulletin_files, :autosave => true, :dependent => :destroy
has_many :bulletin_links, :autosave => true, :dependent => :destroy
has_many :bulletin_files, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :bulletin_files, :allow_destroy => true
accepts_nested_attributes_for :bulletin_links, :allow_destroy => true
@ -38,6 +42,9 @@ class Bulletin
before_save :set_key
after_save :save_bulletin_links
after_save :save_bulletin_files
def self.search( search = nil, category_id = nil )
@ -94,6 +101,22 @@ class Bulletin
self.is_hidden
end
def save_bulletin_links
self.bulletin_links.each do |t|
if t.should_destroy
t.destroy
end
end
end
def save_bulletin_files
self.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

View File

@ -5,13 +5,27 @@ class BulletinFile
mount_uploader :file, AssetUploader
field :filetitle
field :description
# 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 :bulletin
embedded_in :bulletin
belongs_to :bulletin
# embedded_in :bulletin
protected
def set_key
if filetitle.new_record?
filetitle.key = 'filetitle'
end
if description.new_record?
description.key = 'description'
end
end
end

View File

@ -4,10 +4,12 @@ class BulletinLink
include Mongoid::Timestamps
field :url
field :name
# field :name
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
field :should_destroy, :type => Boolean
embedded_in :bulletin
# embedded_in :bulletin
belongs_to :bulletin
end

View File

@ -1,21 +1,17 @@
<tr id="<%= dom_id bulletin_category %>">
<td><%= bulletin_category.key %></td>
<tr id="<%= dom_id bulletin_category %>" class="with_action">
<td>
<%= bulletin_category.key %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<li><%= link_to t('bulletin_category.edit'), edit_panel_announcement_back_end_bulletin_category_path(bulletin_category), :remote => true %></li>
<li><%= link_to t('bulletin_category.quick_edit'), panel_announcement_back_end_bulletin_category_quick_edit_path(bulletin_category), :remote => true %></li>
<li><%= link_to t('bulletin_category.delete'), panel_announcement_back_end_bulletin_category_path(bulletin_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
</ul>
</div>
</td>
<% @site_valid_locales.each do |locale| %>
<td><%= bulletin_category.i18n_variable[locale] rescue nil %></td>
<% end %>
<td><%= bulletin_category.display %></td>
<% if is_manager? %>
<td>
<%= link_to t('blog.new_auth'), init_admin_object_auths_path("BulletinCategory",bulletin_category,:token => @module_app.token) %> <br/ >
<% bulletin_category.object_auths.each do |obj_auth| %>
<%= link_to obj_auth.title,edit_admin_object_auth_url(obj_auth,:token => @module_app.token) %><br />
<% end %>
</td>
<td>
<% end %>
<%= link_to t('bulletin_category.edit'), edit_panel_announcement_back_end_bulletin_category_path(bulletin_category), :remote => true %> |
<%= link_to t('bulletin_category.quick_edit'), panel_announcement_back_end_bulletin_category_quick_edit_path(bulletin_category), :remote => true %> |
<%= link_to t('bulletin_category.delete'), panel_announcement_back_end_bulletin_category_path(bulletin_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %>
</td>
</tr>
</tr>

View File

@ -1,36 +1,36 @@
<% # encoding: utf-8 %>
<%= form_for(@bulletin_category, :remote => true, :url => @url) do |f| %>
<%#= form_for(@bulletin_category, :remote => true, :url => panel_announcement_back_end_bulletin_category_path(@bulletin_category)) do |f| %>
<div class="field">
<%= f.label :key %><br />
<h2><%= (@bulletin_category.new_record? ? 'Add' : 'Edit') %></h2>
<div id="widget-title">
<%= f.label :key %>
<%= f.text_field :key %>
</div>
<div class="field">
<%= f.label :name %><br />
<div id="widget-title">
<%= f.fields_for :i18n_variable, (@bulletin_category.new_record? ? @bulletin_category.build_i18n_variable : @bulletin_category.i18n_variable) do |f| %>
<% @site_valid_locales.each do |locale| %>
<%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %>
<%= f.text_field locale, :style => "width:130px" %>
<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 class="field">
<%= f.label :display %> <br />
<%#= f.select :display, BulletinCategory::PAYMENT_TYPES, :prompt => 'Select a display method' %>
<div id="widget-title">
<%= f.label :display %>
<%= f.radio_button :display, "List" %>List
<%#= f.label :display, 'list', :value => '1', :checked => @a %>
<%= f.radio_button :display, "Picture" %>Picture
<%#= f.label :display, 'picture', :value => '2', :checked => @b %>
<br />顯示方式是設定在前台頁面時,資訊所呈現的樣式
</div>
<div class="actions">
<%= f.submit %>
<div class="form-actions">
<%= f.submit 'Submit/送出', :class=>'btn btn-primary' %>
</div>
<% end %>

View File

@ -1,35 +0,0 @@
<% # encoding: utf-8 %>
<div class="field">
<%= f.label :key %><br />
<%= f.text_field :key %>
</div>
<div class="field">
<%= f.label :name %><br />
<%= f.fields_for :i18n_variable, (@bulletin_category.new_record? ? @bulletin_category.build_i18n_variable : @bulletin_category.i18n_variable) do |f| %>
<% @site_valid_locales.each do |locale| %>
<%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %>
<%= f.text_field locale, :style => "width:130px" %>
<% end %>
<% end %>
</div>
<div class="field">
<%= f.label :display %> <br />
<%#= f.select :display, BulletinCategory::PAYMENT_TYPES, :prompt => 'Select a display method' %>
<%= f.radio_button :display, "List" %>List
<%#= f.label :display, 'list', :value => '1', :checked => @a %>
<%= f.radio_button :display, "Picture" %>Picture
<%#= f.label :display, 'picture', :value => '2', :checked => @b %>
<br />顯示方式是設定在前台頁面時,資訊所呈現的樣式
</div>
<div class="actions">
<%= f.submit %>
</div>

View File

@ -0,0 +1,13 @@
<!-- <tr class="qe-block hide"> -->
<tr class="qe-block hide">
<td colspan="8">
<legend><%= t(:quick_edit) %></legend>
<%= form_for bulletin_category, :url => panel_announcement_back_end_bulletin_category_path(bulletin_category), :html => {:class => 'form-horizontal'} do |f| %>
<%= render :partial => "quick_edit_qe", :locals => { :f => f, :bulletin_category => bulletin_category } %>
<div class="form-actions">
<%= f.submit t(:submit), :class => 'btn btn-primary' %>
<%= f.submit t(:cancel), :class => 'btn', :type => 'reset' %>
</div>
<% end %>
</td>
</tr>

View File

@ -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, 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>

View File

@ -1,38 +1,23 @@
<% content_for :secondary do %>
<%= render :partial => '/panel/announcement/back_end/announcement_secondary' %>
<% end -%>
<%= flash_messages %>
<br />
<br />
<br />
<br />
<br />
<h1><%= t('bulletin_category.list_announcement_class') %></h1>
<table id="bulletin_categorys">
<table id="bulletin_categorys" class="table main-list">
<thead>
<tr>
<th><%= t('bulletin_category.key') %></th>
<th class="span1-2"><%= t('bulletin_category.key') %></th>
<% @site_valid_locales.each do |locale| %>
<th><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th>
<th class="span1-2"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th>
<% end %>
<th><%= t('bulletin_category.display') %></th>
<th><%= t('bulletin.action') %></th>
<th class="span1-2"><%= t('bulletin_category.display') %></th>
</tr>
</thead>
<tbody>
<%# @bulletin_categorys.each do |post| %>
<%= render :partial => 'bulletin_category', :collection => @bulletin_categorys %>
<%# end %>
</tbody>
</table>
<br />
<br />
<br />
<br />
<h2>Add New</h2>
<div id="form"><%= render :partial => "form" %></div>

View File

@ -24,11 +24,12 @@
</ul>
</li>
<li class="dropdown"><%= link_to t('bulletin.delete'), panel_announcement_back_end_bulletin_path(bulletin), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
<li><%= link_to t('bulletin.fact_check'), edit_panel_announcement_back_end_bulletin_path(bulletin) %></li><%#= #TODO add ancher so user can quick access into that part %>
</ul>
</div>
</td>
<td><%= bulletin.bulletin_category.i18n_variable[I18n.locale] %></td>
<td><%= link_to bulletin.title[I18n.locale], panel_announcement_back_end_bulletin_path(bulletin) %></td>
<td><%= link_to bulletin.title[I18n.locale], panel_announcement_back_end_bulletin_path(bulletin) rescue ''%></td>
<td><%= bulletin.postdate %></td>
<td><%= (bulletin.deadline) ? bulletin.deadline : t('bulletin.no_deadline') %></td>
<td>
@ -36,7 +37,7 @@
<span class="label label-tags"><%= tag[I18n.locale] %></span>
<% end %>
</td>
<td><%= User.from_id(bulletin.update_user_id).name %></td>
<td><%= User.from_id(bulletin.update_user_id).name rescue ''%></td>
</tr>
<%= render :partial => 'quick_edit', :locals => {:bulletin => bulletin} %>

View File

@ -1,24 +1,47 @@
<div id="<%= "bulletin_#{bulletin_file.id}" if !bulletin_file.new_record? %>" class='list_item'>
<div class="field">
<%= f.label :file %>
<%#= file_field_tag 'bulletin[file]' %>
<tr id="<%= "bulletin_#{bulletin_file.id}" if !bulletin_file.new_record? %>" class='list_item'>
<td>
<div class="control-group">
<div class="controls">
<%= f.file_field :file %>
<%= f.label :file_title %>
<%= f.text_field :filetitle %>
<%= f.label :file_description %>
<%= f.text_field :description %>
</div>
</div>
</td>
<td>
<%= f.fields_for :filetitle, (bulletin_file.new_record? ? bulletin_file.build_filetitle : bulletin_file.filetitle ) do |f| %>
<% @site_valid_locales.each do |locale| %>
<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 %>
<% end %>
</td>
<td>
<%= f.fields_for :description, (bulletin_file.new_record? ? bulletin_file.build_description : bulletin_file.description ) do |f| %>
<% @site_valid_locales.each do |locale| %>
<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 %>
<% end %>
</td>
<td>
<span class="action">
<% if bulletin_file.new_record? %>
<a href="#" class="delete"><%= t(:delete) %></a>
<a href class="remove_existing_record"><i class="icon-remove"></i></a>
<% else %>
<%= f.hidden_field :id %>
<a href="#" class="remove_existing_record"><%= t(:delete) %></a>
<a href class="remove_existing_record"><i class="icon-remove"></i></a>
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
<% end %>
</span>
</div>
</div>
</td>
</tr>

View File

@ -0,0 +1,27 @@
<div id="<%= "bulletin_#{bulletin_link.id}" if !bulletin_link.new_record? %>" class='list_item'>
<div class="field">
<%= f.label :link_url %>
<%= f.text_field :url %>
<%= f.label :link_name %>
<%#= f.text_field :name %>
<%= f.fields_for :i18n_variable, (bulletin_link.new_record? ? bulletin_link.build_i18n_variable : bulletin_link.i18n_variable) do |f| %>
<% @site_valid_locales.each do |locale| %>
<%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %>
<%= f.text_field locale, :style => "width:130px" %>
<% end %>
<% end %>
<span class="action">
<% if bulletin_link.new_record? %>
<a href="#" class="delete"><%= t(:delete) %></a>
<% else %>
<%= f.hidden_field :id %>
<a href="#" class="remove_existing_record"><%= t(:delete) %></a>
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
<% end %>
</span>
</div>
</div>

View File

@ -0,0 +1,27 @@
<div id="<%= "bulletin_#{bulletin_link.id}" if !bulletin_link.new_record? %>" class='list_item'>
<div class="field">
<%= f.label :link_url %>
<%= f.text_field :url %>
<%= f.label :link_name %>
<%#= f.text_field :name %>
<%= f.fields_for :i18n_variable, (bulletin_link.new_record? ? bulletin_link.build_i18n_variable : bulletin_link.i18n_variable) do |f| %>
<% @site_valid_locales.each do |locale| %>
<%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %>
<%= f.text_field locale, :style => "width:130px" %>
<% end %>
<% end %>
<span class="action">
<% if bulletin_link.new_record? %>
<a href="#" class="delete"><%= t(:delete) %></a>
<% else %>
<%= f.hidden_field :id %>
<a href="#" class="remove_existing_record"><%= t(:delete) %></a>
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
<% end %>
</span>
</div>
</div>

View File

@ -1,21 +1,37 @@
<div id="<%= "bulletin_#{bulletin_link.id}" if !bulletin_link.new_record? %>" class='list_item'>
<div class="field">
<tr id="<%= "bulletin_#{bulletin_link.id}" if !bulletin_link.new_record? %>" class='list_item'>
<%= f.label :link_url %>
<td>
<div class="control-group">
<div class="controls">
<%= f.text_field :url %>
</div>
</div>
</td>
<td>
<%= f.fields_for :i18n_variable, (bulletin_link.new_record? ? bulletin_link.build_i18n_variable : bulletin_link.i18n_variable) do |f| %>
<% @site_valid_locales.each do |locale| %>
<div class="control-group">
<div class="controls">
<%= f.text_field locale, :id => "link-#{locale}", :class => "input-xlarge" %>
</div>
</div>
</td>
<td>
<%= f.label :link_name %>
<%= f.text_field :name %>
<% end %>
<% end %>
</td>
<td>
<span class="action">
<% if bulletin_link.new_record? %>
<a href="#" class="delete"><%= t(:delete) %></a>
<a href class="remove_existing_record"><i class="icon-remove"></i></a>
<% else %>
<%= f.hidden_field :id %>
<a href="#" class="remove_existing_record"><%= t(:delete) %></a>
<a href class="remove_existing_record"><i class="icon-remove"></i></a>
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
<% end %>
</span>
</div>
</div>
</td>
</tr>

View File

@ -0,0 +1,16 @@
<tr id="<%= "bulletin_#{bulletin_link2.id}" %>">
<td><%= link_to bulletin_link2.i18n_variable.zh_tw, bulletin_link2.url, :target => '_blank' %></td>
<td><%= link_to bulletin_link2.i18n_variable.en, bulletin_link2.url, :target => '_blank' %></td>
<td><a href="#modal-link" data-toggle="modal" class="action"><i class="icon-pencil"></i></a>
<span class="action">
<%= f.hidden_field :id %>
<a href class="remove_existing_record"><i class="icon-remove"></i></a>
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
</span>
</td>
</tr>

View File

@ -0,0 +1,16 @@
<tr id="<%= "bulletin_#{bulletin_link2.id}" %>">
<td><%= link_to bulletin_link2.i18n_variable.zh_tw, bulletin_link2.url, :target => '_blank' %></td>
<td><%= link_to bulletin_link2.i18n_variable.en, bulletin_link2.url, :target => '_blank' %></td>
<td><a href="#modal-link" data-toggle="modal" class="action"><i class="icon-pencil"></i></a>
<span class="action">
<%= f.hidden_field :id %>
<a href class="remove_existing_record"><i class="icon-remove"></i></a>
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
</span>
</td>
</tr>

View File

@ -0,0 +1,17 @@
<tr id="<%= "bulletin_#{bulletin_link2.id}" %>">
<td><%= link_to bulletin_link2.i18n_variable.zh_tw, bulletin_link2.url, :target => '_blank' %></td>
<td><%= link_to bulletin_link2.i18n_variable.en, bulletin_link2.url, :target => '_blank' %></td>
<td>
<a href="<%= panel_announcement_back_end_bulletin_link_quick_edit_path(bulletin_link2) %>#modal-link" data-toggle="modal" data-remote="true" class="action"><i class="icon-pencil"></i></a>
<span class="action">
<%= f.hidden_field :id %>
<a href class="remove_existing_record"><i class="icon-remove"></i></a>
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
</span>
</td>
</tr>

View File

@ -0,0 +1,41 @@
<% # encoding: utf-8 %>
<%= form_for(@bulletin.bulletin_links, :remote => true, :url => @link_url) do |f| %>
<div id="modal-link" class="modal hide fade">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h3>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 %>
<span class="help-inline">Please correct the error</span>
</div>
</div>
<% @site_valid_locales.each do |locale| %>
<div class="control-group error">
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
<div class="controls">
<input type="text" value="" id="link-<%= locale %>" class="input-xlarge">
<span class="help-inline">Please correct the error</span>
</div>
</div>
<% end %>
</div>
<div class="modal-footer">
<a class="btn btn-primary" href="#">Submit/確定</a>
<a class="btn" data-dismiss="modal" href="#">Cancel/取消</a>
</div>
</div>
<% end %>

View File

@ -2,7 +2,16 @@
<%= f.error_messages %>
<%= f.select :bulletin_category_id, @bulletin_categorys.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %>
<div class="field">
<%= label :fact_check_stat, t('announcement.bulletin.fact_check_stat') %>
<%= f.radio_button :is_checked, true%>
<%= label :is_checked_true, t('announcement.bulletin.fact_check_pass') %>
<%= f.radio_button :is_checked, false, (@bulletin.is_checked.nil?? {:checked => true} : {}) %>
<%= label :is_checked_false, t('announcement.bulletin.fact_check_not_pass') %>
<%= label :is_checked_false, t('announcement.bulletin.fact_check_not_pass_reason') %>
<%= f.text_field :not_checked_reason %>
</div>
<div class="field">
<%= f.label :image, t('announcement.image') %><br />
<%= f.file_field :image %>
@ -12,139 +21,38 @@
<% end %>
</div>
<div class="field">
<%= f.label :title %>
<%= f.fields_for :title, (@bulletin.new_record? ? @bulletin.build_title : @bulletin.title ) do |f| %>
<% @site_valid_locales.each do |locale| %>
<td>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale %>
</td>
<% end %>
<!--Widget start-->
<div id="sub-wiget">
<div id="widget-picture" class="widget-box widget-size-300">
<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="controls file-upload">
<label class="control-label btn" for="input-upload">
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-large" type="text">
<br>
<% if @bulletin.image.file %>
<%= f.check_box :remove_image %>
<%= t('announcement.刪除已上傳檔案') %>
<% end %>
</div>
<div class="field">
<%= f.label :subtitle %>
<%= f.fields_for :subtitle, (@bulletin.new_record? ? @bulletin.build_subtitle : @bulletin.subtitle ) do |f| %>
<% @site_valid_locales.each do |locale| %>
<td>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_area locale, :rows => 10, :cols => 40 %>
</td>
<% end %>
<% end %>
</div>
</div>
</div>
<div class="field">
<%= f.label :text %>
<%= f.fields_for :text, (@bulletin.new_record? ? @bulletin.build_text : @bulletin.text ) do |f| %>
<% @site_valid_locales.each do |locale| %>
<td>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_area locale, :rows => 10, :cols => 40 %>
</td>
<% end %>
<% end %>
</div>
<div class="field">
<%= f.label :postdate %><br />
<%= f.date_select :postdate, :order => [:year, :month, :day], :use_month_numbers => true %>
<%#= date_select("bulletin", "postdate", :use_month_numbers => true) %>
</div>
<div class="field">
<%= f.label :deadline %><br />
<%= f.date_select :deadline, :use_month_numbers => true, :prompt => { :day => 'Select day', :month => 'Select month', :year => 'Select year'} %>
<%#= f.date_select :deadline, :order => [:year, :month, :day],:default => 1.years.from_now, :use_month_numbers => true %>
</div>
<div class="field">
<%#= f.label :url %><br />
<%#= f.text_field :url, :size => 60 %>
</div>
<div id='bulletin_links' class="bulletin_links_block <%= @class %>">
<div id='add_bulletin_link' class="info_input bulletin_links_block">
<h2>Bulletin links</h2>
<%= hidden_field_tag 'bulletin_link_field_count', @bulletin.bulletin_links.count %>
<a href="#" class="add"><%= t(:add) %></a>
</div>
<%#= render :partial => 'link', :locals => { :bulletin_links => @bulletin.bulletin_links , :f => f} %>
<% @bulletin.bulletin_links.each_with_index do |bulletin_link, i| %>
<%#= fields_for "bulletin[bulletin_links][]", bulletin_link do |f| %>
<%= f.fields_for :bulletin_links, bulletin_link do |f| %>
<%= render :partial => 'bulletin_link', :object => bulletin_link, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
</div>
<div id='bulletin_files' class="bulletin_files_block <%= @class %>">
<div id='add_bulletin_file' class="info_input bulletin_files_block">
<h2>Bulletin files</h2>
<%= hidden_field_tag 'bulletin_file_field_count', @bulletin.bulletin_files.count %>
<a href="#" class="add"><%= t(:add) %></a>
</div>
<%#= render :partial => 'file', :locals => { :bulletin_files => @bulletin.bulletin_files , :f => f} %>
<% @bulletin.bulletin_files.each_with_index do |bulletin_file, i| %>
<%#= fields_for "bulletin[bulletin_files][]", bulletin_file do |f| %>
<%= f.fields_for :bulletin_files, bulletin_file do |f| %>
<%= render :partial => 'bulletin_file', :object => bulletin_file, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
</div>
<br />
<br />
<div class="actions">
<%= f.submit %>
</div>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "bulletin_form" %>
<script>
$('#add_bulletin_link a.add').live('click', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_bulletin_links", "g");
$(this).prev().attr('value', parseInt(new_id) + 1);
$('#bulletin_links').append(("<%= escape_javascript(add_attribute 'bulletin_link', f, :bulletin_links) %>").replace(old_id, new_id));
});
$('#add_bulletin_file a.add').live('click', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_bulletin_files", "g");
$(this).prev().attr('value', parseInt(new_id) + 1);
$('#bulletin_files').append(("<%= escape_javascript(add_attribute 'bulletin_file', f, :bulletin_files) %>").replace(old_id, new_id));
});
</script>
<script type="text/javascript">
$(function() {
$('textarea').tinymce({
theme: 'advanced'
});
});
</script>
<% end %>
<!--Widget start-->
<!-- <div id="sub-wiget">
<div id="widget-date" class="widget-box">
<div id="widget-date" class="widget-box widget-size-300">
<div class="widget-action clear">
<a href="#" class="action"><i title="Set the announcement to start and end dates" class="icon-exclamation-sign icon-white tip"></i></a>
</div>
@ -153,220 +61,58 @@
<div class="control-group">
<label class="control-label">Start</label>
<div class="controls">
<select id="start-day" class="input-small">
<option>Day</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
<option>19</option>
<option>20</option>
<option>21</option>
<option>22</option>
<option>23</option>
<option>24</option>
<option>25</option>
<option>26</option>
<option>27</option>
<option>28</option>
<option>29</option>
<option>30</option>
<option>31</option>
</select>
<select id="start-month" class="input-small">
<option>Month</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
</select>
<select id="start-year" class="input-small">
<option>Year</option>
<option>2012</option>
<option>2011</option>
<option>2010</option>
<option>2009</option>
</select>
<%= f.date_select :postdate, {:use_month_numbers => true, :prompt => { :month => 'Month', :day => 'Day', :year => 'Year'}, :order => [:day, :month, :year] }, {:class => 'input-small'} %>
</div>
</div>
<div class="control-group">
<label class="control-label">End</label>
<div class="controls">
<select id="start-day" class="input-small">
<option>Day</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
<option>19</option>
<option>20</option>
<option>21</option>
<option>22</option>
<option>23</option>
<option>24</option>
<option>25</option>
<option>26</option>
<option>27</option>
<option>28</option>
<option>29</option>
<option>30</option>
<option>31</option>
</select>
<select id="start-month" class="input-small">
<option>Month</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
</select>
<select id="start-year" class="input-small">
<option>Year</option>
<option>2012</option>
<option>2011</option>
<option>2010</option>
<option>2009</option>
</select>
<%= 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">
<div id="widget-status" class="widget-box widget-size-300">
<div class="widget-action clear">
<a class="action"><i title="Setting the announcement 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">
<label class="checkbox inline"><input type="checkbox" value="hot">Hot</label>
<label class="checkbox inline"><input type="checkbox" value="top">Top</label>
<label class="checkbox inline"><input type="checkbox" value="hide">Hide</label>
</div>
</div>
</div>
<div id="widget-role" class="widget-box">
<div class="widget-action clear">
<a class="action"><i title="Set the read role" class="icon-exclamation-sign icon-white tip"></i></a>
<a class="action"><i title="Setting" class="icon-cog icon-white tip"></i></a>
</div>
<h3 class="widget-title"><i class="icons-lock icons-white"></i>Permissions</h3>
<div class="widget-content clear">
<div class="controls">
<label class="radio inline"><input class="privacy" type="radio" value="public" name="privacy">Public</label>
<label class="radio inline"><input class="privacy" type="radio" value="private" name="privacy">Private</label>
<div class="well select-role">
<label class="checkbox inline"><input type="checkbox" value="hot">Student</label>
<label class="checkbox inline"><input type="checkbox" value="top">Teacher</label>
<label class="checkbox inline"><input type="checkbox" value="hide">Staff</label>
</div>
</div>
</div>
</div>
<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="images/default-img.png" />
<div class="controls file-upload">
<label class="control-label btn" for="input-upload">
Browse/選擇檔案
<input id="input-upload" class="upload" type="file" name="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">
</div>
<%= f.check_box :is_top %><%= t('top') %>
<%= f.check_box :is_hot %><%= t('hot') %>
<%= f.check_box :is_hidden %><%= t('hide') %>
</div>
</div>
</div>
<div id="widget-tags" class="widget-box">
<div id="widget-tags" class="widget-box widget-size-300">
<div class="widget-action clear">
<a class="action"><i title="Enter post tags, Chinese and English required" class="icon-exclamation-sign icon-white tip"></i></a>
<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">
<div class="control-group error">
<label class="control-label" for="tags-zh-tw">
Chinese
</label>
<div class="controls">
<input id='tags-zh-tw' class="input-prepend" type="text">
<span class="help-inline">Please correct the error</span>
<% @tags.each do |tag| %>
<%= check_box_tag 'bulletin[tag_ids][]', tag.id, @bulletin.tag_ids.include?(tag.id)%>
<%= tag[I18n.locale] %>
<% end %>
</div>
</div>
<div class="control-group">
<label class="control-label" for="tags-en">
English
</label>
<div class="controls">
<input id='tags-en' class="input-prepend" type="text">
<span class="help-inline">Please correct the error</span>
</div>
</div>
<div class="clear">
<a class="pull-right btn btn-primary" href="#">Add/新增</a>
</div>
<hr>
<span class="label label-tags">Default<a href><i class="icon-remove icon-white"></i></a></span>
<span class="label label-tags">Default<a href><i class="icon-remove icon-white"></i></a></span>
<span class="label label-tags">Default<a href><i class="icon-remove icon-white"></i></a></span>
<span class="label label-tags">Default<a href><i class="icon-remove icon-white"></i></a></span>
</div>
</div>
</div> -->
<!--Wiget End-->
<!--Post Start-->
<!-- <div id="post-body">
<div id="post-body">
<div id="post-body-content" class="clear">
<%= f.select :bulletin_category_id, @bulletin_categorys.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %> <div class="btn-group pull-right">
<%= f.label :category %>
<%= f.select :bulletin_category_id, @bulletin_categorys.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %>
<div class="btn-group pull-right">
<a class="btn dropdown-toggle" href="#" data-toggle="dropdown">
English
<span class="caret"></span>
@ -382,15 +128,43 @@
</ul>
</div>
<div class="title">
<%= f.label :title %>
<%= f.fields_for :title, (@bulletin.new_record? ? @bulletin.build_title : @bulletin.title ) do |f| %>
<% @site_valid_locales.each do |locale| %>
<td>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title' %>
</td>
<% end %>
<% end %>
</div>
<div class="title">
<input class="post-title" type="text" placeholder="Enter title here">
<%= f.label :subtitle %>
<%= f.fields_for :subtitle, (@bulletin.new_record? ? @bulletin.build_subtitle : @bulletin.subtitle ) do |f| %>
<% @site_valid_locales.each do |locale| %>
<td>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_area locale, :style=>"width:100%" %>
</td>
<% end %>
<% end %>
</div>
<div class="title">
<%= f.label :text %>
<%= f.fields_for :text, (@bulletin.new_record? ? @bulletin.build_text : @bulletin.text ) do |f| %>
<% @site_valid_locales.each do |locale| %>
<td>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_area locale, :style=>"width:100%" %>
</td>
<% end %>
<% end %>
</div>
<div class="editor">
<%= text_area_tag 'locale', nil, :style=>"width:100%" %>
</div>
<div class="main-wiget">
<div id="widget-link" class="widget-box">
<div class="widget-action clear">
@ -401,61 +175,45 @@
<table class="table table-condensed">
<thead>
<tr>
<th>Chinese</th>
<th>English</th>
<th>URL</th>
<% @site_valid_locales.each do |locale| %>
<div class="control-group">
<th>Name - <%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th>
<% end %>
<th class="span1"></th>
</tr>
</thead>
<tfoot>
<tr>
<td style="text-align:center" colspan="3">
<a class="btn btn-primary btn-small" href="#modal-link" data-toggle="modal"><i class="icon-plus icon-white"></i> ADD/新增</a>
<td style="text-align:center" colspan="4">
<div id='add_bulletin_link' class="info_input bulletin_links_block">
<%= hidden_field_tag 'bulletin_link_field_count', @bulletin.bulletin_links.count %>
<a class="add"><span class="btn btn-primary btn-small"><i class="icon-plus icon-white"></i> ADD/新增</span></a>
</div>
</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>…</td>
<td>…</td>
<td><a href="#modal-link" data-toggle="modal" class="action"><i class="icon-pencil"></i></a><a href class="action"><i class="icon-remove"></i></a></td>
</tr>
<div id='bulletin_links' class="bulletin_links_block">
<% @bulletin.bulletin_links.each_with_index do |bulletin_link, i| %>
<%#= fields_for "bulletin[bulletin_links][]", bulletin_link do |f| %>
<%= f.fields_for :bulletin_links, bulletin_link do |f| %>
<%= render :partial => 'bulletin_link', :object => bulletin_link, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
</div>
</tbody>
</table>
</div>
<div id="modal-link" class="modal hide fade">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h3>Add Link / Edit Link</h3>
</div>
<div class="modal-body form-horizontal">
<div class="control-group">
<label for="http" class="control-label">http://</label>
<div class="controls">
<input type="text" value="" id="http" class="input-xlarge">
<span class="help-inline">Please correct the error</span>
</div>
</div>
<div class="control-group error">
<label for="link-zh-tw" class="control-label">Chinese</label>
<div class="controls">
<input type="text" value="" id="link-zh-tw" class="input-xlarge">
<span class="help-inline">Please correct the error</span>
</div>
</div>
<div class="control-group">
<label for="link-en" class="control-label">English</label>
<div class="controls">
<input type="text" value="" id="link-en" class="input-xlarge">
<span class="help-inline">Please correct the error</span>
</div>
</div>
</div>
<div class="modal-footer">
<a class="btn btn-primary" href="#">Submit/確定</a>
<a class="btn" data-dismiss="modal" href="#">Cancel/取消</a>
</div>
</div>
</div>
<div class="main-wiget">
<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>
@ -465,67 +223,74 @@
<table class="table table-condensed">
<thead>
<tr>
<th>Chinese</th>
<th>English</th>
<th>File</th>
<th>Name</th>
<th><%= t('description') %></th>
<th class="span1"></th>
</tr>
</thead>
<tfoot>
<tr>
<td style="text-align:center" colspan="3">
<a class="btn btn-primary btn-small" href="#modal-file" data-toggle="modal"><i class="icon-plus icon-white"></i> ADD/新增</a>
<td style="text-align:center" colspan="4">
<div id='add_bulletin_file' class="info_input bulletin_files_block">
<%= hidden_field_tag 'bulletin_file_field_count', @bulletin.bulletin_files.count %>
<a class="add"><span class="btn btn-primary btn-small"><i class="icon-plus icon-white"></i> ADD/新增</span></a>
</div>
</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>…</td>
<td>…</td>
<td><a href="#modal-file" data-toggle="modal" class="action"><i class="icon-pencil"></i></a><a href class="action"><i class="icon-remove"></i></a></td>
</tr>
<div id='bulletin_files' class="bulletin_files_block">
<% @bulletin.bulletin_files.each_with_index do |bulletin_file, i| %>
<%#= fields_for "bulletin[bulletin_files][]", bulletin_file do |f| %>
<%= f.fields_for :bulletin_files, bulletin_file do |f| %>
<%= render :partial => 'bulletin_file', :object => bulletin_file, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
</div>
</tbody>
</table>
</div>
<div id="modal-file" class="modal hide fade">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h3>Add File / Edit File</h3>
</div>
<div class="modal-body form-horizontal">
<div class="controls file-upload">
<label class="control-label btn" for="input-upload">
Browse
<input id="input-upload" class="upload" type="file" name="upload" onchange="document.getElementById('fn').innerHTML = this.value;">
</label>
<span id='fn' class="file-name"></span>
</div>
<div class="control-group">
<label for="file-zh-tw" class="control-label">Chinese</label>
<div class="controls">
<input type="text" value="" id="file-zh-tw" class="input-xlarge">
<span class="help-inline">Please correct the error</span>
</div>
</div>
<div class="control-group">
<label for="file-en" class="control-label">English</label>
<div class="controls">
<input type="text" value="" id="file-en" class="input-xlarge">
<span class="help-inline">Please correct the error</span>
</div>
<!--Post End-->
<div class="form-actions">
<%= f.submit 'Submit/送出', :class=>'btn btn-primary' %>
</div>
</div>
<div class="modal-footer">
<a class="btn btn-primary" href="#">Submit/確定</a>
<a class="btn" data-dismiss="modal" href="#">Cancel/取消</a>
</div>
</div>
</div>
</div>
</div>
</div> -->
<!--Post End-->
<!-- <div class="form-actions"> -->
<button class="btn btn-success" type="submit">Preview/預覽</button>
<button class="btn btn-primary" type="submit">Submit/送出</button>
<button class="btn" type="reset">Cancel/取消</button>
<!-- </div> -->
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "bulletin_form" %>
<script>
$('#add_bulletin_link a.add').live('click', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_bulletin_links", "g");
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'bulletin_link', f, :bulletin_links) %>").replace(old_id, new_id));
});
$('#add_bulletin_file a.add').live('click', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_bulletin_files", "g");
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'bulletin_file', f, :bulletin_files) %>").replace(old_id, new_id));
});
</script>
<script type="text/javascript">
$(function() {
$('textarea').tinymce({
theme: 'advanced'
});
});
</script>
<% end %>

View File

@ -3,11 +3,11 @@
<td colspan="8">
<legend><%= t(:quick_edit) %> - <span class='qe_title'></span>Basic / Picture / Tags / Link / File</legend>
<%= form_for bulletin, :url => panel_announcement_back_end_bulletin_path(bulletin), :html => {:class => 'form-horizontal'} do |f| %>
<%= render :partial => "quick_edit_basic", :locals => { :f => f, :bulletin => bulletin } %>
<%= render :partial => "quick_edit_picture", :locals => { :f => f, :bulletin => bulletin } %>
<%= render :partial => "quick_edit_tags", :locals => { :f => f, :bulletin => bulletin } %>
<%= render :partial => "quick_edit_links", :locals => { :f => f, :bulletin => bulletin } %>
<%= render :partial => "quick_edit_files", :locals => { :f => f, :bulletin => bulletin } %>
<%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_basic", :locals => { :f => f, :bulletin => bulletin } %>
<%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_picture", :locals => { :f => f, :bulletin => bulletin } %>
<%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_tags", :locals => { :f => f, :bulletin => bulletin } %>
<%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_links", :locals => { :f => f, :bulletin => bulletin } %>
<%= render :partial => "panel/announcement/back_end/bulletins/quick_edit_files", :locals => { :f => f, :bulletin => bulletin } %>
<div class="form-actions">
<%= f.submit t(:submit), :class => 'btn btn-primary' %>
<%= f.submit t(:cancel), :class => 'btn', :type => 'reset' %>

View File

@ -17,11 +17,11 @@
</tr>
</tfoot>
<tbody>
<tr>
<td>…</td>
<td>…</td>
<td><a href="#modal-link" data-toggle="modal" class="action"><i class="icon-pencil"></i></a><a href class="action"><i class="icon-remove"></i></a></td>
</tr>
<% bulletin.bulletin_links.each_with_index do |bulletin_link2, i| %>
<%= f.fields_for :bulletin_links, bulletin_link2 do |f| %>
<%= render :partial => 'bulletin_link2', :object => bulletin_link2, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
</tbody>
</table>
</div>
@ -32,27 +32,25 @@
</div>
<div class="modal-body form-horizontal">
<div class="control-group">
<label for="http" class="control-label">http://</label>
<label for="http" class="control-label">URL</label>
<div class="controls">
<input type="text" value="" id="http" class="input-xlarge">
<span class="help-inline">Please correct the error</span>
</div>
</div>
<% @site_valid_locales.each do |locale| %>
<div class="control-group error">
<label for="link-zh-tw" class="control-label">Chinese</label>
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
<div class="controls">
<input type="text" value="" id="link-zh-tw" class="input-xlarge">
<span class="help-inline">Please correct the error</span>
</div>
</div>
<div class="control-group">
<label for="link-en" class="control-label">English</label>
<div class="controls">
<input type="text" value="" id="link-en" class="input-xlarge">
<input type="text" value="" id="link-<%= locale %>" class="input-xlarge">
<span class="help-inline">Please correct the error</span>
</div>
</div>
<% end %>
</div>
<div class="modal-footer">
<a class="btn btn-primary" href="#">Submit/確定</a>
<a class="btn" data-dismiss="modal" href="#">Cancel/取消</a>

View File

@ -7,11 +7,16 @@
<div class="controls file-upload">
<label class="control-label btn" for="input-upload">
Browse/選擇檔案
<input id="input-upload" class="upload" type="file" name="upload" onchange="document.getElementById('fu').innerHTML = this.form.fu.value = this.value;">
<%= 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-large" type="text">
<br>
<% if bulletin.image.file %>
<%= f.check_box :remove_image %>
<%= t('announcement.刪除已上傳檔案') %>
<% end %>
</div>
</div>
</div>

View File

@ -0,0 +1,9 @@
<%= render 'filter' %>
<table id="bulettin_sort_list" class="table main-list">
<%= render 'bulletins' %>
</table>
<div class="form-actions">
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_announcement_back_end_bulletin_path, :class => 'btn btn-primary' %>
</div>

View File

@ -0,0 +1,9 @@
<%= render 'filter' %>
<table id="bulettin_sort_list" class="table main-list">
<%= render 'bulletins' %>
</table>
<div class="form-actions">
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_announcement_back_end_bulletin_path, :class => 'btn btn-primary' %>
</div>

View File

@ -2,7 +2,10 @@
<table id="bulettin_sort_list" class="table main-list">
<%= render 'bulletins' %>
</table>
<div class="form-actions">
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_announcement_back_end_bulletin_path, :class => 'btn btn-primary' %>
</div>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "bulletin_form" %>
<% end %>

View File

@ -0,0 +1,2 @@
//$.each($(".quick_edit"),function(obj){ $(this).remove(); });
$("#<%= "bulletin_#{bulletin_link2.id}" %>").append("<%= j render "bulletin_link_qe" %>");

View File

@ -21,7 +21,7 @@
</li>
<li>
<b><%= t('announcement.title') %></b>
<%= @bulletin.title %>
<%= @bulletin.title[I18n.locale] %>
</li>
<li>
<%#= image_tag(@bulletin.image.url, :size => "320x240") if @bulletin.image.file %>
@ -29,23 +29,23 @@
</li>
<li>
<b><%= t('announcement.subtitle') %></b>
<%= @bulletin.subtitle %>
<%= @bulletin.subtitle[I18n.locale].html_safe %>
</li>
<li>
<b><%= t('announcement.text') %></b>
<%= @bulletin.text %>
<%= @bulletin.text[I18n.locale].html_safe %>
</li>
<li>
<li>
<b><%= t('announcement.link') %></b>
<% @bulletin.bulletin_links.each do | blink | %>
<%= link_to blink.name, blink.url, :target => '_blank' %>
<%= link_to blink.i18n_variable[I18n.locale], blink.url, :target => '_blank' %>
<% end %>
</li>
<li>
<b><%= t('announcement.file') %></b>
<% @bulletin.bulletin_files.each do | bfile | %>
<%= link_to bfile.filetitle, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
<%= link_to bfile.filetitle[I18n.locale], bfile.file.url, {:target => '_blank', :title => bfile.description[I18n.locale]} if bfile.file.file %>
<% end %>
</li>
<li>

View File

@ -0,0 +1,7 @@
<%= content_tag :div ,:id => "users_checkbox_ary", do -%>
<% sys_users = User.all -%>
<% sys_users.each do |user| -%>
<%= label_tag "lab-user-#{user.id}", user.name rescue '' -%>
<%= check_box_tag "[users][#{user.id}]", 'true',users.include?(user) -%>
<% end -%>
<% end -%>

View File

@ -1,5 +1,14 @@
<%= render 'panel/announcement/back_end/bulletins/filter' %>
<table id="bulettin_sort_list" class="table main-list">
<%= render 'panel/announcement/back_end/bulletins/bulletins' %>
</table>
<div class="form-actions">
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_announcement_back_end_bulletin_path, :class => 'btn btn-primary' %>
</div>
<!--
<% content_for :secondary do %>
<%= render :partial => '/panel/announcement/back_end/announcement_secondary' %>
<%#= render :partial => '/panel/announcement/back_end/announcement_secondary' %>
<% end -%>
<%= flash_messages %>
@ -34,7 +43,8 @@
<div id="check_block">
<h1>Check Please</h1>
<%= render :partial => "list_table", :collection => @bulletin_categorys_check,:as => :bulletin_category%>
<%#= render :partial => "list_table", :collection => @bulletin_categorys_check,:as => :bulletin_category%>
</div>
<br />
-->

View File

@ -0,0 +1,20 @@
<%= label_tag :fact_check_setting, t("announcement.bulletin.fact_check_setting") %>
<br/>
<%= form_tag('', :remote => true) %>
<%= label_tag :category, t("announcement.bulletin.category") %>
<%= select_tag "category_id", options_from_collection_for_select(@bulletin_categorys, "id", "key") %>
<br/>
<%= label_tag :role, t("admin.roles") %>
<%= content_tag :div do -%>
<% form_tag :action => "update_setting" do %>
<%= render :partial => "privilege_user", :locals => {:users => @users_array} %>
<%= submit_tag "Update" %>
<% end -%>
<% end -%>
<script type="text/javascript" charset="utf-8">
$('#category_id').change(function() {
$(this).parents('form').submit();
});
</script>

View File

@ -0,0 +1 @@
$("#users_checkbox_ary").replaceWith('<%= (render :partial => 'privilege_user', :locals => {:users => @users_array}).html_safe%>');

View File

@ -29,5 +29,5 @@
</table>
<%= paginate @bulletins %>
<%= paginate @bulletins, :params => {:inner => 'false'} %>

View File

@ -1,6 +1,6 @@
<% @web_links.each do |web_link| %>
<li>
<a><%= web_link.name[I18n.locale] %></a>
<%= link_to web_link.name[I18n.locale], web_link.url %>
</li>
<% end %>

View File

@ -0,0 +1,42 @@
<% if @bulletin and !@bulletin.nil? %>
<div id="col1" class="col">
<h1 class="h1 ini_heading col_title"><%= @bulletin.title %></h1>
<p class="ini_txt"><%= @bulletin.subtitle %></p>
<%= link_to "read more >",panel_announcement_front_end_bulletin_path(@bulletin.id) %>
<a class="btn" href="">read more &gt;</a>
</div>
<% end %>
<% if @bulletins and !@bulletins.nil? %>
<div id="col2" class="col">
<h1 class="h1 ini_heading col_title">news</h1>
<ul class="ini_list">
<% @bulletins.each do |post| %>
<li><span class="time"><%= post.postdate.to_s.gsub("-", "") %></span><%= link_to post.title,panel_announcement_front_end_bulletin_path(post) %></li>
<% end %>
</ul>
<%= link_to "read more >",panel_announcement_front_end_bulletins_path(), :class => "btn" %>
<a class="btn" href="announcement">read more &gt;</a>
</div>
<div id="col2" class="col">
<h1 class="h1 ini_heading col_title">news</h1>
<ul class="ini_list">
<% @bulletins.each do |post| %>
<li>
<%= image_tag(post.image.url, :size => "160x140") if post.image.file %>
<h4><%= post.title %></h4>
<%= post.subtitle %>
</li>
<% end %>
</ul>
<%= link_to "read more >",panel_announcement_front_end_bulletins_path(), :class => "btn" %>
<a class="btn" href="announcement">read more &gt;</a>
</div>
<% end %>

View File

@ -35,6 +35,12 @@ en:
list_lower: " list"
title: Title
postdate: Postdate
fact_check: Fact Check
fact_check_setting: Fact Check Setting
fact_check_stat: Fact Check Status
fact_check_not_pass: 'Not Pass'
fact_check_not_pass_reason: 'Reason'
fact_check_pass: 'Pass'
# admin:
# action: Action
# add_language: Add language

View File

@ -30,6 +30,13 @@ zh_tw:
list_lower: 列表
title: 標題
postdate: 張貼日期
fact_check: 公告審核
fact_check_setting: 審核設定
fact_check_stat: 審核狀況
fact_check_not_pass: '不通過'
fact_check_pass: '通過'
fact_check_not_pass_reason: '不通過原因'
# admin:
# action: 行動
# add_language: 新增語言

View File

@ -3,17 +3,20 @@ Rails.application.routes.draw do
namespace :announcement do
namespace :back_end do
match 'public' => "announcements#public",:as => :public
resources :fact_checks
match 'list_mine' => "announcements#list_mine"
match 'fact_check_setting' => "fact_checks#setting" ,:as => :fact_checks_setting
match 'update_setting' => "fact_checks#update_setting" ,:as => :fact_checks_update_setting
root :to => "bulletins#index"
resources :bulletins
resources :bulletins do
match "link_quick_add/:bulletin_id" => "bulletins#link_quick_add" ,:as => :link_quick_add
match "link_quick_edit/:bulletin_id" => "bulletins#link_quick_edit" ,:as => :link_quick_edit
end
resources :bulletin_categorys, :controller => 'bulletin_categorys' do
match "quick_edit/:bulletin_category_id" => "bulletin_categorys#quick_edit" ,:as => :quick_edit
end
resources :tags
end
namespace :front_end do
root :to => "bulletins#index"
resources :bulletins
end
namespace :widget do

View File

@ -1,4 +1,4 @@
class Panel::NewBlog::Widget::PostsController < \"
class Panel::NewBlog::Widget::PostsController < OrbitWidgetController
# GET /posts
# GET /posts.xml
def index

View File

@ -3,7 +3,7 @@
# # Add a load path for this specific Engine
# # config.autoload_paths << File.expand_path("../lib/some/path", __FILE__)
# put "ABC"
# PrototypeR4::Application::Orbit_Apps << "NewBlog"
# Orbit::Application::Orbit_Apps << "NewBlog"
#
# # initializer "my_engine.add_middleware" do |app|
# # app.middleware.use MyEngine::Middleware
@ -15,4 +15,4 @@ module NewBlog
VERSION = "0.0.1"
MOUDLEAPP_TITLE = "NewBlog"
end
# PrototypeR4::Application::Orbit_Apps << "NewBlog"
# Orbit::Application::Orbit_Apps << "NewBlog"

View File

@ -1,4 +1,4 @@
class Panel::PageContent::FrontEnd::PageContextsController < \"
class Panel::PageContent::FrontEnd::PageContextsController < OrbitWidgetController
def initialize
super

View File

@ -1,32 +1,33 @@
<% # encoding: utf-8 %>
<%= f.error_messages %>
<%#= debugger %>
<%= f.error_messages %>
<div class="field">
<div id="post-body">
<div class="title">
<%= f.label :name %>
<%= @page_context.page.i18n_variable[I18n.locale] %>
</div>
<div class="field">
<div class="title">
<%= f.label :context %>
<%= f.fields_for :context, (@page_context.new_record? ? @page_context.build_context : @page_context.context ) do |f| %>
<% @site_valid_locales.each do |locale| %>
<td>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_area locale, :rows => 10, :cols => 40 %>
<%= f.text_area locale, :style=>"width:100%" %>
</td>
<% end %>
<% end %>
</div>
<br />
<br />
<div class="actions">
<%= f.submit %>
<div class="form-actions">
<%= f.submit 'Submit/送出', :class=>'btn btn-primary' %>
</div>
</div>
<% content_for :page_specific_javascript do %>
<script type="text/javascript">

View File

@ -1,10 +1,14 @@
<tr id="<%= dom_id page_context %>">
<td><%= page_context.page.i18n_variable[I18n.locale] %></td>
<tr id="<%= dom_id page_context %>" class="with_action">
<td>
<%= page_context.page.i18n_variable[I18n.locale] %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<li><%= link_to t('page_context.edit'), edit_panel_page_content_back_end_page_context_path(page_context) %></li>
</ul>
</div>
</td>
<td><%= link_to page_context.version, panel_page_content_back_end_view_path(page_context.page_id) %></td>
<td><%= page_context.updated_at.strftime("%Y-%m-%d %H:%I:%S") %></td>
<td><%= User.find(page_context.create_user_id).name %></td>
<td>
<%= link_to t('page_context.edit'), edit_panel_page_content_back_end_page_context_path(page_context) %>
</td>
</tr>
</tr>

View File

@ -1,10 +1,15 @@
<tr id="<%= dom_id view_page_context %>">
<td><%= view_page_context.page.i18n_variable[I18n.locale] %></td>
<tr id="<%= dom_id view_page_context %>" class="with_action">
<td>
<%= view_page_context.page.i18n_variable[I18n.locale] %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<li><%= link_to t('view_page_context.show'), panel_page_content_back_end_page_context_path(view_page_context) %></li>
</ul>
</div>
</td>
<td><%= view_page_context.version %></td>
<td><%= view_page_context.updated_at.strftime("%Y-%m-%d %H:%I:%S") %></td>
<td><%= User.find(view_page_context.create_user_id).name %></td>
<td>
<%= link_to t('view_page_context.show'), panel_page_content_back_end_page_context_path(view_page_context) %>
</td>
</tr>
</tr>

View File

@ -1,7 +1,3 @@
<br />
<br />
<br />
<br />
<h1><%= t('page_content.editing_page_content') %></h1>
@ -9,8 +5,4 @@
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>
<%= link_back %>
<br />
<br />
<br />
<br />
<%#= link_back %>

View File

@ -1,36 +1,20 @@
<% content_for :secondary do %>
<br />
<br />
<br />
<br />
<br />
<ul class="list">
<li><%= link_to t('page_context.page_content_list'), panel_page_content_back_end_page_contexts_path %></li>
</ul>
<% end -%>
<%= flash_messages %>
<br />
<br />
<br />
<br />
<br />
<h1><%= t('page_context.list_page_content') %></h1>
<table>
<table class="table main-list">
<thead>
<tr>
<th><%= t('page_context.name') %></th>
<th><%= t('page_context.version') %></th>
<th><%= t('page_context.update_time') %></th>
<th><%= t('page_context.last_modified') %></th>
<th><%= t('page_context.action') %></th>
<th class="span7 select"><%= t('page_context.name') %></th>
<th class="span1-2"><%= t('page_context.version') %></th>
<th class="span1-2"><%= t('page_context.update_time') %></th>
<th class="span1-2"><%= t('page_context.last_modified') %></th>
</tr>
</thead>
<tbody>
<%= render :partial => 'page_context', :collection => @page_contexts %>
</table>
</tbody>
</table>
<br />

View File

@ -1,36 +1,19 @@
<% content_for :secondary do %>
<br />
<br />
<br />
<br />
<br />
<ul class="list">
<li><%= link_to t('page_context.page_content_list'), panel_page_content_back_end_page_contexts_path %></li>
</ul>
<% end -%>
<%= flash_messages %>
<br />
<br />
<br />
<br />
<br />
<h1><%= t('page_context.list_page_content') %></h1>
<table>
<table class="table main-list">
<thead>
<tr>
<th><%= t('page_context.name') %></th>
<th><%= t('page_context.version') %></th>
<th><%= t('page_context.update_time') %></th>
<th><%= t('page_context.last_modified') %></th>
<th><%= t('page_context.action') %></th>
<th class="span7 select"><%= t('page_context.name') %></th>
<th class="span1-2"><%= t('page_context.version') %></th>
<th class="span1-2"><%= t('page_context.update_time') %></th>
<th class="span1-2"><%= t('page_context.last_modified') %></th>
</tr>
</thead>
<tbody>
<%= render :partial => 'view_page_context', :collection => @page_contexts %>
</table>
<br />
</tbody>
</table>

View File

@ -1,6 +1,6 @@
class Panel::WebResource::BackEnd::WebLinkCategorysController < ApplicationController
layout 'admin'
layout 'new_admin'
def index
@web_link_categorys = WebLinkCategory.all

View File

@ -1,7 +1,7 @@
class Panel::WebResource::BackEnd::WebLinksController < ApplicationController
layout 'admin'
layout 'new_admin'
before_filter :authenticate_user!
before_filter :is_admin?

View File

@ -1,4 +1,8 @@
<<<<<<< HEAD
class Panel::WebResource::FrontEnd::WebLinksController < \"
=======
class Panel::WebResource::FrontEnd::WebLinksController < OrbitWidgetController
>>>>>>> master
def initialize
super

View File

@ -1,4 +1,4 @@
class Panel::WebResource::Widget::WebLinksController < \"
class Panel::WebResource::Widget::WebLinksController < OrbitWidgetController
def initialize
super

View File

@ -1,25 +1,29 @@
<% # encoding: utf-8 %>
<%= form_for(@web_link_category, :remote => true, :url => @url) do |f| %>
<%#= form_for(@web_link_category, :remote => true, :url => panel_web_resource_back_end_web_link_category_path(@web_link_category)) do |f| %>
<div class="field">
<%= f.label :key %><br />
<h2><%= (@web_link_category.new_record? ? 'Add' : 'Edit') %></h2>
<div id="widget-title">
<%= f.label :key %>
<%= f.text_field :key %>
</div>
<div class="field">
<%= f.label :name %><br />
<div id="widget-title">
<%= f.fields_for :i18n_variable, (@web_link_category.new_record? ? @web_link_category.build_i18n_variable : @web_link_category.i18n_variable) do |f| %>
<% @site_valid_locales.each do |locale| %>
<%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %>
<%= f.text_field locale, :style => "width:130px" %>
<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 class="actions">
<%= f.submit %>
<div class="form-actions">
<%= f.submit 'Submit/送出', :class=>'btn btn-primary' %>
</div>
<% end %>

View File

@ -1,12 +1,16 @@
<tr id="<%= dom_id web_link_category %>">
<td><%= web_link_category.key %></td>
<tr id="<%= dom_id web_link_category %>" class="with_action">
<td>
<%= web_link_category.key %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<li><%= link_to t('web_link_category.edit'), edit_panel_web_resource_back_end_web_link_category_path(web_link_category), :remote => true %></li>
<li><%= link_to t('web_link_category.delete'), panel_web_resource_back_end_web_link_category_quick_edit_path(web_link_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
</ul>
</div>
</td>
<% @site_valid_locales.each do |locale| %>
<td><%= web_link_category.i18n_variable[locale] rescue nil %></td>
<% end %>
<td>
<%= link_to t('web_link_category.edit'), edit_panel_web_resource_back_end_web_link_category_path(web_link_category), :remote => true %> |
<%= link_to t('web_link_category.quick_edit'), panel_web_resource_back_end_web_link_category_quick_edit_path(web_link_category), :remote => true %> |
<%= link_to t('web_link_category.delete'), panel_web_resource_back_end_web_link_category_path(web_link_category), :confirm => t('sure?'), :method => :delete, :remote => true %>
</td>
</tr>
</tr>

View File

@ -1,43 +1,23 @@
<% content_for :secondary do %>
<br />
<br />
<br />
<br />
<br />
<ul class="list">
<li><%#= link_to t('web_link_category.new_web_resource_class'), new_panel_web_resource_back_end_web_link_category_path, :class => 'seclink1' %></li>
</ul>
<% end -%>
<%= flash_messages %>
<h1><%= t('web_link_category.list_web_resource_class') %></h1>
<br />
<br />
<br />
<br />
<br />
<table id="web_link_categorys">
<table id="web_link_categorys" class="table main-list">
<thead>
<tr>
<th><%= t('web_link_category.key') %></th>
<th class="span1-2"><%= t('web_link_category.key') %></th>
<% @site_valid_locales.each do |locale| %>
<th><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th>
<th class="span1-2"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th>
<% end %>
<th><%= t('web_link.action') %></th>
</tr>
</thead>
<tbody>
<%# @web_link_categorys.each do |post| %>
<%= render :partial => 'web_link_category', :collection => @web_link_categorys %>
<%# end %>
</tbody>
</table>
<br />
<br />
<br />
<br />
<h2>Add New</h2>
<div id="form"><%= render :partial => "form" %></div>

View File

@ -1,62 +1,101 @@
<% # encoding: utf-8 %>
<%= f.error_messages %>
<%#= debugger %>
<div class="field">
<%= f.label :category %><br />
<%= f.select :web_link_category_id, @web_link_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ]} %>
<!--Widget start-->
<div id="sub-wiget">
<div id="widget-status" class="widget-box widget-size-300">
<div class="widget-action clear">
<a class="action"><i title="Setting the announcement state" class="icon-exclamation-sign icon-white tip"></i></a>
</div>
<div class="field">
<%= f.label :name %>
<%= f.fields_for :name, (@web_link.new_record? ? @web_link.build_name : @web_link.name ) do |f| %>
<% @site_valid_locales.each do |locale| %>
<td>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale %>
</td>
<% end %>
<% end %>
</div>
<div class="field">
<%= f.label :url %><br />
<%= f.text_field :url, :size => 60 %>
</div>
<div class="field">
<%= f.label :describe %>
<%= f.fields_for :context, (@web_link.new_record? ? @web_link.build_context : @web_link.context ) do |f| %>
<% @site_valid_locales.each do |locale| %>
<td>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_area locale, :rows => 10, :cols => 40 %>
</td>
<% end %>
<% end %>
</div>
<div class="field">
<%= f.label :status %><br />
<h3 class="widget-title"><i class="icons-star-thin icons-white"></i>Status</h3>
<div class="widget-content clear">
<div class="controls">
<%= f.check_box :is_top %><%= t('top') %>
<%= f.check_box :is_hot %><%= t('hot') %>
<%= f.check_box :is_hidden %><%= t('hidden') %>
<%= f.check_box :is_hidden %><%= t('hide') %>
</div>
</div>
</div>
<div class="field">
<%= f.label :tags %><br />
<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| %>
<%= check_box_tag 'web_link[tag_ids][]', tag.id, @web_link.tag_ids.include?(tag.id)%>
<%= tag[I18n.locale] %>
<% end %>
</div>
<br />
<br />
<div class="actions">
<%= f.submit %>
</div>
</div>
<!--Wiget End-->
<!--Post Start-->
<div id="post-body">
<div id="post-body-content" class="clear">
<%= f.label :category %>
<%= f.select :web_link_category_id, @web_link_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ]} %>
<div class="btn-group pull-right">
<a class="btn dropdown-toggle" href="#" data-toggle="dropdown">
English
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li><a href="#">English</a></li>
<li><a href="#">Chinese</a></li>
<li><a href="#">Japanese</a></li>
<li><a href="#">French</a></li>
<li><a href="#">German</a></li>
<!--<li class="divider"></li>
<li><a href="#">Separated link</a></li>-->
</ul>
</div>
<div class="title">
<%= f.label :name %>
<%= f.fields_for :name, (@web_link.new_record? ? @web_link.build_name : @web_link.name ) do |f| %>
<% @site_valid_locales.each do |locale| %>
<td>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title' %>
</td>
<% end %>
<% end %>
</div>
<div class="title">
<%= f.label :url %>
<%= f.text_field :url %>
</div>
<div class="title">
<%= f.label :describe %>
<%= f.fields_for :context, (@web_link.new_record? ? @web_link.build_context : @web_link.context ) do |f| %>
<% @site_valid_locales.each do |locale| %>
<td>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_area locale, :style=>"width:100%" %>
</td>
<% end %>
<% end %>
</div>
</div>
<!--Post End-->
<div class="form-actions">
<%= f.submit 'Submit/送出', :class=>'btn btn-primary' %>
</div>

View File

@ -1,5 +1,5 @@
<tr id="<%= dom_id post %>">
<tr id="<%= dom_id post %>" class="with_action">
<td>
<% if post.is_top? %>
<span class="label label-success"><%= t(:top) %></span>
@ -10,6 +10,12 @@
<% if post.is_hidden? %>
<span class="label"><%= t(:hidden) %></span>
<% end %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<li><%= link_to t('web_link.edit'), edit_panel_web_resource_back_end_web_link_path(post) %></li>
<li><%= link_to t('web_link.delete'), panel_web_resource_back_end_web_link_path(post), :confirm => t('sure?'), :method => :delete, :remote => true %></li>
</ul>
</div>
</td>
<td><%= post.web_link_category.i18n_variable[I18n.locale] %></td>
<td>
@ -20,12 +26,5 @@
<span class="label label-tags"><%= tag[I18n.locale] %></span>
<% end %>
</td>
<td>
<%= link_to t('web_link.edit'), edit_panel_web_resource_back_end_web_link_path(post) %> |
<%= link_to t(:set_top), eval("panel_web_resource_back_end_web_link_path(post, :authenticity_token => form_authenticity_token, :web_link => {:is_top => true})"), :remote => true, :method => :put, :id => "disable_#{post.id}", :style => "display:#{post.is_top? ? 'none' : ''}", :class => 'switch' %>
<%= link_to t(:cancel_top), eval("panel_web_resource_back_end_web_link_path(post, :authenticity_token => form_authenticity_token, :web_link => {:is_top => false})"), :remote => true, :method => :put, :id => "enable_#{post.id}", :style => "display:#{post.is_top? ? '' : 'none'}", :class => 'switch' %>
| <%= link_to t('web_link.delete'), panel_web_resource_back_end_web_link_path(post), :confirm => t('sure?'), :method => :delete, :remote => true %>
</td>
</tr>

View File

@ -1,52 +1,21 @@
<% content_for :secondary do %>
<br />
<br />
<br />
<br />
<br />
<ul class="list">
<li><%= link_to t('web_link.new_link'), new_panel_web_resource_back_end_web_link_path %></li>
<li><%= link_to t('web_link.link_list'), panel_web_resource_back_end_web_links_path %></li>
<li><%= link_to t('web_link.new_link_class'), panel_web_resource_back_end_web_link_categorys_path %></li>
</ul>
<% end -%>
<%= flash_messages %>
<br />
<br />
<br />
<br />
<br />
<%= form_for :web_link, :action => 'search', :method => 'get', :url => panel_web_resource_back_end_web_links_path do |f| %>
<%#= f.select :web_link_category_id, @web_link_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ] },{ :include_blank => t('web_link.select') }%>
Category <%= select_tag "category_id", options_for_select(@web_link_categorys.collect{|t| [t.i18n_variable[I18n.locale], t.id]}), :prompt => t('web_link.select') %>
<%= submit_tag "OK", :name => nil %>
<% end %>
<br />
<br />
<h1><%= t('web_link.list_link') %></h1>
<table>
<table class="table main-list">
<thead>
<tr>
<th><%= t('web_link.status') %></th>
<th><%= t('web_link.category') %></th>
<th><%= t('web_link.name') %></th>
<th><%= t('web_link.tags') %></th>
<th><%= t('web_link.action') %></th>
<th class="span1-2"><%= t('web_link.status') %></th>
<th class="span1-2"><%= t('web_link.category') %></th>
<th class="span1-2"><%= t('web_link.name') %></th>
<th class="span1-2"><%= t('web_link.tags') %></th>
</tr>
</thead>
<tbody>
<% @web_links.each do |post| %>
<%= render :partial => 'web_links', :locals => {:post => post} %>
<% end %>
</table>
<br />
</tbody>
</table>