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.search(params[:search], params[:category_id])
|
||||||
# @bulletins = Bulletin.all.order_by([params[:sort], params[:direction]])
|
# @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_categories = BulletinCategory.all
|
||||||
|
|
||||||
@bulletin_link = BulletinLink.new
|
@bulletin_link = BulletinLink.new
|
||||||
|
|
|
@ -16,6 +16,15 @@ class BulletinFile
|
||||||
belongs_to :bulletin
|
belongs_to :bulletin
|
||||||
# embedded_in :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
|
protected
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
<div class="quick-edit">
|
<div class="quick-edit">
|
||||||
<ul class="nav nav-pills hide">
|
<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.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>
|
<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>
|
</ul>
|
||||||
</div>
|
</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" %>
|
<%= f.select :bulletin_category_id, @bulletin_categorys.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %>
|
||||||
|
|
||||||
<ul class="nav nav-tabs">
|
<ul class="nav nav-tabs">
|
||||||
<li class="active"><a data-toggle="tab" href="#chinese">Chinese</a></li>
|
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||||
<li><a data-toggle="tab" href="#english">English</a></li>
|
<li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
|
||||||
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="tab-content">
|
<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">
|
<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>
|
|
||||||
<div id="english" class="tab-pane">
|
|
||||||
<div class="title">
|
<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>
|
||||||
<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>
|
|
||||||
|
|
||||||
<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 %>
|
<% 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>
|
||||||
|
|
||||||
<div class="main-wiget">
|
<div class="main-wiget">
|
||||||
|
@ -202,11 +189,7 @@
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>URL</th>
|
<th>URL</th>
|
||||||
<% @site_valid_locales.each do |locale| %>
|
<th>Name</th>
|
||||||
<div class="control-group">
|
|
||||||
<th>Name - <%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
<th class="span1"></th>
|
<th class="span1"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
|
@ -8,28 +8,52 @@
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<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="tab-content">
|
||||||
<div class="control-group">
|
|
||||||
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
|
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||||
<div class="controls">
|
|
||||||
<%= f.text_field locale, :id => "link-#{locale}", :class => "input-xlarge" %>
|
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
||||||
</div>
|
|
||||||
|
<%= 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>
|
</div>
|
||||||
<% end %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<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="tab-content">
|
||||||
<div class="control-group">
|
|
||||||
<label for="link-<%= locale %>" class="control-label"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></label>
|
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||||
<div class="controls">
|
|
||||||
<%= f.text_field locale, :id => "link-#{locale}", :class => "input-xlarge" %>
|
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
|
||||||
</div>
|
|
||||||
|
<%= 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>
|
</div>
|
||||||
<% end %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="action">
|
<span class="action">
|
||||||
|
|
|
@ -8,19 +8,29 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</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>
|
<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>
|
||||||
<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
|
match "file_quick_edit/:bulletin_id" => "bulletins#file_quick_edit" ,:as => :file_quick_edit
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :bulletin_categorys, :controller => 'bulletin_categorys' do
|
resources :bulletin_categorys
|
||||||
match "quick_edit/:bulletin_category_id" => "bulletin_categorys#quick_edit" ,:as => :quick_edit
|
|
||||||
end
|
|
||||||
|
|
||||||
resources :bulletin_links, :controller => 'bulletin_links' do
|
resources :bulletin_links, :controller => 'bulletin_links' do
|
||||||
match "link_quick_edit/:bulletin_link_id" => "bulletin_links#link_quick_edit" ,:as => :link_quick_edit
|
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] %>
|
<%= @page_context.page.i18n_variable[I18n.locale] %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="title">
|
<ul class="nav nav-tabs">
|
||||||
<%= f.label :context %>
|
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||||
<%= f.fields_for :context, (@page_context.new_record? ? @page_context.build_context : @page_context.context ) do |f| %>
|
<li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
|
||||||
<% @site_valid_locales.each do |locale| %>
|
<% end %>
|
||||||
<td>
|
</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) %>
|
<%= I18nVariable.from_locale(locale) %>
|
||||||
<%= f.text_area locale, :style=>"width:100%", :class => 'tinymce_textarea' %>
|
<%= f.text_area locale, :style=>"width:100%", :class => 'tinymce_textarea' %>
|
||||||
</td>
|
<% end %>
|
||||||
<% end %>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -45,32 +45,37 @@
|
||||||
<%= f.label :category %>
|
<%= f.label :category %>
|
||||||
<%= f.select :web_link_category_id, @web_link_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ]} %>
|
<%= f.select :web_link_category_id, @web_link_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ]} %>
|
||||||
|
|
||||||
<div class="btn-group pull-right">
|
<ul class="nav nav-tabs">
|
||||||
<a class="btn dropdown-toggle" href="#" data-toggle="dropdown">
|
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||||
English
|
<li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
|
||||||
<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 %>
|
|
||||||
<% end %>
|
<% 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>
|
||||||
|
|
||||||
<div class="title">
|
<div class="title">
|
||||||
|
@ -78,18 +83,6 @@
|
||||||
<%= f.text_field :url %>
|
<%= f.text_field :url %>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
|
|
||||||
<!--Post End-->
|
<!--Post End-->
|
||||||
|
|
Loading…
Reference in New Issue