Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Comments v2.0

  • Loading branch information...
commit f4bb6b7161b67594336eaed7052e8345f12a6a4a 1 parent 6c361fa
Jose authored
3  Gemfile
View
@@ -28,6 +28,9 @@ gem 'feedzirra'
gem 'nokogiri'
gem 'kaminari', '~> 0.12.4'
+gem 'heroku'
+gem 'mysql2'
+
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
15 Gemfile.lock
View
@@ -29,6 +29,7 @@ GEM
activesupport (= 3.1.1)
activesupport (3.1.1)
multi_json (~> 1.0)
+ addressable (2.2.6)
arel (2.2.1)
builder (3.0.0)
coffee-rails (3.1.1)
@@ -60,6 +61,11 @@ GEM
rake (>= 0.9.2)
rdoc (~> 3.8)
sax-machine (~> 0.0.20)
+ heroku (2.14.0)
+ launchy (>= 0.3.2)
+ rest-client (~> 1.6.1)
+ rubyzip
+ term-ansicolor (~> 1.0.5)
hike (1.2.1)
i18n (0.6.0)
jquery-rails (1.0.16)
@@ -68,6 +74,8 @@ GEM
json (1.6.1)
kaminari (0.12.4)
rails (>= 3.0.0)
+ launchy (2.0.5)
+ addressable (~> 2.2.6)
libv8 (3.3.10.2)
loofah (1.0.0)
nokogiri (>= 1.3.3)
@@ -77,6 +85,7 @@ GEM
treetop (~> 1.4.8)
mime-types (1.17.2)
multi_json (1.0.3)
+ mysql2 (0.3.7)
nokogiri (1.4.7)
polyglot (0.3.3)
rack (1.3.5)
@@ -106,6 +115,8 @@ GEM
rake (0.9.2.2)
rdoc (3.11)
json (~> 1.4)
+ rest-client (1.6.7)
+ mime-types (>= 1.16)
rspec (2.7.0)
rspec-core (~> 2.7.0)
rspec-expectations (~> 2.7.0)
@@ -119,6 +130,7 @@ GEM
activesupport (~> 3.0)
railties (~> 3.0)
rspec (~> 2.7.0)
+ rubyzip (0.9.4)
sass (3.1.10)
sass-rails (3.1.4)
actionpack (~> 3.1.0)
@@ -133,6 +145,7 @@ GEM
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.4)
+ term-ansicolor (1.0.7)
therubyracer (0.9.8)
libv8 (~> 3.3.10)
thor (0.14.6)
@@ -154,8 +167,10 @@ DEPENDENCIES
execjs
factory_girl_rails
feedzirra
+ heroku
jquery-rails
kaminari (~> 0.12.4)
+ mysql2
nokogiri
rails (= 3.1.1)
rspec-rails
5 app/assets/stylesheets/application.css
View
@@ -9,7 +9,8 @@
*/
body {
- background-color: #e9f2e1;
+ /* background-color: #e9f2e1; */
+ background-color: #ededed;
}
#notice {
@@ -34,6 +35,7 @@ body {
margin: 0 auto;
position: relative;
/* Gradient */
+
background: #647c4f;
background: -moz-linear-gradient(top, #647c4f 13%, #1c3a02 93%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(13%,#647c4f), color-stop(93%,#1c3a02));
@@ -42,6 +44,7 @@ body {
background: -ms-linear-gradient(top, #647c4f 13%,#1c3a02 93%);
background: linear-gradient(top, #647c4f 13%,#1c3a02 93%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#647c4f', endColorstr='#1c3a02',GradientType=0 );
+
/* Shadow starts here*/
-webkit-box-shadow: 4px 0px 7px 3px #8B8888;
-moz-box-shadow: 4px 0px 7px 3px #8B8888;
68 app/assets/stylesheets/videos.css.scss
View
@@ -32,7 +32,7 @@
}
.info {
- border-bottom: 1px #ababab;
+ /* border-bottom: 1px #ababab; */
border-right: 1px solid #fff;
width: 400px;
height: 99px;
@@ -40,28 +40,32 @@
/* Gradient */
- background: -moz-linear-gradient(top, rgba(188,188,188,0.65) 0%, rgba(229,229,229,0.65) 100%);
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(188,188,188,0.65)),
- color-stop(100%,rgba(229,229,229,0.65)));
- background: -webkit-linear-gradient(top, rgba(188,188,188,0.65) 0%,rgba(229,229,229,0.65) 100%);
- background: -o-linear-gradient(top, rgba(188,188,188,0.65) 0%,rgba(229,229,229,0.65) 100%);
- background: -ms-linear-gradient(top, rgba(188,188,188,0.65) 0%,rgba(229,229,229,0.65) 100%);
- background: linear-gradient(top, rgba(188,188,188,0.65) 0%,rgba(229,229,229,0.65) 100%);
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a6bcbcbc', endColorstr='#a6e5e5e5',GradientType=0 );
-
+ background: #eaebea;
+ background: -moz-linear-gradient(top, #eaebea 0%, #ffffff 100%);
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eaebea), color-stop(100%,#ffffff));
+ background: -webkit-linear-gradient(top, #eaebea 0%,#ffffff 100%);
+ background: -o-linear-gradient(top, #eaebea 0%,#ffffff 100%);
+ background: -ms-linear-gradient(top, #eaebea 0%,#ffffff 100%);
+ background: linear-gradient(top, #eaebea 0%,#ffffff 100%);
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eaebea', endColorstr='#ffffff',GradientType=0 );
+ /* border */
+ border-bottom: 1px solid #d2d3d1;
+ border-bottom-width: 1px;
+ border-bottom-style: solid;
+ border-bottom-color: #d2d3d1;
+
}
.info:hover {
-
- background: -moz-linear-gradient(top, rgba(170,170,170,0.75) 0%, rgba(214,214,214,0.75) 100%);
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(170,170,170,0.75)),
- color-stop(100%,rgba(214,214,214,0.75)));
- background: -webkit-linear-gradient(top, rgba(170,170,170,0.75) 0%,rgba(214,214,214,0.75) 100%);
- background: -o-linear-gradient(top, rgba(170,170,170,0.75) 0%,rgba(214,214,214,0.75) 100%);
- background: -ms-linear-gradient(top, rgba(170,170,170,0.75) 0%,rgba(214,214,214,0.75) 100%);
- background: linear-gradient(top, rgba(170,170,170,0.75) 0%,rgba(214,214,214,0.75) 100%);
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#bfaaaaaa', endColorstr='#bfd6d6d6',GradientType=0 );
-
+
+ background: #d6d6d6;
+ background: -moz-linear-gradient(top, #d6d6d6 0%, #f2f2f2 100%);
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#d6d6d6), color-stop(100%,#f2f2f2));
+ background: -webkit-linear-gradient(top, #d6d6d6 0%,#f2f2f2 100%);
+ background: -o-linear-gradient(top, #d6d6d6 0%,#f2f2f2 100%);
+ background: -ms-linear-gradient(top, #d6d6d6 0%,#f2f2f2 100%);
+ background: linear-gradient(top, #d6d6d6 0%,#f2f2f2 100%);
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#d6d6d6', endColorstr='#f2f2f2',GradientType=0 );
cursor: pointer;
}
@@ -109,9 +113,13 @@
#show-main {
width: 80%;
height: 800px;
- border: 1px solid black;
margin-left: auto;
margin-right: auto;
+ background-color: #dedede;
+}
+
+#comments-area {
+ padding: 10px;
}
.comment-button-area {
@@ -123,7 +131,23 @@
float: right;
}
-.comment-area {
+.comment-text-area {
border: 1px solid #ccc;
}
+#display-comments {
+
+}
+
+.one-comment {
+ width: 500px;
+ border-bottom: 1px solid #c4c4c4;
+ margin-left: 5px;
+ margin-top: 10px;
+ margin-bottom: 30px;
+ padding-bottom: 7px;
+ font: 89% Arial, Helvetica, sans-serif;
+}
+
+
+
4 app/models/video.rb
View
@@ -10,4 +10,8 @@ def prev
self.class.find(:first, :conditions => ['id < ?', self.id], :order => "id DESC")
end
+ def get_comments_desc
+ self.comments.order(:created_at).reverse_order
+ end
+
end
2  app/views/comments/_comment.html.erb
View
@@ -1,3 +1,3 @@
-<%= text_area_tag :comment, params[:comment], :size => "60x6", :class => 'comment-area' %>
+<%= text_area_tag :comment, params[:comment], :size => "60x6", :class => 'comment-text-area' %>
9 app/views/comments/create.js.erb
View
@@ -1 +1,8 @@
-alert("<%= escape_javascript(@video.title) %>");
+div = $('<div>').addClass('one-comment')
+ .text("<%= escape_javascript(@video.comments.last.content) %>");
+
+$('#display-comments').prepend(div);
+div.hide().fadeIn(1500);
+
+
+
30 app/views/videos/show.html.erb
View
@@ -18,21 +18,25 @@
</div>
<div id="show-main">
+ <br /><br />
+ <div id="comments-area">
+
+ <div class="comment-form">
+ <%= form_for @comment, :url => video_comments_path(@video), :remote => true do |f| %>
+ <%= render @comment %>
+ <div class="comment-button-area">
+ <div class="just-button"><%= primary_button_submit_tag "Comment" %></div>
+ </div>
+ <% end %>
+ </div>
- <div class="comment-form">
- <%= form_for @comment, :url => video_comments_path(@video), :remote => true do |f| %>
- <%= render @comment %>
- <div class="comment-button-area">
- <div class="just-button"><%= primary_button_submit_tag "Comment" %></div>
- </div>
- <% end %>
- </div>
+ <div id="display-comments">
+ <% @video.get_comments_desc.each do |comment| %>
+ <div class="one-comment"><%= comment.content %></div>
+ <% end %>
+ </div>
- <div class="display-comments">
- <% @video.comments.each do |comment| %>
- <div class="one-comment"><%= comment.content %></div>
- <% end %>
- </div>
+ </div> <!-- end of commenting area -->
</div>
Please sign in to comment.
Something went wrong with that request. Please try again.