Separate Kendo Scheduler Editor Templates - templates

Am I able to load a custom template based on a condition?
eg..
If I was making a booking for a mechanic then the editor form would show textboxes for carmodel, yearmake etc.
If I was making a booking for a carpet cleaner the editor form would show textboxes for howmanyrooms, room sizes etc..
Am I able to pass an ID of a service and show the particular editor form for the correct service?
we can currently display this functionality if we create different scheduler Views but that would then create a duplication of many pages.

I had the exact same problem and after searching a long time and combining what I found, I came to this :
1) above my scheduler I have a kendodropdownlist
<input id="reservationPicker" />
<script>
$("#reservationPicker").kendoDropDownList({
dataTextField: "name",
dataValueField: "reservationDefTypeId",
dataSource: reservationPickerDataSource
});
</script>
2) my event has an extra field reservationDef which will hold the information of the dropdownlist.
3) I can use this information in my template
<script id="editorScheduler" type="text/x-kendo-template">
<center>
<div id="main">
#if(reservationDef=="mechanic"){#
<h3>Mechanic stuff</h3>
#}else if(reservationDef=="carpetCleaner"){#
<h3>Carpet Cleaner stuff</h3>
#}else{#
<h3>unknown type of reservation !</h3>
#: reservationDef #
#}#
</div>
</center>
</script>
4) I use this template in my scheduler
editable: {
template: $("#editorScheduler").html()
},
5) but what with a new appointment ! I use the add event of the scheduler and I fill in this information in the event
add: function (e) {
var reservationTypes = $("#reservationPicker").data("kendoDropDownList");
var selectedReservationType = reservationTypes.dataItem();
e.event.reservationDef = selectedReservationType.appointmentTitle;
},
This does the trick for me. Good luck !

No I didn't but I did find a work around by dynamically adding textboxes on the following page. To b able to choose a view model at runtime for the scheduler didn't seem possible
if anyone knows how to load a particular viewmodel at runtime using mvc would be very intresting for future ideas and development.

Related

In C1 CMS How to create a list dynamically by getting input from user at the function property window?

Actually I am trying to create two controls one is drop down and another is List. Both are similar and easy for static values or values which are already stored somewhere.
But what I want is, I want the Power user to create or add / edit list items at the run time ( When he is inserting function to the page )
so similar concept to this : http://jsfiddle.net/DVbGY/1/
<div data-role="content">
<div id="items">
</div>
<input type="text" id="item" />
<input type="button" value="Add item to list" onclick="appendToList()"/>
<script>
var listCreated = false;
function appendToList(){
if(!listCreated){
$("#items").append("<ul id='list' data-role='listview' data-inset='true'></ul>");
listCreated = true;
$("#items").trigger("create");
}
var value = $("#item").val();
var listItem = "<li>" + value + "</li>";
$("#list").append(listItem);
}
</script>
but in the function property window.
Currently I am using comma separated list from user but its not viable solution as my next step is to add url as well with the input data from user so Lets say user wants to create a drop-down button and user is adding items and associating particular link to its items.
As you can see in above image i am getting data from user but instead of that text box i want to use above mentioned similar concept.
How can I make this possible ? or Is it possible in C1-CMS ? if yes please explain with Example in detail.
Thank you for your time and thanks reading this post.
It is not possible with the currently built in widgets.

customize the yammer feeds

I am getting the yammer feeds on my page using the following code in content editor webpart.
<div id="embedded">
</div>
<script src="https://assets.yammer.com/assets/platform_embed.js"></script>
<script> yam.connect.embedFeed({
container: "#embedded",
network: network,
feedType: "group",
feedId: "all",
config: {
header: false ,
footer: false,
}
});
</script>
Is there a way to iterate through each of the feeds and customize on how it appears?
I'm facing the same issue. The embedded feed is contained in an iframe, which is under the yammer.com domain. It would be very challenging to access those dom elements from your app's domain, due to the same origin policy, let alone to modify them. You may find hacks or work-arounds but they are not trivial tasks to achieve.

how to write an onclick function in joomla registration section

First of all I am new to this joomla CMS. I have a joomla project. here i have customized the userprofile plugin and added some more fields .
in registration form i need an extra button named "Save for later ". thus my form contains 3 button ( save for later, Register and cancel )
i need to write a javascript function in the onclick event of "save for later button ".
So i have done
In components/com_user/views/registration/tpl/default.php I have created a button as in normal way. and wrote a javascript function call on this
<input type="submit" class="validate" value="Save For Later" name="SaveDraft" onclick="fnSaveDraft()">
At the top of the page i write the function
<script language="javascript" type="text/javascript">
function fnSaveDraft() {
alert('hai');
return false;
}
</script>
But nothing happend
Please advise me
I would like to suggest you to that don't change the core file unless you really needed.You can use the template overridden method for task.For detail go to that link.
How to override the output from the Joomla! core.
And for your problem your are using the input type as submit that why your form will submitted and your function was not call. You can use type as button then your task will be done.Replace your input field with this.
<input type="button" class="validate" value="Save For Later" name="SaveDraft" onclick="fnSaveDraft()">

Django Crispy Forms - Add Button via Helper

I studied the Crispy-Forms documentation and I tried to put an extra button into one of my forms. With
self.helper.add_input(Button('back', "Back", css_class='btn'))
I can add a nice button. But the Button() wont take an onclick or on_click-attribute. So how can I add logic to this button? Adding an onclick event with JQuery isnt a very nice solution...
Thanks!
Ron
Are you certain that Button will not take onclick in its kwargs?
I just added an onclick="javascript here" to a Submit() element and it displayed fine.
I also peered a bit at the underlying code, and I think all inputs by default flatten the kwargs that aren't popped because of special use (i.e. template), and pass those through into the rendered HTML. This may be new since April '12 (when originally posted), but it currently seems to be as simple as the following:
self.helper.add_input(Button('back', "Back", css_class='btn', onclick="alert('Neat!');"))
This is not included by default (afaik..).
If you just need this once, is possible to use crispy-forms HTML Layout Object
HTML('<input type="button" name="Save" onclick="do_whatever" />')
What do you then dislike using jQuery? You could handle this rather easy and generic, using something like:
$('form :submit.ajax_submit').live('click', function(e) {
e.preventDefault();
var my_form = $(this).parents('form');
// do whatever
alert(my_form.attr('id'));
alert(my_form.attr('action'));
});
and then just pass the class:
Submit('save', 'save', css_class='ajax_submit')

Managing a list in umbraco 5

I have recently started working on an umbraco 5 project and am finding it a bit of a struggle compared with umbraco 4. What I am trying to do is have a list of items that are managed in the content section of the site where users can add items to a list, this list is then used in drop downs and page categories throughout the site.
I am looking for the best way to do this, I am currently part way through creating a property editor that manages a list of text boxes but not sure if this is the best way of doing it, and Im currently not entirely sure of how to go about doing even this. I can save one property no problem, but a dynamic list?
Can anybody give me some idea of how they would go about doing this with some code examples, theres not a huge amount of resources for 5 out there at the minute.
Many thanks to those who contribute.
UPDATE
I have now copied the multiple textstring property editor from the source code and am looking to update it to have an extra text input. Its using the knockout javascript library of which Im not too familar with, below is the code I have so far, does anyone know how I would update this to save both text values to the database?
<ul class="relatedlinks-textstring-inputs" data-bind="template: { name: 'textstringRow', foreach: textstrings }"></ul>
<script id="textstringRow" type="text/html">
<li style='width: 250px;'>Name<input type="text" data-bind="value: value" />Url<input type="text" data-bind="value: value" /></li>
</script>
#Html.HiddenFor(x => Model.Value, new Dictionary<string, object> { { "data-bind", "value: value" } })