All Projects → simplygoodwork → craft-donkeytail

simplygoodwork / craft-donkeytail

Licence: other
A Craft CMS fieldtype for content managing points on images.

Programming Languages

PHP
23972 projects - #3 most used programming language
Vue
7211 projects
Twig
543 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to craft-donkeytail

craft-audit
Audit log for Craft 3
Stars: ✭ 18 (-66.04%)
Mutual labels:  craftcms, craft-plugin, craftcms-plugin
tablemaker
A user-definable table field type for Craft CMS
Stars: ✭ 39 (-26.42%)
Mutual labels:  craftcms, craft-plugin, craftcms-plugin
Craft-User-Manual
📚 Help Section Plugin for Craft CMS.
Stars: ✭ 86 (+62.26%)
Mutual labels:  craftcms, craft-plugin, craftcms-plugin
smartdown.craft-plugin
Bringing the unbridled joy of Markdown Extra and Smartypants to your Craft websites.
Stars: ✭ 26 (-50.94%)
Mutual labels:  craftcms, craft-plugin, craftcms-plugin
craft-entry-instructions
A simple fieldtype to add instructions.
Stars: ✭ 16 (-69.81%)
Mutual labels:  craftcms, craft-plugin, craftcms-plugin
Craft-Twig-ImageBase64
A simple Twig extension for Craft CMS to create base64-encoded images from Assets in your Twig templates.
Stars: ✭ 14 (-73.58%)
Mutual labels:  craftcms, craft-plugin, craftcms-plugin
craft-react
Client and Server-side React rendering for CraftCMS
Stars: ✭ 40 (-24.53%)
Mutual labels:  craftcms, craft-plugin, craftcms-plugin
SecureAssetDownload
Craft CMS plugin for secure asset download URLs
Stars: ✭ 22 (-58.49%)
Mutual labels:  craftcms, craft-plugin, craftcms-plugin
craft-recaptcha
Integrate Google’s reCAPTCHA into your web forms.
Stars: ✭ 16 (-69.81%)
Mutual labels:  craftcms, craft-plugin, craftcms-plugin
overflow.craft-plugin
A plain text Craft field type, with a soft or hard character limit.
Stars: ✭ 13 (-75.47%)
Mutual labels:  craftcms, craft-plugin, craftcms-plugin
craft-json-snippets
Helps make CraftCMS models in .json
Stars: ✭ 17 (-67.92%)
Mutual labels:  craftcms, craft-plugin, craftcms-plugin
craft-entriessubset
Craft field type plugin that extends the core Entries field type to give extra settings
Stars: ✭ 27 (-49.06%)
Mutual labels:  craftcms, craft-plugin, craftcms-plugin
Form-Builder
Craft CMS plugin that lets you create and manage forms for your front-end.
Stars: ✭ 16 (-69.81%)
Mutual labels:  craftcms, craftcms-plugin
craft3-sitecopy
With this plugin you can copy the content of an entry to another site.
Stars: ✭ 22 (-58.49%)
Mutual labels:  craftcms, craft-plugin
VarnishPurge-Craft
Craft plugin for purging Varnish when elements are saved.
Stars: ✭ 33 (-37.74%)
Mutual labels:  craftcms, craftcms-plugin
craft-assetusage
Craft plugin adds a column to see which assets are used or unused.
Stars: ✭ 28 (-47.17%)
Mutual labels:  craftcms, craftcms-plugin
craft-router
A Craft CMS plugin for using URL segments as filtering criteria on an entry query.
Stars: ✭ 21 (-60.38%)
Mutual labels:  craftcms, craft-plugin
Spoon
Spoon plugin for Craft CMS - Enhance your Matrix fields with groups, tabs and more!
Stars: ✭ 82 (+54.72%)
Mutual labels:  craftcms, craft-plugin
craft3-collections
Clean up those complex templates with Laravel Collections
Stars: ✭ 24 (-54.72%)
Mutual labels:  craftcms, craftcms-plugin
craft3-forms
This craft CMS 3 form plugin makes it easy to create and use custom forms with the features the Yii 2 Framework offers. On top of this, the plugin provides even more functionalities for easy implementation of forms in twig templates.
Stars: ✭ 20 (-62.26%)
Mutual labels:  craftcms, craft-plugin

Donkeytail plugin for Craft CMS 4.x

Donkeytail is a Craft CMS 4 fieldtype that allows you to quickly and easily content manage element points on images. You can use it for locations on a faux map, showcasing multiple products within an image, or even pinning the tail on a donkey.

Screenshot

Follow the @simplygoodwork Twitter account for updates.

Requirements

This plugin requires Craft CMS 4.0.0-alpha or later.

Installation

To install the plugin, follow these instructions.

  1. Open your terminal and go to your Craft project:

    cd /path/to/project
    
  2. Then tell Composer to load the plugin:

    composer require simplygoodwork/craft-donkeytail
    
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Donkeytail.

Usage

Terminology

In Donkeytail, the image asset you’re adding points to is called the canvas and the point entries you’re adding are called pins.

Templating

The following attributes are available from your donkeytail field:

  • canvas: The canvas asset element.

  • pins: Array of pins attached to canvas:

    • element: The pin element.

    • x: The left percentage value of the pin's anchor point in relation to the canvas (without % suffix).

    • left: The left percentage value of the pin's anchor point in relation to the canvas (with % suffix).

    • y: The top percentage value of the pin's anchor point in relation to the canvas (without % suffix).

    • top: The top percentage value of the pin's anchor point in relation to the canvas (with % suffix).

    • style: Returns the top and left percentages as CSS style properties and values.

      • For example top: 42.121%; left: 88.1337%;.

GraphQL

The following attributes are available from your donkeytail field when accessed via graphql:

  • canvas: The canvas asset element.

  • pins: Pins attached to canvas:

    • x: The left percentage value of the pin's anchor point in relation to the canvas (without % suffix).

    • y: The top percentage value of the pin's anchor point in relation to the canvas (without % suffix).

  • {entry, asset, user, category, product, variant}: The pin element.

Real world example

You’ll need to render the canvas asset yourself as you normally would within a template.

A real world example would likely have the canvas in a parent container with position: relative. The dots can then be set to position: absolute and their positions output using an inline style attribute and {{ entry.donkeytailField.style }}. Don't forget to use negative margins or similar to move your frontend marker’s point to the match the anchor point of the dot, and to replace {donkeytailField} with your Donkeytail Field handle:

<div style="width: 50%; position: relative;">
  <img src="{{ entry.{donkeytailField}.canvas.url }}">
  {% for pin in entry.{donkeytailField}.pins %}
    <div style="position: absolute; z-index: 10; width: 10px; height: 10px; background-color: red; top:{{ pin.y }}%;left:{{ pin.x }}%;"></div>
  {% endfor %}
</div>

Or, if you want to show captions by default:

<div style="width: 50%; position: relative;">
  <img src="{{ entry.{donkeytailField}.canvas.url }}">
  {% for pin in entry.{donkeytailField}.pins %}
    <div style="position: absolute; z-index: 10; width: 10px; height: 10px; background-color: red; top:{{ pin.y }}%;left:{{ pin.x }}%;"></div>
    <div style="position: absolute; z-index: 10; background-color: rgba(0,0,0,.8); color: white; top:{{ pin.y }}%;left:{{ pin.x }}%;transform:translate(-50%, 100%);">
      {{ pin.element.title }}
    </div>
  {% endfor %}
</div>

Brought to you by Good Work. Happy Pinning!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].