From 703fcb2413c7049d4c5279d841709644bed3c375 Mon Sep 17 00:00:00 2001
From: Josh Adams
-
-
+
-
-<%= 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 %>
-<%= form.text_area :body, :rows => 12, :tabindex => 20 %>
+ <%= form.text_area :body, :rows => 12 %>
+
- <%= form.select :forum_id, Forum.find(:all, :order => "position").map {|x| [x.name, x.id] } %>
+
+ <%= form.select :forum_id, Forum.find(:all, :order => "position").map {|x| [x.name, x.id] } %>
<%= '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