all file things are fixed. delete and view and also names

This commit is contained in:
Harry Bomrah 2013-08-13 20:49:03 +08:00 committed by saurabhbhatia
parent 6d54dbd5f8
commit a04155963d
18 changed files with 110 additions and 50 deletions

View File

@ -231,6 +231,9 @@ var orbitDesktopAPI = function(){
}
}
};
this.filepathSplitter = function(path){
return path.split(/\\/g);
}
};
orbitDesktopAPI.prototype.notifyImgPath = "temp";
orbitDesktopAPI.prototype.wallpaperPath = "temp";

View File

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

View File

@ -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');
}
})
});
}

View File

@ -2,7 +2,7 @@
<td>
<div>
<% 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;" %>
<label></label>
<% end %>
</div>
@ -13,7 +13,7 @@
<td <%= style %> <%= 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 @@
<td>
<span class="action">
<% if form_file.new_record? %>
<a class="delete"><i class="icon-remove"></i></a>
<a class="delete"><i class="icon-remove" style="cursor:pointer;"></i></a>
<% else %>
<%= f.hidden_field :id %>
<a class="remove_existing_record"><i class="icon-remove"></i></a>
<a class="remove_existing_record" style="cursor:pointer;"><i class="icon-remove"></i></a>
<%= 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)} ) : '' %>

View File

@ -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');
}
})
});
}

View File

@ -2,7 +2,7 @@
<td>
<div>
<% 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;" %>
<label></label>
<% end %>
</div>
@ -13,7 +13,7 @@
<td <%= style %> <%= 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 @@
<td>
<span class="action">
<% if form_file.new_record? %>
<a class="delete"><i class="icon-remove"></i></a>
<a class="delete"><i class="icon-remove" style="cursor:pointer;"></i></a>
<% else %>
<%= f.hidden_field :id %>
<a class="remove_existing_record"><i class="icon-remove"></i></a>
<a class="remove_existing_record" style="cursor:pointer;"><i class="icon-remove"></i></a>
<%= 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)} ) : '' %>

View File

@ -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');
}
})
});
}

View File

@ -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');
}
})
});
}

View File

@ -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');
}
})
});
}

View File

@ -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');
}
})
});
}

View File

@ -2,7 +2,7 @@
<td>
<div>
<% 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;" %>
<label></label>
<% end %>
</div>
@ -13,7 +13,7 @@
<td <%= style %> <%= 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 @@
<td>
<span class="action">
<% if form_file.new_record? %>
<a class="delete"><i class="icon-remove"></i></a>
<a class="delete"><i class="icon-remove" style="cursor:pointer;"></i></a>
<% else %>
<%= f.hidden_field :id %>
<a class="remove_existing_record"><i class="icon-remove"></i></a>
<a class="remove_existing_record" style="cursor:pointer;"><i class="icon-remove"></i></a>
<%= 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)} ) : '' %>

View File

@ -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');
}
})
});
}

View File

@ -2,7 +2,7 @@
<td>
<div>
<% 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;" %>
<label></label>
<% end %>
</div>
@ -13,7 +13,7 @@
<td <%= style %> <%= 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 @@
<td>
<span class="action">
<% if form_file.new_record? %>
<a class="delete"><i class="icon-remove"></i></a>
<a class="delete"><i class="icon-remove" style="cursor:pointer;"></i></a>
<% else %>
<%= f.hidden_field :id %>
<a class="remove_existing_record"><i class="icon-remove"></i></a>
<a class="remove_existing_record" style="cursor:pointer;"><i class="icon-remove"></i></a>
<%= 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)} ) : '' %>

View File

@ -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');
}
})
});
}

View File

@ -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');
}
})
});
}

View File

@ -2,7 +2,7 @@
<td>
<div>
<% 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;" %>
<label></label>
<% end %>
</div>
@ -13,7 +13,7 @@
<td <%= style %> <%= 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 @@
<td>
<span class="action">
<% if form_file.new_record? %>
<a class="delete"><i class="icon-remove"></i></a>
<a class="delete"><i class="icon-remove" style="cursor:pointer;"></i></a>
<% else %>
<%= f.hidden_field :id %>
<a class="remove_existing_record"><i class="icon-remove"></i></a>
<a class="remove_existing_record" style="cursor:pointer;"><i class="icon-remove"></i></a>
<%= 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)} ) : '' %>

View File

@ -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');
}
})
});
}

View File

@ -2,7 +2,7 @@
<td>
<div>
<% 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;" %>
<label></label>
<% end %>
</div>
@ -13,7 +13,7 @@
<td <%= style %> <%= 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 @@
<td>
<span class="action">
<% if form_file.new_record? %>
<a class="delete"><i class="icon-remove"></i></a>
<a class="delete"><i class="icon-remove" style="cursor:pointer;"></i></a>
<% else %>
<%= f.hidden_field :id %>
<a class="remove_existing_record"><i class="icon-remove"></i></a>
<a class="remove_existing_record" style="cursor:pointer;"><i class="icon-remove"></i></a>
<%= 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)} ) : '' %>