Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert GUI from Coffeescript to Javascript #2516

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/assets/javascripts/alchemy/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
//= require alchemy/alchemy.elements_window
//= require alchemy/alchemy.fixed_elements
//= require alchemy/alchemy.growler
//= require alchemy/alchemy.gui
//= require alchemy/alchemy.hotkeys
//= require alchemy/alchemy.image_overlay
//= require alchemy/alchemy.string_extension
Expand Down
27 changes: 0 additions & 27 deletions app/assets/javascripts/alchemy/alchemy.gui.js.coffee

This file was deleted.

2 changes: 2 additions & 0 deletions app/javascript/alchemy_admin.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import "@hotwired/turbo-rails"

import Buttons from "alchemy_admin/buttons"
import GUI from "alchemy_admin/gui"
import translate from "alchemy_admin/i18n"
import Dirty from "alchemy_admin/dirty"
import translationData from "alchemy_admin/translations"
Expand All @@ -24,6 +25,7 @@ if (typeof window.Alchemy === "undefined") {
Object.assign(Alchemy, {
Buttons,
...Dirty,
GUI,
t: translate, // Global utility method for translating a given string
translations: Object.assign(Alchemy.translations || {}, translationData),
fileEditors,
Expand Down
32 changes: 32 additions & 0 deletions app/javascript/alchemy_admin/gui.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
function init(scope) {
Alchemy.SelectBox(scope)
Alchemy.Datepicker(scope && scope.selector)
Alchemy.Tooltips(scope)
Alchemy.Buttons.observe(scope)
if (!scope) {
Alchemy.watchForDialogs()
}
Alchemy.Hotkeys(scope)
Alchemy.ListFilter(scope)
Alchemy.Autocomplete.tags(scope)
$("[data-alchemy-char-counter]", scope).each(function () {
new Alchemy.CharCounter(this)
})
}

function initElement($el) {
Alchemy.ElementDirtyObserver($el)
init($el && $el.selector)
Alchemy.ImageLoader($el[0])
Alchemy.fileEditors(
$el.find(
".ingredient-editor.file, .ingredient-editor.audio, .ingredient-editor.video"
).selector
)
Alchemy.pictureEditors($el.find(".ingredient-editor.picture").selector)
}

export default {
init,
initElement
}