From e26c5529df63d61941488cfb7b43e303236e7797 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Tue, 7 Feb 2012 11:18:54 +0800 Subject: [PATCH 1/4] Include therubyracer in Gemfile --- Gemfile | 2 +- Gemfile.lock | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 74b66c7d..508949ed 100644 --- a/Gemfile +++ b/Gemfile @@ -17,7 +17,7 @@ gem 'ruby-debug19' gem 'rubyzip' gem 'sinatra' gem 'sprockets' -# gem 'therubyracer' # For linux +gem 'therubyracer' # For linux # Gems used only for assets and not required # in production environments by default. diff --git a/Gemfile.lock b/Gemfile.lock index 7b98907f..a3d530ca 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -78,6 +78,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.0) @@ -173,6 +174,8 @@ GEM rack (~> 1.0) tilt (~> 1.1, != 1.3.0) subexec (0.2.1) + therubyracer (0.9.9) + libv8 (~> 3.3.10) thor (0.14.6) tilt (1.3.3) treetop (1.4.10) @@ -226,5 +229,6 @@ DEPENDENCIES sinatra spork sprockets + therubyracer uglifier watchr From 338d18e909b08707a12a63078bf25bc2fa29a5af Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Feb 2012 14:58:59 +0800 Subject: [PATCH 2/4] announcement path error --- Gemfile | 6 ++++- Gemfile.lock | 9 ++++--- Rakefile | 1 + app/controllers/pages_controller.rb | 2 +- app/models/design/design.rb | 2 +- .../front_end/bulletins_controller.rb | 2 +- .../announcement/app/models/bulletin.rb | 2 +- .../back_end/bulletins/show.html.erb | 12 ++++----- .../front_end/bulletins/index.html.erb | 2 ++ .../widget/bulletins/index.html.erb | 26 +++++++++++++++++-- .../announcement/config/routes.rb | 8 +++--- 11 files changed, 52 insertions(+), 20 deletions(-) diff --git a/Gemfile b/Gemfile index 508949ed..408151ea 100644 --- a/Gemfile +++ b/Gemfile @@ -9,6 +9,9 @@ gem 'devise' gem 'exception_notification' # Send error trace gem 'execjs' gem 'jquery-rails' + +gem 'kaminari' + gem 'mini_magick' gem 'mongoid' gem 'radius' @@ -17,7 +20,8 @@ gem 'ruby-debug19' gem 'rubyzip' gem 'sinatra' gem 'sprockets' -gem 'therubyracer' # For linux +#gem 'therubyracer' # For linux +#gem 'libv8', '3.3.10.4' # Gems used only for assets and not required # in production environments by default. diff --git a/Gemfile.lock b/Gemfile.lock index a3d530ca..ce0d8d6d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -78,7 +78,10 @@ GEM railties (~> 3.0) thor (~> 0.14) json (1.6.5) - libv8 (3.3.10.4) + kaminari (0.13.0) + actionpack (>= 3.0.0) + activesupport (>= 3.0.0) + railties (>= 3.0.0) linecache19 (0.5.12) ruby_core_source (>= 0.1.4) mail (2.3.0) @@ -174,8 +177,6 @@ GEM rack (~> 1.0) tilt (~> 1.1, != 1.3.0) subexec (0.2.1) - therubyracer (0.9.9) - libv8 (~> 3.3.10) thor (0.14.6) tilt (1.3.3) treetop (1.4.10) @@ -214,6 +215,7 @@ DEPENDENCIES execjs factory_girl_rails jquery-rails + kaminari mini_magick mongoid radius @@ -229,6 +231,5 @@ DEPENDENCIES sinatra spork sprockets - therubyracer uglifier watchr diff --git a/Rakefile b/Rakefile index 53b734fe..2036d04c 100644 --- a/Rakefile +++ b/Rakefile @@ -2,6 +2,7 @@ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require File.expand_path('../config/application', __FILE__) +require 'rake/dsl_definition' require 'rake' PrototypeR4::Application.load_tasks diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index a25cb427..485f182c 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -37,7 +37,7 @@ class PagesController < ApplicationController protected def get_item - module_app = ModuleApp.first(:conditions => {:title => params[:app_name]}) + module_app = ModuleApp.first(:conditions => {:key => params[:app_name]}) @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action]}) end diff --git a/app/models/design/design.rb b/app/models/design/design.rb index c909bbcb..3a97c9ed 100644 --- a/app/models/design/design.rb +++ b/app/models/design/design.rb @@ -20,7 +20,7 @@ class Design validates_presence_of :title validates_presence_of :author - after_save :parse_css_for_images + # after_save :parse_css_for_images def new_files=(*attrs) attrs[0].map do |key,items_ary| #Loop by JSs,Themes,Imgs 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 537a7e19..28a3ec5b 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 @@ -12,7 +12,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < ObitWidgetController date_now = Time.now - @bulletins = Bulletin.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate) + @bulletins = Bulletin.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(1) get_categorys end diff --git a/vendor/built_in_modules/announcement/app/models/bulletin.rb b/vendor/built_in_modules/announcement/app/models/bulletin.rb index c65e65f7..4b621faf 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin.rb @@ -72,7 +72,7 @@ class Bulletin # find(:all, :conditions => {:postdate => {"$lte" => Date.today}, deadline: nil} ).desc( :is_top, :postdate) # where( :postdate.lte => date_now ).where( :deadline => nil ).desc(:is_top, :postdate) # any_of({ :title => "test" },{:deadline => nil, :title => "123"}) - any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).limit(5) + any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate) end diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/show.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/show.html.erb index 87d08897..c3ba2c09 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/show.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/show.html.erb @@ -33,18 +33,18 @@
  • + <%= t('announcement.link') %> + <% @bulletin.bulletin_links.each do | blink | %> + <%= link_to blink.name, blink.url, :target => '_blank' %> + <% end %> +
  • +
  • <%= t('announcement.file') %> <% @bulletin.bulletin_files.each do | bfile | %> <%= link_to bfile.filetitle, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %> <% end %>
  • - <% if @bulletin.url? %> - <%= t('announcement.url') %> - <%= link_to @bulletin.url, @bulletin.url, :target => '_blank' %> - <% end %> -
  • -
  • <%= t('announcement.張貼者') %> <%= User.find(@bulletin.create_user_id).name %>
  • diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb index d6340a85..5717b071 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/index.html.erb @@ -2,6 +2,8 @@ <%= flash_messages %> +<%= paginate @bulletins %> +

    <%= t('bulletin.list_announcement') %>

    diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/index.html.erb index 6d19dfd3..2c4cd153 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/index.html.erb @@ -1,13 +1,18 @@ +<% if @bulletin and !@bulletin.nil? %> +
    -

    <%= @bulletin.title %>

    <%= @bulletin.subtitle %>

    <%= link_to "read more >",panel_announcement_front_end_bulletin_path(@bulletin.id) %> read more >
    +<% end %> + +<% if @bulletins and !@bulletins.nil? %> +

    news

      @@ -17,4 +22,21 @@
    <%= link_to "read more >",panel_announcement_front_end_bulletins_path(), :class => "btn" %> read more > -
    \ No newline at end of file + + +
    +

    news

    +
      + <% @bulletins.each do |post| %> +
    • + <%= image_tag(post.image.url, :size => "160x140") if post.image.file %> +

      <%= post.title %>

      + <%= post.subtitle %> +
    • + <% end %> +
    +<%= link_to "read more >",panel_announcement_front_end_bulletins_path(), :class => "btn" %> +read more > +
    + +<% end %> diff --git a/vendor/built_in_modules/announcement/config/routes.rb b/vendor/built_in_modules/announcement/config/routes.rb index fa8b6659..09ada425 100644 --- a/vendor/built_in_modules/announcement/config/routes.rb +++ b/vendor/built_in_modules/announcement/config/routes.rb @@ -5,17 +5,19 @@ Rails.application.routes.draw do namespace :back_end do root :to => "bulletins#index" resources :bulletins - resources :bulletin_categorys, :controller => 'bulletin_categorys' do - match "quick_edit/:bulletin_category_id" => "bulletin_categorys#quick_edit" ,:as => :quick_edit - end + resources :bulletin_categorys, :controller => 'bulletin_categorys' do + match "quick_edit/:bulletin_category_id" => "bulletin_categorys#quick_edit" ,:as => :quick_edit + end end namespace :front_end do root :to => "bulletins#index" resources :bulletins + match "show/:id" => "bulletins#show" ,:as => :bulletin end namespace :widget do root :to => "bulletins#index" end end end + match "/appfront/*path" => redirect("/panel/*path") end From e638c1c7c3895bb705abf98dce882374a4299b5e Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Thu, 9 Feb 2012 15:07:43 +0800 Subject: [PATCH 3/4] Change announcement route --- vendor/built_in_modules/announcement/config/routes.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/vendor/built_in_modules/announcement/config/routes.rb b/vendor/built_in_modules/announcement/config/routes.rb index 09ada425..05554bab 100644 --- a/vendor/built_in_modules/announcement/config/routes.rb +++ b/vendor/built_in_modules/announcement/config/routes.rb @@ -12,7 +12,6 @@ Rails.application.routes.draw do namespace :front_end do root :to => "bulletins#index" resources :bulletins - match "show/:id" => "bulletins#show" ,:as => :bulletin end namespace :widget do root :to => "bulletins#index" From dea9783b939d3f76f0e61714a04d70b76a5da385 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 13 Feb 2012 16:57:56 +0800 Subject: [PATCH 4/4] edit announcement widget --- .../widget/bulletins/index.html.erb | 51 ++++++------------- 1 file changed, 16 insertions(+), 35 deletions(-) diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/index.html.erb index 2c4cd153..52255b2a 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/index.html.erb @@ -1,42 +1,23 @@ - - -<% if @bulletin and !@bulletin.nil? %> - -
    -

    <%= @bulletin.title %>

    -

    <%= @bulletin.subtitle %>

    - <%= link_to "read more >",panel_announcement_front_end_bulletin_path(@bulletin.id) %> - read more > -
    - -<% end %> +<% # encoding: utf-8 %> <% if @bulletins and !@bulletins.nil? %> -
    -

    news

    -
      - <% @bulletins.each do |post| %> -
    • <%= post.postdate.to_s.gsub("-", "") %><%= link_to post.title,panel_announcement_front_end_bulletin_path(post) %>
    • - <% end %> -
    -<%= link_to "read more >",panel_announcement_front_end_bulletins_path(), :class => "btn" %> -read more > +
    +
    +

    <%= t('焦點新聞')%>

    + <%= link_to "more+",panel_announcement_front_end_bulletins_path(), :class => "topic_note" %> +
      + <% @bulletins.each do |post| %> +
    • +
      <%= image_tag(post.image.url, :size => "290x130") if post.image.file %>
      +

      <%= post.title %>

      +

      <%= post.subtitle %>

      +
    • + <% end %> +
    - -
    -

    news

    -
      - <% @bulletins.each do |post| %> -
    • - <%= image_tag(post.image.url, :size => "160x140") if post.image.file %> -

      <%= post.title %>

      - <%= post.subtitle %> -
    • - <% end %> -
    -<%= link_to "read more >",panel_announcement_front_end_bulletins_path(), :class => "btn" %> -read more >
    <% end %> + +