acts_as_paranoid_versioned and routes
This commit is contained in:
6
Gemfile
6
Gemfile
@@ -19,9 +19,13 @@ gem 'will_paginate', "~>3.0"
|
|||||||
gem 'calendar_helper', "~>0.2"
|
gem 'calendar_helper', "~>0.2"
|
||||||
gem 'shoulda', "~>2.11"
|
gem 'shoulda', "~>2.11"
|
||||||
gem 'acts_as_paranoid', '~>0.4'
|
gem 'acts_as_paranoid', '~>0.4'
|
||||||
#gem 'acts_as_versioned', '~>0.6', :ignore_dependencies => true
|
gem 'acts_as_versioned', :git => 'https://github.com/jwhitehorn/acts_as_versioned.git'
|
||||||
gem 'acts_as_list', '~>0.2'
|
gem 'acts_as_list', '~>0.2'
|
||||||
|
|
||||||
group :development, :production do
|
group :development, :production do
|
||||||
gem 'brazilian-rails', '3.3.0', :path => './vendor/gems/brazilian-rails/brI18n/'
|
gem 'brazilian-rails', '3.3.0', :path => './vendor/gems/brazilian-rails/brI18n/'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
group :development do
|
||||||
|
gem 'mongrel'
|
||||||
|
end
|
||||||
|
|||||||
18
Gemfile.lock
18
Gemfile.lock
@@ -1,3 +1,10 @@
|
|||||||
|
GIT
|
||||||
|
remote: https://github.com/jwhitehorn/acts_as_versioned.git
|
||||||
|
revision: 44dfe632ba8c97c786cbc172a2da18a41b17f668
|
||||||
|
specs:
|
||||||
|
acts_as_versioned (3.2.1)
|
||||||
|
activerecord
|
||||||
|
|
||||||
PATH
|
PATH
|
||||||
remote: ./vendor/gems/bluecloth
|
remote: ./vendor/gems/bluecloth
|
||||||
specs:
|
specs:
|
||||||
@@ -46,6 +53,7 @@ GEM
|
|||||||
builder (3.0.4)
|
builder (3.0.4)
|
||||||
calendar_helper (0.2.5)
|
calendar_helper (0.2.5)
|
||||||
open4
|
open4
|
||||||
|
cgi_multipart_eof_fix (2.5.0)
|
||||||
coffee-rails (3.2.2)
|
coffee-rails (3.2.2)
|
||||||
coffee-script (>= 2.2.0)
|
coffee-script (>= 2.2.0)
|
||||||
railties (~> 3.2.0)
|
railties (~> 3.2.0)
|
||||||
@@ -53,9 +61,12 @@ GEM
|
|||||||
coffee-script-source
|
coffee-script-source
|
||||||
execjs
|
execjs
|
||||||
coffee-script-source (1.6.3)
|
coffee-script-source (1.6.3)
|
||||||
|
daemons (1.1.9)
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
execjs (1.4.0)
|
execjs (1.4.0)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
|
fastthread (1.0.7)
|
||||||
|
gem_plugin (0.2.3)
|
||||||
haml (3.1.8)
|
haml (3.1.8)
|
||||||
hike (1.2.3)
|
hike (1.2.3)
|
||||||
hpricot (0.8.6)
|
hpricot (0.8.6)
|
||||||
@@ -70,6 +81,11 @@ GEM
|
|||||||
mime-types (~> 1.16)
|
mime-types (~> 1.16)
|
||||||
treetop (~> 1.4.8)
|
treetop (~> 1.4.8)
|
||||||
mime-types (1.23)
|
mime-types (1.23)
|
||||||
|
mongrel (1.1.5)
|
||||||
|
cgi_multipart_eof_fix (>= 2.4)
|
||||||
|
daemons (>= 1.0.3)
|
||||||
|
fastthread (>= 1.0.1)
|
||||||
|
gem_plugin (>= 0.2.3)
|
||||||
multi_json (1.7.7)
|
multi_json (1.7.7)
|
||||||
open4 (1.3.0)
|
open4 (1.3.0)
|
||||||
polyglot (0.3.3)
|
polyglot (0.3.3)
|
||||||
@@ -127,6 +143,7 @@ PLATFORMS
|
|||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
acts_as_list (~> 0.2)
|
acts_as_list (~> 0.2)
|
||||||
acts_as_paranoid (~> 0.4)
|
acts_as_paranoid (~> 0.4)
|
||||||
|
acts_as_versioned!
|
||||||
bluecloth (= 1.0.0)!
|
bluecloth (= 1.0.0)!
|
||||||
brazilian-rails (= 3.3.0)!
|
brazilian-rails (= 3.3.0)!
|
||||||
calendar_helper (~> 0.2)
|
calendar_helper (~> 0.2)
|
||||||
@@ -136,6 +153,7 @@ DEPENDENCIES
|
|||||||
icalendar (~> 1.0)
|
icalendar (~> 1.0)
|
||||||
jquery-rails
|
jquery-rails
|
||||||
json
|
json
|
||||||
|
mongrel
|
||||||
rails (~> 3.2)
|
rails (~> 3.2)
|
||||||
sass-rails (~> 3.2.3)
|
sass-rails (~> 3.2.3)
|
||||||
shoulda (~> 2.11)
|
shoulda (~> 2.11)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class String
|
|||||||
def format_wiki
|
def format_wiki
|
||||||
text = BlueCloth.new(self).to_html
|
text = BlueCloth.new(self).to_html
|
||||||
text = Hpricot(text, :xhtml_strict => true).to_s
|
text = Hpricot(text, :xhtml_strict => true).to_s
|
||||||
return text.sanitize
|
return text.sanitize unless text.blank?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,12 @@ class Event < ActiveRecord::Base
|
|||||||
# Plugins
|
# Plugins
|
||||||
acts_as_paranoid
|
acts_as_paranoid
|
||||||
acts_as_versioned :if_changed => [ :title, :description, :time ]
|
acts_as_versioned :if_changed => [ :title, :description, :time ]
|
||||||
acts_as_paranoid_versioned
|
|
||||||
|
#acts_as_paranoid_versioned
|
||||||
|
self.versioned_class.class_eval do
|
||||||
|
def self.delete_all(conditions = nil); return; end
|
||||||
|
end
|
||||||
|
|
||||||
self.non_versioned_columns << 'deleted_at'
|
self.non_versioned_columns << 'deleted_at'
|
||||||
|
|
||||||
# Associacoes
|
# Associacoes
|
||||||
|
|||||||
@@ -21,7 +21,11 @@ class Message < ActiveRecord::Base
|
|||||||
acts_as_paranoid
|
acts_as_paranoid
|
||||||
acts_as_versioned :if_changed => [ :title, :body ]
|
acts_as_versioned :if_changed => [ :title, :body ]
|
||||||
self.non_versioned_columns << 'deleted_at'
|
self.non_versioned_columns << 'deleted_at'
|
||||||
acts_as_paranoid_versioned
|
|
||||||
|
#acts_as_paranoid_versioned
|
||||||
|
self.versioned_class.class_eval do
|
||||||
|
def self.delete_all(conditions = nil); return; end
|
||||||
|
end
|
||||||
|
|
||||||
# Associacoes
|
# Associacoes
|
||||||
belongs_to :user,
|
belongs_to :user,
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ class WikiPage < ActiveRecord::Base
|
|||||||
acts_as_paranoid
|
acts_as_paranoid
|
||||||
acts_as_list :scope => 'course_id = #{course_id}'
|
acts_as_list :scope => 'course_id = #{course_id}'
|
||||||
acts_as_versioned :if_changed => [ :content, :description, :title ]
|
acts_as_versioned :if_changed => [ :content, :description, :title ]
|
||||||
acts_as_paranoid_versioned
|
|
||||||
self.non_versioned_columns << 'front_page'
|
self.non_versioned_columns << 'front_page'
|
||||||
self.non_versioned_columns << 'position'
|
self.non_versioned_columns << 'position'
|
||||||
self.non_versioned_columns << 'deleted_at'
|
self.non_versioned_columns << 'deleted_at'
|
||||||
@@ -43,6 +42,11 @@ class WikiPage < ActiveRecord::Base
|
|||||||
validates_uniqueness_of :canonical_title, :scope => :course_id
|
validates_uniqueness_of :canonical_title, :scope => :course_id
|
||||||
validates_format_of :title, :with => /^[^0-9]/
|
validates_format_of :title, :with => /^[^0-9]/
|
||||||
|
|
||||||
|
# acts_as_paranoid_versioned
|
||||||
|
self.versioned_class.class_eval do
|
||||||
|
def self.delete_all(conditions = nil); return; end
|
||||||
|
end
|
||||||
|
|
||||||
def before_validation
|
def before_validation
|
||||||
self.canonical_title = self.title.pretty_url
|
self.canonical_title = self.title.pretty_url
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -14,6 +14,11 @@
|
|||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
ActiveSupport::Inflector.inflections do |inflect|
|
||||||
|
inflect.irregular 'wiki_instance', 'wiki'
|
||||||
|
inflect.irregular 'news_instance', 'news'
|
||||||
|
end
|
||||||
|
|
||||||
WikiUFC::Application.routes.draw do
|
WikiUFC::Application.routes.draw do
|
||||||
|
|
||||||
resources :users
|
resources :users
|
||||||
@@ -55,7 +60,11 @@ WikiUFC::Application.routes.draw do
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Log
|
# Log
|
||||||
#match 'controllerlog' => '#index', :as => :with_options
|
with_options :controller => 'log' do |log|
|
||||||
|
log.match 'courses/:course_id/log', :action => 'index', :format => 'html', :as => 'course_log'
|
||||||
|
log.match 'courses/:course_id/log/:id/undo', :action => 'undo', :format => 'html', :as => 'undo_course_log'
|
||||||
|
log.match 'courses/:course_id/log.:format', :action => 'index', :as => 'formatted_course_log'
|
||||||
|
end
|
||||||
|
|
||||||
# Services
|
# Services
|
||||||
match 'services/preview' => 'wiki#preview', :as => :preview
|
match 'services/preview' => 'wiki#preview', :as => :preview
|
||||||
|
|||||||
Reference in New Issue
Block a user