PWV-1: Refactoring ohif:studylist package

This commit is contained in:
Bruno Alves de Faria authored and Erik Ziegler committed 2016-11-15 08:24:01 +01:00
1 parent 984ef94403
commit 4d79bf84a8
79 files changed
+450 -551

No files matched your search

@@ -12,7 +12,7 @@ OHIF.mixins.button = new OHIF.Mixin({
const component = instance.component;
// Set the element to be controlled
component.$element = instance.$('button:first');
component.$element = instance.$('button').first();
}
}
});
@@ -54,7 +54,7 @@ OHIF.mixins.form = new OHIF.Mixin({
const component = instance.component;
// Set the component main and style elements
component.$style = component.$element = instance.$('form:first');
component.$style = component.$element = instance.$('form').first();
// Block page redirecting on submit
component.$element[0].onsubmit = () => false;
@@ -66,7 +66,7 @@ OHIF.mixins.form = new OHIF.Mixin({
const targetKey = $(event.currentTarget).attr('data-target');
// Focus the first input inside the element with error state
instance.$(`.state-error[data-key="${targetKey}"] :input:first`).focus();
instance.$(`.state-error[data-key="${targetKey}"]`).find(':input:first').focus();
}
},
@@ -147,7 +147,7 @@ OHIF.mixins.group = new OHIF.Mixin({
const component = instance.component;
// Set the element to be controlled
component.$element = instance.$('.component-group:first');
component.$element = instance.$('.component-group').first();
}
}
});
@@ -12,7 +12,7 @@ OHIF.mixins.input = new OHIF.Mixin({
const component = instance.component;
// Set the element to be controlled
component.$element = instance.$('input:first');
component.$element = instance.$('input').first();
}
}
});
@@ -12,7 +12,7 @@ OHIF.mixins.link = new OHIF.Mixin({
const component = instance.component;
// Set the element to be controlled
component.$element = instance.$('a:first');
component.$element = instance.$('a').first();
},
events: {
@@ -12,7 +12,7 @@ OHIF.mixins.select = new OHIF.Mixin({
const component = instance.component;
// Set the element to be controlled
component.$element = instance.$('select:first');
component.$element = instance.$('select').first();
}
}
});
@@ -0,0 +1,3 @@
<template name="dropdownBackdrop">
<div class="dropdown-backdrop"></div>
</template>
@@ -0,0 +1,8 @@
<template name="dropdownForm">
{{#form class='dropdown' api=this.api hideValidationBox=true}}
{{>dropdownBackdrop}}
<ul class="dropdown-menu">
{{>UI.contentBlock}}
</ul>
{{/form}}
</template>
@@ -0,0 +1,25 @@
import { Template } from 'meteor/templating';
import { Blaze } from 'meteor/blaze';
import { _ } from 'meteor/underscore';
Template.dropdownForm.onRendered(() => {
const instance = Template.instance();
// Show the dropdown
instance.$('.dropdown').addClass('open');
// Destroy the Blaze created view (either created with template calls or with renderWithData)
instance.destroyView = () => {
if (_.isFunction(instance.data.destroyView)) {
instance.data.destroyView();
} else {
Blaze.remove(instance.view);
}
};
});
Template.dropdownForm.events({
'click .dropdown'(event, instance) {
instance.destroyView();
}
});
@@ -3,6 +3,10 @@ import './dialog/form.js';
import './dialog/login.html';
import './dialog/login.js';
import './dropdown/backdrop.html';
import './dropdown/form.html';
import './dropdown/form.js';
import './form/button.html';
import './form/form.html';
import './form/group.html';