From 6e24bfc78cc1138f772145a5c1225324d3a0d6aa Mon Sep 17 00:00:00 2001 From: bohung Date: Mon, 5 Sep 2022 09:28:51 +0800 Subject: [PATCH] Fix bug. --- app/controllers/asks_controller.rb | 10 ++++++++-- app/views/asks/index.html.erb | 3 +++ modules/ask/_ask_widget_form.html.erb | 3 +++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/controllers/asks_controller.rb b/app/controllers/asks_controller.rb index 423c6c8..43943d8 100644 --- a/app/controllers/asks_controller.rb +++ b/app/controllers/asks_controller.rb @@ -470,8 +470,14 @@ class AsksController < ApplicationController var i0 = old_inputs.indexOf(v) if (i0 != -1 && new_controls.eq(i).find('select#ask_question_category_id').length==0){ var new_ = new_controls.eq(i).find('.controls').eq(0), - old_ = old_controls.eq(i0).find('.controls').eq(0); - old_.clone().replaceAll(new_); + old_ = old_controls.eq(i0).find('.controls').eq(0), + new_input = new_.find('input, select'), + old_input = old_.find('input, select'); + if(new_input.length != 0 && old_input.length != 0){ + if(new_input.length == old_input.length){ + old_.replaceAll(new_); + } + } } }) self.parents('.ask-question').eq(0).find('form').hide() diff --git a/app/views/asks/index.html.erb b/app/views/asks/index.html.erb index 65c0a5c..c4c3568 100644 --- a/app/views/asks/index.html.erb +++ b/app/views/asks/index.html.erb @@ -72,6 +72,9 @@ padding: 1em 0 0 0; text-align: center; } + .ask-question .controls > input[type="radio"]:not(:first-child) { + margin-left: 0.5em; + } <%# javascript_include_tag "/assets/lib/jquery-ui-1.12.1/jquery-ui.min" %> <%# stylesheet_link_tag "/assets/lib/jquery-ui-1.12.1/jquery-ui.min" %> diff --git a/modules/ask/_ask_widget_form.html.erb b/modules/ask/_ask_widget_form.html.erb index 7f677b5..957310f 100644 --- a/modules/ask/_ask_widget_form.html.erb +++ b/modules/ask/_ask_widget_form.html.erb @@ -46,6 +46,9 @@ padding: 1em 0 0 0; text-align: center; } + .ask-question .controls > input[type="radio"]:not(:first-child) { + margin-left: 0.5em; + }