Skip to content

Instantly share code, notes, and snippets.

View markleusink's full-sized avatar

Mark Leusink markleusink

View GitHub Profile
@markleusink
markleusink / draggable.directive.ts
Last active January 25, 2023 13:42
Angular directive to make ngx-bootstrap modals draggable
import { Directive, ElementRef, HostListener, AfterViewInit } from '@angular/core';
/*
* Directive to add 'drag' support to Ngx Bootstrap modals (https://github.com/valor-software/ngx-bootstrap).
* Based on this library to enable drag support for an ng-bootstrap modal: https://github.com/mattxu-zz/ngb-modal-draggable
*
* Enable by adding the directive to the modal-header element, e.g.:
*
* <div class="modal-header" ngxModalDraggable> </div>
*/
@markleusink
markleusink / modal.xsp
Created January 23, 2019 08:06
Modal causing (partial) refresh issue in Domino 10.0.1
<?xml version="1.0" encoding="UTF-8"?>
<xp:view
xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xe="http://www.ibm.com/xsp/coreex">
<xe:dialog
id="dialog1"
title="refresh issue">
<xp:panel id="dlgContentWrapper">
// filters
List<String> filterCity = new ArrayList<String>();
List<String> cities = new ArrayList<String>(); // list of typeahead suggestions
LinkedHashSet<Integer> matchingIds = new LinkedHashSet<Integer>();
public ListController3() {
// load city typeahead options: get a list of all cities used in the view
// the list is cached in the applicationScope
String fakenamesPath = "fakenames2018.nsf";
// open the target database/ view (collection)
NotesDatabase db = new NotesDatabase(ExtLibUtil.getCurrentSession(), "", fakenamesPath);
NotesCollection collection = db.openCollectionByName("contacts");
//resort the collection (view) according to the selected column and direction
collection.resortView(this.sortColumn,
(this.sortAscending ? Direction.Ascending : Direction.Descending));
String fakenamesPath = "fakenames2018.nsf";
// open the target database/ view (collection)
NotesDatabase db = new NotesDatabase(ExtLibUtil.getCurrentSession(), "", fakenamesPath);
NotesCollection collection = db.openCollectionByName("contacts");
// read total number of entries
totalEntries = collection.getTopLevelEntries();
// tell the API how to navigate in the view: from one entry to the next (in view ordering)
@markleusink
markleusink / toaster.js
Last active August 3, 2017 09:36
AngularJS-toaster example: hide toaster on close button click, goto different state on body click (and hide toaster)
toaster.pop('info', 'Title', '<b>Body text here...</b>', 5000, 'trustedHtml', function callback(toast, isCloseBtn) {
if (!isCloseBtn) {
//handle the click event here, like going to a different state:
$state.go('app.prospects');
}
toaster.clear();
});
@markleusink
markleusink / dialog.xml
Created June 26, 2016 08:36
xpages dialog with materialize tags
<?xml version="1.0" encoding="UTF-8"?>
<xp:view
xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xe="http://www.ibm.com/xsp/coreex">
<xp:this.resources>
<xp:script
src="/materialize-tags/dist/js/materialize-tags.min.js"
clientSide="true">
</xp:script>
@markleusink
markleusink / gist:3d8b1428eeb6f7ba59ee
Created March 24, 2015 08:29
dynamic xcomponents elements
<!doctype html>
<html>
<head>
<title>XComponents</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<!--set the hidden class here, so everything is immediately hidden-->
<style type="text/css">
@markleusink
markleusink / gist:e49950dbd92a955e9d62
Created November 11, 2014 12:38
Morris chart with dynamic data in XPages
<?xml version="1.0" encoding="UTF-8"?>
<xp:view
xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:unp="http://unplugged.teamstudio.com"
xmlns:xc="http://www.ibm.com/xsp/custom">
<xp:this.beforePageLoad><![CDATA[#{javascript://generate the data set here: you could loop through a view for example
var chartData = [];
var year = 2006;