Added function to see if the module is installed or not
This commit is contained in:
parent
2931676ecf
commit
37e58cd780
|
@ -18,7 +18,8 @@ class Admin::ModuleStoreController < OrbitBackendController
|
|||
module_app_name = downloaded_file_name.split(/(.zip)/).first
|
||||
|
||||
#check if the directory exists or not
|
||||
if Dir.exists?("#{Rails.root}/vendor/built_in_modules/#{module_app_name}")
|
||||
@module_status = Dir.exists?("#{Rails.root}/vendor/built_in_modules/#{module_app_name}")
|
||||
if @module_status.eql?(true)
|
||||
flash[:notice] = "This module is already installed"
|
||||
else
|
||||
download_extension(download_link, downloaded_file_name,module_app_name)
|
||||
|
@ -42,8 +43,6 @@ class Admin::ModuleStoreController < OrbitBackendController
|
|||
puts %x(unzip "#{downloaded_file_name}")
|
||||
puts %x(mv #{module_app_name} "#{Rails.root}/vendor/built_in_modules/")
|
||||
puts %x(rm "#{downloaded_file_name}")
|
||||
|
||||
Rails.logger.info"@@@@@@@@"+Dir.exists?("#{Rails.root}/vendor/built_in_modules/location").inspect
|
||||
site_restart
|
||||
end
|
||||
end
|
|
@ -45,7 +45,17 @@
|
|||
<%= extension["description"].html_safe%> <%= link_to 'Read More', admin_module_store_show_path(extension["_slugs"][0]) %>
|
||||
</td>
|
||||
<!-- <td class="active"><button class="act btn btn-mini" type="button">Uninstall</button></td>
|
||||
--> <td class="active"><%= link_to 'Download', admin_module_store_download_path(:id => extension["_slugs"][0]), :class=>"act btn btn-mini btn-success" %></td>
|
||||
-->
|
||||
<% download_link = STORE_CONFIG[:store_settings]["url"] + "/"+ extension["extension"]["extension"]["url"]
|
||||
downloaded_file_name = extension["extension_filename"]
|
||||
module_app_name = downloaded_file_name.split(/(.zip)/).first
|
||||
@module_status = Dir.exists?("#{Rails.root}/vendor/built_in_modules/#{module_app_name}")
|
||||
%>
|
||||
<% if @module_status.eql?(true)%>
|
||||
<td class="active">Installed</td>
|
||||
<% else %>
|
||||
<td class="active"><%= link_to 'Download', admin_module_store_download_path(:id => extension["_slugs"][0]), :class=>"act btn btn-mini btn-success" %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
|
Reference in New Issue