diff --git a/app/models/user.rb b/app/models/user.rb index d56eacc..d001764 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -23,7 +23,7 @@ class User < ActiveRecord::Base acts_as_tagger # FIXME: We should switch to http://www.intridea.com/2007/12/4/announcing-acts_as_taggable_on # authorization plugin - # acts_as_authorized_user + acts_as_authorized_user # userstamp plugin model_stamper @@ -57,11 +57,6 @@ def display_name login end - # TODO: We should implement a rough version of this method - def currently_online - false - end - # Encrypts some data with the salt. def self.encrypt(password, salt) Digest::SHA1.hexdigest("--#{salt}--#{password}--") diff --git a/config/environment.rb b/config/environment.rb index 575f761..18d85fd 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -58,7 +58,7 @@ # Only load the plugins named here, in the order given. By default, all plugins # in vendor/plugins are loaded in alphabetical order. # :all can be used as a placeholder for all plugins not explicitly named - config.plugins = [ :has_settings, :stringex, :userstamp, :paperclip, :white_list, :white_list_formatted_content, :all ] + config.plugins = [ :engines, :has_settings, :stringex, :userstamp, :paperclip, :white_list, :white_list_formatted_content, "rails-authorization-plugin", :all ] # Add additional load paths for your own custom dirs # config.load_paths += %W( #{RAILS_ROOT}/extras ) diff --git a/public/stylesheets/forums.css b/public/stylesheets/forums.css index 93be261..c1ad795 100644 --- a/public/stylesheets/forums.css +++ b/public/stylesheets/forums.css @@ -107,16 +107,6 @@ p.sections a.action { color:#c00; } margin-left:10em; } -h1,h2,h3,h4,h5,h6 -{ -font-family:'Lucida Grande', 'Trebuchet MS', Arial, Helvetica, sans-serif; -} - -h1 { - font-size:1.3em; -} - -h1 img { vertical-align:middle; } p.subtitle { @@ -127,28 +117,6 @@ p.subtitle } p.subtitle img { vertical-align: bottom; } -h1 span { font-size:0.7em; color:#999; font-weight:normal; padding-left: 1em;} - -h2 { - font-size:1.0em; } - -h2 span -{ - color:#999; - font-size:0.7em; - margin-left:1em; -} - -h3 -{ - padding:2px 10px 3px; - background:#333; - color:white; - font-size:0.70em; - border-bottom:1px solid #999; - font-family: 'Lucida Grande', Tahoma, Arial, Helvetica, sans-serif; -} - h6 { margin-bottom:0; } pre.explain diff --git a/vendor/plugins/ansuz_blog/lib/extend_users_with_blog_posts.rb b/vendor/plugins/ansuz_blog/lib/extend_users_with_blog_posts.rb index 9a88270..960ef0a 100644 --- a/vendor/plugins/ansuz_blog/lib/extend_users_with_blog_posts.rb +++ b/vendor/plugins/ansuz_blog/lib/extend_users_with_blog_posts.rb @@ -10,4 +10,9 @@ def self.included(base) end end -User.send :include, Ansuz::JAdams::UserExtensions +require 'dispatcher' + +# This should avoid the problem where methods go missing between reloads +Dispatcher.to_prepare { + User.send :include, Ansuz::JAdams::UserExtensions +} diff --git a/vendor/plugins/ansuz_savage_beast/app/views/topics/_form.html.erb b/vendor/plugins/ansuz_savage_beast/app/views/topics/_form.html.erb index aa21962..5b8eb8f 100644 --- a/vendor/plugins/ansuz_savage_beast/app/views/topics/_form.html.erb +++ b/vendor/plugins/ansuz_savage_beast/app/views/topics/_form.html.erb @@ -1,28 +1,28 @@

-
-<%= form.text_field :title, :onchange => "/*TopicForm.editNewTitle(this);*/", :class => "primary", :tabindex => 10 %> +
+ <%= form.text_field :title, :onchange => "/*TopicForm.editNewTitle(this);*/", :class => "primary" %> -<% if admin? or current_user.moderator_of?(@topic.forum) %> - - - - -<% end %> + <% if admin? or current_user.moderator_of?(@topic.forum) %> + + + <% end %>

+ <% if @topic.new_record? %> -

-
-<%= form.text_area :body, :rows => 12, :tabindex => 20 %>

+

+
+ <%= form.text_area :body, :rows => 12 %> +

<% end %> <% if admin? and not @topic.new_record? %> -

-
- <%= form.select :forum_id, Forum.find(:all, :order => "position").map {|x| [x.name, x.id] } %>

-

-<% end %> \ No newline at end of file +

+
+ <%= form.select :forum_id, Forum.find(:all, :order => "position").map {|x| [x.name, x.id] } %>

+

+<% end %> diff --git a/vendor/plugins/ansuz_savage_beast/app/views/topics/new.html.erb b/vendor/plugins/ansuz_savage_beast/app/views/topics/new.html.erb index 43d9666..19e7a5d 100644 --- a/vendor/plugins/ansuz_savage_beast/app/views/topics/new.html.erb +++ b/vendor/plugins/ansuz_savage_beast/app/views/topics/new.html.erb @@ -3,16 +3,15 @@ <%= link_to h(@forum.name), forum_path(@forum) %> -

<%= 'New Topic'[] %>

<%= 'by {user}'[:by_user, current_user.display_name] %>

<%= error_messages_for :post %> <%= error_messages_for :topic %> + <% form_for :topic, :url => forum_topics_path(@forum) do |f| -%> -<%= render :partial => "form", :object => f %> -<%= submit_tag 'Post Topic'[], :or => link_to('Cancel'[], forum_path(@forum)) %> + <%= render :partial => "form", :object => f %> + <%= submit_tag 'Post Topic'[], :or => link_to('Cancel'[], forum_path(@forum)) %> <% end -%> <%= javascript_tag "$('topic_title').focus();" %> - diff --git a/vendor/plugins/ansuz_savage_beast/init.rb b/vendor/plugins/ansuz_savage_beast/init.rb index 8712635..532ffe7 100644 --- a/vendor/plugins/ansuz_savage_beast/init.rb +++ b/vendor/plugins/ansuz_savage_beast/init.rb @@ -1,4 +1,9 @@ -require 'extend_users' +require 'dispatcher' + +# This should avoid the problem where methods go missing between reloads +Dispatcher.to_prepare { + User.send :include, SavageBeast::UserInit +} ActionView::Base.send :include, SavageBeast::AuthenticationSystem ActionController::Base.send :include, SavageBeast::AuthenticationSystem diff --git a/vendor/plugins/ansuz_savage_beast/lib/extend_users.rb b/vendor/plugins/ansuz_savage_beast/lib/extend_users.rb deleted file mode 100644 index 08e4ca8..0000000 --- a/vendor/plugins/ansuz_savage_beast/lib/extend_users.rb +++ /dev/null @@ -1 +0,0 @@ -User.send :include, SavageBeast::UserInit diff --git a/vendor/plugins/ansuz_savage_beast/lib/savage_beast/user_init.rb b/vendor/plugins/ansuz_savage_beast/lib/savage_beast/user_init.rb index 8df35e4..87b5f87 100644 --- a/vendor/plugins/ansuz_savage_beast/lib/savage_beast/user_init.rb +++ b/vendor/plugins/ansuz_savage_beast/lib/savage_beast/user_init.rb @@ -1,8 +1,5 @@ - module SavageBeast - module UserInit - def self.included(base) base.class_eval do @@ -13,35 +10,24 @@ def self.included(base) has_many :topics has_many :monitorships has_many :monitored_topics, :through => :monitorships, :conditions => ["#{Monitorship.table_name}.active = ?", true], :order => "#{Topic.table_name}.replied_at desc", :source => :topic - - #implement in your user model - def display_name - "implement display_name in your user model" - end - - #implement in your user model - def admin? - false - end - - def moderator_of?(forum) - moderatorships.count(:all, :conditions => ['forum_id = ?', (forum.is_a?(Forum) ? forum.id : forum)]) == 1 - end - - def to_xml(options = {}) - options[:except] ||= [] - super - end end base.extend(ClassMethods) + base.send :include, InstanceMethods end - module ClassMethods + module InstanceMethods #implement in your user model def currently_online false end + + def moderator_of?(forum) + moderatorships.count(:all, :conditions => ['forum_id = ?', (forum.is_a?(Forum) ? forum.id : forum)]) == 1 + end + end + + module ClassMethods def search(query, options = {}) with_scope :find => { :conditions => build_search_conditions(query) } do options[:page] ||= nil @@ -55,13 +41,9 @@ def build_search_conditions(query) query end - def moderator_of?(forum) - moderatorships.count("#{Moderatorship.table_name}.id", :conditions => ['forum_id = ?', (forum.is_a?(Forum) ? forum.id : forum)]) == 1 - end - def to_xml(options = {}) options[:except] ||= [] - options[:except] << :email << :login_key << :login_key_expires_at << :password_hash << :openid_url << :activated << :admin + options[:except] << :email << :login_key << :login_key_expires_at << :password_hash << :openid_url << :activated << :admin << :crypted_password super end @@ -72,8 +54,6 @@ def update_posts_count def update_posts_count(id) User.update_all ['posts_count = ?', Post.count(:id, :conditions => {:user_id => id})], ['id = ?', id] end - end - end -end \ No newline at end of file +end diff --git a/vendor/plugins/engines-patch/init.rb b/vendor/plugins/engines-patch/init.rb new file mode 100644 index 0000000..54dc72a --- /dev/null +++ b/vendor/plugins/engines-patch/init.rb @@ -0,0 +1,15 @@ +# Patching Engines as per http://www.ruby-forum.com/topic/166578 +require 'dispatcher' + +Engines::Plugin.class_eval do + def apply_mixin_to_model(model_class, mixin_module) + Dispatcher.to_prepare { + model_class = Kernel.const_get(model_class.to_s) # \ weird, yet + mixin_module = Kernel.const_get(mixin_module.to_s) # / required. + model_class.send(:extend, mixin_module.const_get("ClassMethods")) + model_class.send(:include, + mixin_module.const_get("InstanceMethods")) + model_class.instance_eval &(mixin_module.class_definition()) + } + end +end diff --git a/vendor/plugins/has_settings/lib/has_settings.rb b/vendor/plugins/has_settings/lib/has_settings.rb index 860787c..ad886f3 100644 --- a/vendor/plugins/has_settings/lib/has_settings.rb +++ b/vendor/plugins/has_settings/lib/has_settings.rb @@ -31,6 +31,7 @@ def has_settings end define_method "settings=" do |the_settings| + self.get_has_settings_setting self.has_settings_setting.settings = the_settings end