From 964d7b6054fd71d8def081c4d330ad386adbd249 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Feb 2012 14:58:59 +0800 Subject: [PATCH] announcement path error --- Gemfile | 6 ++++- Gemfile.lock | 9 ++++--- Rakefile | 1 + 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 +++--- 10 files changed, 51 insertions(+), 19 deletions(-) diff --git a/Gemfile b/Gemfile index 508949ed6..408151ead 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 a3d530ca9..ce0d8d6df 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 53b734fe1..2036d04ca 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/models/design/design.rb b/app/models/design/design.rb index c909bbcbc..3a97c9ed7 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 537a7e195..28a3ec5b9 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 c65e65f73..4b621fafc 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 87d08897a..c3ba2c09d 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 d6340a85d..5717b0710 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 6d19dfd33..2c4cd1533 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

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

    news

    + +<%= 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 fa8b66595..09ada4259 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