oauth: Replace VDOMView with HTMLView
This commit is contained in:
parent
8b5227761e
commit
fef92ad99e
@ -4,12 +4,11 @@
|
||||
* @license Mozilla Public License (MPLv2)
|
||||
*/
|
||||
import { Collection } from "skeletor.js/src/collection";
|
||||
import { HTMLView } from 'skeletor.js/src/htmlview.js';
|
||||
import { Model } from 'skeletor.js/src/model.js';
|
||||
import converse from "@converse/headless/converse-core";
|
||||
import hello from "hellojs";
|
||||
import tpl_oauth_providers from "templates/oauth_providers.html";
|
||||
|
||||
const { _, Backbone } = converse.env;
|
||||
import tpl_oauth_providers from "templates/oauth_providers.js";
|
||||
|
||||
|
||||
// The following line registers your plugin.
|
||||
@ -91,17 +90,12 @@ converse.plugins.add("converse-oauth", {
|
||||
_converse.oauth_providers = new _converse.OAuthProviders();
|
||||
|
||||
|
||||
_converse.OAuthProvidersView = Backbone.VDOMView.extend({
|
||||
'events': {
|
||||
'click .oauth-login': 'oauthLogin'
|
||||
},
|
||||
|
||||
_converse.OAuthProvidersView = HTMLView.extend({
|
||||
toHTML () {
|
||||
return tpl_oauth_providers(
|
||||
Object.assign({
|
||||
'_': _,
|
||||
'__': _converse.__,
|
||||
'providers': this.model.toJSON()
|
||||
'providers': this.model.toJSON(),
|
||||
'oauthLogin': ev => this.oauthLogin(ev)
|
||||
}));
|
||||
},
|
||||
|
||||
|
@ -1,9 +0,0 @@
|
||||
<fieldset class="oauth-providers">
|
||||
{[ o._.forEach(o.providers, function (provider) { ]}
|
||||
<p class="oauth-provider">
|
||||
<a class="oauth-login" href="#" data-id="{{provider.id}}">
|
||||
<i class="fa {{ provider.class}}"></i>{{provider.login_text}}
|
||||
</a>
|
||||
</p>
|
||||
{[ }); ]}
|
||||
</fieldset>
|
13
src/templates/oauth_providers.js
Normal file
13
src/templates/oauth_providers.js
Normal file
@ -0,0 +1,13 @@
|
||||
const tpl_provider = (o) => html`
|
||||
<p class="oauth-provider">
|
||||
<a @click=${o.oauthLogin} class="oauth-login" data-id="${provider.id}">
|
||||
<i class="fa ${provider.class}"></i>${provider.login_text}
|
||||
</a>
|
||||
</p>
|
||||
`;
|
||||
|
||||
export default (o) => html`
|
||||
<fieldset class="oauth-providers">
|
||||
${ o.providers.map(provider => tpl_provider(o)) }
|
||||
</fieldset>
|
||||
`;
|
Loading…
Reference in New Issue
Block a user