fix some errors
This commit is contained in:
parent
f200ef507c
commit
df79763000
|
@ -1,5 +1,6 @@
|
|||
class Admin::OfficialModuleController < OrbitAdminController
|
||||
|
||||
layout "structure"
|
||||
|
||||
def set_master_key
|
||||
@master_password = MasterPassword.first rescue 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'
|
||||
|
||||
|
||||
namespace :admin do
|
||||
resources :sites, only: [] do
|
||||
get "set_master_key" => 'official_module#set_master_key'
|
||||
patch "update_master_password" => 'official_module#update_master_password'
|
||||
locales = Site.first.in_use_locales rescue I18n.available_locales
|
||||
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
|
||||
namespace :admin do
|
||||
scope "sites/:id", :controller => 'official_module' do
|
||||
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
|
||||
|
|
|
@ -2,7 +2,6 @@ module OfficialModule
|
|||
class Engine < ::Rails::Engine
|
||||
initializer "official_module" do
|
||||
OrbitApp.registration "OfficialModule", :type => "ModuleApp" do
|
||||
module_label "official_module.official_module"
|
||||
base_url File.expand_path File.dirname(__FILE__)
|
||||
set_keyword_contstraints ['/store/check_module_permissions',
|
||||
'/store/register_old_sites_modules',
|
||||
|
|
|
@ -1,23 +1,37 @@
|
|||
$:.push File.expand_path("../lib", __FILE__)
|
||||
|
||||
# Maintain your gem's version:
|
||||
require "official_module/version"
|
||||
|
||||
# Describe your gem and declare its dependencies:
|
||||
Gem::Specification.new do |s|
|
||||
s.name = "official_module"
|
||||
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
|
||||
$:.push File.expand_path("../lib", __FILE__)
|
||||
|
||||
# Maintain your gem's version:
|
||||
require "official_module/version"
|
||||
bundle_update_flag = ARGV[0]=='update' || ARGV[0]=='install'
|
||||
if bundle_update_flag
|
||||
app_path = File.expand_path(__dir__)
|
||||
#Add official module to Admin area
|
||||
official_module_li = File.read(app_path+"/official_module_li.erb")
|
||||
file_text = File.read(ENV['PWD']+'/app/views/shared/_side_bar.html.erb')
|
||||
if !file_text.include?('master_key')
|
||||
insert_index = file_text.index('<li title="<%= t(\'search_engine\') %>">')
|
||||
file_text.insert(insert_index , official_module_li)
|
||||
end
|
||||
f = File.open(ENV['PWD']+'/app/views/shared/_side_bar.html.erb','w')
|
||||
f.write(file_text)
|
||||
f.close
|
||||
puts "finish change official module in #{ENV['PWD']}/app/views/shared"
|
||||
end
|
||||
# Describe your gem and declare its dependencies:
|
||||
Gem::Specification.new do |s|
|
||||
s.name = "official_module"
|
||||
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