Skip to content

Conversation

@ScriptyChris
Copy link
Member

@ScriptyChris ScriptyChris commented Jul 18, 2016

According to: https://trello.com/c/qJ8rbIeo/33-usuwanie-znaku-z-tagow

Here is a script that removes unnecessary hash symbols "#" (ommiting values like "C#") from tags written inside <input id="tags"> when user is creating a new post (asking a question).

// filter tags, accept only those without # and those like "C#"
var filteredTags = allTags.filter(function(hash)
{
if (hash.indexOf('#') < 0 || hash.toLowerCase().indexOf('c#') > -1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to put omitting languages in array.
What do you think?
we have C# F# ..
https://en.wikipedia.org/wiki/List_of_programming_languages

Copy link
Member Author

@ScriptyChris ScriptyChris Jul 26, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@efiku
Hmm.., I assumed that users will not search (and mark as tags) languages with "#" character, because there are any categories on forum for languages other than C# - except I forgot about category "Inne języki". Ok then, there may be questions and tags that contains languages with "#" other than mentioned C#.
I have looked on Your linked Wiki and what I saw is mostly 10 per 11 languages has "#" as second character, excluding "Visual J#" - which, on the other hand, I can't find was searched on Forum (so it can be almost sure, that nobody asks about that language).
Considering that fact and recalling KISSprinciple ( ;-) ) I propose to accept only tags, that have not any "#" or have it positioned as a second character in single tag. So for example these tags:
f# programming# newbie c# h#hash after filtering will be saved as f# newbie c# h#hash within this simple algorithm: return hash.indexOf('#') < 0 || hash.indexOf('#') === 1.
I only hope nobody put tags like "o#pomocy" :)

I hope You will agree with that solution.

I let myself pushed my proposal for Your suggestion: e4493f5

@ScriptyChris
Copy link
Member Author

According to what @awaluk mentioned and @efiku noticed, I did flitering only on # when they are on 0 position inside each tag, so:

a# newbie c# #blah problem#

will be eventually saved as:

a# newbie c# blah problem#

Additionally, I rewrote code to ES6 syntax.

Recent code: https://github.com/CodersCommunity/forum.pasja-informatyki.local/pull/31/files

@awaluk
Copy link
Member

awaluk commented Aug 3, 2016

In my opinion now it works well.

@ScriptyChris
Copy link
Member Author

ScriptyChris commented Aug 5, 2016

As for @magic96 advice I swapped IIFE to ES6 standalone block code (using advantage of ES6 const/let).
I also optimised code by changing .forEach to simple for..loop - because whole script is simple and so there is no need to use, previously applicated, Array method.

@efiku
Copy link
Member

efiku commented Aug 5, 2016

In my opinion now it works well.
@awaluk

Like this? → #34 (comment)
;)
If not, rebase from master

@ScriptyChris
Copy link
Member Author

ScriptyChris commented Aug 5, 2016

@efiku
In my opinion, these bugs You encounter are result of lacking the SyntaxHighlighter script and it's subject scripts (such as shBrushCpp.js and so on shBrush*.js and shBrush*.css). Along with @awaluk , we checked, that they are not present inside <head> at Virtual Machine forum (local), which causes that colored blocks with code are not such "beauty" as on production server as well as some weird things happening (with styling and code logics).

Temporary solution is that You and everybody who want to test recent PRs, need to add this:
https://gist.github.com/awaluk/b463b6ddccbd62e445a4f278e125fdae
into <head> (inside "Panel administracyjny - Wygląd" > "własny kod HTML w sekcji każdej strony:" ).

What about rebase. As I'am newbie to Git, I wait for @awaluk to do that rebase (so I will not crash some code accidentaly).

@efiku
Copy link
Member

efiku commented Aug 5, 2016

Temporary solution is that You and everybody who want to test recent PRs, need to add this:
https://gist.github.com/awaluk/b463b6ddccbd62e445a4f278e125fdae
into (inside "Panel administracyjny - Wygląd" > "własny kod HTML w sekcji każdej strony:" ).

NO.
JUST REBASE FROM MASTER AND RESOLVE CONFLICTS to PR's →#37

We are working on dev not prod development.

I'm checking every PR like this #34 (comment)
I can't merge something what is not working.
If you don't know how to rebase, there is a lot of tutrioals in web.

@awaluk
Copy link
Member

awaluk commented Aug 23, 2016

@CodersCommunity/users
Does anyone have any suggestions about this functionality?
If no, I suggest merge.

@efiku
Copy link
Member

efiku commented Aug 23, 2016

Please rebase and allow us to test with latest master branch state.

@efiku efiku closed this Sep 15, 2016
@efiku efiku deleted the feature/remove-unnecessary-hash-from-tags branch October 15, 2016 14:05
@awaluk awaluk restored the feature/remove-unnecessary-hash-from-tags branch October 24, 2016 19:05
@awaluk awaluk reopened this Oct 24, 2016
@awaluk awaluk closed this Nov 11, 2016
@awaluk awaluk deleted the feature/remove-unnecessary-hash-from-tags branch November 11, 2016 22:17
@CodersCommunity CodersCommunity locked and limited conversation to collaborators Nov 12, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants