From 21bf3a0ccd99eea0881171ff06f568e965fa050e Mon Sep 17 00:00:00 2001 From: iCross Date: Fri, 24 May 2013 22:37:40 +0800 Subject: [PATCH] standalone css and icon --- app/assets/images/result.png | Bin 0 -> 524 bytes app/assets/images/write.png | Bin 0 -> 738 bytes app/assets/stylesheets/standalone.css | 2 +- patch/impressionist_delayed.diff | 83 ++++++++++++++++++ .../survey/app/models/survey.rb | 16 +++- .../survey/config/locales/zh_tw.yml | 1 + vendor/built_in_modules/survey/init.rb | 5 +- 7 files changed, 103 insertions(+), 4 deletions(-) create mode 100644 app/assets/images/result.png create mode 100644 app/assets/images/write.png create mode 100644 patch/impressionist_delayed.diff diff --git a/app/assets/images/result.png b/app/assets/images/result.png new file mode 100644 index 0000000000000000000000000000000000000000..ff6c475bdc37a4ec9f14312b7c86f4c1db095baf GIT binary patch literal 524 zcmV+n0`vWeP)X)>i_@& zVo5|nR5*>TR5@-0F$^OC_xbKVJE?szh0dAH1_82D3~WoHC5kd1j|blQjdM=h3IP8P zC<&y)2@nX-*Yt}-5V9!JVnE2e^FQ`p86^lLBUeF?AdBB{(+nMM=S$GS~ESy%o(~QmOWke&PxUnMGs0Le>oc literal 0 HcmV?d00001 diff --git a/app/assets/images/write.png b/app/assets/images/write.png new file mode 100644 index 0000000000000000000000000000000000000000..fb9ef0eaa5a2f7e6ec2128b8c59c834f07911fe1 GIT binary patch literal 738 zcmV<80v-K{P)X)>i_@( zI7vi7R5*=&ls#)!K@f$XgDZ(?RIm>cNYuilv$8Y!0XBk_kU+3dD2(fCn$3F-ea+I@7;V(^S<2OIXmZ^nbF$X8o(1^1rP_vDc~0HY}fa1 zz#HHpKtG1^kY-nU`Bm^>80DgycMYzC7 z*hc80@w#B%Xc_!FwQc^3bppu76H=+rfb0MSA+QSp>lbhmaU8s0SeKbcET^1XRPLG} z>;b|9IOE}_(6nVR7Lw%!;1gyswQXBpuVU1*Qg#cN!N$Qv@DG>(7Qv*Pb5PlBMuFJ_ zw)e5^Igzz4w+u7FxTx7fZUA%j11UFoz$k_G;6qk`?NY+t1kF{g0OEFPauamJ zis~Hehwy1Cdn94lkUiIvGD6~`%~DX_H?9Mx_oH8E?ufU*60n_`+=O(hXmii-Sok~E z2aCzVl1<68?)7l!DJ~ZblXBDU=(loJkHA-vE?_Q!zX*OB&8mzNeV;}xjo~OpDd(nt zh5j@$&H-N$XE3Y4%aLJ#jduqR57UsMl^!799}KIr>;Lha+5mJ>vJ{BLFt(wS9hHs9 z9(p$RiA`$ySsrb{Ry8<*{Mfu61QMC*D%pz_7P?#c65RrT&s+~-2 z+dc t(:need_home) +@@ -18,7 +18,7 @@ class PagesController < ApplicationController + #begin + @item = Item.first(:conditions => {:path => params[:page_name]}) + if @item && @item.is_published && (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s)) +- impressionist(@item) ++ delayed_impressionist(@item) + case @item.class.to_s + when 'Page' + render_page unless save_from_no_lang_for_page +diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb +index e20a0c2..b4aa12b 100644 +--- a/app/helpers/application_helper.rb ++++ b/app/helpers/application_helper.rb +@@ -278,4 +278,8 @@ module ApplicationHelper + end + end + ++ def delayed_impressionist(object) ++ Resque.enqueue_at(1.minute.from_now,DelayedImpressionist,object) ++ end ++ + end +diff --git a/app/jobs/delayed_impressionist.rb b/app/jobs/delayed_impressionist.rb +new file mode 100644 +index 0000000..65a4a6d +--- /dev/null ++++ b/app/jobs/delayed_impressionist.rb +@@ -0,0 +1,7 @@ ++class DelayedImpressionist ++ @queue = :low ++ def self.perform(object) ++ impressionist(object) ++ true ++ end ++end +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 2fe0f71..72fe43b 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 +@@ -53,7 +53,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController + else + @bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num) + end +- impressionist(@tag) if @tag ++ delayed_impressionist(@tag) if @tag + end + + end +@@ -66,7 +66,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController + @bulletin = Bulletin.all.can_display.where(_id: params[:id]).first + if @bulletin and !@bulletin.disable? and !@bulletin.is_rejected + if @bulletin.enabled_for_lang(I18n.locale.to_s) +- impressionist(@bulletin) ++ delayed_impressionist(@bulletin) + get_categorys + else + render :text => "
#{t('sys.can_not_display_due_to_no_context')}
".html_safe +diff --git a/vendor/built_in_modules/page_content/app/controllers/panel/page_content/front_end/page_contexts_controller.rb b/vendor/built_in_modules/page_content/app/controllers/panel/page_content/front_end/page_contexts_controller.rb +index e1e98c7..90a079e 100644 +--- a/vendor/built_in_modules/page_content/app/controllers/panel/page_content/front_end/page_contexts_controller.rb ++++ b/vendor/built_in_modules/page_content/app/controllers/panel/page_content/front_end/page_contexts_controller.rb +@@ -8,7 +8,7 @@ class Panel::PageContent::FrontEnd::PageContextsController < OrbitWidgetControll + def index + # @page_context = PageContext.where("page_id" => params[:page_id], :archived => false) + @page_context = PageContext.first(conditions: { page_id: params[:page_id], :archived => false }) +- impressionist(@page_context) ++ delayed_impressionist(@page_context) + + respond_to do |format| + format.html # index.html.erb diff --git a/vendor/built_in_modules/survey/app/models/survey.rb b/vendor/built_in_modules/survey/app/models/survey.rb index 4767b2f2..13339c5a 100644 --- a/vendor/built_in_modules/survey/app/models/survey.rb +++ b/vendor/built_in_modules/survey/app/models/survey.rb @@ -48,7 +48,21 @@ class Survey end def result - I18n.t 'survey.view_result' + if ( self.result_type == Survey::ResultChart && Time.now > self.deadline ) || + ( self.result_type == Survey::ResultExtern && !self.extern_link.blank? ) || + ( self.result_type == Survey::ResultFile && self.upload_file? ) + ('').html_safe + else + '' + end + end + + def write + if Time.now < self.deadline + ('').html_safe + else + '' + end end def generate_chart_data diff --git a/vendor/built_in_modules/survey/config/locales/zh_tw.yml b/vendor/built_in_modules/survey/config/locales/zh_tw.yml index f58d3c97..60548081 100644 --- a/vendor/built_in_modules/survey/config/locales/zh_tw.yml +++ b/vendor/built_in_modules/survey/config/locales/zh_tw.yml @@ -46,6 +46,7 @@ zh_tw: default_widget: title: 問卷標題 time_range: 問卷期間 + write: 填問卷 result: 結果 frontend: diff --git a/vendor/built_in_modules/survey/init.rb b/vendor/built_in_modules/survey/init.rb index 6ba276d4..c4864de7 100644 --- a/vendor/built_in_modules/survey/init.rb +++ b/vendor/built_in_modules/survey/init.rb @@ -21,10 +21,11 @@ module Faq widgets do default_widget do enable ["typeA"] - query 'Survey.any_of( {deadline: nil,:postdate.lte => Time.now} , {:deadline.gte => Time.now, :postdate.lte => Time.now} )' + query 'Survey.any_of( {:postdate.lte => Time.now} )' link_field :title, {:method => 'panel_survey_front_end_survey_path',:args=>:self} - link_field :result, {:method => 'result_panel_survey_front_end_survey_path', :args=>:self} field :time_range + field :write + field :result link_to_more 'panel_survey_front_end_survey_path', :title_i18n=> 'faq.default_widget.to_more' end end