Add footer to site_info
This commit is contained in:
parent
1fb6c20b86
commit
0246341aef
|
@ -16,6 +16,7 @@ class Site
|
|||
field :department
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
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|
|
||||
define_method meta do
|
||||
fetch_meta = self.site_metas.where(key: meta).limit(1)
|
||||
|
@ -58,7 +63,8 @@ class Site
|
|||
protected
|
||||
|
||||
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
|
||||
|
|
|
@ -14,18 +14,30 @@
|
|||
<div class="tab-content">
|
||||
<% @site_valid_locales.each do |locale|%>
|
||||
<%= content_tag :div, :class => "tab-pane #{active_when_current_locale_eq locale}", :id => "#{locale}" do %>
|
||||
<%= t :title %>
|
||||
<%= f.fields_for :title, @site.title do |f| %>
|
||||
<%= f.text_field locale %>
|
||||
<% end %>
|
||||
<%= t :keywords %>
|
||||
<%= f.fields_for :keywords, @site.keywords do |f| %>
|
||||
<%= f.text_field locale %>
|
||||
<% end %>
|
||||
<%= t :description %>
|
||||
<%= f.fields_for :description, @site.description do |f| %>
|
||||
<%= f.text_field locale %>
|
||||
<% end %>
|
||||
<div>
|
||||
<%= t :title %>
|
||||
<%= f.fields_for :title, @site.title do |f| %>
|
||||
<%= f.text_field locale %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div>
|
||||
<%= t :keywords %>
|
||||
<%= f.fields_for :keywords, @site.keywords do |f| %>
|
||||
<%= f.text_field locale %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div>
|
||||
<%= t :description %>
|
||||
<%= f.fields_for :description, @site.description do |f| %>
|
||||
<%= f.text_field locale %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div>
|
||||
<%= t :footer %>
|
||||
<%= f.fields_for :footer, @site.footer do |f| %>
|
||||
<%= f.text_area locale, :class => "tinymce_textarea" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue