diff --git a/app/controllers/admin/module_store_controller.rb b/app/controllers/admin/module_store_controller.rb index fbf4ba3..c9313d8 100644 --- a/app/controllers/admin/module_store_controller.rb +++ b/app/controllers/admin/module_store_controller.rb @@ -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 diff --git a/app/helpers/admin/module_store_helper.rb b/app/helpers/admin/module_store_helper.rb index 6f573da..6051a88 100644 --- a/app/helpers/admin/module_store_helper.rb +++ b/app/helpers/admin/module_store_helper.rb @@ -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,15 +28,17 @@ 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) @@ -44,7 +46,7 @@ module Admin::ModuleStoreHelper 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 [] diff --git a/app/views/admin/module_store/_modules_to_update.html.erb b/app/views/admin/module_store/_modules_to_update.html.erb index ab3f372..945cbfb 100644 --- a/app/views/admin/module_store/_modules_to_update.html.erb +++ b/app/views/admin/module_store/_modules_to_update.html.erb @@ -12,10 +12,12 @@ diff --git a/app/views/pages/_form.html.erb b/app/views/pages/_form.html.erb index 014535b..1881d3d 100644 --- a/app/views/pages/_form.html.erb +++ b/app/views/pages/_form.html.erb @@ -5,8 +5,8 @@ <% if params[:action] == "new" %> <%= f.label :name, content_tag(:i, nil, :class => "icons-star") + t(:page)+' ID' %>
- <%= 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.;"} %> - <%= t("front_page.name_field_helper") %> + <%= 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.;"} %> + <%= t("front_page.name_field_helper") %>
<% end %> diff --git a/app/views/pages/new.html.erb b/app/views/pages/new.html.erb index db9a35d..4dab28e 100644 --- a/app/views/pages/new.html.erb +++ b/app/views/pages/new.html.erb @@ -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)))); + } }) \ No newline at end of file