neuigkeit no fallback for editor
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
<%= tinymce_assets %>
|
||||
<% trans = (@neuigkeit.translation.id.nil?) %>
|
||||
<%= "Diese Neuigkeit ist noch nicht in " + I18n.locale.to_s + "vorhanden!" if trans %>
|
||||
|
||||
|
||||
<div class="container-fluid">
|
||||
<%= semantic_form_for [@neuigkeit.rubrik,@neuigkeit] do |f| %>
|
||||
<%= f.inputs do %>
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<%= f.input :title, :placeholder=> "Titel" %>
|
||||
|
||||
<%= f.input :title, :placeholder=> "Titel", :value=> @neuigkeit.translation.title.to_s %>
|
||||
<%= f.input :text, :as=> :tinymce_text %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<div class="span6">
|
||||
<% f.input :datum, :as=> :datepicker %>
|
||||
<%= f.input :rubrik, :as=> :radio, :collection=>Rubrik.all %>
|
||||
<%= f.input :rubrik, :as=> :select, :collection=>Rubrik.all %>
|
||||
<% f.input :flag_important %>
|
||||
</div>
|
||||
<div class="span6">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<h1><%= I18n.t("neuigkeit.edit") %></h1>
|
||||
<%= %>
|
||||
<%= render 'form' %>
|
||||
<%= render 'form' , :locale=>:de %>
|
||||
<%= render 'layouts/pretty_toolbar' %>
|
||||
|
||||
Reference in New Issue
Block a user