示例#1
0
var debug = require('debug')('eugenics:media');
var router = require('transit');
var page = require('page');
var Media = require('./media');
var setTitle = require('set-title');
var config = require('config');
var locale = require('i18n');

var layout = require('./media-layout.jade');
var sidebarTemplate = require('./sidebar.jade');

/**
 * Routes
 */

router('/discover/media', clearSidebar, renderLayout);

/**
 * Clear our sidebar -- remove it!
 * @param {Object}   ctx
 * @param {Function} next
 */

function clearSidebar(ctx, next) {
  sidebar
    .show()
    .renderCustom(sidebarTemplate(locale('media')));
  ctx.dimensions = { width: window.innerWidth };
  next();
}
var request = require('request');
var Document = require('./model').Document;
var FormGenerator = require('./forms');
var transit = require('transit');
var sidebar = require('./sidebar');
var renderLayout = require('./render-layout');


transit('/database/new', renderLayout, requireUser, newDocument);


function requireUser(ctx, next){
  if (!window.current_user) {
    alert('You must be logged in to access this page.');
    return;
  } 
  next();
}

function newDocument(ctx){
  sidebar('new');
  var doc = new Document({ type: 'event', prods: [] });
  var form = new FormGenerator(doc);
}
var request = require('request');
var Document = require('./model').Document;
var FormGenerator = require('./forms');
var dom = require('dom');
var transit = require('transit');
var sidebar = require('./sidebar');
var renderLayout = require('./render-layout');
var prodSidebar = require('prod-sidebar');


/**
 * Routes
 */

transit('/database/documents/:id/edit', renderLayout, load, requireUser, editDocument);

function load(ctx, next){
  dom(document.body).addClass('loading');
  next();
}

/**
 * Ensure user logged in
 * @param  {Context}   ctx
 * @param  {Function} next
 */

function requireUser(ctx, next){
  if (!window.current_user) {
    alert('You must be logged in to access this page.');
示例#4
0
    .animate(false)
    .end(function (docs) {
      people = docs;
      next();
    });
}

/**
 * Routes
 */

// story intro
router('/discover/our-stories', fetchDocs, function (ctx, next) {
  page('Our-stories', {});
  navbar.activate('our-stories');
  sidebar.hide().empty();
  dom('#main').html(home(locale('our_stories')));
  next();
});

// story listing
router('/discover/our-stories/stories', fetchDocs, function(ctx, next){
  page('Our-stories', {});
  navbar.activate('our-stories');
  sidebar.hide().empty();
  dom('#main').html(stories());
  next();
});

// particular story
router('/discover/our-stories/:name', fetchDocs, function (ctx, next) {
var transit = require('transit');
var dom = require('dom');
var events = require('events');
var Accordion = require('./accordion');
var page = require('page');
var navbar = require('navbar');
var setTitle = require('set-title');
var prodSidebar = require('prod-sidebar');
var locale = require('i18n');

var template = require('./templates/accordion.jade');

transit('/discover/institutions', showAccordion);

function showAccordion(ctx, next){
  navbar.activate('institutions');
  document.title = 'Institutions - Eugenics in Western Canada';
  setTitle.reset();
  prodSidebar.hide().empty();
  var pamphlet = new Pamphlet();
  dom('#main').empty().append(pamphlet.el);
  page('Accordion', {});
  next();
}

function Pamphlet(){
  this.el = dom(template(locale('institutions')));
  this.accordion = new Accordion(this.el[0]);
  this.bind();
}