Skip to content

Commit

Permalink
Issue #1: Clean up and basic functionality.
Browse files Browse the repository at this point in the history
  • Loading branch information
laryn committed Dec 17, 2024
1 parent a4ebdfb commit 5ad682d
Show file tree
Hide file tree
Showing 7 changed files with 207 additions and 529 deletions.
29 changes: 15 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,50 @@
# Expanding Formatter

This module provides a formatter for existing text, long text and text with
summary widget types. This module allows you to change how the content is being
This module provides a formatter for existing text, long text and text with
summary widget types. This module allows you to change how the content is being
displayed (formatted) by providing new format types:

- Trimmed (expandable)
- Summary or Trimmed (expandable)

![Expanding Formatter](https://github.com/backdrop-contrib/expanding_formatter/blob/1.x-1.x/images/expanding_formatter.gif "Expanding formatter demo")

## Features

- CSS3 Transition effects (with jQuery fallback if disabled):
- CSS Transition effects:
- None (just toggle visibility immediately)
- Fade
- Slide
- Customizable/themable ellipsis
- Customizable labels for trigger (collapsible, if you need to create a toggle)
- Customizable classes on trigger
- Customizable classes on trigger

## How to use this module:

Enable the module and go to your content type's display
(e.g. `admin/structure/types/manage/page/display`). You will see fields
(like `Body`) that allow you to adjust the `Format` – you can now choose
"Trimmed (expandable)". Once you've selected this format, you will have
Enable the module and go to your content type's display
(e.g. `admin/structure/types/manage/page/display`). You will see fields
(like `Body`) that allow you to adjust the `Format` – you can now choose
"Trimmed (expandable)". Once you've selected this format, you will have
additional configuration options.

![Expanding Formatter Display Settings](https://github.com/backdrop-contrib/expanding_formatter/blob/1.x-1.x/images/expanding_formatter_display.png "Expanding formatter display settings")

## Issues

Bugs and Feature requests should be reported in the
Bugs and Feature requests should be reported in the
[Issue Queue](https://github.com/backdrop-contrib/expanding_formatter/issues)

## Current Maintainers

- [Laryn Kragt Bakker](https://github.com/laryn) - [CEDC.org](https://cedc.org)
- [Laryn Kragt Bakker](https://github.com/laryn).

## Credits

- Ported to Backdrop CMS by [Laryn Kragt Bakker](https://github.com/laryn) - [CEDC.org](https://cedc.org).
- Ported to Backdrop CMS by [Laryn Kragt Bakker](https://github.com/laryn).
- Initial port to Backdrop sponsored by [CEDC.org](https://cedc.org).
- Maintainer for the Drupal module: [Mark Carver](https://github.com/markcarver).

## License

This project is GPL v2 software. See the [LICENSE.txt](https://github.com/backdrop-contrib/expanding_formatter/blob/1.x-1.x/LICENSE.txt)
file in this directory for complete text.
This project is GPL v2 software. See the [LICENSE.txt](https://github.com/backdrop-contrib/expanding_formatter/blob/1.x-1.x/LICENSE.txt)
file in this directory for complete text.
24 changes: 0 additions & 24 deletions config.rb

This file was deleted.

36 changes: 12 additions & 24 deletions css/expanding_formatter.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,63 +27,51 @@
.expanding-formatter .expanding-formatter-ellipsis {
margin-right: .25em;
}
.expanding-formatter[data-css3="1"].collapsed.sliding .expanding-formatter-ellipsis, .expanding-formatter[data-css3="1"].collapsed[data-effect="slide"]:not(.sliding) .expanding-formatter-content {
.expanding-formatter.collapsed.sliding .expanding-formatter-ellipsis, .expanding-formatter.collapsed[data-effect="slide"]:not(.sliding) .expanding-formatter-content {
display: none;
}
.expanding-formatter[data-css3="1"].collapsed .trigger {
.expanding-formatter.collapsed .trigger {
display: inline;
}
.expanding-formatter[data-css3="1"][data-effect="slide"] {
-webkit-transition: height 500ms ease;
-moz-transition: height 500ms ease;
-o-transition: height 500ms ease;
.expanding-formatter[data-effect="slide"] {
transition: height 500ms ease;
}
.expanding-formatter[data-css3="1"][data-effect="fade"] .expanding-formatter-content {
-webkit-transition: opacity 500ms ease;
-moz-transition: opacity 500ms ease;
-o-transition: opacity 500ms ease;
.expanding-formatter[data-effect="fade"] .expanding-formatter-content {
transition: opacity 500ms ease;
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
opacity: 0;
overflow: hidden;
}
.expanding-formatter[data-css3="1"][data-effect="fade"] .expanding-formatter-trigger {
-webkit-transition: opacity 500ms ease;
-moz-transition: opacity 500ms ease;
-o-transition: opacity 500ms ease;
.expanding-formatter[data-effect="fade"] .expanding-formatter-trigger {
transition: opacity 500ms ease;
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
opacity: 0;
}
.expanding-formatter[data-css3="1"][data-effect="fade"].fading .expanding-formatter-trigger {
-webkit-transition: none;
-moz-transition: none;
-o-transition: none;
.expanding-formatter[data-effect="fade"].fading .expanding-formatter-trigger {
transition: none;
}
.expanding-formatter[data-css3="1"][data-effect="fade"].collapsed .expanding-formatter-content {
.expanding-formatter[data-effect="fade"].collapsed .expanding-formatter-content {
clip: rect(1px 1px 1px 1px);
clip: rect(1px, 1px, 1px, 1px);
height: 1px;
overflow: hidden;
position: absolute !important;
width: 1px;
}
.expanding-formatter[data-css3="1"][data-effect="fade"].collapsed .expanding-formatter-trigger {
.expanding-formatter[data-effect="fade"].collapsed .expanding-formatter-trigger {
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
opacity: 1;
}
.expanding-formatter[data-css3="1"][data-effect="fade"].collapsed.fading .expanding-formatter-content, .expanding-formatter[data-css3="1"][data-effect="fade"].collapsed.fading .expanding-formatter-trigger {
.expanding-formatter[data-effect="fade"].collapsed.fading .expanding-formatter-content, .expanding-formatter[data-effect="fade"].collapsed.fading .expanding-formatter-trigger {
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
opacity: 0;
}
.expanding-formatter[data-css3="1"][data-effect="fade"].expanded .expanding-formatter-content,
.expanding-formatter[data-css3="1"][data-effect="fade"].expanded .expanding-formatter-trigger {
.expanding-formatter[data-effect="fade"].expanded .expanding-formatter-content,
.expanding-formatter[data-effect="fade"].expanded .expanding-formatter-trigger {
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
opacity: 1;
}
.expanding-formatter[data-css3="1"][data-effect="fade"].expanded.fading .expanding-formatter-content, .expanding-formatter[data-css3="1"][data-effect="fade"].expanded.fading .expanding-formatter-trigger {
.expanding-formatter[data-effect="fade"].expanded.fading .expanding-formatter-content, .expanding-formatter[data-effect="fade"].expanded.fading .expanding-formatter-trigger {
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
opacity: 0;
}
110 changes: 110 additions & 0 deletions css/expanding_formatter.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
// Defaults
.expanding-formatter {
overflow: hidden;
position: relative;

&.expanded .expanding-formatter-ellipsis {
display: none;
}

// Inline summary/expanded content.
&[data-inline="1"] {
p {
margin: 0 0 1.2em;
}

p:nth-child(2) {
margin-top: 1.2em;
}

p:first-child,
p:last-child {
display: inline;
margin-bottom: 0;
}

.expanding-formatter-summary,
.expanding-formatter-content {
display: inline;
}

.expanding-formatter-trigger {
display: inline-block;
margin-bottom: 5px;
}
}

// Margin for ellipsis.
.expanding-formatter-ellipsis {
margin-right: .25em;
}

// Collapsed
&.collapsed {

&.sliding .expanding-formatter-ellipsis,
&[data-effect="slide"]:not(.sliding) .expanding-formatter-content {
display: none;
}

.trigger {
display: inline;
}
}

// Slide effect
&[data-effect="slide"] {
@include transition(height 500ms ease);
}

// Fade effect
&[data-effect="fade"] {
.expanding-formatter-content {
@include transition(opacity 500ms ease);
@include opacity(0);
overflow: hidden;
}

.expanding-formatter-trigger {
@include transition(opacity 500ms ease);
@include opacity(0);
}

&.fading .expanding-formatter-trigger {
@include transition(none);
}

&.collapsed {
.expanding-formatter-content {
clip: rect(1px 1px 1px 1px);
clip: rect(1px, 1px, 1px, 1px);
height: 1px;
overflow: hidden;
position: absolute !important;
width: 1px;
}

.expanding-formatter-trigger {
@include opacity(1);
}

&.fading .expanding-formatter-content,
&.fading .expanding-formatter-trigger {
@include opacity(0);
}
}

&.expanded {

.expanding-formatter-content,
.expanding-formatter-trigger {
@include opacity(1);
}

&.fading .expanding-formatter-content,
&.fading .expanding-formatter-trigger {
@include opacity(0);
}
}
}
}
Loading

0 comments on commit 5ad682d

Please sign in to comment.