Bcat
(Bcat)
April 23, 2021, 11:18am
1
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 Like
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 Like
Bcat
(Bcat)
April 23, 2021, 1:38pm
3
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.
Connectors seem to also be supported for server side rendered erb files.
1 Like
Which plugin was this out of interest?
Bcat
(Bcat)
April 23, 2021, 1:51pm
6
A Discourse plugin that lets you use topics to rate things!
Features
Rate topics by a star rating system in the composer.
Enable different rating types on a per-category or per-tag basis.
Toggle rating count and average rating per rating type.
Toggle visibility of ratings, counts and averages based on user roles.
Bulk actions including rating type migration
[Screenshot 2020-08-21 at 11.12.32 AM]
Get the code
Report a bug
Lost?
Not sure how to install a plugin? F…
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 Like
Bcat
(Bcat)
April 23, 2021, 1:54pm
8
I’m trying to see what it is
<%= @topic_view.topic.inspect %>
<%= @topic_view.topic.tags.inspect %>
<%= @topic_view.topic.tags[0].inspect %>
Bcat
(Bcat)
April 23, 2021, 2:01pm
9
Thank you.
I don’t know, testing the code and running it takes a long time … 90% of the time is waiting
1 Like
You cannot run it locally to test it? Always good to test something locally first before deploying. As you say, time.
1 Like
Bcat
(Bcat)
April 23, 2021, 2:05pm
11
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 Likes