Remove 'dynamic_form' (#888)

Old, unmaintained dep for trivial code.
This commit is contained in:
Alessandro Minali 2020-08-19 13:58:43 +00:00 committed by GitHub
parent 2ac334dba5
commit 142edb664e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 20 additions and 32 deletions

View File

@ -14,7 +14,6 @@ gem "activerecord-typedstore"
gem 'sprockets-rails', '2.3.3'
# js
gem "dynamic_form"
gem "jquery-rails", "~> 4.3"
gem "json"
gem "uglifier", ">= 1.3.0"

View File

@ -88,7 +88,6 @@ GEM
crass (1.0.6)
database_cleaner (1.8.5)
diff-lcs (1.4.4)
dynamic_form (1.1.4)
erubi (1.9.0)
exception_notification (4.4.3)
actionmailer (>= 4.0, < 7)
@ -284,7 +283,6 @@ DEPENDENCIES
capybara
commonmarker (~> 0.14)
database_cleaner
dynamic_form
exception_notification
factory_bot_rails
faker

View File

@ -1156,8 +1156,7 @@ table.data pre {
div.flash-error,
div.flash-notice,
div.flash-success,
div.errorExplanation {
div.flash-success {
position: relative;
padding: 7px 15px;
margin-bottom: 18px;
@ -1175,8 +1174,7 @@ div.errorExplanation {
}
div.flash-error a,
div.flash-notice a,
div.flash-success a,
div.errorExplanation a {
div.flash-success a {
font-weight: bold;
color: #404040;
}
@ -1187,20 +1185,17 @@ div.flash-success p a {
}
div.flash-error p,
div.flash-notice p,
div.flash-success p,
div.errorExplanation p {
div.flash-success p {
margin-bottom: 0;
}
div.flash-error div,
div.flash-notice div,
div.flash-success div,
div.errorExplanation div {
div.flash-success div {
margin-top: 5px;
margin-bottom: 2px;
line-height: 28px;
}
div.flash-error,
div.errorExplanation {
div.flash-error {
background-color: #fdcfcc;
background-repeat: repeat-x;
background-image: linear-gradient(top, #ee5f5b, #c43c35);
@ -1227,19 +1222,11 @@ div.flash-notice {
div.flash-error h2,
div.flash-notice h2,
div.flash-success h2,
div.errorExplanation h2 {
div.flash-success h2 {
font-size: 1.25em;
margin: 0;
}
/* for error_messages_for() */
div.fieldWithErrors {
display: inline;
}
/* select2 deuglification */
.select2-container-multi.select2-container-active .select2-choices {

View File

@ -21,14 +21,18 @@ module ApplicationHelper
}, " ")
end
def errors_for(object, _message = nil)
def errors_for(object)
html = ""
unless object.errors.blank?
html << "<div class=\"flash-error\">\n"
html << "<div class=\"flash-error\">"
html << "<h2>#{pluralize(object.errors.count, 'error')} prohibited this \
#{object.class.name.downcase} from being saved</h2>"
html << "<p>There were the problems with the following fields:</p>"
html << "<ul>"
object.errors.full_messages.each do |error|
html << error << "<br>"
html << "<li>#{error}</li>"
end
html << "</div>\n"
html << "</ul></div>"
end
raw(html)

View File

@ -4,7 +4,7 @@
</div>
<%= form_with url: set_new_password_path, autocomplete: 'off', local: true do |f| %>
<%= error_messages_for(@reset_user) %>
<%= errors_for(@reset_user) %>
<%= f.hidden_field "token", :value => params[:token] %>

View File

@ -1,5 +1,5 @@
<%= form_with model: @new_message, url: new_message, method: :post, local: true do |f| %>
<%= error_messages_for @new_message %>
<%= errors_for @new_message %>
<% if replying %>
<%= f.hidden_field :recipient_username %>

View File

@ -11,7 +11,7 @@
</div>
<%= form_with model: @edit_user, url: settings_path, method: :post, id: 'edit_user', local: true do |f| %>
<%= error_messages_for f.object %>
<%= errors_for f.object %>
<div class="boxline">
<%= f.label :username, "Username:", :class => "required" %>

View File

@ -11,7 +11,7 @@
alerts. Your username can be changed later.
</p>
<%= error_messages_for(@new_user) %>
<%= errors_for(@new_user) %>
<% if not Rails.application.open_signups? %>
<%= f.hidden_field "invitation_code", :value => @invitation.code, :name => :invitation_code %>

View File

@ -1,7 +1,7 @@
<div>
<div class="form_errors_header">
<% if story.errors.any? %>
<%= error_messages_for story %>
<%= errors_for story %>
<% elsif !story.errors.any? && story.public_similar_stories.any? %>
<div class="flash-notice">
<h2>Note: This story was already submitted <%= time_ago_in_words_label(story.most_recent_similar.created_at) %>, but may be submitted again.</h2>

View File

@ -191,7 +191,7 @@
mod_notes: ModNote.for(@showing_user).limit(10),
} %>
<%= form_with model: @mod_note, method: :post, local: true do |f| %>
<%= error_messages_for @mod_note %>
<%= errors_for @mod_note %>
<%= f.hidden_field :username %>
<div class="boxline">
<%= f.label :note, "New Note:", :class => "required" %>