fix some errors
This commit is contained in:
parent
f200ef507c
commit
df79763000
|
@ -1,4 +1,5 @@
|
|||
class Admin::OfficialModuleController < OrbitAdminController
|
||||
layout "structure"
|
||||
|
||||
def set_master_key
|
||||
@master_password = MasterPassword.first rescue 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'
|
||||
|
||||
|
||||
locales = Site.first.in_use_locales rescue I18n.available_locales
|
||||
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
|
||||
namespace :admin do
|
||||
resources :sites, only: [] do
|
||||
get "set_master_key" => 'official_module#set_master_key'
|
||||
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',
|
||||
|
|
|
@ -2,7 +2,21 @@ $:.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"
|
||||
|
|
|
@ -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