Feature #42510 » 0001-Introduce-Stimulus-to-facilitate-JavaScript-moderniz.patch
| Gemfile | ||
|---|---|---|
|
gem 'rubyzip', '~> 2.4.0'
|
||
|
gem 'propshaft', '~> 1.1.0'
|
||
|
gem 'rack', '>= 3.1.3'
|
||
|
gem "stimulus-rails", "~> 1.3"
|
||
|
gem "importmap-rails", "~> 2.0"
|
||
|
# Ruby Standard Gems
|
||
|
gem 'csv', '~> 3.2.8'
|
||
| app/helpers/application_helper.rb | ||
|---|---|---|
|
if Setting.wiki_tablesort_enabled?
|
||
|
tags << javascript_include_tag('tablesort-5.2.1.min.js', 'tablesort-5.2.1.number.min.js')
|
||
|
end
|
||
|
tags << javascript_include_tag('application', 'responsive')
|
||
|
tags << javascript_include_tag('application-legacy', 'responsive')
|
||
|
unless User.current.pref.warn_on_leaving_unsaved == '0'
|
||
|
warn_text = escape_javascript(l(:text_warn_on_leaving_unsaved))
|
||
|
tags <<
|
||
| app/javascript/application.js | ||
|---|---|---|
|
import "controllers"
|
||
| app/javascript/controllers/application.js | ||
|---|---|---|
|
import { Application } from '@hotwired/stimulus'
|
||
|
const application = Application.start()
|
||
|
application.debug = false
|
||
|
window.Stimulus = application
|
||
|
export { application }
|
||
| app/javascript/controllers/index.js | ||
|---|---|---|
|
import { application } from "controllers/application"
|
||
|
import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading"
|
||
|
eagerLoadControllersFrom("controllers", application)
|
||
| app/views/layouts/base.html.erb | ||
|---|---|---|
|
<%= favicon %>
|
||
|
<%= stylesheet_link_tag 'jquery/jquery-ui-1.13.2', 'tribute-5.1.3', 'application', 'responsive', :media => 'all' %>
|
||
|
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||
|
<%= javascript_importmap_tags %>
|
||
|
<%= javascript_heads %>
|
||
|
<%= heads_for_theme %>
|
||
|
<%= heads_for_auto_complete(@project) %>
|
||
| bin/importmap | ||
|---|---|---|
|
#!/usr/bin/env ruby
|
||
|
require_relative "../config/application"
|
||
|
require "importmap/commands"
|
||
| config/importmap.rb | ||
|---|---|---|
|
# Pin npm packages by running ./bin/importmap
|
||
|
pin "application"
|
||
|
pin "@hotwired/stimulus", to: "stimulus.min.js"
|
||
|
pin "@hotwired/stimulus-loading", to: "stimulus-loading.js"
|
||
|
pin_all_from "app/javascript/controllers", under: "controllers"
|
||
- « Previous
- 1
- 2
- Next »