fix announcement & add lang tab
This commit is contained in:
parent
1259d62249
commit
d45725cf3b
Binary file not shown.
Binary file not shown.
|
@ -13,7 +13,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
|||
|
||||
# @bulletins = Bulletin.search(params[:search], params[:category_id])
|
||||
# @bulletins = Bulletin.all.order_by([params[:sort], params[:direction]])
|
||||
@bulletins = params[:sort] ? get_sorted_bulletins : Bulletin.all.desc("postdate").page(params[:page]).per(10)
|
||||
@bulletins = params[:sort] ? get_sorted_bulletins : Bulletin.all
|
||||
@bulletin_categories = BulletinCategory.all
|
||||
|
||||
@bulletin_link = BulletinLink.new
|
||||
|
|
|
@ -16,6 +16,15 @@ class BulletinFile
|
|||
belongs_to :bulletin
|
||||
# embedded_in :bulletin
|
||||
|
||||
before_save :set_key
|
||||
|
||||
def filetitle
|
||||
@filetitle ||= I18nVariable.first(:conditions => {:key => 'filetitle', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
|
||||
end
|
||||
|
||||
def description
|
||||
@description ||= I18nVariable.first(:conditions => {:key => 'description', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<li><%= link_to t('bulletin_category.edit'), edit_panel_announcement_back_end_bulletin_category_path(bulletin_category), :remote => true %></li>
|
||||
<li><%= link_to t('bulletin_category.quick_edit'), panel_announcement_back_end_bulletin_category_quick_edit_path(bulletin_category), :remote => true %></li>
|
||||
<li><%= link_to t('bulletin_category.delete'), panel_announcement_back_end_bulletin_category_path(bulletin_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
$.each($(".quick_edit"),function(obj){ $(this).remove(); });
|
||||
$("#<%= dom_id @bulletin_category %>").append("<div class='quick_edit'><%= j render "form" %></div>");
|
||||
//$("#form > form").replaceWith("<%= j render "form" %>");
|
|
@ -134,58 +134,45 @@
|
|||
<%= f.select :bulletin_category_id, @bulletin_categorys.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %>
|
||||
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a data-toggle="tab" href="#chinese">Chinese</a></li>
|
||||
<li><a data-toggle="tab" href="#english">English</a></li>
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
<li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div id="chinese" class="tab-pane active">
|
||||
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
|
||||
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
|
||||
<div class="title">
|
||||
<input type="text" placeholder="輸入標題" class="post-title">
|
||||
<%= f.label :title %>
|
||||
<%= f.fields_for :title, (@bulletin.new_record? ? @bulletin.build_title : @bulletin.title ) do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_field locale, :class=>'post-title' %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div id="english" class="tab-pane">
|
||||
|
||||
<div class="title">
|
||||
<input type="text" placeholder="Enter title here" class="post-title">
|
||||
<%= f.label :subtitle %>
|
||||
<%= f.fields_for :subtitle, (@bulletin.new_record? ? @bulletin.build_subtitle : @bulletin.subtitle ) do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_area locale, :style=>"width:100%" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="editor"></div>
|
||||
<div class="editor"></div>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :text %>
|
||||
<%= f.fields_for :text, (@bulletin.new_record? ? @bulletin.build_text : @bulletin.text ) do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_area locale, :style=>"width:100%" %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :title %>
|
||||
<%= f.fields_for :title, (@bulletin.new_record? ? @bulletin.build_title : @bulletin.title ) do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_field locale, :class=>'post-title' %>
|
||||
</td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="editor">
|
||||
<%= f.label :subtitle %>
|
||||
<%= f.fields_for :subtitle, (@bulletin.new_record? ? @bulletin.build_subtitle : @bulletin.subtitle ) do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_area locale, :style=>"width:100%", :class => 'tinymce_textarea' %>
|
||||
</td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="editor">
|
||||
<%= f.label :text %>
|
||||
<%= f.fields_for :text, (@bulletin.new_record? ? @bulletin.build_text : @bulletin.text ) do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_area locale, :style=>"width:100%", :class => 'tinymce_textarea' %>
|
||||
</td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="main-wiget">
|
||||
|
@ -202,11 +189,7 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th>URL</th>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<div class="control-group">
|
||||
<th>Name - <%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th>
|
||||
</div>
|
||||
<% end %>
|
||||
<th>Name</th>
|
||||
<th class="span1"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
|
@ -8,28 +8,52 @@
|
|||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<%= f.fields_for :filetitle, (form_bulletin_file.new_record? ? form_bulletin_file.build_filetitle : form_bulletin_file.filetitle ) do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<div class="control-group">
|
||||
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :id => "link-#{locale}", :class => "input-xlarge" %>
|
||||
</div>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
|
||||
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
|
||||
<%= f.fields_for :filetitle, (form_bulletin_file.new_record? ? form_bulletin_file.build_filetitle : form_bulletin_file.filetitle ) do |f| %>
|
||||
<div class="control-group">
|
||||
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :id => "link-#{locale}", :class => "input-xlarge" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<%= f.fields_for :description, (form_bulletin_file.new_record? ? form_bulletin_file.build_description : form_bulletin_file.description ) do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<div class="control-group">
|
||||
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :id => "link-#{locale}", :class => "input-xlarge" %>
|
||||
</div>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
|
||||
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
|
||||
<%= f.fields_for :description, (form_bulletin_file.new_record? ? form_bulletin_file.build_description : form_bulletin_file.description ) do |f| %>
|
||||
<div class="control-group">
|
||||
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :id => "link-#{locale}", :class => "input-xlarge" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<span class="action">
|
||||
|
|
|
@ -8,19 +8,29 @@
|
|||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<%= f.fields_for :i18n_variable, (form_bulletin_link.new_record? ? form_bulletin_link.build_i18n_variable : form_bulletin_link.i18n_variable) do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :id => "link-#{locale}", :class => "input-xlarge" %>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
|
||||
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
|
||||
<%= f.fields_for :i18n_variable, (form_bulletin_link.new_record? ? form_bulletin_link.build_i18n_variable : form_bulletin_link.i18n_variable) do |f| %>
|
||||
<div class="control-group">
|
||||
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field locale, :id => "link-#{locale}", :class => "input-xlarge" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
|
|
@ -17,9 +17,7 @@ Rails.application.routes.draw do
|
|||
match "file_quick_edit/:bulletin_id" => "bulletins#file_quick_edit" ,:as => :file_quick_edit
|
||||
end
|
||||
|
||||
resources :bulletin_categorys, :controller => 'bulletin_categorys' do
|
||||
match "quick_edit/:bulletin_category_id" => "bulletin_categorys#quick_edit" ,:as => :quick_edit
|
||||
end
|
||||
resources :bulletin_categorys
|
||||
|
||||
resources :bulletin_links, :controller => 'bulletin_links' do
|
||||
match "link_quick_edit/:bulletin_link_id" => "bulletin_links#link_quick_edit" ,:as => :link_quick_edit
|
||||
|
|
|
@ -9,16 +9,30 @@
|
|||
<%= @page_context.page.i18n_variable[I18n.locale] %>
|
||||
</div>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :context %>
|
||||
<%= f.fields_for :context, (@page_context.new_record? ? @page_context.build_context : @page_context.context ) do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td>
|
||||
<ul class="nav nav-tabs">
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
<li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
|
||||
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :context %>
|
||||
<%= f.fields_for :context, (@page_context.new_record? ? @page_context.build_context : @page_context.context ) do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_area locale, :style=>"width:100%", :class => 'tinymce_textarea' %>
|
||||
</td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
@ -45,32 +45,37 @@
|
|||
<%= f.label :category %>
|
||||
<%= f.select :web_link_category_id, @web_link_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ]} %>
|
||||
|
||||
<div class="btn-group pull-right">
|
||||
<a class="btn dropdown-toggle" href="#" data-toggle="dropdown">
|
||||
English
|
||||
<span class="caret"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="#">English</a></li>
|
||||
<li><a href="#">Chinese</a></li>
|
||||
<li><a href="#">Japanese</a></li>
|
||||
<li><a href="#">French</a></li>
|
||||
<li><a href="#">German</a></li>
|
||||
<!--<li class="divider"></li>
|
||||
<li><a href="#">Separated link</a></li>-->
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :name %>
|
||||
<%= f.fields_for :name, (@web_link.new_record? ? @web_link.build_name : @web_link.name ) do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_field locale, :class=>'post-title' %>
|
||||
</td>
|
||||
<% end %>
|
||||
<ul class="nav nav-tabs">
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
<li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
|
||||
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
<div class="title">
|
||||
<%= f.label :name %>
|
||||
<%= f.fields_for :name, (@web_link.new_record? ? @web_link.build_name : @web_link.name ) do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_field locale, :class=>'post-title' %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :describe %>
|
||||
<%= f.fields_for :context, (@web_link.new_record? ? @web_link.build_context : @web_link.context ) do |f| %>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_area locale, :style=>"width:100%" %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="title">
|
||||
|
@ -78,18 +83,6 @@
|
|||
<%= f.text_field :url %>
|
||||
</div>
|
||||
|
||||
<div class="title">
|
||||
<%= f.label :describe %>
|
||||
<%= f.fields_for :context, (@web_link.new_record? ? @web_link.build_context : @web_link.context ) do |f| %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<td>
|
||||
<%= I18nVariable.from_locale(locale) %>
|
||||
<%= f.text_area locale, :style=>"width:100%" %>
|
||||
</td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!--Post End-->
|
||||
|
|
Reference in New Issue