Add footer to site_info
This commit is contained in:
parent
1fb6c20b86
commit
0246341aef
|
@ -16,6 +16,7 @@ class Site
|
||||||
field :department
|
field :department
|
||||||
|
|
||||||
has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||||
|
has_one :footer, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||||
has_many :site_metas, :autosave => true, :dependent => :destroy
|
has_many :site_metas, :autosave => true, :dependent => :destroy
|
||||||
|
|
||||||
before_save :set_key
|
before_save :set_key
|
||||||
|
@ -40,6 +41,10 @@ class Site
|
||||||
@title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
|
@title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def footer
|
||||||
|
@footer ||= I18nVariable.first(:conditions => {:key => 'footer', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
|
||||||
|
end
|
||||||
|
|
||||||
METAS.each do |meta|
|
METAS.each do |meta|
|
||||||
define_method meta do
|
define_method meta do
|
||||||
fetch_meta = self.site_metas.where(key: meta).limit(1)
|
fetch_meta = self.site_metas.where(key: meta).limit(1)
|
||||||
|
@ -58,7 +63,8 @@ class Site
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def set_key
|
def set_key
|
||||||
title.key = 'title' if title
|
title.key = 'title' if title && (title.key.blank? rescue true)
|
||||||
|
footer.key = 'footer' if footer && (footer.key.blank? rescue true)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,18 +14,30 @@
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<% @site_valid_locales.each do |locale|%>
|
<% @site_valid_locales.each do |locale|%>
|
||||||
<%= content_tag :div, :class => "tab-pane #{active_when_current_locale_eq locale}", :id => "#{locale}" do %>
|
<%= content_tag :div, :class => "tab-pane #{active_when_current_locale_eq locale}", :id => "#{locale}" do %>
|
||||||
|
<div>
|
||||||
<%= t :title %>
|
<%= t :title %>
|
||||||
<%= f.fields_for :title, @site.title do |f| %>
|
<%= f.fields_for :title, @site.title do |f| %>
|
||||||
<%= f.text_field locale %>
|
<%= f.text_field locale %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
<%= t :keywords %>
|
<%= t :keywords %>
|
||||||
<%= f.fields_for :keywords, @site.keywords do |f| %>
|
<%= f.fields_for :keywords, @site.keywords do |f| %>
|
||||||
<%= f.text_field locale %>
|
<%= f.text_field locale %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
<%= t :description %>
|
<%= t :description %>
|
||||||
<%= f.fields_for :description, @site.description do |f| %>
|
<%= f.fields_for :description, @site.description do |f| %>
|
||||||
<%= f.text_field locale %>
|
<%= f.text_field locale %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<%= t :footer %>
|
||||||
|
<%= f.fields_for :footer, @site.footer do |f| %>
|
||||||
|
<%= f.text_area locale, :class => "tinymce_textarea" %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue