themessticker, cleanup routes

This commit is contained in:
2014-06-25 23:09:05 +05:30
parent 2ba920331a
commit ee8f2d0076
14 changed files with 208 additions and 263 deletions

View File

@@ -38,7 +38,7 @@ class Ability
can [:show, :index], Lva
can [:show,:index], Gallery
can [:show, :index,:faqs], Themengruppe
can [:show], Thema
can [:show], Thema, :isdraft=>false
can [:create], Beispiel
can [:show, :index], Fetprofile
can [:show, :index],Gremium
@@ -53,7 +53,7 @@ class Ability
if( user.has_role?("fetuser") || user.has_role?("fetadmin"))
can :manage,:all
can :manage, Modulgruppe
can :showdraft , Thema
can [:show,:index], Calendar
can [:edit, :update,:new,:create,:verwalten], Calendar
can [:edit, :update,:new,:create,:verwalten], Calentry

View File

@@ -21,11 +21,12 @@ include Rails.application.routes.url_helpers
validates :themengruppe, :presence => true
validates :title, :presence => true
validates :text, :presence => true
scope :search, ->(query) {where("text like ? or title like ?", "%#{query}%", "%#{query}%")}
scope :outdated, -> {where("updated_at < ?", 1.week.ago)}
scope :outdated, -> {where("updated_at < ?", 2.month.ago)}
translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true
def is_outdated?
updated_at < 1.week.ago
updated_at < 1.month.ago
end
def is_wiki?
!(wikiname.nil? || wikiname.empty?)

View File

@@ -21,7 +21,7 @@ class Themengruppe < ActiveRecord::Base
translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true
scope :intern,-> {where(:public=>false)}
scope :intern,-> {where("NOT public")}
scope :public,-> {where(:public=>true)}
def self.find_wiki_default