show element on specific user with nodejs - node.js

I'm building a social app and under each image I have a comment section. I want to render every comment and to include a delete button only to the user that made the comment. Can anyone help me handle this?
here is how I render the comments:
{{# each image.comments}}
<div class="comments clearfix">
<img src="{{this.avatar}}" class="logo">
<span><strong>{{this.userName}}</strong><br> {{this.comment}}</span>
</div>
{{/each}}
`

You can track the comments for the images in the database. When a user comments for an image store that comment as well as check if the user Id is same as the owner id of the image. If so, then the user who just comments must be the owner and set a property like "isOwner = true" for the comment, along with the comment text.
And in the front end you can check this property and set a delete icon..
{{#each image.comments}}
<div class="comments clearfix">
<img src="{{this.avatar}}" class="logo">
<span><strong>{{this.userName}}</strong><br> {{this.comment}}</span>
{{#if this.isOwner}}
<i class="fa fa-trash"></i>
{{/if}}
</div>
{{/each}}

Related

How to display image from dynamic path in node ejs

I am trying to display image based on the path I get from database
here's my code
<% cars.forEach(function(car) { %>
<div class="card">
<div class="img">
<img src="images/" +"<%=car.Img_path %>">
</div>
</div>
<% }); %>
I also tried <img src="images/<%=car.Img_path %>"> but not working.
Can Anyone suggest how to render image.
Thanks In Advance.
<img src="images/<%=car.Img_path %>"> works. My issue was i didn't included Img_path in car model.
whoever may get this type of issue make sure you have included that field in model otherwise you will have data in database for but you wont get it in your application

ejs with progress bar

How to define or update style="width:<%=MettingPer %>;" for progress bar in ejs
<li class="list-group-item d-flex justify-content-between align-items-center">
Meeting
<div class="progress">
<div class="progress-bar progress-bar-striped bg-success progress-bar-animated" role="progressbar" style="width: 75%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">
<%=MettingPer %>%</div>
</div>
</li>
EJS is rendered on the server, not the browser, so EJS has no idea what document is since that's something that's only defined in the browser.
So for this you need to load your page completely on the client side with zero value.
Then complete it according to the instructions in JavaScript.
And as soon as you receive a response from the server, complete and hide it with a little delay.

Buildfire: How to remove the "saved" part?

I could use some hints to get rid of the SAVED content in the coupon Plugin -
Screenshot of the area i want to remove
Thanks in advance!
O.
In the file widget/templates/List-Layout-1.html file you will see the following code:
<div class="col-xs-6 pull-left text-center primaryBackgroundTheme">
<a class="whiteTheme stretch" ng-
click="WidgetHome.showSavedItems()">Saved</a>
</div>
You can just update it to the following:
<div class="col-xs-6 pull-left text-center primaryBackgroundTheme">
</div>
The widget has 4 layouts, so depending on the layout that you want to use, you need to make sure to update the appropriate template.

How to disable specific shipping method based on product's attribute value from checkout process

From, order_wizard_shipmethod_module.tpl
I found this,
{{#each shippingMethods}}
<a data-action="select-delivery-option-radio"
class="order-wizard-shipmethod-module-option {{#if isActive}}order-wizard-shipmethod-module-option-active{{/if}}"
data-value="{{internalid}}">
<input type="radio" name="delivery-options" data-action="edit-module" class="order-wizard-shipmethod-module-checkbox"
{{#if isActive}}checked{{/if}}
value="{{internalid}}"
id="delivery-options-{{internalid}}" />
<span class="order-wizard-shipmethod-module-option-name">{{name}}
<span class="order-wizard-shipmethod-module-option-price">{{rate_formatted}}</span>
</span>
</a>
{{/each}}
I'm wondering how can I get product's attribute value within shopping cart and disable specific shipping method?
If you're looking for the attribute values of each shipping method, then go to the Javascript file OrderWizard.Module.CartSummary.js and in the getContext function, after the confirmation variable is defined, put in console.log(summary);.
In your Cart, look in the console and within attributes is shipmethod and you'll find what you need in there.

Is there any way to control/route content by referrer value in Expression Engine?

Let’s say that I have a carousel on my index page.
Inside the template for index, it loads a particular channel, “Foo”
<div "slider">
<ul class="slides">
{exp:low_reorder:entries set="foo" dynamic="no"}
<li class="foo_{entry_id}">
<div class="container">
<div class="row-fluid">
<div class="span12">
{foo_html}
<style type="text/css">{foo_css}</style>
</div>
</div>
</div>
</li>
{/exp:low_reorder:entries}
</ul>
</div>
That channel, naturally, has a list of content items
I want the list of content items displayed to exclude one of the items in the channel if the referrer is not bing.
Can anyone show me the way that they would go about accomplishing that? I'm not getting any traction on the ellislab forum.
I whipped up a plugin for you, which you can find here
You can wrap the item in a conditional using that plugin to check if it should be output.

Resources