From 426e1400ba20433a840fffabc2a069497f3bd440 Mon Sep 17 00:00:00 2001 From: Nishant Arora Date: Sat, 28 Jan 2017 17:05:53 +0530 Subject: [PATCH 1/2] Word wrap to article title on small screens --- client/assets/style.css | 1 + 1 file changed, 1 insertion(+) diff --git a/client/assets/style.css b/client/assets/style.css index 4a357f7..95b817c 100755 --- a/client/assets/style.css +++ b/client/assets/style.css @@ -53,6 +53,7 @@ padding: 10px 20px; .article-item-title { font-size: 2.5em; font-weight: 700; + word-wrap: break-word; } .article-item-title a { From d2904a0c4e6a654dda59d15564b7334a7020e9de Mon Sep 17 00:00:00 2001 From: Nishant Arora Date: Tue, 31 Jan 2017 13:50:00 +0530 Subject: [PATCH 2/2] Fixed user deletion flow. Articles move to admin --- api/users.js | 43 ++++++++++++++++++--------- client/app/components/admin.jsx | 51 +++++++++++++++++---------------- models/user.js | 5 ++-- 3 files changed, 58 insertions(+), 41 deletions(-) diff --git a/api/users.js b/api/users.js index b9e99d8..36f3eb0 100755 --- a/api/users.js +++ b/api/users.js @@ -7,6 +7,7 @@ comment in the articles.js (same directory). // Importing the topics model var Users = require('../models/user.js'); +var Articles = require('../models/article.js'); var bcrypt = require('bcrypt'); const saltRounds = 10; var db = require('../db.js'); //this file contains the knex file import. it's equal to knex=require('knex') @@ -136,20 +137,34 @@ module.exports = function(app) { It takes the id of the user and then deletes that record from the database. the error key in the returning object is a boolen which is false if there is no error and true otherwise */ - - Users.forge({id: req.body.id}) - .destroy() - .then(function() { - res.json({ - error: { - error: false, - message: '' - }, - code: 'B137', - data: {} + Users.where({id: req.body.id}).fetch({withRelated: ['articles']}).then(function(user) { + var user = user.toJSON(); + var articles = user.articles; + for(var i=0; i