diff --git a/app/views/posts/show.html.haml b/app/views/posts/show.html.haml
index bf4f3ce50..0cfa14815 100644
--- a/app/views/posts/show.html.haml
+++ b/app/views/posts/show.html.haml
@@ -6,7 +6,8 @@
= post_page_title @post
- content_for :head do
- = javascript_include_tag 'vendor/bootstrap/bootstrap-transition', 'vendor/bootstrap/bootstrap-modal', 'posts-show'
+ = javascript_include_tag 'vendor/bootstrap/bootstrap-transition', 'vendor/bootstrap/bootstrap-modal'
+
.header
.header-container
#post-author.media
diff --git a/public/javascripts/app/router.js b/public/javascripts/app/router.js
index 4ce547950..6110eb869 100644
--- a/public/javascripts/app/router.js
+++ b/public/javascripts/app/router.js
@@ -15,6 +15,7 @@ app.Router = Backbone.Router.extend({
"u/:name": "stream",
"followed_tags": "stream",
"tags/:name": "stream",
+
"posts/:id": "singlePost",
"p/:id": "singlePost"
},
diff --git a/public/javascripts/app/views/single_post_view.js b/public/javascripts/app/views/single_post_view.js
index e0d476343..055fbae81 100644
--- a/public/javascripts/app/views/single_post_view.js
+++ b/public/javascripts/app/views/single_post_view.js
@@ -1,11 +1,69 @@
app.views.SinglePost = app.views.Post.extend({
+ /* SINGLE POST SHOULD BE BROKEN OUT INTO A PAGE VIEW!!!! */
+
className : "loaded",
- next_arrow: $('#forward'),
- previous_arrow: $('#back'),
postRenderTemplate : function() {
- $('#forward').attr('href', this.model.get('next_post'));
- $('#back').attr('href', this.model.get('previous_post'));
+ /* nav should be a subview! and tested! (this is some prototyping stuff right here... */
+ this.setNav();
+
+ /* post author info should be a subview! and tested! */
+ this.setAuthor();
+
+ /* post author info should be a subview! and tested! */
+ this.setFeedback();
+ },
+
+ setNav : function() {
+ var mappings = {"#forward" : "next_post",
+ "#back" : "previous_post"};
+
+ _.each(mappings, function(attribute, selector){
+ this.setArrow($(selector), this.model.get(attribute))
+ }, this);
+
+ this.setMappings();
+ },
+
+ setArrow : function(arrow, loc) {
+ loc ? arrow.attr('href', loc) : arrow.remove()
+ },
+
+ setMappings : function() {
+ var nextPostLocation = this.model.get("next_post");
+ var previousPostLocation = this.model.get("previous_post");
+ var doc = $(document);
+
+ /* focus modal */
+ doc.keypress(function(event){
+ $('#text').focus();
+ $('#comment').modal();
+ });
+
+ /* navagation hooks */
+ doc.keydown(function(e){
+ if (e.keyCode == 37 && nextPostLocation) {
+ window.location = nextPostLocation
+
+ }else if(e.keyCode == 39 && previousPostLocation) {
+ window.location = previousPostLocation
+ }
+ })
+ },
+
+ setAuthor : function() {
+ // author avatar
+ // time of post
+ // reshared via... (if appliciable)
+ },
+
+ setFeedback : function() {
+ // go back to profile (app.user())
+ // liking
+ // following
+ // resharing
+ // commenting
}
+
});
diff --git a/public/javascripts/posts-show.js b/public/javascripts/posts-show.js
deleted file mode 100644
index 9404b264b..000000000
--- a/public/javascripts/posts-show.js
+++ /dev/null
@@ -1,14 +0,0 @@
-$(function(){
- $(document).keypress(function(event){
- $('#text').focus();
- $('#comment').modal();
- });
-
- $(document).keydown(function(e){
- if (e.keyCode == 37) {
- window.location = $('#back').attr('href');
- }else if(e.keyCode == 39) {
- window.location = $('#forward').attr('href');
- }
- });
-});
\ No newline at end of file