2017 © Pedro Peláez
 

library oc-locationtowns-plugin

image

vojtasvoboda/oc-locationtowns-plugin

  • Thursday, April 5, 2018
  • by VojtaSvoboda
  • Repository
  • 2 Watchers
  • 2 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

Location Town plugin for OctoberCMS

Codacy Scrutinizer Coverage License, (*1)

Adds towns to states managed by RainLab.Location plugin. Included:, (*2)

  • component for state towns with pagination
  • component for Town detail
  • hooks for RainLab.Sitemap
  • extends RainLab State model

Required plugins: RainLab.Location., (*3)

Tested with the latest stable OctoberCMS build 349., (*4)

Render Town detail

This component render town detail. Just create page Town-detail with slug /town-detail/:slug? and insert Town component:, (*5)

Town component, (*6)

To override Town detail template just create partial file /town/default.htm as copy of /plugins/vojtasvoboda/components/town/default.htm and make own changes., (*7)

Render list of Towns

Create page Towns with slug /towns/:page? where page means paginating. Insert component Towns. Set filter for State and select page for show Town detail created above:, (*8)

Towns component, (*9)

To override Towns listing template just create partial file /towns/default.htm as copy of /plugins/vojtasvoboda/components/towns/default.htm and make own changes., (*10)

Add towns to sitemap

Just install RainLab.Sitemap plugin and insert one town or all towns to sitemap:, (*11)

Towns in sitemap, (*12)

Front-end usage

Following example from Location plugin this plugin just adds form_select_town function:, (*13)

{% set countryId = countryId|default(form_value('country_id')) %}
{% set stateId = stateId|default(form_value('state_id')) %}
{% set townId = townId|default(form_value('town_id')) %}

{{ form_open() }}


{{ form_select_country('country_id', countryId, { id: 'accountCountry', class: 'form-control', emptyOption: '', 'data-request': 'onInit', 'data-request-update': { 'country-state': '#partialCountryState' } }) }}
<div class="form-group"> <label for="accountState">State</label> {{ form_select_state('state_id', countryId, stateId, { id: 'accountState', class: 'form-control', emptyOption: '', 'data-request': 'onInit', 'data-request-update': { 'country-state': '#partialCountryState' } }) }} </div> <div class="form-group"> <label for="accountTown">Town</label> {{ form_select_town('town_id', stateId, townId, { id: 'accountTown', class: 'form-control', emptyOption: '' }) }} </div> {{ form_close() }}

Services

List of available services provided by plugin:, (*14)

locationtowns service

$towns = App::make('locationstowns');
$town = $towns->findOneBySlug('praha');
$allTowns = $towns->all();
$townsByState = $towns->where('state_id', 285)->get();

RainLab State extension

$state = \RainLab\Location\Models\State::find('285');
$towns = $state->towns;

TODO

  • !!fix fixed URL path at Town:114 and Town:129 (there should by path set in component)
  • !filter only by active states in towns component
  • directly extend RainLab.Location.State form to manage towns related to this state
  • run plugin without RainLab.Location (only town management)
  • add select box 'country' to backend listing for filtrating states
  • it is not possible to do october:down
  • add import and export

Feel free to send pullrequest!, (*15)

Contributing

Please send Pull Request to master branch., (*16)

License

LocationTown plugin is open-sourced software licensed under the MIT license same as OctoberCMS platform., (*17)

The Versions

05/04 2018

1.0.1

1.0.1.0

  Sources   Download

05/04 2018

1.0.2

1.0.2.0

  Sources   Download

05/04 2018

1.0.3

1.0.3.0

  Sources   Download

05/04 2018

1.0.4

1.0.4.0

  Sources   Download

05/04 2018

1.0.5

1.0.5.0

  Sources   Download

05/04 2018

1.0.6

1.0.6.0

  Sources   Download

15/12 2016

dev-master

9999999-dev https://github.com/vojtasvoboda/oc-locationtowns-plugin

Adds towns to states managed by RainLab.Location plugin.

  Sources   Download

MIT

The Requires

 

by Vojta Svoboda

plugin city october location town

12/07 2016

1.0.7

1.0.7.0 https://github.com/vojtasvoboda/oc-locationtowns-plugin

Adds towns to states managed by RainLab.Location plugin.

  Sources   Download

MIT

The Requires

 

by Vojta Svoboda

plugin city october location town