1import { Controller } from '@hotwired/stimulus'; 2import { devWarn } from 'helpers/logger'; 3 4/** 5 * @domain í¼ ë¼ì´íì¬ì´í´ 6 * @concern í¼ ì ì¶ ì íì¬ ì»¨í¸ë¡¤ë¬/ì¡ì 컨í ì¤í¸ ì²¨ë¶ 7 * @description meta íê·¸ì rails-controller/rails-action ê°ì ì½ì´ hidden inputì¼ë¡ í¼ì ì¶ê°íë 컨í¸ë¡¤ë¬ 8 */ 9export default class extends Controller { 10 static values = { 11 controllerParamName: { 12 type: String, 13 default: 'source_controller', 14 }, 15 actionParamName: { 16 type: String, 17 default: 'source_action', 18 }, 19 }; 20 21 submit(event) { 22 const form = event.target; 23 24 const controller = this._getMeta('rails-controller'); 25 const action = this._getMeta('rails-action'); 26 27 if (!controller || !action) { 28 devWarn('[form-meta-context] rails-controller / rails-action ë©í í그를 ì°¾ì§ ëª»íìµëë¤.'); 29 return; 30 } 31 32 this._ensureHiddenField(form, this.controllerParamNameValue, controller); 33 this._ensureHiddenField(form, this.actionParamNameValue, action); 34 } 35 36 _getMeta(name) { 37 return document.querySelector(`meta[name="${name}"]`)?.content || ''; 38 } 39 40 _ensureHiddenField(form, name, value) { 41 let input = form.querySelector(`input[name="${name}"]`); 42 if (!input) { 43 input = Object.assign(document.createElement('input'), { 44 type: 'hidden', 45 name, 46 }); 47 form.append(input); 48 } 49 input.value = value; 50 } 51}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.