forked from saurabh/orbit4-5
167 lines
5.6 KiB
Plaintext
167 lines
5.6 KiB
Plaintext
<head>
|
|
<%= stylesheet_link_tag "lib/wrap-nav"%>
|
|
<%= stylesheet_link_tag "lib/main-list"%>
|
|
<%= stylesheet_link_tag "lib/mt-list"%>
|
|
<%= stylesheet_link_tag "lib/filter"%>
|
|
<%= stylesheet_link_tag "lib/togglebox"%>
|
|
<%= stylesheet_link_tag "admin/store"%>
|
|
|
|
<%= javascript_include_tag 'lib/footable-0.1' %>
|
|
<%= javascript_include_tag 'lib/all-list' %>
|
|
<%= javascript_include_tag 'lib/retina' %>
|
|
</head>
|
|
|
|
<%= flash[:notice] rescue nil%>
|
|
<div id="alert_wrap">
|
|
<div class="alert alert-success">
|
|
<h4><span id="module_msg_title"></span></h4><br/>
|
|
<span id="module_msg_content"></span><br/>
|
|
<%= image_tag("preloader.gif", size: "50") %>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="delete_confirm_wrap">
|
|
<div class="alert alert-error row-fluid">
|
|
<div id="module_icon" class="span3"></div>
|
|
<div class="span9">
|
|
<h4>Are you sure?</h4>
|
|
Delete module <b><span id="module_title"></span></b>
|
|
</div>
|
|
<div class="span12">
|
|
<button id="delete_module_btn" class="btn btn-danger"><i class="icon-check"></i> <%= t(:yes_) %></button>
|
|
<button id="cancel_btn" class="btn pull-right"><%= t(:cancel) %></button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="module-store panel">
|
|
<div class="panel-heading">
|
|
<ul>
|
|
<li class="active">
|
|
<a href="#installed_modules" data-toggle="tab">
|
|
<i class="icons-download"></i><%= t(:installed_modules) %>
|
|
</a>
|
|
</li>
|
|
<li>
|
|
<a href="#module_store" data-toggle="tab">
|
|
<i class="icon-shopping-cart"></i><%= t(:module_store) %>
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="pannel-body tab-content">
|
|
<div class="tab-pane fade active in" id="installed_modules">
|
|
<table class="table table-striped"></table>
|
|
<button id="apply_change_btn" onclick="apply_change();" class="btn btn-primary btn-small pull-right"><%= t(:apply_change) %></button>
|
|
</div>
|
|
<div class="tab-pane fade" id="module_store">
|
|
<%= render :partial => "admin/store/store", :locals => {:section => "apps"} %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal-backdrop"></div>
|
|
|
|
<script type="text/javascript">
|
|
var toggle_modules = new Array();
|
|
var extensions = <%= @extensions.to_json.to_s.html_safe %>;
|
|
var module_to_delete;
|
|
|
|
$.each(extensions,function(){
|
|
var module_key = this['key'];
|
|
var module_title = this['title'];
|
|
if(typeof this['installed']=='undefined') return;
|
|
if(this['updated']==false) console.log(this['key']);
|
|
|
|
var checked = "";
|
|
if(this['enabled']==true) checked="checked='checked'";
|
|
|
|
$("#extensions_table").append("<tr><td width='15%'><i class='icons-"+this['key']+" icon-3x'></i><br/>"+this['title']+"</td><td width='40%'>Version<br/>v"+this['installed_version']+"</td><td><%= t(:active) %><br/><input type='checkbox' class='toggle-check set-sidebar-state' data-disabled='true' "+checked+" onclick='toggle_module(\""+this['key']+"\");'></td><td>"+
|
|
"<button id='delete_"+this['key']+"' class='btn btn-small btn-danger'><i class='icon-trash'></i> <%= t(:delete_) %></button></td></tr>");
|
|
|
|
$("#delete_"+this['key']).click(function(){
|
|
module_to_delete = module_key;
|
|
$("#module_icon").html("<i class='icons-"+module_key+" icon-3x'></i>");
|
|
$("#module_title").html(module_title);
|
|
$(".modal-backdrop").fadeIn(300,function(){
|
|
$("#delete_confirm_wrap").fadeIn(300);
|
|
});
|
|
});
|
|
});
|
|
|
|
$("#cancel_btn").click(function(){
|
|
$("#delete_confirm_wrap").fadeOut(200,function(){
|
|
$(".modal-backdrop").fadeOut(100);
|
|
});
|
|
});
|
|
|
|
$("#delete_module_btn").click(function(){
|
|
$("#delete_confirm_wrap").fadeOut();
|
|
remove_module(module_to_delete);
|
|
});
|
|
|
|
function toggle_module(module){
|
|
if((idx = $.inArray(module, toggle_modules))>=0){
|
|
toggle_modules.splice(idx, 1);
|
|
}else{
|
|
toggle_modules.push(module);
|
|
}
|
|
|
|
if(toggle_modules.length>0){
|
|
$("#apply_change_btn").show();
|
|
}else{
|
|
$("#apply_change_btn").hide();
|
|
}
|
|
}
|
|
|
|
function apply_change(){
|
|
$(document).scrollTop(0);
|
|
|
|
$("#module_msg_title").html("<%= t(:applying_change) %>");
|
|
$("#module_msg_content").html("<%= t(:please_wait) %>");
|
|
|
|
$(".modal-backdrop").fadeIn(300,function(){
|
|
$("#alert_wrap").fadeIn(300);
|
|
$.get("<%= admin_module_store_toggle_module_path%>?"+$.param({'module':toggle_modules}),function(data){
|
|
|
|
toggle_modules = new Array();
|
|
$("#apply_change_btn").hide();
|
|
|
|
$("#module_msg_title").html("<%= t(:change_applied) %>");
|
|
$("#module_msg_content").html("<%= t("update_manager_.restart_server") %>");
|
|
|
|
$.get("<%= admin_module_store_restart_server_path%>",function(){
|
|
$("#alert_wrap").delay(2000).fadeOut(300,function(){
|
|
$(".modal-backdrop").fadeOut();
|
|
});
|
|
});
|
|
});
|
|
});
|
|
}
|
|
|
|
function remove_module(mod_key){
|
|
$(document).scrollTop(0);
|
|
|
|
$("#module_msg_title").html("<%= t(:applying_change) %>");
|
|
$("#module_msg_content").html("<%= t(:please_wait) %>");
|
|
|
|
$(".modal-backdrop").fadeIn(300,function(){
|
|
$("#alert_wrap").fadeIn(300);
|
|
$.get("<%= admin_module_store_remove_module_path%>?module="+mod_key,function(data){
|
|
|
|
toggle_modules = new Array();
|
|
$("#apply_change_btn").hide();
|
|
|
|
$("#module_msg_title").html("<%= t(:change_applied) %>");
|
|
$("#module_msg_content").html("<%= t("update_manager_.restart_server") %>");
|
|
|
|
$.get("<%= admin_module_store_restart_server_path%>",function(){
|
|
$("#alert_wrap").delay(2000).fadeOut(300,function(){
|
|
$(".modal-backdrop").fadeOut();
|
|
location.reload();
|
|
});
|
|
});
|
|
});
|
|
});
|
|
}
|
|
</script>
|