Poodll Snippet

Atto ::: atto_snippet
Maintained by Justin Hunt
Poodll Snippet is simple html/text template tool for Moodle's Atto editor. Use it to add text, layouts, buttons and other content from templates directly into Moodle HTML areas.
Latest release:
688 sites
193 downloads
32 fans
Current versions available: 1
Snippet is a template solution for Moodle content creation. Templates and variables(placeholders) are declared in the admin settings for the plugin. When the icon is click on the Atto editor, the user can choose the template and the values for each of the variables. The placeholders and template are then merged to create the final content which is then inserted on the page.

Snippet has no filter plugin companion. It returns html directly to the text area. This is useful when the content doesn't need javascript, and has the benefit that the content is instantly visible and editable in the text area (ie without filtering). As an example of this, the Youtube template will display a Youtube video in the html editor text area immediately.


Installation

If using zip, first download and unzip the file, and place the snippet folder in your Moodle's /lib/editor/atto/plugins folder. Or use git directly from the /lib/editor/atto/plugins folder, ie
git clone https://github.com/justinhunt/moodle-atto_snippet.git snippet

Then visit your site admin's notifications page. The plugin installer will walk through the installation process. At the end you will see a list of 5 templates. You can leave them for now and fill them in later.  3 of the templates are blank, and a helloworld and a youtube template are automatically created for you.

Before the Snippet icon will be visible in the Atto toolbar you will need to visit site admin -> plugins -> text editors -> atto -> atto toolbar settings, and add "snippet" to the list of icons to display. There is a text area towards the bottom of the page for this purpose.


Using Snippet

To use a snippet, look for the spider web/cog icon on the text editor. (Feel free to submit a cooler icon.) Checking on that should open the Snippet dialog with a button for each snippet.

To make a snippet, find an empty snippet template page in the plugin's admin settings, site admin -> plugins -> text editors -> atto -> Snippet(Atto) -> Snippets. Enter a name for the snippet, the content of the snippet and any default variable values. Variables can be used in the snippet content and are surrounded by {{ or }} marks. Like this: {{bigvariable}}


An example snippet:
Snippet Name
sweety

Snippet
My sweet food on {{weekday}} is: {{mysweety}}

Defaults
mysweety=candy,weekday=Monday

This could display as:
My sweet food on Thursday is: cake

If you run out of blank snippet templates, you can always create more. Set the number of snippets on the general settings page.
site admin -> plugins -> text editors -> atto -> Snippet(atto) -> General Settings

Presets

There is a dropdown list of presets at the top of each snippet settings page. These will fill the template page in with the details of a preset template. You can make your own presets and share them too. To do this you can the template by mouse clicking on the green "bundle" box on the top right of the template settings page. It will download as a .txt file. Drag an exported .txt file over the green bundle box on a blank template settings page to import it.


If you wish your exported template to appear in the presets dropdown you must place the .txt file in the presets folder under /lib/editor/atto/plugins/snippet. Or in a folder called "snippet" in your theme.



Screenshots

Screenshot #0
Screenshot #1
Screenshot #2
Screenshot #3
Screenshot #4

Contributors

Justin Hunt (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Comments

  • Plugins bot
    Mon, 17 Apr 2017, 1:40 PM
    Approval issue created: CONTRIB-6863
  • Richard Oelmann
    Sun, 1 Oct 2017, 5:34 PM
    Hi Justin, Is there anywhere else to get more information about adding snippets to themes, and also is there any location for gathering collected snippets people have created (or bundles etc)
  • Justin Hunt
    Mon, 2 Oct 2017, 10:24 AM
    Hi Richard. I wish I had better answers for you to be honest. Snippet's cousin's Generico has a place to share templates here .. https://moodle.org/plugins/browse.php?list=category&id=38. Though I have not found time to pump prime that. The idea was to do the same with snippets. But I need a bit of a rev up I guess.

    Adding a snippet to the theme is pretty simple. I added a note just now to the readme on github. https://github.com/justinhunt/moodle-atto_snippet . You just add a folder called "snippet" and put the template bundle files in there. The same thing works for Generico actually, except the folder is called "generico." It would be really nice if we had a one button installer to setup such templates so that it "just worked" without the added step of having to go off to snippet/generico and set them up. Let me know if you think thats a good idea and I will look into it.
  • Ricardo Caiado
    Sun, 18 Mar 2018, 4:34 AM
    Hi,
    Any updates do Moodle 3.4?

    Ricardo
  • Birgit Lachner
    Thu, 30 Aug 2018, 3:52 PM
    A great tool ... but in the moodle instances that are hostet by our county, the normal users and even the local responsible teacher that organizes the moodle instance for a single school could not change or add snippets, because he does not have access to the plugin settings.

    Is there any chance to change this? May be to save the snippets to the profile of a single user?

    Regards and thanks for the Plugin, Birgit
  • Justin Hunt
    Tue, 4 Sept 2018, 7:40 PM
    Hi Birgit. Its a wee bit trickier than it sounds, but I think its functionality that we need. I will put my thinking cap on.
  • Elliot Bannister
    Thu, 29 Aug 2019, 4:28 AM
    Yooo this is such a helpful plugin!
  • Serge Fleussu
    Fri, 30 Aug 2019, 11:47 PM
    HI,
    This is a great plugin to include repeating strings with paramaters like authors, creative commons ...
    Is it possible to use selected text in the template ? (I mean, I select the text first, I choose a snippet and the result contains the selected text, as it would be to have italic, something like "@@SelectedText@@)
    Thanks for this very useful plugin
  • QLD BNE
    Tue, 31 Aug 2021, 5:07 AM
    Our school loading all policies to moodle platform but we have a big challenge. This plug in seems the closest one to solve the issue. There are responsible persons names in some of policies in multiple documents. When these people change their positions we have to go through all documents and update manually and likely we miss some. Can this snippet be configured the way we can actually insert at the beginning and when a change required, we can only change from the template and it updates across the site automatically?
  • Justin Hunt
    Tue, 31 Aug 2021, 8:45 AM
    Hi QLD BNE
    Text inserted by Snippet, can not be later be changed by changing the template.
    For that purpose use the Generico Filter and the Generico Atto plugin. It does exactly what you need.
  • Grzesiek Rogala
    Sun, 24 Sept 2023, 6:40 AM
    Great Plug-in but the icon in the Atto editor is very pixelated. I created two vector icons (white and dark) if you would like to grab them. How can I contribute them? Thanks!
  • Iñigo Zendegi Urzelai
    Mon, 25 Sept 2023, 4:36 PM
    Hi Justin, we love this plugin and use it extensively, is there in the roadmap any plans to adapt it to TinyMCE?

    It will become the default editor on Moodle 4.3

    TIA
  • Justin Hunt
    Tue, 26 Sept 2023, 10:35 AM
    @Grzesiek Thanks for the icons. That sounds great. Send them to support [at] poodll.freshdesk.com
  • Justin Hunt
    Tue, 26 Sept 2023, 10:36 AM
    @Iñigo Yes we will make a TinyMCE plugin. The TinyMCE change has been hard on the free plugins, but I will get to it before 4.3 I hope
Please login to post comments