forked from saurabh/orbit4-5
Merge branch 'master' of gitlab.tp.rulingcom.com:saurabh/orbit4-5 into nccu
This commit is contained in:
commit
babf12c777
|
@ -1,9 +1,8 @@
|
||||||
class Admin::ModuleStoreController < OrbitAdminController
|
class Admin::ModuleStoreController < OrbitAdminController
|
||||||
layout "structure"
|
layout "structure"
|
||||||
|
include Admin::ModuleStoreHelper
|
||||||
def index
|
def index
|
||||||
@extensions = []
|
@extensions = []
|
||||||
@downloaded_extensions = []
|
|
||||||
# if current_site.site_token?
|
# if current_site.site_token?
|
||||||
# if current_site.store_confirmation
|
# if current_site.store_confirmation
|
||||||
# @extensions = get_extensions
|
# @extensions = get_extensions
|
||||||
|
@ -24,6 +23,11 @@ class Admin::ModuleStoreController < OrbitAdminController
|
||||||
@extension = get_extension(params[:id]) rescue nil
|
@extension = get_extension(params[:id]) rescue nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def modules_to_update
|
||||||
|
@built_in_extensions = get_built_in_extensions
|
||||||
|
render :partial => "modules_to_update"
|
||||||
|
end
|
||||||
|
|
||||||
def download
|
def download
|
||||||
#get extension related values
|
#get extension related values
|
||||||
extension = get_extension(params[:id]) rescue nil
|
extension = get_extension(params[:id]) rescue nil
|
||||||
|
@ -95,7 +99,24 @@ class Admin::ModuleStoreController < OrbitAdminController
|
||||||
end
|
end
|
||||||
|
|
||||||
def restart
|
def restart
|
||||||
Bundler.with_clean_env { `cd #{Rails.root} && bundle install` }
|
Bundler.with_clean_env { `cd #{Rails.root} && BUNDLE_GEMFILE=built_in_extensions.rb bundle update && bundle` }
|
||||||
|
Bundler.with_clean_env { `cd #{Rails.root} && BUNDLE_GEMFILE=downloaded_extensions.rb bundle update && bundle` }
|
||||||
|
@built_in_extensions = get_built_in_extensions
|
||||||
|
render :partial => "modules_to_update"
|
||||||
|
%x(kill -s USR2 `cat tmp/pids/unicorn.pid`)
|
||||||
|
sleep 5
|
||||||
|
end
|
||||||
|
|
||||||
|
def update_module
|
||||||
|
key = params["key"]
|
||||||
|
type = params["type"]
|
||||||
|
if type == "built_in"
|
||||||
|
Bundler.with_clean_env { `cd #{Rails.root} && BUNDLE_GEMFILE=built_in_extensions.rb bundle update #{key}` }
|
||||||
|
elsif type == "downloaded"
|
||||||
|
Bundler.with_clean_env { `cd #{Rails.root} && BUNDLE_GEMFILE=downloaded_extensions.rb bundle update #{key}` }
|
||||||
|
end
|
||||||
|
@built_in_extensions = get_built_in_extensions
|
||||||
|
render :partial => "modules_to_update"
|
||||||
%x(kill -s USR2 `cat tmp/pids/unicorn.pid`)
|
%x(kill -s USR2 `cat tmp/pids/unicorn.pid`)
|
||||||
sleep 5
|
sleep 5
|
||||||
end
|
end
|
||||||
|
@ -133,20 +154,6 @@ class Admin::ModuleStoreController < OrbitAdminController
|
||||||
store_session.get_extension(id)
|
store_session.get_extension(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_downloaded_extension
|
|
||||||
downloaded_extensions = []
|
|
||||||
|
|
||||||
extensions = File.new("#{Rails.root}/downloaded_extensions.rb", "r")
|
|
||||||
|
|
||||||
while (extension = extensions.gets)
|
|
||||||
status = !extension.start_with?("# ")
|
|
||||||
extension = extension.split(',')
|
|
||||||
|
|
||||||
downloaded_extensions << {'name' => extension[0].split(/[\'\"]/)[1], 'repo' => extension[1].split(/[\'\"]/)[1], 'tag' => extension[2].split(/[\'\"]/)[1], 'status' => status}
|
|
||||||
end
|
|
||||||
extensions.close
|
|
||||||
downloaded_extensions.to_json
|
|
||||||
end
|
|
||||||
|
|
||||||
def toggle_item(module_key, active)
|
def toggle_item(module_key, active)
|
||||||
if !module_key.nil?
|
if !module_key.nil?
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
module Admin::ModuleStoreHelper
|
||||||
|
|
||||||
|
def get_built_in_extensions
|
||||||
|
built_in_extensions = []
|
||||||
|
extensions_to_update = get_extensions_to_update
|
||||||
|
@extensions_to_update_count = extensions_to_update.count
|
||||||
|
built_in_extensions = get_extension_from_file("built_in",extensions_to_update)
|
||||||
|
built_in_extensions.concat(get_extension_from_file("downloaded",extensions_to_update))
|
||||||
|
return built_in_extensions
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_extension_from_file(type,extensions_to_update)
|
||||||
|
temp = []
|
||||||
|
extensions = File.new("#{Rails.root}/#{type}_extensions.rb", "r")
|
||||||
|
while (extension = extensions.gets)
|
||||||
|
is_extension = extension.start_with?("gem")
|
||||||
|
extension = extension.split(',')
|
||||||
|
if is_extension
|
||||||
|
key = extension[0].split(/[\'\"]/)[1]
|
||||||
|
ma = ModuleApp.find_by_key(key) rescue nil
|
||||||
|
if !ma.nil?
|
||||||
|
update_available = extensions_to_update.include?(key) ? true : false
|
||||||
|
temp << {'key' => key, 'name' => ma.title, 'repo' => extension[1].split(/[\'\"]/)[1], 'tag' => (extension[2].split(/[\'\"]/)[1] rescue ""), "update_available" => update_available, "type" => type}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return temp
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_extensions_to_update
|
||||||
|
if !File.exists?("#{Rails.root}/built_in_extensions.rb.lock") || !File.exists?("#{Rails.root}/downloaded_extensions.rb.lock")
|
||||||
|
update_extension_file("built_in")
|
||||||
|
update_extension_file("downloaded")
|
||||||
|
return []
|
||||||
|
else
|
||||||
|
update_extensions = get_update_info_for_extensions("built_in")
|
||||||
|
update_extensions.concat(get_update_info_for_extensions("downloaded"))
|
||||||
|
return update_extensions
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def update_extension_file(type)
|
||||||
|
Bundler.with_clean_env { `cd #{Rails.root} && BUNDLE_GEMFILE=#{type}_extensions.rb bundle update && bundle` }
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_update_info_for_extensions(type)
|
||||||
|
buffer = Bundler.with_clean_env { `cd #{Rails.root} && BUNDLE_GEMFILE=#{type}_extensions.rb bundle outdated` }
|
||||||
|
buffer = buffer.split("\n")
|
||||||
|
if buffer.last == "Bundle up to date!"
|
||||||
|
return []
|
||||||
|
elsif buffer.first.start_with?("The git source")
|
||||||
|
update_extension_file(type)
|
||||||
|
return []
|
||||||
|
else
|
||||||
|
output = []
|
||||||
|
buffer.each do |b|
|
||||||
|
if b.start_with?(" * ")
|
||||||
|
temp = b.split(" ")
|
||||||
|
output << temp[1] if !temp[1].nil?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return output
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -229,7 +229,11 @@ module ApplicationHelper
|
||||||
doc = Nokogiri::HTML(file, nil, "UTF-8")
|
doc = Nokogiri::HTML(file, nil, "UTF-8")
|
||||||
file.close
|
file.close
|
||||||
controller = "#{params[:target_controller].capitalize}_controller".classify.constantize.new
|
controller = "#{params[:target_controller].capitalize}_controller".classify.constantize.new
|
||||||
data = controller.send("#{params[:target_action]}") rescue nil
|
begin
|
||||||
|
data = controller.send("#{params[:target_action]}")# rescue nil
|
||||||
|
rescue Exception => e
|
||||||
|
write_debug_file(e,params[:target_controller],params[:target_action]) if Site::DEBUG
|
||||||
|
end
|
||||||
if !data.nil?
|
if !data.nil?
|
||||||
wrap_elements = doc.css("*[data-list][data-level='0']")
|
wrap_elements = doc.css("*[data-list][data-level='0']")
|
||||||
htmls = parsing_repeats_again(wrap_elements,data,1)
|
htmls = parsing_repeats_again(wrap_elements,data,1)
|
||||||
|
@ -261,7 +265,11 @@ module ApplicationHelper
|
||||||
doc = Nokogiri::HTML(file, nil, "UTF-8")
|
doc = Nokogiri::HTML(file, nil, "UTF-8")
|
||||||
file.close
|
file.close
|
||||||
controller = "#{params[:target_controller].capitalize}_controller".classify.constantize.new
|
controller = "#{params[:target_controller].capitalize}_controller".classify.constantize.new
|
||||||
data = controller.send("#{params[:target_action]}") rescue nil
|
begin
|
||||||
|
data = controller.send("#{params[:target_action]}")# rescue nil
|
||||||
|
rescue Exception => e
|
||||||
|
write_debug_file(e,params[:target_controller],params[:target_action]) if Site::DEBUG
|
||||||
|
end
|
||||||
if data.nil?
|
if data.nil?
|
||||||
return "<div class='well'> No content to show. </div>".html_safe
|
return "<div class='well'> No content to show. </div>".html_safe
|
||||||
end
|
end
|
||||||
|
@ -500,4 +508,48 @@ module ApplicationHelper
|
||||||
target
|
target
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def write_debug_file(e,controller_name,action_name)
|
||||||
|
url_dir_name = request.fullpath.split("?")[0]
|
||||||
|
url_dir_name = URI.decode(url_dir_name)
|
||||||
|
url_dir_name = (url_dir_name == "/" ? "home" : url_dir_name.sub("/","").gsub("/","_").gsub("-","_").gsub(" ","_"))
|
||||||
|
directory_name = "tmp/debug/#{url_dir_name}"
|
||||||
|
FileUtils.mkdir_p(directory_name) unless File.exists?(directory_name)
|
||||||
|
fn = "#{directory_name}/#{controller_name}_#{action_name}.html"
|
||||||
|
error_trace_spans = ""
|
||||||
|
e.backtrace.each do |bt|
|
||||||
|
error_trace_spans = error_trace_spans + "<span>#{bt}</span><br />"
|
||||||
|
end
|
||||||
|
con = "#{controller_name.capitalize}_controller".classify.constantize
|
||||||
|
File.open(fn, "w"){ |file|
|
||||||
|
file.puts "<html>
|
||||||
|
<head>
|
||||||
|
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
|
||||||
|
<meta charset=UTF-8'>
|
||||||
|
<title>Debug result</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h3>Error Message</h3>
|
||||||
|
<div class='error-message'>
|
||||||
|
<h2><i>#{e.message}</i></h2>
|
||||||
|
</div>
|
||||||
|
<h3>Request Details</h3>
|
||||||
|
<div class='request-details'>
|
||||||
|
<span>Url : <b>#{URI.decode(request.url)}</b></span><br />
|
||||||
|
<span>Controller : <b>#{con.to_s}</b> </span><br />
|
||||||
|
<span>Action : <b>#{action_name.capitalize}</b> </span>
|
||||||
|
</div>
|
||||||
|
<h3>Error Trace</h3>
|
||||||
|
<div class='error-trace'>
|
||||||
|
#{error_trace_spans}
|
||||||
|
</div>
|
||||||
|
<h3>Params</h3>
|
||||||
|
<div class='params'>
|
||||||
|
#{OrbitHelper.params}
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>"
|
||||||
|
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -71,7 +71,11 @@ module PagesHelper
|
||||||
wrap_elements = doc.css("*[data-repeat]")
|
wrap_elements = doc.css("*[data-repeat]")
|
||||||
controller = "#{controller_name.capitalize.pluralize}_controller".classify.constantize.new
|
controller = "#{controller_name.capitalize.pluralize}_controller".classify.constantize.new
|
||||||
OrbitHelper.set_current_widget_module controller_name
|
OrbitHelper.set_current_widget_module controller_name
|
||||||
data = controller.send("#{widget_method}") rescue nil
|
begin
|
||||||
|
data = controller.send("#{widget_method}") #rescue nil
|
||||||
|
rescue Exception => e
|
||||||
|
write_widget_debug_file(e,controller_name,widget_method,subpart_id)
|
||||||
|
end
|
||||||
if !data.nil?
|
if !data.nil?
|
||||||
wrap_elements = doc.css("*[data-list][data-level='0']")
|
wrap_elements = doc.css("*[data-list][data-level='0']")
|
||||||
htmls = widget_parsing_repeats_again(wrap_elements,data,1)
|
htmls = widget_parsing_repeats_again(wrap_elements,data,1)
|
||||||
|
@ -91,5 +95,50 @@ module PagesHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def write_widget_debug_file(e,controller_name,action_name,sub_part)
|
||||||
|
url_dir_name = request.fullpath.split("?")[0]
|
||||||
|
url_dir_name = URI.decode(url_dir_name)
|
||||||
|
url_dir_name = (url_dir_name == "/" ? "home" : url_dir_name.sub("/","").gsub("/","_").gsub("-","_").gsub(" ","_"))
|
||||||
|
directory_name = "tmp/debug/#{url_dir_name}"
|
||||||
|
FileUtils.mkdir_p(directory_name) unless File.exists?(directory_name)
|
||||||
|
fn = "#{directory_name}/#{controller_name}_#{action_name}_#{(sub_part if !sub_part.nil?)}.html"
|
||||||
|
error_trace_spans = ""
|
||||||
|
e.backtrace.each do |bt|
|
||||||
|
error_trace_spans = error_trace_spans + "<span>#{bt}</span><br />"
|
||||||
|
end
|
||||||
|
con = "#{controller_name.capitalize.pluralize}_controller".classify.constantize
|
||||||
|
File.open(fn, "w"){ |file|
|
||||||
|
file.puts "<html>
|
||||||
|
<head>
|
||||||
|
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
|
||||||
|
<meta charset=UTF-8'>
|
||||||
|
<title>Debug result</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h3>Error Message</h3>
|
||||||
|
<div class='error-message'>
|
||||||
|
<h2><i>#{e.message}</i></h2>
|
||||||
|
</div>
|
||||||
|
<h3>Request Details</h3>
|
||||||
|
<div class='request-details'>
|
||||||
|
<span>Url : <b>#{URI.decode(request.url)}</b></span><br />
|
||||||
|
<span>Controller : <b>#{con.to_s}</b></span><br />
|
||||||
|
<span>Action : <b>#{action_name.capitalize}</b></span><br />
|
||||||
|
<span>SubPart Id : <b>#{sub_part}</b></span>
|
||||||
|
</div>
|
||||||
|
<h3>Error Trace</h3>
|
||||||
|
<div class='error-trace'>
|
||||||
|
#{error_trace_spans}
|
||||||
|
</div>
|
||||||
|
<h3>Params</h3>
|
||||||
|
<div class='params'>
|
||||||
|
#{OrbitHelper.params}
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>"
|
||||||
|
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,8 @@ class Page
|
||||||
|
|
||||||
before_create :assign_page_number
|
before_create :assign_page_number
|
||||||
|
|
||||||
after_save :clear_cache
|
# after_save :clear_cache
|
||||||
after_destroy :clear_cache
|
# after_destroy :clear_cache
|
||||||
|
|
||||||
def clear_cache
|
def clear_cache
|
||||||
I18n.available_locales.each do |locale|
|
I18n.available_locales.each do |locale|
|
||||||
|
|
|
@ -3,6 +3,8 @@ class Site
|
||||||
include Mongoid::Timestamps
|
include Mongoid::Timestamps
|
||||||
include Slug
|
include Slug
|
||||||
|
|
||||||
|
DEBUG = false
|
||||||
|
|
||||||
field :title, as: :slug_title, type: String, localize: true
|
field :title, as: :slug_title, type: String, localize: true
|
||||||
field :school, type: String
|
field :school, type: String
|
||||||
field :department, type: String
|
field :department, type: String
|
||||||
|
|
|
@ -17,8 +17,8 @@ class SubPart
|
||||||
belongs_to :page_part
|
belongs_to :page_part
|
||||||
belongs_to :mobile_page_part
|
belongs_to :mobile_page_part
|
||||||
|
|
||||||
after_save :clear_cache
|
# after_save :clear_cache
|
||||||
after_destroy :clear_cache
|
# after_destroy :clear_cache
|
||||||
|
|
||||||
def clear_cache
|
def clear_cache
|
||||||
Rails.cache.delete_matched( /#{self.id.to_s}/ )
|
Rails.cache.delete_matched( /#{self.id.to_s}/ )
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
<tr>
|
||||||
|
<td class="detail-row">
|
||||||
|
<span class="mt_title"><%= installed_module["name"] %></span>
|
||||||
|
</td>
|
||||||
|
<td class="active">
|
||||||
|
<% if installed_module["update_available"] %>
|
||||||
|
<a href="" class="update_module btn btn-primary" data-module-key="<%= installed_module["key"] %>" data-module-type="<%= installed_module["type"] %>">Update</button>
|
||||||
|
<% else %>
|
||||||
|
Up to Date
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
|
@ -0,0 +1,47 @@
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr class="sort-header">
|
||||||
|
<th class="">Title</th>
|
||||||
|
<th class="">Update <%= (@extensions_to_update_count == 1 ? "(#{@extensions_to_update_count} update available)" : (@extensions_to_update_count > 1 ? "(#{@extensions_to_update_count} updates available)" : "")) %>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody class="sort-holder" id="tbody_designs">
|
||||||
|
<%= render :partial => "installed_module", :collection => @built_in_extensions %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$("a.update_module").on("click",function(){
|
||||||
|
if(!$(this).hasClass("disabled")){
|
||||||
|
$(this).text("Updating").addClass("disabled");
|
||||||
|
var key = $(this).data("module-key"),
|
||||||
|
type = $(this).data("module-type")
|
||||||
|
$.ajax({
|
||||||
|
url : "/admin/module_store/update_module",
|
||||||
|
data : {"key" : key, "type" : type},
|
||||||
|
dataType : "json",
|
||||||
|
type : "post"
|
||||||
|
}).always(function(obj){
|
||||||
|
if(obj.status == 200){
|
||||||
|
update_module_table.html(obj.responseText);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
})
|
||||||
|
|
||||||
|
$("a#update_all_modules").on("click",function(){
|
||||||
|
if(!$(this).hasClass("disabled")){
|
||||||
|
$(this).text("Updating").addClass("disabled");
|
||||||
|
$.ajax({
|
||||||
|
url : "/admin/module_store/restart",
|
||||||
|
type : "post"
|
||||||
|
}).always(function(obj){
|
||||||
|
if(obj.status == 200){
|
||||||
|
update_module_table.html(obj.responseText);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
})
|
||||||
|
</script>
|
|
@ -9,6 +9,15 @@
|
||||||
<%= javascript_include_tag 'lib/footable-0.1' %>
|
<%= javascript_include_tag 'lib/footable-0.1' %>
|
||||||
<%= javascript_include_tag 'lib/all-list' %>
|
<%= javascript_include_tag 'lib/all-list' %>
|
||||||
<%= javascript_include_tag 'lib/retina' %>
|
<%= javascript_include_tag 'lib/retina' %>
|
||||||
|
<style type="text/css">
|
||||||
|
.loading-image-wrapper {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.loading-image-wrapper > span {
|
||||||
|
display: block;
|
||||||
|
padding: 20px 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<%= flash[:notice] rescue nil%>
|
<%= flash[:notice] rescue nil%>
|
||||||
|
@ -39,7 +48,7 @@
|
||||||
<ul>
|
<ul>
|
||||||
<li class="active">
|
<li class="active">
|
||||||
<a href="#installed_modules" data-toggle="tab">
|
<a href="#installed_modules" data-toggle="tab">
|
||||||
<i class="icons-download"></i><%= t(:installed_modules) %>
|
<i class="icon-cloud-download"></i> <%= t(:installed_modules) %>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
@ -47,6 +56,11 @@
|
||||||
<i class="icon-shopping-cart"></i><%= t(:module_store) %>
|
<i class="icon-shopping-cart"></i><%= t(:module_store) %>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="#update_module" data-toggle="tab">
|
||||||
|
<i class="icon-download-alt"></i> <%= t(:update_modules) %>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="pannel-body tab-content">
|
<div class="pannel-body tab-content">
|
||||||
|
@ -57,6 +71,12 @@
|
||||||
<div class="tab-pane fade" id="module_store">
|
<div class="tab-pane fade" id="module_store">
|
||||||
<%= render :partial => "admin/store/store", :locals => {:section => "apps"} %>
|
<%= render :partial => "admin/store/store", :locals => {:section => "apps"} %>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="tab-pane fade" id="update_module">
|
||||||
|
<div class="loading-image-wrapper">
|
||||||
|
<img src="/assets/preloader.gif" />
|
||||||
|
<span>Fetching module update info.</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-backdrop"></div>
|
<div class="modal-backdrop"></div>
|
||||||
|
@ -129,11 +149,6 @@
|
||||||
$("#module_msg_title").html("<%= t(:change_applied) %>");
|
$("#module_msg_title").html("<%= t(:change_applied) %>");
|
||||||
$("#module_msg_content").html("<%= t("update_manager_.restart_server") %>");
|
$("#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();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -153,14 +168,26 @@
|
||||||
|
|
||||||
$("#module_msg_title").html("<%= t(:change_applied) %>");
|
$("#module_msg_title").html("<%= t(:change_applied) %>");
|
||||||
$("#module_msg_content").html("<%= t("update_manager_.restart_server") %>");
|
$("#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();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var update_module_table = $("#update_module");
|
||||||
|
|
||||||
|
$('a[data-toggle="tab"]').on('shown', function (e) {
|
||||||
|
var el = $(e.target),
|
||||||
|
prev_el = $(e.relatedTarget);
|
||||||
|
if(el.attr("href") == "#update_module"){
|
||||||
|
$.ajax({
|
||||||
|
url : "/admin/module_store/modules_to_update",
|
||||||
|
type : "get",
|
||||||
|
dataType : "html"
|
||||||
|
}).done(function(data){
|
||||||
|
update_module_table.html(data);
|
||||||
|
})
|
||||||
|
}else if(prev_el.attr("href") == "#update_module"){
|
||||||
|
update_module_table.html('<div class="loading-image-wrapper"><img src="/assets/preloader.gif" /><span>Fetching module update info.</span></div>');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -126,8 +126,6 @@
|
||||||
<div style="height: 55px;">
|
<div style="height: 55px;">
|
||||||
<% if @store_permissions["permission_granted"] %>
|
<% if @store_permissions["permission_granted"] %>
|
||||||
<button id="update_btn" class="btn btn-primary pull-right" style="margin: 10px;"><i class="icon-inbox icon-white"></i> <%= t("update_manager_.system_update") %></button>
|
<button id="update_btn" class="btn btn-primary pull-right" style="margin: 10px;"><i class="icon-inbox icon-white"></i> <%= t("update_manager_.system_update") %></button>
|
||||||
|
|
||||||
<button id="module_update_btn" class="btn btn-primary pull-right" style="margin-right: 10px;"><i class="icon-inbox icon-white"></i> <%= t("update_manager_.module_update") %></button>
|
|
||||||
<% else %>
|
<% else %>
|
||||||
<a href="/<%= I18n.locale.to_s %>/admin/designs" class="pull-right">Please register here.</a>
|
<a href="/<%= I18n.locale.to_s %>/admin/designs" class="pull-right">Please register here.</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -173,9 +171,6 @@
|
||||||
</div>
|
</div>
|
||||||
<div style="padding: 10px 0; height: 65px;">
|
<div style="padding: 10px 0; height: 65px;">
|
||||||
<button id="chech_update_btn" class="btn btn-small btn-inverse pull-right"><i class="icon-refresh icon-white"></i> <%= t("update_manager_.check_update") %></button>
|
<button id="chech_update_btn" class="btn btn-small btn-inverse pull-right"><i class="icon-refresh icon-white"></i> <%= t("update_manager_.check_update") %></button>
|
||||||
<% if @store_permissions["permission_granted"] %>
|
|
||||||
<button id="module_update_btn" class="btn btn-primary btn-small pull-right" style="margin-right: 10px;"><i class="icon-inbox icon-white"></i> <%= t("update_manager_.module_update") %></button>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -269,7 +264,7 @@
|
||||||
check_updates();
|
check_updates();
|
||||||
get_update_history();
|
get_update_history();
|
||||||
|
|
||||||
$("#module_update_btn").click(check_module_updates);
|
// $("#module_update_btn").click(check_module_updates);
|
||||||
|
|
||||||
$("#chech_update_btn").click(check_updates);
|
$("#chech_update_btn").click(check_updates);
|
||||||
|
|
||||||
|
|
|
@ -236,10 +236,12 @@ Orbit::Application.routes.draw do
|
||||||
get 'design_list' => 'designs#design_list'
|
get 'design_list' => 'designs#design_list'
|
||||||
get 'module_store' => 'module_store#index'
|
get 'module_store' => 'module_store#index'
|
||||||
get 'module_store/show' => 'module_store#show'
|
get 'module_store/show' => 'module_store#show'
|
||||||
|
post 'module_store/update_module' => 'module_store#update_module'
|
||||||
get 'module_store/download' => 'module_store#download'
|
get 'module_store/download' => 'module_store#download'
|
||||||
get 'module_store/remove_module' => 'module_store#remove_module'
|
get 'module_store/remove_module' => 'module_store#remove_module'
|
||||||
get 'module_store/toggle_module' => 'module_store#toggle_module'
|
get 'module_store/toggle_module' => 'module_store#toggle_module'
|
||||||
get 'module_store/restart_server' => 'module_store#restart_server'
|
post 'module_store/restart' => 'module_store#restart'
|
||||||
|
get 'module_store/modules_to_update' => 'module_store#modules_to_update'
|
||||||
|
|
||||||
#store routes
|
#store routes
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue