Ember.js trouble with select and radiobutton bindings example - ember.js

I'm new with Ember and have a big troubles with basics. Can you answer on two questions:
There are two users, next to the name of each there is a link "Edit" which opens an edit form. In the form there are text inputs and SELECT with the names of cities. If I choose to edit the item in the entire form perfectly substituted data and shows the current city in SELECT. But when I then click on the editing of another item SELECT remains with the previous city(
I think this is something about bindings. This is my jsbin http://jsbin.com/bidoma/8/
How did add/edit form with radio buttons? Do you have working jsbin examples?
Waiting for an answer :)
UPD: Comment to first question. The question is how to update the selection when the edited object has been changed?

This was easy. To get object instead of promise needed write content in the end of the my selection value.
It should be
selection=model.city.content
instead
selection=model.city

Related

Custom Product.tpl with declination crash when select attribute and url change Prestashop 1.7

I have to create a custom page for only one product with declinations, so I have created "product-158.tpl" file with a new hook for a new module. (158 is the ID of the targeted product)
The page works well when the product is not to complicated to select, but if I need declinations as color or size, the new layout is replaced by classic product.tpl version and every customed things desapeared. The problem comes when the hidden "refresh" button is trigged and the "add-to-cart-or-refresh" form is submitted. If I erase the hidden button, I can select what I need to select, the cart recognise my order, I can buy the right declination, but If I click the "continue shopping" button, the same problem is displayed.
The problem comes when url change, maybe because of the new ID of the product, I really don't know. I'm searching from two month.
Thanks a lot to who will help me.
Why not park the base tpl, and call your hooks, and apply only changes that the product ID is 158?
Regards

How to fill dynamic form fields using capybara

I have a form that contains a select box and a text field.
The text field is displayed dynamically based on the selectbox selection. If the value of selectbox is "Yes", then the text field will be displayed and vice versa.
I am running an rspec test and filled the select box value with "Yes"
select 'Yes', from: 'property[have_water_bills]'
Now i want to fill a value on the text field
fill_in 'property[irrigation_cycle_count]', with: 5
But i am getting the following error.
Capybara::ElementNotFound:
Unable to find field "property[irrigation_cycle_count]"
That is, capybara cannot find the dynamic element. Does anyone know how to fix this?
Poltergeist doesn't gemerate a click event when choosing an item from a select. It generates a focus on the option, change on the select, blur on the option. It is more like if a user selected the option with keyboard instead of using a mouse. You probably should be doing the logic to display your text field on the change event anyway so that it works if people use a mouse or a keyboard to navigate around your page. It also makes more sense to run your show/hide logic on the change event because that's what you actually care about, not clicks.
Finally got this to work using the following piece of code
page.execute_script("$('#have_water_bills').val('true').trigger('click')")

Sitecore Item Display Name is encoded automatically

When editing a Sitecore item that contains HTML in the Display Name (e.g. Title), the HTML is encoded immediately. Editing Display Name a second time shows that <em>Title</em> has been converted to <em>Title</em>.
We don't have any custom code that would do this; is there a configuration parameter or something that would control how display name is encoded?
[EDIT]
To clarify, if I edit an item's Display Name to add HTML, and then edit it a second time, the HTML contained in the Display Name has been encoded. There are several older items that contain HTML in the Display Name field and it is rendered correctly.
For example, first I edit an item's Display Name to add emphasis tags...
...you can see how the Display Name is updated in the content tree.
However, if I edit the item again, Sitecore encodes the HTML as show below...
Oddly, there are other (older) items in the content tree that already have HTML in their Display Name, and the HTML is correctly rendered (see below item with tag in the display name).
My question is: what could cause the HTML to be encoded?
To answer the question "Why would you want to do this in the first place?", I would respond with the answer that this is legacy code that used to be working and is now suddenly not. I'm not building a new system; this is an existing web site that I'm troubleshooting.
Your question is a little bit confusing. What exactly are you expecting to see vs. what you are actually seeing? Display Name is a simple text field, it's not rich text... I don't believe Sitecore is doing any encoding here.
Now you can make Sitecore skip the decoding step for single-line text fields by removing the Sitecore.Pipelines.RenderField.GetTextFieldValue from the renderField pipeline. Then you'll get exactly whatever is in that field rather than <em>Title</em>
OK, I think I get why your question is confusing me now. The input from you question was decoded?
EDIT: BTW, this pipeline entry GetTextFieldValue was a recent addition... some time between 6.3 and 6.6.

How should I create an action on the content tab of a folder that acts on all items that are selected?

I asked a series of questions in a post last week, and the person who answered very wisely suggested that I split it into separate questions. I have added a CMF action for folders called "Remote Publish". The button now shows up when viewing the "Content" tab for all folders. How would one now add the logic to do something as simple as writing the titles of the selected items to a log when the button is clicked? Ultimately I will have the selected items share their titles with a web service that I have written, but I am thinking baby steps :D Any help is appreciated.
The simplest thing you can do is: copy what other button are doing!
For example: copy the CMF skin script name folder_delete.cpy. You'll see that paths parameter if loaded from the REQUEST.

Input list of items from user

I have a website with a form where users can type a free text in a textarea. I allow them to use Markdown but most of them don't use it and they usually publish crappy content, even after seeing a preview of the end result :-(
Given that most users enumerate things (job requirements) in that textarea I'm thinking that it would be great if I could somehow "force" them to create a list of items. Also, I think it would be valuable to provide them with some visual feedback while they are typing. For example, displaying some bullet points close to each item of the list they are creating and creating a new bullet point when they hit enter.
So basically, I would like to transform a textarea in a WYSIWYG editor that only allows users to create a list of items.
Any ideas?
Take your pick:
https://github.com/cheeaun/mooeditable/wiki/Alternative-Javascript-WYSIWYG-editors
These can all be configured to only allow for bullets.
Your answer lies here:
As soon as a user focuses the textarea field, a bullet will appear. With every Enter key, a new bullet will show.
Also, a user can delete the bullet if not required and continue with normal text.
http://jsfiddle.net/abhiagrawal87/m39xt
Sample snippet:
$(".todolist").focus(function() {
if(document.getElementById('todolist').value === ''){
document.getElementById('todolist').value +='• ';
}
});