Merge branch 'ad_banner' into ldap

This commit is contained in:
Christophe Vilayphiou 2012-04-26 17:15:44 +08:00
commit 7d6b82d9dd
24 changed files with 125 additions and 114 deletions

View File

@ -1,4 +1,4 @@
$('#submit_button').live('click', function(){
$(document).on('click', '#ajax_form_submit', function(){
$('#ajaxForm').ajaxSubmit({
beforeSubmit: function(a,f,o) {
o.dataType = 'script';

View File

@ -6,10 +6,9 @@ $('.bulletin_files_block a.delete').live('click', function(){
$(this).parents('.list_item').remove();
});
$('.action a.remove_existing_record').live('click', function(){
$(document).on('click', '.action a.remove_existing_record', function(){
$(this).next('.should_destroy').attr('value', 1);
//$("#bulletin_" + $(this).prev().attr('value')).hide();
$("tr#bulletin_" + $(this).prev().attr('value')).hide();
$("tr #" + $(this).prev().attr('value')).hide();
});
$('.quick_edit_cancel').live('click', function(){

View File

@ -6,6 +6,7 @@
//
//= require jquery
//= require jquery_ujs
//= require jquery.form
//= require bootstrap
//= require jquery.isotope.min
//= require jquery.tinyscrollbar.min
@ -13,4 +14,5 @@
//= require tinymce-jquery
//= require tinymce_orbit
//= require orbit-bar-search
//= require side_bar_history
//= require side_bar_history
//= require ajax_form

View File

@ -1,28 +1,28 @@
var history_edited = false;
// $('#back_sidebar a, #back_main a.nav').live('click',
// function () {
// $.getScript(this.href);
// history.pushState(null, document.title, this.href);
// history_edited = true;
// return false;
// }
// );
$('#back_sidebar a, #back_main a.nav').live('click',
function () {
$.getScript(this.href);
history.pushState(null, document.title, this.href);
history_edited = true;
return false;
}
);
// $('#back_main a.reload').live('click',
// function () {
// $.getScript(this.href);
// history.replaceState(null, document.title, this.href);
// history_edited = true;
// return false;
// }
// );
$('#back_main a.reload').live('click',
function () {
$.getScript(this.href);
history.replaceState(null, document.title, this.href);
history_edited = true;
return false;
}
);
// $('.form').live('submit', function () {
// $.post(this.action, $(this).serialize(), null, 'script');
// history_edited = true;
// return false;
// });
$('#back_main .form').live('submit', function () {
$.post(this.action, $(this).serialize(), null, 'script');
history_edited = true;
return false;
});
$(document).on('click', '.js_history',
function () {

View File

@ -6,6 +6,10 @@
//
//= require jquery
//= require jquery_ujs
//= require page_edit
//= require bootstrap
//= require jquery.isotope.min
//= require jquery.tinyscrollbar.min
//= require orbit-1.0
//= require orbit-bar-search
//= require side_bar_history
//= require new_admin
//= require page_edit

View File

@ -5,6 +5,10 @@
*= require reset
*= require_self
*= require message
*= require bootstrap
*= require style
*= require bootstrap-orbit
*= require scroll_style
*= require site_items
*= require sidebar
*/

View File

@ -124,11 +124,13 @@ module ApplicationHelper
"<title>#{page.title ? page.title[I18n.locale] : page.i18n_variable[I18n.locale]}</title>\n"
end
def page_stylesheets(page)
def page_stylesheets(page, edit=nil)
stylesheets = ''
stylesheets << "<link href='/assets/bootstrap.css' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='/assets/bootstrap-orbit.css' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='/assets/style.css' rel='stylesheet' type='text/css' />\n"
unless edit
stylesheets << "<link href='/assets/bootstrap.css' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='/assets/bootstrap-orbit.css' rel='stylesheet' type='text/css' />\n"
stylesheets << "<link href='/assets/style.css' rel='stylesheet' type='text/css' />\n"
end
stylesheets << "<link href='#{page.design.reset_css.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.reset_css
stylesheets << "<link href='#{page.design.default_css.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.default_css
theme = page.design.themes.detect{ |d| d.id == page.theme_id }
@ -136,17 +138,19 @@ module ApplicationHelper
stylesheets
end
def page_javascripts(page)
def page_javascripts(page, edit=nil)
javascripts = ''
javascripts << "<script type='text/javascript' src='/static/jquery.js'></script>\n"
javascripts << "<script type='text/javascript' src='/static/jquery.cycle.all.latest.js'></script>\n"
unless edit
javascripts << "<script type='text/javascript' src='/static/jquery.js'></script>\n"
javascripts << "<script type='text/javascript' src='/static/jquery.cycle.all.latest.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/bootstrap.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/jquery.tinyscrollbar.min.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/jquery.isotope.min.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/orbit-bar-member.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/orbit-bar-search.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/orbit_bar.js'></script>\n"
end
javascripts << "<script type='text/javascript' src='/static/kernel.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/bootstrap.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/jquery.tinyscrollbar.min.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/jquery.isotope.min.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/orbit-bar-member.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/orbit-bar-search.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/orbit_bar.js'></script>\n"
javascripts << "<script type='text/javascript' src='/assets/event.js'></script>\n"
page.design.javascripts.each do |js|
# javascripts << "<script type='text/javascript' src='#{js.file.url}'></script>"

View File

@ -1,4 +1,4 @@
<div class="tab-pane fade <%= "active in" if ad_banner_tab==@active%>" id=<%= ad_banner_tab.title %>>
<div class="tab-pane fade <%= "active in" if ad_banner_tab==@active%>" id=<%= ad_banner_tab.title.dehumanize %>>
<%= form_for ad_banner_tab,:url=> admin_ad_banner_path(ad_banner_tab),:method => :put,:class=>"input-medium" do |f| -%>
<div class="adbanner-setup well">

View File

@ -8,7 +8,7 @@
<div class="modal-body">
<p class="ad_banner_slideshow">
<% preview_block_ad_images_helper(ad_banner).each do |ad_image| -%>
<%= image_tag ad_image.file,:alt => (ad_image.title[locale] || " "),:time_to_next => ad_banner.transition_sec,:link_open=> ad_image.link_open, :link_url =>((ad_image.out_link || ad_banner.context || " ")) %>
<%= image_tag ad_image.file,:alt => (ad_image.title[locale] || " "),:time_to_next => ad_banner.transition_msec,:link_open=> ad_image.link_open, :link_url =>((ad_image.out_link || ad_banner.context || " ")) %>
<% end -%>
</p>
</div>

View File

@ -9,7 +9,7 @@
<div class="modal-body">
<p class="ad_banner_slideshow">
<% preview_block_ad_images_helper(ad_banner).each do |ad_image| -%>
<%= image_tag ad_image.file,:alt => (ad_image.title[locale] || ' '),:time_to_next => ad_banner.transition_sec,:link_open=> ad_image.link_open, :link_url =>((ad_image.out_link || ad_banner.context || ' ')) %>
<%= image_tag ad_image.file,:alt => (ad_image.title[locale] || ' '),:time_to_next => ad_banner.transition_msec,:link_open=> ad_image.link_open, :link_url =>((ad_image.out_link || ad_banner.context || ' ')) %>
<% end -%>
</p>
</div>

View File

@ -10,7 +10,7 @@
<div id="post-body-content" class="clear">
<ul class="nav nav-tabs">
<% @ad_banners.each do |ab| %>
<%= content_tag :li,link_to(ab.title,"##{ab.title}",:data=>{:toggle=>"tab"}),:class => (ab == @active ? 'active' : nil ) %>
<%= content_tag :li,link_to(ab.title,"##{ab.title.dehumanize}",:data=>{:toggle=>"tab"}),:class => (ab == @active ? 'active' : nil ) %>
<% end -%>
<%= content_tag :li,link_to(t("admin.ad.new_banner"),"#new-a-banner",:data=>{:toggle=>"tab"}),:id=>'new_ad_banner_tab_but',:class => (@active.nil? ? 'active' : nil ) %>

View File

@ -157,7 +157,7 @@
</div>
</div>
<div class="form-actions">
<%= link_to t("modal.preview"), admin_realtime_preview_ad_banner_path(@ad_image.ad_banner.title) ,:class=>"preview_trigger btn btn-success" rescue nil%>
<%#= link_to t("modal.preview"), admin_realtime_preview_ad_banner_path(@ad_image.ad_banner.title) ,:class=>"preview_trigger btn btn-success" rescue nil%>
<%= f.submit t("submit"),:class=>"btn btn-primary" %>
<%= f.submit t("cancel"),:class=>"btn ",:type => 'reset' %>
</div>

View File

@ -9,7 +9,7 @@
<%= link_back %>
<%= f.submit t(:edit) %>
<% else %>
<a id='submit_button'><%= t(:edit) %></a>
<a id='ajax_form_submit'><%= t(:edit) %></a>
<% end %>
</div>
<% end %>

View File

@ -9,7 +9,7 @@
<%= link_back %>
<%= f.submit t(:create) %>
<% else %>
<a id='submit_button' class="new"><%= t(:create) %></a>
<a id='ajax_form_submit' class="new"><%= t(:create) %></a>
<% end %>
</div>
<% end %>

View File

@ -1,7 +1,7 @@
<%= flash_messages %>
<%= page_stylesheets(@item).html_safe %>
<%= page_javascripts(@item).html_safe %>
<%= page_stylesheets(@item, true).html_safe %>
<%= page_javascripts(@item, true).html_safe %>
<%= parse_page_edit_noko(@item).html_safe %>

View File

@ -1,5 +1 @@
<% content_for :sidebar do %>
<%= render 'admin/items/site_map_left_bar' %>
<% end -%>
<%= render 'show' %>

View File

@ -33,8 +33,8 @@
<%= 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', 'ad_images')) 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_images', 'new') %>
<%#= 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_images', 'new') %>
<% end %>
<% end %>

View File

@ -9,31 +9,30 @@
<![endif]-->
<%= stylesheet_link_tag "site_editor" %>
<%= javascript_include_tag "site_editor" %>
<%= yield :page_specific_css %>
<%= yield :page_specific_javascript %>
<%= csrf_meta_tag %>
</head>
<body>
<!--
<header id="back_banner_link" class="fixed clear" >
<nav id="back_orbit">
<span>Orbit Icon</span>
<%= render 'layouts/drop_down_menu' %>
</nav>
<div class="hmenu">
<%= render 'devise/menu/login_items' %>
<div class="lang"><%= render 'layouts/lang_menu' %></div>
<%= render 'layouts/orbit_bar' %>
<nav id="main-sidebar" class="my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
</header>
-->
<div class="viewport">
<div id='back_sidebar' class="overview">
<ul class="nav nav-list">
<%= yield :sidebar %>
</ul>
</div>
</div>
</nav>
<div id="main-wrap">
<div id="main-sidebar"><%= yield :sidebar %></div>
<div class="main"><div id='back_main' class="main2">
<div id='back_main'>
<%= yield %>
</div></div>
<div class="tertiary"><%= yield :tertiary %></div>
<div id="back_footer"><p><%= APP_CONFIG['ruling_digital'] %></p></div>
</div>
</div>
</body>
</html>

View File

@ -66,7 +66,7 @@ module ParserCommon
printable_ad_images.each do |ad_image| #TODO Need Reflact
res << "<img src='#{ad_image.file}' "
res << "alt='#{ad_image.title || ' '}' "
res << "time_to_next='#{ad_banner.transition_sec}' "
res << "time_to_next='#{ad_banner.transition_msec}' "
res << "link_open='#{ad_image.link_open}' "
# res << "link_url='#{(ad_image.direct_to_after_click?? ad_image.out_link : ad_banner.context) || ' '}' "
res << "link_url='#{(ad_image.out_link || ad_banner.context || ' ')}' "

View File

@ -1,6 +1,6 @@
<% # encoding: utf-8 %>
<%= form_for(@bulletin_file, :remote => true, :url => @file_url) do |f| %>
<%= form_for @bulletin_file, :url => @file_url, :html => {:id => 'ajaxForm', :multipart => true} do |f| %>
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
@ -38,9 +38,9 @@
</div>
<div class="modal-footer">
<%= hidden_field_tag 'bulletin_file[bulletin_id]', @bulletin_file.bulletin_id %>
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
<%= hidden_field_tag 'bulletin_file[bulletin_id]', @bulletin_file.bulletin_id %>
<a class="btn btn-primary" id='ajax_form_submit'><%= t('submit')%></a>
<a class="btn" data-dismiss="modal"><%= t('cancel')%></a>
</div>

View File

@ -1,18 +1,19 @@
<tr id="<%= dom_id list_bulletin_file %>">
<td><%= list_bulletin_file.file.file ? ( link_to list_bulletin_file.filetitle.zh_tw, list_bulletin_file.file.url, {:target => '_blank', :title => list_bulletin_file.description.zh_tw} ) : list_bulletin_file.filetitle.zh_tw %></td>
<td><%= list_bulletin_file.file.file ? ( link_to list_bulletin_file.filetitle.en, list_bulletin_file.file.url, {:target => '_blank', :title => list_bulletin_file.description.en} ) : list_bulletin_file.filetitle.en %></td>
<td>
<a href="<%= panel_announcement_back_end_bulletin_file_quick_edit_path(list_bulletin_file) %>#modal-file" data-toggle="modal" data-remote="true" class="action"><i class="icon-pencil"></i></a>
<span class="action">
<%= fields_for "bulletin[bulletin_files_attributes][]", list_bulletin_file, :index => list_bulletin_file_counter do |f| %>
<%= f.hidden_field :id %>
<a href class="remove_existing_record"><i class="icon-remove"></i></a>
<%= f.hidden_field :should_destroy, :value => nil , :class => 'should_destroy' %>
<% end %>
</span>
</td>
</tr>
<tr id="<%= dom_id list_bulletin_file %>">
<td><%= list_bulletin_file.file.file ? ( link_to list_bulletin_file.filetitle.zh_tw, list_bulletin_file.file.url, {:target => '_blank', :title => list_bulletin_file.description.zh_tw} ) : list_bulletin_file.filetitle.zh_tw %></td>
<td><%= list_bulletin_file.file.file ? ( link_to list_bulletin_file.filetitle.en, list_bulletin_file.file.url, {:target => '_blank', :title => list_bulletin_file.description.en} ) : list_bulletin_file.filetitle.en %></td>
<td>
<a href="<%= panel_announcement_back_end_bulletin_file_quick_edit_path(list_bulletin_file) %>#modal-file" data-toggle="modal" data-remote="true" class="action"><i class="icon-pencil"></i></a>
<span class="action">
<%= fields_for "bulletin[bulletin_files_attributes][]", list_bulletin_file, :index => list_bulletin_file_counter do |f| %>
<%= f.hidden_field :id %>
<%= hidden_field_tag :tr, (dom_id list_bulletin_file) %>
<a class="remove_existing_record"><i class="icon-remove"></i></a>
<%= f.hidden_field :_destroy, :value => nil , :class => 'should_destroy' %>
<% end %>
</span>
</td>
</tr>

View File

@ -1,19 +1,15 @@
<tr id="<%= dom_id list_bulletin_link %>">
<td><%= link_to list_bulletin_link.i18n_variable.zh_tw, list_bulletin_link.url, :target => '_blank' %></td>
<td><%= link_to list_bulletin_link.i18n_variable.en, list_bulletin_link.url, :target => '_blank' %></td>
<td>
<a href="<%= panel_announcement_back_end_bulletin_link_quick_edit_path(list_bulletin_link) %>#modal-link" data-toggle="modal" data-remote="true" class="action"><i class="icon-pencil"></i></a>
<span class="action">
<%= fields_for "bulletin[bulletin_links_attributes][]", list_bulletin_link, :index => list_bulletin_link_counter do |f| %>
<%= f.hidden_field :id %>
<a href class="remove_existing_record"><i class="icon-remove"></i></a>
<%= f.hidden_field :should_destroy, :value => nil , :class => 'should_destroy' %>
<% end %>
</span>
</td>
</tr>
<tr id="<%= dom_id list_bulletin_link %>">
<td><%= link_to list_bulletin_link.i18n_variable.zh_tw, list_bulletin_link.url, :target => '_blank' %></td>
<td><%= link_to list_bulletin_link.i18n_variable.en, list_bulletin_link.url, :target => '_blank' %></td>
<td>
<a href="<%= panel_announcement_back_end_bulletin_link_quick_edit_path(list_bulletin_link) %>#modal-link" data-toggle="modal" data-remote="true" class="action"><i class="icon-pencil"></i></a>
<span class="action">
<%= fields_for "bulletin[bulletin_links_attributes][]", list_bulletin_link, :index => list_bulletin_link_counter do |f| %>
<%= f.hidden_field :id %>
<%= hidden_field_tag :tr, (dom_id list_bulletin_link) %>
<a class="remove_existing_record"><i class="icon-remove"></i></a>
<%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
<% end %>
</span>
</td>
</tr>

View File

@ -1,7 +1,7 @@
<div id="qe-file" class="qe-edit-div">
<div id="widget-file">
<div class="control-group">
<table class="table table-condensed">
<table id="bulletin_files" class="table table-condensed">
<thead>
<tr>
<th>Chinese</th>

View File

@ -14,6 +14,12 @@
<%= render :partial => "bulletin_link_qe" %>
</div>
</div>
<div id="bulletin_file_qe">
<div id="modal-file" class="modal fade">
<%= render :partial => "bulletin_file_qe" %>
</div>
</div>
<div class="form-actions">
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_announcement_back_end_bulletin_path, :class => 'btn btn-primary' %>