diff --git a/app/controllers/neuigkeiten_controller.rb b/app/controllers/neuigkeiten_controller.rb index 937aab4..2a8ade6 100755 --- a/app/controllers/neuigkeiten_controller.rb +++ b/app/controllers/neuigkeiten_controller.rb @@ -99,7 +99,7 @@ class NeuigkeitenController < ApplicationController end def edit @neuigkeit = Neuigkeit.find(params[:id]) - + @neuigkeit.no_fallbacks=true @calentries= @neuigkeit.calentries @calentries<< Calentry.new diff --git a/app/models/neuigkeit.rb b/app/models/neuigkeit.rb index c338d41..85a31a2 100755 --- a/app/models/neuigkeit.rb +++ b/app/models/neuigkeit.rb @@ -41,7 +41,24 @@ class Neuigkeit < ActiveRecord::Base accepts_nested_attributes_for :calentries, :allow_destroy=>true , :reject_if=> lambda{|a| a[:start].blank?} before_validation :sanitize after_save :update_cache - + attr_accessor :no_fallbacks + def globalize_fallbacks(locale) + if self.no_fallbacks + [locale] + else + super + end + end + def read_attribute(name,options={}) + if translated?(name) + a=super(name,options) + a=self.translation_for(options[:locale] || I18n.locale).read_attribute(name) if self.no_fallbacks + + a + else + super(name) + end + end def picture_robust unless self.picture.url.nil? return self.picture diff --git a/app/views/neuigkeiten/_form.html.erb b/app/views/neuigkeiten/_form.html.erb index 76f452f..925415d 100755 --- a/app/views/neuigkeiten/_form.html.erb +++ b/app/views/neuigkeiten/_form.html.erb @@ -1,17 +1,22 @@ <%= tinymce_assets %> +<% trans = (@neuigkeit.translation.id.nil?) %> +<%= "Diese Neuigkeit ist noch nicht in " + I18n.locale.to_s + "vorhanden!" if trans %> + +