Adding sections to login form and allowing schema overriding
This commit is contained in:
parent
c89b0d4bef
commit
4fd18c61aa
@ -33,7 +33,7 @@ Template.section.onCreated(() => {
|
||||
|
||||
// Define the content
|
||||
currentView._sectionMap.set(sectionName, {
|
||||
data: currentView._templateInstance.data,
|
||||
data: Object.assign({}, currentView._templateInstance.data),
|
||||
renderFunction: templateContentBlock.renderFunction
|
||||
});
|
||||
} else {
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
)
|
||||
options=(clone this.options
|
||||
multiple=(valueIf this.multiple true false)
|
||||
placeholder=this.placeholder
|
||||
minimumResultsForSearch=(valueIf this.hideSearch
|
||||
-1 this.minimumResultsForSearch
|
||||
)
|
||||
|
||||
@ -11,7 +11,8 @@ const extend = (...argsArray) => {
|
||||
const result = argsArray[0] || {};
|
||||
|
||||
// Extract the Spacebars kw hash
|
||||
const kwHash = _.last(argsArray).hash;
|
||||
const lastArg = _.last(argsArray);
|
||||
const kwHash = lastArg ? lastArg.hash : null;
|
||||
|
||||
// Extract the given objects
|
||||
const objects = _.initial(argsArray);
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
OHIF.blaze = {};
|
||||
@ -47,7 +48,7 @@ OHIF.blaze.getParentTemplateView = view => {
|
||||
while (currentView) {
|
||||
currentView = currentView.originalParentView || currentView.parentView;
|
||||
if (!currentView || !currentView.name) return;
|
||||
if (currentView.name.indexOf('Template.') > -1) {
|
||||
if (currentView.name.indexOf('Template.') > -1 && currentView.name.indexOf('Template.__dynamic') === -1) {
|
||||
return currentView;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,8 +5,10 @@
|
||||
{{#form class='user-login-form form-themed p-a-2' schema=instance.schema api=instance.api hideValidationBox=true}}
|
||||
<h3>Sign In</h3>
|
||||
<hr class="m-h-2">
|
||||
{{>section 'userLoginFieldsBefore'}}
|
||||
{{>inputText labelClass='form-group' key='username'}}
|
||||
{{>inputPassword labelClass='form-group' key='password'}}
|
||||
{{>section 'userLoginFieldsAfter'}}
|
||||
<hr class="m-t-0 m-b-2">
|
||||
{{#button action='login' class='form-control btn btn-primary'}}Enter{{/button}}
|
||||
{{/form}}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { Template } from 'meteor/templating';
|
||||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
import { Router } from 'meteor/iron:router';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
@ -40,14 +39,5 @@ Template.userLogin.onCreated(() => {
|
||||
}
|
||||
};
|
||||
|
||||
instance.schema = new SimpleSchema({
|
||||
username: {
|
||||
type: String,
|
||||
label: 'Username'
|
||||
},
|
||||
password: {
|
||||
type: String,
|
||||
label: 'Password'
|
||||
}
|
||||
});
|
||||
instance.schema = OHIF.user.schema;
|
||||
});
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import './getName';
|
||||
import './login';
|
||||
import './logout';
|
||||
import './schema';
|
||||
|
||||
14
Packages/ohif-user/client/lib/schema.js
Normal file
14
Packages/ohif-user/client/lib/schema.js
Normal file
@ -0,0 +1,14 @@
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
import { ReactiveVar } from 'meteor/reactive-var';
|
||||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
|
||||
OHIF.user.schema = new ReactiveVar(new SimpleSchema({
|
||||
username: {
|
||||
type: String,
|
||||
label: 'Username'
|
||||
},
|
||||
password: {
|
||||
type: String,
|
||||
label: 'Password'
|
||||
}
|
||||
}));
|
||||
@ -1,8 +1,9 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { Router } from 'meteor/iron:router';
|
||||
|
||||
Meteor.startup(() => {
|
||||
Router.route('/login', function() {
|
||||
this.layout('mainLayout');
|
||||
this.layout('mainLayout', { data: {} });
|
||||
this.render('userLogin');
|
||||
}, { name: 'userLogin' });
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user