Esempio n. 1
0
/**
 * @param {string} tagName
 * @param {string} description
 * @return {HTMLElement}
 */
function createComponentsFormEntry (tagName,
                                    description = 'no description provided') {
  return tag('div', { class: 'radio' }, [
    tag('label', [
      tag('input', {
        type: 'radio',
        name: FORM_COMPONENTS_NAME,
        value: tagName
      }),
      tag('strong', tagName)
    ]),
    tag('p', description)
  ])
}
Esempio n. 2
0
 return tag('form', entries.map(([name, { type }]) => {
   return tag('div', { class: 'form-group row' }, [
     tag('label', {
       for: `fi-${name}`,
       class: 'col-sm-6 form-control-label'
     }, name),
     tag('div', { class: 'col-sm-6' }, [
       tag('input', Object.assign({
         type: getInputType(type),
         class: 'form-control',
         id: `fi-${name}`,
         name: name
       }, getInitialValue(name)))
     ])
   ])
 }))
Esempio n. 3
0
/**
 * @param {Object} descriptor
 * @return {HTMLFormElement}
 */
function createAttributesForm (descriptor) {

  const entries = Object.entries(descriptor.attributes)
    .filter(([name, { type }]) => name !== 'model' && isTypeSupported(type))

  return tag('form', entries.map(([name, { type }]) => {
    return tag('div', { class: 'form-group row' }, [
      tag('label', {
        for: `fi-${name}`,
        class: 'col-sm-6 form-control-label'
      }, name),
      tag('div', { class: 'col-sm-6' }, [
        tag('input', Object.assign({
          type: getInputType(type),
          class: 'form-control',
          id: `fi-${name}`,
          name: name
        }, getInitialValue(name)))
      ])
    ])
  }))
}
Esempio n. 4
0
init(function() {
  var rnodes = enumerable(document.querySelectorAll('.resort')),
    opens = state(rnodes, 'open', {
      on: 'shift + o',
      off: 'shift + x'
    }),
    starred = state(rnodes, 'starred'),
    starredTag = tag(document.querySelector('.tags .starred')),
    resorts = rnodes.map(function(r) {
      return resort(r);
    });

  resorts.each(function(r) {
    minimax(r.node, '.minimax').state('open').on(function(open) {
      if (open) {
        r.refresh(true);
      }
      opens.update();
    });
    minimax(r.node, '.star').state('starred').on(function() {
      starredTag.update(starred.update().length);
    });
    r.init();
  });
  window.setInterval(function() {
    resorts.each(function(r) {
      r.refresh();
    });
  }, 5 * 1000);
  about();
  opens.update();
  starredTag.update(starred.load().length);
  if (document.querySelector('.twitter-follow-button')) {
    load('//platform.twitter.com/widgets.js');
  }
  stats();
  height();
  analytics();
});
Esempio n. 5
0
/**
 * @param {Object[]} descriptors
 * @return {HTMLFormElement}
 */
function createComponentsForm (descriptors) {
  return tag('form', descriptors.map(({ tagName, description }) => {
    return createComponentsFormEntry(tagName, description)
  }))
}
Esempio n. 6
0
 return tag('ul', { class: 'list-unstyled' }, models.map(m => tag('li', m)))
Esempio n. 7
0
/**
 * @param {string[]} models
 * @return {DocumentFragment}
 */
function createModelsView (models) {
  return tag('ul', { class: 'list-unstyled' }, models.map(m => tag('li', m)))
}