-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1189 from codidact/0valt/1145/show-min-length-cha…
…r-reqs
- Loading branch information
Showing
6 changed files
with
106 additions
and
73 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
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
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
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
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
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,28 @@ | ||
<%# | ||
Reusable helper view for character count requirements. | ||
Variables: | ||
cur : current number of characters (default 0) | ||
max : maximum number of characters allowed (default 255) | ||
min : minimum number of characters allowed (default 0) | ||
threshold : fraction of max to show the count at (default 0.75) | ||
type : character count type (e.g.: post-title) | ||
%> | ||
|
||
<% | ||
# defaults & normalization | ||
cur ||= defined?(cur) && !cur.nil? ? cur.to_i : 0 | ||
max ||= defined?(max) && !max.nil? ? max.to_i : 255 | ||
min ||= defined?(min) && !min.nil? ? min.to_i : 0 | ||
threshold ||= defined?(threshold) && !threshold.nil? ? threshold.to_f : 0.75 | ||
%> | ||
|
||
<span class="has-float-right has-font-size-caption js-character-count-<%= type %>" | ||
data-max="<%= max %>" | ||
data-min="<%= min %>" | ||
data-threshold="<%= threshold %>"> | ||
<i class="fas fa-ellipsis-h js-character-count__icon"></i> | ||
<span class="js-character-count__count"> | ||
<%= cur %> / <%= cur < min ? min : max %> | ||
</span> | ||
</span> |