From 65acc0295aced24c5a3fbfcdcec7b2cb29c97789 Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 1 May 2020 18:29:02 +0200 Subject: [PATCH] Some changes --- README.md | 4 ---- crowdin.yml | 9 ++++++++ public/js/emojionearea.js | 30 ++++++++++++++++++++------- src/Controller/FediPlanController.php | 6 ++++++ templates/fediplan/index.html.twig | 2 +- 5 files changed, 38 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 64ebf72..59d4276 100644 --- a/README.md +++ b/README.md @@ -27,9 +27,5 @@ See: [Download Composer](https://getcomposer.org/download/) Your site needs to target /path/to/FediPlan/public -#### TODO: - 1. Polls - 2. Autocompletion for mentions, tags and emojis - 3. Check and edit scheduled statuses. #### Support My work at [fedilab.app](https://fedilab.app/page/donations/) \ No newline at end of file diff --git a/crowdin.yml b/crowdin.yml index 2c30c66..eaf4db2 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -2,6 +2,15 @@ files: - source: /translations/fediplan.en.yaml translation: /%original_path%/fediplan.%two_letters_code%.%file_extension% update_option: update_without_changes + languages_mapping: + two_letters_code: + zh-TW: zh-TW + zh-CN: zh-CN + pt-PT: pt-PT + pt-BR: pt-BR + - source: /translations/fediplan+intl-icu.en.yaml + translation: /%original_path%/fediplan+intl-icu.%two_letters_code%.%file_extension% + update_option: update_without_changes languages_mapping: two_letters_code: zh-TW: zh-TW diff --git a/public/js/emojionearea.js b/public/js/emojionearea.js index 02d59bb..1d9fb1d 100644 --- a/public/js/emojionearea.js +++ b/public/js/emojionearea.js @@ -1430,7 +1430,7 @@ document = window.document || {}; editor.textcomplete([ { id: css_class, - match: /\B((:[\-+\w]*)|(@[\-+\w]*))$/, + match: /\B((:[\-+\w]*)|(@[\-+\w]*)|(#[\-+\w]*))$/, search: function (term, callback) { if (term.startsWith(":")) { @@ -1443,27 +1443,41 @@ document = window.document || {}; headers: {"Authorization": $('#data_api').attr('data-token')}, context: document.body }).done(function(value) { - // value = eval("(" + value + ")"); callback($.map(value.accounts, function (value) { return value; })); }); + }else if (term.startsWith("#")){ + $.ajax({ + url: "https://"+$('#data_api').attr('data-instance')+"/api/v2/search?type=hashtags&q="+term.substring(1), + headers: {"Authorization": $('#data_api').attr('data-token')}, + context: document.body + }).done(function(value) { + callback($.map(value.hashtags, function (value) { + return value; + })); + }); } }, template: function (value) { - if (typeof value.acct == 'undefined') { - return shortnameTo(value, self.emojiTemplate) + " " + value.replace(/:/g, ''); - } else { + if (typeof value.acct != 'undefined') { return ' @'+value.acct; + } else if (typeof value.name != 'undefined') { + return '#'+value.name; + } else { + return shortnameTo(value, self.emojiTemplate) + " " + value.replace(/:/g, ''); } }, replace: function (value) { - if (typeof value.acct == 'undefined') { - return shortnameTo(value, self.emojiTemplate); - }else{ + if (typeof value.acct != 'undefined') { return "@"+value.acct+ " "; + }else if (typeof value.name != 'undefined') { + return "#"+value.name+ " "; + }else{ + + return shortnameTo(value, self.emojiTemplate); } }, cache: true, diff --git a/src/Controller/FediPlanController.php b/src/Controller/FediPlanController.php index cbd3c24..4f21cff 100644 --- a/src/Controller/FediPlanController.php +++ b/src/Controller/FediPlanController.php @@ -247,6 +247,12 @@ class FediPlanController extends AbstractController unset($compose); unset($form); $compose = new Compose(); + $pollOption1 = new PollOption(); + $pollOption1->setTitle(""); + $compose->getPollOptions()->add($pollOption1); + $pollOption2 = new PollOption(); + $pollOption2->setTitle(""); + $compose->getPollOptions()->add($pollOption2); $session->getFlashBag()->add( 'Success', 'The message has been scheduled' diff --git a/templates/fediplan/index.html.twig b/templates/fediplan/index.html.twig index 12afa26..1ccffea 100644 --- a/templates/fediplan/index.html.twig +++ b/templates/fediplan/index.html.twig @@ -75,7 +75,7 @@

{{ 'page.index.about'|trans |raw}}

{{ 'page.index.data'|trans |raw}}

-
FediPlan 1.0.0
+
{{ form_end(form) }}