Uploaded image for project: 'Blesta Core'
  1. Blesta Core
  2. CORE-2169

Allow action links to specify base URI

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0.0-b1
    • Component/s: None
    • Labels:
      None

      Description

      The base URI for plugin action nav links is determined automatically by the context of the link.

      This becomes problematic, however, if we wish to define a primary client nav element that is based off the public URI. The solution is to add the ability to overwrite the base URI via an option.

      • base_uri - The base URI (optional)
        • "public" - The public URI path
        • "client" - The client URI path
        • "admin" - The admin URI path
        • Any other string, e.g. "https://blesta.com/"

      The base_uri option should be supported as a top-level key, as well as within any sub element that also contains a uri key. For example:

      [
          'action' => 'nav_primary_client',
          'base_uri' => 'public',
          'uri' => 'order/',
          'name' => 'Order',
          'sub' => [
              [
                  'name' => 'Dippin Dots',
                  'uri' => '',
                  'base_uri' => 'https://www.dippindots.com'
              ]
          ]
      ]
      

      The top-level base_uri SHOULD overwrite the base_uri for all sub elements unless explicitly overridden by a sub element. If no top-level base_uri is defined, it should inherit the default base_uri as it does today.

      The Navigation model requires updates in order to support this.

      public function baseUri($label, $uri)
      {
          $this->base_uris[$label] = $uri;
          return $this;
      }
      

      Then in AppController:

      $this->Navigation->baseUri('public', $this->public_uri);
          ->baseUri('client', $this->client_uri);
          ->baseUri('admin', $this->admin_uri);
      

        Issue Links

          Activity

          cody Cody Phillips (Inactive) created issue -
          cody Cody Phillips (Inactive) made changes -
          Field Original Value New Value
          Link This issue blocks CORE-1974 [ CORE-1974 ]
          cody Cody Phillips (Inactive) made changes -
          Assignee Cody Phillips [ cody ] Tyson Phillips [ tyson ]
          tyson Tyson Phillips (Inactive) made changes -
          Description The base URI for [plugin action|https://docs.blesta.com/display/dev/Plugin+Actions] nav links is determined automatically by the context of the link.

          This becomes problematic, however, if we wish to define a primary client nav element that is based off the public URI. The solution is to add the ability to overwrite the base URI via an option.

          - base_uri - The base URI (optional)
          -- "public" - The public URI path
          -- "client" - The client URI path
          -- "admin" - The admin URI path
          -- Any other string, e.g. "https://blesta.com/"

          The *base_uri* option should be supported as a top-level key, as well as within any sub element that also contains a *uri* key. For example:

          {noformat}
          [
              'action' => 'nav_primary_client',
              'base_uri' => 'public',
              'uri' => 'order/',
              'name' => 'Order',
              'sub' => [
                  [
                      'name' => 'Dippin Dots',
                      'uri' => '',
                      'base_uri' => 'https://www.dippindots.com'
                  ]
              ]
          ]
          {noformat}

          The top-level *base_uri* SHOULD overwrite the *base_uri* for all sub elements. If no top-level *base_uri* is defined, it should inherit the default base_uri as it does today.

          The *Navigation* model requires updates in order to support this.

          {noformat}
          public function baseUri($label, $uri)
          {
              $this->base_uris[$label] = $uri;
              return $this;
          }
          {noformat}

          Then in AppController:
          {noformat}
          $this->Navigation->baseUri('public', $this->public_uri);
              ->baseUri('client', $this->client_uri);
              ->baseUri('admin', $this->admin_uri);
          {noformat}
          The base URI for [plugin action|https://docs.blesta.com/display/dev/Plugin+Actions] nav links is determined automatically by the context of the link.

          This becomes problematic, however, if we wish to define a primary client nav element that is based off the public URI. The solution is to add the ability to overwrite the base URI via an option.

          - base_uri - The base URI (optional)
          -- "public" - The public URI path
          -- "client" - The client URI path
          -- "admin" - The admin URI path
          -- Any other string, e.g. "https://blesta.com/"

          The *base_uri* option should be supported as a top-level key, as well as within any sub element that also contains a *uri* key. For example:

          {noformat}
          [
              'action' => 'nav_primary_client',
              'base_uri' => 'public',
              'uri' => 'order/',
              'name' => 'Order',
              'sub' => [
                  [
                      'name' => 'Dippin Dots',
                      'uri' => '',
                      'base_uri' => 'https://www.dippindots.com'
                  ]
              ]
          ]
          {noformat}

          The top-level *base_uri* SHOULD overwrite the *base_uri* for all sub elements unless explicitly overridden by a sub element. If no top-level *base_uri* is defined, it should inherit the default base_uri as it does today.

          The *Navigation* model requires updates in order to support this.

          {noformat}
          public function baseUri($label, $uri)
          {
              $this->base_uris[$label] = $uri;
              return $this;
          }
          {noformat}

          Then in AppController:
          {noformat}
          $this->Navigation->baseUri('public', $this->public_uri);
              ->baseUri('client', $this->client_uri);
              ->baseUri('admin', $this->admin_uri);
          {noformat}
          Automated transition triggered when Tyson Phillips (Inactive) created a branch in Stash -
          Status Open [ 1 ] In Progress [ 3 ]
          Hide
          tyson Tyson Phillips (Inactive) added a comment -

          It looks to me like the 'nav_secondary_staff' action will require two additional options:

          • base_uri - The secondary subnav URI
          • parent_base_uri The URI of the parent.

          The parent_base_uri would be necessary if a plugin wanted to add a secondary URI to a parent (e.g. of a plugin) that also overrides its base_uri.

          Show
          tyson Tyson Phillips (Inactive) added a comment - It looks to me like the 'nav_secondary_staff' action will require two additional options: base_uri - The secondary subnav URI parent_base_uri The URI of the parent. The parent_base_uri would be necessary if a plugin wanted to add a secondary URI to a parent (e.g. of a plugin) that also overrides its base_uri.
          Hide
          cody Cody Phillips (Inactive) added a comment -

          I think it's a rare case to have a plugin attempt to add secondary URI to another plugin so not sure we need to cover that. At least not right now.

          Show
          cody Cody Phillips (Inactive) added a comment - I think it's a rare case to have a plugin attempt to add secondary URI to another plugin so not sure we need to cover that. At least not right now.
          Automated transition triggered when Tyson Phillips (Inactive) created pull request #117 in Stash -
          Status In Progress [ 3 ] In Review [ 5 ]
          Resolution Fixed [ 1 ]
          Automated transition triggered when Cody Phillips (Inactive) merged pull request #117 in Stash -
          Status In Review [ 5 ] Closed [ 6 ]

            People

            • Assignee:
              tyson Tyson Phillips (Inactive)
              Reporter:
              cody Cody Phillips (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                15/Sep/16