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.
This commit is contained in:
parent
3792846778
commit
2026e4a872
@ -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'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +0,0 @@
|
||||
<?php namespace Jasonwilliams\Feed\Controllers;
|
||||
|
||||
use BackendMenu;
|
||||
use Backend\Classes\Controller;
|
||||
|
||||
/**
|
||||
* Import Back-end Controller
|
||||
*/
|
||||
class Import extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
17
www/plugins/jasonwilliams/feed/controllers/feed/_import.htm
Normal file
17
www/plugins/jasonwilliams/feed/controllers/feed/_import.htm
Normal file
@ -0,0 +1,17 @@
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="popup">×</button>
|
||||
<h4 class="modal-title">Importing <?= $importType ?></h4>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<?= $content ?>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-default"
|
||||
data-dismiss="popup">
|
||||
<?= e(trans('backend::lang.form.close')) ?>
|
||||
</button>
|
||||
</div>
|
@ -17,7 +17,7 @@
|
||||
</button>
|
||||
|
||||
<a
|
||||
href="<?= Backend::url('jasonwilliams/feed/import') ?>"
|
||||
href="<?= Backend::url('jasonwilliams/feed/feed/import') ?>"
|
||||
class="btn btn-default oc-icon-upload">
|
||||
Fetch posts
|
||||
</a>
|
||||
|
33
www/plugins/jasonwilliams/feed/controllers/feed/import.htm
Normal file
33
www/plugins/jasonwilliams/feed/controllers/feed/import.htm
Normal file
@ -0,0 +1,33 @@
|
||||
<?php Block::put('breadcrumb') ?>
|
||||
<ul>
|
||||
<li><a href="<?= Backend::url('jasonwilliams/feed/feed') ?>">Social Feed</a></li>
|
||||
<li><?= e(trans($this->pageTitle)) ?></li>
|
||||
</ul>
|
||||
<?php Block::endPut() ?>
|
||||
|
||||
<div class="layout-row form-group">
|
||||
<button
|
||||
data-control="popup"
|
||||
data-handler="onImportTwitter"
|
||||
class="btn btn-default">
|
||||
Update Twitter Posts
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="layout-row form-group">
|
||||
<button
|
||||
data-control="popup"
|
||||
data-handler="onImportInstagram"
|
||||
class="btn btn-default">
|
||||
Update Instagram Posts
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="layout-row form-group">
|
||||
<button
|
||||
data-control="popup"
|
||||
data-handler="onImportFoursquare"
|
||||
class="btn btn-default">
|
||||
Update Foursquare Posts
|
||||
</button>
|
||||
</div>
|
@ -1,21 +0,0 @@
|
||||
<div data-control="toolbar">
|
||||
<a
|
||||
href="<?= Backend::url('jasonwilliams/feed/import/create') ?>"
|
||||
class="btn btn-primary oc-icon-plus">
|
||||
New Import
|
||||
</a>
|
||||
|
||||
<button
|
||||
class="btn btn-danger oc-icon-trash-o"
|
||||
disabled="disabled"
|
||||
onclick="$(this).data('request-data', { checked: $('.control-list').listWidget('getChecked') })"
|
||||
data-request="onDelete"
|
||||
data-request-confirm="Are you sure you want to delete the selected Imports?"
|
||||
data-trigger-action="enable"
|
||||
data-trigger=".control-list input[type=checkbox]"
|
||||
data-trigger-condition="checked"
|
||||
data-request-success="$(this).prop('disabled', 'disabled')"
|
||||
data-stripe-load-indicator>
|
||||
Delete selected
|
||||
</button>
|
||||
</div>
|
@ -1,4 +0,0 @@
|
||||
|
||||
<? //$this->listRender() ?>
|
||||
|
||||
Hello, world!
|
Loading…
Reference in New Issue
Block a user