diff --git a/app/assets/javascripts/validator.js b/app/assets/javascripts/validator.js index 89c653a..435d4d7 100644 --- a/app/assets/javascripts/validator.js +++ b/app/assets/javascripts/validator.js @@ -28,7 +28,7 @@ var FormValidator = function(form){ lowercase : function(value){ return (value == value.toLowerCase() ? true : false); }, - email : function(){ + email : function(value){ var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(value); } diff --git a/app/assets/stylesheets/lib/orbit_bar/orbit-bar.scss.erb b/app/assets/stylesheets/lib/orbit_bar/orbit-bar.scss.erb index 384cbd5..d3c4639 100644 --- a/app/assets/stylesheets/lib/orbit_bar/orbit-bar.scss.erb +++ b/app/assets/stylesheets/lib/orbit_bar/orbit-bar.scss.erb @@ -334,7 +334,7 @@ $orbit-bar-bgc-lighter: lighten($orbit-bar-bgc, 20%) !default; display: none; top: 0; margin: 0 2em; - padding: 0.3em 0; + padding: 0; color: #FFF; font-size: 1.4em; text-align: center; @@ -344,6 +344,9 @@ $orbit-bar-bgc-lighter: lighten($orbit-bar-bgc, 20%) !default; a { color: #FFF; } + .page-main & { + padding: 0.3em 0; + } } .orbit-bar-search-sign-language { float: right; @@ -355,6 +358,7 @@ $orbit-bar-bgc-lighter: lighten($orbit-bar-bgc, 20%) !default; input[type="search"] { color: $orbit-bar-bgc-lighter; border: none; + margin-bottom: 0; border-radius: 1.7em; line-height: 1.3em; padding: 0.2em 0.8em; diff --git a/app/controllers/admin/module_store_controller.rb b/app/controllers/admin/module_store_controller.rb index c6ac85f..7385bbd 100644 --- a/app/controllers/admin/module_store_controller.rb +++ b/app/controllers/admin/module_store_controller.rb @@ -3,7 +3,7 @@ class Admin::ModuleStoreController < OrbitAdminController def index @extensions = [] - @downloaded_extensions = get_downloaded_extension + @downloaded_extensions = [] # if current_site.site_token? # if current_site.store_confirmation # @extensions = get_extensions diff --git a/app/controllers/store_api_controller.rb b/app/controllers/store_api_controller.rb index b526e54..a5c5d81 100644 --- a/app/controllers/store_api_controller.rb +++ b/app/controllers/store_api_controller.rb @@ -16,14 +16,31 @@ class StoreApiController < ApplicationController end def install_module - file = File.join(Rails.root,"downloaded_extensions.rb") - g = "gem '#{params[:module_key]}', git: '#{params[:git_path]}'" - File.open(file,"a+") { |f| f.puts(g) } - if !directory_exists?(File.join(Rails.root,"app","templates","#{Site.first.template}","modules","#{params[:module_key]}")) - download_template(params[:template],params[:template_filename]) + if current_site.store_token.nil? + response = {"success" => false} + elsif current_site.store_token == params[:site_token] + file = File.join(Rails.root,"downloaded_extensions.rb") + g = "gem '#{params[:module_key]}', git: '#{params[:git_path]}'" + File.open(file,"a+") { |f| f.puts(g) } + if !directory_exists?(File.join(Rails.root,"app","templates","#{Site.first.template}","modules","#{params[:module_key]}")) + download_template(params[:template],params[:template_filename]) + end + response = {"success" => true} + else + response = {"success" => false} end + render :json => response.to_json + bundle_install if response["success"] + end + + def uninstall_module + file = File.join(Rails.root,"downloaded_extensions.rb") + data = File.read(file) + g = "gem '#{params[:module_key]}', git: '#{params[:git_path]}'\n" + data = data.gsub(g,"") + File.write(file,data) bundle_install - render :json => {"success" => true} .to_json + render :json => {"success" => true}.to_json end private @@ -58,5 +75,6 @@ class StoreApiController < ApplicationController zip_file.extract(f, f_path) unless File.exist?(f_path) } } + FileUtils.rm_rf(File.join(Rails.root,"public","template_cache")) end end \ No newline at end of file diff --git a/app/helpers/orbit_helper.rb b/app/helpers/orbit_helper.rb index cd133a6..c23e2d6 100644 --- a/app/helpers/orbit_helper.rb +++ b/app/helpers/orbit_helper.rb @@ -136,11 +136,11 @@ module OrbitHelper end def self.set_widget_tags(tags) - @tags = tags; + @widget_tags = tags; end def self.widget_tags - @tags + @widget_tags end def self.user_can_edit?(obj) diff --git a/config/routes.rb b/config/routes.rb index 2da0372..8d95df9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -28,6 +28,7 @@ Orbit::Application.routes.draw do get "/module/:name/show" => "home#show" post "/store/confirmation" => "store_api#confirmation" post "/store/install_module" => "store_api#install_module" + post "/store/uninstall_module" => "store_api#uninstall_module" # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes".