Skip to content

Commit

Permalink
added: button to add a blank embedded item to the content
Browse files Browse the repository at this point in the history
  • Loading branch information
jdalsem committed May 13, 2024
1 parent 225edad commit c86ff05
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
4 changes: 4 additions & 0 deletions languages/en.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@

// embed
'newsletter:embed:show_all' => "Show all content, not just group content",
'newsletter:embed:blank' => "Add empty item",
'newsletter:embed:blank:title' => "Item title",
'newsletter:embed:blank:description' => "Item description",
'newsletter:embed:blank:img' => "Add image here",
'newsletter:embed:format:description:title' => "Show description",
'newsletter:embed:format:description:option:full' => "Full",
'newsletter:embed:format:description:option:excerpt' => "Excerpt",
Expand Down
4 changes: 4 additions & 0 deletions languages/nl.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@
'newsletter:action:unsubscribe:success:all' => 'Je bent uitgeschreven van alle nieuwsbrieven',
'newsletter:action:unsubscribe:success:entity' => 'Je bent uitgeschreven van de %s nieuwsbrief',
'newsletter:embed:show_all' => 'Toon all content, niet alleen van de groep',
'newsletter:embed:blank' => 'Blanco item toevoegen',
'newsletter:embed:blank:title' => "Item titel",
'newsletter:embed:blank:description' => "Item omschrijving",
'newsletter:embed:blank:img' => "Hier afbeelding invoegen",
'newsletter:embed:format:description:title' => 'Toon tekst van de content',
'newsletter:embed:format:description:option:full' => 'Volledig',
'newsletter:embed:format:description:option:excerpt' => 'Klein stukje (met meer knop)',
Expand Down
19 changes: 19 additions & 0 deletions views/default/ckeditor/config/newsletter.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,25 @@ define(['jquery', 'elgg', 'elgg/hooks', 'elgg/i18n', 'elgg/lightbox', 'elgg/Ajax
}
});
});

$(document).on('click', '#newsletter-embed-add-blank', function(event) {
event.preventDefault();

var content = '';

content += "<table class='newsletter-item' style='width: 100%'>";
content += "<tr><td>" + i18n.echo('newsletter:embed:blank:img') + "</td></tr>";
content += "<tr><td><h3>";
content += "<a href='#'>" + i18n.echo('newsletter:embed:blank:title') + "</a>";
content += "</h3></td></tr>";
content += "<tr><td>";
content += i18n.echo('newsletter:embed:blank:description');
content += "<p class='newsletter-read-more'><a href='#'>" + i18n.echo('newsletter:embed:read_more') + " ></a></p>";
content += "</td></tr>";
content += "</table>";

embed(content);
});

$(document).on('change', '#newsletter-embed-format-description, #newsletter-embed-format-icon', function() {
embed_format_preview();
Expand Down
2 changes: 1 addition & 1 deletion views/default/forms/newsletter/edit/content.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#newsletter-embed-list {
width: 700px;
max-width: 1000px;

> li {
padding: 5px;
Expand Down
5 changes: 5 additions & 0 deletions views/default/newsletter/embed.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@
'#type' => 'submit',
'text' => elgg_echo('search'),
],
[
'#type' => 'button',
'id' => 'newsletter-embed-add-blank',
'text' => elgg_echo('newsletter:embed:blank'),
],
],
]);

Expand Down

0 comments on commit c86ff05

Please sign in to comment.