Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Manu
    @manuchap
    This date thing is a real brainfunk... Here's a query that works in mongo:
    db.locomotive_content_entries.find({ "created_at": {$gte: new Date(1631491200000)} })
    After many trials, only the long epoch date worked.
    Now I need to figure out how to script that 😶 knowing that new Date("2021-9-13").valueOf() returns a long epoch.
    Luke Grayson
    @greyskin
    Ok so get this: {{ '2021-09-14' | parse_date }} is now working for me. (Or at least it was when I tested it again last night). What do you make of this? I haven't changed anything. Same test page, just reloaded it.
    Manu
    @manuchap
    I think it's {{ '2021-09-14' | parse_date_time }}
    Luke Grayson
    @greyskin
    I believe there is also a parse_date_time but I'm talking about parse_dateand weirdly it's now working for me.
    So bizarre.
    Manu
    @manuchap
    Yes because for me it doesn't 😅
    Wagon version: 3.0.5
    Luke Grayson
    @greyskin
    I'm also wagon 3.0.5!! 😮
    Peter Salomon
    @patternpoints

    Just tested the date output. For me, the above spits out

    {{ '2021-09-14' | parse_date }}
    # output: 2021-09-14
    {{ '2021/09/14' |  date: "%b %d, %y" }}
    # output: Sep 14, 21

    or, the other way around ( i guess that is the expected output according to the docs:

    {{ '2021-09-14' | date: "%m/%d/%Y" }}
    # output: 09/14/2021
    And for long epoch:
    {{ '2021-09-14' | date: "%s" }}
    # output: 1631592000
    not sure if that helps in time comparison though
    Peter Salomon
    @patternpoints
    but it seems, that parse_date doesn´t do much...
    works also with "now":
    {{ now | date: "%s" }}
    # output: 1631744078
    Peter Salomon
    @patternpoints
    And back:
    {{ "1631592000" | date: "%Y-%m-%d %H:%M" }}
    # output: 2021-09-14 00:00
    Peter Salomon
    @patternpoints
    And with parse_date, also liquid doesnt accept a format string:
    {{ '2015-09-26' | parse_date: format: "%m/%d/%Y" }}
    # output: error: "no implicit conversion of Hash into String"
    Luke Grayson
    @greyskin
    @patternpoints are you on station.locomotive.works or your own install?
    Peter Salomon
    @patternpoints
    @greyskin I am on my own install, but all the above is wagon
    Manu
    @manuchap
    New feature everyone: CSV import
    Daniel Schulte
    @swf-dschulte_gitlab

    Hello everybody, I’m currently giving the authentication feature a spin, but I’m having trouble setting the from field via the custom smtp settings, so users receive proper looking welcome / password related e-mails. I’m setting a custom smtp namespace in my sign-up form via the following hidden field:

     <input type="hidden" name="auth_email_smtp_namespace" value="smtp_settings" />

    In order to configure the custom smtp, I used this guide and the following configuration in my site.yml:

    metafields:
      smtp_settings:
        address: myaddress.com
        authentication: plain
        port: 587
        enable_starttls_auto: true
        user_name: user@name.com
        password: some_password
        domain: mydomain.com
        from: my@mail.com

    When a new user registers and receives the welcome e-mail, the from field is still set to the default, and not to e.g. my@mail.com, as specified above.

    Any idea how to get this working?

    Luke Grayson
    @greyskin
    Hi @swf-dschulte_gitlab, are you on station.locomotive.works or your own install?
    Daniel Schulte
    @swf-dschulte_gitlab
    Hi @greyskin, I tested this on my local install with version 4.0.3 and 4.1.0rc, had the same problem with both versions.
    Luke Grayson
    @greyskin
    Ah ok - I only use station (Locomotive's hosted solution) but there is something funny with the setup there too. I had major issues setting up authentication and getting the smtp namespace to work. Weird things like adding an address that required "authentication: login" would stop the password reset email sending (but it would work for API action send emails) but using one that used "authentication: plain" worked fine.
    Alex Wellnitz
    @alexohneander
    Hi @did , I have built a running version of the search plugin using Elasticsearch. My version is based on the 0.1.0. If someone has fun he can modify it a bit so that it also runs with the version 0.3.0.
    https://github.com/alexohneander/locomotive_search
    Chris Dyer
    @dyerc
    Not sure if anyone has any prior experience or input they can offer on this... I would like to make a page in a Locomotive site that can only be viewed by users authorized in the backend. I know I could keep the page as unpublished which would achieve this but it's very important the page can't be accidentally published by anyone. Effectively it's something like this locomotivecms/engine#153 and I'm wondering whether an engine module is the only way to go? With the new authentication feature it would be great if this could be linked to the existing Devise site admins rather than just a new content type.
    Luke Grayson
    @greyskin

    Hi @dyerc, I'm not 100% sure if I understand you correctly so my apologies if the below is irrelevant.

    I've assumed you mean that the page in question can only be viewed on the front-end by users authorized in the back-end. If that's the case, then you can get a list of "memberships" for a site at:

    You could use the actions api do so something like this:

    {% action "get content types" %}
    
        var memberships = callAPI("GET", "https://station.locomotive.works/locomotive/api/v3/memberships.json", {
    
            data: {
            },
    
            headers: {
                "X-Locomotive-Account-Email": "admin_email",
                "X-Locomotive-Account-Token": "account_token",
                "X-Locomotive-Site-Handle": "site_handle"
            }
    
        });
    
        setProp("memberships", memberships);
    
    {% endaction %}

    You could then set the page in question to be restricted using Locomotive's built-in authentication. Then match the email address of the front-end user to the back-end user so that only authenticated users who also have a back-end membership can view the page.

    Hopefully that makes sense. Hit me up again if you have questions.

    Chris Dyer
    @dyerc
    Hi @greyskin , thanks very much, this is really helpful. I hadn't thought of querying the API from an action, but it's a good solution. Thank you!
    Luke Grayson
    @greyskin
    @dyerc no worries! Glad I could help. :smiley:
    Jase Kraft
    @jase-k

    Anybody know how I can organize my file system better than having all the sections in the folder app/views/sections

    (i.e. split into multiple folders like: app/views/sections/folder1 && app/views/sections/folder2)

    When I put my sections into different folders, those sections don't show up in the User Interface

    Peter Salomon
    @patternpoints
    @jase-k Sounds like an awesome feature to me either. My list is growing extremely long. The only option to organize your sections is ( as far as i know) to use categories. I have mine sorted with categories like 1. Heros, 2. Call To Actions, 3. Contact Forms, 4 Banners, ... 10. Footers.
    Peter Salomon
    @patternpoints
    Another issue that comes along with a huge amount of sections is to identify which section you have used once it is in usage. Either you see the shortened content of the first element in the section or you see the section name but then you dont get a hint that helps you to identify which section you are looking for. I´t be great if you could have both: shortened content plus section name
    Jase Kraft
    @jase-k

    @patternpoints Thanks for the response! I've sorted with categories for the Engine, but I was thinking it'd be handy to sort by categories in the backend. So you could have a folder structure like:

    + sections
        - Heros
             - full_width.liquid
             - portrait.liquid
        - Call_To_Actions
             - button.liquid
             - animated_button.liquid
        - Contact_Forms

    Inside your codebase.

    Jase Kraft
    @jase-k
    Anybody able to add a subdomain to their website but keep it all on one backend engine? E.g. blog.example.com and example.com
    Manu
    @manuchap
    Yes. Just did it on a site.
    Then you can use something like {% if host contains 'blog' %} in your templates.
    Depending on your server you'll have to declare a cname for each domain.
    Jase Kraft
    @jase-k
    I have an A record pointing to our server IP address.
    Manu
    @manuchap
    I'm on a mutualized server but from what I can tell I've got an A record too but also a cname for each record with the domain as a host name (eg blog) and a dns server as value.
    Jase Kraft
    @jase-k
    I'm pretty sure I just figured it out. Thanks! It was right under my nose the whole time.
    Samba Gueye
    @sambag:matrix.org
    [m]

    Hi guys. Itś possible to sync all content_entries excepted customers data? Imagine you have 20000 customers, the command bundle exec wagon sync env -r content_entries will take much time to execute and a timeout error will be returned.

    May be itś possible to sync only a specific content_entry by bundle exec wagon sync en -r content_entries -f mySpecificContentEntry -v ?

    Luke Grayson
    @greyskin
    Hi @sambag:matrix.org, I feel your pain. Unfortunately the syntax you've described doesn't work as expected as per locomotivecms/wagon#403.
    Manu
    @manuchap
    @sambag:matrix.org One way would be exporting your entries in csv and use an online converter and a little scripting to produce the yml.
    Carlos Virreira
    @carlosvirreira_twitter
    Hey all! I am wondering if someone has a way to 'duplicate' pages in the LocoCMS?
    Manu
    @manuchap
    Not from the back-office. Unless you use a layout that's fully editable and copy/paste the contents. You can do it from wagon and change the filename/slug/handle/title.
    Luke Grayson
    @greyskin
    @carlosvirreira_twitter - what Manu said. Page duplication from the Back Office would be a cool feature. Closest thing to it is using Layouts which at least give you a starting point.
    Amit_lt
    @VenomINJECT3R
    Hey Team LocomotiveCMS i want to confirm that the demo version is latest version or update version??
    I mean oldest version or latest version?
    Andy Brown
    @geekygrappler

    Hi, just looking at locomotive. I'm trying to use tailwind css. I'm using tailwind cli to compile a file public/stylesheets/tailwind.css. I have the issue that tailwind stylesheet has this rule:

    abbr:where([title]) {
      -webkit-text-decoration: underline dotted;
              text-decoration: underline dotted;
    }

    when I try to deploy with wagon I get this error
    persisting stylesheets/tailwind.cssWarning: Unable to compress and minify it, error: Invalid CSS after "abbr:where(": expected pseudo_expr, was "[title])"

    I am not really sure how wagon is compressing and minifying the files. I think the abbr:where([title]) is acceptable CSS? How can I get the file to be compressed and minified correctly?

    OR is there a better way to include tailwind?

    Thanks!

    Jase Kraft
    @jase-k
    @geekygrappler we use webpack to minify and purge excess CSS. We still get the warning when deploying with wagon, but it has already been minimized.
    image.png
    I haven't used tailwind myself, but we do import bootstrap and use scss files that get compiled and minified down into a few files.
    Manu
    @manuchap
    Hi guys! Been flirting with Tailwind lately and since I struggled a bit I put this repo on GH to get started.
    PRs are welcome 🤓
    Chloe Coyle
    @ccoyle1
    Hi. So we added Polish to our site and by default there is no translations or localising of the content in the models, it is just meant to show the English version. But adding the language, it doesn't show any of its content even after using the Wagon back office to re-save it for Polish. It is only an issue with 2 pages that both have a content type with a type: select and uses with_scope to display the content. Does anyone have any ideas as to what could cause this problem or potential fixes? Thanks.