Remove bootstrap form

This commit is contained in:
Anton 2023-07-03 11:11:51 +02:00
parent b459ed7b4b
commit b956f9de25
53 changed files with 166 additions and 153 deletions

View file

@ -6,7 +6,6 @@ ruby '3.2.2'
gem 'bootsnap', require: false
gem 'bootstrap-sass', '~> 3.4.1'
gem 'bootstrap_form', '~> 2.7.0'
gem 'devise', '~> 4.8.1'
gem 'devise_invitable'
gem 'figaro'

View file

@ -207,7 +207,6 @@ GEM
bootstrap-select-rails (1.12.4)
bootstrap3-datetimepicker-rails (4.17.47)
momentjs-rails (>= 2.8.1)
bootstrap_form (2.7.0)
builder (3.2.4)
bullet (7.0.7)
activesupport (>= 3.0.0)
@ -438,6 +437,8 @@ GEM
nokogiri (1.14.5)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
nokogiri (1.14.5-arm64-darwin)
racc (~> 1.4)
nokogiri (1.14.5-x86_64-linux)
racc (~> 1.4)
oauth2 (2.0.9)
@ -659,6 +660,8 @@ GEM
ffi (~> 1.1)
tailwindcss-rails (2.0.29)
railties (>= 6.0.0)
tailwindcss-rails (2.0.29-arm64-darwin)
railties (>= 6.0.0)
tailwindcss-rails (2.0.29-x86_64-linux)
railties (>= 6.0.0)
thor (1.2.2)
@ -701,6 +704,7 @@ GEM
rubyzip (>= 1.0.0)
PLATFORMS
arm64-darwin
ruby
x86_64-linux
@ -723,7 +727,6 @@ DEPENDENCIES
bootstrap-sass (~> 3.4.1)
bootstrap-select-rails (~> 1.12.4)
bootstrap3-datetimepicker-rails (~> 4.17)
bootstrap_form (~> 2.7.0)
bullet
byebug
canaid!

View file

@ -1,7 +1,6 @@
/*
*= require_self
*= require jquery-ui/draggable
*= require rails_bootstrap_forms
*= require bootstrap-select
*= require sn-icon-font
*= require sn-inter-font

View file

@ -35,6 +35,13 @@
&::placeholder {
color: $color-alto;
}
&.textarea {
height: unset;
min-height: 36px;
padding: 10px;
resize: vertical;
}
}
.sn-icon {

View file

@ -2,6 +2,6 @@
module Reports
class DateInputComponent < TemplateValueComponent
include BootstrapFormHelper
include SciFormHelper
end
end

View file

@ -31,7 +31,8 @@ class ExperimentsController < ApplicationController
@experiment = Experiment.new
render json: {
html: render_to_string(
partial: 'new_modal'
partial: 'new_modal',
formats: :html
)
}
end

View file

@ -13,7 +13,7 @@ class MyModuleTagsController < ApplicationController
render json: {
my_module: @my_module,
html: render_to_string(partial: 'index_edit.html.erb')
html: render_to_string(partial: 'index_edit', formats: :html)
}
end

View file

@ -23,9 +23,7 @@ class ResultTextsController < ApplicationController
respond_to do |format|
format.json {
render json: {
html: render_to_string({
partial: "new.html.erb"
})
html: render_to_string({ partial: 'new', formats: :html })
}, status: :ok
}
end

View file

@ -1,9 +1,5 @@
module BootstrapFormHelper
# Extend Bootstrap form builder
class BootstrapForm::FormBuilder
include BootstrapFormHelper
module SciFormHelper
class SciFormBuilder < ActionView::Helpers::FormBuilder
# Returns Bootstrap date-time picker of the "datetime" type tailored for accessing a specified datetime attribute (identified by +name+) on an object
# assigned to the template (identified by +object+). Additional options on the input tag can be passed as a
# hash with +options+. The supported options are shown in the following examples.
@ -21,8 +17,8 @@ module BootstrapFormHelper
# Show a "today" button on the bottom of the date picker.
# # => datetime_picker(:post, :published, today: true)
def datetime_picker(name, options = {})
id = "#{@object_name}_#{name.to_s}"
input_name = "#{@object_name}[#{name.to_s}]"
id = "#{@object_name}_#{name}"
input_name = "#{@object_name}[#{name}]"
value = options[:value] ? options[:value].strftime("#{I18n.backend.date_format} %H:%M") : ''
js_locale = I18n.locale.to_s
js_format = options[:time] ? datetime_picker_format_full : datetime_picker_format_date_only
@ -36,7 +32,7 @@ module BootstrapFormHelper
res << "<div class='input-group date'>" if options[:clear]
res << "<input type='datetime' class='form-control' name='#{input_name}' id='#{id}' "\
res << "<input type='datetime' class='form-control' name='#{input_name}' id='#{id}' " \
"readonly value='#{value}' data-toggle='date-time-picker' data-date-format='#{js_format}' " \
"data-date-locale='#{js_locale}' data-date-show-today-button='#{options[:today].present?}'/>"
@ -66,48 +62,40 @@ module BootstrapFormHelper
# Specify custom CSS classes on the element
# # => enum_btn_group(:car, :type, class: "class1 class2")
def enum_btn_group(name, options = {})
id = "#{@object_name}_#{name.to_s}"
input_name = "#{@object_name}[#{name.to_s}]"
id = "#{@object_name}_#{name}"
input_name = "#{@object_name}[#{name}]"
enum_vals = @object.class.send(name.to_s.pluralize)
btn_names = Hash[enum_vals.keys.collect { |k| [k, k] }]
if options[:btn_names] then
btn_names = options[:btn_names]
end
btn_names = HashWithIndifferentAccess.new(btn_names)
btn_names = enum_vals.keys.collect { |k| [k, k] }.to_h
btn_names = options[:btn_names] if options[:btn_names]
btn_names = ActiveSupport::HashWithIndifferentAccess.new(btn_names)
label = name.to_s.humanize
if options[:label] then
label = options[:label]
end
label = options[:label] if options[:label]
style_str = ""
if options[:style] then
style_str = " style='#{options[:style]}'"
end
style_str = ''
style_str = " style='#{options[:style]}'" if options[:style]
class_str = ""
if options[:class] then
class_str = " #{options[:class]}"
end
class_str = ''
class_str = " #{options[:class]}" if options[:class]
res = ""
res = ''
res << "<div class='form-group#{class_str}'#{style_str}>"
res << "<label for='#{id}'>#{label}</label>"
res << "<br>"
res << '<br>'
res << "<div class='btn-group' data-toggle='buttons'>"
enum_vals.keys.each do |val|
active = @object.send("#{val}?")
active_str = active ? " active" : ""
checked_str = active ? " checked='checked'" : ""
active_str = active ? ' active' : ''
checked_str = active ? " checked='checked'" : ''
res << "<label class='btn btn-toggle#{active_str}'>"
res << "<input type='radio' value='#{val}' name='#{input_name}' id='#{id}_#{val}'#{checked_str}>"
res << btn_names[val]
res << "</label>"
res << '</label>'
end
res << "</div>"
res << "</div>"
res << '</div>'
res << '</div>'
res.html_safe
end
@ -125,11 +113,11 @@ module BootstrapFormHelper
end
opts.delete(:rows) if opts[:rows].nil?
if opts[:single_line]
if opts[:rows]
opts[:class] = [opts[:class], 'textarea-sm-present'].join(' ')
else
opts[:class] = [opts[:class], 'textarea-sm'].join(' ')
end
opts[:class] = if opts[:rows]
[opts[:class], 'textarea-sm-present'].join(' ')
else
[opts[:class], 'textarea-sm'].join(' ')
end
end
text_area(name, opts)
end

View file

@ -6,7 +6,7 @@ module Experiments
include CommentHelper
include ProjectsHelper
include InputSanitizeHelper
include BootstrapFormHelper
include SciFormHelper
include MyModulesHelper
include Canaid::Helpers::PermissionsHelper
include Rails.application.routes.url_helpers

View file

@ -3,9 +3,9 @@
role="dialog"
tabindex="-1"
aria-labelledby="new-office-file-modal-label">
<%= bootstrap_form_tag url: create_wopi_file_path(),
html: { novalidate: "novalidate" },
method: :post, remote: true do |f| %>
<%= form_with url: create_wopi_file_path(),
html: { novalidate: "novalidate" },
method: :post, remote: true do |f| %>
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">

View file

@ -8,7 +8,7 @@
data-can-edit-connections="<%= @experiment_managable ? "yes" : "no" %>"
data-unsaved-work-text="<%=t "experiments.canvas.edit.unsaved_work" %>"
>
<%= bootstrap_form_tag url: canvas_experiment_url, method: "post", html: {class: "canvas-header"} do |f| %>
<%= form_with url: canvas_experiment_url, method: "post", html: {class: "canvas-header"} do |f| %>
<% if @experiment_managable %>
<%=link_to "", type: "button", class: "btn btn-primary", id: "canvas-new-module" do %>
<span class="hbtn-default">

View file

@ -6,11 +6,9 @@
<h4 class="modal-title" id="modal-edit-module-label"><%=t "experiments.canvas.edit.modal_edit_module.title" %></h4>
</div>
<div class="modal-body">
<%= bootstrap_form_tag do |f| %>
<div class="sci-input-container">
<%= f.text_field t("experiments.canvas.edit.modal_edit_module.name"), id: "edit-module-name-input", class: "sci-input-field" %>
</div>
<% end %>
<div class="sci-input-container">
<%= text_field_tag t("experiments.canvas.edit.modal_edit_module.name"), '',id: "edit-module-name-input", class: "sci-input-field" %>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal"><%=t "general.cancel" %></button>

View file

@ -8,7 +8,7 @@
<div class="modal-body">
<% experiments = @experiment.project.experiments.managable_by_user(current_user).order(name: :asc).active %>
<% if experiments.count > 1 %>
<%= bootstrap_form_tag do |f| %>
<%= form_with do |f| %>
<%= f.select :experiment_id, experiments
.select { |e| e != @experiment && can_manage_experiment?(e) }
.collect { |e| [ e.name, e.id ] }, {},

View file

@ -8,7 +8,7 @@
<div class="modal-body">
<% experiments = @experiment.project.experiments.managable_by_user(current_user).order(name: :asc).active %>
<% if experiments.count > 1 %>
<%= bootstrap_form_tag do |f| %>
<%= form_with do |f| %>
<%= f.select :experiment_id, experiments
.select { |e| e != @experiment }
.collect { |e| [ e.name, e.id ] }, {},

View file

@ -6,13 +6,13 @@
<h4 class="modal-title" id="modal-new-module-label"><%=t "experiments.canvas.edit.modal_new_module.title" %></h4>
</div>
<div class="modal-body">
<%= bootstrap_form_tag do |f| %>
<%= f.text_field t("experiments.canvas.edit.modal_new_module.name"), placeholder: t("experiments.canvas.edit.modal_new_module.name_placeholder"), id: "new-module-name-input" %>
<% end %>
<div class="sci-input-container">
<%= text_field_tag t("experiments.canvas.edit.modal_new_module.name"), '', placeholder: t("experiments.canvas.edit.modal_new_module.name_placeholder"), id: "new-module-name-input", class: "sci-input-field" %>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><%=t "general.cancel" %></button>
<button type="button" class="btn btn-success" data-dismiss="modal" data-action="confirm"><%=t "experiments.canvas.edit.modal_new_module.confirm" %></button>
<button type="button" class="btn btn-light" data-dismiss="modal"><%=t "general.cancel" %></button>
<button type="button" class="btn btn-primary" data-dismiss="modal" data-action="confirm"><%=t "experiments.canvas.edit.modal_new_module.confirm" %></button>
</div>
</div>
</div>

View file

@ -1,7 +1,7 @@
<div class="modal" id="clone-experiment-modal-<%= @experiment.id %>" tabindex="-1" role="dialog" aria-labelledby="clone-experiment-modal-label">
<div class="modal-dialog" role="document">
<div class="modal-content">
<%= bootstrap_form_for @experiment, url: clone_experiment_path(@experiment, :view_mode=>view_mode), method: :post do |f| %>
<%= form_with model: @experiment, url: clone_experiment_path(@experiment, :view_mode=>view_mode), method: :post do |f| %>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="clone-experiment-modal-label"><%= t("experiments.clone.modal_title", experiment: @experiment.name ) %></h5>

View file

@ -1,7 +1,7 @@
<div class="modal" id="edit-experiment-modal-<%= @experiment.id %>" tabindex="-1" role="dialog" aria-labelledby="edit-experiment-modal-label">
<div class="modal-dialog" role="document">
<div class="modal-content">
<%= bootstrap_form_for [@project, @experiment], html: { class: 'experiment-action-form' } do |f| %>
<%= form_with model: [@project, @experiment], html: { class: 'experiment-action-form' }, builder: SciFormHelper::SciFormBuilder do |f| %>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="<%= t('general.close') %>"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="edit-eperiment-modal-label">

View file

@ -1,9 +1,10 @@
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="form-group">
<div class="sci-input-container">
<label><%= t('experiments.new.name') %></label>
<%= form.text_field :name,
label: t('experiments.new.name'),
autofocus: true,
class: 'sci-input-field',
placeholder: t('experiments.new.name_placeholder'),
id: 'experiment-name' %>
</div>
@ -12,10 +13,11 @@
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="form-group">
<div class="sci-input-container">
<label><%= t('experiments.new.description') %></label>
<%= form.smart_text_area :description,
label: t('experiments.new.description'),
id: 'experiment-description',
class: 'sci-input-field textarea h-48',
data: { 'atwho-edit' => '' } %>
</div>
</div>

View file

@ -3,7 +3,7 @@
tabindex="-1"
role="dialog"
aria-labelledby="move-experiment-modal-label">
<%= bootstrap_form_for @experiment,
<%= form_with model: @experiment,
url: move_experiment_path(@experiment),
method: :post,
remote: true,

View file

@ -7,7 +7,7 @@
</div>
<div class="modal-body">
<% if @experiments.present? %>
<%= bootstrap_form_tag do |f| %>
<%= form_with do |f| %>
<%= f.select :experiment_id, @experiments.collect { |e| [ e.name, e.id ] }, {}, class: "form-control selectpicker", 'data-role': 'clear' %>
<% end %>
<% else %>

View file

@ -1,10 +1,11 @@
<div class="modal" id="new-experiment-modal" tabindex="-1" role="dialog" aria-labelledby="new-experiment-modal-label">
<div class="modal-dialog" role="document">
<div class="modal-content">
<%= bootstrap_form_for [@project, @experiment],
remote: true,
method: :post,
html: { class: 'experiment-action-form' } do |f| %>
<%= form_with url: [@project, @experiment],
remote: true,
method: :post,
builder: SciFormHelper::SciFormBuilder,
html: { class: 'experiment-action-form' } do |f| %>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="<%= t('general.close') %>"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="new-eperiment-modal-label"><%= t("experiments.new.modal_title") %></h4>

View file

@ -19,7 +19,7 @@
<%= link_to my_module_my_module_tag_path(@my_module, mmt, format: :json), method: :delete, remote: true, class: 'btn btn-link remove-tag-link', title: t("experiments.canvas.modal_manage_tags.remove_tag", module: @my_module.name), data: {tag_id: tag.id} do %>
<span class="sn-icon sn-icon-close"></span>
<% end %>
<%= bootstrap_form_for tag, remote: true, url: project_tag_path(@my_module.experiment.project, tag, format: :json), data: {tag_id: tag.id}, method: :delete, html: { class: "delete-tag-form"} do |f| %>
<%= form_with model: tag, remote: true, url: project_tag_path(@my_module.experiment.project, tag, format: :json), data: {tag_id: tag.id}, method: :delete, html: { class: "delete-tag-form"} do |f| %>
<%= hidden_field_tag :my_module_id, @my_module.id %>
<%= f.button class: 'btn btn-link delete-tag-link', title: t("experiments.canvas.modal_manage_tags.delete_tag"), data: { confirm: t("experiments.canvas.modal_manage_tags.delete_tag_confirmation") } do %>
<span class="sn-icon sn-icon-delete-alt"></span>
@ -30,7 +30,7 @@
</div>
<div class="row tag-edit" style="display: none;">
<%= bootstrap_form_for tag, remote: true, url: project_tag_path(@my_module.experiment.project, tag, format: :json), method: :put, html: { class: "edit-tag-form" }, data: {tag_id: tag.id} do |f| %>
<%= form_with model:tag, remote: true, url: project_tag_path(@my_module.experiment.project, tag, format: :json), method: :put, html: { class: "edit-tag-form" }, data: {tag_id: tag.id} do |f| %>
<%= hidden_field_tag :my_module_id, @my_module.id %>
<div class="col-xs-7">
<%= f.text_field :name, hide_label: true %>
@ -58,7 +58,7 @@
<% if can_manage_my_module?(@my_module) %>
<hr data-view-mode="active">
<div class="row" data-view-mode="active">
<%= bootstrap_form_for [@my_module, @new_mmt], remote: true, format: :json, html: { class: 'add-tag-form' } do |f| %>
<%= form_with url: [@my_module, @new_mmt], remote: true, format: :json, html: { class: 'add-tag-form' } do |f| %>
<div>
<div class="well well-sm">
<%= collection_select(:my_module_tag,
@ -75,7 +75,7 @@
</div>
<% end %>
<div class="pull-right create-new-tag-btn">
<%= bootstrap_form_for [@my_module.experiment.project, @new_tag], remote: true, format: :json, html: { class: 'add-tag-form' } do |f| %>
<%= form_with url: [@my_module.experiment.project, @new_tag], remote: true, format: :json, html: { class: 'add-tag-form' } do |f| %>
<%= hidden_field_tag :my_module_id, @my_module.id %>
<%= f.hidden_field :project_id, :value => @my_module.experiment.project.id %>
<%= f.hidden_field :name, :value => t("tags.create.new_name") %>

View file

@ -1,3 +1,3 @@
<%= bootstrap_form_for @my_module, url: my_module_path(@my_module, format: :json), remote: :true do |f| %>
<%= form_with model: @my_module, url: my_module_path(@my_module, format: :json), builder: SciFormHelper::SciFormBuilder, remote: :true do |f| %>
<%= f.smart_text_area :description, label: t("my_modules.description.label") %>
<% end %>

View file

@ -1,4 +1,4 @@
<%= bootstrap_form_for @my_module, url: update_description_my_module_path(@my_module, format: :json), remote: :true, html: {class: 'tiny-mce-editor'} do |f| %>
<%= form_with model: @my_module, url: update_description_my_module_path(@my_module, format: :json), remote: :true, html: {class: 'tiny-mce-editor'}, builder: SciFormHelper::SciFormBuilder do |f| %>
<%= render partial: 'shared/tiny_mce_extra_buttons' %>
<div id="my_module_description_view"
class="ql-editor tinymce-view"

View file

@ -1,4 +1,4 @@
<%= bootstrap_form_for @my_module, url: my_module_path(@my_module, format: :json), remote: :true do |f| %>
<%= form_with model: @my_module, url: my_module_path(@my_module, format: :json), remote: :true do |f| %>
<%= f.datetime_picker :due_date,
value: @my_module.due_date,
label: t('my_modules.due_date.label'),

View file

@ -1,6 +1,6 @@
<div class="modal" id="new-my-module-modal" tabindex="-1" role="dialog"
data-create-url="<%= modules_experiment_path(@experiment) %>" data-user-id="<%= current_user.id %>">
<%= bootstrap_form_for @my_module, url: modules_experiment_path(@experiment), remote: true do |f| %>
<%= form_with model: @my_module, url: modules_experiment_path(@experiment), remote: true do |f| %>
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">

View file

@ -3,7 +3,7 @@
tabindex="-1"
role="dialog"
aria-labelledby="print-protocol-modal-label">
<%= bootstrap_form_tag({ url: print_protocol_path(protocol), method: :get, html: { class: 'print-protocol-form', id: "print-protocol-form", target: '_blank' } }) do %>
<%= form_with url: print_protocol_path(protocol), method: :get, html: { class: 'print-protocol-form', id: "print-protocol-form", target: '_blank' } do %>
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">

View file

@ -1,4 +1,4 @@
<%= bootstrap_form_for protocol, url: update_url, remote: :true, html: {class: 'tiny-mce-editor'} do |f| %>
<%= form_with model: protocol, url: update_url, remote: :true, html: {class: 'tiny-mce-editor'}, builder: SciFormHelper::SciFormBuilder do |f| %>
<%= render partial: 'shared/tiny_mce_extra_buttons' %>
<div id="protocol_description_view"
class="ql-editor tinymce-view"

View file

@ -4,12 +4,13 @@
<%= t('projects.index.modal_edit_folder.title', folder: folder.name) %>
</h4>
</div>
<%= bootstrap_form_for folder, url: project_folder_path(folder ,format: :json), method: :put, remote: true do |f| %>
<%= form_with model: folder, url: project_folder_path(folder ,format: :json), method: :put, remote: true do |f| %>
<div class="modal-body">
<p><%= t('projects.index.modal_edit_folder.description') %></p>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<%= f.text_field :name, label: t('projects.index.modal_edit_folder.folder_name_field'), autofocus: true %>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 sci-input-container">
<label><%= t('projects.index.modal_edit_folder.folder_name_field') %></label>
<%= f.text_field :name, autofocus: true, class: "sci-input-field" %>
</div>
</div>

View file

@ -4,11 +4,12 @@
<%= t('projects.index.modal_edit_project.modal_title', project: @project.name) %>
</h4>
</div>
<%= bootstrap_form_for @project, url: project_path(@project ,format: :json), method: :put, remote: true do |f| %>
<%= form_with model: @project, url: project_path(@project ,format: :json), method: :put, remote: true do |f| %>
<div class="modal-body">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<%= f.text_field :name, label: t("projects.index.modal_new_project.name"), autofocus: true, placeholder: t("projects.index.modal_new_project.name_placeholder") %>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 sci-input-container">
<label><%= t("projects.index.modal_new_project.name") %></label>
<%= f.text_field :name, autofocus: true, placeholder: t("projects.index.modal_new_project.name_placeholder"), class: 'sci-input-field' %>
</div>
</div>
<div class="row">

View file

@ -1,5 +1,5 @@
<div class="modal" id="new-project-modal" tabindex="-1" role="dialog" aria-labelledby="new-project-modal-label">
<%= bootstrap_form_for @project, remote: true do |f| %>
<%= form_with model: @project, remote: true do |f| %>
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
@ -8,25 +8,31 @@
</div>
<div class="modal-body">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 sci-input-container">
<%= f.hidden_field :project_folder_id %>
<%= f.text_field :name, label: t('projects.index.modal_new_project.name'), placeholder: t('projects.index.modal_new_project.name_placeholder') %>
<label><%= t('projects.index.modal_new_project.name') %></label>
<%= f.text_field :name, placeholder: t('projects.index.modal_new_project.name_placeholder'), class: 'sci-input-field' %>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="checkbox">
<%= f.check_box :visibility,
{ label: t('projects.index.modal_new_project.visibility_html'), data: { action: 'toggle-visibility', target: 'role_select_wrapper' } },
:visible,
:hidden %>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 mt-4">
<div class="flex items-center gap-4 text-xs">
<div class="sci-checkbox-container">
<%= f.check_box :visibility,
{ class: 'sci-checkbox' ,data: { action: 'toggle-visibility', target: 'role_select_wrapper' } },
:visible,
:hidden %>
<span class="sci-checkbox-label"></span>
</div>
<span><%= t('projects.index.modal_new_project.visibility_html') %></span>
</div>
</div>
</div>
<div class="row hidden" id="role_select_wrapper">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 sci-input-container mt-4">
<%= f.select :default_public_user_role_id,
options_for_select(user_roles_collection(@project), UserRole.find_by(name: I18n.t('user_roles.predefined.viewer')).id),
{},
class: 'form-control selectpicker'%>
</div>
</div>

View file

@ -1,5 +1,5 @@
<div class="modal" id="new-project-folder-modal" tabindex="-1" role="dialog" aria-labelledby="new-project-folder-modal-label">
<%= bootstrap_form_for @project_folder, remote: true do |f| %>
<%= form_with model: @project_folder, remote: true do |f| %>
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
@ -13,7 +13,8 @@
<div class="form-group sci-input-container">
<%= f.hidden_field :parent_folder_id %>
<%= f.hidden_field :archived %>
<%= f.text_field :name, label: t('projects.index.modal_new_project_folder.name'), placeholder: t('projects.index.modal_new_project_folder.name_placeholder') %>
<label><%= t('projects.index.modal_new_project_folder.name') %></label>
<%= f.text_field :name, placeholder: t('projects.index.modal_new_project_folder.name_placeholder'), class: 'sci-input-field' %>
</div>
</div>
<div class="modal-footer">

View file

@ -42,7 +42,7 @@
<!-- Save report modal -->
<div class="modal" id="delete-reports-modal" tabindex="-1" role="dialog" aria-labelledby="delete-reports-modal-label">
<%= bootstrap_form_tag url: reports_destroy_path, method: :post, id: "delete-reports-form" do |f| %>
<%= form_with url: reports_destroy_path, method: :post, id: "delete-reports-form" do |f| %>
<input type="hidden" name="report_ids" id="report-ids">
<div class="modal-dialog" role="document">
<div class="modal-content">

View file

@ -1,7 +1,7 @@
<div class="modal fade" id="copy-repo-modal" tabindex="-1" role="dialog">
<%= bootstrap_form_for @tmp_repository,
url: team_repository_copy_path(id: @repository, format: :json),
remote: true do |f| %>
<%= form_with model: @tmp_repository,
url: team_repository_copy_path(id: @repository, format: :json),
remote: true do |f| %>
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
@ -14,8 +14,8 @@
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="form-group sci-input-container">
<label><%= t("repositories.index.modal_copy.name") %></label>
<%= f.text_field :name,
label: t("repositories.index.modal_copy.name"),
help: t("repositories.index.modal_copy.description"),
autofocus: true,
class: "sci-input-field",

View file

@ -1,5 +1,5 @@
<div class="modal" id="create-repo-modal" tabindex="-1" role="dialog" aria-labelledby="create-repo-modal-label">
<%= bootstrap_form_for [current_team, @repository], remote: :true do |f| %>
<%= form_with url: [current_team, @repository], remote: :true do |f| %>
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
@ -10,9 +10,9 @@
</div>
<div class="modal-body">
<div class="form-group sci-input-container">
<label><%= t("repositories.index.modal_create.name_label") %></label>
<%= f.text_field :name,
autofocus: true,
label: t("repositories.index.modal_create.name_label"),
class: "sci-input-field",
placeholder: t("repositories.index.modal_create.name_placeholder") %>
</div>

View file

@ -3,7 +3,7 @@
tabindex="-1"
role="dialog"
aria-labelledby="modal-export-repository-label">
<%= bootstrap_form_tag(url: export_repository_team_path(repository),
<%= form_with(url: export_repository_team_path(repository),
html: { id: 'form-export' },
remote: true) do |f| %>
<div class="modal-dialog" role="document">

View file

@ -6,7 +6,7 @@
<h4 class="modal-title"><%= t('repositories.modal_import.title') %></h4>
<%= t("repositories.modal_import.notice") %>
</div>
<%= bootstrap_form_tag url: parse_sheet_repository_path(repository),
<%= form_with url: parse_sheet_repository_path(repository),
html: {'data-type' => 'json',
id: 'form-records-file'} do |f| %>
<%= f.hidden_field :team_id, value: current_team.id %>

View file

@ -8,7 +8,7 @@
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="parse-modal-title"><%= t('repositories.modal_parse.title') %></h4>
</div>
<%= bootstrap_form_tag(url: import_records_repository_path(@import_data.repository, format: :json),
<%= form_with(url: import_records_repository_path(@import_data.repository, format: :json),
html: {'data-type' => 'json', id: 'form-import'},
remote: true) do |f|%>
<%= f.hidden_field :team_id, value: current_team.id %>

View file

@ -1,7 +1,7 @@
<div class="modal fade" id="rename-repo-modal" tabindex="-1" role="dialog">
<%= bootstrap_form_for @repository,
url: team_repository_path(id: @repository, format: :json),
remote: true do |f| %>
<%= form_with model: @repository,
url: team_repository_path(id: @repository, format: :json),
remote: true do |f| %>
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
@ -14,8 +14,8 @@
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="form-group sci-input-container">
<label><%= t("repositories.index.modal_rename.name") %></label>
<%= f.text_field :name,
label: t("repositories.index.modal_rename.name"),
autofocus: true,
class: "sci-input-field",
placeholder: t("repositories.index.modal_rename.name_placeholder") %>

View file

@ -1,5 +1,5 @@
<div class="well">
<%= bootstrap_form_for(@result, url: result_asset_path(format: :json), remote: true) do |f| %>
<%= form_with(model: @result, url: result_asset_path(format: :json), remote: true) do |f| %>
<%= f.text_field :name, style: "margin-top: 10px;" %><br />
<%= f.fields_for :asset do |ff| %>
<span><strong><%=t "result_assets.edit.uploaded_asset" %></strong></span>

View file

@ -1,5 +1,5 @@
<div id="table-form" class="well">
<%= bootstrap_form_for(@result, url: result_table_path(format: :json),
<%= form_with(model: @result, url: result_table_path(format: :json),
data: { 'name-max-length': Constants::NAME_MAX_LENGTH },
remote: true) do |f| %>
<%= f.text_field :name, style: "margin-top: 10px;" %><br />

View file

@ -1,5 +1,5 @@
<div id="table-form" class="well">
<%= bootstrap_form_for(@result, url: my_module_result_tables_path(format: :json, page: params[:page], order: params[:order]),
<%= form_with(model: @result, url: my_module_result_tables_path(format: :json, page: params[:page], order: params[:order]),
data: { 'name-max-length': Constants::NAME_MAX_LENGTH },
remote: true) do |f| %>
<%= f.text_field :name, style: "margin-top: 10px;" %><br />

View file

@ -1,8 +1,11 @@
<div class="well edit-text-result">
<%= bootstrap_form_for(@result, url: result_text_path(format: :json),
<%= form_with(model: @result, url: result_text_path(format: :json),
builder: SciFormHelper::SciFormBuilder,
data: { 'name-max-length': Constants::NAME_MAX_LENGTH, 'rich-text-max-length': Constants::RICH_TEXT_MAX_LENGTH },
remote: :true) do |f| %>
<%= f.text_field :name, style: "margin-top: 10px;" %><br />
<div class="sci-input-container mb-4">
<%= f.text_field :name, style: "margin-top: 10px;", class: "sci-input-field" %><br />
</div>
<%= f.fields_for :result_text do |ff| %>
<%= ff.tiny_mce_editor(:text,
id: :result_text_attributes_textarea,

View file

@ -1,8 +1,11 @@
<div class="well edit-text-result">
<%= bootstrap_form_for(@result, url: my_module_result_texts_path(format: :json, page: params[:page], order: params[:order]),
<%= form_with(model: @result, url: my_module_result_texts_path(format: :json, page: params[:page], order: params[:order]),
builder: SciFormHelper::SciFormBuilder,
data: { 'name-max-length': Constants::NAME_MAX_LENGTH, 'rich-text-max-length': Constants::RICH_TEXT_MAX_LENGTH },
remote: true) do |f| %>
<%= f.text_field :name, style: "margin-top: 10px;" %><br />
<div class="sci-input-container mb-4">
<%= f.text_field :name, style: "margin-top: 10px;", class: "sci-input-field" %><br />
</div>
<%= f.fields_for :result_text do |ff| %>
<%= ff.tiny_mce_editor(:text,
id: :result_text_attributes_textarea,

View file

@ -1,4 +1,4 @@
<%= bootstrap_form_for object, url: update_url, remote: :true, method: update_method, html: {class: 'tiny-mce-editor'} do |f| %>
<%= form_with model: object, url: update_url, remote: :true, method: update_method, html: {class: 'tiny-mce-editor'}, builder: SciFormHelper::SciFormBuilder do |f| %>
<%= render partial: 'shared/tiny_mce_extra_buttons' %>
<div class="ql-editor tinymce-view"
data-placeholder="<%= placeholder %>"><%= custom_auto_link(object.tinymce_render(field),

View file

@ -38,7 +38,7 @@
<li>
<hr>
<div class="row">
<%= bootstrap_form_for [@my_module, @new_um], remote: true, format: :json, html: { class: 'add-user-form' } do |f| %>
<%= form_wiht url: [@my_module, @new_um], remote: true, format: :json, html: { class: 'add-user-form' } do |f| %>
<div class="col-xs-4">
<%= collection_select(:user_my_module, :user_id, @undesignated_users, :id, :full_name, {}, { class: 'selectpicker' }) %>
</div>

View file

@ -1,8 +1,9 @@
<%= bootstrap_form_for team,
url: update_team_path(team,
format: :json),
remote: :true,
method: :put do |f| %>
<%= form_with model:team,
url: update_team_path(team,
format: :json),
remote: :true,
builder: SciFormHelper::SciFormBuilder,
method: :put do |f| %>
<%= f.smart_text_area :description,
label: t('users.settings.teams.edit.description_label') %>
<% end %>

View file

@ -13,7 +13,7 @@
<%= t("users.settings.teams.edit.modal_destroy_team.message", team: team.name) %>
</div>
<div class="modal-footer">
<%= bootstrap_form_tag url: destroy_team_path(team), method: :delete do |f| %>
<%= form_with url: destroy_team_path(team), method: :delete do |f| %>
<button type="button" class="btn btn-default" data-dismiss="modal"><%= t('general.cancel') %></button>
<%= f.submit t("users.settings.teams.edit.modal_destroy_team.confirm"), class: "btn btn-danger" %>
<% end %>

View file

@ -19,11 +19,11 @@
<li class="dropdown-header">
<%= t("users.settings.teams.edit.user_dropdown.role_label") %>
</li>
<%= bootstrap_form_for user_assignment,
url: update_role_path,
method: :put,
remote: true,
data: { id: 'update-role-form' } do |f| %>
<%= form_with model: user_assignment,
url: update_role_path,
method: :put,
remote: true,
data: { id: 'update-role-form' } do |f| %>
<input type="hidden" name="user_assignment[user_role_id]" data-field="role" value="" %>
<% end %>
<% team_user_roles_collection.each do |user_role| %>

View file

@ -5,11 +5,12 @@
<div class="tab-content">
<div class="tab-pane content-pane" role="tabpanel"></div>
<div class="tab-pane content-pane active" role="tabpanel">
<%= bootstrap_form_for @new_team, url: create_team_path do |f| %>
<div class="form-group" style="max-width: 500px;">
<%= form_with model: @new_team, url: create_team_path do |f| %>
<div class="form-group sci-input-container" style="max-width: 500px;">
<label><%= t('users.settings.teams.new.name_label') %></label>
<%= f.text_field :name,
label: t('users.settings.teams.new.name_label'),
autofocus: true,
class: 'sci-input-field',
placeholder: t('users.settings.teams.new.name_placeholder') %>
<small>
<%=t 'users.settings.teams.new.name_sublabel' %>

View file

@ -1,8 +1,8 @@
<%= bootstrap_form_for user_assignment,
url: destroy_user_team_path(user_assignment, format: :json),
remote: :true,
method: :delete,
data: { id: 'destroy-user-team-form' } do |f| %>
<%= form_with model: user_assignment,
url: destroy_user_team_path(user_assignment, format: :json),
remote: :true,
method: :delete,
data: { id: 'destroy-user-team-form' } do |f| %>
<p><%= t("users.settings.user_teams.destroy_uo_message",
user: user_assignment.user.full_name,
team: user_assignment.assignable.name) %></p>

View file

@ -1,8 +1,8 @@
<%= bootstrap_form_for @user_assignment,
url: destroy_user_team_path(@user_assignment, format: :json),
remote: :true,
method: :delete,
data: { id: 'leave-user-team-form' } do |f| %>
<%= form_with model: @user_assignment,
url: destroy_user_team_path(@user_assignment, format: :json),
remote: :true,
method: :delete,
data: { id: 'leave-user-team-form' } do |f| %>
<%= hidden_field_tag :leave, true %>
<p><%= t("users.settings.user_teams.leave_uo_message", team: @user_assignment.team.name) %></p>
<div class="alert alert-danger" role="alert">