Skip to content
This repository has been archived by the owner on Jan 18, 2022. It is now read-only.

Commit

Permalink
Add workshop url
Browse files Browse the repository at this point in the history
  • Loading branch information
nnarhinen committed Apr 10, 2014
1 parent edcfa51 commit 3f3e676
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
13 changes: 12 additions & 1 deletion client/components/workshop-selector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,22 @@ module.exports = React.createClass({
getInitialState: function() {
return {};
},
onWorkshopChange: function(ev) {
var obj = {};
obj[ev.target.name] = ev.target.value;
this.setState({
workshopAttends: _.extend({},this.state.workshopAttends, obj)
});
},
save: function(ev) {
console.log(this.state.workshopAttends);
},
render: function() {
var comp = this;
var workshops = _.groupBy(this.props.workshops, 'date');
var createWorkshopRowCell = function(ws) {
var inputName = ws.date + '_' + ws.slot;
return <td><label><input type="radio" name={inputName} /> {ws.name}</label></td>;
return <td><label><input type="radio" name={inputName} value={ws.id} onChange={comp.onWorkshopChange} /> <a target="_blank" href={ws.url}>{ws.name}</a></label></td>;
};
var createWorkshopTable = function(date) {
var workshopsBySlot = _.groupBy(workshops[date], 'slot');
Expand Down
31 changes: 31 additions & 0 deletions insert-workshops.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
var Bookshelf = require('bookshelf'),
Q = require('q');

var conf = require('./config');
var DB = Bookshelf.initialize(conf.database);

var Workshop = DB.Model.extend({
tableName: 'workshops'
});

var workshops = [
{name: 'Listening++', slot: 1, url: 'http://turkuagileday.fi/topics/#listening', date: '2014-05-12'},
{name: 'The Agile-ish Github Flow', slot: 1, url: 'http://turkuagileday.fi/topics/#github-flow', date: '2014-05-12'},
{name: 'Retrospective facilitation 101', slot: 1, url: 'http://turkuagileday.fi/topics/#retrospective-facilitation', date: '2014-05-12'},
{name: 'Pitching Agile', slot: 2, url: 'http://turkuagileday.fi/topics/#pitching-agile', date: '2014-05-12'},
{name: 'TBA', slot: 2, url: '', date: '2014-05-12'},
{name: 'TBA', slot: 2, url: '', date: '2014-05-12'},
];

workshops.reduce(function(pr, ws) {
return pr.then(function() {
var model = new Workshop(ws);
return model.save();
});
}, Q()).then(function() {
console.log('All workshops inserted');
process.exit(0);
}, function(err) {
console.error('Failed to insert', err);
process.exit(1);
});
13 changes: 13 additions & 0 deletions migrations/20140410225859_workshopurl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

exports.up = function(knex, Promise) {
return knex.schema.table('workshops', function(table) {
table.string('url');
});

};

exports.down = function(knex, Promise) {
return knex.schema.table('workshops', function(table) {
table.dropColumn('url');
});
};

0 comments on commit 3f3e676

Please sign in to comment.