From 5b70b67bfebb6d3a1d4e28cab54b201b0e02fd4c Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Wed, 15 Jul 2015 12:03:05 +0200 Subject: [PATCH] AutoCommit Mit Jul 15 12:03:05 CEST 2015 --- app/controllers/themen_controller.rb | 4 ++-- app/models/thema.rb | 2 +- app/views/themen/index.html.erb | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/controllers/themen_controller.rb b/app/controllers/themen_controller.rb index d8643a4..aa96eb5 100644 --- a/app/controllers/themen_controller.rb +++ b/app/controllers/themen_controller.rb @@ -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]) diff --git a/app/models/thema.rb b/app/models/thema.rb index 77366f8..1abc8b8 100644 --- a/app/models/thema.rb +++ b/app/models/thema.rb @@ -40,7 +40,7 @@ class Thema < ActiveRecord::Base validates :title, :presence => true validates :text, :presence => true - scope :outdated, -> {includes(:translations).where("thema_translations.updated_atI18n.t.locale)} + scope :outdated, -> {includes(:translations).where("thema_translations.updated_atI18n.locale)} scope :public, where(:isdraft=>false).includes(:themengruppe).where("themengruppen.public"=>true) default_scope includes(:translations).order("themen.priority").reverse_order diff --git a/app/views/themen/index.html.erb b/app/views/themen/index.html.erb index 7a47b5f..5577baf 100644 --- a/app/views/themen/index.html.erb +++ b/app/views/themen/index.html.erb @@ -1,11 +1,13 @@

Listing theme1n

drafts

<% @themen_drafts.each do |thema| %> -<%= render partial:"themen/nlink", object: thema %> +<%= render partial:"themen/small", object: thema %> <% end %>

All

<% @themen.each do |thema| %> -<%= render partial:"themen/nlink", object: thema %> +<%= render partial:"themen/small", object: thema %> +<% render thema %> + <% end %>