Finalize check fields
This commit is contained in:
parent
63fc206c27
commit
174cf9f503
12 changed files with 73 additions and 34 deletions
|
|
@ -54,6 +54,6 @@ class LinksController < ApplicationController
|
|||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def link_params
|
||||
params.require(:link).permit(:url, :text, :description_html, :last_check_at, :fail_count, :link_category_id)
|
||||
params.require(:link).permit(:url, :text, :description, :link_category_id)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ module ApplicationHelper
|
|||
delegate :filter_params, to: :controller
|
||||
|
||||
def multilang_form_field(form, attribute, as: :text_field)
|
||||
return form.send(as, "#{attribute}_de")
|
||||
|
||||
col_width = as == :rich_text_area ? 12 : 12 / I18n.available_locales.count
|
||||
tag.div(class: "row") do
|
||||
fields = I18n.available_locales.map { _1.to_s.split("-").first }.map do |lang|
|
||||
|
|
|
|||
11
app/models/concerns/filter_scopeable.rb
Normal file
11
app/models/concerns/filter_scopeable.rb
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
module FilterScopeable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def filter_scope(name, block)
|
||||
define_method(name) do |filter_value|
|
||||
return self if filter_value.blank?
|
||||
|
||||
instance_exec(filter_value, &block)
|
||||
end
|
||||
end
|
||||
en
|
||||
|
|
@ -6,7 +6,7 @@ class Link < ApplicationRecord
|
|||
belongs_to :link_category
|
||||
has_and_belongs_to_many :checks
|
||||
|
||||
has_rich_text :description_html
|
||||
has_rich_text :description
|
||||
|
||||
validates :url, :text, presence: true
|
||||
validate :check_url
|
||||
|
|
|
|||
|
|
@ -1,27 +1,23 @@
|
|||
= bootstrap_form_with(model: check, remote: true) do |form|
|
||||
h2 Details
|
||||
= form.collection_select :principle_id, Principle.all.sort_by(&:t_name), :id, :t_name
|
||||
= form.text_field :number
|
||||
= multilang_form_field(form, :name)
|
||||
= form.collection_check_boxes :standard_ids, Standard.all.sort_by(&:t_name), :id, :t_name, include_blank: true
|
||||
= form.text_field :number
|
||||
.row
|
||||
= form.collection_radio_buttons(:principle_id, Principle.all.sort_by(&:t_name), :id, :t_name) { |b| b.label(class: "col-md-2") { b.radio_button + b.text } }
|
||||
= form.collection_check_boxes :standard_ids, Standard.all.sort_by{ _1.t_name.downcase }, :id, :t_name, include_blank: true
|
||||
h2 Zugänglichkeit
|
||||
.row
|
||||
.col-md-3
|
||||
= form.check_box :visual, label: t("disability.visual").capitalize
|
||||
.col-md-3
|
||||
= form.check_box :auditory, label: t("disability.auditory").capitalize
|
||||
.col-md-3
|
||||
= form.check_box :physical, label: t("disability.physical").capitalize
|
||||
.col-md-3
|
||||
= form.check_box :cognitive, label: t("disability.cognitive").capitalize
|
||||
- %w[visual auditory physical cognitive].sort_by { |d| t("disability.#{d}") }.each do |d|
|
||||
.col-md-3
|
||||
= form.check_box d, label: t("disability.#{d}").capitalize
|
||||
h2 Anwendbarkeit
|
||||
.row
|
||||
.col-md-6
|
||||
= form.check_box :applicable_to_web, label: t("applicability.applicable_to_web").capitalize
|
||||
.col-md-6
|
||||
= form.check_box :applicable_to_app, label: t("applicability.applicable_to_app").capitalize
|
||||
- %w[applicable_to_web applicable_to_app].sort_by { |d| t("applicability.#{d}") }.each do |d|
|
||||
.col-md-6
|
||||
= form.check_box d, label: t("applicability.#{d}").capitalize
|
||||
h2 Richtlinie
|
||||
= form.text_field :external_number
|
||||
= form.text_field :external_url
|
||||
= form.select :conformity_level, Check.conformity_levels.keys, include_blank: true
|
||||
= multilang_form_field(form, :conformity_notice, as: :rich_text_area)
|
||||
|
||||
|
|
@ -36,7 +32,6 @@
|
|||
= multilang_form_field(form, :criterion_details, as: :rich_text_area)
|
||||
= multilang_form_field(form, :example, as: :rich_text_area)
|
||||
= multilang_form_field(form, :exemption_details, as: :rich_text_area)
|
||||
= multilang_form_field(form, :standard_text, as: :rich_text_area)
|
||||
|
||||
h2 Intern
|
||||
= form.rich_text_area :test_instructions
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
<p>
|
||||
<strong>Description:</strong>
|
||||
<%= link.description_html %>
|
||||
<%= link.description %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
<td><%= link_to(link.link_category.name, url_for(link)) %></td>
|
||||
<td><%= link_to(truncate(link.url), link.url, target: "_blank", rel: "nofollow") %></td>
|
||||
<td><%= link_to(link.text, url_for(link)) %></td>
|
||||
<td><%= link_to(truncate(link.description_html.to_plain_text), url_for(link)) %></td>
|
||||
<td><%= link_to(truncate(link.description.to_plain_text), url_for(link)) %></td>
|
||||
<td><%= link.last_check_at && l(link.last_check_at, format: :short) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue