forked from saurabh/orbit4-5
Merge branch 'master' of gitlab.tp.rulingcom.com:saurabh/orbit4-5 into nccu
This commit is contained in:
commit
ccb9a24861
|
@ -110,13 +110,13 @@ class Admin::ModuleStoreController < OrbitAdminController
|
|||
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"
|
||||
# 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
|
||||
Bundler.with_clean_env { `cd #{Rails.root} && bundle update #{key}` }
|
||||
render :nothing => true
|
||||
%x(kill -s USR2 `cat tmp/pids/unicorn.pid`)
|
||||
sleep 5
|
||||
end
|
||||
|
|
|
@ -106,9 +106,6 @@ class Admin::SitesController < OrbitAdminController
|
|||
else
|
||||
result = "success"
|
||||
# Bundler.with_clean_env { `cd #{Rails.root} && bundle update` }
|
||||
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` }
|
||||
|
||||
end
|
||||
|
||||
render :text => result
|
||||
|
|
|
@ -5,7 +5,7 @@ module Admin::ModuleStoreHelper
|
|||
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))
|
||||
# built_in_extensions.concat(get_extension_from_file("downloaded",extensions_to_update))
|
||||
return built_in_extensions
|
||||
end
|
||||
|
||||
|
@ -28,23 +28,25 @@ module Admin::ModuleStoreHelper
|
|||
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
|
||||
# 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
|
||||
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 = Bundler.with_clean_env { `cd #{Rails.root} && bundle outdated` }
|
||||
buffer = buffer.split("\n")
|
||||
if buffer.last == "Bundle up to date!"
|
||||
return []
|
||||
|
|
|
@ -12,10 +12,12 @@
|
|||
|
||||
<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")
|
||||
var el = $(this);
|
||||
if(!el.hasClass("disabled")){
|
||||
$(".update_module").addClass("disabled");
|
||||
el.text("Updating, please wait...");
|
||||
var key = el.data("module-key"),
|
||||
type = el.data("module-type")
|
||||
$.ajax({
|
||||
url : "/admin/module_store/update_module",
|
||||
data : {"key" : key, "type" : type},
|
||||
|
@ -23,7 +25,8 @@
|
|||
type : "post"
|
||||
}).always(function(obj){
|
||||
if(obj.status == 200){
|
||||
update_module_table.html(obj.responseText);
|
||||
el.text("Updating gem list.");
|
||||
update_module_tables();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -178,6 +178,13 @@ $('a[data-toggle="tab"]').on('shown', function (e) {
|
|||
var el = $(e.target),
|
||||
prev_el = $(e.relatedTarget);
|
||||
if(el.attr("href") == "#update_module"){
|
||||
update_module_tables();
|
||||
}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>');
|
||||
}
|
||||
})
|
||||
|
||||
var update_module_tables = function(){
|
||||
$.ajax({
|
||||
url : "/admin/module_store/modules_to_update",
|
||||
type : "get",
|
||||
|
@ -185,9 +192,6 @@ $('a[data-toggle="tab"]').on('shown', function (e) {
|
|||
}).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>
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
<% if params[:action] == "new" %>
|
||||
<%= f.label :name, content_tag(:i, nil, :class => "icons-star") + t(:page)+' ID' %>
|
||||
<div class="controls">
|
||||
<%= f.text_field :page_id, class:"input-xlarge change", data: {"fv-validation" => "required;nospace;pageid_validation;", "fv-messages" => "Cannot be empty.;Cannot have blank spaces.;Page id is already taken.;"} %>
|
||||
<span class="help-block"><%= t("front_page.name_field_helper") %></span>
|
||||
<%= f.text_field :page_id, class:"input-xlarge change", data: {"fv-validation" => "required;nospace;pageid_validation;detect_chinese;", "fv-messages" => "Cannot be empty.;Cannot have blank spaces.;Page id is already taken.;Page ID cannot be in chinese.;"} %>
|
||||
<span><%= t("front_page.name_field_helper") %></span>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -17,5 +17,11 @@ $(document).ready(function(){
|
|||
fromvalidator.validate_functions.pageid_validation = function(value){
|
||||
return (pageids.indexOf(value) == -1 ? true : false);
|
||||
}
|
||||
|
||||
fromvalidator.validate_functions.detect_chinese = function(value){
|
||||
var re1 = new RegExp("^[\u4E00-\uFA29]*$"),
|
||||
re2 = new RegExp("^[\uE7C7-\uE7F3]*$"); //Chinese character range
|
||||
return (!(re1.test(value) && (! re2.test(value))));
|
||||
}
|
||||
})
|
||||
</script>
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
<li title="<%= t('site_info') %>"><%= link_to admin_site_site_info_path(current_site), :class => active_for_action('sites', 'site_info') do %><span><i class="icons-browser"></i></span><%end%></li>
|
||||
|
||||
<li title="<%= t('mobile_settings') %>"><%= link_to admin_site_responsive_setting_path(current_site), :class => active_for_action('sites', 'responsive_setting') do %><span><i class="icons-mobile"></i></span><%end%></li>
|
||||
<!-- <li title="<%#= t('mobile_settings') %>"><%#= link_to admin_site_responsive_setting_path(current_site), :class => active_for_action('sites', 'responsive_setting') do %><span><i class="icons-mobile"></i></span><%#end%></li> -->
|
||||
|
||||
<li title="<%= t('search_engine') %>"><%= link_to admin_site_search_engine_path(current_site), :class => active_for_action('sites', 'search_engine') do %><span><i class="icons-search"></i></span><%end%></li>
|
||||
|
||||
|
|
Loading…
Reference in New Issue