From 55c0c95e14807a542013bb1ec074eb762f486a18 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Wed, 25 Apr 2012 17:17:04 +0800 Subject: [PATCH 01/10] Remove unless sidebar links. --- app/views/admin/ad_banners/_ad_banner_tab.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/ad_banners/_ad_banner_tab.html.erb b/app/views/admin/ad_banners/_ad_banner_tab.html.erb index 79dc647c..08404815 100644 --- a/app/views/admin/ad_banners/_ad_banner_tab.html.erb +++ b/app/views/admin/ad_banners/_ad_banner_tab.html.erb @@ -1,4 +1,4 @@ -
" id=<%= ad_banner_tab.title %>> +
" id=<%= ad_banner_tab.title.dehumanize %>>

<%= t("admin.ad.banner_best_size") %>:

<%= form_for ad_banner_tab,:url=> admin_ad_banner_path(ad_banner_tab),:method => :put,:class=>"input-medium" do |f| -%> From 7a42ef9193e482ca6beb45763406b3bb7652287a Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Wed, 25 Apr 2012 17:17:42 +0800 Subject: [PATCH 02/10] dehumanize ad banner --- app/views/admin/ad_banners/index.html.erb | 2 +- app/views/layouts/_side_bar.html.erb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/admin/ad_banners/index.html.erb b/app/views/admin/ad_banners/index.html.erb index 8307885a..9a5d438b 100644 --- a/app/views/admin/ad_banners/index.html.erb +++ b/app/views/admin/ad_banners/index.html.erb @@ -10,7 +10,7 @@
- <%= 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' %>
diff --git a/lib/parsers/parser_common.rb b/lib/parsers/parser_common.rb index 403c05e4..f60c4a51 100644 --- a/lib/parsers/parser_common.rb +++ b/lib/parsers/parser_common.rb @@ -66,7 +66,7 @@ module ParserCommon printable_ad_images.each do |ad_image| #TODO Need Reflact res << " Date: Wed, 25 Apr 2012 18:17:58 +0800 Subject: [PATCH 04/10] Fix for structure: restore js and change manifests --- app/assets/javascripts/side_bar_history.js | 42 +++++++++++----------- app/assets/javascripts/site_editor.js | 7 ++-- app/assets/stylesheets/site_editor.css.erb | 4 +-- app/views/layouts/site_editor.html.erb | 37 ++++++++++--------- 4 files changed, 42 insertions(+), 48 deletions(-) diff --git a/app/assets/javascripts/side_bar_history.js b/app/assets/javascripts/side_bar_history.js index 4b5da1d4..ad29b497 100644 --- a/app/assets/javascripts/side_bar_history.js +++ b/app/assets/javascripts/side_bar_history.js @@ -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 () { diff --git a/app/assets/javascripts/site_editor.js b/app/assets/javascripts/site_editor.js index 1eb5e3f1..4c22acbd 100644 --- a/app/assets/javascripts/site_editor.js +++ b/app/assets/javascripts/site_editor.js @@ -4,8 +4,5 @@ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // the compiled file. // -//= require jquery -//= require jquery_ujs -//= require page_edit -//= require side_bar_history -//= require new_admin \ No newline at end of file +//= require new_admin +//= require page_edit \ No newline at end of file diff --git a/app/assets/stylesheets/site_editor.css.erb b/app/assets/stylesheets/site_editor.css.erb index 1e16ea3f..fa439d09 100644 --- a/app/assets/stylesheets/site_editor.css.erb +++ b/app/assets/stylesheets/site_editor.css.erb @@ -2,9 +2,7 @@ *This is a manifest file that'll automatically include all the stylesheets available in this directory *and any sub-directories. You're free to add application-wide styles to this file and they'll appear at *the top of the compiled file, but it's generally better to create a new file per style scope. - *= require reset - *= require_self - *= require message + *= require new_admin *= require site_items *= require sidebar */ \ No newline at end of file diff --git a/app/views/layouts/site_editor.html.erb b/app/views/layouts/site_editor.html.erb index e5ed9bb9..158c9f80 100644 --- a/app/views/layouts/site_editor.html.erb +++ b/app/views/layouts/site_editor.html.erb @@ -9,31 +9,30 @@ <%= stylesheet_link_tag "site_editor" %> <%= javascript_include_tag "site_editor" %> - <%= yield :page_specific_css %> - <%= yield :page_specific_javascript %> <%= csrf_meta_tag %> - +
+
+ +
+
+
-
<%= yield :sidebar %>
-
+
<%= yield %> -
-
<%= yield :tertiary %>
- +
- From 6f1eb97ace60caa97c2563818c919b53e20921eb Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Wed, 25 Apr 2012 18:41:38 +0800 Subject: [PATCH 05/10] Fix for structure js and css --- app/assets/javascripts/site_editor.js | 9 ++++++++- app/assets/stylesheets/site_editor.css.erb | 8 +++++++- app/helpers/application_helper.rb | 7 ------- app/views/admin/pages/show.html.erb | 4 ---- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/app/assets/javascripts/site_editor.js b/app/assets/javascripts/site_editor.js index 4c22acbd..4451accb 100644 --- a/app/assets/javascripts/site_editor.js +++ b/app/assets/javascripts/site_editor.js @@ -4,5 +4,12 @@ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // the compiled file. // -//= require new_admin +//= require jquery +//= require jquery_ujs +//= require bootstrap +//= require jquery.isotope.min +//= require jquery.tinyscrollbar.min +//= require orbit-1.0 +//= require orbit-bar-search +//= require side_bar_history //= require page_edit \ No newline at end of file diff --git a/app/assets/stylesheets/site_editor.css.erb b/app/assets/stylesheets/site_editor.css.erb index fa439d09..e36d0b7b 100644 --- a/app/assets/stylesheets/site_editor.css.erb +++ b/app/assets/stylesheets/site_editor.css.erb @@ -2,7 +2,13 @@ *This is a manifest file that'll automatically include all the stylesheets available in this directory *and any sub-directories. You're free to add application-wide styles to this file and they'll appear at *the top of the compiled file, but it's generally better to create a new file per style scope. - *= require new_admin + *= require reset + *= require_self + *= require message + *= require bootstrap + *= require style + *= require bootstrap-orbit + *= require scroll_style *= require site_items *= require sidebar */ \ No newline at end of file diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 7337b274..b1d190ec 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -138,15 +138,8 @@ module ApplicationHelper def page_javascripts(page) javascripts = '' - javascripts << "\n" javascripts << "\n" javascripts << "\n" - javascripts << "\n" - javascripts << "\n" - javascripts << "\n" - javascripts << "\n" - javascripts << "\n" - javascripts << "\n" javascripts << "\n" page.design.javascripts.each do |js| # javascripts << "" diff --git a/app/views/admin/pages/show.html.erb b/app/views/admin/pages/show.html.erb index d6b6a8a2..3e1160c7 100644 --- a/app/views/admin/pages/show.html.erb +++ b/app/views/admin/pages/show.html.erb @@ -1,5 +1 @@ -<% content_for :sidebar do %> - <%= render 'admin/items/site_map_left_bar' %> -<% end -%> - <%= render 'show' %> \ No newline at end of file From 6bf4c60d458104de36c0ba3805508014b2f506cf Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Thu, 26 Apr 2012 01:49:02 +0800 Subject: [PATCH 06/10] Changes for js and ccs load for site's pages --- app/helpers/application_helper.rb | 23 +++++++++++++++++------ app/views/admin/pages/_show.html.erb | 4 ++-- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b1d190ec..52ad71c0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -124,11 +124,13 @@ module ApplicationHelper "#{page.title ? page.title[I18n.locale] : page.i18n_variable[I18n.locale]}\n" end - def page_stylesheets(page) + def page_stylesheets(page, edit=nil) stylesheets = '' - stylesheets << "\n" - stylesheets << "\n" - stylesheets << "\n" + unless edit + stylesheets << "\n" + stylesheets << "\n" + stylesheets << "\n" + end stylesheets << "\n" if page.design.reset_css stylesheets << "\n" if page.design.default_css theme = page.design.themes.detect{ |d| d.id == page.theme_id } @@ -136,9 +138,18 @@ module ApplicationHelper stylesheets end - def page_javascripts(page) + def page_javascripts(page, edit=nil) javascripts = '' - javascripts << "\n" + unless edit + javascripts << "\n" + javascripts << "\n" + javascripts << "\n" + javascripts << "\n" + javascripts << "\n" + javascripts << "\n" + javascripts << "\n" + javascripts << "\n" + end javascripts << "\n" javascripts << "\n" page.design.javascripts.each do |js| diff --git a/app/views/admin/pages/_show.html.erb b/app/views/admin/pages/_show.html.erb index ba9bcf48..29d532fb 100644 --- a/app/views/admin/pages/_show.html.erb +++ b/app/views/admin/pages/_show.html.erb @@ -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 %> \ No newline at end of file From 3d293f64199d5130c154d46beef750fa2cf40acc Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Thu, 26 Apr 2012 16:42:28 +0800 Subject: [PATCH 07/10] Fix for quick edit file and link in announcement Change submit_button into ajax_for_submit --- app/assets/javascripts/ajax_form.js | 2 +- app/assets/javascripts/bulletin_form.js.erb | 5 ++- app/assets/javascripts/new_admin.js | 4 ++- app/views/admin/assets/_edit.html.erb | 2 +- app/views/admin/assets/_new.html.erb | 2 +- .../bulletins/_bulletin_file_qe.html.erb | 8 ++--- .../bulletins/_list_bulletin_file.html.erb | 29 ++++++++-------- .../bulletins/_list_bulletin_link.html.erb | 34 ++++++++----------- .../bulletins/_quick_edit_files.html.erb | 2 +- .../back_end/bulletins/index.html.erb | 6 ++++ 10 files changed, 49 insertions(+), 45 deletions(-) diff --git a/app/assets/javascripts/ajax_form.js b/app/assets/javascripts/ajax_form.js index c026e518..d9b5abfe 100644 --- a/app/assets/javascripts/ajax_form.js +++ b/app/assets/javascripts/ajax_form.js @@ -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'; diff --git a/app/assets/javascripts/bulletin_form.js.erb b/app/assets/javascripts/bulletin_form.js.erb index abb908b4..01685c3d 100644 --- a/app/assets/javascripts/bulletin_form.js.erb +++ b/app/assets/javascripts/bulletin_form.js.erb @@ -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(){ diff --git a/app/assets/javascripts/new_admin.js b/app/assets/javascripts/new_admin.js index 45bfcbbc..f20267cd 100644 --- a/app/assets/javascripts/new_admin.js +++ b/app/assets/javascripts/new_admin.js @@ -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 \ No newline at end of file +//= require side_bar_history +//= require ajax_form \ No newline at end of file diff --git a/app/views/admin/assets/_edit.html.erb b/app/views/admin/assets/_edit.html.erb index 33f8131c..a747d4f2 100644 --- a/app/views/admin/assets/_edit.html.erb +++ b/app/views/admin/assets/_edit.html.erb @@ -9,7 +9,7 @@ <%= link_back %> <%= f.submit t(:edit) %> <% else %> - <%= t(:edit) %> + <%= t(:edit) %> <% end %>
<% end %> diff --git a/app/views/admin/assets/_new.html.erb b/app/views/admin/assets/_new.html.erb index 49e638c8..85d3c2e5 100644 --- a/app/views/admin/assets/_new.html.erb +++ b/app/views/admin/assets/_new.html.erb @@ -9,7 +9,7 @@ <%= link_back %> <%= f.submit t(:create) %> <% else %> - <%= t(:create) %> + <%= t(:create) %> <% end %> <% end %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file_qe.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file_qe.html.erb index 4e47024c..23229b5d 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file_qe.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file_qe.html.erb @@ -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| %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_list_bulletin_file.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_list_bulletin_file.html.erb index c884d0ad..f340b00f 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_list_bulletin_file.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_list_bulletin_file.html.erb @@ -1,18 +1,19 @@ - - <%= 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 %> - <%= 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 %> - - - - <%= fields_for "bulletin[bulletin_files_attributes][]", list_bulletin_file, :index => list_bulletin_file_counter do |f| %> - <%= f.hidden_field :id %> - - <%= f.hidden_field :should_destroy, :value => nil , :class => 'should_destroy' %> - <% end %> - - - + + <%= 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 %> + <%= 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 %> + + + + <%= 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) %> + + <%= f.hidden_field :_destroy, :value => nil , :class => 'should_destroy' %> + <% end %> + + + diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_list_bulletin_link.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_list_bulletin_link.html.erb index 33cb9498..462d357b 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_list_bulletin_link.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_list_bulletin_link.html.erb @@ -1,19 +1,15 @@ - - - <%= link_to list_bulletin_link.i18n_variable.zh_tw, list_bulletin_link.url, :target => '_blank' %> - <%= link_to list_bulletin_link.i18n_variable.en, list_bulletin_link.url, :target => '_blank' %> - - - - <%= fields_for "bulletin[bulletin_links_attributes][]", list_bulletin_link, :index => list_bulletin_link_counter do |f| %> - <%= f.hidden_field :id %> - - <%= f.hidden_field :should_destroy, :value => nil , :class => 'should_destroy' %> - <% end %> - - - - - - - \ No newline at end of file + + <%= link_to list_bulletin_link.i18n_variable.zh_tw, list_bulletin_link.url, :target => '_blank' %> + <%= link_to list_bulletin_link.i18n_variable.en, list_bulletin_link.url, :target => '_blank' %> + + + + <%= 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) %> + + <%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %> + <% end %> + + + diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_files.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_files.html.erb index 8360ad42..8daa6a26 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_files.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_quick_edit_files.html.erb @@ -1,7 +1,7 @@
- +
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb index 78532f00..89872e5e 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb @@ -14,6 +14,12 @@ <%= render :partial => "bulletin_link_qe" %> + +
+ +
<%= 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' %> From 9a5ce5f5125b8dae31e790e2fc04a8939ab1174f Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Wed, 25 Apr 2012 17:17:04 +0800 Subject: [PATCH 08/10] Remove unless sidebar links. --- app/views/admin/ad_banners/_ad_banner_tab.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/ad_banners/_ad_banner_tab.html.erb b/app/views/admin/ad_banners/_ad_banner_tab.html.erb index 76c55376..d2149f81 100644 --- a/app/views/admin/ad_banners/_ad_banner_tab.html.erb +++ b/app/views/admin/ad_banners/_ad_banner_tab.html.erb @@ -1,4 +1,4 @@ -
" id=<%= ad_banner_tab.title %>> +
" 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| -%>
From faace9893a20ea3a3f5d2d8bd20d767f95622f7d Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Wed, 25 Apr 2012 17:17:42 +0800 Subject: [PATCH 09/10] dehumanize ad banner --- app/views/admin/ad_banners/index.html.erb | 2 +- app/views/layouts/_side_bar.html.erb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/admin/ad_banners/index.html.erb b/app/views/admin/ad_banners/index.html.erb index 8307885a..9a5d438b 100644 --- a/app/views/admin/ad_banners/index.html.erb +++ b/app/views/admin/ad_banners/index.html.erb @@ -10,7 +10,7 @@
- <%= 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' %>
diff --git a/lib/parsers/parser_common.rb b/lib/parsers/parser_common.rb index 403c05e4..f60c4a51 100644 --- a/lib/parsers/parser_common.rb +++ b/lib/parsers/parser_common.rb @@ -66,7 +66,7 @@ module ParserCommon printable_ad_images.each do |ad_image| #TODO Need Reflact res << "
Chinese