forked from thoughtbot/administrate
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
%> | ||
|
||
<div class="field-unit__label"> | ||
<%= f.label field.attribute %> | ||
</div> | ||
<div class="field-unit__field"> | ||
<%= f.rich_text_area field.attribute, data: { controller: "mentions", target: "mentions.field" } %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
%> | ||
|
||
<div class="preserve-whitespace"><%= field.data %></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |