Skip to content

Commit

Permalink
improvement: allow setting classenames for buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricerenck committed Feb 19, 2021
1 parent 4f296a6 commit c94ec96
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 30 deletions.
49 changes: 26 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,29 +91,32 @@ You could add it to your site.yml blueprint so you see the number of pending Kom

You can fine tune the komments to behave as you whish, use this options in `config.php` file.

| Option | Default | Description |
| --------------------------------- | ------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| `debug` | `false` | Enables debug mode and logs all webmentions to a file |
| `enable-webmention-support` | `true` | Listen to Webmentions and save them as komment |
| `webmention-auto-publish` | `true` | When you receive a webmention set status to published |
| `komment-auto-publish` | `false` | When you receive a komment set status to published |
| `send-mention-on-update` | `true` | Detect urls in your pages and send webmentions |
| `send-limit-to-templates` | `[]` | An array of template names (strings). When set webmentions will be sent only when this pages are updated |
| `send-mention-url-fields` | `['text']` | An array of fieldnames in which the plugin will search for urls |
| `send-to-mastodon-on-publish` | `false` | Send a post to mastodon when publishing a page |
| `mastodon-bearer` | - | Your Mastodon bearer Token |
| `mastodon-instance-url` | `'https://mastodon.social/api/v1/statuses‘` | Your Mastodon API Endpoint |
| `mastodon-text-field` | `'mastodonTeaser'` | The fieldname of the field you write your mastodon msg in, otherwise the title is used |
| `ping-archiveorg` | `false` | Enable if you want to inform archive.org when you update a page |
| `auto-delete-spam` | `true` | When comment spam is detected it will be rejected, set to false to just mark the comment as SPAM |
| `auto-disable-komments` | `0` | Disables the komment form after `n` number of days. Use `0` to never disable komments (default) |
| `auto-disable-komments-datefield` | `'date'` | Set a field to function as publish date field used for `auto-disable-komments` |
| `komment-icon-like` | '❤️' | The icon for likes in your komment list |
| `komment-icon-reply` | '💬' | The icon for replies/comments in your komment list |
| `komment-icon-repost` | '♻️' | The icon for reposts in your komment list |
| `komment-icon-mention` | '♻️' | The icon for mention in your komment list |
| `komment-icon-verified` | '✅' | The icon for the verify badge list |
| `replyClassNames` | '' | add classnames tto the reply link |
| Option | Default | Description |
| --------------------------------- | ------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| `debug` | `false` | Enables debug mode and logs all webmentions to a file |
| `enable-webmention-support` | `true` | Listen to Webmentions and save them as komment |
| `webmention-auto-publish` | `true` | When you receive a webmention set status to published |
| `komment-auto-publish` | `false` | When you receive a komment set status to published |
| `send-mention-on-update` | `true` | Detect urls in your pages and send webmentions |
| `send-limit-to-templates` | `[]` | An array of template names (strings). When set webmentions will be sent only when this pages are updated |
| `send-mention-url-fields` | `['text']` | An array of fieldnames in which the plugin will search for urls |
| `send-to-mastodon-on-publish` | `false` | Send a post to mastodon when publishing a page |
| `mastodon-bearer` | - | Your Mastodon bearer Token |
| `mastodon-instance-url` | `'https://mastodon.social/api/v1/statuses‘` | Your Mastodon API Endpoint |
| `mastodon-text-field` | `'mastodonTeaser'` | The fieldname of the field you write your mastodon msg in, otherwise the title is used |
| `ping-archiveorg` | `false` | Enable if you want to inform archive.org when you update a page |
| `auto-delete-spam` | `true` | When comment spam is detected it will be rejected, set to false to just mark the comment as SPAM |
| `auto-disable-komments` | `0` | Disables the komment form after `n` number of days. Use `0` to never disable komments (default) |
| `auto-disable-komments-datefield` | `'date'` | Set a field to function as publish date field used for `auto-disable-komments` |
| `komment-icon-like` | '❤️' | The icon for likes in your komment list |
| `komment-icon-reply` | '💬' | The icon for replies/comments in your komment list |
| `komment-icon-repost` | '♻️' | The icon for reposts in your komment list |
| `komment-icon-mention` | '♻️' | The icon for mention in your komment list |
| `komment-icon-verified` | '✅' | The icon for the verify badge list |
| `replyClassNames` | '' | add classnames to the reply link |
| `form.submit.classNames` | `'button button-tiny button-primary'` | add classnames to the submit button |
| `form.twitter.classNames` | `'button button-tiny button-outlined share komment-share-twitter'` | add classnames to the twitter button |
| `form.mastodon.classNames` | `'button button-tiny button-outlined share komment-share-mastodon'` | add classnames to the mastodon button |

**Please make sure to prefix all the options with `mauricerenck.komments.`**. For example the debug option should be set in your `config.php` like so: `'mauricerenck.komments.debug' => true`

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mauricerenck/komments",
"version": "0.10.2",
"version": "0.10.3",
"description": "A comment and webmention plugin for Kirby 3",
"type": "kirby-plugin",
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions config/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@
'komment-icon-verified' => '',
'replyClassNames' => '',
'form.submit.classNames' => 'button button-tiny button-primary',
'form.twitter.classNames' => '',
'form.mastodon.classNames' => '',
'form.twitter.classNames' => 'button button-tiny button-outlined share komment-share-twitter',
'form.mastodon.classNames' => 'button button-tiny button-outlined share komment-share-mastodon',
];
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "komments",
"version": "0.10.2",
"version": "0.10.3",
"description": "A comment and webmention plugin for Kirby 3",
"main": "index.js",
"author": "Maurice Renck",
Expand Down
6 changes: 3 additions & 3 deletions snippets/kommentform.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<?php $actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . "://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; ?>
<div class="share-elsewhere">
<span><?php echo t('mauricerenck.komments.externalReply'); ?></span><br>
<a href="https://twitter.com/intent/tweet?url=<?php echo $actual_link; ?>" class="button button-tiny button-outlined share komment-share-twitter" target="_blank"><i class="fab fa-twitter"></i> Twitter</a>
<a href="https://www.addtoany.com/add_to/mastodon?linkurl=<?php echo $actual_link; ?>" class="button button-tiny button-outlined share komment-share-mastodon" target="_blank"><i class="fab fa-mastodon"></i> Mastodon</a>
<a href="https://twitter.com/intent/tweet?url=<?php echo $actual_link; ?>" class="<?php echo option('mauricerenck.komments.form.twitter.classNames', 'button button-tiny button-outlined share komment-share-twitter'); ?>" target="_blank"><i class="fab fa-twitter"></i> Twitter</a>
<a href="https://www.addtoany.com/add_to/mastodon?linkurl=<?php echo $actual_link; ?>" class="<?php echo option('mauricerenck.komments.form.mastodon.classNames', 'button button-tiny button-outlined share komment-share-mastodon'); ?>" target="_blank"><i class="fab fa-mastodon"></i> Mastodon</a>
</div>
<form action="<?= $kirby->url('index') ?>/komments/send" method="post" id="kommentform">
<div class="loading-invisible loader sk-cube-grid"><div class="sk-cube sk-cube1"></div><div class="sk-cube sk-cube2"></div><div class="sk-cube sk-cube3"></div><div class="sk-cube sk-cube4"></div><div class="sk-cube sk-cube5"></div><div class="sk-cube sk-cube6"></div><div class="sk-cube sk-cube7"></div><div class="sk-cube sk-cube8"></div><div class="sk-cube sk-cube9"></div></div>
Expand All @@ -40,6 +40,6 @@
<input type="hidden" name="replyHandle" value="">
<input type="hidden" name="cts" value="" class="cts">
<span class="komment-privacy"><?php echo t('mauricerenck.komments.form.privacy'); ?></span>
<input type="submit" value="<?php echo t('mauricerenck.komments.form.submit'); ?>" class="button button-tiny button-primary">
<input type="submit" value="<?php echo t('mauricerenck.komments.form.submit'); ?>" class="<?php echo option('mauricerenck.komments.form.submit.classNames', 'button button-tiny button-primary'); ?>">
</form>
<?php echo js(['/media/plugins/mauricerenck/komments/komments.js']); ?>

0 comments on commit c94ec96

Please sign in to comment.