Rails 3 Post/Comments with Formatting (like in stackoverflow) - ruby-on-rails-3

I was wondering, it would be great to know how to allow users to format their posts in Ruby on Rails 3. Ideally, i was wondering if there are any gems or solutions to implementing a formatting system similar to stackoverflow, where the user can bold and underline text, and so on (ie provides a little partial above the post input field similar to the one above the input field we use to ask questions).
Any ideas?
Thanks everyone!

If anyone is still interested in this question, there are a bunch of options for formatting comments and for text editor helpers.
To be brief, I've checked out a whole bunch of options - but I found one that I think is awesome: ckeditor. Check it out at https://github.com/galetahub/ckeditor

Related

Umbraco Lucene search breaking on 'special characters'

When a user inputs certain special characters i.e a html tag, the user receives this:
Error loading Partial View script (file: ~/Views/MacroPartials/ezSearch.cshtml)
I have been investigating and this seems to be a common issue and I attempted to apply a fix so it would strip out 'bad' characters:
public string CleanseSearchTerm(string input)
{
System.Text.RegularExpressions.Regex rgx = new System.Text.RegularExpressions.Regex("[^a-zA-Z0-9 -]");
input = rgx.Replace(input, "");
return input.ToString();
}
However, the issue is that this error is getting generated before it has a chance to hit my method to strip out 'bad' characters. Any ideas of how this can be resolved?
I haven't tried these changes myself Kyle but I have done some investigation to help you fix this problem. Could one of the following solutions help you?
See this Umbraco form question and its answers, especially the one from Ismail Mayat could help you.
Linked to Ismail's answer, there is also this "How to make the Lucene QueryParser more forgiving?" question and I'd recommend you to check the answers for this question, too.
Another answer that might help you is this stackoverflow answer.
Lucene.NET does contain a few classes to help with HTML stripping. These classes are located here in the Lucene.NET repo. Specifically, the HTMLStripCharFilter may be of interest.

"Chapters" missing in PhpStorm "Search Everywhere"

I use PhpStorm for many years and for all this time the search results for "Search Everywhere" were separated in "Chapters" for Classes, Files, Actions and so on, as its shown in this screenshot (from the internet).
But recently I noticed that these "chapters" are gone and everything is just mixed together without any separation.
Now its very difficult for me to find what I'm looking for. I searched everywhere in the settings but couldn't find any options to bring back those chapters.
Am I missing something or is this feature just gone?
I'm using PhpStorm 2020.3.2.
Thank you very much for your help.
The behavior can be enabled back by disabling search.everywhere.mixed.results in Registry. To access it open Help > Find Action and type "Registry".

silverstripe dynamic backend for flexible frontend

I'm searching for a while, but didn't find a practical answer for the following problem:
An Articlepage in the Frontend can contain different types of sections. For example a block text section and than a text section with left photo an at the end an wallpaper photo.
Now I want to implement this in my backend dynamically, so that I can choose, which type of section and -even more important- how many sections my article should contain.
In my recent project I've solved the problem as an Articlesection with a Dropdown, wich contains the different section styles. And one article hat xy Artilesections as childpages. In the frontend I included all Childpages of the Article - so to speak the Articlesections, where I've checked with if conditions, which sectionsystyle I have in this Section and here I styled the section as I want.
For example Artilce1 has 2 Childpages: Articlesection1 and Artilcesection2.
In AS1 I have choose in the dropdown: right text with left photo and check with if conditions, to style the section. The same with AS2, that is for example a wallpaper photo.
This semiprofessional solution worked, but there are some bugs with displaying the Article correct in the backend, because I have to declare the Articlesections as Includes and not native childpages. And in generell this don't seems like the developers of silverstripe want the users to do it this way..
Are there better ways to implement a dynamically changing backend, so I can decide, which and how much sections I have in the frontend.
Take a look at https://github.com/sheadawson/silverstripe-blocks. There's quite a few addons that offer similar functionality as Blocks such as Elemental. The following blog post might also be useful too - https://www.silverstripe.org/blog/silverstripe-strips/.
Thank you for your reply, but there is a problem, because I don't work a lot with the terminal and the composer. In principle I want to install sheadawsons silverstripe-block. I have installed the composer and run the command:
"composer require sheadawson/silverstripe-blocks" it seems like it installed that correctly, because I became no errors, but what then? With dev/build -to refresh the database- happened nothing and the following instructions in the readmy chanced nothing. Should I copy any files in my Sivlerstripe web folder or what else..? I'm a bit desperate, because there is such a poor documentation.
Tank you

Aur comment field formattings

Supports the aur comment system formatting options like codeblock, italic, bold and something like that?
This answer sucks but its one of the top Google results for this. Although you shouldn't spam the comments with stuff, let it be known that AUR uses similar formatting to StackOverflow and Github:
Code uses backticks: surround with a single `code` or triple ```code```
Italic uses asterisks: *text*
Bold uses 2 asterisks: **text**
To answer my own question (for the codeblock part):
The AUR guidelines describe this here.
The AUR Web Interface has a comments facility that allows users to provide suggestions and feedback on improvements to the PKGBUILD contributor. Avoid pasting patches or PKGBUILDs into the comments section: they quickly become obsolete and just end up needlessly taking up lots of space. Instead email those files to the maintainer, or even use a pastebin.

utf8=✓ in rails 3.1 GET forms

When I use form helper with GET action, the resulting url shows utf8=✓.
It was caused by rails adding a hidden input utf8. My question is is it possible to remove this?
Why do you want to remove that field? According to this Rails Guides article it's quite useful and helps to overcome issues with some browsers (IE, I believe).
The first input element with name utf8 enforces browsers to properly
respect your form’s character encoding and is generated for all forms
whether their actions are “GET” or “POST”.
See this answer for a nice explanation about why you might need that parameter (previously snowman character was used instead of check mark).