summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/assets/config/manifest.js0
-rw-r--r--app/controllers/assets_controller.rb17
-rw-r--r--app/controllers/content_controller.rb9
-rw-r--r--app/controllers/events_controller.rb10
-rw-r--r--app/controllers/menu_items_controller.rb15
-rw-r--r--app/controllers/nodes_controller.rb6
-rw-r--r--app/controllers/occurrences_controller.rb11
-rw-r--r--app/controllers/pages_controller.rb2
-rw-r--r--app/controllers/users_controller.rb2
-rw-r--r--app/helpers/admin_helper.rb6
-rw-r--r--app/helpers/link_helper.rb25
-rw-r--r--app/models/application_record.rb3
-rw-r--r--app/models/asset.rb17
-rw-r--r--app/models/concerns/file_attachment.rb124
-rw-r--r--app/models/event.rb2
-rw-r--r--app/models/menu_item.rb2
-rw-r--r--app/models/node.rb2
-rw-r--r--app/models/occurrence.rb2
-rw-r--r--app/models/page.rb2
-rw-r--r--app/models/permission.rb2
-rw-r--r--app/models/related_asset.rb2
-rw-r--r--app/models/user.rb2
-rw-r--r--app/views/content/_search.html.erb2
-rw-r--r--app/views/content/_tags.html.erb2
-rw-r--r--app/views/layouts/application.html.erb9
-rw-r--r--app/views/layouts/application.html.erb.bak54
26 files changed, 218 insertions, 112 deletions
diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/app/assets/config/manifest.js
diff --git a/app/controllers/assets_controller.rb b/app/controllers/assets_controller.rb
index a11bbdd..d150e06 100644
--- a/app/controllers/assets_controller.rb
+++ b/app/controllers/assets_controller.rb
@@ -7,10 +7,9 @@ class AssetsController < ApplicationController
7 layout 'admin' 7 layout 'admin'
8 8
9 def index 9 def index
10 @assets = Asset.all.paginate( 10 @assets = Asset.order('id DESC').paginate(
11 :page => params[:page], 11 :page => params[:page],
12 :per_page => 20, 12 :per_page => 20
13 :order => 'id DESC'
14 ) 13 )
15 end 14 end
16 15
@@ -44,7 +43,7 @@ class AssetsController < ApplicationController
44 # POST /assets 43 # POST /assets
45 # POST /assets.xml 44 # POST /assets.xml
46 def create 45 def create
47 @asset = Asset.new(params[:asset]) 46 @asset = Asset.new(asset_params)
48 47
49 respond_to do |format| 48 respond_to do |format|
50 if @asset.save 49 if @asset.save
@@ -64,7 +63,7 @@ class AssetsController < ApplicationController
64 @asset = Asset.find(params[:id]) 63 @asset = Asset.find(params[:id])
65 64
66 respond_to do |format| 65 respond_to do |format|
67 if @asset.update_attributes(params[:asset]) 66 if @asset.update(asset_params)
68 flash[:notice] = 'Asset was successfully updated.' 67 flash[:notice] = 'Asset was successfully updated.'
69 format.html { redirect_to(@asset) } 68 format.html { redirect_to(@asset) }
70 format.xml { head :ok } 69 format.xml { head :ok }
@@ -86,4 +85,10 @@ class AssetsController < ApplicationController
86 format.xml { head :ok } 85 format.xml { head :ok }
87 end 86 end
88 end 87 end
88
89 private
90
91 def asset_params
92 params.require(:asset).permit(:name, :upload)
93 end
89end 94end
diff --git a/app/controllers/content_controller.rb b/app/controllers/content_controller.rb
index 876bccf..8d33105 100644
--- a/app/controllers/content_controller.rb
+++ b/app/controllers/content_controller.rb
@@ -15,13 +15,14 @@ class ContentController < ApplicationController
15 15
16 if @page and @page.public? 16 if @page and @page.public?
17 render( 17 render(
18 :file => @page.valid_template, 18 :template => @page.valid_template,
19 :layout => true 19 :layout => true
20 ) 20 )
21 else 21 else
22 render( 22 render(
23 :file => Rails.root.join('public', '404.html'), 23 :file => Rails.root.join('public', '404.html').to_s,
24 :status => 404 24 :status => 404,
25 :layout => false
25 ) 26 )
26 end 27 end
27 28
@@ -32,7 +33,7 @@ class ContentController < ApplicationController
32 @images = @page.assets.images 33 @images = @page.assets.images
33 render :file => "content/gallery" 34 render :file => "content/gallery"
34 else 35 else
35 render :nothing => true, :status => 404 36 head :not_found
36 end 37 end
37 end 38 end
38 39
diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb
index 6eba476..7695e9b 100644
--- a/app/controllers/events_controller.rb
+++ b/app/controllers/events_controller.rb
@@ -47,7 +47,7 @@ class EventsController < ApplicationController
47 # POST /events 47 # POST /events
48 # POST /events.xml 48 # POST /events.xml
49 def create 49 def create
50 @event = Event.new(params[:event]) 50 @event = Event.new(event_params)
51 51
52 respond_to do |format| 52 respond_to do |format|
53 if @event.save 53 if @event.save
@@ -67,7 +67,7 @@ class EventsController < ApplicationController
67 @event = Event.find(params[:id]) 67 @event = Event.find(params[:id])
68 68
69 respond_to do |format| 69 respond_to do |format|
70 if @event.update_attributes(params[:event]) 70 if @event.update(event_params)
71 flash[:notice] = 'Event was successfully updated.' 71 flash[:notice] = 'Event was successfully updated.'
72 format.html { redirect_to(edit_node_path(@event.node)) } 72 format.html { redirect_to(edit_node_path(@event.node)) }
73 format.xml { head :ok } 73 format.xml { head :ok }
@@ -89,4 +89,10 @@ class EventsController < ApplicationController
89 format.xml { head :ok } 89 format.xml { head :ok }
90 end 90 end
91 end 91 end
92
93 private
94
95 def event_params
96 params.require(:event).permit(:start_time, :end_time, :rrule, :custom_rrule, :allday, :url, :latitude, :longitude, :node_id, :location)
97 end
92end 98end
diff --git a/app/controllers/menu_items_controller.rb b/app/controllers/menu_items_controller.rb
index 4018693..1b1eb59 100644
--- a/app/controllers/menu_items_controller.rb
+++ b/app/controllers/menu_items_controller.rb
@@ -14,11 +14,11 @@ class MenuItemsController < ApplicationController
14 end 14 end
15 15
16 def new 16 def new
17 @menu_item = MenuItem.new params[:menu_item] 17 @menu_item = MenuItem.new menu_item_params
18 end 18 end
19 19
20 def create 20 def create
21 if MenuItem.create( params[:menu_item] ) 21 if MenuItem.create( menu_item_params )
22 redirect_to menu_items_path 22 redirect_to menu_items_path
23 else 23 else
24 render :new 24 render :new
@@ -32,7 +32,7 @@ class MenuItemsController < ApplicationController
32 def update 32 def update
33 @menu_item = MenuItem.find( params[:id] ) 33 @menu_item = MenuItem.find( params[:id] )
34 34
35 if @menu_item.update_attributes( params[:menu_item] ) 35 if @menu_item.update( menu_item_params )
36 redirect_to menu_items_path 36 redirect_to menu_items_path
37 else 37 else
38 render :edit 38 render :edit
@@ -48,10 +48,15 @@ class MenuItemsController < ApplicationController
48 def sort 48 def sort
49 params[:menu_items].each_with_index do |item_id, index| 49 params[:menu_items].each_with_index do |item_id, index|
50 menu_item = MenuItem.find(item_id) 50 menu_item = MenuItem.find(item_id)
51 menu_item.update_attributes(:position => index + 1) 51 menu_item.update(:position => index + 1)
52 end 52 end
53 53
54 render :nothing => true 54 head :ok
55 end 55 end
56 56
57 private
58
59 def menu_item_params
60 params.require(:menu_item).permit(:node_id, :path, :position, :type, :type_id)
61 end
57end 62end
diff --git a/app/controllers/nodes_controller.rb b/app/controllers/nodes_controller.rb
index 482d0ac..bd60b27 100644
--- a/app/controllers/nodes_controller.rb
+++ b/app/controllers/nodes_controller.rb
@@ -36,7 +36,7 @@ class NodesController < ApplicationController
36 @node.slug = params[:title].parameterize.to_s 36 @node.slug = params[:title].parameterize.to_s
37 37
38 if @node.save 38 if @node.save
39 @node.draft.update_attributes(:title => params[:title]) 39 @node.draft.update(:title => params[:title])
40 case params[:kind] 40 case params[:kind]
41 when "update" 41 when "update"
42 @node.draft.tag_list.add("update") 42 @node.draft.tag_list.add("update")
@@ -70,10 +70,10 @@ class NodesController < ApplicationController
70 end 70 end
71 71
72 def update 72 def update
73 @node.update_attributes(node_params) 73 @node.update(node_params)
74 @draft = @node.find_or_create_draft current_user 74 @draft = @node.find_or_create_draft current_user
75 @draft.tag_list = params[:tag_list] 75 @draft.tag_list = params[:tag_list]
76 if @draft.update_attributes( page_params ) 76 if @draft.update( page_params )
77 flash[:notice] = "Draft has been saved: #{Time.now}" 77 flash[:notice] = "Draft has been saved: #{Time.now}"
78 respond_to do |format| 78 respond_to do |format|
79 format.html { redirect_to edit_node_path(@node) } 79 format.html { redirect_to edit_node_path(@node) }
diff --git a/app/controllers/occurrences_controller.rb b/app/controllers/occurrences_controller.rb
index 61b42ff..0f30ce3 100644
--- a/app/controllers/occurrences_controller.rb
+++ b/app/controllers/occurrences_controller.rb
@@ -45,7 +45,7 @@ class OccurrencesController < ApplicationController
45 # POST /occurrences 45 # POST /occurrences
46 # POST /occurrences.xml 46 # POST /occurrences.xml
47 def create 47 def create
48 @occurrence = Occurrence.new(params[:occurrence]) 48 @occurrence = Occurrence.new(occurrence_params)
49 49
50 respond_to do |format| 50 respond_to do |format|
51 if @occurrence.save 51 if @occurrence.save
@@ -65,7 +65,7 @@ class OccurrencesController < ApplicationController
65 @occurrence = Occurrence.find(params[:id]) 65 @occurrence = Occurrence.find(params[:id])
66 66
67 respond_to do |format| 67 respond_to do |format|
68 if @occurrence.update_attributes(params[:occurrence]) 68 if @occurrence.update(occurrence_params)
69 flash[:notice] = 'Occurrence was successfully updated.' 69 flash[:notice] = 'Occurrence was successfully updated.'
70 format.html { redirect_to(@occurrence) } 70 format.html { redirect_to(@occurrence) }
71 format.xml { head :ok } 71 format.xml { head :ok }
@@ -87,4 +87,11 @@ class OccurrencesController < ApplicationController
87 format.xml { head :ok } 87 format.xml { head :ok }
88 end 88 end
89 end 89 end
90
91 private
92
93 def occurrence_params
94 params.require(:occurrence).permit(:start_time, :end_time, :node_id, :event_id)
95 end
96
90end 97end
diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb
index f5609eb..a40bf10 100644
--- a/app/controllers/pages_controller.rb
+++ b/app/controllers/pages_controller.rb
@@ -22,6 +22,6 @@ class PagesController < ApplicationController
22 page = Page.find(params[:id]) 22 page = Page.find(params[:id])
23 page.update_assets(params[:images]) 23 page.update_assets(params[:images])
24 24
25 render :nothing => true, :status => 200 25 head :ok
26 end 26 end
27end 27end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 72e6058..98fd534 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -36,7 +36,7 @@ class UsersController < ApplicationController
36 permitted = user_params 36 permitted = user_params
37 permitted.delete(:admin) unless current_user.is_admin? 37 permitted.delete(:admin) unless current_user.is_admin?
38 38
39 if @user.update_attributes(permitted) 39 if @user.update(permitted)
40 flash[:notice] = "Updated user #{@user.login}" 40 flash[:notice] = "Updated user #{@user.login}"
41 redirect_to user_path(@user) 41 redirect_to user_path(@user)
42 else 42 else
diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb
index 389f6dc..e5c3d5c 100644
--- a/app/helpers/admin_helper.rb
+++ b/app/helpers/admin_helper.rb
@@ -1,11 +1,11 @@
1module AdminHelper 1module AdminHelper
2 2
3 def language_selector 3 def language_selector
4 case I18n.locale 4 case I18n.locale
5 when :de 5 when :de
6 link_to raw('<span class="inactive">English</span>'), url_for(:overwrite_params => {:locale => :en}) 6 link_to raw('<span class="inactive">English</span>'), url_for(params.permit!.to_h.merge('locale' => 'en'))
7 when :en 7 when :en
8 link_to raw('<span class="inactive">Deutsch</span>'), url_for(:overwrite_params => {:locale => :de}) 8 link_to raw('<span class="inactive">Deutsch</span>'), url_for(params.permit!.to_h.merge('locale' => 'de'))
9 end 9 end
10 end 10 end
11end 11end
diff --git a/app/helpers/link_helper.rb b/app/helpers/link_helper.rb
index 85d8fbe..39ec495 100644
--- a/app/helpers/link_helper.rb
+++ b/app/helpers/link_helper.rb
@@ -45,9 +45,28 @@ module LinkHelper
45 "Locked by #{@node.lock_owner.login}\n" + 45 "Locked by #{@node.lock_owner.login}\n" +
46 "Last modified #{@page.updated_at.to_s(:db)}" 46 "Last modified #{@page.updated_at.to_s(:db)}"
47 47
48 link_to( 48 link_to 'Unlock', safe_path(:unlock_node_path, @node), :method => :put, :data => { :confirm => message }
49 'Unlock', unlock_node_path(@node), :method => :put, :data => { :confirm => message } 49 end
50
51 # Rails 6.1 workaround: content_path named helper returns RouteWithParams
52 # when called from within a catch-all glob route request context.
53 # Rails 6.1 workaround: named route helpers return RouteWithParams when called
54 # from within a catch-all glob route request context.
55 # Remove this method when upgrading to Rails 7.0+, where this is fixed.
56 def safe_path(name, *args)
57 Rails.application.routes.url_helpers.send(name, *args)
58 end
59
60 def content_path(page_path = nil, options = {})
61 if page_path.is_a?(Hash)
62 options = page_path
63 page_path = options.delete(:page_path)
64 end
65 options[:locale] ||= params[:locale] || I18n.locale
66 Rails.application.routes.url_helpers.content_path(
67 Array(page_path).join("/").sub(/^\//, ""),
68 options
50 ) 69 )
51 end 70 end
52 71
53end 72end
diff --git a/app/models/application_record.rb b/app/models/application_record.rb
new file mode 100644
index 0000000..10a4cba
--- /dev/null
+++ b/app/models/application_record.rb
@@ -0,0 +1,3 @@
1class ApplicationRecord < ActiveRecord::Base
2 self.abstract_class = true
3end
diff --git a/app/models/asset.rb b/app/models/asset.rb
index f6526f2..aca0ee8 100644
--- a/app/models/asset.rb
+++ b/app/models/asset.rb
@@ -1,20 +1,11 @@
1class Asset < ActiveRecord::Base 1class Asset < ApplicationRecord
2
3 include FileAttachment
2 4
3 has_many :related_assets, :dependent => :destroy 5 has_many :related_assets, :dependent => :destroy
4 has_many :pages, :through => :related_assets 6 has_many :pages, :through => :related_assets
5 7
6 has_attached_file( 8 scope :images, -> { where(:upload_content_type => ["image/gif", "image/jpeg", "image/png", "image/webp"]) }
7 :upload,
8 :path => ":rails_root/public/system/:attachment/:id/:style/:filename",
9 :url => "/system/:attachment/:id/:style/:filename",
10 :styles => {
11 :medium => "300x300",
12 :thumb => "100x100",
13 :headline => "460x250#"
14 }
15 )
16
17 scope :images, -> { where(:upload_content_type => ["image/gif", "image/jpeg", "image/png"]) }
18 scope :documents, -> { where(:upload_content_type => ["application/pdf", "text/plain", "text/rtf"]) } 9 scope :documents, -> { where(:upload_content_type => ["application/pdf", "text/plain", "text/rtf"]) }
19 scope :audio, -> { where(:upload_content_type => ["audio/mpeg", "audio/x-m4a", "audio/wav", "audio/x-wav"]) } 10 scope :audio, -> { where(:upload_content_type => ["audio/mpeg", "audio/x-m4a", "audio/wav", "audio/x-wav"]) }
20 11
diff --git a/app/models/concerns/file_attachment.rb b/app/models/concerns/file_attachment.rb
new file mode 100644
index 0000000..b3ff0f1
--- /dev/null
+++ b/app/models/concerns/file_attachment.rb
@@ -0,0 +1,124 @@
1# FileAttachment — minimal drop-in replacement for Paperclip's has_attached_file.
2#
3# Provides the same interface used throughout this codebase:
4# asset.upload.url -> "/system/uploads/:id/original/:filename"
5# asset.upload.url(:thumb) -> "/system/uploads/:id/thumb/:filename"
6# asset.upload.content_type -> string
7# asset.upload.size -> integer (bytes)
8#
9# Files are stored at:
10# Rails.root/public/system/uploads/:id/:style/:filename
11#
12# Image variants are generated via ImageMagick (convert) on upload.
13# Non-image files get only an original, no variants.
14#
15# To replace an asset: assign a new file to asset.upload= and save.
16# The filename is fixed on first upload and preserved on replacement,
17# keeping all public URLs stable.
18#
19# Future: if more sophisticated asset management is needed (versioning,
20# S3, on-demand resizing), replace this module and keep the interface.
21
22module FileAttachment
23 extend ActiveSupport::Concern
24
25 STYLES = {
26 medium: { geometry: "300x300>", format: nil },
27 thumb: { geometry: "100x100>", format: nil },
28 headline: { geometry: "460x250!", format: nil }
29 }.freeze
30
31 IMAGE_CONTENT_TYPES = %w[image/jpeg image/gif image/png image/webp].freeze
32
33 included do
34 attr_reader :upload
35
36 after_initialize :build_upload_proxy
37 after_save :process_upload
38 before_destroy :delete_upload_files
39 end
40
41 def upload=(uploaded_file)
42 return if uploaded_file.blank?
43 @pending_upload = uploaded_file
44 # Populate the database columns immediately so validations can use them
45 self.upload_file_name = sanitize_filename(uploaded_file.original_filename)
46 self.upload_content_type = uploaded_file.content_type.to_s.split(';').first.strip
47 self.upload_file_size = uploaded_file.size
48 self.upload_updated_at = Time.current
49 build_upload_proxy
50 end
51
52 private
53
54 def build_upload_proxy
55 @upload = UploadProxy.new(self)
56 end
57
58 def process_upload
59 return unless @pending_upload
60 uploaded_file = @pending_upload
61 @pending_upload = nil
62
63 original_path = file_path(:original)
64 FileUtils.mkdir_p(File.dirname(original_path))
65 FileUtils.cp(uploaded_file.tempfile.path, original_path)
66
67 if IMAGE_CONTENT_TYPES.include?(upload_content_type)
68 generate_variants(original_path)
69 end
70 end
71
72 def generate_variants(original_path)
73 STYLES.each do |style, options|
74 dest_path = file_path(style)
75 FileUtils.mkdir_p(File.dirname(dest_path))
76 system("convert", original_path, "-resize", options[:geometry], dest_path)
77 end
78 end
79
80 def delete_upload_files
81 dir = Rails.root.join("public", "system", "uploads", id.to_s)
82 FileUtils.rm_rf(dir) if Dir.exist?(dir)
83 end
84
85 def file_path(style)
86 Rails.root.join(
87 "public", "system", "uploads",
88 id.to_s, style.to_s, upload_file_name
89 ).to_s
90 end
91
92 def sanitize_filename(filename)
93 File.basename(filename).gsub(/[^\w\.\-]/, '_')
94 end
95
96 # Proxy object returned by asset.upload, providing the Paperclip-compatible
97 # interface used in views: .url, .url(:style), .content_type, .size
98 class UploadProxy
99 def initialize(record)
100 @record = record
101 end
102
103 def url(style = :original)
104 return "" if @record.upload_file_name.blank?
105 "/system/uploads/#{@record.id}/#{style}/#{@record.upload_file_name}"
106 end
107
108 def content_type
109 @record.upload_content_type.to_s
110 end
111
112 def size
113 @record.upload_file_size.to_i
114 end
115
116 def present?
117 @record.upload_file_name.present?
118 end
119
120 def blank?
121 !present?
122 end
123 end
124end
diff --git a/app/models/event.rb b/app/models/event.rb
index 23deed6..94a22e3 100644
--- a/app/models/event.rb
+++ b/app/models/event.rb
@@ -1,4 +1,4 @@
1class Event < ActiveRecord::Base 1class Event < ApplicationRecord
2 2
3 # Associations 3 # Associations
4 4
diff --git a/app/models/menu_item.rb b/app/models/menu_item.rb
index eb82347..7769b7f 100644
--- a/app/models/menu_item.rb
+++ b/app/models/menu_item.rb
@@ -1,4 +1,4 @@
1class MenuItem < ActiveRecord::Base 1class MenuItem < ApplicationRecord
2 2
3 default_scope -> { where(:type => "MenuItem") } 3 default_scope -> { where(:type => "MenuItem") }
4 4
diff --git a/app/models/node.rb b/app/models/node.rb
index d760f0a..f7a70d0 100644
--- a/app/models/node.rb
+++ b/app/models/node.rb
@@ -1,4 +1,4 @@
1class Node < ActiveRecord::Base 1class Node < ApplicationRecord
2 # Mixins and Plugins 2 # Mixins and Plugins
3 acts_as_nested_set 3 acts_as_nested_set
4 4
diff --git a/app/models/occurrence.rb b/app/models/occurrence.rb
index 8457ffd..3baf447 100644
--- a/app/models/occurrence.rb
+++ b/app/models/occurrence.rb
@@ -1,7 +1,7 @@
1# TODO Make a gem out of the c wrapper 1# TODO Make a gem out of the c wrapper
2require 'chaos_calendar' 2require 'chaos_calendar'
3 3
4class Occurrence < ActiveRecord::Base 4class Occurrence < ApplicationRecord
5 5
6 # Associations 6 # Associations
7 7
diff --git a/app/models/page.rb b/app/models/page.rb
index 93debf8..d1e7439 100644
--- a/app/models/page.rb
+++ b/app/models/page.rb
@@ -1,6 +1,6 @@
1require 'xml' 1require 'xml'
2 2
3class Page < ActiveRecord::Base 3class Page < ApplicationRecord
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 = Rails.root.join('app', 'views', PUBLIC_TEMPLATE_PATH) 6 FULL_PUBLIC_TEMPLATE_PATH = Rails.root.join('app', 'views', PUBLIC_TEMPLATE_PATH)
diff --git a/app/models/permission.rb b/app/models/permission.rb
index f304538..1383a4b 100644
--- a/app/models/permission.rb
+++ b/app/models/permission.rb
@@ -1,4 +1,4 @@
1class Permission < ActiveRecord::Base 1class Permission < ApplicationRecord
2 # Validations 2 # Validations
3 validates_presence_of :user_id, :node_id, :granted 3 validates_presence_of :user_id, :node_id, :granted
4 validates_inclusion_of :granted, :in => [true, false] 4 validates_inclusion_of :granted, :in => [true, false]
diff --git a/app/models/related_asset.rb b/app/models/related_asset.rb
index 2b61c51..8f16460 100644
--- a/app/models/related_asset.rb
+++ b/app/models/related_asset.rb
@@ -1,4 +1,4 @@
1class RelatedAsset < ActiveRecord::Base 1class RelatedAsset < ApplicationRecord
2 belongs_to :page 2 belongs_to :page
3 belongs_to :asset 3 belongs_to :asset
4 4
diff --git a/app/models/user.rb b/app/models/user.rb
index a2540b5..92ac33a 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1,6 +1,6 @@
1require 'digest/sha1' 1require 'digest/sha1'
2 2
3class User < ActiveRecord::Base 3class User < ApplicationRecord
4 # Mixins and Plugins 4 # Mixins and Plugins
5 include Authentication 5 include Authentication
6 include Authentication::ByPassword 6 include Authentication::ByPassword
diff --git a/app/views/content/_search.html.erb b/app/views/content/_search.html.erb
index aa91424..f732fca 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 safe_path(: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 169ae84..387f51c 100644
--- a/app/views/content/_tags.html.erb
+++ b/app/views/content/_tags.html.erb
@@ -3,7 +3,7 @@
3 <h2>Tags</h2> 3 <h2>Tags</h2>
4 <ul class="teasertext"> 4 <ul class="teasertext">
5 <% @page.tags.each do |tag| %> 5 <% @page.tags.each do |tag| %>
6 <li><%= link_to tag.name, tag_path(:id => tag.name) %></li> 6 <li><%= link_to tag.name, safe_path(:tag_path, tag.name) %></li>
7 <% end %> 7 <% end %>
8 </ul> 8 </ul>
9</div> 9</div>
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 2a46f09..84dcdc6 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -16,8 +16,8 @@
16 <%= stylesheet_link_tag "shadowbox" %> 16 <%= stylesheet_link_tag "shadowbox" %>
17 <%= javascript_include_tag 'public' %> 17 <%= javascript_include_tag 'public' %>
18 18
19 <%= auto_discovery_link_tag(:atom, {:locale => :de, :controller => "rss", :action => "updates", :format => :xml}) %> 19 <%= auto_discovery_link_tag(:atom, '/rss/updates.xml', title: "ATOM") %>
20 <%= auto_discovery_link_tag(:rss, {:locale => :de, :controller => "rss", :action => "updates", :format => :rdf}) %> 20 <%= auto_discovery_link_tag(:rss, '/rss/updates.rdf', title: "RSS") %>
21 21
22 <script> 22 <script>
23 (function() { document.addEventListener("DOMContentLoaded", function() { 23 (function() { document.addEventListener("DOMContentLoaded", function() {
@@ -32,7 +32,6 @@
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") %>
35 <!-- <%= link_to_path(image_tag("header.png"), "/home") %> -->
36 </div> 35 </div>
37 <div id="toolbox"> 36 <div id="toolbox">
38 <div id="search"> 37 <div id="search">
@@ -53,8 +52,8 @@
53 <div class="main_navigation"> 52 <div class="main_navigation">
54 <h2>Admin</h2> 53 <h2>Admin</h2>
55 <ul> 54 <ul>
56 <li><%= link_to raw('<span class="inactive admin_edit_link">⚙️ Overview</span>'),:controller => :admin, :action => 'index' %></li> 55 <li><%= link_to raw('<span class="inactive admin_edit_link">⚙️ Overview</span>'), safe_path(:admin_path) %></li>
57 <li><%= link_to raw('<span class="inactive admin_edit_link">✎ Edit</span>'), node_path(:id => @page.node) %></li> 56 <li><%= link_to raw('<span class="inactive admin_edit_link">✎ Edit</span>'), safe_path(:node_path, @page.node) %></li>
58 </ul> 57 </ul>
59 </div> 58 </div>
60 <% end %> 59 <% end %>
diff --git a/app/views/layouts/application.html.erb.bak b/app/views/layouts/application.html.erb.bak
deleted file mode 100644
index 3c95d75..0000000
--- a/app/views/layouts/application.html.erb.bak
+++ /dev/null
@@ -1,54 +0,0 @@
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