Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 16 19:28
    morgant commented #898
  • Sep 16 13:59
    morgant commented #898
  • Sep 13 09:45
    jhovad commented #865
  • Sep 11 22:14
    morgant commented #898
  • Sep 10 20:25
    morgant opened #898
  • Sep 09 12:07
    kbroderick commented #865
  • Sep 09 12:06
    kbroderick commented #865
  • Sep 07 16:16
    kbroderick commented #865
  • Sep 07 15:47
    Tongboy commented #865
  • Sep 07 09:21
    Dreamersoul opened #897
  • Sep 05 13:22
    kbroderick commented #865
  • Aug 13 16:20
    Tongboy synchronize #892
  • Aug 13 16:09
    Tongboy commented #892
  • Aug 13 16:06
    Tongboy synchronize #892
  • Aug 13 11:51
    gr8bit commented #892
  • Aug 13 11:50
    gr8bit commented #892
  • Aug 12 18:13
    gr8bit opened #896
  • Aug 12 18:07
    Tongboy commented #892
  • Aug 12 18:04
    gr8bit opened #895
  • Aug 12 18:02
    gr8bit opened #894
Oleg
@GBH
:thumbsup:
oscarsan
@oscarsan
Hi, should this be working in order to add classes to image tags
{{ cms:file image, as: image, class: "img-fluid"}}
if i want to use bootstrap classes for example?
oscarsan
@oscarsan
ok, is an option in 2.0.18 but in that one the export/import is broken. @GBH are you going to make some version soon? :-)
Oleg
@GBH
I'll take a look at the import/export issue later. Appreciate the PR though.
oscarsan
@oscarsan
Thanks @GBH issue is fixed in master, I can live with that, had just to path the gem in production. cheers.
Michael Chaney
@mdchaney
Is there a way to include a link to a file in the css for a layout? I have searched and can't find anything. We need to reference files for background images.
I can easily put {{ cms:file_link 4, as: image }} in a layout, but not the css.
Oleg
@GBH
Not right now. Layout's css and js is not parsed so you can't use tags there. Technically it's possible to run that content through the cms renderer to accomplish what you want.
Take a look at the cms_snippet_render helper. Same idea. Take text, and then render it out: https://github.com/comfy/comfortable-mexican-sofa/blob/master/app/helpers/comfy/cms_helper.rb#L48
Michael Chaney
@mdchaney
Okay, thanks for the tip.
Ed Chavez
@EdSF
Hi, definitely a n00b and currently doing research. For comfy, is there any guidance/how-to on importing data - e.g. Wordpress? Perhaps in the seed process? Thanks!
Oleg
@GBH
@EdSF There's no automatic way to import wordpress. I think your best bet is to massage wordpress data into seeds files.
Ed Chavez
@EdSF
Thank you @GBH . Understood, I'll have to go deeper into comfy to understand its data structure correctly (I haven't) in order to seed the right object/s into the right places (db/tables) - that's actually what I meant (not really an automatic thing).
Peter Albertson
@petealbertson
Is there something comfy specific that needs to be done to get active_storage images to be served over SSL/HTTPS?
I already have force_ssl set to true
but images implemented via a WYSIWYG are rendering as HTTP
Peter Albertson
@petealbertson
it looks like re-adding those WYSIWYG images (since the force_ssl config was changed) updates the protocol
but perhaps there's a way to fix that without re-uploading all of these images... If anyone has advice, that would be greatly appreciated!
Petros Petropoulos
@petrospe
how to include layout in another layout?
Oleg
@GBH
@petealbertson It's just how wysiwyg works unfortunately. Image is uploaded and image tag is added to the html. If something changes about the ActiveStorage record, html content for the page is not going to be updated. You can use cms tags to insert AS files into content, but you lose the wysiwyg aspect of adding images
Petros Petropoulos
@petrospe
Thank you @GBH .
How to create an email contact form via comfy cms?
Oleg
@GBH
@petrospe Contact form is really not a content thing. You just need to create a normal controller/view for it. If you have CMS content that you need on that page, you can pull it into your view via helper methods: https://github.com/comfy/comfortable-mexican-sofa/wiki/Docs:-CMS-View-Helpers#helper-methods or you can insert form view partial into a CMS page.
Kips Davenport
@dp6ai
Im trying to add the wysiwig editor to a custom admin page, it was possible previously according to this comfy/comfortable-mexican-sofa#169 but If it works now, I cant work out how, any help appreciated.
Kips Davenport
@dp6ai
worked it out.. i targeted the text_area with $(document).ready( function() { $('#redactor-content-details').redactor(); } );
now you can add a class rich-text-editor or data attribute textarea[data-cms-rich-text] and Redactor should initialize for your textarea.
Michael Chaney
@mdchaney
Does CMS work as-is with Rails 6?
Oleg
@GBH
Haven't tried it yet, but it should. There are no real differences between 5.2 and 6. Just a couple of new features.
Christian Aust
@datenimperator
Gentlemen, can I have something like {{ cms:helper some_helper, param_a, key: param_b }} in a layout? It renders to ERB but doesn't get evaluated. Should it?
Oleg
@GBH
That tag just renders <%= some_helper(foo, bar) %> and should be treated like anything else in the rails template. What exactly are you seeing?
Christian Aust
@datenimperator
@GBH sorry, my fault. I'm build some kind of single-page app where multiple pages are rendered into one, and I forgot to eventually render those subpages. Simply included the content_cache attribute which contains the ERB alright.
Michael Chaney
@mdchaney
Is there any way to redirect from a higher-level path to a lower-level path. In other words, I want to redirect /newsletter to /newsletter/2019/08. The redirect dropdown doesn't include the current path or anything in it.
Christian Aust
@datenimperator
@mdchaney I suppose that'd be easy using a Rails helper and the {{ cms:helper some_helper }} syntax within your top-level page. The helper would probably contain something like controller.redirect_to path.
Christian Aust
@datenimperator
I'd like to add files with metadata to a page, mp3 files in this case. Attachments hold a file reference only, what other way could you think of?
Michael Chaney
@mdchaney
@datenimperator I ended up simply creating a top level page called /newsletter-current that is a redirect set to the current newsletter. Then, /newsletter simply redirects to /newsletter-current. That works fine, although it is two redirects.
Peter Albertson
@petealbertson
What's the Comfy approved™ way to build a sitemap? I see there's a enable_sitemap flag in the repo, but I can't find any other information on where/how that's used.
I was looking into the rails sitemap gem but it requires the routes exist in routes.rb
Christian Aust
@datenimperator
@petealbertson from what I see the enable_sitemap isn't used in the code anymore. It had been added 8 years ago, maybe Comfy had sitemaps built in at that time? Having said that, the sitemap gem looks as if it could be used with Comfy. Then again, you could simply build a sitemap using standard Rails. See https://git.software-berater.net/christian/daemsing/commit/cee88439b221f3979e7a4c5a38bcf16b06436538 for an example.
Michael Chaney
@mdchaney
Here's how I did a sitemap. First, in config/routes:
get 'sitemap.xml' => 'main#sitemap', as: :sitemap
In my main_controller.rb file:
  def sitemap
    @cms_site = ::Comfy::Cms::Site.first
  end
Finally, app/views/main/sitemap.xml.builder:
xml.instruct! :xml, :version => '1.0', :encoding => 'UTF-8'

xml.urlset :xmlns => 'http://www.sitemaps.org/schemas/sitemap/0.9' do
  @cms_site.pages.published.each do |page|
    xml.url do
      xml.loc page.url
      # just take some guesses the closer to the root means higher priority
      # start subtracting 0.1 for every additional child page, max out at 0.1
      # "/" splits to 0, "/child_page" splits to 2, hence weird max -1 
      xml.priority [1 - (0.1 * ( ( [page.full_path.split("/").count, 1].max - 1 ) ) ), 0.1].max
      xml.lastmod page.updated_at.strftime('%Y-%m-%d')
    end
  end
  ['join', 'renew', 'login'].each do |path|
    xml.url do
      xml.loc "//#{@cms_site.hostname}/#{path}"
      xml.priority 1.0
      xml.lastmod Time.zone.local(2019, 7, 1, 0, 0, 0)
    end
  end
end
Note that /join, /renew, and /login are extra non-CMS paths that I am also adding.
Peter Albertson
@petealbertson
that's helpful, thank you @mdchaney, I'll give that a shot
Alexandra Grancho
@agrancho
Hello :) I have a snippet, let's call example_snippet with my navigation. I wanted to pass it their text variables in order to be able to edit them in the pages. I imagine that in the layout, something like this {{ cms:snippet example_snippet, text:variable_text }}
What I would like to do ideally is never make the user go and edit the text of a snippet inside its HTML structure (just to understand the issue)
Ghost
@ghost~5d7681ced73408ce4fca6d20
Hi there! Could anyone point me please at the wiki docs for version 1.12? Well, docs in any form, especially on tags. Thanks a bunch!
Morgan Aldridge
@morgant
we're running into errors when attaching images to file fragments: comfy/comfortable-mexican-sofa#898