forked from bofh/fetsite
neuigkeit no fallback for editor
This commit is contained in:
@@ -99,7 +99,7 @@ class NeuigkeitenController < ApplicationController
|
|||||||
end
|
end
|
||||||
def edit
|
def edit
|
||||||
@neuigkeit = Neuigkeit.find(params[:id])
|
@neuigkeit = Neuigkeit.find(params[:id])
|
||||||
|
@neuigkeit.no_fallbacks=true
|
||||||
@calentries= @neuigkeit.calentries
|
@calentries= @neuigkeit.calentries
|
||||||
@calentries<< Calentry.new
|
@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?}
|
accepts_nested_attributes_for :calentries, :allow_destroy=>true , :reject_if=> lambda{|a| a[:start].blank?}
|
||||||
before_validation :sanitize
|
before_validation :sanitize
|
||||||
after_save :update_cache
|
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
|
def picture_robust
|
||||||
unless self.picture.url.nil?
|
unless self.picture.url.nil?
|
||||||
return self.picture
|
return self.picture
|
||||||
|
|||||||
@@ -1,17 +1,22 @@
|
|||||||
<%= tinymce_assets %>
|
<%= tinymce_assets %>
|
||||||
|
<% trans = (@neuigkeit.translation.id.nil?) %>
|
||||||
|
<%= "Diese Neuigkeit ist noch nicht in " + I18n.locale.to_s + "vorhanden!" if trans %>
|
||||||
|
|
||||||
|
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<%= semantic_form_for [@neuigkeit.rubrik,@neuigkeit] do |f| %>
|
<%= semantic_form_for [@neuigkeit.rubrik,@neuigkeit] do |f| %>
|
||||||
<%= f.inputs do %>
|
<%= f.inputs do %>
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span12">
|
<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 %>
|
<%= f.input :text, :as=> :tinymce_text %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span6">
|
<div class="span6">
|
||||||
<% f.input :datum, :as=> :datepicker %>
|
<% 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 %>
|
<% f.input :flag_important %>
|
||||||
</div>
|
</div>
|
||||||
<div class="span6">
|
<div class="span6">
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<h1><%= I18n.t("neuigkeit.edit") %></h1>
|
<h1><%= I18n.t("neuigkeit.edit") %></h1>
|
||||||
<%= %>
|
<%= %>
|
||||||
<%= render 'form' %>
|
<%= render 'form' , :locale=>:de %>
|
||||||
<%= render 'layouts/pretty_toolbar' %>
|
<%= render 'layouts/pretty_toolbar' %>
|
||||||
|
|||||||
Reference in New Issue
Block a user