From 2026e4a872328a9ff981bb1ddbefe2044c019fd5 Mon Sep 17 00:00:00 2001 From: Jason Williams Date: Wed, 30 Dec 2020 20:05:29 -0700 Subject: [PATCH] Closing #47 with completed manual trigger for social updates. Moving update/import functionality back to the feed controller (removing the import controller previously created), added an option to the backend that triggers the update from the custom SocialApis class. --- .../jasonwilliams/feed/controllers/Feed.php | 36 +++++++++++++++++++ .../jasonwilliams/feed/controllers/Import.php | 15 -------- .../feed/controllers/feed/_import.htm | 17 +++++++++ .../feed/controllers/feed/_list_toolbar.htm | 2 +- .../feed/controllers/feed/import.htm | 33 +++++++++++++++++ .../feed/controllers/import/_list_toolbar.htm | 21 ----------- .../feed/controllers/import/index.htm | 4 --- 7 files changed, 87 insertions(+), 41 deletions(-) delete mode 100644 www/plugins/jasonwilliams/feed/controllers/Import.php create mode 100644 www/plugins/jasonwilliams/feed/controllers/feed/_import.htm create mode 100644 www/plugins/jasonwilliams/feed/controllers/feed/import.htm delete mode 100644 www/plugins/jasonwilliams/feed/controllers/import/_list_toolbar.htm delete mode 100644 www/plugins/jasonwilliams/feed/controllers/import/index.htm diff --git a/www/plugins/jasonwilliams/feed/controllers/Feed.php b/www/plugins/jasonwilliams/feed/controllers/Feed.php index 00c7735..e776679 100644 --- a/www/plugins/jasonwilliams/feed/controllers/Feed.php +++ b/www/plugins/jasonwilliams/feed/controllers/Feed.php @@ -2,6 +2,7 @@ use Backend\Classes\Controller; use BackendMenu; +use JasonWilliams\Feed\Classes\SocialApis; class Feed extends Controller { @@ -18,4 +19,39 @@ class Feed extends Controller parent::__construct(); BackendMenu::setContext('jasonwilliams.feed', 'main-menu-item'); } + + public function import() + { + $this->pageTitle = 'Fetch posts'; + } + + public function onImportTwitter() + { + SocialApis::updateTwitter(); + + return $this->makePartial('import', [ + 'importType' => 'Twitter', + 'content' => 'Done' + ]); + } + + public function onImportInstagram() + { + SocialApis::updateInstagram(); + + return $this->makePartial('import', [ + 'importType' => 'Instagram', + 'content' => 'Done' + ]); + } + + public function onImportFoursquare() + { + SocialApis::updateFoursquare(); + + return $this->makePartial('import', [ + 'importType' => 'Foursquare', + 'content' => 'Done' + ]); + } } diff --git a/www/plugins/jasonwilliams/feed/controllers/Import.php b/www/plugins/jasonwilliams/feed/controllers/Import.php deleted file mode 100644 index 66db654..0000000 --- a/www/plugins/jasonwilliams/feed/controllers/Import.php +++ /dev/null @@ -1,15 +0,0 @@ - + + + + + + + diff --git a/www/plugins/jasonwilliams/feed/controllers/feed/_list_toolbar.htm b/www/plugins/jasonwilliams/feed/controllers/feed/_list_toolbar.htm index 4f098c3..babbfab 100644 --- a/www/plugins/jasonwilliams/feed/controllers/feed/_list_toolbar.htm +++ b/www/plugins/jasonwilliams/feed/controllers/feed/_list_toolbar.htm @@ -17,7 +17,7 @@ Fetch posts diff --git a/www/plugins/jasonwilliams/feed/controllers/feed/import.htm b/www/plugins/jasonwilliams/feed/controllers/feed/import.htm new file mode 100644 index 0000000..7453c3a --- /dev/null +++ b/www/plugins/jasonwilliams/feed/controllers/feed/import.htm @@ -0,0 +1,33 @@ + + + + +
+ +
+ +
+ +
+ +
+ +
diff --git a/www/plugins/jasonwilliams/feed/controllers/import/_list_toolbar.htm b/www/plugins/jasonwilliams/feed/controllers/import/_list_toolbar.htm deleted file mode 100644 index 2e189a0..0000000 --- a/www/plugins/jasonwilliams/feed/controllers/import/_list_toolbar.htm +++ /dev/null @@ -1,21 +0,0 @@ -
- - New Import - - - -
diff --git a/www/plugins/jasonwilliams/feed/controllers/import/index.htm b/www/plugins/jasonwilliams/feed/controllers/import/index.htm deleted file mode 100644 index d7bfd9a..0000000 --- a/www/plugins/jasonwilliams/feed/controllers/import/index.htm +++ /dev/null @@ -1,4 +0,0 @@ - -listRender() ?> - -Hello, world!