simple_form单个内联复选框CSS类问题

时间:2019-07-05 04:09:13

标签: ruby-on-rails simple-form tailwind-css

我正在将simple_form添加到现有的Rails应用程序中。我要重新创建此复选框:

    struct Point
    {
        double x, y, angle;
        Point (double x, double y): x(x), y(y) {}
    };

    bool SortByY (Point a, Point b)
    {
        return a.y < b.y;
    }

    bool SortByAngle (Point a, Point b)
    {
        return a.angle < b.angle;
    }

    double GetRotationAngle(vector<Point> points)
    {
        sort (points.begin(), points.end(), SortByY);

        // If there are 2 points lie on the same y-axis coordinates, simply return 0
        if  (points[0].y == points[1].y) return 0;

        Point D = points[0];

        for (int i=1; i<4; i++)
        {
            // Move the whole thing by vector OD
            double a = points[i].x -= D.x;
            double b = points[i].y -= D.y;

            // Keep in mind that in C++, the acos function returns value in radians, you may need to convert to degrees for your purposes.
            points[i].angle = acos(a / sqrt(a*a+b*b));
        }

        sort (points.begin()+1, points.end(), SortByAngle);
        return points[1].angle;
    }

问题在于simple_form呈现器:

<div class="form-group">
  <label class="boolean optional" for="client_flag_active">Status</label>
  <input name="client[flag_active]" type="hidden" value="0"><input class="" type="checkbox" value="1" checked="checked" name="client[flag_active]" id="client_flag_active"> Active
</div>

<%= form.input :flag_active, as: :boolean, inline_label: 'Active' %> 

问题似乎是添加到输入中的“表单控件”,使用我的Tailwind CSS将复选框呈现为文本字段。我的配置为所有其他字段的默认<div class="input form-group boolean optional client_flag_active field_without_errors"> <label class="boolean optional" for="client_flag_active">Status</label> <span class="hint"> <input value="0" type="hidden" name="client[flag_active]"><label class="checkbox"> <input class="form-control boolean optional form-control" type="checkbox" value="1" checked="checked" name="client[flag_active]" id="client_flag_active"> Active</label> </span> </div> (同样是CSS)。我似乎在文档中找不到如何清理并消除该类的方法。

奖金将是清理其他多余的包装纸等。

0 个答案:

没有答案
相关问题