Giter Site home page Giter Site logo

bolt-store-hours's People

Contributors

zomars avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

bolt-store-hours's Issues

[Feature] Handy Twig Function

It would be nice to add a TWIG function that requires a template file or uses a default template file specified in the config.yml.dist that allows the user to output data by default like this -

{% for hour in store_hours_hours_today(record.hours) %}
    {% set this_day_hours = hour|split('-') %}
    Open: {{ this_day_hours[0]|date('g:i a') }}
    Close: {{ this_day_hours[1]|date('g:i a') }}
{% endfor %}

or maybe it shows an example of outputting each one based upon the day....
Monday - Friday 7am to 3:30pm
Sunday - Closed
After Hours Support is Available

Then you could call a function outputStoreHoursFormatted(twigTemplate = defaut.twig).

fields/_hourspicker.twig // ln 32 // Uncaught Exception: Twig_Error_Runtime

Uncaught Exception: Twig_Error_Runtime

Twig_Error_Runtime in Template.php line 447:
An exception has been thrown during the rendering of a template ("Warning: json_decode() expects parameter 1 to be string, array given") in "fields/_hourspicker.twig" at line 32.

Steps to reproduce

  • install bolt 3.2 via composer
  • install zomars/bolt-store-hours via extend
  • edit contenttypes.yml, add new field with fieldtype storehours
  • try to create a new content

Database Issue When Setting Up Extension

I am trying to set up Store HOurs in Bolt 3.4.5 on CentOS PHP7

I add:

business:
    name: Businesses
    singular_name: Business
    fields:
        hours:
            type: storehours

Then it tells me to update the database, which I do, but when I try to add my business hours, it throws an error.

Modifications made to the database:

    Table bolt_business is not the correct schema: invalid column hours, invalid column hours

Am I adding the content type (exactly as above) correctly?

Repeating Fields Issue

If users use this as a repeating field it will not work. (Although, I don't know why you would need to) You should not include JS in the field type as you have done. I would include it in an external script and carry the attributes or options through data attributes. The repeating field uses text/templates and will break any field types with script in them. I would recommend doing something similar to this - https://github.com/Raistlfiren/FAIconFieldType

I would also recommend removing https://github.com/zomars/bolt-store-hours/blob/master/src/StoreHoursExtension.php#L35 so it displays

    /**
     * {@inheritdoc}
     */
    protected function registerTwigPaths()
    {
        return [
            'templates',
        ];
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.