diff options
Diffstat (limited to 'public/assets')
| -rw-r--r-- | public/assets/css/bucky.css | 112 | ||||
| -rw-r--r-- | public/assets/js/lib/views/details/commentform.js | 33 | ||||
| -rw-r--r-- | public/assets/js/lib/views/details/index.js | 16 | ||||
| -rw-r--r-- | public/assets/js/lib/views/index/hootbox.js | 24 | ||||
| -rw-r--r-- | public/assets/js/lib/views/index/index.js | 2 | ||||
| -rw-r--r-- | public/assets/js/lib/views/index/threadbox.js | 27 | ||||
| -rw-r--r-- | public/assets/js/util/format.js | 9 | ||||
| -rw-r--r-- | public/assets/js/vendor/view/formview.js | 24 | ||||
| -rw-r--r-- | public/assets/js/vendor/view/view.js | 1 |
9 files changed, 192 insertions, 56 deletions
diff --git a/public/assets/css/bucky.css b/public/assets/css/bucky.css index 9da79e5..c791ca1 100644 --- a/public/assets/css/bucky.css +++ b/public/assets/css/bucky.css @@ -17,7 +17,7 @@ label { text-align: right; padding-right: 5px; } -button { +button, input[type=submit] { font-size: 10px; font-family: Trebuchet MS, Helvetica, Arial, sans-serif; font-weight: bold; @@ -28,7 +28,8 @@ button { background-color: #c8d0dc; text-transform: uppercase; } -.desktop button:hover { +.desktop button:hover, +.desktop input[type=submit] { color: #040a0a; background-color: #d8ece0; } @@ -134,28 +135,48 @@ table, tr { #hoots tr:nth-child(odd) td:nth-child(2) { background-color: #f3f1f2; } #hoots tr:nth-child(even) td:nth-child(2) { background-color: #e3e8e3; } -#threads th { +#threads .keyword td { vertical-align: top; font-weight: normal; padding-right: 4px; line-height: 15px; + padding-top: 10px; } -#threads th b { +#threads .keyword:first-child td { + padding-top: 5px; +} +#threads .keyword td:first-child { + text-align: right; +} +#threads .keyword td b { font-weight: bold; font-size: 14px; } +#threads .keyword:first-child td:nth-child(2) { + border-top: 0; +} +#threads .keyword td:nth-child(2) { + border-top: 1px solid #b3b3b3; + border-bottom: 1px solid #b3b3b3; +} +#threads .row:last-child td:nth-child(2) { + border-bottom: 1px solid #b3b3b3; +} -.ledger td { +.ledger { + width: 100%; +} +.ledger .row td { text-align: right; padding-left: 4px; padding-right: 4px; } -.ledger td:nth-child(1) a { +.ledger .row td:nth-child(1) a { margin-left: 10px; color: #444; text-decoration: none; } -.ledger td:nth-child(2) { +.ledger .row td:nth-child(2) { text-align: left; font-family: Georgia, serif; font-size: 120%; @@ -166,10 +187,10 @@ table, tr { max-width: 30vw; white-space: nowrap; } -.ledger tr:first-child td:nth-child(2) { +.ledger tr.row:first-child td:nth-child(2) { border-top: 1px solid #b6aeab; } -.ledger tr:last-child td:nth-child(2) { +.ledger tr.row:last-child td:nth-child(2) { border-bottom: 1px solid #b6aeab; } .ledger td:nth-child(2) a { @@ -179,10 +200,10 @@ table, tr { text-align: center; } -tr:nth-child(odd).row td { background-color: #e6f0f0; } -tr:nth-child(odd).row:hover td { background-color: #d8e0ec; color: #000000; } -tr:nth-child(even).row td { background-color: #e0e8e8; } -tr:nth-child(even).row:hover td { background-color: #d8e0ec; color: #000000; } +tr:nth-child(odd).file td { background-color: #e6f0f0; } +tr:nth-child(odd).file:hover td { background-color: #d8e0ec; color: #000000; } +tr:nth-child(even).file td { background-color: #e0e8e8; } +tr:nth-child(even).file:hover td { background-color: #d8e0ec; color: #000000; } tr:nth-child(odd) td.row { background-color: #e6f0f0; } tr:nth-child(odd) td.row:hover { background-color: #d8e0ec; color: #000000; } @@ -251,10 +272,6 @@ tr:nth-child(even) td.black:hover { background-color: #f8f8f8; color: #000000; .older { color: #5D6464; } .quiet { color: #787878; } -#details .left { - padding-right: 20px; - vertical-align: top; -} #details_rapper { width: 100%; text-align: center; @@ -262,6 +279,11 @@ tr:nth-child(even) td.black:hover { background-color: #f8f8f8; color: #000000; #details { display: inline-block; text-align: left; + width: 100%; +} +#details .left { + vertical-align: top; + max-width: 50%; } #details .right { max-width: 50vw; @@ -273,6 +295,13 @@ 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: 450px; +} +#comments { + width: 600px; +} +#comments tr { + padding-right: 20px; } #comments tr .user { margin: 0; @@ -281,8 +310,14 @@ tr:nth-child(even) td.black:hover { background-color: #f8f8f8; color: #000000; font-size: 11px; vertical-align: top; } -#comments tr .user img { +#comments tr .user .avatar { border: 1px solid; + width: 40px; + height: 40px; + background-size: cover; + margin: 0 auto; + margin-bottom: 2px; + background-position: center center; } #comments tr:first-child .comment { border-top: 1px solid #ccc; @@ -300,6 +335,23 @@ tr:nth-child(even) td.black:hover { background-color: #f8f8f8; color: #000000; tr:nth-child(even) td.comment { background-color: #f3f1f2; } tr:nth-child(odd) td.comment { background-color: #fcf8f8; } +#comment_form form { + width: 530px; + margin-top: 5px; + margin-left: 50px; + padding-right: 10px; +} +#comment_form textarea { + width: 100%; + height: 240px; + font-family: 'Trebuchet MS', sans-serif; + padding: 5px; + font-size: 15px; +} +#comment_form input[type=submit] { + float: right; +} + #files, #files tr { margin: 0; padding: 0; border-spacing: 0; @@ -338,10 +390,32 @@ tr:nth-child(odd) td.comment { background-color: #fcf8f8; } text-align: center; padding: 0 0 12px 0; } +#gallery .thumb { + max-width: 150px; +} #messages { width: 100%; } +#messages tr td:nth-child(1) { + text-align: right; + padding-right: 3px; +} +#messages tr td:nth-child(2) { + padding: 5px; + border-left: 1px solid #ccc; + border-right: 1px solid #ccc; +} +#messages tr td:nth-child(3) { + text-align: center; + padding-left: 3px; +} +#messages tr:first-child td:nth-child(2) { + border-top: 1px solid #ccc; +} +#messages tr:last-child td:nth-child(2) { + border-bottom: 1px solid #ccc; +} #boxes table { width: 200px; font-size: 13px; @@ -377,7 +451,7 @@ tr:nth-child(odd) td.comment { background-color: #fcf8f8; } line-height: 15px; padding: 20px; } -@media (max-width: 1024px) { +@media (max-width: 700px) { #threads td:nth-child(3) small { display: none; } diff --git a/public/assets/js/lib/views/details/commentform.js b/public/assets/js/lib/views/details/commentform.js new file mode 100644 index 0000000..30671f2 --- /dev/null +++ b/public/assets/js/lib/views/details/commentform.js @@ -0,0 +1,33 @@ +var CommentForm = FormView.extend({ + + el: "#comment_form", + + events: { + }, + + action: "/api/thread/1/comment", + + initialize: function(){ + this.__super__.initialize.call(this) + this.template = this.$(".template").html() + this.$comment = this.$("[name=comment]") + }, + + load: function(thread){ + this.action = "/api/thread/" + thread.id + "/comment" + }, + + validate: function(){ + var errors = [] + var comment = $("[name=comment]").val() + if (! comment || ! comment.length) { + errors.push("Please enter a comment.") + } + return errors.length ? errors : null + }, + + success: function(comment){ + this.prependComment(comment) + this.$("[name=comment]").val("") + } +})
\ No newline at end of file diff --git a/public/assets/js/lib/views/details/index.js b/public/assets/js/lib/views/details/index.js index 554c475..cd8045a 100644 --- a/public/assets/js/lib/views/details/index.js +++ b/public/assets/js/lib/views/details/index.js @@ -6,11 +6,14 @@ var DetailsView = View.extend({ action: "/api/thread/", keywordAction: "/api/keyword/", + initialize: function(opt){ this.comments = new CommentsView ({ parent: this }) this.files = new FilesView ({ parent: this }) this.gallery = new GalleryView ({ parent: this }) + this.form = new CommentForm ({ parent: this }) this.threadbox = new ThreadBox ({ parent: this }) + this.metadataTemplate = $(".metadata_template").html() }, load: function(id){ @@ -19,7 +22,18 @@ var DetailsView = View.extend({ }, populate: function(data){ - $("h1").html(data.thread.title) + var thread = data.thread + $("h1").html(thread.title) + var datetime = verbose_date(thread.createdate, true) + var age = get_age(thread.lastmodified, true) + var t = this.metadataTemplate + .replace(/{{ username }}/g, thread.username) + .replace(/{{ date }}/g, datetime[0]) + .replace(/{{ time }}/g, datetime[1]) + .replace(/{{ active }}/g, age + " ago") + .replace(/{{ views }}/g, thread.viewed + " view" + courtesy_s(thread.viewed)) + $(".metadata").html(t) + this.form.load(data.thread) this.comments.load(data.comments) this.files.load(data.files) this.gallery.load(data.files) diff --git a/public/assets/js/lib/views/index/hootbox.js b/public/assets/js/lib/views/index/hootbox.js index 4a23d32..cdd3eb0 100644 --- a/public/assets/js/lib/views/index/hootbox.js +++ b/public/assets/js/lib/views/index/hootbox.js @@ -33,24 +33,18 @@ var HootBox = FormView.extend({ var $el = $( this.parse(comment) ) this.$hoots.append($el) }, - + validate: function(){ var errors = [] - if (! this.$comment.val()) { - errors.push("no comment") - return errors + var comment = $("[name=comment]").val() + if (! comment || ! comment.length) { + errors.push("Please enter a comment.") } - return null - }, - - beforeSend: function(){ - this.$comment.val("") + return errors.length ? errors : null }, - - showErrors: function(){ - }, - - success: function(data){ - this.prependComment(data.comment) + + 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/index.js b/public/assets/js/lib/views/index/index.js index a1e8af5..d66ea1c 100644 --- a/public/assets/js/lib/views/index/index.js +++ b/public/assets/js/lib/views/index/index.js @@ -8,7 +8,7 @@ var IndexView = View.extend({ initialize: function(opt){ // opt.parent = parent this.hootbox = new HootBox ({ parent: this }) - this.threadbox = new ThreadBox ({ parent: this }) + this.threadbox = new ThreadBox ({ parent: this, latest: true }) this.lastlog = new LastLog ({ parent: this }) this.load() }, diff --git a/public/assets/js/lib/views/index/threadbox.js b/public/assets/js/lib/views/index/threadbox.js index 0475382..8d8cb02 100644 --- a/public/assets/js/lib/views/index/threadbox.js +++ b/public/assets/js/lib/views/index/threadbox.js @@ -12,13 +12,30 @@ var ThreadBox = View.extend({ load: function(data){ if (data.keyword) { - var $row = this.parseKeyword(data.keyword) - this.$el.append($row) + this.appendKeyword(data.keyword) + data.threads.forEach(this.appendThread.bind(this)) + } + else if (this.options.latest) { + data.threads.sort( (a,b) => { + return b.lastmodified - a.lastmodified + }).slice(0, 50).forEach(this.appendThread.bind(this)) + } + else { + var keywords = {} + data.threads.forEach((thread) => { + var keyword = thread.keyword || '__unsorted' + keywords[keyword] = keywords[keyword] || [] + keywords[keyword].push(thread) + }) + Object.keys(keywords).sort().forEach((keyword) => { + this.appendKeyword({ keyword }) + keywords[keyword].forEach(this.appendThread.bind(this)) + }) } - data.threads.forEach(this.appendThread.bind(this)) }, 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") @@ -65,4 +82,8 @@ var ThreadBox = View.extend({ this.$el.append($row) }, + appendKeyword: function(keyword){ + var $row = $( this.parseKeyword(keyword) ) + this.$el.append($row) + }, }) diff --git a/public/assets/js/util/format.js b/public/assets/js/util/format.js index 501108a..889ab09 100644 --- a/public/assets/js/util/format.js +++ b/public/assets/js/util/format.js @@ -132,7 +132,7 @@ function hush_null (n, unit, no_bold) { } } -function courtesy_s (n, s) { return v == 1 ? "" : (s || "s") } +function courtesy_s (n, s) { return n == 1 ? "" : (s || "s") } var revision_letters = "z a b c d f g h j k l m n p q r s t v w x y".split(" ") function get_revision (thread) { @@ -207,10 +207,11 @@ function make_link(file){ } function make_thumb(file){ if (file.filename.indexOf("http") !== 0) { - return "//carbonpictures.com/bucky/data/" + file.thread + "/.thumb/t." + file.filename.toLowerCase() + return "//carbonpictures.com/bucky/data/" + file.thread + "/" + file.filename } else { - var partz = file.filename.toLowerCase().split("/") - return partz.splice(partz.length-2, 0, ".thumb").join("/") + return "//carbonpictures.com/bucky/data/" + file.thread + "/" + file.filename + // var partz = file.filename.toLowerCase().split("/") + // return partz.splice(partz.length-2, 0, ".thumb").join("/") } }
\ No newline at end of file diff --git a/public/assets/js/vendor/view/formview.js b/public/assets/js/vendor/view/formview.js index 7e77500..2c54d3e 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) { @@ -103,13 +103,11 @@ var FormView = View.extend({ } return } - else { - if (successCallback) { - successCallback(response) - } - if (this.success) { - this.success(response) - } + if (successCallback) { + successCallback(response) + } + if (this.success) { + this.success(response) } }.bind(this), error: function(response){ @@ -141,4 +139,4 @@ var ModalFormView = ModalView.extend(FormView.prototype).extend({ }) -*/
\ No newline at end of file +*/ diff --git a/public/assets/js/vendor/view/view.js b/public/assets/js/vendor/view/view.js index 9a8ab5b..82e5117 100644 --- a/public/assets/js/vendor/view/view.js +++ b/public/assets/js/vendor/view/view.js @@ -4,6 +4,7 @@ var View = (function($, _){ this._id = _.uniqueId('view') this.type = "view" options || (options = {}); + this.options = options _.extend(this, _.pick(options, viewOptions)) this._ensureElement() this.initialize.apply(this, arguments) |
