summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-06-24 04:13:16 +0200
committererdgeist <erdgeist@erdgeist.org>2026-06-24 04:13:16 +0200
commite0a7e0fec760ba12c8067a37e10c96f1f05876e2 (patch)
treed0cf745592a46aee4d4913911fd34c7c24515220 /app
parent6424e10be5a89f175a74c71c55660412a169b8b8 (diff)
Stage 1 complete: Rails 2.3.5 to Rails 3.2.22.5 upgrade
- Converted plugins to gems (Gemfile) - Updated config structure (application.rb, boot.rb, environment.rb) - Converted routes to Rails 3 DSL - Converted named_scope to scope throughout models - Converted find(:all, :conditions) to where() chains - Fixed has_many :order to use ordering scope - Updated session store and secret token configuration - Fixed exception_notification middleware configuration - Patched Ruby 2.4 / Rails 3.2 incompatibilities: - Integer/Float duration arithmetic (ActiveSupport) - Arel visit_Integer for PostgreSQL adapter - create_database String/Integer coercion - ActionController consider_all_requests_local - Migrated taggings schema for acts-as-taggable-on - Replaced dynamic_form gem with custom form_error_messages helper - Fixed Rails 3 block helper syntax (form_for, form_tag, fields_for) - Fixed admin layout yield - Updated test suite for Rails 3 APIs
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin_controller.rb38
-rw-r--r--app/controllers/application_controller.rb18
-rw-r--r--app/controllers/content_controller.rb4
-rw-r--r--app/controllers/menu_items_controller.rb2
-rw-r--r--app/controllers/nodes_controller.rb9
-rw-r--r--app/controllers/revisions_controller.rb1
-rw-r--r--app/controllers/rss_controller.rb19
-rw-r--r--app/controllers/tags_controller.rb14
-rw-r--r--app/controllers/users_controller.rb2
-rw-r--r--app/helpers/application_helper.rb11
-rw-r--r--app/helpers/content_helper.rb10
-rw-r--r--app/models/asset.rb29
-rw-r--r--app/models/event.rb12
-rw-r--r--app/models/menu_item.rb8
-rw-r--r--app/models/node.rb17
-rw-r--r--app/models/occurrence.rb24
-rw-r--r--app/models/page.rb35
-rw-r--r--app/models/permission.rb4
-rw-r--r--app/views/assets/edit.html.erb6
-rw-r--r--app/views/assets/new.html.erb6
-rw-r--r--app/views/content/_search.html.erb2
-rw-r--r--app/views/content/_tags.html.erb2
-rw-r--r--app/views/custom/page_templates/public/no_date_and_author_with_map.html.erb8
-rw-r--r--app/views/events/edit.html.erb6
-rw-r--r--app/views/events/new.html.erb6
-rw-r--r--app/views/layouts/admin.html.erb2
-rw-r--r--app/views/layouts/application.html.erb2
-rw-r--r--app/views/layouts/application.html.erb.bak54
-rw-r--r--app/views/menu_items/edit.html.erb4
-rw-r--r--app/views/menu_items/new.html.erb4
-rw-r--r--app/views/nodes/edit.html.erb10
-rw-r--r--app/views/nodes/index.html.erb2
-rw-r--r--app/views/nodes/new.html.erb9
-rw-r--r--app/views/occurrences/edit.html.erb6
-rw-r--r--app/views/occurrences/new.html.erb6
-rw-r--r--app/views/pages/edit.html.erb4
-rw-r--r--app/views/pages/new.html.erb4
-rw-r--r--app/views/revisions/diff.html.erb4
-rw-r--r--app/views/revisions/index.html.erb6
-rw-r--r--app/views/sessions/new.html.erb4
-rw-r--r--app/views/users/edit.html.erb11
-rw-r--r--app/views/users/new.html.erb11
42 files changed, 228 insertions, 208 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index f3cc221..18c4104 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -5,21 +5,15 @@ class AdminController < ApplicationController
5 before_filter :login_required 5 before_filter :login_required
6 6
7 def index 7 def index
8 @drafts = Node.all( 8 @drafts = Node.where("draft_id IS NOT NULL")
9 :limit => 50, 9 .limit(50).order("updated_at desc")
10 :order => "updated_at desc", 10
11 :conditions => ["draft_id IS NOT NULL"] 11 @drafts_count = Node.where("draft_id IS NOT NULL").count
12 ) 12
13 @drafts_count = Node.count( 13 @recent_changes = Node.where(
14 :conditions => ["draft_id IS NOT NULL"] 14 "updated_at < ? AND updated_at > ? AND parent_id IS NOT NULL",
15 ) 15 Time.now, Time.now - 14.days
16 @recent_changes = Node.all( 16 ).limit(50).order("updated_at desc")
17 :limit => 50,
18 :order => "updated_at desc",
19 :conditions => [
20 "updated_at < ? AND updated_at > ? AND parent_id IS NOT NULL", Time.now, Time.now-14.days
21 ]
22 )
23 17
24 all_nodes = Node.root.self_and_descendants 18 all_nodes = Node.root.self_and_descendants
25 @sitemap_depth = {} 19 @sitemap_depth = {}
@@ -28,16 +22,12 @@ class AdminController < ApplicationController
28 end 22 end
29 @sitemap = all_nodes.to_a.sort! { |node1,node2| node1.lft <=> node2.lft }.delete_if { |node| node.update? } 23 @sitemap = all_nodes.to_a.sort! { |node1,node2| node1.lft <=> node2.lft }.delete_if { |node| node.update? }
30 24
31 @mypages = Page.all( 25 @mypages = Page.where("user_id = ? or editor_id = ?", @current_user, @current_user)
32 :conditions => [ "user_id = ? or editor_id = ?", @current_user, @current_user]
33 )
34
35 @mynodes = Node.all(
36 :order => "updated_at desc",
37 :joins => :pages,
38 :conditions => [ "pages.user_id = ? or pages.editor_id = ?", @current_user, @current_user ]
39 ).uniq.first(50)
40 26
27 @mynodes = Node.joins(:pages)
28 .where("pages.user_id = ? or pages.editor_id = ?", @current_user, @current_user)
29 .order("updated_at desc")
30 .uniq.first(50)
41 end 31 end
42 32
43 def search 33 def search
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 89cd330..4d0ed2e 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -2,25 +2,19 @@
2# Likewise, all the methods added will be available for all controllers. 2# Likewise, all the methods added will be available for all controllers.
3 3
4class ApplicationController < ActionController::Base 4class ApplicationController < ActionController::Base
5
6 include ExceptionNotifiable
7 include AuthenticatedSystem 5 include AuthenticatedSystem
8 6
9 helper :all # include all helpers, all the time
10 protect_from_forgery # See ActionController::RequestForgeryProtection for details 7 protect_from_forgery # See ActionController::RequestForgeryProtection for details
11 8
12 # Scrub sensitive parameters from your log
13 filter_parameter_logging :password, :password_confirmation
14
15 before_filter :set_locale 9 before_filter :set_locale
16 10
17 protected 11 protected
18 12
19 def set_locale 13 def set_locale
20 if params[:locale] && I18n.available_locales.include?(params[:locale].to_sym) 14 if params[:locale] && I18n.available_locales.include?(params[:locale].to_sym)
21 I18n.locale = params[:locale].to_sym 15 I18n.locale = params[:locale].to_sym
22 else 16 else
23 params.delete(:locale) 17 params.delete(:locale)
24 end
25 end 18 end
19 end
26end 20end
diff --git a/app/controllers/content_controller.rb b/app/controllers/content_controller.rb
index c62b726..4248239 100644
--- a/app/controllers/content_controller.rb
+++ b/app/controllers/content_controller.rb
@@ -20,7 +20,7 @@ class ContentController < ApplicationController
20 ) 20 )
21 else 21 else
22 render( 22 render(
23 :file => File.join(RAILS_ROOT, 'public', '404.html'), 23 :file => Rails.root.join('public', '404.html'),
24 :status => 404 24 :status => 404
25 ) 25 )
26 end 26 end
@@ -38,7 +38,7 @@ class ContentController < ApplicationController
38 38
39 private 39 private
40 def find_page 40 def find_page
41 path = params[:page_path].join('/') 41 path = params[:page_path].is_a?(Array) ? params[:page_path].join('/') : params[:page_path]
42 if path =~ /^[a-zA-Z\:\/\/\.\-\d_]+$/ 42 if path =~ /^[a-zA-Z\:\/\/\.\-\d_]+$/
43 @page = Node.find_page(path) 43 @page = Node.find_page(path)
44 else 44 else
diff --git a/app/controllers/menu_items_controller.rb b/app/controllers/menu_items_controller.rb
index 808da15..24a3d5e 100644
--- a/app/controllers/menu_items_controller.rb
+++ b/app/controllers/menu_items_controller.rb
@@ -7,7 +7,7 @@ class MenuItemsController < ApplicationController
7 layout 'admin' 7 layout 'admin'
8 8
9 def index 9 def index
10 @menu_items = MenuItem.all(:order => "position ASC") 10 @menu_items = MenuItem.order("position ASC").all
11 end 11 end
12 12
13 def show 13 def show
diff --git a/app/controllers/nodes_controller.rb b/app/controllers/nodes_controller.rb
index 95aed48..7c082c4 100644
--- a/app/controllers/nodes_controller.rb
+++ b/app/controllers/nodes_controller.rb
@@ -15,12 +15,9 @@ class NodesController < ApplicationController
15 ] 15 ]
16 16
17 def index 17 def index
18 @nodes = Node.root.descendants.paginate( 18 @nodes = Node.root.descendants.includes(:head, :draft)
19 :include => [:head, :draft], 19 .order('id DESC')
20 :page => params[:page], 20 .paginate(:page => params[:page], :per_page => 25)
21 :per_page => 25,
22 :order => 'id DESC'
23 )
24 end 21 end
25 22
26 def new 23 def new
diff --git a/app/controllers/revisions_controller.rb b/app/controllers/revisions_controller.rb
index 05e8acc..8c16730 100644
--- a/app/controllers/revisions_controller.rb
+++ b/app/controllers/revisions_controller.rb
@@ -8,6 +8,7 @@ class RevisionsController < ApplicationController
8 8
9 def index 9 def index
10 @node = Node.find(params[:node_id]) 10 @node = Node.find(params[:node_id])
11 @pages = @node.pages.all
11 end 12 end
12 13
13 def diff 14 def diff
diff --git a/app/controllers/rss_controller.rb b/app/controllers/rss_controller.rb
index acffc0e..70a642c 100644
--- a/app/controllers/rss_controller.rb
+++ b/app/controllers/rss_controller.rb
@@ -7,12 +7,9 @@ class RssController < ApplicationController
7 expires_in 31.minutes, :public => true 7 expires_in 31.minutes, :public => true
8 8
9 I18n.locale = :de 9 I18n.locale = :de
10 10
11 @items = Page.heads.find_tagged_with( 11 @items = Page.heads.tagged_with("update")
12 "update", 12 .order("published_at DESC").limit(20)
13 :order => "published_at DESC",
14 :limit => 20
15 )
16 13
17 respond_to do |format| 14 respond_to do |format|
18 format.xml {} 15 format.xml {}
@@ -21,13 +18,9 @@ class RssController < ApplicationController
21 end 18 end
22 19
23 def recent_changes 20 def recent_changes
24 @items = Page.all( 21 @items = Page.where(
25 :limit => 20, 22 "updated_at < ? AND updated_at > ?", Time.now, Time.now - 14.days
26 :order => "updated_at desc", 23 ).limit(20).order("updated_at desc")
27 :conditions => [
28 "updated_at < ? AND updated_at > ?", Time.now, Time.now-14.days
29 ]
30 )
31 end 24 end
32 25
33 protected 26 protected
diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb
index bf64b73..f09d560 100644
--- a/app/controllers/tags_controller.rb
+++ b/app/controllers/tags_controller.rb
@@ -5,7 +5,7 @@ class TagsController < ApplicationController
5 def index 5 def index
6 @page = Page.new :title => "Tags" 6 @page = Page.new :title => "Tags"
7 7
8 @tags = Tag.all(:limit => 500) 8 @tags = Tag.limit(500).all
9 end 9 end
10 10
11 def show 11 def show
@@ -16,14 +16,12 @@ class TagsController < ApplicationController
16 @tag = @tag ? @tag.name : tag_name 16 @tag = @tag ? @tag.name : tag_name
17 @page = Page.new 17 @page = Page.new
18 18
19 params[:page] = ( params[:page].is_a?(Fixnum) ? params[:page] : 1 ) 19 params[:page] = (params[:page].is_a?(Integer) ? params[:page] : 1)
20 20
21 @pages = Page.heads.paginate( 21 @pages = Page.heads.tagged_with(@tag).paginate(
22 Page.find_options_for_find_tagged_with(@tag).merge( 22 :order => 'published_at DESC',
23 :order => 'published_at DESC', 23 :page => params[:page],
24 :page=>params[:page], 24 :per_page => 23
25 :per_page => 23
26 )
27 ) 25 )
28 26
29 respond_to do |format| 27 respond_to do |format|
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 87df678..b7914c4 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -9,7 +9,7 @@ class UsersController < ApplicationController
9 layout 'admin' 9 layout 'admin'
10 10
11 def index 11 def index
12 @users = User.all(:order => "login ASC").group_by do |user| 12 @users = User.order("login ASC").all.group_by do |user|
13 user.admin? ? :admin : :user 13 user.admin? ? :admin : :user
14 end 14 end
15 end 15 end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 22a7940..0be66e9 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1,3 +1,14 @@
1# Methods added to this helper will be available to all templates in the application. 1# Methods added to this helper will be available to all templates in the application.
2module ApplicationHelper 2module ApplicationHelper
3 def form_error_messages(form_object)
4 object = form_object.is_a?(ActionView::Helpers::FormBuilder) ? form_object.object : form_object
5 return "" unless object && object.errors.any?
6 content_tag(:div, :class => "error_messages") do
7 content_tag(:ul) do
8 object.errors.full_messages.map do |msg|
9 content_tag(:li, msg)
10 end.join.html_safe
11 end
12 end
13 end
3end 14end
diff --git a/app/helpers/content_helper.rb b/app/helpers/content_helper.rb
index 17364f8..dbe468e 100644
--- a/app/helpers/content_helper.rb
+++ b/app/helpers/content_helper.rb
@@ -1,7 +1,7 @@
1module ContentHelper 1module ContentHelper
2 2
3 def main_menu 3 def main_menu
4 menu_items = MenuItem.all(:order => "position ASC") 4 menu_items = MenuItem.order("position ASC").all
5 render( 5 render(
6 :partial => 'content/main_navigation', 6 :partial => 'content/main_navigation',
7 :locals => {:menu_items => menu_items} 7 :locals => {:menu_items => menu_items}
@@ -51,7 +51,7 @@ module ContentHelper
51 end 51 end
52 52
53 def page_title 53 def page_title
54 if @page.title && @page.title != "" 54 if @page && @page.title && @page.title != ""
55 "CCC | #{@page.title}" 55 "CCC | #{@page.title}"
56 else 56 else
57 "CCC | Chaos Computer Club" 57 "CCC | Chaos Computer Club"
@@ -75,7 +75,7 @@ module ContentHelper
75 def aggregate? content 75 def aggregate? content
76 options = {} 76 options = {}
77 77
78 cccms_attributes = ActionView::Base.sanitized_allowed_attributes + [ 'lang' ] 78 cccms_attributes = ActionView::Base.sanitized_allowed_attributes + ['lang']
79 79
80 begin 80 begin
81 if content =~ /<aggregate([^<>]*)>/ 81 if content =~ /<aggregate([^<>]*)>/
@@ -126,9 +126,7 @@ module ContentHelper
126 # Check if a custom partial exists in the proper location 126 # Check if a custom partial exists in the proper location
127 def partial_exists? partial 127 def partial_exists? partial
128 File.exist?( 128 File.exist?(
129 File.join( 129 Rails.root.join('app', 'views', 'custom', 'partials', "_#{partial}.html.erb")
130 RAILS_ROOT, 'app', 'views', 'custom', 'partials', "_#{partial}.html.erb"
131 )
132 ) 130 )
133 end 131 end
134 132
diff --git a/app/models/asset.rb b/app/models/asset.rb
index 5bfea76..d27c525 100644
--- a/app/models/asset.rb
+++ b/app/models/asset.rb
@@ -11,29 +11,8 @@ class Asset < ActiveRecord::Base
11 :headline => "460x250#" 11 :headline => "460x250#"
12 } 12 }
13 ) 13 )
14 14
15 named_scope :images, :conditions => { 15 scope :images, where(:upload_content_type => ["image/gif", "image/jpeg", "image/png"])
16 :upload_content_type => [ 16 scope :documents, where(:upload_content_type => ["application/pdf", "text/plain", "text/rtf"])
17 "image/gif", 17 scope :audio, where(:upload_content_type => ["audio/mpeg", "audio/x-m4a", "audio/wav", "audio/x-wav"])
18 "image/jpeg",
19 "image/png"
20 ]
21 }
22
23 named_scope :documents, :conditions => {
24 :upload_content_type => [
25 "application/pdf",
26 "text/plain",
27 "text/rtf"
28 ]
29 }
30
31 named_scope :audio, :conditions => {
32 :upload_content_type => [
33 "audio/mpeg",
34 "audio/x-m4a",
35 "audio/wav",
36 "audio/x-wav"
37 ]
38 }
39end 18end
diff --git a/app/models/event.rb b/app/models/event.rb
index 60b8521..23deed6 100644
--- a/app/models/event.rb
+++ b/app/models/event.rb
@@ -12,14 +12,12 @@ class Event < ActiveRecord::Base
12 # Instance Methods 12 # Instance Methods
13 13
14 def occurrences_in_range start_time, end_time 14 def occurrences_in_range start_time, end_time
15 self.occurrences.find( 15 self.occurrences.where(
16 :all, :conditions => [ 16 "start_time > ? AND end_time < ?",
17 "start_time > ? AND end_time < ?", 17 start_time, end_time
18 start_time, end_time
19 ]
20 ) 18 )
21 end 19 end
22 20
23 private 21 private
24 def generate_occurences 22 def generate_occurences
25 Occurrence.generate self 23 Occurrence.generate self
diff --git a/app/models/menu_item.rb b/app/models/menu_item.rb
index 054e7ee..d1ddc68 100644
--- a/app/models/menu_item.rb
+++ b/app/models/menu_item.rb
@@ -1,6 +1,6 @@
1class MenuItem < ActiveRecord::Base 1class MenuItem < ActiveRecord::Base
2 2
3 default_scope :conditions => {:type => "MenuItem"} 3 default_scope where(:type => "MenuItem")
4 4
5 translates :title 5 translates :title
6 6
@@ -24,5 +24,5 @@ end
24 24
25 25
26class FeaturedArticle < MenuItem 26class FeaturedArticle < MenuItem
27 default_scope :conditions => {:type => "FeaturedArticle"} 27 default_scope where(:type => "FeaturedArticle")
28end \ No newline at end of file 28end
diff --git a/app/models/node.rb b/app/models/node.rb
index 75122d1..1b80565 100644
--- a/app/models/node.rb
+++ b/app/models/node.rb
@@ -24,12 +24,12 @@ class Node < ActiveRecord::Base
24 validate :borders # This should never ever happen. 24 validate :borders # This should never ever happen.
25 25
26 # Index for Fulltext Search 26 # Index for Fulltext Search
27 define_index do 27 # define_index do
28 indexes head.translations.title 28 # indexes head.translations.title
29 indexes slug 29 # indexes slug
30 indexes unique_name 30 # indexes unique_name
31 indexes head.translations.body 31 # indexes head.translations.body
32 end 32 # end
33 33
34 # Class methods 34 # Class methods
35 35
@@ -39,8 +39,8 @@ class Node < ActiveRecord::Base
39 # revision with -1. It raises an Argument error if the revision is not a 39 # revision with -1. It raises an Argument error if the revision is not a
40 # Fixnum 40 # Fixnum
41 def self.find_page path, revision = -1 41 def self.find_page path, revision = -1
42 unless revision.class == Fixnum 42 unless revision.is_a?(Integer)
43 raise ArgumentError, "revision must be a Fixnum" 43 raise ArgumentError, "revision must be a Integer"
44 end 44 end
45 45
46 node = Node.find_by_unique_name(path) 46 node = Node.find_by_unique_name(path)
@@ -111,6 +111,7 @@ class Node < ActiveRecord::Base
111 end 111 end
112 112
113 self.save! 113 self.save!
114 self.update_unique_name
114 self.unlock! 115 self.unlock!
115 self 116 self
116 end 117 end
diff --git a/app/models/occurrence.rb b/app/models/occurrence.rb
index 62432d5..0760d5e 100644
--- a/app/models/occurrence.rb
+++ b/app/models/occurrence.rb
@@ -11,25 +11,17 @@ class Occurrence < ActiveRecord::Base
11 # Class Methods 11 # Class Methods
12 12
13 def self.find_in_range start_time, end_time 13 def self.find_in_range start_time, end_time
14 find( 14 includes(:node)
15 :all, 15 .where("start_time > ? AND end_time < ?", start_time, end_time)
16 :include => :node, 16 .order("start_time")
17 :conditions => [
18 "start_time > ? AND end_time < ?", start_time, end_time
19 ],
20 :order => "start_time"
21 )
22 end 17 end
23 18
24 def self.find_next 19 def self.find_next
25 find( 20 includes(:node)
26 :all, 21 .where("start_time > ?", Time.now)
27 :limit => 1, 22 .limit(1)
28 :include => :node,
29 :conditions => ["start_time > ?", Time.now]
30 )
31 end 23 end
32 24
33 # Deletes all Occurrences which belong to the given event. Afterwards a few 25 # Deletes all Occurrences which belong to the given event. Afterwards a few
34 # variables are set to save repetitive queries. The occurrences of the given 26 # variables are set to save repetitive queries. The occurrences of the given
35 # event are then calculated and created. 27 # event are then calculated and created.
diff --git a/app/models/page.rb b/app/models/page.rb
index f804353..05abd43 100644
--- a/app/models/page.rb
+++ b/app/models/page.rb
@@ -3,23 +3,11 @@ require 'xml'
3class Page < ActiveRecord::Base 3class Page < ActiveRecord::Base
4 4
5 PUBLIC_TEMPLATE_PATH = File.join(%w(custom page_templates public)) 5 PUBLIC_TEMPLATE_PATH = File.join(%w(custom page_templates public))
6 FULL_PUBLIC_TEMPLATE_PATH = File.join(RAILS_ROOT, 'app', 'views', PUBLIC_TEMPLATE_PATH) 6 FULL_PUBLIC_TEMPLATE_PATH = Rails.root.join('app', 'views', PUBLIC_TEMPLATE_PATH)
7 7
8 # named scopes 8 # named scopes
9 9 scope :drafts, joins(:node).includes(:translations).where("nodes.draft_id = pages.id")
10 named_scope( 10 scope :heads, joins(:node).includes(:translations).where("nodes.head_id = pages.id")
11 :drafts,
12 :joins => :node,
13 :include => [:translations],
14 :conditions => ["nodes.draft_id = pages.id"]
15 )
16
17 named_scope(
18 :heads,
19 :joins => :node,
20 :include => [:translations],
21 :conditions => ["nodes.head_id = pages.id"]
22 )
23 11
24 # Mixins and Plugins 12 # Mixins and Plugins
25 acts_as_taggable 13 acts_as_taggable
@@ -62,15 +50,16 @@ class Page < ActiveRecord::Base
62 50
63 options = defaults.merge options 51 options = defaults.merge options
64 52
65 Page.heads.paginate( 53 scope = Page.heads
66 find_options_for_find_tagged_with( 54 unless options[:tags].blank?
67 options[:tags].gsub(/\s/, ","), :match_all => true, :conditions => options[:conditions] 55 scope = scope.tagged_with(
68 ).merge( 56 options[:tags].gsub(/\s/, ",").split(",").map(&:strip),
69 :page => page, 57 :match_all => true
70 :per_page => options[:limit],
71 :order => "#{options[:order_by]} #{options[:order_direction]}"
72 ) 58 )
73 ) 59 end
60
61 scope.order("#{options[:order_by]} #{options[:order_direction]}")
62 .paginate(:page => page, :per_page => options[:limit])
74 end 63 end
75 64
76 def self.custom_templates 65 def self.custom_templates
diff --git a/app/models/permission.rb b/app/models/permission.rb
index 438538e..a7a30ed 100644
--- a/app/models/permission.rb
+++ b/app/models/permission.rb
@@ -8,6 +8,6 @@ class Permission < ActiveRecord::Base
8 belongs_to :node 8 belongs_to :node
9 9
10 # Named scopes 10 # Named scopes
11 named_scope :for_node, lambda { |node| { :conditions => ['node_id = ?', (node.is_a? Node ? node.id : node)] } } 11 scope :for_node, lambda { |node| where('node_id = ?', (node.is_a?(Node) ? node.id : node)) }
12 named_scope :for_user, lambda { |user| { :conditions => ['user_id = ?', (user.is_a? User ? user.id : user)] } } 12 scope :for_user, lambda { |user| where('user_id = ?', (user.is_a?(User) ? user.id : user)) }
13end 13end
diff --git a/app/views/assets/edit.html.erb b/app/views/assets/edit.html.erb
index d60db94..e65d600 100644
--- a/app/views/assets/edit.html.erb
+++ b/app/views/assets/edit.html.erb
@@ -1,7 +1,7 @@
1<h1>Editing asset</h1> 1<h1>Editing asset</h1>
2 2
3<% form_for(@asset) do |f| %> 3<%= form_for(@asset) do |f| %>
4 <%= f.error_messages %> 4 <%= form_error_messages(f) %>
5 5
6 <p> 6 <p>
7 <%= f.submit 'Update' %> 7 <%= f.submit 'Update' %>
@@ -9,4 +9,4 @@
9<% end %> 9<% end %>
10 10
11<%= link_to 'Show', @asset %> | 11<%= link_to 'Show', @asset %> |
12<%= link_to 'Back', assets_path %> \ No newline at end of file 12<%= link_to 'Back', assets_path %>
diff --git a/app/views/assets/new.html.erb b/app/views/assets/new.html.erb
index 366488f..6c1310a 100644
--- a/app/views/assets/new.html.erb
+++ b/app/views/assets/new.html.erb
@@ -1,7 +1,7 @@
1<h1>New asset</h1> 1<h1>New asset</h1>
2 2
3<% form_for(@asset, :html => { :multipart => true }) do |f| %> 3<%= form_for(@asset, :html => { :multipart => true }) do |f| %>
4 <%= f.error_messages %> 4 <%= form_error_messages(f) %>
5 5
6 <p> 6 <p>
7 <%= f.label :name %><br /> 7 <%= f.label :name %><br />
@@ -14,4 +14,4 @@
14 </p> 14 </p>
15<% end %> 15<% end %>
16 16
17<%= link_to 'Back', assets_path %> \ No newline at end of file 17<%= link_to 'Back', assets_path %>
diff --git a/app/views/content/_search.html.erb b/app/views/content/_search.html.erb
index e654462..aa91424 100644
--- a/app/views/content/_search.html.erb
+++ b/app/views/content/_search.html.erb
@@ -1,3 +1,3 @@
1<% form_tag search_path, :method => 'get' do %> 1<%= form_tag search_path, :method => 'get' do %>
2 <div><%= text_field_tag :search_term, params[:search_term], :placeholder => 'suchen', :type => 'search' %></div> 2 <div><%= text_field_tag :search_term, params[:search_term], :placeholder => 'suchen', :type => 'search' %></div>
3<% end %> 3<% end %>
diff --git a/app/views/content/_tags.html.erb b/app/views/content/_tags.html.erb
index fd808b6..169ae84 100644
--- a/app/views/content/_tags.html.erb
+++ b/app/views/content/_tags.html.erb
@@ -1,4 +1,4 @@
1<% unless @page.tags.empty? %> 1<% unless @page.nil? || @page.tags.empty? %>
2<div id="tags"> 2<div id="tags">
3 <h2>Tags</h2> 3 <h2>Tags</h2>
4 <ul class="teasertext"> 4 <ul class="teasertext">
diff --git a/app/views/custom/page_templates/public/no_date_and_author_with_map.html.erb b/app/views/custom/page_templates/public/no_date_and_author_with_map.html.erb
new file mode 100644
index 0000000..6e86edf
--- /dev/null
+++ b/app/views/custom/page_templates/public/no_date_and_author_with_map.html.erb
@@ -0,0 +1,8 @@
1<div class="article">
2 <h2 class="headline"><%= @page.title %></h2>
3 <p><%= sanitize( @page.abstract ) %></p>
4 <object data="/system/uploads/327/original/map.svg" type="image/svg+xml"/>
5 <%= aggregate?(@page.body) %>
6</div>
7
8<%= will_paginate(@content_collection) if @content_collection %>
diff --git a/app/views/events/edit.html.erb b/app/views/events/edit.html.erb
index 17b6980..824cd66 100644
--- a/app/views/events/edit.html.erb
+++ b/app/views/events/edit.html.erb
@@ -6,8 +6,8 @@
6 6
7<h1>Editing event</h1> 7<h1>Editing event</h1>
8 8
9<% form_for(@event) do |f| %> 9<%= form_for(@event) do |f| %>
10 <%= f.error_messages %> 10 <%= form_error_messages(f) %>
11 11
12 <p> 12 <p>
13 <%= f.label :start_time %><br /> 13 <%= f.label :start_time %><br />
@@ -47,4 +47,4 @@
47 <p> 47 <p>
48 <%= f.submit 'Update' %> 48 <%= f.submit 'Update' %>
49 </p> 49 </p>
50<% end %> \ No newline at end of file 50<% end %>
diff --git a/app/views/events/new.html.erb b/app/views/events/new.html.erb
index 8c9812e..cd892c5 100644
--- a/app/views/events/new.html.erb
+++ b/app/views/events/new.html.erb
@@ -1,7 +1,7 @@
1<h1>New event</h1> 1<h1>New event</h1>
2 2
3<% form_for(@event) do |f| %> 3<%= form_for(@event) do |f| %>
4 <%= f.error_messages %> 4 <%= form_error_messages(f) %>
5 5
6 <p> 6 <p>
7 <%= f.label :start_time %><br /> 7 <%= f.label :start_time %><br />
@@ -43,4 +43,4 @@
43 </p> 43 </p>
44<% end %> 44<% end %>
45 45
46<%= link_to 'Back', events_path %> \ No newline at end of file 46<%= link_to 'Back', events_path %>
diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb
index 97b81df..9f36021 100644
--- a/app/views/layouts/admin.html.erb
+++ b/app/views/layouts/admin.html.erb
@@ -34,7 +34,7 @@
34 <% end %> 34 <% end %>
35 </div> 35 </div>
36 <div id="content"> 36 <div id="content">
37 <%= yield :layout %> 37 <%= yield %>
38 </div> 38 </div>
39 39
40 <div id="results"></div> 40 <div id="results"></div>
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index d2a624f..2a46f09 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -28,7 +28,7 @@
28 28
29 </head> 29 </head>
30 30
31 <body lang="<%= @page.effective_lang %>"> 31 <body lang="<%= @page ? @page.effective_lang : 'de' %>">
32 <div id="wrapper"> 32 <div id="wrapper">
33 <div id="header"> 33 <div id="header">
34 <%= image_tag("header.png") %> 34 <%= image_tag("header.png") %>
diff --git a/app/views/layouts/application.html.erb.bak b/app/views/layouts/application.html.erb.bak
new file mode 100644
index 0000000..3c95d75
--- /dev/null
+++ b/app/views/layouts/application.html.erb.bak
@@ -0,0 +1,54 @@
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
4<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5 <head>
6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7
8 <title><%= page_title %></title>
9 <%= stylesheet_link_tag "ccc" %>
10 <%= javascript_include_tag 'jquery-1.3.2.min' %>
11 <%= javascript_include_tag 'shadowbox/shadowbox' %>
12 <%= stylesheet_link_tag "shadowbox" %>
13 <%= javascript_include_tag 'public' %>
14
15 <%= auto_discovery_link_tag(:atom, {:locale => :de, :controller => "rss", :action => "updates", :format => :xml}) %>
16 <%= auto_discovery_link_tag(:rss, {:locale => :de, :controller => "rss", :action => "updates", :format => :rdf}) %>
17 </head>
18
19 <body>
20 <div id="wrapper">
21 <div id="header">
22 <%= link_to_path(image_tag("header.png"), "/home") %>
23 </div>
24 <div id="search">
25 <%= render :partial => "content/search" %>
26 </div>
27 <div id="left_column">
28 <%= main_menu %>
29
30 <%= language_selector %>
31 <% if current_user && @page.node %>
32 <%= link_to "Edit", node_path(:id => @page.node) %>
33 <% end %>
34
35 <%= calendar %>
36 </div>
37 <div id="center_column">
38 <%= yield :layout %>
39
40 <div id="footer">
41 <br />
42 <br />
43 <p style="text-align: center">
44 <%= link_to t(:sponsors), content_path("sponsors") %>
45 </p>
46 </div>
47 </div>
48 <div id="right_column">
49 <%= tags %>
50 <%= featured_articles %>
51 </div>
52 </div>
53 </body>
54</html> \ No newline at end of file
diff --git a/app/views/menu_items/edit.html.erb b/app/views/menu_items/edit.html.erb
index 9ea0fcc..9891708 100644
--- a/app/views/menu_items/edit.html.erb
+++ b/app/views/menu_items/edit.html.erb
@@ -1,6 +1,6 @@
1<h1>Edit Menu Item</h1> 1<h1>Edit Menu Item</h1>
2 2
3<% form_for @menu_item do |f| %> 3<%= form_for @menu_item do |f| %>
4 <table> 4 <table>
5 5
6 <tr> 6 <tr>
@@ -29,4 +29,4 @@
29 <td class="right"><%= f.submit 'Update' %></td> 29 <td class="right"><%= f.submit 'Update' %></td>
30 </tr> 30 </tr>
31 </table> 31 </table>
32<% end %> \ No newline at end of file 32<% end %>
diff --git a/app/views/menu_items/new.html.erb b/app/views/menu_items/new.html.erb
index 64b9abb..68081d0 100644
--- a/app/views/menu_items/new.html.erb
+++ b/app/views/menu_items/new.html.erb
@@ -1,6 +1,6 @@
1<h1>Add Menu Item</h1> 1<h1>Add Menu Item</h1>
2 2
3<% form_for @menu_item do |f| %> 3<%= form_for @menu_item do |f| %>
4 <table> 4 <table>
5 5
6 <tr> 6 <tr>
@@ -29,4 +29,4 @@
29 <td class="right"><%= f.submit 'Create' %></td> 29 <td class="right"><%= f.submit 'Create' %></td>
30 </tr> 30 </tr>
31 </table> 31 </table>
32<% end %> \ No newline at end of file 32<% end %>
diff --git a/app/views/nodes/edit.html.erb b/app/views/nodes/edit.html.erb
index 612a3d3..d40d4e7 100644
--- a/app/views/nodes/edit.html.erb
+++ b/app/views/nodes/edit.html.erb
@@ -7,8 +7,12 @@
7<% end %> 7<% end %>
8 8
9<div id="page_editor"> 9<div id="page_editor">
10<% form_for(@node) do |f| %> 10<%= form_for(@node) do |f| %>
11 <%= f.error_messages %> 11 <% if @node.errors.any? %>
12 <div class="error_messages">
13 <ul><% @node.errors.full_messages.each do |msg| %><li><%= msg %></li><% end %></ul>
14 </div>
15 <% end %>
12 16
13 <div id="metadata"> 17 <div id="metadata">
14 <div class="node_description">Event</div> 18 <div class="node_description">Event</div>
@@ -35,7 +39,7 @@
35 %> 39 %>
36 </div> 40 </div>
37 41
38 <% fields_for @draft do |d| %> 42 <%= fields_for @draft do |d| %>
39 <div class="node_description">Tags - comma seperated</div> 43 <div class="node_description">Tags - comma seperated</div>
40 <div class="node_content"><%= text_field_tag :tag_list, @draft.tag_list %></div> 44 <div class="node_content"><%= text_field_tag :tag_list, @draft.tag_list %></div>
41 45
diff --git a/app/views/nodes/index.html.erb b/app/views/nodes/index.html.erb
index bf01645..e5a55d4 100644
--- a/app/views/nodes/index.html.erb
+++ b/app/views/nodes/index.html.erb
@@ -27,7 +27,7 @@
27 <%= node.lock_owner.login if node.lock_owner %> 27 <%= node.lock_owner.login if node.lock_owner %>
28 </td> 28 </td>
29 <td> 29 <td>
30 <%= node.draft ? node.draft.revision : node.head.revision %> 30 <%= node.draft ? node.draft.revision : (node.head ? node.head.revision : "EMPTY") %>
31 </td> 31 </td>
32 </tr> 32 </tr>
33 <% end %> 33 <% end %>
diff --git a/app/views/nodes/new.html.erb b/app/views/nodes/new.html.erb
index 7d744de..028d727 100644
--- a/app/views/nodes/new.html.erb
+++ b/app/views/nodes/new.html.erb
@@ -1,11 +1,14 @@
1<h1>Create new node</h1> 1<h1>Create new node</h1>
2 2
3<%= error_messages_for( :node ).gsub("Slug", "Title") %> 3<% if @node.errors.any? %>
4 4 <div class="error_messages">
5 <ul><% @node.errors.full_messages.each do |msg| %><li><%= msg.to_s.gsub("Slug", "Title") %></li><% end %></ul>
6 </div>
7<% end %>
5 8
6<p>What kind of node do you want to create?</p> 9<p>What kind of node do you want to create?</p>
7 10
8<% form_tag nodes_path do %> 11<%= form_tag nodes_path do %>
9<table id="new_node"> 12<table id="new_node">
10 <tr> 13 <tr>
11 <td class="description">Type</td> 14 <td class="description">Type</td>
diff --git a/app/views/occurrences/edit.html.erb b/app/views/occurrences/edit.html.erb
index 6a81188..aa4f6e0 100644
--- a/app/views/occurrences/edit.html.erb
+++ b/app/views/occurrences/edit.html.erb
@@ -1,7 +1,7 @@
1<h1>Editing occurrence</h1> 1<h1>Editing occurrence</h1>
2 2
3<% form_for(@occurrence) do |f| %> 3<%= form_for(@occurrence) do |f| %>
4 <%= f.error_messages %> 4 <%= form_error_messages(f) %>
5 5
6 <p> 6 <p>
7 <%= f.label :summary %><br /> 7 <%= f.label :summary %><br />
@@ -29,4 +29,4 @@
29<% end %> 29<% end %>
30 30
31<%= link_to 'Show', @occurrence %> | 31<%= link_to 'Show', @occurrence %> |
32<%= link_to 'Back', occurrences_path %> \ No newline at end of file 32<%= link_to 'Back', occurrences_path %>
diff --git a/app/views/occurrences/new.html.erb b/app/views/occurrences/new.html.erb
index 0a77af1..c05ce40 100644
--- a/app/views/occurrences/new.html.erb
+++ b/app/views/occurrences/new.html.erb
@@ -1,7 +1,7 @@
1<h1>New occurrence</h1> 1<h1>New occurrence</h1>
2 2
3<% form_for(@occurrence) do |f| %> 3<%= form_for(@occurrence) do |f| %>
4 <%= f.error_messages %> 4 <%= form_error_messages(f) %>
5 5
6 <p> 6 <p>
7 <%= f.label :summary %><br /> 7 <%= f.label :summary %><br />
@@ -28,4 +28,4 @@
28 </p> 28 </p>
29<% end %> 29<% end %>
30 30
31<%= link_to 'Back', occurrences_path %> \ No newline at end of file 31<%= link_to 'Back', occurrences_path %>
diff --git a/app/views/pages/edit.html.erb b/app/views/pages/edit.html.erb
index 749d7e3..8b1242c 100644
--- a/app/views/pages/edit.html.erb
+++ b/app/views/pages/edit.html.erb
@@ -1,7 +1,7 @@
1<h1>Editing page</h1> 1<h1>Editing page</h1>
2 2
3<% form_for(@page) do |f| %> 3<%= form_for(@page) do |f| %>
4 <%= f.error_messages %> 4 <%= form_error_messages(f) %>
5 5
6 <p> 6 <p>
7 <%= f.label :title %><br /> 7 <%= f.label :title %><br />
diff --git a/app/views/pages/new.html.erb b/app/views/pages/new.html.erb
index b27dc62..2758faf 100644
--- a/app/views/pages/new.html.erb
+++ b/app/views/pages/new.html.erb
@@ -1,7 +1,7 @@
1<h1>New page</h1> 1<h1>New page</h1>
2 2
3<% form_for(@page) do |f| %> 3<%= form_for(@page) do |f| %>
4 <%= f.error_messages %> 4 <%= form_error_messages(f) %>
5 5
6 <p> 6 <p>
7 <%= f.label :node_id %><br /> 7 <%= f.label :node_id %><br />
diff --git a/app/views/revisions/diff.html.erb b/app/views/revisions/diff.html.erb
index f7ad79c..efda85d 100644
--- a/app/views/revisions/diff.html.erb
+++ b/app/views/revisions/diff.html.erb
@@ -5,7 +5,7 @@
5 5
6<h1>Revisions#diff</h1> 6<h1>Revisions#diff</h1>
7 7
8<% form_tag diff_node_revisions_path do %> 8<%= form_tag diff_node_revisions_path do %>
9 <%= select_tag :start_revision, options_for_select(@node.pages.map{|x| x.revision}, params[:start_revision].to_i) %> 9 <%= select_tag :start_revision, options_for_select(@node.pages.map{|x| x.revision}, params[:start_revision].to_i) %>
10 <%= select_tag :end_revision, options_for_select(@node.pages.map{|x| x.revision}, params[:end_revision].to_i) %> 10 <%= select_tag :end_revision, options_for_select(@node.pages.map{|x| x.revision}, params[:end_revision].to_i) %>
11 <%= submit_tag 'Diff' %> 11 <%= submit_tag 'Diff' %>
@@ -62,4 +62,4 @@
62 62
63 <h3>Body</h3> 63 <h3>Body</h3>
64 <p id="diffview_body"></p> 64 <p id="diffview_body"></p>
65</div> \ No newline at end of file 65</div>
diff --git a/app/views/revisions/index.html.erb b/app/views/revisions/index.html.erb
index dc9ad51..306f9ea 100644
--- a/app/views/revisions/index.html.erb
+++ b/app/views/revisions/index.html.erb
@@ -4,7 +4,7 @@
4 4
5<h2>Revisions for Node: <%= @node.unique_name %></h2> 5<h2>Revisions for Node: <%= @node.unique_name %></h2>
6 6
7<% form_tag diff_node_revisions_path(@node) do %> 7<%= form_tag diff_node_revisions_path(@node) do %>
8<table id="revisions"> 8<table id="revisions">
9 <tr class="header"> 9 <tr class="header">
10 <th>First</th> 10 <th>First</th>
@@ -15,7 +15,7 @@
15 <th>Date</th> 15 <th>Date</th>
16 <th></th> 16 <th></th>
17 </tr> 17 </tr>
18<% @node.pages.reverse.each do |page| %> 18<% (@pages || @node.pages.all).reverse.each do |page| %>
19 <tr> 19 <tr>
20 <td><%= radio_button_tag :start_revision, page.revision %></td> 20 <td><%= radio_button_tag :start_revision, page.revision %></td>
21 <td><%= radio_button_tag :end_revision, page.revision %></td> 21 <td><%= radio_button_tag :end_revision, page.revision %></td>
@@ -41,4 +41,4 @@
41 </tr> 41 </tr>
42</table> 42</table>
43 43
44<% end %> \ No newline at end of file 44<% end %>
diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb
index fef0912..3c10303 100644
--- a/app/views/sessions/new.html.erb
+++ b/app/views/sessions/new.html.erb
@@ -1,5 +1,5 @@
1<div id="login_form"> 1<div id="login_form">
2 <% form_tag session_path do -%> 2 <%= form_tag session_path do -%>
3 <table> 3 <table>
4 <tr> 4 <tr>
5 <td></td> 5 <td></td>
@@ -21,4 +21,4 @@
21 </tr> 21 </tr>
22 </table> 22 </table>
23 <% end -%> 23 <% end -%>
24</div> \ No newline at end of file 24</div>
diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb
index 226e821..df1005b 100644
--- a/app/views/users/edit.html.erb
+++ b/app/views/users/edit.html.erb
@@ -1,8 +1,13 @@
1<h1>Edit existing user</h1> 1<h1>Edit existing user</h1>
2 2
3<%= error_messages_for :user %> 3<% if @user.errors.any? %>
4 <div class="error_messages">
5 <ul><% @user.errors.full_messages.each do |msg| %><li><%= msg.gsub("Slug", "Title") %></li><% end %></ul>
6 </div>
7<% end %>
4 8
5<% form_for @user do |f| %> 9
10<%= form_for @user do |f| %>
6<table id="new_node"> 11<table id="new_node">
7 <tr> 12 <tr>
8 <td class="description">Login</td> 13 <td class="description">Login</td>
@@ -31,4 +36,4 @@
31 <td class="right"><%= f.submit "Update" %></td> 36 <td class="right"><%= f.submit "Update" %></td>
32 </tr> 37 </tr>
33</table> 38</table>
34<% end %> \ No newline at end of file 39<% end %>
diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb
index 6990c27..6beda4f 100644
--- a/app/views/users/new.html.erb
+++ b/app/views/users/new.html.erb
@@ -1,8 +1,13 @@
1<h1>Create new user</h1> 1<h1>Create new user</h1>
2 2
3<%= error_messages_for :user %> 3<% if @user.errors.any? %>
4 <div class="error_messages">
5 <ul><% @user.errors.full_messages.each do |msg| %><li><%= msg.gsub("Slug", "Title") %></li><% end %></ul>
6 </div>
7<% end %>
4 8
5<% form_for @user do |f| %> 9
10<%= form_for @user do |f| %>
6<table id="new_node"> 11<table id="new_node">
7 <tr> 12 <tr>
8 <td class="description">Login</td> 13 <td class="description">Login</td>
@@ -29,4 +34,4 @@
29 <td class="right"><%= f.submit "Create" %></td> 34 <td class="right"><%= f.submit "Create" %></td>
30 </tr> 35 </tr>
31</table> 36</table>
32<% end %> \ No newline at end of file 37<% end %>