Comments (3)
Aren't these files supposed to be autoloaded by the
Administrate::Field::SimpleMarkdown::Engine
declaration?class Engine < ::Rails::Engine Administrate::Engine.add_javascript 'administrate-field-simple_markdown/application' Administrate::Engine.add_stylesheet 'administrate-field-simple_markdown/application' end
You’re correct, for some reason the skeleton application I was testing this on required those two lines as well.
But I found what the issue is, it's because my model is namespaced (
Course::Translation
coming from Globalize) and SimpleMarkdown is looking for a textarea with IDcourse/translation_about
instead ofcourse_translation_about
.
By changingf.object.class.name.underscore
tof.object.class.name.parameterize.underscore
inviews/fields/simple_markdown/_form.html.erb
, the issue seems fixed (Course::Translation.name.parameterize.underscore --> "course_translation"
).
Ah, good catch! Makes sense, and thanks for opening a PR. I’ll check it out in a minute and release a new version of the gem with your fix.
from administrate-field-simple_markdown.
Hey @sedubois, thanks for the feedback!
I just scaffolded a project with the same dependencies as the ones you listed, and everything is working fine for me.
Please make sure that you are including both Administrate’s and the plugin assets in your app/assets/config/manifest.js
file, like this:
//= link administrate/application.css
//= link administrate/application.js
//= link administrate-field-simple_markdown/application.css
//= link administrate-field-simple_markdown/application.js
Let me know if this fixes it for you.
from administrate-field-simple_markdown.
Thanks @michelegera, aren't these files supposed to be autoloaded by the Administrate::Field::SimpleMarkdown::Engine
declaration?
class Engine < ::Rails::Engine
Administrate::Engine.add_javascript 'administrate-field-simple_markdown/application'
Administrate::Engine.add_stylesheet 'administrate-field-simple_markdown/application'
end
Also I don't yet have app/assets/config/manifest.js
because I'm still running on sprockets 3.7.2.
And anyway I checked the source code and simplemde.min.js
and simplemde.min.css
are correctly referenced.
But I found what the issue is, it's because my model is namespaced (Course::Translation
coming from Globalize) and SimpleMarkdown is looking for a textarea with ID course/translation_about
instead of course_translation_about
.
Here was the generated code:
$(function() {
new SimpleMDE({
element: document.getElementById('course/translation_about')
});
});
By changing f.object.class.name.underscore
to f.object.class.name.parameterize.underscore
in views/fields/simple_markdown/_form.html.erb
, the issue seems fixed (Course::Translation.name.parameterize.underscore --> "course_translation"
).
from administrate-field-simple_markdown.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from administrate-field-simple_markdown.