Add image display to show view for news

This commit is contained in:
Nathan Leniz
2015-03-09 13:55:13 +09:00
parent eb991c4f15
commit 528e0094d1
4 changed files with 22 additions and 4 deletions

View File

@ -821,6 +821,11 @@ iframe.iphone {
height: 50px; height: 50px;
} }
.url-preview {
max-width: 250px;
max-height: 250px;
}
//.media ~ .media .media-body-wrapper:nth-child(odd) { //.media ~ .media .media-body-wrapper:nth-child(odd) {
// background-color: #e5e5e5; // background-color: #e5e5e5;
//} //}

View File

@ -173,7 +173,7 @@ $(document).ready(function() {
username: user.profile.username username: user.profile.username
}, },
comments: [], comments: [],
image: '' image: storyImage
} }
}) })
.fail(function (xhr, textStatus, errorThrown) { .fail(function (xhr, textStatus, errorThrown) {

View File

@ -5,6 +5,7 @@
var comments = !{JSON.stringify(comments)}; var comments = !{JSON.stringify(comments)};
var upVotes = !{JSON.stringify(upVotes)}; var upVotes = !{JSON.stringify(upVotes)};
var user = !{JSON.stringify(user)}; var user = !{JSON.stringify(user)};
var image = !{JSON.stringify(image)};
.spacer .spacer
h3.row.col-xs-12 h3.row.col-xs-12
@ -33,6 +34,8 @@
a(href="/" + author.username)@#{author.username} a(href="/" + author.username)@#{author.username}
|  ·  |  · 
a#reply-to-main-post Reply a#reply-to-main-post Reply
.col-xs-12.positive-15.hidden-element#image-display
img.url-preview(src="#{image}")
.col-xs-12#reply-area .col-xs-12#reply-area
.hidden-element#initial-comment-submit .hidden-element#initial-comment-submit
form.form-horizontal.control-label-story-submission form.form-horizontal.control-label-story-submission
@ -44,6 +47,9 @@
span.spacer.pull-left#textarea_feedback span.spacer.pull-left#textarea_feedback
script. script.
if (image) {
$('#image-display').removeClass('hidden-element')
}
$('#reply-to-main-post').on('click', function() { $('#reply-to-main-post').on('click', function() {
$('#initial-comment-submit').removeClass('hidden-element'); $('#initial-comment-submit').removeClass('hidden-element');
$(this).unbind('click'); $(this).unbind('click');

View File

@ -21,17 +21,24 @@
label.control-label.control-label-story-submission(for='name') Description label.control-label.control-label-story-submission(for='name') Description
.col-xs-12.col-md-11 .col-xs-12.col-md-11
input#description-box.form-control(name="comment-box", placeholder="Start off the discussion with a description of your post" maxlength='140') input#description-box.form-control(name="comment-box", placeholder="Start off the discussion with a description of your post" maxlength='140')
.form-group
.col-xs-12.col-md-offset-1
span.pull-left#textarea_feedback span.pull-left#textarea_feedback
.row .form-group
img.img-center.img-responsive(src="#{storyImage}", style="max-width: 250px; max-height: 250px") .col-xs-12.col-md-offset-1
.hidden-element#image-display
img.url-preview(src="#{storyImage}")
.spacer .spacer
.row .row
.form-group .form-group
button.btn.btn-big.btn-block.btn-primary#story-submit Submit button.btn.btn-big.btn-block.btn-primary#story-submit Submit
script. script.
$('#story-url').val(storyURL).attr('disabled', 'disabled'); $('#story-url').val(storyURL).attr('disabled', 'disabled');
$('#story-title').val(storyTitle); $('#story-title').val(storyTitle);
console.log(storyImage); if (storyImage) {
$('#image-display').removeClass('hidden-element');
}
var text_max = 140; var text_max = 140;
$('#textarea_feedback').html(text_max + ' characters remaining'); $('#textarea_feedback').html(text_max + ' characters remaining');
$('#description-box').keyup(function () { $('#description-box').keyup(function () {