diff --git a/app/views/fields/rich_text/_form.html.erb b/app/views/fields/rich_text/_form.html.erb new file mode 100644 index 0000000000..d45bb4404c --- /dev/null +++ b/app/views/fields/rich_text/_form.html.erb @@ -0,0 +1,22 @@ +<%# +# Text Form Partial + +This partial renders a textarea element for a text attribute. + +## Local variables: + +- `f`: + A Rails form generator, used to help create the appropriate input fields. +- `field`: + An instance of [Administrate::Field::Text][1]. + A wrapper around the Text pulled from the database. + +[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Text +%> + +
+ <%= f.label field.attribute %> +
+
+ <%= f.rich_text_area field.attribute, data: { controller: "mentions", target: "mentions.field" } %> +
diff --git a/app/views/fields/rich_text/_index.html.erb b/app/views/fields/rich_text/_index.html.erb new file mode 100644 index 0000000000..a70d6b53ae --- /dev/null +++ b/app/views/fields/rich_text/_index.html.erb @@ -0,0 +1,18 @@ +<%# +# Text Index Partial + +This partial renders a text attribute +to be displayed on a resource's index page. + +By default, the attribute is rendered as a truncated string. + +## Local variables: + +- `field`: + An instance of [Administrate::Field::Text][1]. + A wrapper around the Text pulled from the database. + +[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Text +%> + +<%= field.truncate %> diff --git a/app/views/fields/rich_text/_show.html.erb b/app/views/fields/rich_text/_show.html.erb new file mode 100644 index 0000000000..25c569bf80 --- /dev/null +++ b/app/views/fields/rich_text/_show.html.erb @@ -0,0 +1,18 @@ +<%# +# Text Show Partial + +This partial renders a text attribute, +to be displayed on a resource's show page. + +By default, the attribute is rendered as text with whitespace preserved. + +## Local variables: + +- `field`: + An instance of [Administrate::Field::Text][1]. + A wrapper around the Text pulled from the database. + +[1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Text +%> + +
<%= field.data %>
diff --git a/lib/administrate/field/rich_text.rb b/lib/administrate/field/rich_text.rb new file mode 100644 index 0000000000..5159c9d0a2 --- /dev/null +++ b/lib/administrate/field/rich_text.rb @@ -0,0 +1,11 @@ +require "administrate/field/text" + +module Administrate + module Field + class RichText < Administrate::Field::Text + def to_s + data + end + end + end +end