sticky topics

This commit is contained in:
Andreas Stephanides
2015-02-23 09:19:30 +01:00
parent 81e97837de
commit a0427336c8
4 changed files with 13 additions and 1 deletions

View File

@@ -8,6 +8,7 @@ class HomeController < ApplicationController
else else
@starttopic=@themen = nil @starttopic=@themen = nil
end end
@stickythemen = Thema.where(:sticky_startpage=>true)
end end
def dev def dev

View File

@@ -13,7 +13,7 @@
require 'uri' require 'uri'
class Thema < ActiveRecord::Base class Thema < ActiveRecord::Base
include Rails.application.routes.url_helpers 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 :fragen
has_many :attachments has_many :attachments
belongs_to :themengruppe, :foreign_key => "themengruppe_id" belongs_to :themengruppe, :foreign_key => "themengruppe_id"

View File

@@ -21,6 +21,8 @@
</div> </div>
<div class="span4"> <div class="span4">
<%= f.input :hideattachment %> <%= f.input :hideattachment %>
<%= f.input :sticky_intern %>
<%= f.input :sticky_startpage %>
</div> </div>

View File

@@ -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