Skip to content

Commit

Permalink
Merge pull request #11 from ibelar/feature/jsurl
Browse files Browse the repository at this point in the history
Feature/jsurl
  • Loading branch information
ibelar authored Mar 5, 2018
2 parents 46fa5ec + 7589175 commit 2a172af
Show file tree
Hide file tree
Showing 15 changed files with 1,365 additions and 13 deletions.
1 change: 0 additions & 1 deletion assets/vendor/atk4/ui/1.3.0/atk4JS.min.js

This file was deleted.

1 change: 0 additions & 1 deletion assets/vendor/atk4/ui/1.3.0/atkjs-ui.min.js

This file was deleted.

2 changes: 1 addition & 1 deletion assets/vendor/atk4/ui/1.4/atkjs-ui.min.js

Large diffs are not rendered by default.

364 changes: 364 additions & 0 deletions assets/vendor/semantic-ui/2.3/semantic.min.css

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions assets/vendor/semantic-ui/2.3/semantic.min.js

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
947 changes: 947 additions & 0 deletions assets/vendor/semantic-ui/2.3/themes/default/assets/fonts/icons.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 40 additions & 8 deletions src/AtkWpApp.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,35 +162,67 @@ public function terminate($output = null)
* @param array $page
* @param bool $hasRequestUri
* @param array $extraArgs
* @param bool $needAjax
*
* @return array|null|string
*/
public function url($page = [], $hasRequestUri = false, $extraArgs = [])
public function url($page = [], $needRequestUri = false, $extraArgs = [])
{
$result = $extraArgs;
if (is_string($page)) {
return $page;
}

$wpPage = 'admin';

if ($wpPageRequest = @$_REQUEST['page']) {
$extraArgs['page'] = $wpPageRequest;
}

return $this->buildUrl($wpPage, $page, $extraArgs);
}

/**
* Return url.
*
* @param array $page
* @param bool $hasRequestUri
* @param array $extraArgs
*
* @return array|null|string
*/
public function jsUrl($page = [], $hasRequestUri = false, $extraArgs = [])
{
if (is_string($page)) {
return $page;
}

$this->page = 'admin-ajax';
$wpPage = 'admin-ajax';

//if running front end set url for ajax.
if (!WpUtil::isAdmin()) {
$this->page = WpUtil::getBaseAdminUrl().'admin-ajax';
}
$sticky = $this->sticky_get_arguments;
$sticky['action'] = $this->plugin->getPluginName();
$sticky['atkwp'] = $this->plugin->getWpComponentId();

$extraArgs['action'] = $this->plugin->getPluginName();
$extraArgs['atkwp'] = $this->plugin->getWpComponentId();

if ($this->plugin->getComponentCount() > 0) {
$sticky['atkwp-count'] = $this->plugin->getComponentCount();
$extraArgs['atkwp-count'] = $this->plugin->getComponentCount();
}

if ($this->plugin->config->getConfig('plugin/use_nounce', false)) {
$sticky['_ajax_nonce'] = helpers\WpUtil::createWpNounce($this->plugin->getPluginName());
$extraArgs['_ajax_nonce'] = helpers\WpUtil::createWpNounce($this->plugin->getPluginName());
}

return $this->buildUrl($wpPage, $page, $extraArgs);
}

private function buildUrl($wpPage, $page, $extras)
{
$result = $extras;
$sticky = $this->sticky_get_arguments;
$this->page = $wpPage;

if (!isset($page[0])) {
$page[0] = $this->page;

Expand Down
2 changes: 1 addition & 1 deletion src/services/EnqueueService.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class EnqueueService
*/
private $ctrl;

protected $semanticUiVersion = '2.2.12';
protected $semanticUiVersion = '2.3';
protected $semanticCalendarVersion = '0.0.8';
protected $atkUiVersion = '1.4';

Expand Down
2 changes: 1 addition & 1 deletion templates/paginator.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<{_element}div{/} id="{$_id}" class="{_ui}ui{/} {$class} {_class}{/}" style="{$style}" {$attributes}>
{rows}
{Item}<a class="item {$active}" data-page="{$page}">{$page}</a>
{Item}<a class="item {$active}" href="{$link}" data-page="{$page}">{$page}</a>
{/}
{Spacer}
<div class="disabled item">...</div>
Expand Down

0 comments on commit 2a172af

Please sign in to comment.