FullCalendar - flexible time range for day\week agenda - fullcalendar

I was trying to play with the minTime and the maxTime, I need the hours range to be from 6:00am untill 5:30am.
Unfortunately this is not possible, I've tried to use the 'minTime' and 'maxTime' and it gave me an empty calendar.
Is there any workaround that you guys know about ?
Many thanks :)

Moving to answer from the comment.
Looking at your requirement I think there is only one option, you have to change the code of the plugin. I can tell you that inside function "buildSkeleton" it creates the dom with css "fc-slot" there it format the time before it shown in UI. You have to change there probably to meet your requirement.

My workaround will be allowing event creation until next hours on the next day. I'm doing this by very little code changes, find the following code on your fullcalendar.js,
function slotSelectionMousedown(ev) {
and find where it says,
if (cell && cell.col == origCell.col && !getIsCellAllDay(cell)) {
then remove cell.col == origCell.col so it will be if (cell && !getIsCellAllDay(cell)) {,
then on your fullCalendar init call, set selectHelper to false or don't define it at all.
EDIT: add demo (select 'Futsal'), http://buking.my/Galaxy

Related

Is it possible to show all options in Tokenize2?

Tokenize2 is a javacsript lib to select multiple options.
It provides a very neat UI to start writing and then get a list of options to select from. Selected options will show up as "tags" that can be removed with "x" link.
So far all is fine. But Right now you need to know what your looking for and start write at least one character to see matching alternatives.
In my scenario there are very few alternatives and they are not known to the user. I would like to show ALL options when the user clicks the input box. There is a configuration option named searchMinLength but it is already set to 0.
Is there a workaround that can be used? Maybe like triggering load and dropdown manually?
I know there are a lot of similar alternatives but I picked Tokenize2 because:
It looks clean and nice
It works in mobile browsers
I don't know if there is an "official" approach, but after some investigation I have found an acceptable workaround.
After downloading the Tokenizer2 sourceode I found the following line that triggered my attention:
if(this.input.val().length > 0){
this.trigger('tokenize:search', [this.input.val()]);
}
My interpretation is that the internal search command is not triggered unless the user input has at least one character. This line in sourcecode could easily be modified. I have filed a suggestion for this here: https://github.com/zellerda/Tokenize2/issues/26
My current workaround is to add an event listener for the select event and there trigger the internal search command. That works fine for my scenario and does not force a source code rewrite.
$("#my-dropdown").on("tokenize:select", function (e: Event, routedEvent: boolean) {
$("#my-dropdown").trigger('tokenize:search', "");
});
Tokenize2
This link worked for me GitHub
$('.tokenize-sample-demo1').on('tokenize:select', function(container){
$(this).tokenize2().trigger('tokenize:search', [$(this).tokenize2().input.val()]);
});

Telerik RadGrid: Show column only in edit mode?

I'd like to "hide" one column in my RadGrid and only have it show when I'm in edit mode. I tried just moving it into the edit item template, but that didn't work at all.
Any suggestions would be deeply appreciated!
Thank you!
Oy...
"Paul's Third Law of Asking For Help
You will discover the obscure answer 5 minutes after giving up and asking for advice."
Turns out you set the column to "Display=False" but only if you are in popup or edit form mode, not inline.
Hope it helps someone else.
Even though you did answer this yourself I thought I'd write an answer to clarify some things.
You can set the default value of the EditColumn to be false, even in InPlace edit. However it makes it a lot more difficult to save edited data as the InPlace edit (for simplicity) requires the EditColumn to display the save or cancel items.
That being said, you can do it - however you need to use explicit CommandNames on the items:
Say you want to Update a row with the new values you have inserted in the InPlace edit. Then the confirm button's CommandName would HAVE to be "Update" to be picked up correctly.
All of this being said, it would be a lot simpler for you to keep the EditColumn intact even when in InPlace (editmode).
Or you could specify the EditTemplate for one column to widen the column, add the two buttons necessary to perform Update and Cancel as well as hiding the EditColumn so that multiple InPlaceEdits can't be performed at the same time. :)
I hope this helps someone, as I was stuck in a similar situation myself when I had to incorporate both InPlace and EditForms EditModes on a single RadGrid and knowing the above information made a WORLD of difference.
You can try this:
var agtype = $telerik.$(atCell).text().trim();
if(agtype == ""Guaranty""){{
var masterTableView = sender.get_masterTableView();
var columnIndex = masterTableView.getColumnByUniqueName(""Amount"").get_element().cellIndex;
masterTableView.showColumn(columnIndex);
}}

Prestashop 1.6 / How to get carrier id, to use it in order-carrier.tpl

I'm using Prestashop 1.6
In order-carrier.tpl, I'm trying to get the carrier id, because I would like to use it in the css class of the <div>.
For exemple : div.delivery_option.carrier_id_33
I tried this :
{$cart->id_carrier}
But it doesn't really work.
If it's in TPL file, you need to use getcontext() first
So in this case it would be
{context::getContext()->cart->id_carrier}
Late answer here, but I write mainly for future reference.
First, there should always be a global $carrier smarty variable available to templates. Just check placing a {debug} tag on the place you want to use it and see if it's there.
Second, DO NOT use id_carrier. It's quite strange but you will loose it. It's not a really reliable property. I discussed the issue with the developers some time ago. You should use id_reference instead: that won't change.
http://forge.prestashop.com/browse/PSCSX-4651
So, to sum up:
{assign var=carrier_instance value=$carrier.instance}
{* then later somewhere: *}
{$carrier_instance->id_reference}
this will do the job.
Try this code
<div class="delivery_option {if ($option#index % 2)}alternate_{/if}item {foreach $option.carrier_list as $carrier}carrier_id_{$carrier.instance->id}{/foreach}">
The carriers are not directly accessible, but they are encapsuled inside the variable $option
Since I always get here whenever I search for id_reference from smarty I'll post my solution for 1.7
{$carrier_id = context::getContext()->cart->id_carrier.id_reference}
Returns the carrier_id_reference, the nice one cause carrier_id changes everytime you modify a carrier, so the real ID you need in order to operate with carriers is id_reference

Add a timestamp and info to a saved CSS/HTML file

Looking for a way to add a custom timestamp(and maybe some extra info) inside a CSS/HTML file everytime you save the file. Is there an extention for brackets, sublime or dreamweaver that does this, Or perhaps some other way to do this?
Thanks
I think this post will give you a Sublime Text plugin that should do what you ask.
In Brackets, you can configure the snippets extension to insert a timestamp manually, like the answer above for Sublime. Here's how: https://stackoverflow.com/a/18844762/1172352.
Similar to the Sublime answer, it would be a bit trickier to do it automatically every time you save. There's not yet a clean hook in Brackets for pre-save processing. Several extensions get around this by listening for a post-save event and saving quickly a second time. You could probably write a timestamp-auto-inserter extension by borrowing their code for that pattern.
Anything that runs automatically would also need a little extra code to find the old timestamp and replace it -- both the snippets solution here and the Sublime solution above just insert the timestamp wherever the cursor/selection is. A regular expression should do the trick for detection.
You'd also want to screen out other file types. Bringing it all together, it would look something like this for Brackets:
function documentSavedHandler(event, doc) {
// TODO: need a little extra code here to ignore save events triggered
// by ourself, to avoid infinite loop
var langId = doc.getLanguage().getId();
if (langId === "html" || langId === "css") {
var pos = /* use regexp to find old timestamp */;
doc.replaceRange(timestampStr, posStart, posEnd);
CommandManager.execute(Commands.FILE_SAVE);
}
}

UIGestureRecognizer on multiple view

There is several examples on here about how to get multiple views recognized by a single UIGestureRecognizer. I have this code, and i've tried varies ways to get it work but unfortunately doesn't seem to work. I would appreciate it if one can shed some light on this.
the only way that i was able to get it to work if I create several (IBAction) functions but i have up to 100 views that need to be moved around so that would require to have 100 different functions. I read an example here where tag can be used to do just that but i tried it and unfortunately it does not work. I'm using XCode 4.6.1 if that helps. Here's the code below.
-(IBAction)handlePan:(UIPanGestureRecognizer *)recognizer{
UIView *player=recognizer.view;
int tag=player.tag;
[player addGestureRecognizer:recognizer];
if (tag!=0) {
CGPoint translation =[recognizer translationInView:self.view];
player.center=CGPointMake(player.center.x+translation.x, player.center.y+translation.y);
[recognizer setTranslation:CGPointMake(0, 0) inView:player.superview];
}
}
It seems to me that you are adding the same gesture recognizer to the view that already has it. You could use a loop using the tag to add the UIPanGestureRecognizer to all your views and then in the method handlePan:(UIPanGestureRecognizer *)recognizer check which view is currently being panned and continue from there.

Resources