fix some errors
This commit is contained in:
parent
f200ef507c
commit
df79763000
|
@ -1,5 +1,6 @@
|
||||||
class Admin::OfficialModuleController < OrbitAdminController
|
class Admin::OfficialModuleController < OrbitAdminController
|
||||||
|
layout "structure"
|
||||||
|
|
||||||
def set_master_key
|
def set_master_key
|
||||||
@master_password = MasterPassword.first rescue nil
|
@master_password = MasterPassword.first rescue nil
|
||||||
if @master_password.nil?
|
if @master_password.nil?
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
module OfficialModule
|
|
||||||
class ApplicationController < ActionController::Base
|
|
||||||
protect_from_forgery with: :exception
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -7,11 +7,13 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
get "/store/form_token" => 'client_sites#get_csrf_token'
|
get "/store/form_token" => 'client_sites#get_csrf_token'
|
||||||
|
|
||||||
|
locales = Site.first.in_use_locales rescue I18n.available_locales
|
||||||
namespace :admin do
|
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
|
||||||
resources :sites, only: [] do
|
namespace :admin do
|
||||||
get "set_master_key" => 'official_module#set_master_key'
|
scope "sites/:id", :controller => 'official_module' do
|
||||||
patch "update_master_password" => 'official_module#update_master_password'
|
get "set_master_key" => 'official_module#set_master_key', as: :site_set_master_key
|
||||||
|
patch "update_master_password" => 'official_module#update_master_password'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,6 @@ module OfficialModule
|
||||||
class Engine < ::Rails::Engine
|
class Engine < ::Rails::Engine
|
||||||
initializer "official_module" do
|
initializer "official_module" do
|
||||||
OrbitApp.registration "OfficialModule", :type => "ModuleApp" do
|
OrbitApp.registration "OfficialModule", :type => "ModuleApp" do
|
||||||
module_label "official_module.official_module"
|
|
||||||
base_url File.expand_path File.dirname(__FILE__)
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
set_keyword_contstraints ['/store/check_module_permissions',
|
set_keyword_contstraints ['/store/check_module_permissions',
|
||||||
'/store/register_old_sites_modules',
|
'/store/register_old_sites_modules',
|
||||||
|
|
|
@ -1,23 +1,37 @@
|
||||||
$:.push File.expand_path("../lib", __FILE__)
|
$:.push File.expand_path("../lib", __FILE__)
|
||||||
|
|
||||||
# Maintain your gem's version:
|
# Maintain your gem's version:
|
||||||
require "official_module/version"
|
require "official_module/version"
|
||||||
|
bundle_update_flag = ARGV[0]=='update' || ARGV[0]=='install'
|
||||||
# Describe your gem and declare its dependencies:
|
if bundle_update_flag
|
||||||
Gem::Specification.new do |s|
|
app_path = File.expand_path(__dir__)
|
||||||
s.name = "official_module"
|
#Add official module to Admin area
|
||||||
s.version = OfficialModule::VERSION
|
official_module_li = File.read(app_path+"/official_module_li.erb")
|
||||||
s.authors = ["Harry Bomrah"]
|
file_text = File.read(ENV['PWD']+'/app/views/shared/_side_bar.html.erb')
|
||||||
s.email = ["harry@rulingcom.com"]
|
if !file_text.include?('master_key')
|
||||||
s.homepage = "http://www.rulingcom.com"
|
insert_index = file_text.index('<li title="<%= t(\'search_engine\') %>">')
|
||||||
s.summary = "Summary of OfficialModule."
|
file_text.insert(insert_index , official_module_li)
|
||||||
s.description = "Description of OfficialModule."
|
end
|
||||||
s.license = "MIT"
|
f = File.open(ENV['PWD']+'/app/views/shared/_side_bar.html.erb','w')
|
||||||
|
f.write(file_text)
|
||||||
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
|
f.close
|
||||||
s.test_files = Dir["test/**/*"]
|
puts "finish change official module in #{ENV['PWD']}/app/views/shared"
|
||||||
|
end
|
||||||
s.add_dependency "rails", "~> 4.1.16"
|
# Describe your gem and declare its dependencies:
|
||||||
|
Gem::Specification.new do |s|
|
||||||
s.add_development_dependency "sqlite3"
|
s.name = "official_module"
|
||||||
end
|
s.version = OfficialModule::VERSION
|
||||||
|
s.authors = ["Harry Bomrah"]
|
||||||
|
s.email = ["harry@rulingcom.com"]
|
||||||
|
s.homepage = "http://www.rulingcom.com"
|
||||||
|
s.summary = "Summary of OfficialModule."
|
||||||
|
s.description = "Description of OfficialModule."
|
||||||
|
s.license = "MIT"
|
||||||
|
|
||||||
|
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
|
||||||
|
s.test_files = Dir["test/**/*"]
|
||||||
|
|
||||||
|
s.add_dependency "rails", "~> 4.1.16"
|
||||||
|
|
||||||
|
s.add_development_dependency "sqlite3"
|
||||||
|
end
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
<li title="<%= t('master_key') %>"><%= link_to admin_site_set_master_key_path(current_site), :class => active_for_action('sites', 'preference') do %><span><i class="icons-key "></i></span><%end%></li>
|
Loading…
Reference in New Issue