Merge branch 'ad_banner' of https://github.com/Rulingcom/orbit into ad_banner

This commit is contained in:
Matthew K. Fu JuYuan 2012-04-09 12:45:27 +08:00
commit d2e77d6bf8
18 changed files with 216 additions and 201 deletions

Binary file not shown.

View File

@ -79,20 +79,21 @@ $(window).resize(function(){
/*main-table position*/
function mainTablePosition() {
var $height = $('#main-wrap .subnav').length && $('#main-wrap .subnav').height();
var $table = $('#main-wrap > .table').length && $('#main-wrap > .table');
var $nottable = $('#main-wrap .nottable').length && $('#main-wrap .nottable');
//alert ($table.height())
if($nottable==0){
var $table = $('#main-wrap > table').length && $('#main-wrap > table');
if($table && $table==0){
$table.css({marginTop:$height});
}
else if($table){
if($height>0){
$height = $height-17;
}
$table.stop().animate({marginTop:$height},500);
}
if($table==0){
$nottable.css({marginTop:$height});
else if($('#main-wrap .subnav')){
var $object = $('#main-wrap .subnav').next();
$object.css({marginTop:$height});
};
//$table.css({marginTop : $height})
}
};
$(window).scroll(function () {
//var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-1;
//var $subnavWidth = parseInt($('#main-wrap > .subnav').css("width"));

View File

@ -4,14 +4,13 @@ $(function() {
plugins : "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
// Theme options
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,bullist,numlist,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,fullscreen",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : false,
theme_advanced_resizing : true,
// Skin options
skin : "o2k7",

View File

@ -8,7 +8,7 @@
</li>
</ul>
</div>
<div id='tags' class="nottable clear">
<div id='tags' class="clear">
<%= render :partial => 'tag', :collection => @tags %>
</div>
<div class="form-actions">

View File

@ -9,7 +9,7 @@
<%= content_tag :li, link_to(t('admin.add_new'), new_panel_announcement_back_end_bulletin_path), :class => active_for_action('bulletins', 'new') %>
<%= content_tag :li, link_to(t('admin.categories'), panel_announcement_back_end_bulletin_categorys_path), :class => active_for_action('bulletin_categorys', 'index') %>
<%= content_tag :li, link_to(t('admin.tags'), panel_announcement_back_end_tags_path), :class => active_for_action('tags', 'index') %>
<%= content_tag :li, link_to(t('announcement.bulletin.fact_check_setting'), panel_announcement_back_end_fact_checks_setting_path), :class => active_for_action('tags', 'index') if (is_manager? rescue nil) %>
<%= content_tag :li, link_to(t('announcement.bulletin.fact_check_setting'), panel_announcement_back_end_fact_checks_setting_path), :class => active_for_action('bulletins', 'fact_check_setting') if (is_manager? rescue nil) %>
<% end -%>
<% end -%>
@ -29,15 +29,14 @@
<%= link_to content_tag(:i, nil, :class => 'icons-window-block') + t('admin.design'), admin_designs_path %>
<% end -%>
<%= content_tag :li, :class => active_for_controllers('ad_banners') do -%>
<%= content_tag :li, :class => active_for_controllers('ad_banners', 'ad_images') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.ad_banner'), admin_ad_banners_path %>
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('ad_banners')) do -%>
<%= content_tag :li, link_to(t('admin.ad.all_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %>
<%= content_tag :li, link_to(t('admin.ad.new_banner'), new_admin_ad_banner_path), :class => active_for_action('ad_banners', 'new') %>
<%= content_tag :li, link_to(t('admin.ad.new_image'), new_ad_image_admin_ad_banners_path), :class => active_for_action('ad_banners', 'new_image') %>
<% end -%>
<% end -%>
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('ad_banners', 'ad_images')) do -%>
<%= content_tag :li, link_to(t('admin.all_ad_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %>
<%= content_tag :li, link_to(t('admin.new_ad_banner'), new_admin_ad_banner_path), :class => active_for_action('ad_banners', 'new') %>
<%= content_tag :li, link_to(t('admin.new_ad_image'), new_ad_image_admin_ad_banners_path), :class => active_for_action('ad_images', 'new') %>
<% end %>
<% end %>
<%= content_tag :li, :class => active_for_controllers('web_links', 'tags', 'web_link_categorys') do -%>
<%= link_to content_tag(:i, nil, :class => 'icons-link') + t('admin.link'), panel_web_resource_back_end_web_links_path %>

Binary file not shown.

View File

@ -102,7 +102,7 @@ module ParserCommon
page_menu = body.css('.page_menu').first
home = get_homepage
menu = page.design.layout.menu
fragment = Nokogiri::HTML::DocumentFragment.new(body, menu_level(home, 0, menu, true))
fragment = Nokogiri::HTML::DocumentFragment.new(body, menu_level(home, 0, menu, edit))
page_menu.swap(fragment)
end

View File

@ -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.page(params[:page]).per(10)
@bulletin_categories = BulletinCategory.all
@bulletin_link = BulletinLink.new

View File

@ -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

View File

@ -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>

View File

@ -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" %>");

View File

@ -4,38 +4,6 @@
<%= f.error_messages %>
<div id="sub-wiget">
<% if params[:action] != 'new' %>
<div id="widget-audit" class="widget-box">
<div class="widget-action clear">
<a class="action"><i title="A" class="icon-exclamation-sign icon-white tip"></i></a>
</div>
<h3 class="widget-title"><i class="icons-link icons-white"></i>Audit</h3>
<div class="widget-content">
<% if is_manager? || @bulletin.bulletin_category.authed_users('fact_check').include?(current_user) || current_user.admin? %>
<div class="controls">
<%= f.label :fact_check_stat, t('announcement.bulletin.fact_check_stat') %>
<%= content_tag :label,:class => "radio inline" do -%>
<%= f.radio_button :is_checked, true , {:class => 'privacy'} %>
<%= t('announcement.bulletin.fact_check_pass') %>
<% end -%>
<%= content_tag :label,:class => "radio inline" do -%>
<%= f.radio_button :is_checked, false, (@bulletin.is_checked.nil?? {:checked => true, :class => 'privacy'} : {})%>
<%= t('announcement.bulletin.fact_check_not_pass') %>
<% end -%>
<div class="select-role">
<%= label :is_checked_false, t('announcement.bulletin.fact_check_not_pass_reason') %>
<%= f.text_field :not_checked_reason %>
</div>
</div>
<% end %>
</div>
</div>
<% elsif current_user.admin? %>
<%= f.hidden_field :is_checked,:value => true%>
<% end %>
<div id="widget-picture" class="widget-box widget-size-300">
<div class="widget-action clear">
<a class="action"><i title="Upload pictures" class="icon-exclamation-sign icon-white tip"></i></a>
@ -121,7 +89,38 @@
<% end %>
</div>
</div>
<% if params[:action] != 'new' %>
<div id="widget-audit" class="widget-box">
<div class="widget-action clear">
<a class="action"><i title="A" class="icon-exclamation-sign icon-white tip"></i></a>
</div>
<h3 class="widget-title"><i class="icons-link icons-white"></i>Audit</h3>
<div class="widget-content">
<% if is_manager? || @bulletin.bulletin_category.authed_users('fact_check').include?(current_user) || current_user.admin? %>
<div class="controls">
<%= f.label :fact_check_stat, t('announcement.bulletin.fact_check_stat') %>
<%= content_tag :label,:class => "radio inline" do -%>
<%= f.radio_button :is_checked, true , {:class => 'privacy'} %>
<%= t('announcement.bulletin.fact_check_pass') %>
<% end -%>
<%= content_tag :label,:class => "radio inline" do -%>
<%= f.radio_button :is_checked, false, (@bulletin.is_checked.nil?? {:checked => true, :class => 'privacy'} : {})%>
<%= t('announcement.bulletin.fact_check_not_pass') %>
<% end -%>
<div class="select-role">
<%= label :is_checked_false, t('announcement.bulletin.fact_check_not_pass_reason') %>
<%= f.text_field :not_checked_reason %>
</div>
</div>
<% end %>
</div>
</div>
<% elsif current_user.admin? %>
<%= f.hidden_field :is_checked,:value => true%>
<% end %>
</div>
@ -130,72 +129,50 @@
<div id="post-body">
<div id="post-body-content" class="clear">
<div class="field">
<%= f.label :image, t('announcement.image') %><br />
<%= f.file_field :image %>
<% if @bulletin.image.file %>
<%= check_box_tag 'bulletin[image_del]' %>
<%= t('announcement.刪除已上傳檔案') %>
<% end %>
</div>
<%= f.label :category %>
<%= 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">
<div class="title">
<input type="text" placeholder="輸入標題" class="post-title">
</div>
</div>
<div id="english" class="tab-pane">
<div class="title">
<input type="text" placeholder="Enter title here" class="post-title">
</div>
<div class="editor"></div>
<div class="editor"></div>
</div>
</div>
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
<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="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 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>
<div class="editor">
<%= 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%", :class => 'tinymce_textarea' %>
</td>
<% end %>
<% end %>
</div>
<% 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>
<div class="editor">
<%= 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%", :class => 'tinymce_textarea' %>
</td>
<% end %>
<% end %>
</div>
</div>
<% end %>
</div>
<div class="main-wiget">
@ -212,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>

View File

@ -8,29 +8,53 @@
</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 %>
</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>
<% end %>
<% end %>
<% end %>
</div>
</td>
<td>
<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 %>
</div>
</td>
<td>
<span class="action">
<% if form_bulletin_file.new_record? %>

View File

@ -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>
<td>
<div class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %>
<% end %>
<% end %>
<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>

View File

@ -20,7 +20,7 @@
</ul>
</div>
<%#= label_tag :role, t("admin.roles") %>
<div class="nottable clear">
<div class="clear">
<%= content_tag :div do -%>
<% form_tag :action => "update_setting" do %>
<%= render :partial => "privilege_user", :locals => {:users => @users_array} %>

View File

@ -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

View File

@ -9,16 +9,29 @@
<%= @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>

View File

@ -44,51 +44,44 @@
<%= 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">
<%= f.label :url %>
<%= 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>