summaryrefslogtreecommitdiff
path: root/public/assets
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets')
-rw-r--r--public/assets/css/bucky.css7
-rw-r--r--public/assets/js/lib/views/details/index.js2
-rw-r--r--public/assets/js/lib/views/index/hootbox.js14
-rw-r--r--public/assets/js/lib/views/index/threadbox.js1
-rw-r--r--public/assets/js/vendor/view/formview.js47
5 files changed, 41 insertions, 30 deletions
diff --git a/public/assets/css/bucky.css b/public/assets/css/bucky.css
index 08d25d3..98cc9f8 100644
--- a/public/assets/css/bucky.css
+++ b/public/assets/css/bucky.css
@@ -161,6 +161,9 @@ table, tr {
border-bottom: 1px solid #b3b3b3;
}
+.ledger {
+ width: 100%;
+}
.ledger .row td {
text-align: right;
padding-left: 4px;
@@ -290,10 +293,10 @@ tr:nth-child(even) td.black:hover { background-color: #f8f8f8; color: #000000;
border-bottom: 1px solid #ccc;
border-left: 1px solid #ccc;
border-right: 1px solid #ccc;
- min-width: 400px;
+ min-width: 450px;
}
#comments {
- max-width: 450px;
+ width: 600px;
}
#comments tr {
padding-right: 20px;
diff --git a/public/assets/js/lib/views/details/index.js b/public/assets/js/lib/views/details/index.js
index 6290738..7757bae 100644
--- a/public/assets/js/lib/views/details/index.js
+++ b/public/assets/js/lib/views/details/index.js
@@ -30,7 +30,7 @@ var DetailsView = View.extend({
.replace(/{{ date }}/g, datetime[0])
.replace(/{{ time }}/g, datetime[1])
.replace(/{{ active }}/g, age + " ago")
- .replace(/{{ views }}/g, thread.viewed + " " + courtesy_s(thread.viewed, "view"))
+ .replace(/{{ views }}/g, thread.viewed + " view" + courtesy_s(thread.viewed))
console.log(t)
console.log(data.thread)
// name date time active views
diff --git a/public/assets/js/lib/views/index/hootbox.js b/public/assets/js/lib/views/index/hootbox.js
index 9d1cc3d..f93a689 100644
--- a/public/assets/js/lib/views/index/hootbox.js
+++ b/public/assets/js/lib/views/index/hootbox.js
@@ -5,6 +5,17 @@ var HootBox = FormView.extend({
events: {
},
+ validate: function(){
+ var errors = []
+ var comment = $("[name=comment]").val()
+ if (! comment || ! comment.length) {
+ errors.push("Please enter a comment.")
+ }
+ return errors.length ? errors : null
+ },
+
+ action: "/api/thread/1/comment",
+
initialize: function(){
this.__super__.initialize.call(this)
this.template = this.$(".template").html()
@@ -31,7 +42,8 @@ var HootBox = FormView.extend({
this.$hoots.append($el)
},
- success: function(){
+ success: function(comment){
this.prependComment(comment)
+ this.$("[name=comment]").val("")
}
}) \ No newline at end of file
diff --git a/public/assets/js/lib/views/index/threadbox.js b/public/assets/js/lib/views/index/threadbox.js
index 0c6a4be..8d8cb02 100644
--- a/public/assets/js/lib/views/index/threadbox.js
+++ b/public/assets/js/lib/views/index/threadbox.js
@@ -35,6 +35,7 @@ var ThreadBox = View.extend({
},
parse: function(thread){
+ if (thread.comment_count === undefined) return ""
var views = hush_views(thread.viewed)
var size = hush_size(thread.size)
var comments = hush_null(thread.comment_count, "c")
diff --git a/public/assets/js/vendor/view/formview.js b/public/assets/js/vendor/view/formview.js
index 05b1ecb..384e470 100644
--- a/public/assets/js/vendor/view/formview.js
+++ b/public/assets/js/vendor/view/formview.js
@@ -53,10 +53,10 @@ var FormView = View.extend({
}
});
-// if (! hasCSRF) {
-// fd.append("_csrf", $("[name=_csrf]").attr("value"))
-// }
-//
+ if (! hasCSRF) {
+ fd.append("_csrf", $("[name=_csrf]").attr("value"))
+ }
+
return fd
},
@@ -64,7 +64,7 @@ var FormView = View.extend({
e && e.preventDefault()
this.$errors.hide().css("opacity", 0.0);
-
+
if (this.validate) {
var errors = this.validate()
if (errors && errors.length) {
@@ -90,30 +90,25 @@ var FormView = View.extend({
processData: false,
contentType: false,
success: function(response){
-
- if (response.error) {
- var errors = []
- for (var key in response.error.errors) {
- errors.push(response.error.errors[key].message);
- }
- if (errorCallback) {
- errorCallback(errors)
- }
- else {
- this.showErrors(errors)
- }
- return
+ if (response.error) {
+ var errors = []
+ for (var key in response.error.errors) {
+ errors.push(response.error.errors[key].message);
+ }
+ if (errorCallback) {
+ errorCallback(errors)
}
else {
- if (successCallback) {
- successCallback(response)
- }
- if (this.success) {
- this.success(response)
- }
+ this.showErrors(errors)
}
-
-
+ return
+ }
+ if (successCallback) {
+ successCallback(response)
+ }
+ if (this.success) {
+ this.success(response)
+ }
}.bind(this),
error: function(response){
}.bind(this),