Skip to content

Commit

Permalink
changing handle wip
Browse files Browse the repository at this point in the history
  • Loading branch information
nateiler committed Jan 11, 2023
1 parent 6c1dbf7 commit 5df58cc
Show file tree
Hide file tree
Showing 19 changed files with 96 additions and 92 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Unreleased
### Changed
- Renamed plugin handle (and twig variables) from 'hubspot' to 'flipbox-hubspot'

## 1.4.0 - 2022-09-28
### Added
- Connection using HubSpot Private App token
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
},
"extra": {
"name": "HubSpot",
"handle": "hubspot",
"handle": "flipbox-hubspot",
"class": "flipbox\\craft\\hubspot\\HubSpot",
"developer": "Flipbox Digital",
"developerUrl": "https://www.flipboxdigital.com",
Expand Down
38 changes: 19 additions & 19 deletions src/HubSpot.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class HubSpot extends Plugin
/**
* @var string
*/
public static $category = 'hubspot';
public static $category = 'flipbox-hubspot';

/**
* @inheritdoc
Expand Down Expand Up @@ -86,7 +86,7 @@ public function init()
function (Event $event) {
/** @var CraftVariable $variable */
$variable = $event->sender;
$variable->set('hubspot', HubSpotVariable::class);
$variable->set('flipbox-hubspot', HubSpotVariable::class);
}
);

Expand Down Expand Up @@ -133,17 +133,17 @@ public function getCpNavItem()
parent::getCpNavItem(),
[
'subnav' => [
'hubspot.visitors' => [
'flipbox-hubspot.visitors' => [
'label' => static::t('Visitors'),
'url' => 'hubspot/visitors',
'url' => 'flipbox-hubspot/visitors',
],
'hubspot.limits' => [
'flipbox-hubspot.limits' => [
'label' => static::t('Limits'),
'url' => 'hubspot/limits',
'url' => 'flipbox-hubspot/limits',
],
'hubspot.settings' => [
'flipbox-hubspot.settings' => [
'label' => static::t('Settings'),
'url' => 'hubspot/settings',
'url' => 'flipbox-hubspot/settings',
]
]
]
Expand All @@ -165,7 +165,7 @@ public function createSettingsModel()
public function settingsHtml()
{
Craft::$app->getResponse()->redirect(
UrlHelper::cpUrl('hubspot/settings')
UrlHelper::cpUrl('flipbox-hubspot/settings')
);

Craft::$app->end();
Expand Down Expand Up @@ -236,7 +236,7 @@ public function getVisitor(): Visitor
*/
public static function t($message, $params = [], $language = null)
{
return Craft::t('hubspot', $message, $params, $language);
return Craft::t('flipbox-hubspot', $message, $params, $language);
}


Expand Down Expand Up @@ -269,25 +269,25 @@ public static function onRegisterCpUrlRules(RegisterUrlRulesEvent $event)
$event->rules,
[
// ??
'hubspot' => 'hubspot/cp/settings/view/general/index',
'flipbox-hubspot' => 'flipbox-hubspot/cp/settings/view/general/index',

// LIMITS
'hubspot/limits' => 'hubspot/cp/view/limits/index',
'flipbox-hubspot/limits' => 'flipbox-hubspot/cp/view/limits/index',

// VISITORS
'hubspot/visitors' => 'hubspot/cp/view/visitors/index',
'hubspot/visitors/<identifier:\d+>' => 'hubspot/cp/view/visitors/detail',
'flipbox-hubspot/visitors' => 'flipbox-hubspot/cp/view/visitors/index',
'flipbox-hubspot/visitors/<identifier:\d+>' => 'flipbox-hubspot/cp/view/visitors/detail',

// OBJECTS: PAYLOAD
'hubspot/objects/payloads/<field:\d+>/element/<element:\d+>' => 'hubspot/cp/view/object-payloads/index',
'flipbox-hubspot/objects/payloads/<field:\d+>/element/<element:\d+>' => 'flipbox-hubspot/cp/view/object-payloads/index',

// SETTINGS
'hubspot/settings' => 'hubspot/cp/settings/view/general/index',
'flipbox-hubspot/settings' => 'flipbox-hubspot/cp/settings/view/general/index',

// SETTINGS: CONNECTIONS
'hubspot/settings/connections' => 'hubspot/cp/settings/view/connections/index',
'hubspot/settings/connections/new' => 'hubspot/cp/settings/view/connections/upsert',
'hubspot/settings/connections/<identifier:\d+>' => 'hubspot/cp/settings/view/connections/upsert',
'flipbox-hubspot/settings/connections' => 'flipbox-hubspot/cp/settings/view/connections/index',
'flipbox-hubspot/settings/connections/new' => 'flipbox-hubspot/cp/settings/view/connections/upsert',
'flipbox-hubspot/settings/connections/<identifier:\d+>' => 'flipbox-hubspot/cp/settings/view/connections/upsert',

]
);
Expand Down
2 changes: 1 addition & 1 deletion src/connections/ApplicationKeyConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static function displayName(): string
public function getSettingsHtml()
{
return Craft::$app->getView()->renderTemplate(
'hubspot/_components/connections/applicationKey',
'flipbox-hubspot/_components/connections/applicationKey',
[
'connection' => $this
]
Expand Down
2 changes: 1 addition & 1 deletion src/connections/PrivateKeyConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static function displayName(): string
public function getSettingsHtml()
{
return Craft::$app->getView()->renderTemplate(
'hubspot/_components/connections/privateApplicationKey',
'flipbox-hubspot/_components/connections/privateApplicationKey',
[
'connection' => $this
]
Expand Down
6 changes: 3 additions & 3 deletions src/cp/controllers/view/AbstractController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ abstract class AbstractController extends Controller
/**
* The index view template path
*/
const TEMPLATE_BASE = 'hubspot' . '/_cp';
const TEMPLATE_BASE = 'flipbox-hubspot' . '/_cp';

/*******************************************
* BASE PATHS
Expand Down Expand Up @@ -116,7 +116,7 @@ protected function invalidConnectionModel(): DynamicModel
$model->addError(
'connection',
'Invalid connection. ' .
'<a href="' . UrlHelper::cpUrl('hubspot/settings/connections') . '">' .
'<a href="' . UrlHelper::cpUrl('flipbox-hubspot/settings/connections') . '">' .
'Manage connections to HubSpot' .
'</a>.'
);
Expand Down Expand Up @@ -159,7 +159,7 @@ protected function baseVariables(array &$variables = [])
if (!$activeSubNav = Craft::$app->getRequest()->getSegment(2)) {
$activeSubNav = 'queries';
}
$variables['selectedSubnavItem'] = 'hubspot.' . $activeSubNav;
$variables['selectedSubnavItem'] = 'flipbox-hubspot.' . $activeSubNav;

// Breadcrumbs
$variables['crumbs'][] = [
Expand Down
18 changes: 9 additions & 9 deletions src/fields/Objects.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,47 +36,47 @@ abstract class Objects extends Integrations implements ObjectsFieldInterface
/**
* @inheritdoc
*/
const TRANSLATION_CATEGORY = 'hubspot';
const TRANSLATION_CATEGORY = 'flipbox-hubspot';

/**
* @inheritdoc
*/
const INPUT_TEMPLATE_PATH = 'hubspot/_components/fieldtypes/Objects/input';
const INPUT_TEMPLATE_PATH = 'flipbox-hubspot/_components/fieldtypes/Objects/input';

/**
* @inheritdoc
*/
const INPUT_ITEM_TEMPLATE_PATH = 'hubspot/_components/fieldtypes/Objects/_inputItem';
const INPUT_ITEM_TEMPLATE_PATH = 'flipbox-hubspot/_components/fieldtypes/Objects/_inputItem';

/**
* @inheritdoc
*/
const SETTINGS_TEMPLATE_PATH = 'hubspot/_components/fieldtypes/Objects/settings';
const SETTINGS_TEMPLATE_PATH = 'flipbox-hubspot/_components/fieldtypes/Objects/settings';

/**
* @inheritdoc
*/
const ACTION_PREFORM_ACTION_PATH = 'hubspot/cp/fields/perform-action';
const ACTION_PREFORM_ACTION_PATH = 'flipbox-hubspot/cp/fields/perform-action';

/**
* @inheritdoc
*/
const ACTION_CREATE_ITEM_PATH = 'hubspot/cp/fields/create-item';
const ACTION_CREATE_ITEM_PATH = 'flipbox-hubspot/cp/fields/create-item';

/**
* @inheritdoc
*/
const ACTION_ASSOCIATION_ITEM_PATH = 'hubspot/cp/objects/associate';
const ACTION_ASSOCIATION_ITEM_PATH = 'flipbox-hubspot/cp/objects/associate';

/**
* @inheritdoc
*/
const ACTION_DISSOCIATION_ITEM_PATH = 'hubspot/cp/objects/dissociate';
const ACTION_DISSOCIATION_ITEM_PATH = 'flipbox-hubspot/cp/objects/dissociate';

/**
* @inheritdoc
*/
const ACTION_PREFORM_ITEM_ACTION_PATH = 'hubspot/cp/fields/perform-item-action';
const ACTION_PREFORM_ITEM_ACTION_PATH = 'flipbox-hubspot/cp/fields/perform-item-action';

/**
* Indicates whether the full sync operation should be preformed if a matching HubSpot Object was found but not
Expand Down
8 changes: 4 additions & 4 deletions src/templates/_components/connections/applicationKey.twig
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% import "_includes/forms" as forms %}

{{ forms.autosuggestField({
label: "Key"|t('hubspot'),
instructions: "The key."|t('hubspot'),
label: "Key"|t('flipbox-hubspot'),
instructions: "The key."|t('flipbox-hubspot'),
id: 'key',
name: 'key',
suggestEnvVars: true,
Expand All @@ -12,8 +12,8 @@
}) }}

{{ forms.autosuggestField({
label: "Hub Id"|t('hubspot'),
instructions: "The Hub Id."|t('hubspot'),
label: "Hub Id"|t('flipbox-hubspot'),
instructions: "The Hub Id."|t('flipbox-hubspot'),
id: 'hubId',
name: 'hubId',
suggestEnvVars: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% import "_includes/forms" as forms %}

{{ forms.autosuggestField({
label: "Private Application Key"|t('hubspot'),
instructions: "Reference HubSpot API Docs: https://developers.hubspot.com/docs/api/private-apps"|t('hubspot'),
label: "Private Application Key"|t('flipbox-hubspot'),
instructions: "Reference HubSpot API Docs: https://developers.hubspot.com/docs/api/private-apps"|t('flipbox-hubspot'),
id: 'key',
name: 'key',
suggestEnvVars: true,
Expand All @@ -12,8 +12,8 @@
}) }}

{{ forms.autosuggestField({
label: "Hub Id"|t('hubspot'),
instructions: "The Hub Id."|t('hubspot'),
label: "Hub Id"|t('flipbox-hubspot'),
instructions: "The Hub Id."|t('flipbox-hubspot'),
id: 'hubId',
name: 'hubId',
suggestEnvVars: true,
Expand Down
2 changes: 1 addition & 1 deletion src/templates/_cp/_layout/_connectionOptions.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% import "_includes/forms" as forms %}

{% if not activeConnection %}
<a href="{{ cpUrl('hubspot/settings/connections') }}">Create a connection</a>&nbsp;{{ "to get started."|t('force') }}
<a href="{{ cpUrl('flipbox-hubspot/settings/connections') }}">Create a connection</a>&nbsp;{{ "to get started."|t('force') }}
{% endif %}

{% set queryParams = craft.app.request.queryParams|without(craft.app.request.fullPath) %}
Expand Down
8 changes: 4 additions & 4 deletions src/templates/_cp/limits/index.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "hubspot/_cp/_layout" %}
{% extends "flipbox-hubspot/_cp/_layout" %}

{% block contextMenu %}
{% include "hubspot/_cp/_layout/_connectionOptions" with {
{% include "flipbox-hubspot/_cp/_layout/_connectionOptions" with {
availableConnections: availableConnections,
activeConnection: activeConnection,
defaultConnection: defaultConnection
Expand All @@ -13,8 +13,8 @@
<thead>
<tr>
<th>&nbsp;</th>
<th>{{ "Used"|t('hubspot') }}</th>
<th>{{ "Max"|t('hubspot') }}</th>
<th>{{ "Used"|t('flipbox-hubspot') }}</th>
<th>{{ "Max"|t('flipbox-hubspot') }}</th>
</tr>
</thead>
<tbody>
Expand Down
2 changes: 1 addition & 1 deletion src/templates/_cp/objects/payload.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "hubspot/_cp/_layout" %}
{% extends "flipbox-hubspot/_cp/_layout" %}
{% import "_includes/forms" as forms %}

{% do view.registerJsFile("//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js") %}
Expand Down
2 changes: 1 addition & 1 deletion src/templates/_cp/settings/_layout.twig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "_layouts/cp" %}
{% block sidebar %}
{% set baseCpPath = 'hubspot/settings' %}
{% set baseCpPath = 'flipbox-hubspot/settings' %}
{% set selected = selected is defined ? selected : craft.app.request.getSegment(3) %}
{% set nav = {
general : {
Expand Down
26 changes: 13 additions & 13 deletions src/templates/_cp/settings/connections/index.twig
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
{% extends "hubspot/_cp/settings/_layout" %}
{% extends "flipbox-hubspot/_cp/settings/_layout" %}

{% block actionButton %}
<div class="buttons right">
<a href="{{ url(continueEditingUrl ~ '/new') }}"
class="btn submit add icon">{{ "New connection"|t('hubspot') }}</a>
class="btn submit add icon">{{ "New connection"|t('flipbox-hubspot') }}</a>
</div>
{% endblock %}

{% set content %}
<table id="connections" class="data fullwidth collapsible">
<thead>
<th scope="col">{{ "Name"|t('hubspot') }}</th>
<th scope="col">{{ "Handle"|t('hubspot') }}</th>
<th scope="col">{{ "Hub Id"|t('hubspot') }}</th>
<th scope="col">{{ "Type"|t('hubspot') }}</th>
<th scope="col">{{ "Default"|t('hubspot') }}</th>
<th scope="col">{{ "Name"|t('flipbox-hubspot') }}</th>
<th scope="col">{{ "Handle"|t('flipbox-hubspot') }}</th>
<th scope="col">{{ "Hub Id"|t('flipbox-hubspot') }}</th>
<th scope="col">{{ "Type"|t('flipbox-hubspot') }}</th>
<th scope="col">{{ "Default"|t('flipbox-hubspot') }}</th>
</thead>
<tbody>
{% if connections|length %}
{% for handle, record in connections %}
{% set connection = record.connection %}
<tr data-id="{{ record.id }}" data-name="{{ record.handle }}">
<th scope="row" data-title="{{ 'Type'|t('hubspot') }}">
<th scope="row" data-title="{{ 'Type'|t('flipbox-hubspot') }}">
<span class="status{% if record.enabled %} enabled{% endif %}"></span>
<a href="{{ url(baseCpPath~'/'~record.id) }}">
{{ record.name }}
</a>
</th>
<th data-title="{{ 'Handle'|t('hubspot') }}">
<th data-title="{{ 'Handle'|t('flipbox-hubspot') }}">
<code>{{ record.handle }}</code>
</th>
<td data-title="{{ 'HubId'|t('hubspot') }}">
<td data-title="{{ 'HubId'|t('flipbox-hubspot') }}">
<code>{{ connection.hubId }}</code>
</td>
<td data-title="{{ 'Handle'|t('hubspot') }}">
<td data-title="{{ 'Handle'|t('flipbox-hubspot') }}">
{{ connection.displayName() }}
</td>
<td data-title="{{ 'Default'|t('hubspot') }}">
<td data-title="{{ 'Default'|t('flipbox-hubspot') }}">
<span class="status{% if settings.defaultConnection == record.handle %} enabled{% endif %}"></span>
</td>
</tr>
{% endfor %}
{% else %}
<tr>
<td colspan="3">
{{ "No connections exist yet."|t('hubspot') }}
{{ "No connections exist yet."|t('flipbox-hubspot') }}
</td>
</tr>
{% endif %}
Expand Down
Loading

0 comments on commit 5df58cc

Please sign in to comment.