announcement path error
This commit is contained in:
parent
e26c5529df
commit
338d18e909
6
Gemfile
6
Gemfile
|
@ -9,6 +9,9 @@ gem 'devise'
|
||||||
gem 'exception_notification' # Send error trace
|
gem 'exception_notification' # Send error trace
|
||||||
gem 'execjs'
|
gem 'execjs'
|
||||||
gem 'jquery-rails'
|
gem 'jquery-rails'
|
||||||
|
|
||||||
|
gem 'kaminari'
|
||||||
|
|
||||||
gem 'mini_magick'
|
gem 'mini_magick'
|
||||||
gem 'mongoid'
|
gem 'mongoid'
|
||||||
gem 'radius'
|
gem 'radius'
|
||||||
|
@ -17,7 +20,8 @@ gem 'ruby-debug19'
|
||||||
gem 'rubyzip'
|
gem 'rubyzip'
|
||||||
gem 'sinatra'
|
gem 'sinatra'
|
||||||
gem 'sprockets'
|
gem 'sprockets'
|
||||||
gem 'therubyracer' # For linux
|
#gem 'therubyracer' # For linux
|
||||||
|
#gem 'libv8', '3.3.10.4'
|
||||||
|
|
||||||
# Gems used only for assets and not required
|
# Gems used only for assets and not required
|
||||||
# in production environments by default.
|
# in production environments by default.
|
||||||
|
|
|
@ -78,7 +78,10 @@ GEM
|
||||||
railties (~> 3.0)
|
railties (~> 3.0)
|
||||||
thor (~> 0.14)
|
thor (~> 0.14)
|
||||||
json (1.6.5)
|
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)
|
linecache19 (0.5.12)
|
||||||
ruby_core_source (>= 0.1.4)
|
ruby_core_source (>= 0.1.4)
|
||||||
mail (2.3.0)
|
mail (2.3.0)
|
||||||
|
@ -174,8 +177,6 @@ GEM
|
||||||
rack (~> 1.0)
|
rack (~> 1.0)
|
||||||
tilt (~> 1.1, != 1.3.0)
|
tilt (~> 1.1, != 1.3.0)
|
||||||
subexec (0.2.1)
|
subexec (0.2.1)
|
||||||
therubyracer (0.9.9)
|
|
||||||
libv8 (~> 3.3.10)
|
|
||||||
thor (0.14.6)
|
thor (0.14.6)
|
||||||
tilt (1.3.3)
|
tilt (1.3.3)
|
||||||
treetop (1.4.10)
|
treetop (1.4.10)
|
||||||
|
@ -214,6 +215,7 @@ DEPENDENCIES
|
||||||
execjs
|
execjs
|
||||||
factory_girl_rails
|
factory_girl_rails
|
||||||
jquery-rails
|
jquery-rails
|
||||||
|
kaminari
|
||||||
mini_magick
|
mini_magick
|
||||||
mongoid
|
mongoid
|
||||||
radius
|
radius
|
||||||
|
@ -229,6 +231,5 @@ DEPENDENCIES
|
||||||
sinatra
|
sinatra
|
||||||
spork
|
spork
|
||||||
sprockets
|
sprockets
|
||||||
therubyracer
|
|
||||||
uglifier
|
uglifier
|
||||||
watchr
|
watchr
|
||||||
|
|
1
Rakefile
1
Rakefile
|
@ -2,6 +2,7 @@
|
||||||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||||
|
|
||||||
require File.expand_path('../config/application', __FILE__)
|
require File.expand_path('../config/application', __FILE__)
|
||||||
|
require 'rake/dsl_definition'
|
||||||
require 'rake'
|
require 'rake'
|
||||||
|
|
||||||
PrototypeR4::Application.load_tasks
|
PrototypeR4::Application.load_tasks
|
||||||
|
|
|
@ -37,7 +37,7 @@ class PagesController < ApplicationController
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def get_item
|
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]})
|
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action]})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ class Design
|
||||||
validates_presence_of :title
|
validates_presence_of :title
|
||||||
validates_presence_of :author
|
validates_presence_of :author
|
||||||
|
|
||||||
after_save :parse_css_for_images
|
# after_save :parse_css_for_images
|
||||||
|
|
||||||
def new_files=(*attrs)
|
def new_files=(*attrs)
|
||||||
attrs[0].map do |key,items_ary| #Loop by JSs,Themes,Imgs
|
attrs[0].map do |key,items_ary| #Loop by JSs,Themes,Imgs
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < ObitWidgetController
|
||||||
|
|
||||||
date_now = Time.now
|
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
|
get_categorys
|
||||||
end
|
end
|
||||||
|
|
|
@ -72,7 +72,7 @@ class Bulletin
|
||||||
# find(:all, :conditions => {:postdate => {"$lte" => Date.today}, deadline: nil} ).desc( :is_top, :postdate)
|
# 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)
|
# where( :postdate.lte => date_now ).where( :deadline => nil ).desc(:is_top, :postdate)
|
||||||
# any_of({ :title => "test" },{:deadline => nil, :title => "123"})
|
# 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
|
end
|
||||||
|
|
|
@ -33,18 +33,18 @@
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<li>
|
<li>
|
||||||
|
<b><%= t('announcement.link') %></b>
|
||||||
|
<% @bulletin.bulletin_links.each do | blink | %>
|
||||||
|
<%= link_to blink.name, blink.url, :target => '_blank' %>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
<b><%= t('announcement.file') %></b>
|
<b><%= t('announcement.file') %></b>
|
||||||
<% @bulletin.bulletin_files.each do | bfile | %>
|
<% @bulletin.bulletin_files.each do | bfile | %>
|
||||||
<%= link_to bfile.filetitle, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
|
<%= link_to bfile.filetitle, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<% if @bulletin.url? %>
|
|
||||||
<b><%= t('announcement.url') %></b>
|
|
||||||
<%= link_to @bulletin.url, @bulletin.url, :target => '_blank' %>
|
|
||||||
<% end %>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<b><%= t('announcement.張貼者') %></b>
|
<b><%= t('announcement.張貼者') %></b>
|
||||||
<%= User.find(@bulletin.create_user_id).name %>
|
<%= User.find(@bulletin.create_user_id).name %>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
<%= flash_messages %>
|
<%= flash_messages %>
|
||||||
|
|
||||||
|
<%= paginate @bulletins %>
|
||||||
|
|
||||||
<h1><%= t('bulletin.list_announcement') %></h1>
|
<h1><%= t('bulletin.list_announcement') %></h1>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,18 @@
|
||||||
|
|
||||||
|
|
||||||
|
<% if @bulletin and !@bulletin.nil? %>
|
||||||
|
|
||||||
<div id="col1" class="col">
|
<div id="col1" class="col">
|
||||||
|
|
||||||
<h1 class="h1 ini_heading col_title"><%= @bulletin.title %></h1>
|
<h1 class="h1 ini_heading col_title"><%= @bulletin.title %></h1>
|
||||||
<p class="ini_txt"><%= @bulletin.subtitle %></p>
|
<p class="ini_txt"><%= @bulletin.subtitle %></p>
|
||||||
<%= link_to "read more >",panel_announcement_front_end_bulletin_path(@bulletin.id) %>
|
<%= link_to "read more >",panel_announcement_front_end_bulletin_path(@bulletin.id) %>
|
||||||
<a class="btn" href="">read more ></a>
|
<a class="btn" href="">read more ></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if @bulletins and !@bulletins.nil? %>
|
||||||
|
|
||||||
<div id="col2" class="col">
|
<div id="col2" class="col">
|
||||||
<h1 class="h1 ini_heading col_title">news</h1>
|
<h1 class="h1 ini_heading col_title">news</h1>
|
||||||
<ul class="ini_list">
|
<ul class="ini_list">
|
||||||
|
@ -18,3 +23,20 @@
|
||||||
<%= link_to "read more >",panel_announcement_front_end_bulletins_path(), :class => "btn" %>
|
<%= link_to "read more >",panel_announcement_front_end_bulletins_path(), :class => "btn" %>
|
||||||
<a class="btn" href="announcement">read more ></a>
|
<a class="btn" href="announcement">read more ></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="col2" class="col">
|
||||||
|
<h1 class="h1 ini_heading col_title">news</h1>
|
||||||
|
<ul class="ini_list">
|
||||||
|
<% @bulletins.each do |post| %>
|
||||||
|
<li>
|
||||||
|
<%= image_tag(post.image.url, :size => "160x140") if post.image.file %>
|
||||||
|
<h4><%= post.title %></h4>
|
||||||
|
<%= post.subtitle %>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<%= link_to "read more >",panel_announcement_front_end_bulletins_path(), :class => "btn" %>
|
||||||
|
<a class="btn" href="announcement">read more ></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|
|
@ -5,17 +5,19 @@ Rails.application.routes.draw do
|
||||||
namespace :back_end do
|
namespace :back_end do
|
||||||
root :to => "bulletins#index"
|
root :to => "bulletins#index"
|
||||||
resources :bulletins
|
resources :bulletins
|
||||||
resources :bulletin_categorys, :controller => 'bulletin_categorys' do
|
resources :bulletin_categorys, :controller => 'bulletin_categorys' do
|
||||||
match "quick_edit/:bulletin_category_id" => "bulletin_categorys#quick_edit" ,:as => :quick_edit
|
match "quick_edit/:bulletin_category_id" => "bulletin_categorys#quick_edit" ,:as => :quick_edit
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
namespace :front_end do
|
namespace :front_end do
|
||||||
root :to => "bulletins#index"
|
root :to => "bulletins#index"
|
||||||
resources :bulletins
|
resources :bulletins
|
||||||
|
match "show/:id" => "bulletins#show" ,:as => :bulletin
|
||||||
end
|
end
|
||||||
namespace :widget do
|
namespace :widget do
|
||||||
root :to => "bulletins#index"
|
root :to => "bulletins#index"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
match "/appfront/*path" => redirect("/panel/*path")
|
||||||
end
|
end
|
||||||
|
|
Reference in New Issue