Skip to content

Commit

Permalink
Deal with Ace Editor really really really wanting certain files in ce…
Browse files Browse the repository at this point in the history
…rtain places.
  • Loading branch information
epugh committed Aug 24, 2023
1 parent 7c84fbf commit e1b816f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
8 changes: 8 additions & 0 deletions app/assets/javascripts/mode-json.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 13 additions & 3 deletions app/controllers/pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,20 @@

class PagesController < ApplicationController
skip_before_action :require_login
before_action :check_page
skip_before_action :verify_authenticity_token, only: [ :theme_textmate ]
# before_action :check_page, only: [:show]

def show
render template: "pages/#{params[:page]}"
# def show
# render template: "pages/#{params[:page]}"
# end

# this is how we deal with the ACE editor wanting this specific file.
# There is another mode-json.js file that it wants from /assets/mode-json.js,
# and that we are able to just add to /app/assets/javascripts.
def theme_textmate
path = 'node_modules/ace-builds/src-min-noconflict/theme-textmate.js'
file_contents = File.read(path)
render js: file_contents
end

private
Expand Down
4 changes: 4 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,5 +205,9 @@

# Static pages
# get '*page' => 'pages#show'
#

# Deal with ACE Editor really really wanting this file here
get '/javascripts/ace/theme-textmate.js' => 'pages#theme_textmate'
end
# rubocop:enable Metrics/BlockLength

0 comments on commit e1b816f

Please sign in to comment.