From a0427336c8639a07388702407401124930023dce Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Mon, 23 Feb 2015 09:19:30 +0100 Subject: [PATCH] sticky topics --- app/controllers/home_controller.rb | 1 + app/models/thema.rb | 2 +- app/views/themen/_form.html.erb | 2 ++ db/migrate/20150219142123_add_sticky_to_thema.rb | 9 +++++++++ 4 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20150219142123_add_sticky_to_thema.rb diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 20a9a49..dedb4e7 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -8,6 +8,7 @@ class HomeController < ApplicationController else @starttopic=@themen = nil end + @stickythemen = Thema.where(:sticky_startpage=>true) end def dev diff --git a/app/models/thema.rb b/app/models/thema.rb index f9d506f..2149dcd 100644 --- a/app/models/thema.rb +++ b/app/models/thema.rb @@ -13,7 +13,7 @@ require 'uri' class Thema < ActiveRecord::Base include Rails.application.routes.url_helpers - attr_accessible :text, :title, :themengruppe_id,:isdraft, :hidelink, :hideattachment + attr_accessible :text, :title, :themengruppe_id,:isdraft, :hidelink, :hideattachment, :sticky_startpage,:sticky_intern has_many :fragen has_many :attachments belongs_to :themengruppe, :foreign_key => "themengruppe_id" diff --git a/app/views/themen/_form.html.erb b/app/views/themen/_form.html.erb index 4995656..3ee1ba9 100644 --- a/app/views/themen/_form.html.erb +++ b/app/views/themen/_form.html.erb @@ -21,6 +21,8 @@
<%= f.input :hideattachment %> + <%= f.input :sticky_intern %> + <%= f.input :sticky_startpage %>
diff --git a/db/migrate/20150219142123_add_sticky_to_thema.rb b/db/migrate/20150219142123_add_sticky_to_thema.rb new file mode 100644 index 0000000..0f6bef7 --- /dev/null +++ b/db/migrate/20150219142123_add_sticky_to_thema.rb @@ -0,0 +1,9 @@ +class AddStickyToThema < ActiveRecord::Migration + def change + add_column :themen, :sticky_startpage, :boolean + add_column :themen, :sticky_intern, :boolean + add_column :themengruppen, :sticky_startpage, :boolean + add_column :themengruppen, :sticky_intern, :boolean + add_column :galleries, :sticky_startpage, :boolean + end +end