Fighting CSS

pull/161/head
Nathan Leniz 2015-03-08 11:53:03 +09:00
parent 0a741f0e54
commit 790a2d987b
4 changed files with 38 additions and 22 deletions

View File

@ -179,6 +179,9 @@ exports.comments = function(req, res, next) {
exports.newStory = function(req, res, next) {
var url = req.body.data.url;
if (url.search(/^https?:\/\//g) === -1) {
url = 'http://' + url;
}
debug('In pre submit with a url', url);
Story.find({'link': url}, function(err, story) {
@ -193,13 +196,14 @@ exports.newStory = function(req, res, next) {
msg: "Someone's already posted that link. Here's the discussion."
});
debug('Redirecting the user with', story[0].storyLink);
res.json({
return res.json({
alreadyPosted: true,
storyURL: story.pop().storyLink
});
}
});
resources.getURLTitle(url, processResponse);
});
function processResponse(err, storyTitle) {
if (err) {
res.json({

View File

@ -395,9 +395,21 @@ ul {
font-size: 30px;
}
.btn-small {
font-size: 30px;
@media (max-width: 768px) {
font-size: 15px;
height: 26.5px;
padding-top: 1px;
}
}
.big-text-field {
font-size: 30px;
height: 57px;
@media (max-width: 768px) {
font-size: 15px;
height: 26.5px;
}
}
.table {

View File

@ -253,6 +253,12 @@ profileValidation.controller('emailSignInController', ['$scope',
}
]);
profileValidation.controller('URLSubmitController', ['$scope',
function($scope) {
}
]);
profileValidation.controller('nonprofitFormController', ['$scope',
function($scope) {

View File

@ -1,24 +1,17 @@
.col-xs-12
.spacer
.input-group
input#story-url.big-text-field.form-control(placeholder='Paste your link here', name='Link', autofocus)
div(ng-controller="URLSubmitController")
form.input-group(name='URLSubmit')
input#story-url.big-text-field.form-control(placeholder='Paste your link here', name='link', type='url', ng-model='possibleURL' autofocus)
span.input-group-btn
button#preliminary-story-submit.btn.btn-big.btn-primary(type='button') Submit
button#preliminary-story-submit.btn.btn-big.btn-primary(type='button', ng-disabled='URLSubmit.link.$invalid') Submit
div(ng-show="URLSubmit.link.$error.url && !URLsubmit.link.$pristine")
alert(type='danger')
span.ion-close-circled
| Please enter a valid URL format (http://www.example.com/).
.spacer
//
.col-xs-12
form.form-horizontal.control-label-story-submission#story-submission-form
.col-xs-2.img-story-post
img.img-responsive(src='#{user.profile.picture}')
.col-xs-10
.form-group
.col-xs-11
input#story-url.form-control(placeholder='Paste your link here', name='Link')
.spacer
.form-group
button.btn.btn-big.btn-block.btn-primary Submit
script.
$('#story-url').on('keypress', function(e) {
if (e.which === 13 || e === 13) {
@ -44,10 +37,11 @@
.done(function (data, textStatus, xhr) {
if (data.alreadyPosted) {
window.location = '/stories/' + data.storyURL;
}
} else {
window.location = '/stories/submit/url=' +
encodeURIComponent(data.storyURL) +
'&title=' + encodeURIComponent(data.storyTitle);
}
});
}
$('#preliminary-story-submit').on('click', preliminaryStorySubmit);