From 0a9ad1dfb635bf0c5d29819facecbbc40aaee9e7 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Fri, 13 Apr 2012 12:10:47 +0800 Subject: [PATCH 001/298] starting Resque --- Gemfile | 2 ++ Gemfile.lock | 18 ++++++++++++++ app/jobs/fetch_time.rb | 11 +++++++++ app/mailer/cron_mail.rb | 8 ++++++ config/environments/development.rb | 22 ++++++++--------- config/initializers/resque.rb | 15 ++++++++++++ config/resque.yml | 2 ++ config/resque_schedule.yml | 6 +++++ config/routes.rb | 1 + lib/tasks/anc_tasks.rake | 1 + lib/tasks/resque.rake | 39 ++++++++++++++++++++++++++++++ 11 files changed, 114 insertions(+), 11 deletions(-) create mode 100644 app/jobs/fetch_time.rb create mode 100644 app/mailer/cron_mail.rb create mode 100644 config/initializers/resque.rb create mode 100644 config/resque.yml create mode 100644 config/resque_schedule.yml create mode 100644 lib/tasks/resque.rake diff --git a/Gemfile b/Gemfile index d1afdb8c..a6b96ff2 100644 --- a/Gemfile +++ b/Gemfile @@ -19,6 +19,8 @@ gem "mongo_session_store-rails3" gem 'nokogiri' gem 'radius' gem 'rake' +gem 'resque-scheduler', :require => 'resque_scheduler' +gem 'resque', :require => "resque/server" gem 'ruby-debug19' gem 'rubyzip' gem 'sinatra' diff --git a/Gemfile.lock b/Gemfile.lock index 71742974..80ce363c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -153,6 +153,18 @@ GEM rake (0.9.2.2) rdoc (3.12) json (~> 1.4) + redis (2.2.2) + redis-namespace (1.0.3) + redis (< 3.0.0) + resque (1.20.0) + multi_json (~> 1.0) + redis-namespace (~> 1.0.2) + sinatra (>= 0.9.2) + vegas (~> 0.1.2) + resque-scheduler (1.9.9) + redis (>= 2.0.1) + resque (>= 1.8.0) + rufus-scheduler rspec (2.8.0) rspec-core (~> 2.8.0) rspec-expectations (~> 2.8.0) @@ -182,6 +194,8 @@ GEM ruby_parser (2.3.1) sexp_processor (~> 3.0) rubyzip (0.9.6.1) + rufus-scheduler (2.0.16) + tzinfo (>= 0.3.23) ruport (1.6.3) fastercsv pdf-writer (= 1.1.8) @@ -222,6 +236,8 @@ GEM uglifier (1.2.3) execjs (>= 0.3.0) multi_json (>= 1.0.2) + vegas (0.1.11) + rack (>= 1.0.0) warden (1.1.1) rack (>= 1.0) watchr (0.7) @@ -259,6 +275,8 @@ DEPENDENCIES radius rails (>= 3.1.0, < 3.2.0) rake + resque + resque-scheduler rspec (~> 2.0) rspec-rails (~> 2.0) ruby-debug19 diff --git a/app/jobs/fetch_time.rb b/app/jobs/fetch_time.rb new file mode 100644 index 00000000..70e58b2b --- /dev/null +++ b/app/jobs/fetch_time.rb @@ -0,0 +1,11 @@ +require 'open-uri' +require 'nokogiri' +module FetchTime + @queue = :fetch_time + + def self.perform() + sleep 10 + doc = Nokogiri::HTML(open('http://www.timeanddate.com/worldclock/city.html?n=241')) + CronMail.time_check(doc.at('#ct').children.first.text).deliver + end +end diff --git a/app/mailer/cron_mail.rb b/app/mailer/cron_mail.rb new file mode 100644 index 00000000..8a4c9700 --- /dev/null +++ b/app/mailer/cron_mail.rb @@ -0,0 +1,8 @@ +class CronMail < ActionMailer::Base + default :from => "orbit_test@rulingcom.com" + + def time_check(msg) + #attachments["rails.png"] = File.read("#{Rails.root}/public/images/rails.png") + mail(:to => "Matt ", :subject => msg) + end +end \ No newline at end of file diff --git a/config/environments/development.rb b/config/environments/development.rb index 1dbff032..20f4519b 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -29,16 +29,16 @@ Orbit::Application.configure do # :sender_address => %{"notifier" }, # :exception_recipients => %w{chris@rulingcom.com} - # config.action_mailer.delivery_method = :smtp - # config.action_mailer.smtp_settings = { - # :tls => true, - # :enable_starttls_auto => true, - # :address => "smtp.gmail.com", - # :port => '587', - # :domain => "smtp.gmail.com", - # :authentication => "plain", - # :user_name => "redmine@rulingcom.com", - # :password => "rulingredmine" } - + config.action_mailer.delivery_method = :smtp + config.action_mailer.smtp_settings = { + :tls => true, + :enable_starttls_auto => true, + :address => "smtp.gmail.com", + :port => '587', + :domain => "smtp.gmail.com", + :authentication => "plain", + :user_name => "redmine@rulingcom.com", + :password => "rulingredmine" } + end diff --git a/config/initializers/resque.rb b/config/initializers/resque.rb new file mode 100644 index 00000000..69eabc9c --- /dev/null +++ b/config/initializers/resque.rb @@ -0,0 +1,15 @@ +require 'resque_scheduler' +require 'resque_scheduler/server' +require 'yaml' + +rails_root = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/../..' +rails_env = ENV['RAILS_ENV'] || 'development' + +resque_config = YAML.load_file(rails_root + '/config/resque.yml') +Resque.redis = resque_config[rails_env] + +Resque.schedule = YAML.load_file("#{Rails.root}/config/resque_schedule.yml") +Dir["#{Rails.root}/app/jobs/*.rb"].each { |file| require file } + +# current_path = Rails.root.to_s.gsub(/\s/,'\ ') +# queues = [:test] diff --git a/config/resque.yml b/config/resque.yml new file mode 100644 index 00000000..f874633c --- /dev/null +++ b/config/resque.yml @@ -0,0 +1,2 @@ +development: localhost:6379 +production: localhost:6379 diff --git a/config/resque_schedule.yml b/config/resque_schedule.yml new file mode 100644 index 00000000..08b1b7ea --- /dev/null +++ b/config/resque_schedule.yml @@ -0,0 +1,6 @@ +time_to_talk_a_rest: + cron: "*/5 * * * *" + class: FetchTime + queue: daemons + rails_env: development + description: Send Email for Remind Time diff --git a/config/routes.rb b/config/routes.rb index 99860bb6..51044970 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -12,6 +12,7 @@ Orbit::Application.routes.draw do # routes for admin namespace :admin do + mount Resque::Server.new, :at => "/resque" resources :assets resources :app_auths resources :object_auths do diff --git a/lib/tasks/anc_tasks.rake b/lib/tasks/anc_tasks.rake index cd534b93..a97e1830 100644 --- a/lib/tasks/anc_tasks.rake +++ b/lib/tasks/anc_tasks.rake @@ -1,3 +1,4 @@ +require 'resque_scheduler/tasks' # encoding: utf-8 namespace :anc do diff --git a/lib/tasks/resque.rake b/lib/tasks/resque.rake new file mode 100644 index 00000000..66841c72 --- /dev/null +++ b/lib/tasks/resque.rake @@ -0,0 +1,39 @@ +# require "resque/tasks" +# require 'resque/scheduler' +# require 'resque/scheduler' + +# +# task "resque:setup" => :environment +# Resque tasks +require 'resque/tasks' +require 'resque_scheduler/tasks' + +namespace :resque do + task :setup => :environment do + require 'resque' + require 'resque_scheduler' + require 'resque/scheduler' + + # you probably already have this somewhere + Resque.redis = 'localhost:6379' + + # If you want to be able to dynamically change the schedule, + # uncomment this line. A dynamic schedule can be updated via the + # Resque::Scheduler.set_schedule (and remove_schedule) methods. + # When dynamic is set to true, the scheduler process looks for + # schedule changes and applies them on the fly. + # Note: This feature is only available in >=2.0.0. + #Resque::Scheduler.dynamic = true + + # The schedule doesn't need to be stored in a YAML, it just needs to + # be a hash. YAML is usually the easiest. + Resque.schedule = YAML.load_file('config/resque_schedule.yml') + + # If your schedule already has +queue+ set for each job, you don't + # need to require your jobs. This can be an advantage since it's + # less code that resque-scheduler needs to know about. But in a small + # project, it's usually easier to just include you job classes here. + # So, someting like this: + #require 'jobs' + end +end \ No newline at end of file From 0fe5baf93f449b55db16b827cb730f95d612c52d Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Fri, 13 Apr 2012 16:14:43 +0800 Subject: [PATCH 002/298] fix for letting ad_banner display even when file in not uploaded --- app/assets/stylesheets/widget.css | 2 +- app/views/admin/ad_banners/_ad_image_update.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/widget.css b/app/assets/stylesheets/widget.css index f1c4d615..7a658f36 100644 --- a/app/assets/stylesheets/widget.css +++ b/app/assets/stylesheets/widget.css @@ -58,7 +58,7 @@ cursor: pointer; } .select-role { - display:none; + display:none; padding: 10px 0; } .file-upload { diff --git a/app/views/admin/ad_banners/_ad_image_update.html.erb b/app/views/admin/ad_banners/_ad_image_update.html.erb index 366d370d..b87e5684 100644 --- a/app/views/admin/ad_banners/_ad_image_update.html.erb +++ b/app/views/admin/ad_banners/_ad_image_update.html.erb @@ -1,5 +1,5 @@
  • - <%= image_tag ad_image.file %> + <%= image_tag ad_image.file rescue nil%>

    <%= ad_image.display? ? '[Showing]' : '[NotShawing]' %> <%= "#{ad_image.post_date ||'NeedReset' }~#{ad_image.unpost_date || 'NeedReset'}" %> From 4af73ecf6fcee27a5b44a35d8829c5d862f62ce0 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Fri, 13 Apr 2012 16:46:16 +0800 Subject: [PATCH 003/298] fix preview window size. --- app/assets/stylesheets/admin/ad_banner_preview.css.erb | 4 ++++ app/views/admin/ad_banners/_preview_block.html.erb | 2 +- app/views/admin/ad_banners/index.html.erb | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 app/assets/stylesheets/admin/ad_banner_preview.css.erb diff --git a/app/assets/stylesheets/admin/ad_banner_preview.css.erb b/app/assets/stylesheets/admin/ad_banner_preview.css.erb new file mode 100644 index 00000000..f46be689 --- /dev/null +++ b/app/assets/stylesheets/admin/ad_banner_preview.css.erb @@ -0,0 +1,4 @@ +.banner-preview { + width: auto; + left: 35%; +} \ No newline at end of file diff --git a/app/views/admin/ad_banners/_preview_block.html.erb b/app/views/admin/ad_banners/_preview_block.html.erb index 4e8432b6..c2185d04 100644 --- a/app/views/admin/ad_banners/_preview_block.html.erb +++ b/app/views/admin/ad_banners/_preview_block.html.erb @@ -1,7 +1,7 @@ <% if ad_banner -%> <%= link_to 'Preview',"#slideshow-#{ad_banner.title.dehumanize}",:class=>"btn btn-primary btn-large",:data=>{:toggle=>'modal'} %> -

  • <%= image_tag ad_image.file rescue nil%>

    - <%= ad_image.display? ? '[Showing]' : '[NotShawing]' %> + <%= ad_image.display? ? "[#{t('admin.ad.showing')}]" : "[#{t('admin.ad.not_showing')}]" %> <%= "#{ad_image.post_date ||'NeedReset' }~#{ad_image.unpost_date || 'NeedReset'}" %>

    diff --git a/config/locales/en.yml b/config/locales/en.yml index d019de7e..f34557ca 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -48,6 +48,8 @@ en: banner_best_size: Banner Best Size new_banner: New banner new_image: New image + showing: Showing + not_showing: NotShowing title: Title transition_sec: Transition time trans_unit_sec: sec diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 708def10..2615c99c 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -45,6 +45,8 @@ zh_tw: banner_best_size: Banner 尺寸 new_banner: 新增輪播 new_image: 新增橫幅 + showing: 顯示中 + not_showing: 沒有顯示 title: 標題 transition_sec: 轉場單位時間 trans_unit_sec: 秒 From 170c12bcdd08601bb2fa4a6c86e69856b1e5313a Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Wed, 18 Apr 2012 16:24:17 +0800 Subject: [PATCH 012/298] fix js --- .../ad_banners/_modal_ad_banner_form.html.erb | 14 ++++++-------- app/views/admin/ad_banners/index.html.erb | 2 +- app/views/admin/ad_banners/new_created_node.js.erb | 1 + 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb b/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb index 36ebc4a3..235e7e15 100644 --- a/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb +++ b/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb @@ -36,17 +36,15 @@ <% end %> diff --git a/app/views/admin/ad_banners/index.html.erb b/app/views/admin/ad_banners/index.html.erb index 4b7dfef2..8307885a 100644 --- a/app/views/admin/ad_banners/index.html.erb +++ b/app/views/admin/ad_banners/index.html.erb @@ -12,7 +12,7 @@ <% @ad_banners.each do |ab| %> <%= content_tag :li,link_to(ab.title,"##{ab.title}",:data=>{:toggle=>"tab"}),:class => (ab == @active ? 'active' : nil ) %> <% end -%> - <%= content_tag :li,link_to('New',"#new-a-banner",:data=>{:toggle=>"tab"}),:id=>'new_ad_banner_tab_but',:class => (@active.nil? ? 'active' : nil ) %> + <%= content_tag :li,link_to(t("admin.ad.new_banner"),"#new-a-banner",:data=>{:toggle=>"tab"}),:id=>'new_ad_banner_tab_but',:class => (@active.nil? ? 'active' : nil ) %> diff --git a/app/views/admin/ad_banners/new_created_node.js.erb b/app/views/admin/ad_banners/new_created_node.js.erb index 140be0b4..86970e6a 100644 --- a/app/views/admin/ad_banners/new_created_node.js.erb +++ b/app/views/admin/ad_banners/new_created_node.js.erb @@ -2,6 +2,7 @@ $('<%= escape_javascript(content_tag(:li,link_to(@ad_banner.title,"##{@ad_banner $('<%= escape_javascript(render(:partial => "ad_banner_tab",:locals => {:ad_banner_tab => @ad_banner})) %>').insertBefore($("#new-a-banner")); $('.modal').modal('hide'); +$('#new-a-banner').unbind(); $('#post-body-content').find(".nav.nav-tabs").children('li.active').removeClass("active"); $('#post-body-content').find(".nav.nav-tabs").children('li[id!="new_ad_banner_tab_but"]').last().addClass("active"); From 72efdbd742d4f3ac8a910bd5c817cf5c74570ba5 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Thu, 19 Apr 2012 11:50:54 +0800 Subject: [PATCH 013/298] changes before Chirs and Ray's trip --- Gemfile.lock | 4 + app/assets/javascripts/site_editor.js | 3 +- app/assets/stylesheets/list.css | 300 +++++++++--------- app/assets/stylesheets/new_admin.css.erb | 2 +- app/assets/stylesheets/sidebar.css.erb | 56 +++- app/assets/stylesheets/site_items.css.erb | 4 +- app/assets/stylesheets/style.css.erb | 24 ++ app/assets/stylesheets/widgets.css | 148 +++++++++ app/helpers/admin/item_helper.rb | 14 +- app/views/admin/ad_images/_form.html.erb | 16 +- .../admin/items/_site_map_left_bar.html.erb | 2 +- app/views/layouts/admin.html.erb | 74 ++--- app/views/layouts/site_editor.html.erb | 77 ++--- 13 files changed, 473 insertions(+), 251 deletions(-) create mode 100644 app/assets/stylesheets/widgets.css diff --git a/Gemfile.lock b/Gemfile.lock index 71742974..52453b6a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -97,6 +97,7 @@ GEM 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.3) @@ -209,6 +210,8 @@ GEM rack (~> 1.0) tilt (~> 1.1, != 1.3.0) subexec (0.2.1) + therubyracer (0.9.10) + libv8 (~> 3.3.10) thor (0.14.6) tilt (1.3.3) tinymce-rails (3.4.8) @@ -269,6 +272,7 @@ DEPENDENCIES sinatra spork sprockets + therubyracer tinymce-rails uglifier watchr diff --git a/app/assets/javascripts/site_editor.js b/app/assets/javascripts/site_editor.js index 98405564..1eb5e3f1 100644 --- a/app/assets/javascripts/site_editor.js +++ b/app/assets/javascripts/site_editor.js @@ -7,4 +7,5 @@ //= require jquery //= require jquery_ujs //= require page_edit -//= require side_bar_history \ No newline at end of file +//= require side_bar_history +//= require new_admin \ No newline at end of file diff --git a/app/assets/stylesheets/list.css b/app/assets/stylesheets/list.css index 11f17a55..c7785778 100644 --- a/app/assets/stylesheets/list.css +++ b/app/assets/stylesheets/list.css @@ -1,151 +1,151 @@ -.list-remove { - position: relative; - top: 2px; - left: 2px; -} -.table th.select { - border-bottom:2px solid #0088CC; -} -.main-list { - margin-bottom: 0; -} -.main-wrap>.main-list thead th { - background-color: transparent; - border-right: medium none; -} -.main-list thead th:last-child { - border-right: none; -} -.main-list .span1 { - min-width: 32px; -} -.main-list .span7 { - min-width: 300px; -} -.main-list .nav-pills > li > a { - border-radius: 5px 5px 5px 5px; - margin: 2px; - padding:5px -} -.main-list tbody .quick-edit { - position:relative; - height:20px; -} -.main-list tbody .quick-edit .nav { - /*left: -55px;*/ - position: absolute; - /*top: -3px;*/ - width: 350px; - left: -8px; -} -.main-list td { - background-color: #FFFFFF; - border-bottom: 1px solid #DDDDDD; - border-top: medium none; -} -.main-list .nav { - margin-top: 0; - margin-bottom: 3px; -} -.main-list tr.with_action:hover .hide { - display:block !important; -} -.main-list .label-group { - position: relative; - height: 40px; -} -.main-list .label-td { - background-color: rgba(255, 255, 255, 1); - height: 40px; - overflow: hidden; - position: absolute; - width: 100%; - left: 0; - z-index: 1; -} -.main-list .label-td:hover { - height: auto; - text-align: center; - padding: 5px 5px 8px; - left: -6px; - top: -6px; - border: 1px solid rgba(0, 0, 0, 0.2); - box-shadow: 0px 5px 10px rgba(0,0,0,0.2); - -moz-box-shadow: 0px 5px 10px rgba(0,0,0,0.2); - -webkit-box-shadow: 0px 5px 10px rgba(0,0,0,0.2); - border-radius: 3px; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - z-index: 5; -} -.table-label { - background-color: #F2F2F2; - position: relative; -} -.table-label .main-list thead th { - background-color: #F2F2F2; - border-right: 1px solid #DDDDDD; - border-top: 1px solid #DDDDDD !important; -} -.route-group .route { - padding: 0; -} -.route-group .route .breadcrumb { - border-width: 0!important; -} -.qe-block td { - height:auto; - padding: 0; -} -.qe-block .table td, .qe-block .table th { - padding: 8px; -} -.qe-block .form-horizontal { - margin-bottom: 0; -} -.qe-block .form-actions { - margin-bottom: 0; -} -legend { - font-size: 15px; - line-height: 30px; - margin-bottom: 15px; - padding-bottom: 5px; -} -.upload-picture { - margin-left: 20px; -} -.subnav { - -moz-border-radius: 0; - -webkit-border-radius: 0; - border-radius: 0; - border-left: none; - border-right: none; - position: fixed; - top: 30px; - z-index: 50; -} -.subnav .nav > li:first-child > a, .subnav .nav > li:first-child > a:hover { - -moz-border-radius: 0; - -webkit-border-radius: 0; - border-radius: 0; -} -.dropdown-menu.tags { - max-width: none; -} -.dropdown-menu.tags .tags-cloud { - width: 300px; - padding:10px; -} -.dropdown-menu.tags .tags-cloud .active { - background-color: #0088CC; - color: #FFFFFF; -} -.dropdown-menu.tags .tags-cloud a { - display: inline-block; - margin-bottom: 3px; -} -.dropdown-menu.tags li:last-child a { - display: block; - text-align:center; +.list-remove { + position: relative; + top: 2px; + left: 2px; +} +.table th.select { + border-bottom:2px solid #0088CC; +} +.main-list { + margin-bottom: 0; +} +.main-wrap>.main-list thead th { + background-color: transparent; + border-right: medium none; +} +.main-list thead th:last-child { + border-right: none; +} +.main-list .span1 { + min-width: 32px; +} +.main-list .span7 { + min-width: 300px; +} +.main-list .nav-pills > li > a { + border-radius: 5px 5px 5px 5px; + margin: 2px; + padding:5px +} +.main-list tbody .quick-edit { + position:relative; + height:20px; +} +.main-list tbody .quick-edit .nav { + /*left: -55px;*/ + position: absolute; + /*top: -3px;*/ + width: 350px; + left: -8px; +} +.main-list td { + background-color: #FFFFFF; + border-bottom: 1px solid #DDDDDD; + border-top: medium none; +} +.main-list .nav { + margin-top: 0; + margin-bottom: 3px; +} +.main-list tr.with_action:hover .hide { + display:block !important; +} +.main-list .label-group { + position: relative; + height: 40px; +} +.main-list .label-td { + background-color: rgba(255, 255, 255, 1); + height: 40px; + overflow: hidden; + position: absolute; + width: 100%; + left: 0; + z-index: 1; +} +.main-list .label-td:hover { + height: auto; + text-align: center; + padding: 5px 5px 8px; + left: -6px; + top: -6px; + border: 1px solid rgba(0, 0, 0, 0.2); + box-shadow: 0px 5px 10px rgba(0,0,0,0.2); + -moz-box-shadow: 0px 5px 10px rgba(0,0,0,0.2); + -webkit-box-shadow: 0px 5px 10px rgba(0,0,0,0.2); + border-radius: 3px; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + z-index: 5; +} +.table-label { + background-color: #F2F2F2; + position: relative; +} +.table-label .main-list thead th { + background-color: #F2F2F2; + border-right: 1px solid #DDDDDD; + border-top: 1px solid #DDDDDD !important; +} +.route-group .route { + padding: 0; +} +.route-group .route .breadcrumb { + border-width: 0!important; +} +.qe-block td { + height:auto; + padding: 0; +} +.qe-block .table td, .qe-block .table th { + padding: 8px; +} +.qe-block .form-horizontal { + margin-bottom: 0; +} +.qe-block .form-actions { + margin-bottom: 0; +} +legend { + font-size: 15px; + line-height: 30px; + margin-bottom: 15px; + padding-bottom: 5px; +} +.upload-picture { + margin-left: 20px; +} +.subnav { + -moz-border-radius: 0; + -webkit-border-radius: 0; + border-radius: 0; + border-left: none; + border-right: none; + position: fixed; + top: 30px; + z-index: 50; +} +.subnav .nav > li:first-child > a, .subnav .nav > li:first-child > a:hover { + -moz-border-radius: 0; + -webkit-border-radius: 0; + border-radius: 0; +} +.dropdown-menu.tags { + max-width: none; +} +.dropdown-menu.tags .tags-cloud { + width: 300px; + padding:10px; +} +.dropdown-menu.tags .tags-cloud .active { + background-color: #0088CC; + color: #FFFFFF; +} +.dropdown-menu.tags .tags-cloud a { + display: inline-block; + margin-bottom: 3px; +} +.dropdown-menu.tags li:last-child a { + display: block; + text-align:center; } \ No newline at end of file diff --git a/app/assets/stylesheets/new_admin.css.erb b/app/assets/stylesheets/new_admin.css.erb index d81761bc..9d687eb6 100644 --- a/app/assets/stylesheets/new_admin.css.erb +++ b/app/assets/stylesheets/new_admin.css.erb @@ -8,7 +8,7 @@ *= require bootstrap *= require bootstrap-orbit *= require list - *= require widget + *= require widgets *= require style *= require scroll_style *= require isotope diff --git a/app/assets/stylesheets/sidebar.css.erb b/app/assets/stylesheets/sidebar.css.erb index f5a5d572..79022cac 100644 --- a/app/assets/stylesheets/sidebar.css.erb +++ b/app/assets/stylesheets/sidebar.css.erb @@ -1,13 +1,9 @@ #back_sidebar { - background: url(<%= asset_path "75.png" %>) repeat scroll left top transparent; - box-shadow: 3px 0 4px #472A12; - border-right: 1px solid #121212; - height: 100%; left: 0; position: fixed; top: 0; - width: 220px; + width: 160px; } #back_sidebar h1 { @@ -91,4 +87,54 @@ } #sidebar .translations_setup { margin-top: 42px; +} + + +#main-sidebar{ + left:0; +} +#main-sidebar .list{ +} +#main-sidebar li{ + position:relative; +} +#main-sidebar li a{ + border-bottom: 1px solid #CCCCCC; + display: block; + padding: 10px 0 10px 10px; +} +#main-sidebar ul ul li a{ + padding: 10px 0 10px 20px; +} +#main-sidebar li:hover .quick-edit{ + display:block; +} +#main-sidebar .quick-edit{ + background: none repeat scroll 0 0 #FFFFFF; + border: 1px solid #DDDDDD; + border-radius: 5px 5px 5px 5px; + display: none; + margin:-3px 0 0 3px; + padding: 3px; + z-index:1; +} +#main-sidebar .quick-edit:after{ + content: "."; + display: block; + height: 0; + clear: both; + visibility: hidden; +} +#main-sidebar .quick-edit a{ + border-bottom: medium none; + border-radius: 5px 5px 5px 5px; + font-size:12px; + float: left; + margin: 0 3px 0 0; + padding: 3px; +} + +#main-sidebar .quick-edit a:hover{ + background: none repeat scroll 0 0 #EEEEEE; + border-bottom:none; } \ No newline at end of file diff --git a/app/assets/stylesheets/site_items.css.erb b/app/assets/stylesheets/site_items.css.erb index 4e23bd4c..922bfe56 100644 --- a/app/assets/stylesheets/site_items.css.erb +++ b/app/assets/stylesheets/site_items.css.erb @@ -4,7 +4,7 @@ html, body{ padding: 0; } html{ - background: url(<%= asset_path "body.jpg" %>) no-repeat fixed 0 0 transparent; + background-size: cover; } @@ -172,8 +172,6 @@ body{ .main { background: none repeat scroll 0 0 #FFFFFF; height: 100%; - margin-left: 220px; - padding: 0 40px; position: relative; } .main_list { diff --git a/app/assets/stylesheets/style.css.erb b/app/assets/stylesheets/style.css.erb index d2e33b04..39beaec9 100644 --- a/app/assets/stylesheets/style.css.erb +++ b/app/assets/stylesheets/style.css.erb @@ -261,6 +261,10 @@ box-shadow: 0px 2px 1px rgba(0,0,0,0.1); -moz-box-shadow: 0px 2px 1px rgba(0,0,0,0.1); -webkit-box-shadow: 0px 2px 1px rgba(0,0,0,0.1); + display: none; +} +#main-sidebar .nav > li.active > .nav { + display: block; } #main-sidebar .nav > li > .nav > li > a { margin-left: 0; @@ -433,6 +437,26 @@ .filters .in { /*border-bottom: 1px solid rgba(0,0,0,0.07)*/ } +#tags { +} +#tags .tag { + line-height: 32px; + padding: 0 10px; + background-color: #FFFFFF; + border-bottom: 1px solid #DDDDDD; + border-top: medium none; +} +#tags .tag form, #tags .tag form input { + margin:0; +} +#tags .tagitem { + display: inline-block; + float: left; +} +#tags .action { + display: inline-block; + float: right; +} .sign-in { width: 360px; margin: 0 auto 70px; diff --git a/app/assets/stylesheets/widgets.css b/app/assets/stylesheets/widgets.css new file mode 100644 index 00000000..7a658f36 --- /dev/null +++ b/app/assets/stylesheets/widgets.css @@ -0,0 +1,148 @@ +.widget-size-300 { + width:298px; +} +.widget-box { + background-color: #FFF; + overflow: hidden; + min-width: 300px; + margin: 0 0 5px 5px; + position:relative; +} +.widget-box .widget-title { + color: #FFF; + padding-left: 5px; + border-radius: 5px 5px 0 0; + -moz-border-radius: 5px 5px 0 0; + -webkit-border-radius: 5px 5px 0 0; + background-image: -moz-linear-gradient(top, #B7B7B7, #9d9d9d); + background-image: -ms-linear-gradient(top, #B7B7B7, #9d9d9d); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#B7B7B7), to(#9d9d9d)); + background-image: -webkit-linear-gradient(top, #B7B7B7, #9d9d9d); + background-image: -o-linear-gradient(top, #B7B7B7, #9d9d9d); + background-image: linear-gradient(top, #B7B7B7, #9d9d9d); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#B7B7B7', endColorstr='#9d9d9d', GradientType=0); +} +.widget-box .widget-title [class^="icons-"] { + margin: 3px 5px 0 2px; +} +.widget-box .widget-content { + padding: 10px; + border-width: 0 1px 1px; + border-style: solid; + border-color: #CCCCCC; + border-radius: 0 0 5px 5px; + -moz-border-radius: 0 0 5px 5px; + -webkit-border-radius: 0 0 5px 5px; +} +.widget-box .form-horizontal .control-group > label { + width: 50px; +} +.widget-box .form-horizontal .controls { + margin-left: 60px; +} +.widget-action { + position:absolute; + right:1px; + top:6px; +} +.action { + float: left; + display:inline-block; + margin-right: 5px; + opacity: 0.8; + filter: alpha(opacity=80); +} +.action:hover { + opacity: 1; + filter: alpha(opacity=100); + cursor: pointer; +} +.select-role { + display:none; + padding: 10px 0; +} +.file-upload { + position:relative; + overflow: hidden; +} +.file-upload .file-name { + white-space: nowrap; + overflow: hidden; + border-style: solid; + border-width: 1px 1px 1px 0; + border-color: #CCC; + display: inline-block; + float: left; + padding: 4px 10px; + height: 18px; + line-height: 18px; + -webkit-border-radius: 0 3px 3px 0; + -moz-border-radius: 0 3px 3px 0; + border-radius: 0 3px 3px 0; + text-align: left; + margin: 0; + width: 182px; +} +.file-upload .upload { + margin:0; + padding:0; + position:absolute; + top: 0; + left:0; + opacity:.0; + font-size: 60px; + left: -595px/9; + filter: alpha(opacity: 0); + outline: none; +} +.file-upload .upload:focus { + position:absolute; +} +.upload-picture { + margin-bottom: 5px; + text-align: center; + width: 276px; + overflow: hidden; + height: 90px; +} +.upload-picture img { + left: 0; + margin-top: -15%; + width: 100%; +} +.widget-box .widgetInfo { + display: inline-block; + text-align: center; + width: 255px; + margin : 0px 0 5px; + padding: 5px 10px; +} +.file-upload .input-medium { + border-radius: 3px 3px 3px 3px !important; + width: 267px; + position: relative; + z-index: 5; +} +#widget-link table { + margin-bottom:0 +} +/*Date*/ +.showDate { + border-style: solid; + border-width: 1px 0 1px 1px; + border-color: #CCC; + display: inline-block; + float: left; + padding: 4px 10px; + height: 18px; + line-height: 18px; + -webkit-border-radius: 3px 0 0 3px; + -moz-border-radius: 3px 0 0 3px; + border-radius: 3px 0 0 3px; + text-align: center; +} +.calendarInput { + position: absolute; + visibility: hidden; + left: 11px; +} \ No newline at end of file diff --git a/app/helpers/admin/item_helper.rb b/app/helpers/admin/item_helper.rb index d7a3455b..c9715a71 100644 --- a/app/helpers/admin/item_helper.rb +++ b/app/helpers/admin/item_helper.rb @@ -12,12 +12,14 @@ module Admin::ItemHelper ret << "

      " ret << "
    • " ret << (link_to node.i18n_variable[I18n.locale], dest) - ret << ' | ' << (link_to t('admin.edit'), eval("edit_admin_#{node._type.downcase}_path(node)")) if node._type.eql?('Page') - ret << ' | ' << (link_to t('admin.new_page'), new_admin_page_path(:parent_id => node.id), :class => 'new_page') if node._type.eql?('Page') - ret << ' | ' << (link_to t('admin.new_link'), new_admin_link_path(:parent_id => node.id), :class => 'new_link') if node._type.eql?('Page') - ret << ' | ' << (link_to t(:delete), eval("delete_admin_#{node._type.downcase}_path(node, :authenticity_token => form_authenticity_token)"), :confirm => t('sure?'), :class => 'delete') - ret << render_children(node) + ret << "
      " + ret << (link_to t('admin.edit'), eval("edit_admin_#{node._type.downcase}_path(node)")) if node._type.eql?('Page') + ret << (link_to t('admin.new_page'), new_admin_page_path(:parent_id => node.id), :class => 'new_page') if node._type.eql?('Page') + ret << (link_to t('admin.new_link'), new_admin_link_path(:parent_id => node.id), :class => 'new_link') if node._type.eql?('Page') + ret << (link_to t(:delete), eval("delete_admin_#{node._type.downcase}_path(node, :authenticity_token => form_authenticity_token)"), :confirm => t('sure?'), :class => 'delete') + ret << "
      " ret << "
    • " + ret << render_children(node) ret << "
    " end ret.html_safe @@ -26,11 +28,9 @@ module Admin::ItemHelper def render_children(parent) if children = parent.children ret = '' - ret << "
      " children.each do |child| ret << render_node_and_children(child) end - ret << "
    " ret end end diff --git a/app/views/admin/ad_images/_form.html.erb b/app/views/admin/ad_images/_form.html.erb index 1089db3b..8e7f18df 100644 --- a/app/views/admin/ad_images/_form.html.erb +++ b/app/views/admin/ad_images/_form.html.erb @@ -161,13 +161,13 @@ <%= content_tag :div,:class => "tab-pane #{active_when_default_locale_eq locale}",:id=>"#{locale}" do%>
    <%= f.fields_for :title,@ad_image.title do |f| %> - <%= f.text_field locale,:class=>"ad_image-title",:placeholder => "輸入標題"%> + <%= f.text_field locale,:class=>"ad_image-title post-title",:placeholder => "輸入標題"%> <% end %>
    - +
    <%= f.fields_for :context, @ad_image.context do |f| %> - <%= f.text_area locale,:style => "width:100%", :class => "asd_tinymce_textarea" %> + <%= f.text_area locale,:style => "width:100%", :class => "asd_tinymce_textarea post-title" %> <% end %>
    @@ -177,12 +177,12 @@ +
    + + + +
    -
    - - - -
    \ No newline at end of file diff --git a/app/views/admin/items/_site_map_left_bar.html.erb b/app/views/admin/items/_site_map_left_bar.html.erb index 8dbcb722..b2a48a19 100644 --- a/app/views/admin/items/_site_map_left_bar.html.erb +++ b/app/views/admin/items/_site_map_left_bar.html.erb @@ -1,3 +1,3 @@ -
    +
    <%= render_node_and_children(Item.first(:conditions => {:parent_id => nil})) %>
    \ No newline at end of file diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index 4adce7a5..3c2df376 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb @@ -1,37 +1,37 @@ - - - - - <%= @title || APP_CONFIG['orbit'] %> - - - <%= stylesheet_link_tag "admin" %> - <%= javascript_include_tag "admin" %> - <%= yield :page_specific_css %> - <%= yield :page_specific_javascript %> - <%= csrf_meta_tag %> - - - - -
    -
    <%= yield :secondary %>
    -
    - <%= yield %> -
    -
    <%= yield :tertiary %>
    - -
    - - + + + + + <%= @title || APP_CONFIG['orbit'] %> + + + <%= stylesheet_link_tag "admin" %> + <%= javascript_include_tag "admin" %> + <%= yield :page_specific_css %> + <%= yield :page_specific_javascript %> + <%= csrf_meta_tag %> + + + + +
    +
    <%= yield :secondary %>
    +
    + <%= yield %> +
    +
    <%= yield :tertiary %>
    + +
    + + diff --git a/app/views/layouts/site_editor.html.erb b/app/views/layouts/site_editor.html.erb index efcc54ca..e5ed9bb9 100644 --- a/app/views/layouts/site_editor.html.erb +++ b/app/views/layouts/site_editor.html.erb @@ -1,38 +1,39 @@ - - - - - <%= @title || APP_CONFIG['orbit'] %> - - - <%= stylesheet_link_tag "site_editor" %> - <%= javascript_include_tag "site_editor" %> - <%= yield :page_specific_css %> - <%= yield :page_specific_javascript %> - <%= csrf_meta_tag %> - - - - -
    -
    <%= yield :sidebar %>
    -
    - <%= yield %> -
    -
    <%= yield :tertiary %>
    - -
    - - - + + + + + <%= @title || APP_CONFIG['orbit'] %> + + + <%= stylesheet_link_tag "site_editor" %> + <%= javascript_include_tag "site_editor" %> + <%= yield :page_specific_css %> + <%= yield :page_specific_javascript %> + <%= csrf_meta_tag %> + + + +
    +
    <%= yield :sidebar %>
    +
    + <%= yield %> +
    +
    <%= yield :tertiary %>
    + +
    + + + From 2f279c53ff777991802235e525e2d7077f4ffb35 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Thu, 19 Apr 2012 11:50:54 +0800 Subject: [PATCH 014/298] Apply patch from ldap --- app/assets/javascripts/inc/search.js | 39 +++++++++++++++------------- app/views/layouts/_side_bar.html.erb | 16 ++++++------ 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/app/assets/javascripts/inc/search.js b/app/assets/javascripts/inc/search.js index 979b5621..70507fc6 100644 --- a/app/assets/javascripts/inc/search.js +++ b/app/assets/javascripts/inc/search.js @@ -8,24 +8,27 @@ $.extend($.expr[':'], { return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0; } }); +var interval,sval; $(document).ready(function(){ $("#user_filter").keyup(function(){ - if($(this).val()){ - var totalfoundbyname = $("div#users_checkbox_ary label.member-name:containsi("+$(this).val()+")").length - if(totalfoundbyname!=0){ - $("div#users_checkbox_ary label.member-name:not(:containsi("+$(this).val()+"))").parent().parent().slideUp(); - //$("div#users_checkbox_ary label.member-name:not(:containsi("+$(this).val()+"))").parent().popover('hide'); - $("div#users_checkbox_ary label.member-name:containsi("+$(this).val()+")").parent().parent().slideDown(); - $("div#users_checkbox_ary label.member-name:containsi("+$(this).val()+")").parent().popover('toggle'); - }else if(totalfoundbyname==0){ - $("div#users_checkbox_ary div.for_unit:not(:containsi("+$(this).val()+"))").parent().slideUp(); - //$("div#users_checkbox_ary div.for_unit:not(:containsi("+$(this).val()+"))").popover('hide'); - $("div#users_checkbox_ary div.for_unit:containsi("+$(this).val()+")").parent().slideDown(); - $("div#users_checkbox_ary div.for_unit:containsi("+$(this).val()+")").popover('toggle'); - } - }else{ - $(".checkbox").popover('hide'); - $("div.checkblock").slideDown(); - } + sval = $(this).val(); + $(".checkbox").popover("hide"); + $("div.checkblock").hide(); + clearInterval(interval); + interval = setInterval(waitForSearch,1000); }) -}) \ No newline at end of file +}) +var waitForSearch = function(){ + if(sval){ + var totalfoundbyname = $("div#users_checkbox_ary label.member-name:containsi("+sval+")").length + if(totalfoundbyname!=0){ + $("div#users_checkbox_ary label.member-name:containsi("+sval+")").parent().parent().show(); + }else if(totalfoundbyname==0){ + $("div#users_checkbox_ary div.for_unit:containsi("+sval+")").parent().show(); + } + }else{ + $(".checkbox").popover('hide'); + $("div.checkblock").show(); + } + clearInterval(interval); +} \ No newline at end of file diff --git a/app/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb index f74f24f6..38380984 100644 --- a/app/views/layouts/_side_bar.html.erb +++ b/app/views/layouts/_side_bar.html.erb @@ -5,10 +5,10 @@ <%= content_tag :li, :class => active_for_controllers('bulletins', 'tags', 'bulletin_categorys', 'fact_checks') do -%> <%= link_to content_tag(:i, nil, :class => 'icons-announcement') + t('admin.announcement'), panel_announcement_back_end_bulletins_path %> <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('bulletins', 'tags', 'bulletin_categorys', 'fact_checks')) do -%> - <%= content_tag :li, link_to(t('admin.all_articles'), panel_announcement_back_end_bulletins_path), :class => active_for_action('bulletins', 'index') %> - <%= 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('panel/bulletin/back_end/tags', 'index') %> + <%= content_tag :li, link_to(t('announcement.all_articles'), panel_announcement_back_end_bulletins_path), :class => active_for_action('bulletins', 'index') %> + <%= content_tag :li, link_to(t('announcement.add_new'), new_panel_announcement_back_end_bulletin_path), :class => active_for_action('bulletins', 'new') %> + <%= content_tag :li, link_to(t('announcement.categories'), panel_announcement_back_end_bulletin_categorys_path), :class => active_for_action('bulletin_categorys', 'index') %> + <%= content_tag :li, link_to(t('announcement.tags'), panel_announcement_back_end_tags_path), :class => active_for_action('panel/bulletin/back_end/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('fact_checks', 'setting') if (is_manager? rescue nil) %> <% end -%> @@ -41,10 +41,10 @@ <%= 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('panel/web_resource/back_end/tags', 'index') %> + <%= content_tag :li, link_to(t('admin.announcement.all_articles'), panel_web_resource_back_end_web_links_path), :class => active_for_action('web_link', 'index') %> + <%= content_tag :li, link_to(t('admin.announcement.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.announcement.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.announcement.tags'), panel_web_resource_back_end_tags_path), :class => active_for_action('panel/web_resource/back_end/tags', 'index') %> <% end -%> <% end -%> From ff472714dec8cbf0e27593415e328361e51c323c Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Fri, 13 Apr 2012 17:24:30 +0800 Subject: [PATCH 015/298] AdBanner i18n vars patch --- app/controllers/admin/ad_banners_controller.rb | 6 ++++-- app/views/admin/ad_banners/_ad_banner_tab.html.erb | 6 +++--- config/locales/en.yml | 10 ++++++++++ config/locales/zh_tw.yml | 2 ++ config/routes.rb | 1 + 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/app/controllers/admin/ad_banners_controller.rb b/app/controllers/admin/ad_banners_controller.rb index 95ce7e7c..a6f4fd5f 100644 --- a/app/controllers/admin/ad_banners_controller.rb +++ b/app/controllers/admin/ad_banners_controller.rb @@ -39,8 +39,10 @@ class Admin::AdBannersController < ApplicationController redirect_to admin_ad_banners_url end - def destroy_ad_image - + def realtime_preview + @ad_banner = AdBanner.find(params[:id]) + @ad_banner.update_attributes(params[:ad_banner]) + render end def index diff --git a/app/views/admin/ad_banners/_ad_banner_tab.html.erb b/app/views/admin/ad_banners/_ad_banner_tab.html.erb index d9b1b902..10a98b52 100644 --- a/app/views/admin/ad_banners/_ad_banner_tab.html.erb +++ b/app/views/admin/ad_banners/_ad_banner_tab.html.erb @@ -1,14 +1,14 @@
    " id=<%= ad_banner_tab.title %>> -

    尺寸:

    +

    <%= t("admin.ad.banner_best_size") %>:

    <%= form_for ad_banner_tab,:url=> admin_ad_banner_path(ad_banner_tab),:method => :put,:class=>"input-medium" do |f| -%> <%= f.label :ad_fx, t('admin.ad.ab_fx') %> <%= f.select :ad_fx ,AdBanner::FX_TYPES %> <%= f.label :transition_sec, t('admin.ad.transition_sec') %> <%= f.text_field :transition_sec,:placeholder=>"3秒請輸入3000",:class=> "span3" %> <%= t("admin.ad.trans_unit_sec") %> - <%= f.submit %> - <%= f.submit 'Cancel',:type=>'reset' %> + <%= f.submit t("admin.ad.update_banner") %> + <%= f.submit t("cancel"),:type=>'reset' %>
    <%= render :partial => "ad_image_update", :collection => ad_banner_tab.ad_images,:as => :ad_image,:locals=>{:ad_banner => ad_banner_tab} %> <%#= render :partial => 'new_add_banner_file', :object => ad_banner_tab.ad_images.build, :locals => { :field_name => "new_ad_images[]", :f => f, :classes => "r_destroy" } %> diff --git a/config/locales/en.yml b/config/locales/en.yml index da72a4eb..9b586148 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -42,6 +42,16 @@ en: admin: action: Action ad_banner: AD Banner + ad: + ab_fx: FX + all_banners: AdBanner list + banner_best_size: Banner Best Size + new_banner: New banner + new_image: New image + title: Title + transition_sec: Transition time + trans_unit_sec: sec + update_banner: Update Banner add: Add add_item: Add item add_language: Add language diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 491d80e8..ebc6e6b3 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -42,11 +42,13 @@ zh_tw: ad: ab_fx: 轉場特效 all_banners: 輪播清單 + banner_best_size: Banner 尺寸 new_banner: 新增輪播 new_image: 新增橫幅 title: 標題 transition_sec: 轉場單位時間 trans_unit_sec: 秒 + update_banner: 更新輪播 add: 新增 add_item: 新增項目 add_language: 新增語言 diff --git a/config/routes.rb b/config/routes.rb index 99860bb6..cdf3a7f0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -26,6 +26,7 @@ Orbit::Application.routes.draw do resources :ad_banners do + match 'preview/:id' => 'ad_banners#realtime_preview',:as => :realtime_preview,:via => :put collection do match 'new_ad_image' => 'ad_images#new',:as => :new_ad_image,:via => :get match 'new_ad_image' => 'ad_images#create',:as => :create_ad_image,:via => :post From 30edc317b2f917dbd4f11f25d8dab954d7455f0c Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Fri, 13 Apr 2012 17:51:19 +0800 Subject: [PATCH 016/298] text area for ad_image --- app/views/admin/ad_images/_form.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/ad_images/_form.html.erb b/app/views/admin/ad_images/_form.html.erb index 8e7f18df..03b11b18 100644 --- a/app/views/admin/ad_images/_form.html.erb +++ b/app/views/admin/ad_images/_form.html.erb @@ -167,7 +167,7 @@
    <%= f.fields_for :context, @ad_image.context do |f| %> - <%= f.text_area locale,:style => "width:100%", :class => "asd_tinymce_textarea post-title" %> + <%= f.text_area locale,:style => "width:100%", :class => "tinymce_textarea post-title" %> <% end %>
    From 8cc0611c4a64a6dbae00251bbaca5f3c417699c9 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Fri, 13 Apr 2012 18:02:36 +0800 Subject: [PATCH 017/298] Ray's fix for ad_banner --- app/assets/stylesheets/widget.css | 68 ++++++++++++++++--------------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/app/assets/stylesheets/widget.css b/app/assets/stylesheets/widget.css index 7a658f36..81862e25 100644 --- a/app/assets/stylesheets/widget.css +++ b/app/assets/stylesheets/widget.css @@ -66,22 +66,20 @@ overflow: hidden; } .file-upload .file-name { - white-space: nowrap; - overflow: hidden; - border-style: solid; - border-width: 1px 1px 1px 0; - border-color: #CCC; - display: inline-block; - float: left; - padding: 4px 10px; - height: 18px; - line-height: 18px; - -webkit-border-radius: 0 3px 3px 0; - -moz-border-radius: 0 3px 3px 0; - border-radius: 0 3px 3px 0; - text-align: left; - margin: 0; - width: 182px; + border-color: #CCCCCC; + border-radius: 0 3px 3px 0; + border-style: solid; + border-width: 1px 1px 1px 0; + display: inline-block; + float: left; + height: 18px; + line-height: 18px; + margin: 0; + overflow: hidden; + padding: 4px 10px; + text-align: left; + white-space: nowrap; + width: 182px; } .file-upload .upload { margin:0; @@ -111,11 +109,11 @@ width: 100%; } .widget-box .widgetInfo { - display: inline-block; - text-align: center; - width: 255px; - margin : 0px 0 5px; - padding: 5px 10px; + display: inline-block; + margin: 0 0 5px; + padding: 5px 10px; + text-align: center; + width: 255px; } .file-upload .input-medium { border-radius: 3px 3px 3px 3px !important; @@ -128,21 +126,25 @@ } /*Date*/ .showDate { - border-style: solid; - border-width: 1px 0 1px 1px; - border-color: #CCC; - display: inline-block; - float: left; - padding: 4px 10px; - height: 18px; - line-height: 18px; - -webkit-border-radius: 3px 0 0 3px; - -moz-border-radius: 3px 0 0 3px; - border-radius: 3px 0 0 3px; - text-align: center; + border-color: #CCCCCC; + border-radius: 3px 0 0 3px; + border-style: solid; + border-width: 1px 0 1px 1px; + display: inline-block; + float: left; + height: 18px; + line-height: 18px; + padding: 4px 10px; + text-align: center; } .calendarInput { position: absolute; visibility: hidden; left: 11px; +} +.file-upload .input-medium { + border-radius: 3px 3px 3px 3px !important; + position: relative; + width: 267px; + z-index: 5; } \ No newline at end of file From 1b70852ff7c707dcacd70defc41b7e7558c06d0b Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Tue, 17 Apr 2012 11:34:25 +0800 Subject: [PATCH 018/298] realtime preview is working. but save to object when preview --- app/assets/javascripts/inc/modal-preview.js | 15 ++++ app/assets/stylesheets/new_admin.css.erb | 2 +- app/assets/stylesheets/widget.css | 70 +++++++++---------- .../admin/ad_banners_controller.rb | 4 +- .../admin/ad_banners/_ad_banner_tab.html.erb | 4 +- .../admin/ad_banners/_modal_preview.html.erb | 35 ++++++++++ app/views/admin/ad_banners/index.html.erb | 8 ++- .../admin/ad_banners/realtime_preview.js.erb | 2 + config/locales/en.yml | 7 +- config/locales/zh_tw.yml | 3 + config/routes.rb | 4 +- 11 files changed, 111 insertions(+), 43 deletions(-) create mode 100644 app/assets/javascripts/inc/modal-preview.js create mode 100644 app/views/admin/ad_banners/_modal_preview.html.erb create mode 100644 app/views/admin/ad_banners/realtime_preview.js.erb diff --git a/app/assets/javascripts/inc/modal-preview.js b/app/assets/javascripts/inc/modal-preview.js new file mode 100644 index 00000000..3453c096 --- /dev/null +++ b/app/assets/javascripts/inc/modal-preview.js @@ -0,0 +1,15 @@ +//Preview need a link in form as Ex and a corresponding PUT action in controller +//Ex preview trigger: +// <%= link_to "NewPreview", realtime_preview_admin_ad_banner_path(ad_banner_tab) , :class=>'preview_trigger'%> + +$(document).ready(function() { + $("a.preview_trigger").click(function(){ + $(this).after("

    "); + $.ajax({ + type:"PUT", + url:$(this).attr("href"), + data:$(this).parents("form").serialize() + }).done(function(){ $("#"+start_modal_with_id).modal('show');}); + return false;} + ); +}); \ No newline at end of file diff --git a/app/assets/stylesheets/new_admin.css.erb b/app/assets/stylesheets/new_admin.css.erb index 9d687eb6..2eaefd53 100644 --- a/app/assets/stylesheets/new_admin.css.erb +++ b/app/assets/stylesheets/new_admin.css.erb @@ -12,4 +12,4 @@ *= require style *= require scroll_style *= require isotope -*/ \ No newline at end of file +*/ \ No newline at end of file diff --git a/app/assets/stylesheets/widget.css b/app/assets/stylesheets/widget.css index 81862e25..3638bd4a 100644 --- a/app/assets/stylesheets/widget.css +++ b/app/assets/stylesheets/widget.css @@ -59,27 +59,29 @@ } .select-role { display:none; - padding: 10px 0; + overflow:hidden; } .file-upload { position:relative; overflow: hidden; } .file-upload .file-name { - border-color: #CCCCCC; - border-radius: 0 3px 3px 0; - border-style: solid; - border-width: 1px 1px 1px 0; - display: inline-block; - float: left; - height: 18px; - line-height: 18px; - margin: 0; - overflow: hidden; - padding: 4px 10px; - text-align: left; - white-space: nowrap; - width: 182px; + white-space: nowrap; + overflow: hidden; + border-style: solid; + border-width: 1px 1px 1px 0; + border-color: #CCC; + display: inline-block; + float: left; + padding: 4px 10px; + height: 18px; + line-height: 18px; + -webkit-border-radius: 0 3px 3px 0; + -moz-border-radius: 0 3px 3px 0; + border-radius: 0 3px 3px 0; + text-align: left; + margin: 0; + width: 182px; } .file-upload .upload { margin:0; @@ -109,11 +111,11 @@ width: 100%; } .widget-box .widgetInfo { - display: inline-block; - margin: 0 0 5px; - padding: 5px 10px; - text-align: center; - width: 255px; + display: inline-block; + text-align: center; + width: 255px; + margin : 0px 0 5px; + padding: 5px 10px; } .file-upload .input-medium { border-radius: 3px 3px 3px 3px !important; @@ -126,25 +128,21 @@ } /*Date*/ .showDate { - border-color: #CCCCCC; - border-radius: 3px 0 0 3px; - border-style: solid; - border-width: 1px 0 1px 1px; - display: inline-block; - float: left; - height: 18px; - line-height: 18px; - padding: 4px 10px; - text-align: center; + border-style: solid; + border-width: 1px 0 1px 1px; + border-color: #CCC; + display: inline-block; + float: left; + padding: 4px 10px; + height: 18px; + line-height: 18px; + -webkit-border-radius: 3px 0 0 3px; + -moz-border-radius: 3px 0 0 3px; + border-radius: 3px 0 0 3px; + text-align: center; } .calendarInput { position: absolute; visibility: hidden; left: 11px; -} -.file-upload .input-medium { - border-radius: 3px 3px 3px 3px !important; - position: relative; - width: 267px; - z-index: 5; } \ No newline at end of file diff --git a/app/controllers/admin/ad_banners_controller.rb b/app/controllers/admin/ad_banners_controller.rb index a6f4fd5f..5ce44a0d 100644 --- a/app/controllers/admin/ad_banners_controller.rb +++ b/app/controllers/admin/ad_banners_controller.rb @@ -40,9 +40,9 @@ class Admin::AdBannersController < ApplicationController end def realtime_preview - @ad_banner = AdBanner.find(params[:id]) + @ad_banner = AdBanner.find(params[:id]).clone + debugger @ad_banner.update_attributes(params[:ad_banner]) - render end def index diff --git a/app/views/admin/ad_banners/_ad_banner_tab.html.erb b/app/views/admin/ad_banners/_ad_banner_tab.html.erb index 10a98b52..7bba88c6 100644 --- a/app/views/admin/ad_banners/_ad_banner_tab.html.erb +++ b/app/views/admin/ad_banners/_ad_banner_tab.html.erb @@ -13,7 +13,9 @@ <%= render :partial => "ad_image_update", :collection => ad_banner_tab.ad_images,:as => :ad_image,:locals=>{:ad_banner => ad_banner_tab} %> <%#= render :partial => 'new_add_banner_file', :object => ad_banner_tab.ad_images.build, :locals => { :field_name => "new_ad_images[]", :f => f, :classes => "r_destroy" } %> <%= link_to 'Add AdImage',new_admin_ad_banner_ad_image_path(ad_banner_tab) %> + <%= link_to "NewPreview", realtime_preview_admin_ad_banner_path(ad_banner_tab) , :class=>'preview_trigger'%> +
    <% end -%> - <%= render :partial => 'preview_block',:locals=> {:ad_banner =>ad_banner_tab} %> + <%#= render :partial => 'preview_block',:locals=> {:ad_banner =>ad_banner_tab} %>
    diff --git a/app/views/admin/ad_banners/_modal_preview.html.erb b/app/views/admin/ad_banners/_modal_preview.html.erb new file mode 100644 index 00000000..27222e57 --- /dev/null +++ b/app/views/admin/ad_banners/_modal_preview.html.erb @@ -0,0 +1,35 @@ +<% if ad_banner -%> + + + +<% end -%> + + + diff --git a/app/views/admin/ad_banners/index.html.erb b/app/views/admin/ad_banners/index.html.erb index e6ebfd5d..365d020d 100644 --- a/app/views/admin/ad_banners/index.html.erb +++ b/app/views/admin/ad_banners/index.html.erb @@ -1,4 +1,10 @@ -<%= stylesheet_link_tag "admin/ad_banner_preview" %> +<% content_for :page_specific_css do -%> + <%#= stylesheet_link_tag "admin/ad_banner_preview" %> +<% end -%> +<% content_for :page_specific_css do -%> + <%= javascript_include_tag "inc/modal-preview" %> +<% end -%> +
    +
    + <%= link_to t("modal.preview"), realtime_preview_admin_ad_banner_path(@ad_image.ad_banner) ,:class=>"preview_trigger btn btn-success" rescue nil%> + + +
    \ No newline at end of file diff --git a/app/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb index 38380984..84d89ac4 100644 --- a/app/views/layouts/_side_bar.html.erb +++ b/app/views/layouts/_side_bar.html.erb @@ -32,9 +32,9 @@ <%= content_tag :li, :class => active_for_controllers('ad_banners', 'ad_images') do -%> <%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.ad_banner'), admin_ad_banners_path %> <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('ad_banners', 'ad_images')) do -%> - <%= content_tag :li, link_to(t('admin.all_ad_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %> - <%= content_tag :li, link_to(t('admin.new_ad_banner'), new_admin_ad_banner_path), :class => active_for_action('ad_banners', 'new') %> - <%= content_tag :li, link_to(t('admin.new_ad_image'), new_ad_image_admin_ad_banners_path), :class => active_for_action('ad_images', 'new') %> + <%= content_tag :li, link_to(t('admin.ad.all_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %> + <%= content_tag :li, link_to(t('admin.ad.new_banner'), new_admin_ad_banner_path), :class => active_for_action('ad_banners', 'new') %> + <%= content_tag :li, link_to(t('admin.ad.new_image'), new_ad_image_admin_ad_banners_path), :class => active_for_action('ad_images', 'new') %> <% end %> <% end %> diff --git a/config/routes.rb b/config/routes.rb index 2716588a..0d440e83 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -26,13 +26,13 @@ Orbit::Application.routes.draw do resources :ad_banners do - member do - match 'preivew' => 'ad_banners#realtime_preview',:as => :realtime_preview,:via => :put - end collection do match 'new_ad_image' => 'ad_images#new',:as => :new_ad_image,:via => :get match 'new_ad_image' => 'ad_images#create',:as => :create_ad_image,:via => :post end + member do + match 'preivew' => 'ad_banners#realtime_preview',:as => :realtime_preview,:via => :put + end resources :ad_images ,:except => [:show,:index] end resources :dashboards From 81b0046f42fe0668deec90818665fcee2d12acb3 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Tue, 17 Apr 2012 16:03:48 +0800 Subject: [PATCH 020/298] Preview now can be use at both ad_banner and ad_image,however it won't run correctly if user change its ad_banner at ad_image. --- app/assets/javascripts/inc/modal-preview.js | 2 +- app/controllers/admin/ad_banners_controller.rb | 2 +- app/models/ad_banner.rb | 1 + app/views/admin/ad_banners/_ad_banner_tab.html.erb | 3 +-- app/views/admin/ad_banners/_modal_ad_banner_form.html.erb | 3 --- app/views/admin/ad_banners/index.html.erb | 1 + app/views/admin/ad_images/_form.html.erb | 7 ++++--- config/routes.rb | 6 ++---- 8 files changed, 11 insertions(+), 14 deletions(-) diff --git a/app/assets/javascripts/inc/modal-preview.js b/app/assets/javascripts/inc/modal-preview.js index 3453c096..fd62a95e 100644 --- a/app/assets/javascripts/inc/modal-preview.js +++ b/app/assets/javascripts/inc/modal-preview.js @@ -4,7 +4,7 @@ $(document).ready(function() { $("a.preview_trigger").click(function(){ - $(this).after("

    "); + $(this).after(""); $.ajax({ type:"PUT", url:$(this).attr("href"), diff --git a/app/controllers/admin/ad_banners_controller.rb b/app/controllers/admin/ad_banners_controller.rb index 4d2ed213..c3d0cc58 100644 --- a/app/controllers/admin/ad_banners_controller.rb +++ b/app/controllers/admin/ad_banners_controller.rb @@ -40,7 +40,7 @@ class Admin::AdBannersController < ApplicationController end def realtime_preview - @ad_banner = AdBanner.find(params[:id]).preview_clone + @ad_banner = AdBanner.find(conditions: { title: params[:title] }).preview_clone #@ad_banner.update_attributes(params[:ad_banner]).update_attributes(params[:ad_images]) end diff --git a/app/models/ad_banner.rb b/app/models/ad_banner.rb index a2ac2096..0147c3d2 100644 --- a/app/models/ad_banner.rb +++ b/app/models/ad_banner.rb @@ -9,6 +9,7 @@ class AdBanner before_save :save_or_destroy validates_uniqueness_of :title + validates :title , :length => { :minimum => 2 } has_many :ad_images , dependent: :delete FX_TYPES = ["blindX","blindY","blindZ","cover","curtainX","curtainY","fade","fadeZoom","growX","growY","scrollUp","scrollDown","scrollLeft","scrollRight","scrollHorz","scrollVert","shuffle","slideX","slideY","toss","turnUp","turnDown","turnLeft","turnRight","uncover","wipe","zoom"] diff --git a/app/views/admin/ad_banners/_ad_banner_tab.html.erb b/app/views/admin/ad_banners/_ad_banner_tab.html.erb index 001726f4..47986323 100644 --- a/app/views/admin/ad_banners/_ad_banner_tab.html.erb +++ b/app/views/admin/ad_banners/_ad_banner_tab.html.erb @@ -1,4 +1,3 @@ -
    " id=<%= ad_banner_tab.title %>>

    <%= t("admin.ad.banner_best_size") %>:

    @@ -13,7 +12,7 @@ <%= render :partial => "ad_image_update", :collection => ad_banner_tab.ad_images,:as => :ad_image,:locals=>{:ad_banner => ad_banner_tab} %> <%#= render :partial => 'new_add_banner_file', :object => ad_banner_tab.ad_images.build, :locals => { :field_name => "new_ad_images[]", :f => f, :classes => "r_destroy" } %> <%= link_to t("admin.ad.new_image"),new_admin_ad_banner_ad_image_path(ad_banner_tab) ,:class => "btn btn-primary"%> - <%= link_to t("modal.preview"), realtime_preview_admin_ad_banner_path(ad_banner_tab) , :class=>'preview_trigger btn btn-success'%> + <%= link_to t("modal.preview"), admin_realtime_preview_ad_banner_path(ad_banner_tab.title) , :class=>'preview_trigger btn btn-success'%>
    <% end -%> diff --git a/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb b/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb index 8e8de1d9..66f8de2b 100644 --- a/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb +++ b/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb @@ -44,9 +44,6 @@ $('#new_ad_banner_tab_but').on('shown', function (e) { $('#new-a-banner').modal({show: true}); }) -$('#new-a-banner').on('shown', function (e) { - alert('show!'); -}) $('#new-a-banner').on('hidden', function (e) { $(".nav.nav-tabs a[id!='new_ad_banner_tab_but']:last").tab('show'); diff --git a/app/views/admin/ad_banners/index.html.erb b/app/views/admin/ad_banners/index.html.erb index 365d020d..4b7dfef2 100644 --- a/app/views/admin/ad_banners/index.html.erb +++ b/app/views/admin/ad_banners/index.html.erb @@ -2,6 +2,7 @@ <%#= stylesheet_link_tag "admin/ad_banner_preview" %> <% end -%> <% content_for :page_specific_css do -%> + <%= javascript_include_tag "/static/jquery.cycle.all.latest.js" %> <%= javascript_include_tag "inc/modal-preview" %> <% end -%> diff --git a/app/views/admin/ad_images/_form.html.erb b/app/views/admin/ad_images/_form.html.erb index 21dca2a0..075f01b4 100644 --- a/app/views/admin/ad_images/_form.html.erb +++ b/app/views/admin/ad_images/_form.html.erb @@ -5,6 +5,7 @@ <%= javascript_include_tag "lib/datepicker" %> <%= javascript_include_tag "lib/date.format" %> <%= javascript_include_tag "inc/modal-preview" %> + <%= javascript_include_tag "/static/jquery.cycle.all.latest.js" %> <% end %> @@ -187,9 +188,9 @@
    - <%= link_to t("modal.preview"), realtime_preview_admin_ad_banner_path(@ad_image.ad_banner) ,:class=>"preview_trigger btn btn-success" rescue nil%> - - + <%= link_to t("modal.preview"), admin_realtime_preview_ad_banner_path(@ad_image.ad_banner.title) ,:class=>"preview_trigger btn btn-success" rescue nil%> + <%= f.submit t("submit"),:class=>"btn btn-primary" %> + <%= f.submit t("cancel"),:class=>"btn ",:type => 'reset' %>
    \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 0d440e83..9200492d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -24,15 +24,13 @@ Orbit::Application.routes.draw do end end - + + match 'ad_banner/:title/preivew' => 'ad_banners#realtime_preview',:as => :realtime_preview_ad_banner,:via => :put resources :ad_banners do collection do match 'new_ad_image' => 'ad_images#new',:as => :new_ad_image,:via => :get match 'new_ad_image' => 'ad_images#create',:as => :create_ad_image,:via => :post end - member do - match 'preivew' => 'ad_banners#realtime_preview',:as => :realtime_preview,:via => :put - end resources :ad_images ,:except => [:show,:index] end resources :dashboards From 0c46b4da23f7b8c2c929a44222e274a406016728 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Wed, 18 Apr 2012 15:26:59 +0800 Subject: [PATCH 021/298] AdImage and AnBanner JS fixed --- app/assets/javascripts/inc/modal-preview.js | 2 +- app/controllers/admin/ad_banners_controller.rb | 15 ++++++++++----- .../admin/ad_banners/_ad_banner_tab.html.erb | 2 +- .../ad_banners/_modal_ad_banner_form.html.erb | 4 ++-- .../admin/ad_banners/create_error_msg.js.erb | 1 + .../admin/ad_banners/new_created_node.js.erb | 7 +++++++ 6 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 app/views/admin/ad_banners/create_error_msg.js.erb create mode 100644 app/views/admin/ad_banners/new_created_node.js.erb diff --git a/app/assets/javascripts/inc/modal-preview.js b/app/assets/javascripts/inc/modal-preview.js index fd62a95e..2f915f6c 100644 --- a/app/assets/javascripts/inc/modal-preview.js +++ b/app/assets/javascripts/inc/modal-preview.js @@ -6,7 +6,7 @@ $(document).ready(function() { $("a.preview_trigger").click(function(){ $(this).after(""); $.ajax({ - type:"PUT", + type:"put", url:$(this).attr("href"), data:$(this).parents("form").serialize() }).done(function(){ $("#"+start_modal_with_id).modal('show');}); diff --git a/app/controllers/admin/ad_banners_controller.rb b/app/controllers/admin/ad_banners_controller.rb index c3d0cc58..19983b66 100644 --- a/app/controllers/admin/ad_banners_controller.rb +++ b/app/controllers/admin/ad_banners_controller.rb @@ -22,9 +22,14 @@ class Admin::AdBannersController < ApplicationController def create @ad_banner = AdBanner.new(params[:ad_banner]) - @ad_banner.save - redirect_to admin_ad_banners_url - + if @ad_banner.save + @active = @ad_banner + respond_to do |format| + format.js {render 'new_created_node'} + end + else + render 'create_error_msg' + end end def edit @@ -40,8 +45,8 @@ class Admin::AdBannersController < ApplicationController end def realtime_preview - @ad_banner = AdBanner.find(conditions: { title: params[:title] }).preview_clone - #@ad_banner.update_attributes(params[:ad_banner]).update_attributes(params[:ad_images]) + @ad_banner = AdBanner.first(conditions: { title: params[:title] }).preview_clone + @ad_banner.update_attributes(params[:ad_banner]).update_attributes(params[:ad_images]) end def index diff --git a/app/views/admin/ad_banners/_ad_banner_tab.html.erb b/app/views/admin/ad_banners/_ad_banner_tab.html.erb index 47986323..530e45cb 100644 --- a/app/views/admin/ad_banners/_ad_banner_tab.html.erb +++ b/app/views/admin/ad_banners/_ad_banner_tab.html.erb @@ -1,4 +1,4 @@ -
    " id=<%= ad_banner_tab.title %>> +
    " id=<%= ad_banner_tab.title %>>

    <%= t("admin.ad.banner_best_size") %>:

    <%= form_for ad_banner_tab,:url=> admin_ad_banner_path(ad_banner_tab),:method => :put,:class=>"input-medium" do |f| -%> diff --git a/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb b/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb index 66f8de2b..36ebc4a3 100644 --- a/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb +++ b/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb @@ -4,7 +4,7 @@ <% end %> diff --git a/app/views/admin/ad_banners/create_error_msg.js.erb b/app/views/admin/ad_banners/create_error_msg.js.erb new file mode 100644 index 00000000..60f1d261 --- /dev/null +++ b/app/views/admin/ad_banners/create_error_msg.js.erb @@ -0,0 +1 @@ +alert("Error occures:<%= @ad_banner.errors.full_messages%>"); \ No newline at end of file diff --git a/app/views/admin/ad_banners/new_created_node.js.erb b/app/views/admin/ad_banners/new_created_node.js.erb new file mode 100644 index 00000000..140be0b4 --- /dev/null +++ b/app/views/admin/ad_banners/new_created_node.js.erb @@ -0,0 +1,7 @@ +$('<%= escape_javascript(content_tag(:li,link_to(@ad_banner.title,"##{@ad_banner.title}",:data=>{:toggle=>"tab"}))) %>').insertBefore("#new_ad_banner_tab_but"); +$('<%= escape_javascript(render(:partial => "ad_banner_tab",:locals => {:ad_banner_tab => @ad_banner})) %>').insertBefore($("#new-a-banner")); + +$('.modal').modal('hide'); +$('#post-body-content').find(".nav.nav-tabs").children('li.active').removeClass("active"); +$('#post-body-content').find(".nav.nav-tabs").children('li[id!="new_ad_banner_tab_but"]').last().addClass("active"); + From 8eedbc951e810e7e79e0711aba2e465450ad3206 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Wed, 18 Apr 2012 15:33:11 +0800 Subject: [PATCH 022/298] add i18n vars --- app/views/admin/ad_banners/_ad_image_update.html.erb | 2 +- config/locales/en.yml | 2 ++ config/locales/zh_tw.yml | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/admin/ad_banners/_ad_image_update.html.erb b/app/views/admin/ad_banners/_ad_image_update.html.erb index 583c3316..c51b5885 100644 --- a/app/views/admin/ad_banners/_ad_image_update.html.erb +++ b/app/views/admin/ad_banners/_ad_image_update.html.erb @@ -1,7 +1,7 @@
  • <%= image_tag ad_image.file rescue nil%>

    - <%= ad_image.display? ? '[Showing]' : '[NotShawing]' %> + <%= ad_image.display? ? "[#{t('admin.ad.showing')}]" : "[#{t('admin.ad.not_showing')}]" %> <%= "#{ad_image.post_date ||'NeedReset' }~#{ad_image.unpost_date || 'NeedReset'}" %>

    diff --git a/config/locales/en.yml b/config/locales/en.yml index d019de7e..f34557ca 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -48,6 +48,8 @@ en: banner_best_size: Banner Best Size new_banner: New banner new_image: New image + showing: Showing + not_showing: NotShowing title: Title transition_sec: Transition time trans_unit_sec: sec diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 708def10..2615c99c 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -45,6 +45,8 @@ zh_tw: banner_best_size: Banner 尺寸 new_banner: 新增輪播 new_image: 新增橫幅 + showing: 顯示中 + not_showing: 沒有顯示 title: 標題 transition_sec: 轉場單位時間 trans_unit_sec: 秒 From 67ba2389a2adb766a1d43664241ab7341c25f565 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Wed, 18 Apr 2012 16:24:17 +0800 Subject: [PATCH 023/298] fix js --- .../ad_banners/_modal_ad_banner_form.html.erb | 14 ++++++-------- app/views/admin/ad_banners/index.html.erb | 2 +- app/views/admin/ad_banners/new_created_node.js.erb | 1 + 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb b/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb index 36ebc4a3..235e7e15 100644 --- a/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb +++ b/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb @@ -36,17 +36,15 @@ <% end %> diff --git a/app/views/admin/ad_banners/index.html.erb b/app/views/admin/ad_banners/index.html.erb index 4b7dfef2..8307885a 100644 --- a/app/views/admin/ad_banners/index.html.erb +++ b/app/views/admin/ad_banners/index.html.erb @@ -12,7 +12,7 @@ <% @ad_banners.each do |ab| %> <%= content_tag :li,link_to(ab.title,"##{ab.title}",:data=>{:toggle=>"tab"}),:class => (ab == @active ? 'active' : nil ) %> <% end -%> - <%= content_tag :li,link_to('New',"#new-a-banner",:data=>{:toggle=>"tab"}),:id=>'new_ad_banner_tab_but',:class => (@active.nil? ? 'active' : nil ) %> + <%= content_tag :li,link_to(t("admin.ad.new_banner"),"#new-a-banner",:data=>{:toggle=>"tab"}),:id=>'new_ad_banner_tab_but',:class => (@active.nil? ? 'active' : nil ) %> diff --git a/app/views/admin/ad_banners/new_created_node.js.erb b/app/views/admin/ad_banners/new_created_node.js.erb index 140be0b4..86970e6a 100644 --- a/app/views/admin/ad_banners/new_created_node.js.erb +++ b/app/views/admin/ad_banners/new_created_node.js.erb @@ -2,6 +2,7 @@ $('<%= escape_javascript(content_tag(:li,link_to(@ad_banner.title,"##{@ad_banner $('<%= escape_javascript(render(:partial => "ad_banner_tab",:locals => {:ad_banner_tab => @ad_banner})) %>').insertBefore($("#new-a-banner")); $('.modal').modal('hide'); +$('#new-a-banner').unbind(); $('#post-body-content').find(".nav.nav-tabs").children('li.active').removeClass("active"); $('#post-body-content').find(".nav.nav-tabs").children('li[id!="new_ad_banner_tab_but"]').last().addClass("active"); From 09910ca4ae855e15881a3013cca45c898c21a15a Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Mon, 23 Apr 2012 14:12:18 +0800 Subject: [PATCH 024/298] Rmove therubyraces from Gemfile.lock --- Gemfile.lock | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 52453b6a..71742974 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -97,7 +97,6 @@ GEM 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.3) @@ -210,8 +209,6 @@ GEM rack (~> 1.0) tilt (~> 1.1, != 1.3.0) subexec (0.2.1) - therubyracer (0.9.10) - libv8 (~> 3.3.10) thor (0.14.6) tilt (1.3.3) tinymce-rails (3.4.8) @@ -272,7 +269,6 @@ DEPENDENCIES sinatra spork sprockets - therubyracer tinymce-rails uglifier watchr From 499930a680c3e479c383c7534a149d43b52e43cb Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Mon, 23 Apr 2012 14:29:55 +0800 Subject: [PATCH 025/298] Pull from github --- app/assets/stylesheets/new_admin.css.erb | 4 +- app/assets/stylesheets/widget.css | 148 ----------------------- app/assets/stylesheets/widgets.css | 5 +- 3 files changed, 5 insertions(+), 152 deletions(-) delete mode 100644 app/assets/stylesheets/widget.css diff --git a/app/assets/stylesheets/new_admin.css.erb b/app/assets/stylesheets/new_admin.css.erb index 2eaefd53..4b004d3d 100644 --- a/app/assets/stylesheets/new_admin.css.erb +++ b/app/assets/stylesheets/new_admin.css.erb @@ -5,11 +5,11 @@ *= require reset *= require_self *= require message + *= require style *= require bootstrap *= require bootstrap-orbit *= require list *= require widgets - *= require style *= require scroll_style *= require isotope -*/ \ No newline at end of file +*/ diff --git a/app/assets/stylesheets/widget.css b/app/assets/stylesheets/widget.css deleted file mode 100644 index 3638bd4a..00000000 --- a/app/assets/stylesheets/widget.css +++ /dev/null @@ -1,148 +0,0 @@ -.widget-size-300 { - width:298px; -} -.widget-box { - background-color: #FFF; - overflow: hidden; - min-width: 300px; - margin: 0 0 5px 5px; - position:relative; -} -.widget-box .widget-title { - color: #FFF; - padding-left: 5px; - border-radius: 5px 5px 0 0; - -moz-border-radius: 5px 5px 0 0; - -webkit-border-radius: 5px 5px 0 0; - background-image: -moz-linear-gradient(top, #B7B7B7, #9d9d9d); - background-image: -ms-linear-gradient(top, #B7B7B7, #9d9d9d); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#B7B7B7), to(#9d9d9d)); - background-image: -webkit-linear-gradient(top, #B7B7B7, #9d9d9d); - background-image: -o-linear-gradient(top, #B7B7B7, #9d9d9d); - background-image: linear-gradient(top, #B7B7B7, #9d9d9d); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#B7B7B7', endColorstr='#9d9d9d', GradientType=0); -} -.widget-box .widget-title [class^="icons-"] { - margin: 3px 5px 0 2px; -} -.widget-box .widget-content { - padding: 10px; - border-width: 0 1px 1px; - border-style: solid; - border-color: #CCCCCC; - border-radius: 0 0 5px 5px; - -moz-border-radius: 0 0 5px 5px; - -webkit-border-radius: 0 0 5px 5px; -} -.widget-box .form-horizontal .control-group > label { - width: 50px; -} -.widget-box .form-horizontal .controls { - margin-left: 60px; -} -.widget-action { - position:absolute; - right:1px; - top:6px; -} -.action { - float: left; - display:inline-block; - margin-right: 5px; - opacity: 0.8; - filter: alpha(opacity=80); -} -.action:hover { - opacity: 1; - filter: alpha(opacity=100); - cursor: pointer; -} -.select-role { - display:none; - overflow:hidden; -} -.file-upload { - position:relative; - overflow: hidden; -} -.file-upload .file-name { - white-space: nowrap; - overflow: hidden; - border-style: solid; - border-width: 1px 1px 1px 0; - border-color: #CCC; - display: inline-block; - float: left; - padding: 4px 10px; - height: 18px; - line-height: 18px; - -webkit-border-radius: 0 3px 3px 0; - -moz-border-radius: 0 3px 3px 0; - border-radius: 0 3px 3px 0; - text-align: left; - margin: 0; - width: 182px; -} -.file-upload .upload { - margin:0; - padding:0; - position:absolute; - top: 0; - left:0; - opacity:.0; - font-size: 60px; - left: -595px/9; - filter: alpha(opacity: 0); - outline: none; -} -.file-upload .upload:focus { - position:absolute; -} -.upload-picture { - margin-bottom: 5px; - text-align: center; - width: 276px; - overflow: hidden; - height: 90px; -} -.upload-picture img { - left: 0; - margin-top: -15%; - width: 100%; -} -.widget-box .widgetInfo { - display: inline-block; - text-align: center; - width: 255px; - margin : 0px 0 5px; - padding: 5px 10px; -} -.file-upload .input-medium { - border-radius: 3px 3px 3px 3px !important; - width: 267px; - position: relative; - z-index: 5; -} -#widget-link table { - margin-bottom:0 -} -/*Date*/ -.showDate { - border-style: solid; - border-width: 1px 0 1px 1px; - border-color: #CCC; - display: inline-block; - float: left; - padding: 4px 10px; - height: 18px; - line-height: 18px; - -webkit-border-radius: 3px 0 0 3px; - -moz-border-radius: 3px 0 0 3px; - border-radius: 3px 0 0 3px; - text-align: center; -} -.calendarInput { - position: absolute; - visibility: hidden; - left: 11px; -} \ No newline at end of file diff --git a/app/assets/stylesheets/widgets.css b/app/assets/stylesheets/widgets.css index 7a658f36..d38b442d 100644 --- a/app/assets/stylesheets/widgets.css +++ b/app/assets/stylesheets/widgets.css @@ -1,3 +1,4 @@ +/*Widget*/ .widget-size-300 { width:298px; } @@ -50,11 +51,11 @@ display:inline-block; margin-right: 5px; opacity: 0.8; - filter: alpha(opacity=80); + filter: alpha(opacity:80); } .action:hover { opacity: 1; - filter: alpha(opacity=100); + filter: alpha(opacity:100); cursor: pointer; } .select-role { From 1ebf460f7eabd81359f9b2346db692ba3aa3197c Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Mon, 23 Apr 2012 14:47:33 +0800 Subject: [PATCH 026/298] Fix 'loading fail' in front-end for announcement The show action was returning an array instead of a bulletin --- .../panel/announcement/front_end/bulletins_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb index 3ba0e666..8438c8e0 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb @@ -23,8 +23,8 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController end def show - @bulletin = Bulletin.can_display.where.where(_id: params[:id]) - get_categorys + @bulletin = Bulletin.can_display.where(_id: params[:id]).first + get_categorys end From 834cbe3a1124d2c93c448529c3c50949d0aae7f7 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Mon, 23 Apr 2012 16:12:07 +0800 Subject: [PATCH 027/298] Fix side_bar for tags Modules needs to use the fullpath for active or visible in tags --- app/helpers/application_helper.rb | 5 +++-- app/views/layouts/_side_bar.html.erb | 12 ++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e45fa4d6..ea8c5a5b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -75,11 +75,12 @@ module ApplicationHelper end def active_for_controllers(*controller_names) - controller_names.include?(controller.controller_name) ? 'active' : nil + (controller_names.include?(controller.controller_name) || controller_names.include?(request.fullpath)) ? 'active' : nil end def visible_for_controllers(*controller_names) - controller_names.include?(controller.controller_name) ? '' : 'hide' + puts controller_names + (controller_names.include?(controller.controller_name) || controller_names.include?(request.fullpath)) ? '' : 'hide' end def active_for_action(controller_name, action_name) diff --git a/app/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb index 84d89ac4..4acaa0c1 100644 --- a/app/views/layouts/_side_bar.html.erb +++ b/app/views/layouts/_side_bar.html.erb @@ -2,13 +2,13 @@ <%= link_to content_tag(:i, nil, :class => 'icons-purchase') + t('admin.purchase'), admin_purchases_path %> <% end -%> -<%= content_tag :li, :class => active_for_controllers('bulletins', 'tags', 'bulletin_categorys', 'fact_checks') do -%> +<%= content_tag :li, :class => active_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'fact_checks') do -%> <%= link_to content_tag(:i, nil, :class => 'icons-announcement') + t('admin.announcement'), panel_announcement_back_end_bulletins_path %> - <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('bulletins', 'tags', 'bulletin_categorys', 'fact_checks')) do -%> + <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'fact_checks')) do -%> <%= content_tag :li, link_to(t('announcement.all_articles'), panel_announcement_back_end_bulletins_path), :class => active_for_action('bulletins', 'index') %> <%= content_tag :li, link_to(t('announcement.add_new'), new_panel_announcement_back_end_bulletin_path), :class => active_for_action('bulletins', 'new') %> <%= content_tag :li, link_to(t('announcement.categories'), panel_announcement_back_end_bulletin_categorys_path), :class => active_for_action('bulletin_categorys', 'index') %> - <%= content_tag :li, link_to(t('announcement.tags'), panel_announcement_back_end_tags_path), :class => active_for_action('panel/bulletin/back_end/tags', 'index') %> + <%= content_tag :li, link_to(t('announcement.tags'), panel_announcement_back_end_tags_path), :class => active_for_action('/panel/announcement/back_end/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('fact_checks', 'setting') if (is_manager? rescue nil) %> <% end -%> @@ -38,13 +38,13 @@ <% end %> <% end %> -<%= content_tag :li, :class => active_for_controllers('web_links', 'tags', 'web_link_categorys') do -%> +<%= content_tag :li, :class => active_for_controllers('web_links', '/panel/web_resource/back_end/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 :ul, :class => ("nav nav-list " + visible_for_controllers('web_links', '/panel/web_resource/back_end/tags', 'web_link_categorys')) do -%> <%= content_tag :li, link_to(t('admin.announcement.all_articles'), panel_web_resource_back_end_web_links_path), :class => active_for_action('web_link', 'index') %> <%= content_tag :li, link_to(t('admin.announcement.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.announcement.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.announcement.tags'), panel_web_resource_back_end_tags_path), :class => active_for_action('panel/web_resource/back_end/tags', 'index') %> + <%= content_tag :li, link_to(t('admin.announcement.tags'), panel_web_resource_back_end_tags_path), :class => active_for_action('/panel/web_resource/back_end/tags', 'index') %> <% end -%> <% end -%> From 35452c039d6a3c20929845d192bc28e1230d6f7b Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Mon, 23 Apr 2012 17:03:55 +0800 Subject: [PATCH 028/298] Fix ad_banner --- app/assets/javascripts/inc/modal-preview.js | 17 ++++++++++++----- app/models/ad_banner.rb | 10 +++++++++- .../admin/ad_banners/_ad_banner_tab.html.erb | 4 ++-- .../ad_banners/_modal_ad_banner_form.html.erb | 10 ++++++---- config/locales/en.yml | 1 + config/locales/zh_tw.yml | 1 + config/routes.rb | 2 +- 7 files changed, 32 insertions(+), 13 deletions(-) diff --git a/app/assets/javascripts/inc/modal-preview.js b/app/assets/javascripts/inc/modal-preview.js index 2f915f6c..35195999 100644 --- a/app/assets/javascripts/inc/modal-preview.js +++ b/app/assets/javascripts/inc/modal-preview.js @@ -6,10 +6,17 @@ $(document).ready(function() { $("a.preview_trigger").click(function(){ $(this).after(""); $.ajax({ - type:"put", + type: 'PUT', + //async : true, url:$(this).attr("href"), - data:$(this).parents("form").serialize() - }).done(function(){ $("#"+start_modal_with_id).modal('show');}); - return false;} - ); + contentType: 'application/javascript; charset=utf-8', + data:$(this).parents("form").serialize(), + success: function (msg) { + $("#"+start_modal_with_id).modal('show'); }, + error: function(){ + alert("ERROR"); + } + }); + return false; + }); }); \ No newline at end of file diff --git a/app/models/ad_banner.rb b/app/models/ad_banner.rb index 0147c3d2..7377d852 100644 --- a/app/models/ad_banner.rb +++ b/app/models/ad_banner.rb @@ -4,7 +4,7 @@ class AdBanner include Mongoid::MultiParameterAttributes field :title - field :transition_sec,type: Integer + field :transition_msec,type: Integer field :ad_fx #TODO Design should explain before_save :save_or_destroy @@ -13,6 +13,14 @@ class AdBanner has_many :ad_images , dependent: :delete FX_TYPES = ["blindX","blindY","blindZ","cover","curtainX","curtainY","fade","fadeZoom","growX","growY","scrollUp","scrollDown","scrollLeft","scrollRight","scrollHorz","scrollVert","shuffle","slideX","slideY","toss","turnUp","turnDown","turnLeft","turnRight","uncover","wipe","zoom"] +attr_writer :transition_sec + def transition_sec + self.transition_msec/1000 + end + + def transition_sec=(sec) + self.transition_msec = sec.to_i*1000 + end def preview_clone preview_banner = self.clone diff --git a/app/views/admin/ad_banners/_ad_banner_tab.html.erb b/app/views/admin/ad_banners/_ad_banner_tab.html.erb index 530e45cb..c2c9697b 100644 --- a/app/views/admin/ad_banners/_ad_banner_tab.html.erb +++ b/app/views/admin/ad_banners/_ad_banner_tab.html.erb @@ -5,14 +5,14 @@ <%= f.label :ad_fx, t('admin.ad.ab_fx') %> <%= f.select :ad_fx ,AdBanner::FX_TYPES %> <%= f.label :transition_sec, t('admin.ad.transition_sec') %> - <%= f.text_field :transition_sec,:placeholder=>"3秒請輸入3000",:class=> "span3" %> <%= t("admin.ad.trans_unit_sec") %> + <%= f.text_field :transition_sec,:placeholder=>t('admin.ad.sec_place_holder'),:class=> "span3" %> <%= t("admin.ad.trans_unit_sec") %> <%= f.submit t("admin.ad.update_banner") %> <%= f.submit t("cancel"),:type=>'reset' %>

    <%= render :partial => "ad_image_update", :collection => ad_banner_tab.ad_images,:as => :ad_image,:locals=>{:ad_banner => ad_banner_tab} %> <%#= render :partial => 'new_add_banner_file', :object => ad_banner_tab.ad_images.build, :locals => { :field_name => "new_ad_images[]", :f => f, :classes => "r_destroy" } %> <%= link_to t("admin.ad.new_image"),new_admin_ad_banner_ad_image_path(ad_banner_tab) ,:class => "btn btn-primary"%> - <%= link_to t("modal.preview"), admin_realtime_preview_ad_banner_path(ad_banner_tab.title) , :class=>'preview_trigger btn btn-success'%> + <%= link_to t("modal.preview"), admin_realtime_preview_ad_banner_url(ad_banner_tab.title) , :class=>'preview_trigger btn btn-success'%>
    <% end -%> diff --git a/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb b/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb index 235e7e15..cac5f1a1 100644 --- a/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb +++ b/app/views/admin/ad_banners/_modal_ad_banner_form.html.erb @@ -40,11 +40,13 @@ $('#new_ad_banner_tab_but').on('shown', function (e) { $('#new-a-banner').modal({show: true}); }); -<% if params[:action] == "new" -%> - $('#new-a-banner').modal({show: true}); -<% end -%> + $('#new-a-banner').on('hidden', function (e) { - $(".nav.nav-tabs a[id!='new_ad_banner_tab_but']:last").tab('show'); + $('#post-body-content').find(".nav.nav-tabs").children('li.active').removeClass("active"); + + $('#post-body-content').find(".nav.nav-tabs").children('li[id!="new_ad_banner_tab_but"]').last().addClass("active"); + $('.tab-pane').find(".nav.nav-tabs").children('li[id!="new_ad_banner_tab_but"]').last().addClass("active"); + }); diff --git a/config/locales/en.yml b/config/locales/en.yml index f34557ca..bb161a04 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -43,6 +43,7 @@ en: action: Action ad_banner: AD Banner ad: + sec_place_holder: Enter 3 if 3 sec ab_fx: FX all_banners: AdBanner list banner_best_size: Banner Best Size diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 2615c99c..d0acb21f 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -40,6 +40,7 @@ zh_tw: action: 操作 ad_banner: 廣告輪播 ad: + sec_place_holder: 3秒請輸入3 ab_fx: 轉場特效 all_banners: 輪播清單 banner_best_size: Banner 尺寸 diff --git a/config/routes.rb b/config/routes.rb index 9200492d..d8552cdd 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -25,7 +25,7 @@ Orbit::Application.routes.draw do end - match 'ad_banner/:title/preivew' => 'ad_banners#realtime_preview',:as => :realtime_preview_ad_banner,:via => :put + match 'ad_banner/:title/preview' => 'ad_banners#realtime_preview',:as => :realtime_preview_ad_banner,:via => :put resources :ad_banners do collection do match 'new_ad_image' => 'ad_images#new',:as => :new_ad_image,:via => :get From a5db2382e765508c6a28f2e0f3e1c2156fc9aaf6 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Mon, 23 Apr 2012 18:20:12 +0800 Subject: [PATCH 029/298] Fix ad image date selector --- app/controllers/admin/ad_images_controller.rb | 2 ++ app/models/ad_image.rb | 4 ++-- app/views/admin/ad_images/_form.html.erb | 4 ++-- .../panel/announcement/back_end/fact_checks/setting.html.erb | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/controllers/admin/ad_images_controller.rb b/app/controllers/admin/ad_images_controller.rb index 3fb681da..d2039ab5 100644 --- a/app/controllers/admin/ad_images_controller.rb +++ b/app/controllers/admin/ad_images_controller.rb @@ -19,6 +19,8 @@ class Admin::AdImagesController < ApplicationController def new @ad_image =AdImage.new + @ad_image.post_date = Date.today + @ad_image.unpost_date = Date.today + 30 #render :action => 'new',:url=> {:ad_banner_id => params.has_key?(:ad_banner_id)? params[:ad_banner_id],nil} end diff --git a/app/models/ad_image.rb b/app/models/ad_image.rb index 3eb63511..f20a5582 100644 --- a/app/models/ad_image.rb +++ b/app/models/ad_image.rb @@ -28,12 +28,12 @@ class AdImage attr_reader :parse_post_date,:parse_unpost_date def parse_post_date=(att) - self.post_date = (Date.parse att rescue nil) + self.post_date = (Date.parse att.gsub(/\s+/, "") rescue nil) end def parse_unpost_date=(att) - self.unpost_date = (Date.parse att rescue nil) + self.unpost_date = (Date.parse att.gsub(/\s+/, "") rescue nil) end def display? diff --git a/app/views/admin/ad_images/_form.html.erb b/app/views/admin/ad_images/_form.html.erb index c19b2cf4..0fe04b28 100644 --- a/app/views/admin/ad_images/_form.html.erb +++ b/app/views/admin/ad_images/_form.html.erb @@ -23,8 +23,8 @@
    - <%= f.hidden_field :parse_post_date %> - <%= f.hidden_field :parse_unpost_date%> + <%= f.hidden_field :parse_post_date,:value => @ad_image.post_date.strftime('%Y / %m / %d') %> + <%= f.hidden_field :parse_unpost_date,:value => @ad_image.unpost_date.strftime('%Y / %m / %d')%>
    diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/setting.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/setting.html.erb index 7303b705..6b8ba483 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/setting.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/setting.html.erb @@ -3,8 +3,8 @@ <% end %> <% content_for :page_specific_javascript do %> <%= javascript_include_tag "bootstrap" %> - <%= javascript_include_tag "inc/permission-checkbox" %> - <%= javascript_include_tag "inc/search" %> + <%#= javascript_include_tag "inc/permission-checkbox" %> + <%#= javascript_include_tag "inc/search" %> <% end %> <%#= label_tag :fact_check_setting, t("announcement.bulletin.fact_check_setting") %> <%= form_tag('', :remote => true) %> From 083658369416fe701ac851996ad9543cb5bd1ce5 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Mon, 23 Apr 2012 18:29:23 +0800 Subject: [PATCH 030/298] Disable ad_banner_preview. Just show window --- app/controllers/admin/ad_banners_controller.rb | 2 +- app/models/ad_image.rb | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/controllers/admin/ad_banners_controller.rb b/app/controllers/admin/ad_banners_controller.rb index 19983b66..1e96907f 100644 --- a/app/controllers/admin/ad_banners_controller.rb +++ b/app/controllers/admin/ad_banners_controller.rb @@ -46,7 +46,7 @@ class Admin::AdBannersController < ApplicationController def realtime_preview @ad_banner = AdBanner.first(conditions: { title: params[:title] }).preview_clone - @ad_banner.update_attributes(params[:ad_banner]).update_attributes(params[:ad_images]) + #@ad_banner.update_attributes(params[:ad_banner]).update_attributes(params[:ad_images]) end def index diff --git a/app/models/ad_image.rb b/app/models/ad_image.rb index f20a5582..9d7fe55b 100644 --- a/app/models/ad_image.rb +++ b/app/models/ad_image.rb @@ -24,7 +24,6 @@ class AdImage # validates_numericality_of :weight, greater_than_or_equal_to: 1,less_than_or_equal_to: 10 # validates_format_of :out_link, with: /(http:\/\/.*|)/ ,:message => 'Need a valid URL' - # validates_presence_of :post_date,:message => 'Need a valid post date' attr_reader :parse_post_date,:parse_unpost_date def parse_post_date=(att) From b502bedd0fb4df1e25ee3de6ebf7b4b6ab1f539b Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Tue, 24 Apr 2012 00:46:34 +0800 Subject: [PATCH 031/298] Fix filter and sort for status in announcement --- .../back_end/bulletins_controller.rb | 23 +++++++---- .../announcement/app/models/bulletin.rb | 40 +++++++++++-------- .../back_end/bulletins/_bulletin.html.erb | 12 +++++- .../bulletins/_filter_status.html.erb | 10 +++-- .../back_end/bulletins/_form.html.erb | 2 +- 5 files changed, 57 insertions(+), 30 deletions(-) diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb index e66c51a4..ef60c330 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb @@ -243,12 +243,14 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController # end respond_to do |format| - if @bulletin.update_attributes(params[:bulletin]) && @bulletin.save + if @bulletin.update_attributes(params[:bulletin]) # format.html { redirect_to(panel_announcement_back_end_bulletin_url(@bulletin), :notice => t('bulletin.update_bulletin_success')) } format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('bulletin.update_bulletin_success')) } format.js { render 'toggle_enable' } format.xml { head :ok } else + get_tags + get_categorys format.html { render :action => "edit" } format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity } end @@ -335,7 +337,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse! bulletins = sorted.collect {|a| a[1] } when 'status' - bulletins = bulletins.order_by(:is_top, params[:direction]).order_by(:is_hot, params[:direction]).order_by(:is_hidden, params[:direction]) + bulletins = bulletins.order_by(:is_top, params[:direction]).order_by(:is_hot, params[:direction]).order_by(:is_hidden, params[:direction]).order_by(:is_pending, params[:direction]).order_by(:is_checked, params[:direction]).order_by(:is_rejected, params[:direction]) when 'update_user_id' user_ids = bulletins.distinct(:update_user_id) users = User.find(user_ids) rescue nil @@ -357,7 +359,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController sorted_titles = sorted.collect {|a| a[1] } a = params[:direction].eql?('asc') ? (sorted_titles + a) : (a + sorted_titles) bulletins = a.flatten - end + end if @filter @filter.each do |key, value| case key @@ -365,16 +367,23 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController a = Array.new bulletins.each do |bulletin| value.each do |v| - a << bulletin if bulletin[v] + case v + when 'pending' + a << bulletin if bulletin.is_checked.nil? + when 'rejected' + a << bulletin if bulletin.is_checked.eql?(false) + else + a << bulletin if bulletin[v] + end end end - bulletins = a + bulletins = a.uniq when 'categories' a = Array.new bulletins.each do |bulletin| a << bulletin if value.include?(bulletin.bulletin_category.id.to_s) end - bulletins = a + bulletins = a.uniq when 'tags' a = Array.new bulletins.each do |bulletin| @@ -382,7 +391,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController a << bulletin if value.include?(tag.id.to_s) end end - bulletins = a + bulletins = a.uniq end if value.size > 0 end end diff --git a/vendor/built_in_modules/announcement/app/models/bulletin.rb b/vendor/built_in_modules/announcement/app/models/bulletin.rb index 4808b3a9..55d1ec84 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin.rb @@ -19,7 +19,10 @@ 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 => nil + field :is_checked, :type => Boolean, :default => false + field :is_pending, :type => Boolean, :default => true + field :is_rejected, :type => Boolean, :default => false + field :not_checked_reason @@ -42,7 +45,7 @@ class Bulletin validates_presence_of :title - before_save :set_key + before_save :set_key, :update_status after_save :save_bulletin_links after_save :save_bulletin_files @@ -79,17 +82,6 @@ class Bulletin end - def status - case self.is_checked - when nil - I18n.t('announcement.bulletin.fact_check_pending') - when true - I18n.t('announcement.bulletin.fact_check_pass') - when false - I18n.t('announcement.bulletin.fact_check_not_pass') - end - end - def is_expired? Date.today > self.deadline ? true : false rescue false #some dates might sat as nil so rescue false @@ -110,9 +102,13 @@ class Bulletin def is_checked? self.is_checked end - - def is_check_rejected? - self.is_checked == false + + def is_pending? + self.is_pending + end + + def is_rejected? + self.is_rejected end @@ -169,6 +165,18 @@ class Bulletin text.key = 'text' end end + + def update_status + if !self.is_pending && !self.is_checked + self.is_pending = false + self.is_rejected = true + self.is_checked = false + elsif self.is_checked + self.is_pending = false + self.is_rejected = false + self.is_checked = true + end + end end \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb index ca80512e..7db70593 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb @@ -10,14 +10,22 @@ <% if bulletin.is_hidden? %> <%= t(:hidden) %> <% end %> - <%= bulletin.status %> + <% if bulletin.is_pending? %> + <%= t(:pending) %> + <% end %> + <% if bulletin.is_checked? %> + <%= t(:checked) %> + <% end %> + <% if bulletin.is_rejected? %> + <%= t(:rejected) %> + <% end %> <%= bulletin.bulletin_category.i18n_variable[I18n.locale] %> <%= link_to bulletin.title[I18n.locale], panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category.id) rescue ''%>
    <% end %> -
    \ No newline at end of file +
    + + +asdaskljh;ufdshu;fdsijo;dklsfij;jsfijsflijwjiijpv'jpifjpifwepjif diff --git a/app/views/kaminari/_first_page.html.erb b/app/views/kaminari/_first_page.html.erb index f147502f..4c1c33a3 100644 --- a/app/views/kaminari/_first_page.html.erb +++ b/app/views/kaminari/_first_page.html.erb @@ -6,6 +6,6 @@ per_page: number of items to fetch per page remote: data-remote -%> - +
  • <%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote %> - +
  • diff --git a/app/views/kaminari/_gap.html.erb b/app/views/kaminari/_gap.html.erb index d1800e18..8807aafe 100644 --- a/app/views/kaminari/_gap.html.erb +++ b/app/views/kaminari/_gap.html.erb @@ -5,4 +5,4 @@ per_page: number of items to fetch per page remote: data-remote -%> -<%= raw(t 'views.pagination.truncate') %> +
  • <%= raw(t 'views.pagination.truncate') %>
  • diff --git a/app/views/kaminari/_last_page.html.erb b/app/views/kaminari/_last_page.html.erb index 73ce4d4a..5b3277b4 100644 --- a/app/views/kaminari/_last_page.html.erb +++ b/app/views/kaminari/_last_page.html.erb @@ -6,6 +6,6 @@ per_page: number of items to fetch per page remote: data-remote -%> - +
  • <%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote} %> - +
  • diff --git a/app/views/kaminari/_next_page.html.erb b/app/views/kaminari/_next_page.html.erb index 19008755..673ba771 100644 --- a/app/views/kaminari/_next_page.html.erb +++ b/app/views/kaminari/_next_page.html.erb @@ -6,6 +6,6 @@ per_page: number of items to fetch per page remote: data-remote -%> - + diff --git a/app/views/kaminari/_page.html.erb b/app/views/kaminari/_page.html.erb index 1683069e..67cfaf24 100644 --- a/app/views/kaminari/_page.html.erb +++ b/app/views/kaminari/_page.html.erb @@ -7,6 +7,10 @@ per_page: number of items to fetch per page remote: data-remote -%> - - <%= link_to_unless page.current?, page, url, opts = {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %> - +
  • + <% if page.current? %> + <%= page %> + <% else %> + <%= link_to page, url, opts = {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %> + <% end %> +
  • diff --git a/app/views/kaminari/_paginator.html.erb b/app/views/kaminari/_paginator.html.erb index aad45ef4..8871496f 100644 --- a/app/views/kaminari/_paginator.html.erb +++ b/app/views/kaminari/_paginator.html.erb @@ -7,7 +7,8 @@ paginator: the paginator that renders the pagination tags inside -%> <%= paginator.render do -%> - + + <% end -%> diff --git a/app/views/kaminari/_prev_page.html.erb b/app/views/kaminari/_prev_page.html.erb index 4e94c8a6..0d1d2b22 100644 --- a/app/views/kaminari/_prev_page.html.erb +++ b/app/views/kaminari/_prev_page.html.erb @@ -6,6 +6,6 @@ per_page: number of items to fetch per page remote: data-remote -%> - + diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/setting.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/setting.html.erb index 7303b705..2325082f 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/setting.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/fact_checks/setting.html.erb @@ -24,7 +24,9 @@ <%= content_tag :div do -%> <% form_tag :action => "update_setting" do %> <%= render :partial => "privilege_user", :locals => {:users => @users_array} %> - <%= submit_tag "Update" %> +
    + <%= submit_tag "Update", :class => 'btn' %> +
    <% end -%> <% end -%> From 8041452be50fb91593ac67b41cfc6203c5cf0da8 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Tue, 24 Apr 2012 11:05:01 +0800 Subject: [PATCH 037/298] Fix for translation in sort headers for announcement --- .../back_end/bulletins/_sort_headers.html.erb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_sort_headers.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_sort_headers.html.erb index 6d6c54e0..b48cca39 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_sort_headers.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_sort_headers.html.erb @@ -6,25 +6,25 @@ - <%= link_to t('bulletin.status') + content_tag(:b, nil, :class => is_sort?('status')), panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('status'))), :class => 'js_history' %> + <%= link_to (t('bulletin.status') + content_tag(:b, nil, :class => is_sort?('status'))).html_safe, panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('status'))), :class => 'js_history' %> - <%= link_to t('bulletin.category') + content_tag(:b, nil, :class => is_sort?('category')), panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('category'))), :class => 'js_history' %> + <%= link_to (t('bulletin.category') + content_tag(:b, nil, :class => is_sort?('category'))).html_safe, panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('category'))), :class => 'js_history' %> - <%= link_to t('bulletin.title') + content_tag(:b, nil, :class => is_sort?('title')), panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('title'))), :class => 'js_history' %> + <%= link_to (t('bulletin.title') + content_tag(:b, nil, :class => is_sort?('title'))).html_safe, panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('title'))), :class => 'js_history' %> - <%= link_to t('bulletin.start_date') + content_tag(:b, nil, :class => is_sort?('postdate')), panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('postdate'))), :class => 'js_history' %> + <%= link_to (t('bulletin.start_date') + content_tag(:b, nil, :class => is_sort?('postdate'))).html_safe, panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('postdate'))), :class => 'js_history' %> - <%= link_to t('bulletin.end_date') + content_tag(:b, nil, :class => is_sort?('deadline')), panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('deadline'))), :class => 'js_history' %> + <%= link_to (t('bulletin.end_date') + content_tag(:b, nil, :class => is_sort?('deadline'))).html_safe, panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('deadline'))), :class => 'js_history' %> - <%= link_to t('bulletin.tags') + content_tag(:b, nil, :class => is_sort?('tags')), panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('tags'))), :class => 'js_history' %> + <%= link_to (t('bulletin.tags') + content_tag(:b, nil, :class => is_sort?('tags'))).html_safe, panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('tags'))), :class => 'js_history' %> - <%= link_to t('bulletin.last_modified') + content_tag(:b, nil, :class => is_sort?('update_user_id')), panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('update_user_id'))), :class => 'js_history' %> + <%= link_to (t('bulletin.last_modified') + content_tag(:b, nil, :class => is_sort?('update_user_id'))).html_safe, panel_announcement_back_end_bulletins_path({:filter => @filter}.merge(sortable('update_user_id'))), :class => 'js_history' %> From f05b7db73a629e9295a01980be9724c02e4132b9 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Tue, 24 Apr 2012 11:26:36 +0800 Subject: [PATCH 038/298] Fix for parser sub_menu Add style to the sub_menu --- lib/parsers/parser_common.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/parsers/parser_common.rb b/lib/parsers/parser_common.rb index 94a968c4..403c05e4 100644 --- a/lib/parsers/parser_common.rb +++ b/lib/parsers/parser_common.rb @@ -110,13 +110,17 @@ module ParserCommon def parse_sub_menus(body = nil, page = nil, id = nil) body.css('sub_menu').each do |sub_menu| res = '' - res << "
      " + res << "
      " + res << "

      #{page.i18n_variable[I18n.locale]}

      " + res << "" + res << "" + res << "
      " fragment = Nokogiri::HTML::DocumentFragment.new(body, res) sub_menu.swap(fragment) end From b80339d7046b58226c8d26b5f0aa6dc5ddd194d1 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Tue, 24 Apr 2012 11:35:50 +0800 Subject: [PATCH 039/298] Ray's changes for image upload component and sign-in page --- .../javascripts/inc/jquery.imagesloaded.js | 112 ++++++++++++++++++ .../inc/permission-checkbox.css.erb | 79 ++++++++++++ app/assets/stylesheets/new_admin.css.erb | 2 +- app/assets/stylesheets/style.css.erb | 4 +- app/views/admin/ad_images/_form.html.erb | 56 +++++---- app/views/devise/sessions/new.html.erb | 2 +- 6 files changed, 223 insertions(+), 32 deletions(-) create mode 100644 app/assets/javascripts/inc/jquery.imagesloaded.js create mode 100644 app/assets/stylesheets/inc/permission-checkbox.css.erb diff --git a/app/assets/javascripts/inc/jquery.imagesloaded.js b/app/assets/javascripts/inc/jquery.imagesloaded.js new file mode 100644 index 00000000..a488974d --- /dev/null +++ b/app/assets/javascripts/inc/jquery.imagesloaded.js @@ -0,0 +1,112 @@ +/*! + * jQuery imagesLoaded plugin v2.0.1 + * http://github.com/desandro/imagesloaded + * + * MIT License. by Paul Irish et al. + */ + +/*jshint curly: true, eqeqeq: true, noempty: true, strict: true, undef: true, browser: true */ +/*global jQuery: false */ + +;(function($, undefined) { +'use strict'; + +// blank image data-uri bypasses webkit log warning (thx doug jones) +var BLANK = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=='; + +$.fn.imagesLoaded = function( callback ) { + var $this = this, + deferred = $.isFunction($.Deferred) ? $.Deferred() : 0, + hasNotify = $.isFunction(deferred.notify), + $images = $this.find('img').add( $this.filter('img') ), + loaded = [], + proper = [], + broken = []; + + function doneLoading() { + var $proper = $(proper), + $broken = $(broken); + + if ( deferred ) { + if ( broken.length ) { + deferred.reject( $images, $proper, $broken ); + } else { + deferred.resolve( $images ); + } + } + + if ( $.isFunction( callback ) ) { + callback.call( $this, $images, $proper, $broken ); + } + } + + function imgLoaded( img, isBroken ) { + // don't proceed if BLANK image, or image is already loaded + if ( img.src === BLANK || $.inArray( img, loaded ) !== -1 ) { + return; + } + + // store element in loaded images array + loaded.push( img ); + + // keep track of broken and properly loaded images + if ( isBroken ) { + broken.push( img ); + } else { + proper.push( img ); + } + + // cache image and its state for future calls + $.data( img, 'imagesLoaded', { isBroken: isBroken, src: img.src } ); + + // trigger deferred progress method if present + if ( hasNotify ) { + deferred.notifyWith( $(img), [ isBroken, $images, $(proper), $(broken) ] ); + } + + // call doneLoading and clean listeners if all images are loaded + if ( $images.length === loaded.length ){ + setTimeout( doneLoading ); + $images.unbind( '.imagesLoaded' ); + } + } + + // if no images, trigger immediately + if ( !$images.length ) { + doneLoading(); + } else { + $images.bind( 'load.imagesLoaded error.imagesLoaded', function( event ){ + // trigger imgLoaded + imgLoaded( event.target, event.type === 'error' ); + }).each( function( i, el ) { + var src = el.src; + + // find out if this image has been already checked for status + // if it was, and src has not changed, call imgLoaded on it + var cached = $.data( el, 'imagesLoaded' ); + if ( cached && cached.src === src ) { + imgLoaded( el, cached.isBroken ); + return; + } + + // if complete is true and browser supports natural sizes, try + // to check for image status manually + if ( el.complete && el.naturalWidth !== undefined ) { + imgLoaded( el, el.naturalWidth === 0 || el.naturalHeight === 0 ); + return; + } + + // cached images don't fire load sometimes, so we reset src, but only when + // dealing with IE, or image is complete (loaded) and failed manual check + // webkit hack from http://groups.google.com/group/jquery-dev/browse_thread/thread/eee6ab7b2da50e1f + if ( el.readyState || el.complete ) { + el.src = BLANK; + el.src = src; + } + }); + } + + return deferred ? deferred.promise( $this ) : $this; +}; + +})(jQuery); \ No newline at end of file diff --git a/app/assets/stylesheets/inc/permission-checkbox.css.erb b/app/assets/stylesheets/inc/permission-checkbox.css.erb new file mode 100644 index 00000000..9e61df20 --- /dev/null +++ b/app/assets/stylesheets/inc/permission-checkbox.css.erb @@ -0,0 +1,79 @@ +/*permission-checkbox*/ + +.checkblock { + display: inline-block; + float: left; + width: 200px; +} +.check[type="checkbox"]{ + display:none; +} +.checkbox{ + padding: 5px; + margin: 5px 5px 10px; + display: inline-block; + color:#777777; + text-shadow: 0 1px 0px rgba(255,255,255,.4); + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + height: 30px; + position: relative; + cursor: pointer; + background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf) ); + background:-moz-linear-gradient( center top, #ededed 5%, #dfdfdf 100% ); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf'); + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); + -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); +} +.checkbox .check-icon { + display: none; + position: absolute; + width: 32px; + height: 32px; + background: url(<%= asset_path 'check.png' %>) no-repeat left top; + right: -10px; + top: 15px; +} +.checkbox .member-name { + cursor: pointer; + font-family: helvetica; + font-size: 12px; + line-height: 30px; + padding: 0 10px 0 40px; + color: #333333; + display: inline-block; + margin-bottom: 0; +} +.member-avatar { + position: absolute; + width: 34px; + height: 34px; + overflow: hidden; + margin-top: -2px; +} +img.member-img { + max-width: 100%; +} +.checked .check-icon { + display: block; +} +.popover-inner { + width: auto; + display: inline-block; + text-align: center; +} +.popover-title { + display: block; + font-size: 12px; + font-weight: normal; + padding: 3px 10px; +} +.popover-content { + padding: 3px 10px; + color: #898989; +} +.popover-content p { + font-size: 12px; +} \ No newline at end of file diff --git a/app/assets/stylesheets/new_admin.css.erb b/app/assets/stylesheets/new_admin.css.erb index 4b004d3d..99542101 100644 --- a/app/assets/stylesheets/new_admin.css.erb +++ b/app/assets/stylesheets/new_admin.css.erb @@ -5,8 +5,8 @@ *= require reset *= require_self *= require message - *= require style *= require bootstrap + *= require style *= require bootstrap-orbit *= require list *= require widgets diff --git a/app/assets/stylesheets/style.css.erb b/app/assets/stylesheets/style.css.erb index c08a23e4..e0a704ef 100644 --- a/app/assets/stylesheets/style.css.erb +++ b/app/assets/stylesheets/style.css.erb @@ -565,7 +565,9 @@ padding: 5px; } .popover-content { - border-radius: 3px; + -webkit-border-radius: 0 0 3px 3px; + -moz-border-radius: 0 0 3px 3px; + border-radius: 0 0 3px 3px; padding: 5px; } .popover-title { diff --git a/app/views/admin/ad_images/_form.html.erb b/app/views/admin/ad_images/_form.html.erb index 075f01b4..d38a86a6 100644 --- a/app/views/admin/ad_images/_form.html.erb +++ b/app/views/admin/ad_images/_form.html.erb @@ -6,6 +6,7 @@ <%= javascript_include_tag "lib/date.format" %> <%= javascript_include_tag "inc/modal-preview" %> <%= javascript_include_tag "/static/jquery.cycle.all.latest.js" %> + <%= javascript_include_tag "inc/jquery.imagesloaded" %> <% end %> @@ -79,27 +80,29 @@ <%= image_tag @ad_image.file,:width=> "456",:height=>'700' rescue ''%> + $('.upload-picture').find('img').imagesLoaded(function(){; + var picH = $('.upload-picture').width()/$('.upload-picture').find('img').width()*$('.upload-picture').find('img').height(); + var imgMarginTop = ($('.upload-picture').height()-picH)/2; + var d = $('.upload-picture').height(); + if(imgMarginTop>0){ + imgMarginTop = 0; + d = picH; + $('.upload-picture').css({height:d}) + } + $('.upload-picture').find('img').css({marginTop:imgMarginTop}) + $('.upload-picture').each(function (i){ + $(this).mouseenter(function(){ + var h= picH; + $(this).stop().animate({height:h}, 500); + $(this).find('img').stop().animate({marginTop:0}, 500); + }); + $(this).mouseleave(function(){ + $(this).stop().animate({height:d}, 500); + $(this).find('img').stop().animate({marginTop:imgMarginTop}, 500); + }); + }); + }); + 此區塊圖片尺寸請使用580px × 225px
      @@ -181,16 +184,11 @@
      - - - + <%= link_to t("modal.preview"), admin_realtime_preview_ad_banner_path(@ad_image.ad_banner.title) ,:class=>"preview_trigger btn btn-success" rescue nil%> + <%= f.submit t("submit"),:class=>"btn btn-primary" %> + <%= f.submit t("cancel"),:class=>"btn ",:type => 'reset' %>
      -
      - <%= link_to t("modal.preview"), admin_realtime_preview_ad_banner_path(@ad_image.ad_banner.title) ,:class=>"preview_trigger btn btn-success" rescue nil%> - <%= f.submit t("submit"),:class=>"btn btn-primary" %> - <%= f.submit t("cancel"),:class=>"btn ",:type => 'reset' %> -
      \ No newline at end of file diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb index 37f58994..29501fbf 100644 --- a/app/views/devise/sessions/new.html.erb +++ b/app/views/devise/sessions/new.html.erb @@ -5,7 +5,7 @@
    diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb index 5cc03143..b8aa5d2a 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb @@ -110,17 +110,17 @@ <% if is_manager? || @bulletin.bulletin_category.authed_users('fact_check').include?(current_user) || current_user.admin? %>
    - <%= f.label :fact_check_stat, t('announcement.bulletin.fact_check_stat') %> + <%= f.label :approval_stat, t('announcement.bulletin.approval_stat') %> <%= content_tag :label,:class => "radio inline" do -%> <%= f.radio_button :is_checked, true , {:class => 'privacy'} %> - <%= t('announcement.bulletin.fact_check_pass') %> + <%= t('announcement.bulletin.approval_pass') %> <% end -%> <%= content_tag :label,:class => "radio inline" do -%> <%= f.radio_button :is_checked, false, (!@bulletin.is_checked ? {:checked => true, :class => 'privacy'} : {})%> - <%= t('announcement.bulletin.fact_check_not_pass') %> + <%= t('announcement.bulletin.approval_not_pass') %> <% end -%>
    - <%= label :is_checked_false, t('announcement.bulletin.fact_check_not_pass_reason') %> + <%= label :is_checked_false, t('announcement.bulletin.approval_not_pass_reason') %> <%= f.text_field :not_checked_reason %>
    diff --git a/vendor/built_in_modules/announcement/config/locales/en.yml b/vendor/built_in_modules/announcement/config/locales/en.yml index 0d861af2..c4d0dcde 100644 --- a/vendor/built_in_modules/announcement/config/locales/en.yml +++ b/vendor/built_in_modules/announcement/config/locales/en.yml @@ -37,7 +37,18 @@ en: rejected: Rejected clear: Clear + hot: Hot + top: Top + hidden: Hidden + passed: Approved + pending: Pending + rejected: Rejected + clear: Clear + + announcement: + all_articles: List + add_new: Add sure?: Sure? campus_news: Campus News more: more+ @@ -49,14 +60,14 @@ 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_pending: 'Pending' - fact_check_pass: 'Pass' - fact_check_setting_window_title: 'Unit' + approval: Approval + approval_setting: Approval Setting + approval_stat: Fact Check Status + approval_not_pass: 'Not Pass' + approval_not_pass_reason: 'Reason' + approval_pending: 'Pending' + approval_pass: 'Pass' + approval_setting_window_title: 'Unit' # admin: # action: Action diff --git a/vendor/built_in_modules/announcement/config/locales/zh_tw.yml b/vendor/built_in_modules/announcement/config/locales/zh_tw.yml index 1d354f82..27e92e30 100644 --- a/vendor/built_in_modules/announcement/config/locales/zh_tw.yml +++ b/vendor/built_in_modules/announcement/config/locales/zh_tw.yml @@ -27,16 +27,16 @@ zh_tw: hot: 熱門 top: 置頂 hidden: 隱藏 - passed: 通過 - pending: 待審核 + passed: 審核通過 + pending: 待審查 rejected: 不通過 clear: 清除 quick_edit: 快速編輯 announcement: - add_new: 新增公告 - all_articles: 公告列表 + add_new: 新增 + all_articles: 列表 tags: 標籤 categories: 分類 status: 狀態 @@ -51,14 +51,14 @@ zh_tw: list_lower: 列表 title: 標題 postdate: 張貼日期 - fact_check: 公告審核 - fact_check_setting: 審核設定 - fact_check_stat: 審核狀況 - fact_check_pending: 待審核 - fact_check_not_pass: '不通過' - fact_check_pass: '通過' - fact_check_not_pass_reason: '不通過原因' - fact_check_setting_window_title: '單位' + approval: 公告審核 + approval_setting: 審核設定 + approval_stat: 審核狀況 + approval_pending: 待審核 + approval_not_pass: '不通過' + approval_pass: '通過' + approval_not_pass_reason: '不通過原因' + approval_setting_window_title: '單位' bulletin: last_modified: 最後修改於 diff --git a/vendor/built_in_modules/announcement/config/routes.rb b/vendor/built_in_modules/announcement/config/routes.rb index 048926cb..0d5e1b99 100644 --- a/vendor/built_in_modules/announcement/config/routes.rb +++ b/vendor/built_in_modules/announcement/config/routes.rb @@ -3,8 +3,8 @@ Rails.application.routes.draw do namespace :announcement do namespace :back_end do match 'public' => "announcements#public",:as => :public - match 'fact_check_setting' => "fact_checks#setting" ,:as => :fact_checks_setting - match 'update_setting' => "fact_checks#update_setting" ,:as => :fact_checks_update_setting + match 'approval_setting' => "approvals#setting" ,:as => :approval_setting + match 'update_setting' => "approvals#update_setting" ,:as => :approval_update_setting resources :bulletins do match "link_quick_add/:bulletin_id" => "bulletins#link_quick_add" ,:as => :link_quick_add From 330874439683018d38396228f0c0101210183215 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Tue, 24 Apr 2012 17:00:33 +0800 Subject: [PATCH 053/298] Fix side_bar after Matt's changes in translation --- app/views/layouts/_side_bar.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb index 887f09be..e740fe7b 100644 --- a/app/views/layouts/_side_bar.html.erb +++ b/app/views/layouts/_side_bar.html.erb @@ -2,14 +2,14 @@ <%#= link_to content_tag(:i, nil, :class => 'icons-purchase') + t('admin.purchase'), admin_purchases_path %> <%# end -%> -<%= content_tag :li, :class => active_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'fact_checks') do -%> +<%= content_tag :li, :class => active_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals') do -%> <%= link_to content_tag(:i, nil, :class => 'icons-announcement') + t('admin.announcement'), panel_announcement_back_end_bulletins_path %> - <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'fact_checks')) do -%> + <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals')) do -%> <%= content_tag :li, link_to(t('announcement.all_articles'), panel_announcement_back_end_bulletins_path), :class => active_for_action('bulletins', 'index') %> <%= content_tag :li, link_to(t('announcement.add_new'), new_panel_announcement_back_end_bulletin_path), :class => active_for_action('bulletins', 'new') %> <%= content_tag :li, link_to(t('announcement.categories'), panel_announcement_back_end_bulletin_categorys_path), :class => active_for_action('bulletin_categorys', 'index') %> <%= content_tag :li, link_to(t('announcement.tags'), panel_announcement_back_end_tags_path), :class => active_for_action('/panel/announcement/back_end/tags', 'index') %> - <%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_announcement_back_end_approval_setting_path), :class => active_for_action('fact_checks', 'setting') if (is_manager? rescue nil) %> + <%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_announcement_back_end_approval_setting_path), :class => active_for_action('approvals', 'setting') if (is_manager? rescue nil) %> <% end -%> <% end -%> From dc07964bc3a82121e290b5771470eb44bc42b1b6 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Tue, 24 Apr 2012 17:10:23 +0800 Subject: [PATCH 054/298] Fix js bug after Matt's changes in 'approval' --- .../panel/announcement/back_end/approvals/setting.html.erb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/setting.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/setting.html.erb index d1cf86ed..8bb86ad0 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/setting.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/setting.html.erb @@ -2,9 +2,8 @@ <%= stylesheet_link_tag "inc/permission-checkbox" %> <% end %> <% content_for :page_specific_javascript do %> - <%= javascript_include_tag "bootstrap" %> - <%#= javascript_include_tag "inc/permission-checkbox" %> - <%#= javascript_include_tag "inc/search" %> + <%= javascript_include_tag "inc/permission-checkbox" %> + <%= javascript_include_tag "inc/search" %> <% end %> <%#= label_tag :fact_check_setting, t("announcement.bulletin.fact_check_setting") %> <%= form_tag('', :remote => true) %> From 3f2643bb66554dc586565ff5e1ff52d6c3f6d81b Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Wed, 25 Apr 2012 10:55:49 +0800 Subject: [PATCH 055/298] fix useless notice at login --- app/views/devise/sessions/new.html.erb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb index 29501fbf..96840bf5 100644 --- a/app/views/devise/sessions/new.html.erb +++ b/app/views/devise/sessions/new.html.erb @@ -3,9 +3,11 @@

    <%= t(:login) %>