forum previews working
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -3,7 +3,7 @@ $(document).ready(function() {
|
||||
// $("#upgrade-account").hide();
|
||||
// Cookie.put('hide-upgrade-account', '1', 7);
|
||||
// });
|
||||
|
||||
|
||||
// Table striping
|
||||
$("table.striped tbody tr:even").addClass("even");
|
||||
$("table.striped tbody tr:odd").addClass("odd");
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Danbooru.Comment = {};
|
||||
|
||||
Danbooru.Comment.initialize_all = function() {
|
||||
$("#c-comments div.dtext-preview").hide();
|
||||
$("div.dtext-preview").hide();
|
||||
this.initialize_response_link();
|
||||
this.initialize_preview_button();
|
||||
}
|
||||
|
||||
35
public/javascripts/src/app/forum_posts.js
Normal file
35
public/javascripts/src/app/forum_posts.js
Normal file
@@ -0,0 +1,35 @@
|
||||
(function() {
|
||||
Danbooru.ForumPost = {};
|
||||
|
||||
Danbooru.ForumPost.initialize_all = function() {
|
||||
$("#c-forum-topics #preview").hide();
|
||||
|
||||
this.initialize_preview_link();
|
||||
}
|
||||
|
||||
Danbooru.ForumPost.initialize_preview_link = function() {
|
||||
$("#c-forum-topics #preview a[name=toggle-preview]").click(function() {
|
||||
$("#preview").toggle();
|
||||
$("#dtext-help").toggle();
|
||||
});
|
||||
$("#c-forum-topics input[value=Preview]").click(function(e) {
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "/dtext/preview",
|
||||
data: {
|
||||
body: $("#forum_post_body").val()
|
||||
},
|
||||
success: function(data) {
|
||||
$("#dtext-help").hide();
|
||||
$("#preview").show();
|
||||
$("#preview .content").html(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
$(document).ready(function() {
|
||||
Danbooru.ForumPost.initialize_all();
|
||||
});
|
||||
@@ -134,14 +134,25 @@ table.striped tbody tr:hover {
|
||||
table.striped tr.even {
|
||||
background-color: #EEE; }
|
||||
|
||||
div.error-messages {
|
||||
margin: 1em 0;
|
||||
padding: 1em; }
|
||||
div.error-messages span.ui-icon {
|
||||
float: left;
|
||||
margin-right: 0.5em; }
|
||||
div.error-messages h1 {
|
||||
font-size: 1em;
|
||||
color: #A00; }
|
||||
|
||||
div#search {
|
||||
margin-bottom: 1em; }
|
||||
|
||||
div#notice {
|
||||
margin: 1em;
|
||||
padding: 1em;
|
||||
border: 2px solid #666;
|
||||
background: #EEE; }
|
||||
margin: 1em 0;
|
||||
padding: 1em; }
|
||||
div#notice span.ui-icon {
|
||||
float: left;
|
||||
margin-right: 0.5em; }
|
||||
|
||||
div#page aside#sidebar {
|
||||
width: 20%;
|
||||
@@ -222,6 +233,8 @@ form.simple_form {
|
||||
margin-right: 2em; }
|
||||
|
||||
/*** DText Preview ***/
|
||||
div.dtext h1.preview-header {
|
||||
margin-bottom: 0.25em; }
|
||||
div.dtext p {
|
||||
margin-bottom: 1em; }
|
||||
div.dtext ul {
|
||||
@@ -455,6 +468,8 @@ div.list-of-forum-posts article {
|
||||
div.list-of-forum-posts article div.content menu {
|
||||
margin-top: 0.5em; }
|
||||
|
||||
div#c-forum-topics div.single-forum-post {
|
||||
width: 60em; }
|
||||
div#c-forum-topics div#a-show h1#forum-topic-title {
|
||||
font-size: 2em; }
|
||||
div#c-forum-topics span.info {
|
||||
@@ -465,6 +480,10 @@ div#c-forum-topics textarea {
|
||||
div#c-forum-topics div#form-content {
|
||||
float: left;
|
||||
width: 500px; }
|
||||
div#c-forum-topics div#dtext-help {
|
||||
div#c-forum-topics div#form-aside {
|
||||
float: left;
|
||||
width: 400px; }
|
||||
div#c-forum-topics div#form-aside div#preview > p {
|
||||
margin-top: 0.5em;
|
||||
padding-top: 0.5em;
|
||||
border-top: 1px solid #AAA; }
|
||||
|
||||
@@ -179,15 +179,33 @@ table.striped {
|
||||
}
|
||||
}
|
||||
|
||||
div.error-messages {
|
||||
margin: 1em 0;
|
||||
padding: 1em;
|
||||
|
||||
span.ui-icon {
|
||||
float: left;
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1em;
|
||||
color: #A00;
|
||||
}
|
||||
}
|
||||
|
||||
div#search {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
div#notice {
|
||||
margin: 1em;
|
||||
margin: 1em 0;
|
||||
padding: 1em;
|
||||
border: 2px solid #666;
|
||||
background: #EEE;
|
||||
|
||||
span.ui-icon {
|
||||
float: left;
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
}
|
||||
|
||||
div#page {
|
||||
@@ -320,6 +338,10 @@ form.simple_form {
|
||||
/*** DText Preview ***/
|
||||
|
||||
div.dtext {
|
||||
h1.preview-header {
|
||||
margin-bottom: 0.25em;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
@@ -781,6 +803,10 @@ div.list-of-forum-posts {
|
||||
}
|
||||
|
||||
div#c-forum-topics {
|
||||
div.single-forum-post {
|
||||
width: 60em;
|
||||
}
|
||||
|
||||
div#a-show {
|
||||
h1#forum-topic-title {
|
||||
font-size: 2em;
|
||||
@@ -801,8 +827,14 @@ div#c-forum-topics {
|
||||
width: 500px;
|
||||
}
|
||||
|
||||
div#dtext-help {
|
||||
div#form-aside {
|
||||
float: left;
|
||||
width: 400px;
|
||||
|
||||
div#preview > p {
|
||||
margin-top: 0.5em;
|
||||
padding-top: 0.5em;
|
||||
border-top: 1px solid #AAA;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user