forked from saurabh/orbit4-5
added clean button for the modules import
This commit is contained in:
parent
cbd3a79122
commit
c18846b6b0
|
@ -29,6 +29,27 @@ class Admin::ImportController < OrbitAdminController
|
|||
render :json=>{"status"=>msg}
|
||||
end
|
||||
|
||||
def clean_old_data
|
||||
case params[:module]
|
||||
when "members"
|
||||
User.where(:user_name.ne => "rulingcom").destroy_all
|
||||
member_profle_id = User.where(:user_name => "rulingcom").first.member_profile.id.to_s
|
||||
MemberProfile.where(:id.ne => member_profle_id).destroy_all
|
||||
Role.destroy_all
|
||||
when "announcement"
|
||||
Bulletin.where(:rss2_sn.ne => nil).destroy_all
|
||||
when "archive"
|
||||
ArchiveFile.where(:rss2_sn.ne => nil).destroy_all
|
||||
when "pages"
|
||||
Page.where(:rss2_id.ne => nil).destroy_all
|
||||
when "gallery"
|
||||
Album.where(:rss2_id.ne => nil).destroy_all
|
||||
when "links"
|
||||
WebLink.where(:rss2_id.ne => nil).destroy_all
|
||||
end
|
||||
render :json => {"success" => true}.to_json
|
||||
end
|
||||
|
||||
def module_categories
|
||||
module_app = ModuleApp.find_by(:key=>params['module'])
|
||||
uri = URI.parse(params['url'])
|
||||
|
|
|
@ -157,12 +157,13 @@
|
|||
<div class="head" style="border: 0px solid #CCC; margin: 5px; text-align: center;">
|
||||
<i class=""></i>
|
||||
</div>
|
||||
<div class="content" style="border: 0px solid #CCC; height: 100px; margin: 5px">
|
||||
<div class="content text-right" style="border: 0px solid #CCC; height: 100px; margin: 5px">
|
||||
<div class="progress">
|
||||
<div class="bar" style="width: 0%;"></div>
|
||||
</div>
|
||||
<div id="import-progress-text"></div>
|
||||
<button id="import-start-btn" class="btn btn-primary pull-right">Start</i></button>
|
||||
<div id="import-progress-text" class="text-center"></div>
|
||||
<button id="import-start-btn" class="btn btn-primary">Start</i></button>
|
||||
<button id="import-clean-btn" class="btn btn-danger">Clean</i></button>
|
||||
<button id="import-back-btn" class="btn pull-left">Back</i></button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -208,6 +209,19 @@
|
|||
getModuleCategories();
|
||||
}
|
||||
});
|
||||
|
||||
$("#import-clean-btn").click(function(){
|
||||
$("#import-progress-text").html("Cleaning up " + module + ". Please wait.");
|
||||
$.ajax({
|
||||
url : "<%= admin_import_clean_old_data_path %>",
|
||||
type : "post",
|
||||
dataType : "json",
|
||||
data : {"module" : module}
|
||||
}).done(function(){
|
||||
$("#import-progress-text").html("Cleaning up successful. Ready to import.");
|
||||
})
|
||||
})
|
||||
|
||||
$("#import-back-btn").click(function(){
|
||||
$("#import-progress").fadeOut(300,function(){
|
||||
$("#import-head").fadeIn(0);
|
||||
|
|
|
@ -231,6 +231,7 @@ Orbit::Application.routes.draw do
|
|||
post "import/rss2_members" => "import#rss2_members"
|
||||
post "import/rss2_members_info" => "import#rss2_members_info"
|
||||
get "import/import_plugin" => "import#import_plugin"
|
||||
post "import/clean_old_data" => "import#clean_old_data"
|
||||
end
|
||||
|
||||
get 'mobile', to: 'pages#home'
|
||||
|
|
Loading…
Reference in New Issue