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

[WIP] Added link form as an option. #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion public/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,12 @@ app.controller('talksController', ($scope, $http) => {
// Send a http POST request to create a new talk
$scope.createTalk = () => {
if($scope.newTalk !== undefined) {
let {name, type, desc} = $scope.newTalk;
let {name, type, desc, link} = $scope.newTalk;

if(name.trim() == '' || type.trim() == '' || desc.trim() == '') {
if (link.trim() == '') {
link = '/'
}
alert('Empty fields. please try again');
$scope.newTalk = {};
return;
Expand Down
16 changes: 8 additions & 8 deletions talks-ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ module.exports.createTalk = (req, res) => {

// write the new talk to the server
return talksModel.sync().then(() => {
const { name, type, desc } = req.body;
const { name, type, desc, link } = req.body;
// create an instance of the model and save to the db
talksModel.create({name, type, desc}, {
fields: ['id', 'name', 'type', 'desc']
talksModel.create({name, type, desc, link}, {
fields: ['id', 'name', 'type', 'desc', 'link']
}).then(data => {
logger.log({
level: 'info',
message: `[CREATE] ${name} created a ${type} with the description: ${desc}`
message: `[CREATE] ${name} created a ${type} with the description: ${desc} link: ${link}`
});

// reload the talks
Expand All @@ -76,14 +76,14 @@ module.exports.updateTalk = (req, res) => {
);
}).then(() => {
return talksModel.find({
attributes: ['id', 'name', 'type', 'desc', 'hidden'],
attributes: ['id', 'name', 'type', 'desc', 'link', 'hidden'],
where: { id: req.body.talkId }
}).then(data => {
const talk = data.dataValues;

logger.log({
level: 'info',
message: `[UPDATE] The ${talk.type} "${talk.desc}" by ${talk.name} was ${talk.hidden ? 'hidden': 'unhidden'}`
message: `[UPDATE] The ${talk.type} "${talk.desc}" by ${talk.name} link: ${talk.link} was ${talk.hidden ? 'hidden': 'unhidden'}`
});

loadTalks(talksModel, res);
Expand All @@ -94,15 +94,15 @@ module.exports.updateTalk = (req, res) => {
// Send a SELECT query to the database and return the response as JSON
function loadTalks(model, res) {
return model.findAll({
attributes: ['id', 'name', 'type', 'desc', 'hidden']
attributes: ['id', 'name', 'type', 'desc', 'link', 'hidden']
}).then(result => {
return res.json(result);
});
}

function loadVisibleTalks(model, res) {
return model.findAll({
attributes: ['id', 'name', 'type', 'desc', 'hidden'],
attributes: ['id', 'name', 'type', 'desc', 'link', 'hidden'],
where: {hidden: false}
}).then(result => {
return res.json(result);
Expand Down
1 change: 1 addition & 0 deletions talks-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = function(sequelize, DataTypes) {
name: { type: DataTypes.STRING },
type: { type: DataTypes.STRING },
desc: { type: DataTypes.STRING },
link: { type: DataTypes.STRING },
hidden: { type: DataTypes.BOOLEAN, defaultValue: false }
},
{
Expand Down
7 changes: 7 additions & 0 deletions views/all.pug
Original file line number Diff line number Diff line change
Expand Up @@ -29,39 +29,45 @@ html(ng-app='talksApp')
th Talk Presenter
th Type
th Description
th Link
th
tr(class="event" ng-class="{hidden: talk.hidden}" ng-repeat="talk in talks | filter: {type: 'forum topic'} | orderBy: ['type']")
td.name {{ talk.name }}
td.type {{ talk.type }}
td.desc {{ talk.desc }}
td.link: a(target='_blank' href='{{ talk.link }}') .
td.hides
button(ng-click="hide(this.talk.id)") X
button(ng-click="unhide(this.talk.id)") ↶
tr(class="event" ng-class="{hidden: talk.hidden}" ng-repeat="talk in talks | filter: {type: 'lightning talk'} |orderBy: ['type']")
td.name {{ talk.name }}
td.type {{ talk.type }}
td.desc {{ talk.desc }}
td.link: a(target='_blank' href='{{ talk.link }}') .
td.hides
button(ng-click="hide(this.talk.id)") X
button(ng-click="unhide(this.talk.id)") ↶
tr(class="event" ng-class="{hidden: talk.hidden}" ng-repeat="talk in talks | filter: {type: 'project update'} |orderBy: ['type']")
td.name {{ talk.name }}
td.type {{ talk.type }}
td.desc {{ talk.desc }}
td.link: a(target='_blank' href='{{ talk.link }}') .
td.hides
button(ng-click="hide(this.talk.id)") X
button(ng-click="unhide(this.talk.id)") ↶
tr(class="event" ng-class="{hidden: talk.hidden}" ng-repeat="talk in talks | filter: {type: 'announcement'} |orderBy: ['type']")
td.name {{ talk.name }}
td.type {{ talk.type }}
td.desc {{ talk.desc }}
td.link: a(target='_blank' href='{{ talk.link }}') .
td.hides
button(ng-click="hide(this.talk.id)") X
button(ng-click="unhide(this.talk.id)") ↶
tr(class="event" ng-class="{hidden: talk.hidden}" ng-repeat="talk in talks | filter: {type: 'after meeting slot'} |orderBy: ['type']")
td.name {{ talk.name }}
td.type {{ talk.type }}
td.desc {{ talk.desc }}
td.link: a(target='_blank' href='{{ talk.link }}') .
td.hides
button(ng-click="hide(this.talk.id)") X
button(ng-click="unhide(this.talk.id)") ↶
Expand All @@ -75,6 +81,7 @@ html(ng-app='talksApp')
option(value="announcement") Announcement
option(value="after meeting slot") After-Meeting Slot
th: input(id="in_desc" size=50 name="desc" type="text" ng-model="newTalk.desc" placeholder="Description" required)
th: input(id="in_link" size=30 name="link" type="text" ng-model="newTalk.link" placeholder="Link")
th: button(ng-click="createTalk()") Create

script(src="js/vendors/angular.min.js")
Expand Down
3 changes: 3 additions & 0 deletions views/chrono.pug
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ html(ng-app='talksApp')
th Talk Presenter
th Type
th Description
th Link
th
tr(class="event" ng-class="{hidden: talk.hidden}" ng-repeat="talk in talks | filter: {'hidden': false} | orderBy: ['id']")
td.name {{ talk.name }}
td.type {{ talk.type }}
td.desc {{ talk.desc }}
td.link: a(target='_blank' href='{{ talk.link }}') .
td.hides
button(ng-click="hide(this.talk.id)") X
button(ng-click="unhide(this.talk.id)") ↶
Expand All @@ -47,6 +49,7 @@ html(ng-app='talksApp')
option(value="announcement") Announcement
option(value="after meeting slot") After-Meeting Slot
th: input(id="in_desc" size=50 name="desc" type="text" ng-model="newTalk.desc" placeholder="Description" required)
th: input(id="in_link" size=30 name="link" type="text" ng-model="newTalk.link" placeholder="Link")
th: button(ng-click="createTalk()") Create

script(src="js/vendors/angular.min.js")
Expand Down
7 changes: 7 additions & 0 deletions views/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -31,41 +31,47 @@ html(ng-app='talksApp')
th Talk Presenter
th Type
th Description
th Link
th

tbody
tr(class="event" ng-class="{hidden: talk.hidden}" ng-repeat="talk in talks | filter: {'hidden': false, type: 'forum topic'} | orderBy: ['type']")
td.name {{ talk.name }}
td.type {{ talk.type }}
td.desc {{ talk.desc }}
td.link: a(target='_blank' href='{{ talk.link }}') .
td.hides
button(ng-click="hide(this.talk.id)") X
button(ng-class="{'hidden-button': !talk.hidden}" ng-click="unhide(this.talk.id)") ↶
tr(class="event" ng-class="{hidden: talk.hidden}" ng-repeat="talk in talks | filter: {'hidden': false, type: 'lightning talk'} | orderBy: ['type']")
td.name {{ talk.name }}
td.type {{ talk.type }}
td.desc {{ talk.desc }}
td.link: a(target='_blank' href='{{ talk.link }}') .
td.hides
button(ng-click="hide(this.talk.id)") X
button(ng-class="{'hidden-button': !talk.hidden}" ng-click="unhide(this.talk.id)") ↶
tr(class="event" ng-class="{hidden: talk.hidden}" ng-repeat="talk in talks | filter: {'hidden': false, type: 'project update'} | orderBy: ['type']")
td.name {{ talk.name }}
td.type {{ talk.type }}
td.desc {{ talk.desc }}
td.link: a(target='_blank' href='{{ talk.link }}') .
td.hides
button(ng-click="hide(this.talk.id)") X
button(ng-class="{'hidden-button': !talk.hidden}" ng-click="unhide(this.talk.id)") ↶
tr(class="event" ng-class="{hidden: talk.hidden}" ng-repeat="talk in talks | filter: {'hidden': false, type: 'announcement'} | orderBy: ['type']")
td.name {{ talk.name }}
td.type {{ talk.type }}
td.desc {{ talk.desc }}
td.link: a(target='_blank' href='{{ talk.link }}') .
td.hides
button(ng-click="hide(this.talk.id)") X
button(ng-class="{'hidden-button': !talk.hidden}" ng-click="unhide(this.talk.id)") ↶
tr(class="event" ng-class="{hidden: talk.hidden}" ng-repeat="talk in talks | filter: {'hidden': false, type: 'after meeting slot'} | orderBy: ['type']")
td.name {{ talk.name }}
td.type {{ talk.type }}
td.desc {{ talk.desc }}
td.link: a(target='_blank' href='{{ talk.link }}') .
td.hides
button(ng-click="hide(this.talk.id)") X
button(ng-class="{'hidden-button': !talk.hidden}" ng-click="unhide(this.talk.id)") ↶
Expand All @@ -79,6 +85,7 @@ html(ng-app='talksApp')
option(value="announcement") Announcement
option(value="after meeting slot") After-Meeting Slot
th: input(id="in_desc" size=50 name="desc" type="text" ng-model="newTalk.desc" placeholder="Description")
th: input(id="in_link" size=30 name="link" type="text" ng-model="newTalk.link" placeholder="Link")
th: button(ng-click="createTalk()") Create

p(style="text-align: center;"): button(onclick="parseToMM()") Parse to Meeting Minutes
Expand Down