From a04155963d5318e5acf5a80f563c8428462eac43 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Tue, 13 Aug 2013 20:49:03 +0800 Subject: [PATCH] all file things are fixed. delete and view and also names --- app/assets/javascripts/desktop/orbitdesktopAPI.js | 3 +++ app/assets/stylesheets/desktop/desktop-main.css | 7 +++++++ .../personal_book/desktop/personal_books.js | 9 +++++++-- .../desktop/personal_books/_form_file.html.erb | 8 ++++---- .../personal_conference/desktop/conference_pages.js | 11 ++++++++--- .../desktop/conference_pages/_form_file.html.erb | 8 ++++---- .../personal_diploma/desktop/personal_diploma.js | 9 +++++++-- .../desktop/personal_experiences.js | 9 +++++++-- .../personal_honor/desktop/personal_honors.js | 11 ++++++++--- .../personal_journal/desktop/journal_pages.js | 9 +++++++-- .../desktop/journal_pages/_form_file.html.erb | 8 ++++---- .../javascripts/personal_lab/desktop/personal_lab.js | 11 ++++++++--- .../desktop/personal_labs/_form_file.html.erb | 8 ++++---- .../personal_patent/desktop/personal_patent.js | 11 ++++++++--- .../personal_project/desktop/personal_project.js | 11 ++++++++--- .../desktop/personal_projects/_form_file.html.erb | 8 ++++---- .../personal_research/desktop/personal_research.js | 11 ++++++++--- .../desktop/personal_researchs/_form_file.html.erb | 8 ++++---- 18 files changed, 110 insertions(+), 50 deletions(-) diff --git a/app/assets/javascripts/desktop/orbitdesktopAPI.js b/app/assets/javascripts/desktop/orbitdesktopAPI.js index 47b72d4ba..2d89a727b 100644 --- a/app/assets/javascripts/desktop/orbitdesktopAPI.js +++ b/app/assets/javascripts/desktop/orbitdesktopAPI.js @@ -231,6 +231,9 @@ var orbitDesktopAPI = function(){ } } }; + this.filepathSplitter = function(path){ + return path.split(/\\/g); + } }; orbitDesktopAPI.prototype.notifyImgPath = "temp"; orbitDesktopAPI.prototype.wallpaperPath = "temp"; diff --git a/app/assets/stylesheets/desktop/desktop-main.css b/app/assets/stylesheets/desktop/desktop-main.css index bc240f270..eb833caac 100644 --- a/app/assets/stylesheets/desktop/desktop-main.css +++ b/app/assets/stylesheets/desktop/desktop-main.css @@ -789,3 +789,10 @@ a.admtxt.admbg2:hover { background-color: #fff; } .desktop_toolpopup span { margin: 3px 0 3px 0; } + + .color-red{ + color : red; + } +.remove_existing_record.color-red:hover { + color: red; +}; \ No newline at end of file diff --git a/vendor/built_in_modules/personal_book/app/assets/javascripts/personal_book/desktop/personal_books.js b/vendor/built_in_modules/personal_book/app/assets/javascripts/personal_book/desktop/personal_books.js index 64baaff2b..739f98cb3 100644 --- a/vendor/built_in_modules/personal_book/app/assets/javascripts/personal_book/desktop/personal_books.js +++ b/vendor/built_in_modules/personal_book/app/assets/javascripts/personal_book/desktop/personal_books.js @@ -56,8 +56,13 @@ orbitDesktop.prototype.initializePersonalBook = function(target,url,cache){ // t return false; }); $('.action a.remove_existing_record').click(function(){ - $(this).next('.should_destroy').attr('value', 1); - $("tr#add_plugin_file_" + $(this).prev().attr('value')).hide(); + $(this).toggleClass("color-red",function(){ + if($(this).hasClass('color-red')){ + $(this).next('.should_destroy').attr('value', 1); + }else{ + $(this).next('.should_destroy').removeAttr('value'); + } + }) }); } diff --git a/vendor/built_in_modules/personal_book/app/views/panel/personal_book/desktop/personal_books/_form_file.html.erb b/vendor/built_in_modules/personal_book/app/views/panel/personal_book/desktop/personal_books/_form_file.html.erb index 66a048cfa..3b82712c0 100644 --- a/vendor/built_in_modules/personal_book/app/views/panel/personal_book/desktop/personal_books/_form_file.html.erb +++ b/vendor/built_in_modules/personal_book/app/views/panel/personal_book/desktop/personal_books/_form_file.html.erb @@ -2,7 +2,7 @@
<% if form_file.new_record? %> - <%= f.file_field :file, class: "s_grid_2", onchange:"this.parentNode.getElementsByTagName('label')[0].innerHTML = this.value" %> + <%= f.file_field :file, class: "s_grid_2", onchange:"var temp = o.filepathSplitter(this.value);temp=temp[temp.length - 1];this.parentNode.getElementsByTagName('label')[0].innerHTML = temp;var inputs = this.parentNode.parentNode.parentNode.getElementsByClassName('title_field');inputs[0].value = temp;inputs[1].value = temp;" %> <% end %>
@@ -13,7 +13,7 @@ <%= data %>> <%= f.fields_for :file_title_translations do |f| %> <%= f.text_field locale, - class: 's_grid_4', + class: 's_grid_4 title_field', placeholder: I18nVariable.from_locale(locale), value: (form_file.file_title_translations[locale] rescue nil) %> <% end %> @@ -31,10 +31,10 @@ <% if form_file.new_record? %> - + <% else %> <%= f.hidden_field :id %> - + <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> <% end %> <%= form_file.file.file ? ( link_to '', form_file.file.url, {:class => 'icon-eye-open', :target => '_blank', :title => t(:view)} ) : '' %> diff --git a/vendor/built_in_modules/personal_conference/app/assets/javascripts/personal_conference/desktop/conference_pages.js b/vendor/built_in_modules/personal_conference/app/assets/javascripts/personal_conference/desktop/conference_pages.js index be1fbfe69..b0647287f 100644 --- a/vendor/built_in_modules/personal_conference/app/assets/javascripts/personal_conference/desktop/conference_pages.js +++ b/vendor/built_in_modules/personal_conference/app/assets/javascripts/personal_conference/desktop/conference_pages.js @@ -55,9 +55,14 @@ orbitDesktop.prototype.initializeConferencePapers = function(target,url,cache){ }); return false; }); - $('.action a.remove_existing_record').click(function(){ - $(this).next('.should_destroy').attr('value', 1); - $("tr#add_plugin_file_" + $(this).prev().attr('value')).hide(); + $('.action a.remove_existing_record').click(function(){ + $(this).toggleClass("color-red",function(){ + if($(this).hasClass('color-red')){ + $(this).next('.should_destroy').attr('value', 1); + }else{ + $(this).next('.should_destroy').removeAttr('value'); + } + }) }); } diff --git a/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_pages/_form_file.html.erb b/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_pages/_form_file.html.erb index 66a048cfa..3b82712c0 100644 --- a/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_pages/_form_file.html.erb +++ b/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_pages/_form_file.html.erb @@ -2,7 +2,7 @@
<% if form_file.new_record? %> - <%= f.file_field :file, class: "s_grid_2", onchange:"this.parentNode.getElementsByTagName('label')[0].innerHTML = this.value" %> + <%= f.file_field :file, class: "s_grid_2", onchange:"var temp = o.filepathSplitter(this.value);temp=temp[temp.length - 1];this.parentNode.getElementsByTagName('label')[0].innerHTML = temp;var inputs = this.parentNode.parentNode.parentNode.getElementsByClassName('title_field');inputs[0].value = temp;inputs[1].value = temp;" %> <% end %>
@@ -13,7 +13,7 @@ <%= data %>> <%= f.fields_for :file_title_translations do |f| %> <%= f.text_field locale, - class: 's_grid_4', + class: 's_grid_4 title_field', placeholder: I18nVariable.from_locale(locale), value: (form_file.file_title_translations[locale] rescue nil) %> <% end %> @@ -31,10 +31,10 @@ <% if form_file.new_record? %> - + <% else %> <%= f.hidden_field :id %> - + <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> <% end %> <%= form_file.file.file ? ( link_to '', form_file.file.url, {:class => 'icon-eye-open', :target => '_blank', :title => t(:view)} ) : '' %> diff --git a/vendor/built_in_modules/personal_diploma/app/assets/javascripts/personal_diploma/desktop/personal_diploma.js b/vendor/built_in_modules/personal_diploma/app/assets/javascripts/personal_diploma/desktop/personal_diploma.js index 9f9cf6e98..a9f85bae7 100644 --- a/vendor/built_in_modules/personal_diploma/app/assets/javascripts/personal_diploma/desktop/personal_diploma.js +++ b/vendor/built_in_modules/personal_diploma/app/assets/javascripts/personal_diploma/desktop/personal_diploma.js @@ -56,8 +56,13 @@ orbitDesktop.prototype.initializePersonalDiploma = function(target,url,cache){ / return false; }); $('.action a.remove_existing_record').click(function(){ - $(this).next('.should_destroy').attr('value', 1); - $("tr#add_plugin_file_" + $(this).prev().attr('value')).hide(); + $(this).toggleClass("color-red",function(){ + if($(this).hasClass('color-red')){ + $(this).next('.should_destroy').attr('value', 1); + }else{ + $(this).next('.should_destroy').removeAttr('value'); + } + }) }); } diff --git a/vendor/built_in_modules/personal_experience/app/assets/javascripts/personal_experience/desktop/personal_experiences.js b/vendor/built_in_modules/personal_experience/app/assets/javascripts/personal_experience/desktop/personal_experiences.js index bbada5fdc..6e4725640 100644 --- a/vendor/built_in_modules/personal_experience/app/assets/javascripts/personal_experience/desktop/personal_experiences.js +++ b/vendor/built_in_modules/personal_experience/app/assets/javascripts/personal_experience/desktop/personal_experiences.js @@ -56,8 +56,13 @@ orbitDesktop.prototype.initializePersonalExperience = function(target,url,cache) return false; }); $('.action a.remove_existing_record').click(function(){ - $(this).next('.should_destroy').attr('value', 1); - $("tr#add_plugin_file_" + $(this).prev().attr('value')).hide(); + $(this).toggleClass("color-red",function(){ + if($(this).hasClass('color-red')){ + $(this).next('.should_destroy').attr('value', 1); + }else{ + $(this).next('.should_destroy').removeAttr('value'); + } + }) }); } diff --git a/vendor/built_in_modules/personal_honor/app/assets/javascripts/personal_honor/desktop/personal_honors.js b/vendor/built_in_modules/personal_honor/app/assets/javascripts/personal_honor/desktop/personal_honors.js index 7d0d27edc..e006fb055 100644 --- a/vendor/built_in_modules/personal_honor/app/assets/javascripts/personal_honor/desktop/personal_honors.js +++ b/vendor/built_in_modules/personal_honor/app/assets/javascripts/personal_honor/desktop/personal_honors.js @@ -55,9 +55,14 @@ orbitDesktop.prototype.initializePersonalHonor = function(target,url,cache){ // }); return false; }); - $('.action a.remove_existing_record').click(function(){ - $(this).next('.should_destroy').attr('value', 1); - $("tr#add_plugin_file_" + $(this).prev().attr('value')).hide(); + $('.action a.remove_existing_record').click(function(){ + $(this).toggleClass("color-red",function(){ + if($(this).hasClass('color-red')){ + $(this).next('.should_destroy').attr('value', 1); + }else{ + $(this).next('.should_destroy').removeAttr('value'); + } + }) }); } diff --git a/vendor/built_in_modules/personal_journal/app/assets/javascripts/personal_journal/desktop/journal_pages.js b/vendor/built_in_modules/personal_journal/app/assets/javascripts/personal_journal/desktop/journal_pages.js index da74534d2..d6f96c9ad 100644 --- a/vendor/built_in_modules/personal_journal/app/assets/javascripts/personal_journal/desktop/journal_pages.js +++ b/vendor/built_in_modules/personal_journal/app/assets/javascripts/personal_journal/desktop/journal_pages.js @@ -56,8 +56,13 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ // return false; }); $('.action a.remove_existing_record').click(function(){ - $(this).next('.should_destroy').attr('value', 1); - $("tr#add_plugin_file_" + $(this).prev().attr('value')).hide(); + $(this).toggleClass("color-red",function(){ + if($(this).hasClass('color-red')){ + $(this).next('.should_destroy').attr('value', 1); + }else{ + $(this).next('.should_destroy').removeAttr('value'); + } + }) }); } diff --git a/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/_form_file.html.erb b/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/_form_file.html.erb index 66a048cfa..3b82712c0 100644 --- a/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/_form_file.html.erb +++ b/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/_form_file.html.erb @@ -2,7 +2,7 @@
<% if form_file.new_record? %> - <%= f.file_field :file, class: "s_grid_2", onchange:"this.parentNode.getElementsByTagName('label')[0].innerHTML = this.value" %> + <%= f.file_field :file, class: "s_grid_2", onchange:"var temp = o.filepathSplitter(this.value);temp=temp[temp.length - 1];this.parentNode.getElementsByTagName('label')[0].innerHTML = temp;var inputs = this.parentNode.parentNode.parentNode.getElementsByClassName('title_field');inputs[0].value = temp;inputs[1].value = temp;" %> <% end %>
@@ -13,7 +13,7 @@ <%= data %>> <%= f.fields_for :file_title_translations do |f| %> <%= f.text_field locale, - class: 's_grid_4', + class: 's_grid_4 title_field', placeholder: I18nVariable.from_locale(locale), value: (form_file.file_title_translations[locale] rescue nil) %> <% end %> @@ -31,10 +31,10 @@ <% if form_file.new_record? %> - + <% else %> <%= f.hidden_field :id %> - + <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> <% end %> <%= form_file.file.file ? ( link_to '', form_file.file.url, {:class => 'icon-eye-open', :target => '_blank', :title => t(:view)} ) : '' %> diff --git a/vendor/built_in_modules/personal_lab/app/assets/javascripts/personal_lab/desktop/personal_lab.js b/vendor/built_in_modules/personal_lab/app/assets/javascripts/personal_lab/desktop/personal_lab.js index 82103f3a0..41c4e40fd 100644 --- a/vendor/built_in_modules/personal_lab/app/assets/javascripts/personal_lab/desktop/personal_lab.js +++ b/vendor/built_in_modules/personal_lab/app/assets/javascripts/personal_lab/desktop/personal_lab.js @@ -57,9 +57,14 @@ orbitDesktop.prototype.initializePersonalLab = function(target,url,cache){ // th }); return false; }); - $('.action a.remove_existing_record').click(function(){ - $(this).next('.should_destroy').attr('value', 1); - $("tr#add_plugin_file_" + $(this).prev().attr('value')).hide(); + $('.action a.remove_existing_record').click(function(){ + $(this).toggleClass("color-red",function(){ + if($(this).hasClass('color-red')){ + $(this).next('.should_destroy').attr('value', 1); + }else{ + $(this).next('.should_destroy').removeAttr('value'); + } + }) }); } diff --git a/vendor/built_in_modules/personal_lab/app/views/panel/personal_lab/desktop/personal_labs/_form_file.html.erb b/vendor/built_in_modules/personal_lab/app/views/panel/personal_lab/desktop/personal_labs/_form_file.html.erb index 66a048cfa..3b82712c0 100644 --- a/vendor/built_in_modules/personal_lab/app/views/panel/personal_lab/desktop/personal_labs/_form_file.html.erb +++ b/vendor/built_in_modules/personal_lab/app/views/panel/personal_lab/desktop/personal_labs/_form_file.html.erb @@ -2,7 +2,7 @@
<% if form_file.new_record? %> - <%= f.file_field :file, class: "s_grid_2", onchange:"this.parentNode.getElementsByTagName('label')[0].innerHTML = this.value" %> + <%= f.file_field :file, class: "s_grid_2", onchange:"var temp = o.filepathSplitter(this.value);temp=temp[temp.length - 1];this.parentNode.getElementsByTagName('label')[0].innerHTML = temp;var inputs = this.parentNode.parentNode.parentNode.getElementsByClassName('title_field');inputs[0].value = temp;inputs[1].value = temp;" %> <% end %>
@@ -13,7 +13,7 @@ <%= data %>> <%= f.fields_for :file_title_translations do |f| %> <%= f.text_field locale, - class: 's_grid_4', + class: 's_grid_4 title_field', placeholder: I18nVariable.from_locale(locale), value: (form_file.file_title_translations[locale] rescue nil) %> <% end %> @@ -31,10 +31,10 @@ <% if form_file.new_record? %> - + <% else %> <%= f.hidden_field :id %> - + <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> <% end %> <%= form_file.file.file ? ( link_to '', form_file.file.url, {:class => 'icon-eye-open', :target => '_blank', :title => t(:view)} ) : '' %> diff --git a/vendor/built_in_modules/personal_patent/app/assets/javascripts/personal_patent/desktop/personal_patent.js b/vendor/built_in_modules/personal_patent/app/assets/javascripts/personal_patent/desktop/personal_patent.js index d6a113b1d..209ae99ac 100644 --- a/vendor/built_in_modules/personal_patent/app/assets/javascripts/personal_patent/desktop/personal_patent.js +++ b/vendor/built_in_modules/personal_patent/app/assets/javascripts/personal_patent/desktop/personal_patent.js @@ -55,9 +55,14 @@ orbitDesktop.prototype.initializePersonalPatent = function(target,url,cache){ // }); return false; }); - $('.action a.remove_existing_record').click(function(){ - $(this).next('.should_destroy').attr('value', 1); - $("tr#add_plugin_file_" + $(this).prev().attr('value')).hide(); + $('.action a.remove_existing_record').click(function(){ + $(this).toggleClass("color-red",function(){ + if($(this).hasClass('color-red')){ + $(this).next('.should_destroy').attr('value', 1); + }else{ + $(this).next('.should_destroy').removeAttr('value'); + } + }) }); } diff --git a/vendor/built_in_modules/personal_project/app/assets/javascripts/personal_project/desktop/personal_project.js b/vendor/built_in_modules/personal_project/app/assets/javascripts/personal_project/desktop/personal_project.js index 55d8b7474..804ac8ac3 100644 --- a/vendor/built_in_modules/personal_project/app/assets/javascripts/personal_project/desktop/personal_project.js +++ b/vendor/built_in_modules/personal_project/app/assets/javascripts/personal_project/desktop/personal_project.js @@ -55,9 +55,14 @@ orbitDesktop.prototype.initializePersonalProject = function(target,url,cache){ / }); return false; }); - $('.action a.remove_existing_record').click(function(){ - $(this).next('.should_destroy').attr('value', 1); - $("tr#add_plugin_file_" + $(this).prev().attr('value')).hide(); + $('.action a.remove_existing_record').click(function(){ + $(this).toggleClass("color-red",function(){ + if($(this).hasClass('color-red')){ + $(this).next('.should_destroy').attr('value', 1); + }else{ + $(this).next('.should_destroy').removeAttr('value'); + } + }) }); } diff --git a/vendor/built_in_modules/personal_project/app/views/panel/personal_project/desktop/personal_projects/_form_file.html.erb b/vendor/built_in_modules/personal_project/app/views/panel/personal_project/desktop/personal_projects/_form_file.html.erb index 66a048cfa..3b82712c0 100644 --- a/vendor/built_in_modules/personal_project/app/views/panel/personal_project/desktop/personal_projects/_form_file.html.erb +++ b/vendor/built_in_modules/personal_project/app/views/panel/personal_project/desktop/personal_projects/_form_file.html.erb @@ -2,7 +2,7 @@
<% if form_file.new_record? %> - <%= f.file_field :file, class: "s_grid_2", onchange:"this.parentNode.getElementsByTagName('label')[0].innerHTML = this.value" %> + <%= f.file_field :file, class: "s_grid_2", onchange:"var temp = o.filepathSplitter(this.value);temp=temp[temp.length - 1];this.parentNode.getElementsByTagName('label')[0].innerHTML = temp;var inputs = this.parentNode.parentNode.parentNode.getElementsByClassName('title_field');inputs[0].value = temp;inputs[1].value = temp;" %> <% end %>
@@ -13,7 +13,7 @@ <%= data %>> <%= f.fields_for :file_title_translations do |f| %> <%= f.text_field locale, - class: 's_grid_4', + class: 's_grid_4 title_field', placeholder: I18nVariable.from_locale(locale), value: (form_file.file_title_translations[locale] rescue nil) %> <% end %> @@ -31,10 +31,10 @@ <% if form_file.new_record? %> - + <% else %> <%= f.hidden_field :id %> - + <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> <% end %> <%= form_file.file.file ? ( link_to '', form_file.file.url, {:class => 'icon-eye-open', :target => '_blank', :title => t(:view)} ) : '' %> diff --git a/vendor/built_in_modules/personal_research/app/assets/javascripts/personal_research/desktop/personal_research.js b/vendor/built_in_modules/personal_research/app/assets/javascripts/personal_research/desktop/personal_research.js index 4c1c477bf..4d2b32b9a 100644 --- a/vendor/built_in_modules/personal_research/app/assets/javascripts/personal_research/desktop/personal_research.js +++ b/vendor/built_in_modules/personal_research/app/assets/javascripts/personal_research/desktop/personal_research.js @@ -55,9 +55,14 @@ orbitDesktop.prototype.initializePersonalResearch = function(target,url,cache){ }); return false; }); - $('.action a.remove_existing_record').click(function(){ - $(this).next('.should_destroy').attr('value', 1); - $("tr#add_plugin_file_" + $(this).prev().attr('value')).hide(); + $('.action a.remove_existing_record').click(function(){ + $(this).toggleClass("color-red",function(){ + if($(this).hasClass('color-red')){ + $(this).next('.should_destroy').attr('value', 1); + }else{ + $(this).next('.should_destroy').removeAttr('value'); + } + }) }); } diff --git a/vendor/built_in_modules/personal_research/app/views/panel/personal_research/desktop/personal_researchs/_form_file.html.erb b/vendor/built_in_modules/personal_research/app/views/panel/personal_research/desktop/personal_researchs/_form_file.html.erb index 66a048cfa..3b82712c0 100644 --- a/vendor/built_in_modules/personal_research/app/views/panel/personal_research/desktop/personal_researchs/_form_file.html.erb +++ b/vendor/built_in_modules/personal_research/app/views/panel/personal_research/desktop/personal_researchs/_form_file.html.erb @@ -2,7 +2,7 @@
<% if form_file.new_record? %> - <%= f.file_field :file, class: "s_grid_2", onchange:"this.parentNode.getElementsByTagName('label')[0].innerHTML = this.value" %> + <%= f.file_field :file, class: "s_grid_2", onchange:"var temp = o.filepathSplitter(this.value);temp=temp[temp.length - 1];this.parentNode.getElementsByTagName('label')[0].innerHTML = temp;var inputs = this.parentNode.parentNode.parentNode.getElementsByClassName('title_field');inputs[0].value = temp;inputs[1].value = temp;" %> <% end %>
@@ -13,7 +13,7 @@ <%= data %>> <%= f.fields_for :file_title_translations do |f| %> <%= f.text_field locale, - class: 's_grid_4', + class: 's_grid_4 title_field', placeholder: I18nVariable.from_locale(locale), value: (form_file.file_title_translations[locale] rescue nil) %> <% end %> @@ -31,10 +31,10 @@ <% if form_file.new_record? %> - + <% else %> <%= f.hidden_field :id %> - + <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> <% end %> <%= form_file.file.file ? ( link_to '', form_file.file.url, {:class => 'icon-eye-open', :target => '_blank', :title => t(:view)} ) : '' %>