Downloaded Modules now use tags. mobile/app always active

This commit is contained in:
Saurabh Bhatia 2014-03-14 10:10:05 +08:00
parent af1676c69f
commit 941833e4d2
2 changed files with 14 additions and 5 deletions

View File

@ -26,11 +26,11 @@ class Admin::ModuleStoreController < OrbitBackendController
extension = get_extension(params[:id]) rescue nil
extension_name = extension["key"].to_s
git_repository_url = extension["git_url"]
version = extension["version"]
tag = extension["tag"]
module_installed = File.read("downloaded_extensions.rb").include?(extension["key"])
if module_installed.eql?(false)
@download_link = "gem '#{extension_name}', '#{version}', :git => '#{git_repository_url}'"
@download_link = "gem '#{extension_name}', :git => '#{git_repository_url}', :tag => '#{tag}'"
File.open("downloaded_extensions.rb", 'a') do |file|
file.puts @download_link
end
@ -107,8 +107,8 @@ class Admin::ModuleStoreController < OrbitBackendController
if !extensions.select{|ext| ext['key']==exist_ext[0].split(/[\'\"]/)[1]}.blank?
extensions.select{|ext| ext['key']==exist_ext[0].split(/[\'\"]/)[1]}[0]['installed']=true
extensions.select{|ext| ext['key']==exist_ext[0].split(/[\'\"]/)[1]}[0]['enabled']=status
extensions.select{|ext| ext['key']==exist_ext[0].split(/[\'\"]/)[1]}[0]['installed_version']=exist_ext[1].split(/[\'\"]/)[1]
if extensions.select{|ext| ext['key']==exist_ext[0].split(/[\'\"]/)[1]}[0]['version'] != exist_ext[1].split(/[\'\"]/)[1]
extensions.select{|ext| ext['key']==exist_ext[0].split(/[\'\"]/)[1]}[0]['installed_version']=exist_ext[2].split(/[\'\"]/)[1]
if extensions.select{|ext| ext['key']==exist_ext[0].split(/[\'\"]/)[1]}[0]['tag'] != exist_ext[2].split(/[\'\"]/)[1]
extensions.select{|ext| ext['key']==exist_ext[0].split(/[\'\"]/)[1]}[0]['updated'] = false
else
extensions.select{|ext| ext['key']==exist_ext[0].split(/[\'\"]/)[1]}[0]['updated'] = true
@ -134,7 +134,7 @@ class Admin::ModuleStoreController < OrbitBackendController
status = !extension.start_with?("# ")
extension = extension.split(',')
downloaded_extensions << {'name' => extension[0].split(/[\'\"]/)[1], 'version' => extension[1].split(/[\'\"]/)[1], 'repo' => extension[2].split(/[\'\"]/)[1], 'status' => status}
downloaded_extensions << {'name' => extension[0].split(/[\'\"]/)[1], 'repo' => extension[1].split(/[\'\"]/)[1], 'tag' => extension[2].split(/[\'\"]/)[1], 'status' => status}
end
extensions.close

View File

@ -476,6 +476,15 @@ class ApplicationController < ActionController::Base
session[:mobile_param]
end
request.format = :mobile if mobile_device?
else
session[:mobile_param] = if request.path =~ /app/
'1'
elsif params[:mobile]
params[:mobile]
else
session[:mobile_param]
end
request.format = :mobile if mobile_device?
end
end