announcement widget page
This commit is contained in:
parent
2c8940e350
commit
68ad208777
|
@ -6,9 +6,12 @@ class Bulletin
|
||||||
include Mongoid::MultiParameterAttributes
|
include Mongoid::MultiParameterAttributes
|
||||||
|
|
||||||
# field :category_id, :type => Integer
|
# field :category_id, :type => Integer
|
||||||
field :title
|
# field :title
|
||||||
field :subtitle
|
has_one :title_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||||
field :text
|
has_one :subtitle_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||||
|
has_one :text_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||||
|
# field :subtitle
|
||||||
|
# field :text
|
||||||
field :postdate , :type => Date
|
field :postdate , :type => Date
|
||||||
field :deadline , :type => Date
|
field :deadline , :type => Date
|
||||||
field :url
|
field :url
|
||||||
|
@ -28,7 +31,7 @@ class Bulletin
|
||||||
|
|
||||||
accepts_nested_attributes_for :bulletin_files, :allow_destroy => true
|
accepts_nested_attributes_for :bulletin_files, :allow_destroy => true
|
||||||
|
|
||||||
validates_presence_of :title
|
validates_presence_of :title_variable
|
||||||
|
|
||||||
after_save :save_bulletin_files
|
after_save :save_bulletin_files
|
||||||
|
|
||||||
|
|
|
@ -18,17 +18,35 @@
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<%= f.label :title %><br />
|
<%= f.label :title %><br />
|
||||||
<%= f.text_field :title %>
|
<%#= f.text_field :title %>
|
||||||
|
<%= f.fields_for :title_variable, (@bulletin.new_record? ? @bulletin.build_title_variable : @bulletin.title_variable) do |f| %>
|
||||||
|
<% @site_valid_locales.each do |locale| %>
|
||||||
|
<%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %>
|
||||||
|
<%= f.text_field locale, :style => "width:130px" %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<%= f.label :subtitle %><br />
|
<%= f.label :subtitle %><br />
|
||||||
<%= f.text_area :subtitle, :rows => 10, :cols => 40 %>
|
<%#= f.text_area :subtitle, :rows => 10, :cols => 40 %>
|
||||||
|
<%= f.fields_for :subtitle_variable, (@bulletin.new_record? ? @bulletin.build_subtitle_variable : @bulletin.subtitle_variable) do |f| %>
|
||||||
|
<% @site_valid_locales.each do |locale| %>
|
||||||
|
<%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %>
|
||||||
|
<%= f.text_area locale, :rows => 10, :cols => 40 %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<%= f.label :text %><br />
|
<%= f.label :text %><br />
|
||||||
<%= f.text_area :text, :rows => 10, :cols => 40 %>
|
<%#= f.text_area :text, :rows => 10, :cols => 40 %>
|
||||||
|
<%= f.fields_for :text_variable, (@bulletin.new_record? ? @bulletin.build_text_variable : @bulletin.text_variable) do |f| %>
|
||||||
|
<% @site_valid_locales.each do |locale| %>
|
||||||
|
<%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %>
|
||||||
|
<%= f.text_area locale, :rows => 10, :cols => 40 %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
<td><%= (post.deadline) ? post.deadline : t('bulletin.no_deadline') %></td>
|
<td><%= (post.deadline) ? post.deadline : t('bulletin.no_deadline') %></td>
|
||||||
<td><%= post.bulletin_category.i18n_variable[I18n.locale] %></td>
|
<td><%= post.bulletin_category.i18n_variable[I18n.locale] %></td>
|
||||||
<td><%#= link_to post.title, panel_announcement_front_end_bulletin_path(post) %>
|
<td><%#= link_to post.title, panel_announcement_front_end_bulletin_path(post) %>
|
||||||
<%= link_to post.title, panel_announcement_back_end_bulletin_path(post) %>
|
<%= link_to post.title_variable[I18n.locale], panel_announcement_back_end_bulletin_path(post) %>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<%= link_to t('bulletin.edit'), edit_panel_announcement_back_end_bulletin_path(post) %> |
|
<%= link_to t('bulletin.edit'), edit_panel_announcement_back_end_bulletin_path(post) %> |
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<b><%= t('announcement.title') %></b>
|
<b><%= t('announcement.title') %></b>
|
||||||
<%= @bulletin.title %>
|
<%= @bulletin.title_variable[I18n.locale] %>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<%#= image_tag(@bulletin.image.url, :size => "320x240") if @bulletin.image.file %>
|
<%#= image_tag(@bulletin.image.url, :size => "320x240") if @bulletin.image.file %>
|
||||||
|
@ -25,11 +25,11 @@
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<b><%= t('announcement.subtitle') %></b>
|
<b><%= t('announcement.subtitle') %></b>
|
||||||
<%= @bulletin.subtitle %>
|
<%= @bulletin.subtitle_variable[I18n.locale] %>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<b><%= t('announcement.text') %></b>
|
<b><%= t('announcement.text') %></b>
|
||||||
<%= @bulletin.text %>
|
<%= @bulletin.text_variable[I18n.locale] %>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<li>
|
<li>
|
||||||
|
|
Loading…
Reference in New Issue