From 1549514e13c4542ee29c723d338be7ce1f75d00e Mon Sep 17 00:00:00 2001 From: janpaulo Date: Tue, 8 Mar 2022 21:11:06 +0800 Subject: [PATCH] Fix selectize issue for all --- .../document_doctrine_show_component.html.erb | 2 +- app/javascript/controllers/doctrines_controller.js | 10 +++++----- app/javascript/controllers/selectize_controller.js | 6 +++--- app/javascript/src/application.scss | 10 +++++++++- app/views/reports/index.html.erb | 4 ++-- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/app/components/document_doctrine_show_component/document_doctrine_show_component.html.erb b/app/components/document_doctrine_show_component/document_doctrine_show_component.html.erb index c9657f8..a890af9 100644 --- a/app/components/document_doctrine_show_component/document_doctrine_show_component.html.erb +++ b/app/components/document_doctrine_show_component/document_doctrine_show_component.html.erb @@ -6,7 +6,7 @@
- Edit + Edit Delete
diff --git a/app/javascript/controllers/doctrines_controller.js b/app/javascript/controllers/doctrines_controller.js index cd599bf..3cc0afe 100644 --- a/app/javascript/controllers/doctrines_controller.js +++ b/app/javascript/controllers/doctrines_controller.js @@ -91,12 +91,12 @@ export default class extends ApplicationController { $('.toast').addClass('bg-success').show() $( ".toast-body" ).html( "Submitted Successfully" ), location.pathname = "/documents/" + document_id + "/doctrines/" + data.id + }else { + $(".btn-close-x").trigger("click"), + $('.toast').addClass('bg-danger').show(), + $( ".toast-body" ).html( "Unexpected Error Problem Occurred" ) } - }, - $(".btn-close-x").trigger("click"), - $('.toast').addClass('bg-danger').show(), - $( ".toast-body" ).html( "Unexpected Error Problem Occurred" ) - ) + }) } } } diff --git a/app/javascript/controllers/selectize_controller.js b/app/javascript/controllers/selectize_controller.js index 6685788..c2912f7 100644 --- a/app/javascript/controllers/selectize_controller.js +++ b/app/javascript/controllers/selectize_controller.js @@ -90,9 +90,9 @@ export default class extends ApplicationController { if ($subjects_selectize.length) $subjects_selectize[0].selectize.addOption(result, true); }) - if ($subject_ids_selectize.length) $subject_ids_selectize[0].selectize.refreshOptions(); - - if ($subjects_selectize.length) $subjects_selectize[0].selectize.refreshOptions(); + //this code will be autoFocus on the first selectize + // if ($subject_ids_selectize.length) $subject_ids_selectize[0].selectize.refreshOptions(); + // if ($subjects_selectize.length) $subjects_selectize[0].selectize.refreshOptions(); } }); diff --git a/app/javascript/src/application.scss b/app/javascript/src/application.scss index ec15119..ab6be17 100644 --- a/app/javascript/src/application.scss +++ b/app/javascript/src/application.scss @@ -116,4 +116,12 @@ background-size: cover; overflow-x: hidden; // box-shadow: inset 0 0 0 2000px rgba(251, 251, 251, 0.3); -} \ No newline at end of file +} + +.subject-ids-selectize { + width: auto !important; +} + +.not-full input { + width: auto !important; +} diff --git a/app/views/reports/index.html.erb b/app/views/reports/index.html.erb index 35a9f1e..229eff5 100644 --- a/app/views/reports/index.html.erb +++ b/app/views/reports/index.html.erb @@ -8,7 +8,7 @@
- +
@@ -23,7 +23,7 @@
- <%= select_tag :user_ids, options_from_collection_for_select(@users, :id, :name, params[:user_ids]), class: "form-control default-selectize p-0", multiple: true %> + <%= select_tag :user_ids, options_from_collection_for_select(@users, :id, :name, params[:user_ids]), class: "default-selectize p-0", multiple: true %>