كيفية التحقق مما إذا كانت علامات الموضوع تتضمن معرف العلامة abczxyz؟

This my code:

<% if ( @topic_view.topic.tags.length > 0 and @topic_view.topic.tags.include? "abcxyza" ) %>
SOME THING
<% else %>

Full code: here

And is it wrong to make the site inaccessible?

Can you give me the correct code to check that article tags have an id tag named “abcxyz”?

إعجاب واحد (1)

Out of interest why are you using an erb file and not an hbs file?

Normally you would use an hbs template within a connector.

إعجاب واحد (1)

I am not good at coding so I have followed another plugin with the function that may interfere with the connectors.

So if you write it on hbs file will things be easier?

I could be wrong but connectors are ember components so you actually need to change your directory structure here to match a discourse ember structure as well. I would look at existing official or pavilion plugins for examples.

Then again if you are stuck on server side rendering because of ‘amp’ you may need a different approach closer to what you are already doing. However I’m not sure connectors work in that scenario? - I’m not your best advisor here and will open that up to the house. :slight_smile:

Connectors seem to also be supported for server side rendered erb files.

إعجاب واحد (1)

Which plugin was this out of interest?

is: discourse-ratings/app/views/connectors/topic_header/aggregate_rating.html.erb at main · paviliondev/discourse-ratings · GitHub

I just see how to insert an html clip into a topic and it still shows when viewing source. Previously I wanted to insert on the engine

Thanks. I stand corrected. Looks like you can.

إعجاب واحد (1)

I’m trying to see what it is

<%= @topic_view.topic.inspect %>
<%= @topic_view.topic.tags.inspect %>
<%= @topic_view.topic.tags[0].inspect %>

Thank you.

I don’t know, testing the code and running it takes a long time … 90% of the time is waiting

إعجاب واحد (1)

You cannot run it locally to test it? Always good to test something locally first before deploying. As you say, time.

إعجاب واحد (1)

Everything is done and I find myself stupid: D Instead of using $value[“key”] I use $value.key :))

You cannot run it locally to test it? => I created a new server and tested it.

Thank you very much, good day. @merefield

إعجابَين (2)

Very well done @Bcat!

إعجابَين (2)