fix for non registered site and module update button

This commit is contained in:
Harry Bomrah 2014-12-31 15:27:18 +08:00
parent 487d84c1d1
commit 343294858e
3 changed files with 17 additions and 6 deletions

View File

@ -119,6 +119,7 @@ class Admin::SitesController < OrbitAdminController
def bundle_install def 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=built_in_extensions.rb bundle update && bundle` }
Bundler.with_clean_env { `cd #{Rails.root} && BUNDLE_GEMFILE=downloaded_extensions.rb bundle update && bundle` }
%x(kill -s USR2 `cat tmp/pids/unicorn.pid`) %x(kill -s USR2 `cat tmp/pids/unicorn.pid`)
sleep 5 sleep 5
render :nothing => true render :nothing => true

View File

@ -127,7 +127,7 @@
<% 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: 10px;"><i class="icon-inbox icon-white"></i> <%= t("update_manager_.module_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,6 +173,9 @@
</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>

View File

@ -41,12 +41,19 @@ module OrbitApp
if !response.nil? if !response.nil?
data = JSON.parse(response.body) data = JSON.parse(response.body)
if response.code == "200" if response.code == "200"
if data["success"]
permissions = data["permissions"] permissions = data["permissions"]
permissions.each do |permission| permissions.each do |permission|
ma = module_index[permission["app"]] ma = module_index[permission["app"]]
ma.store_permission_granted = (exceptions.include?(ma.key) ? true : permission["granted"]) ma.store_permission_granted = (exceptions.include?(ma.key) ? true : permission["granted"])
ma.save ma.save
end end
else
module_apps.each do |ma|
ma.store_permission_granted = (exceptions.include?(ma.key) ? true : false)
ma.save
end
end
end end
else else
module_apps.each do |ma| module_apps.each do |ma|