-
-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This reverts commit dc0be4f.
- Loading branch information
1 parent
6f3551a
commit c85d17a
Showing
40 changed files
with
536 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
'use strict'; | ||
const Widget = require('enketo-core/src/js/Widget'); | ||
const $ = require( 'jquery' ); | ||
require('enketo-core/src/js/plugins'); | ||
|
||
const pluginName = 'simprintswidget'; | ||
|
||
/** | ||
* @constructor | ||
* @param {Element} element [description] | ||
* @param {(boolean|{touch: boolean, repeat: boolean})} options options | ||
* @param {*=} e event | ||
*/ | ||
function Simprintswidget( element, options ) { | ||
this.namespace = pluginName; | ||
Widget.call( this, element, options ); | ||
this._init(); | ||
} | ||
|
||
//copy the prototype functions from the Widget super class | ||
Simprintswidget.prototype = Object.create( Widget.prototype ); | ||
|
||
//ensure the constructor is the new one | ||
Simprintswidget.prototype.constructor = Simprintswidget; | ||
|
||
Simprintswidget.prototype._init = function() { | ||
const $el = $( this.element ); | ||
const $input = $el.find( 'input' ); | ||
$input.attr( 'disabled', true ); | ||
const $translate = window.CHTCore.Translate; | ||
// todo migrate when simprints are migrated | ||
//const service = angularServices.get( 'Simprints' ); | ||
const service = { | ||
enabled: () => {}, | ||
register: () => Promise.resolve(), | ||
}; | ||
|
||
if ( !service.enabled() ) { | ||
$translate.get( 'simprints.disabled' ).then(function( label ) { | ||
$el.append( '<p>' + label + '</p>' ); | ||
}); | ||
return; | ||
} | ||
|
||
$el.on( 'click', '.btn.simprints-register', function() { | ||
service.register().then( function(simprintsId) { | ||
$input.val( simprintsId ).trigger( 'change' ); | ||
} ); | ||
} ); | ||
|
||
$translate.get( 'simprints.register' ).then( function( label ) { | ||
$el.append( '<div><a class="btn btn-default simprints-register">' + | ||
'<img src="/img/simprints.png" width="20" height="20"/> ' + label + '</a>' + | ||
'</div>' ); | ||
} ); | ||
}; | ||
|
||
Simprintswidget.prototype.destroy = function( element ) {}; // eslint-disable-line no-unused-vars | ||
|
||
$.fn[ pluginName ] = function( options, event ) { | ||
return this.each( function() { | ||
const $this = $( this ); | ||
let data = $this.data( pluginName ); | ||
|
||
options = options || {}; | ||
|
||
if ( !data && typeof options === 'object' ) { | ||
$this.data( pluginName, ( data = new Simprintswidget( this, options, event ) ) ); | ||
} else if ( data && typeof options === 'string' ) { | ||
data[ options ]( this ); | ||
} | ||
} ); | ||
}; | ||
|
||
module.exports = { | ||
'name': pluginName, | ||
'selector': '.or-appearance-simprints-reg', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
webapp/src/ts/components/filters/simprints-filter/simprints-filter.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<span class="simprints-filter" *ngIf="simprintsEnabled"> | ||
<a tabindex="-1" (click)="simprintsIdentify()" title="{{'simprints.search' | translate}}"> | ||
<img src="/img/simprints.png" width="20" height="20"/> | ||
</a> | ||
</span> |
14 changes: 14 additions & 0 deletions
14
webapp/src/ts/components/filters/simprints-filter/simprints-filter.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Component, EventEmitter, Input, Output } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'mm-simprints-filter', | ||
templateUrl: './simprints-filter.component.html' | ||
}) | ||
export class SimprintsFilterComponent { | ||
@Input() simprintsEnabled; | ||
@Output() identify: EventEmitter<any> = new EventEmitter(); | ||
|
||
simprintsIdentify() { | ||
this.identify.emit(); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
webapp/src/ts/modules/contacts/contacts-filters.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.