forked from bofh/fetsite
AutoCommit Mit Jul 15 12:03:05 CEST 2015
This commit is contained in:
@@ -4,9 +4,9 @@ class ThemenController < ApplicationController
|
||||
# GET /themen.json
|
||||
load_and_authorize_resource
|
||||
def index
|
||||
@themen = Thema.accessible_by(current_ability,:show)
|
||||
@themen = Thema.accessible_by(current_ability,:show).where(:isdraft=>false)
|
||||
@themen_drafts = Thema.accessible_by(current_ability,:show).where(:isdraft=>true)
|
||||
|
||||
@themen_outdated =Thema.accessible_by(current_ability,:show).outdated
|
||||
end
|
||||
def show
|
||||
@thema = Thema.find(params[:id])
|
||||
|
||||
@@ -40,7 +40,7 @@ class Thema < ActiveRecord::Base
|
||||
validates :title, :presence => true
|
||||
validates :text, :presence => true
|
||||
|
||||
scope :outdated, -> {includes(:translations).where("thema_translations.updated_at<?",7.month.ago).where("thema_translations.locale"=>I18n.t.locale)}
|
||||
scope :outdated, -> {includes(:translations).where("thema_translations.updated_at<?",7.month.ago).where("thema_translations.locale"=>I18n.locale)}
|
||||
scope :public, where(:isdraft=>false).includes(:themengruppe).where("themengruppen.public"=>true)
|
||||
|
||||
default_scope includes(:translations).order("themen.priority").reverse_order
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
<h1>Listing theme1n</h1><h2>drafts </h2>
|
||||
<% @themen_drafts.each do |thema| %>
|
||||
<%= render partial:"themen/nlink", object: thema %>
|
||||
<%= render partial:"themen/small", object: thema %>
|
||||
<% end %>
|
||||
|
||||
<h2>All</h2>
|
||||
<% @themen.each do |thema| %>
|
||||
<%= render partial:"themen/nlink", object: thema %>
|
||||
<%= render partial:"themen/small", object: thema %>
|
||||
<% render thema %>
|
||||
|
||||
<% end %>
|
||||
<br />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user