LT-330 Study list context menu style issues

This commit is contained in:
Emanuel F. Oliveira 2016-11-14 23:53:36 -02:00
parent 2399b4a319
commit c89319344a
3 changed files with 16 additions and 3 deletions

View File

@ -0,0 +1,3 @@
.dropdown
ul.dropdown-menu li
cursor: pointer

View File

@ -1,12 +1,15 @@
import { Template } from 'meteor/templating';
import { Blaze } from 'meteor/blaze';
import { $ } from 'meteor/jquery';
import { _ } from 'meteor/underscore';
Template.dropdownForm.onRendered(() => {
const instance = Template.instance();
const dropdown = instance.$('.dropdown');
// Show the dropdown
instance.$('.dropdown').addClass('open');
dropdown.addClass('open');
dropdown.find('ul.dropdown-menu li a').addClass('noselect');
// Destroy the Blaze created view (either created with template calls or with renderWithData)
instance.destroyView = () => {
@ -20,6 +23,12 @@ Template.dropdownForm.onRendered(() => {
Template.dropdownForm.events({
'click .dropdown'(event, instance) {
instance.destroyView();
let target = $(event.target);
if (target.hasClass('disabled')) {
event.preventDefault();
event.stopPropagation();
} else {
instance.destroyView();
}
}
});

View File

@ -24,7 +24,8 @@ Package.onUse(function(api) {
// UI Styles
api.addFiles([
'client/ui/resizable/resizable.styl'
'client/ui/resizable/resizable.styl',
'client/components/bootstrap/dropdown/dropdown.styl'
], 'client');
api.mainModule('main.js', ['client', 'server']);