forked from saurabh/orbit4-5
fix update manager
This commit is contained in:
parent
39cb82e83d
commit
a8a092a395
|
@ -41,7 +41,6 @@ class Admin::PersonalPluginIntrosController < OrbitMemberController
|
|||
end
|
||||
|
||||
def edit
|
||||
debugger
|
||||
if !has_access?
|
||||
render_401
|
||||
end
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
class Admin::SitesController < OrbitAdminController
|
||||
before_filter :get_site
|
||||
before_filter :set_git_branch, :only=>[:check_updates, :update_orbit]
|
||||
|
||||
layout "structure"
|
||||
|
||||
def mail_setting
|
||||
|
@ -83,7 +85,7 @@ class Admin::SitesController < OrbitAdminController
|
|||
if (@current_tag.eql?(@latest_tag) == false)
|
||||
%x(git fetch origin)
|
||||
end
|
||||
@new_updates = %x(git log "#{@current_tag}"..."#{@latest_tag}" --pretty=format:"%ad','%s" --date=short).split("\n").map{|log| log.gsub("'","").split(",")}.to_json
|
||||
@new_updates = %x(git log #{@branch}..origin/#{@branch} --pretty=format:"%ad','%s" --date=short).split("\n").map{|log| log.gsub("'","").split(",")}.to_json
|
||||
render :json => @new_updates
|
||||
end
|
||||
|
||||
|
@ -92,7 +94,7 @@ class Admin::SitesController < OrbitAdminController
|
|||
need_stash = %x(git diff).blank?
|
||||
%x(git stash) unless need_stash
|
||||
%x(git fetch origin)
|
||||
pull_result = %x(git pull -r --ff-only 2>&1 origin #{@latest_tag})
|
||||
pull_result = %x(git pull -r --ff-only 2>&1 origin #{@branch})
|
||||
%x(git stash pop) unless need_stash
|
||||
|
||||
if pull_result.include? "fatal: Not possible to fast-forward, aborting."
|
||||
|
@ -113,7 +115,7 @@ class Admin::SitesController < OrbitAdminController
|
|||
|
||||
private
|
||||
def get_site
|
||||
@site = Site.first
|
||||
@site = @current_site.nil? ? Site.first : @current_site
|
||||
end
|
||||
|
||||
def site_params
|
||||
|
@ -142,12 +144,7 @@ class Admin::SitesController < OrbitAdminController
|
|||
end
|
||||
|
||||
|
||||
def git_branch
|
||||
def set_git_branch
|
||||
@branch = %x(git rev-parse --abbrev-ref HEAD).gsub("\n","")
|
||||
end
|
||||
|
||||
def git_tags
|
||||
@current_tag = %x(git describe --tags).gsub("\n","").split("-").first
|
||||
@latest_tag = `git ls-remote --tags origin | awk '{print $2}'`.split(/\n/).last.gsub("refs/tags/","") rescue nil
|
||||
end
|
||||
end
|
||||
|
|
|
@ -51,7 +51,7 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def current_site
|
||||
@current_site = Site.first
|
||||
@current_site = @current_site.nil? ? Site.first : @current_site
|
||||
end
|
||||
|
||||
def frontent_allowed
|
||||
|
@ -102,9 +102,10 @@ class ApplicationController < ActionController::Base
|
|||
log.request_method = request.request_method
|
||||
log.remote_ip = request.remote_ip
|
||||
log.referer = request.referer
|
||||
log.save
|
||||
|
||||
current_user.user_actions << log
|
||||
begin
|
||||
current_user.user_actions << log if log.save
|
||||
rescue
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -120,7 +121,7 @@ class ApplicationController < ActionController::Base
|
|||
private
|
||||
|
||||
def current_user
|
||||
@current_user ||= User.find(session[:user_id]) if session[:user_id] rescue nil
|
||||
@current_user = @current_user.nil? ? (User.find(session[:user_id]) if session[:user_id] rescue nil) : @current_user
|
||||
end
|
||||
|
||||
protected
|
||||
|
|
|
@ -16,7 +16,7 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def render_header
|
||||
site = Site.first
|
||||
site = current_site
|
||||
header_file = File.join('../templates', "#{@key}", "/home/header.html.erb")
|
||||
header_file_html = render :file => header_file
|
||||
header = Nokogiri::HTML(header_file_html, nil, "UTF-8")
|
||||
|
@ -33,7 +33,7 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def render_site_title
|
||||
site = Site.first
|
||||
site = current_site
|
||||
title = site.title rescue ""
|
||||
if site.title_always_on
|
||||
if !params[:slug].nil?
|
||||
|
@ -49,11 +49,11 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def render_google_analytics
|
||||
Site.first.google_analytics.html_safe rescue ""
|
||||
current_site.google_analytics.html_safe rescue ""
|
||||
end
|
||||
|
||||
def render_footer
|
||||
site = Site.first
|
||||
site = current_site
|
||||
footer_file = File.join('../templates', "#{@key}", "/home/footer.html.erb")
|
||||
footer_file_html = render :file => footer_file
|
||||
footer = Nokogiri::HTML(footer_file_html, nil, "UTF-8")
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
<% content_for :side_bar do %>
|
||||
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t('site.settings'), :link_url => admin_site_site_info_path(@site), :icon => 'icons-cog', :side_bar_content => 'admin/sites/side_bar'} %>
|
||||
<% end %>
|
||||
<style type="text/css">
|
||||
.container{
|
||||
}
|
||||
|
@ -185,14 +182,13 @@
|
|||
$("#update_done").fadeOut(function(){
|
||||
$("#update_status").fadeIn(function(){
|
||||
$("#update_progress").fadeIn();
|
||||
$.getJSON("<%= admin_site_check_updates_path %>",function(data){
|
||||
new_updates = data;
|
||||
show_new_updates();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$.getJSON("<%= admin_site_check_updates_path %>",function(data){
|
||||
new_updates = data;
|
||||
show_new_updates();
|
||||
});
|
||||
}
|
||||
|
||||
function show_new_updates(){
|
||||
|
|
Loading…
Reference in New Issue