Permalink
Browse files

walls alone

  • Loading branch information...
isaacjarquin
isaacjarquin committed Mar 23, 2012
1 parent 68410cb commit 1e20dfdbaa9ac77160777baece42ca4e674cf42a
Showing with 894 additions and 18 deletions.
  1. BIN .redcar/lucene/_82.cfs
  2. BIN .redcar/lucene/_82_1.del
  3. BIN .redcar/lucene/_83.cfs
  4. BIN .redcar/lucene/_83_1.del
  5. BIN .redcar/lucene/_84.cfs
  6. BIN .redcar/lucene/_84_1.del
  7. BIN .redcar/lucene/_85.cfs
  8. BIN .redcar/lucene/_85_1.del
  9. BIN .redcar/lucene/_86.cfs
  10. BIN .redcar/lucene/_86_1.del
  11. BIN .redcar/lucene/_87.cfs
  12. BIN .redcar/lucene/_87_1.del
  13. BIN .redcar/lucene/_88.cfs
  14. BIN .redcar/lucene/_88_1.del
  15. BIN .redcar/lucene/_89.cfs
  16. BIN .redcar/lucene/segments.gen
  17. BIN .redcar/lucene/segments_7i
  18. +1 −1 .redcar/lucene_last_updated
  19. +73 −5 .redcar/tags
  20. +1 −0 Gemfile
  21. +3 −0 Gemfile.lock
  22. +3 −2 app/assets/javascripts/application.js
  23. +260 −0 app/assets/javascripts/jquery.ui.chatbox.js
  24. +19 −0 app/assets/javascripts/messages.js
  25. +3 −0 app/assets/javascripts/walls.js.coffee
  26. +54 −0 app/assets/stylesheets/jquery.ui.chatbox.css
  27. +3 −0 app/assets/stylesheets/walls.css.scss
  28. +22 −0 app/controllers/messages_controller.rb
  29. +83 −0 app/controllers/walls_controller.rb
  30. +2 −0 app/helpers/walls_helper.rb
  31. +2 −0 app/models/message.rb
  32. +1 −0 app/models/user.rb
  33. +3 −0 app/models/wall.rb
  34. +8 −0 app/views/messages/_message.html.erb
  35. +5 −0 app/views/messages/create.js.erb
  36. +18 −0 app/views/messages/index.html.erb
  37. +21 −0 app/views/walls/_form.html.erb
  38. +6 −0 app/views/walls/edit.html.erb
  39. +23 −0 app/views/walls/index.html.erb
  40. +5 −0 app/views/walls/new.html.erb
  41. +10 −0 app/views/walls/show.html.erb
  42. +10 −0 config/private_pub.yml
  43. +4 −0 config/routes.rb
  44. +10 −0 db/migrate/20120220214319_create_messages.rb
  45. +9 −0 db/migrate/20120321184751_create_walls.rb
  46. +14 −2 db/schema.rb
  47. +28 −8 db/schema.rb~
  48. +101 −0 lib/social/cvxvxvc.rb
  49. +8 −0 private_pub.ru
  50. +7 −0 test/fixtures/messages.yml
  51. +7 −0 test/fixtures/walls.yml
  52. +49 −0 test/functional/walls_controller_test.rb
  53. +4 −0 test/unit/helpers/walls_helper_test.rb
  54. +7 −0 test/unit/message_test.rb
  55. +7 −0 test/unit/wall_test.rb
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
@@ -1 +1 @@
-1329651066
+1332432735
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -27,6 +27,7 @@ end
gem 'jquery-rails'
gem 'private_pub'
+gem 'rbjs'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
View
@@ -125,6 +125,8 @@ GEM
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2.2)
+ rbjs (0.10.2)
+ json
rdoc (3.12)
json (~> 1.4)
rubyzip (0.9.5)
@@ -172,6 +174,7 @@ DEPENDENCIES
mysql2
private_pub
rails (= 3.2.1)
+ rbjs
sass-rails (~> 3.2.3)
therubyracer
uglifier (>= 1.0.3)
@@ -10,6 +10,7 @@
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
-//= require jquery
-//= require jquery_ujs
+// = require jquery
+// = require jquery_ujs
+// = require jquery-ui
//= require_tree .
@@ -0,0 +1,260 @@
+/*
+ * Copyright 2010, Wen Pu (dexterpu at gmail dot com)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * Check out http://www.cs.illinois.edu/homes/wenpu1/chatbox.html for document
+ *
+ * Depends on jquery.ui.core, jquery.ui.widiget, jquery.ui.effect
+ *
+ * Also uses some styles for jquery.ui.dialog
+ *
+ */
+
+
+// TODO: implement destroy()
+(function($){
+ $.widget("ui.chatbox", {
+ options: {
+ id: null, //id for the DOM element
+ title: null, // title of the chatbox
+ user: null, // can be anything associated with this chatbox
+ hidden: false,
+ offset: 0, // relative to right edge of the browser window
+ width: 230, // width of the chatbox
+ messageSent: function(id, user, msg){
+ // override this
+ this.boxManager.addMsg(user.first_name, msg);
+ },
+ boxClosed: function(id) {}, // called when the close icon is clicked
+ boxManager: {
+ // thanks to the widget factory facility
+ // similar to http://alexsexton.com/?p=51
+ init: function(elem) {
+ this.elem = elem;
+ },
+ addMsg: function(peer, msg) {
+ var self = this;
+ var box = self.elem.uiChatboxLog;
+ var e = document.createElement('div');
+ $(e).html("<b>" + peer +":</b> " + msg)
+ .addClass("ui-chatbox-msg");
+ box.append(e);
+ self._scrollToBottom();
+
+ if(!self.elem.uiChatboxTitlebar.hasClass("ui-state-focus") && !self.highlightLock) {
+ self.highlightLock = true;
+ self.highlightBox();
+ }
+ },
+ highlightBox: function() {
+ //this.elem.uiChatbox.addClass("ui-state-highlight");
+ var self = this;
+ self.elem.uiChatboxTitlebar.effect("highlight", {}, 300);
+ self.elem.uiChatbox.effect("bounce", {times:3}, 300, function(){
+ self.highlightLock = false;
+ self._scrollToBottom();
+ });
+ },
+ toggleBox: function() {
+ this.elem.uiChatbox.toggle();
+ },
+ _scrollToBottom: function() {
+ var box = this.elem.uiChatboxLog;
+ box.scrollTop(box.get(0).scrollHeight);
+ }
+ }
+ },
+
+ toggleContent: function(event) {
+ this.uiChatboxContent.toggle();
+ if(this.uiChatboxContent.is(":visible")) {
+ this.uiChatboxInputBox.focus();
+ }
+ },
+
+ widget: function() {
+ return this.uiChatbox
+ },
+
+ _create: function(){
+ var self = this,
+ options = self.options,
+ title = options.title || "No Title",
+ // chatbox
+ uiChatbox = (self.uiChatbox = $('<div></div>'))
+ .appendTo(document.body)
+ .addClass('ui-widget ' +
+ 'ui-corner-top ' +
+ 'ui-chatbox'
+ )
+ .attr('outline', 0)
+ .focusin(function(){
+ // ui-state-highlight is not really helpful here
+ //self.uiChatbox.removeClass('ui-state-highlight');
+ self.uiChatboxTitlebar.addClass('ui-state-focus');
+ })
+ .focusout(function(){
+ self.uiChatboxTitlebar.removeClass('ui-state-focus');
+ }),
+ // titlebar
+ uiChatboxTitlebar = (self.uiChatboxTitlebar = $('<div></div>'))
+ .addClass('ui-widget-header ' +
+ 'ui-corner-top ' +
+ 'ui-chatbox-titlebar ' +
+ 'ui-dialog-header' // take advantage of dialog header style
+ )
+ .click(function(event) {
+ self.toggleContent(event);
+ })
+ .appendTo(uiChatbox),
+ uiChatboxTitle = (self.uiChatboxTitle = $('<span></span>'))
+ .html(title)
+ .appendTo(uiChatboxTitlebar),
+ uiChatboxTitlebarClose = (self.uiChatboxTitlebarClose = $('<a href="#"></a>'))
+ .addClass('ui-corner-all ' +
+ 'ui-chatbox-icon '
+ )
+ .attr('role', 'button')
+ .hover(function() {uiChatboxTitlebarClose.addClass('ui-state-hover');},
+ function() {uiChatboxTitlebarClose.removeClass('ui-state-hover');})
+ // .focus(function() {
+ // uiChatboxTitlebarClose.addClass('ui-state-focus');
+ // })
+ // .blur(function() {
+ // uiChatboxTitlebarClose.removeClass('ui-state-focus');
+ // })
+ .click(function(event) {
+ uiChatbox.hide();
+ self.options.boxClosed(self.options.id);
+ return false;
+ })
+ .appendTo(uiChatboxTitlebar),
+ uiChatboxTitlebarCloseText = $('<span></span>')
+ .addClass('ui-icon ' +
+ 'ui-icon-closethick')
+ .text('close')
+ .appendTo(uiChatboxTitlebarClose),
+ uiChatboxTitlebarMinimize = (self.uiChatboxTitlebarMinimize = $('<a href="#"></a>'))
+ .addClass('ui-corner-all ' +
+ 'ui-chatbox-icon'
+ )
+ .attr('role', 'button')
+ .hover(function() {uiChatboxTitlebarMinimize.addClass('ui-state-hover');},
+ function() {uiChatboxTitlebarMinimize.removeClass('ui-state-hover');})
+ // .focus(function() {
+ // uiChatboxTitlebarMinimize.addClass('ui-state-focus');
+ // })
+ // .blur(function() {
+ // uiChatboxTitlebarMinimize.removeClass('ui-state-focus');
+ // })
+ .click(function(event) {
+ self.toggleContent(event);
+ return false;
+ })
+ .appendTo(uiChatboxTitlebar),
+ uiChatboxTitlebarMinimizeText = $('<span></span>')
+ .addClass('ui-icon ' +
+ 'ui-icon-minusthick')
+ .text('minimize')
+ .appendTo(uiChatboxTitlebarMinimize),
+ // content
+ uiChatboxContent = (self.uiChatboxContent = $('<div></div>'))
+ .addClass('ui-widget-content ' +
+ 'ui-chatbox-content '
+ )
+ .appendTo(uiChatbox),
+ uiChatboxLog = (self.uiChatboxLog = self.element)
+ //.show()
+ .addClass('ui-widget-content '+
+ 'ui-chatbox-log'
+ )
+ .appendTo(uiChatboxContent),
+ uiChatboxInput = (self.uiChatboxInput = $('<div></div>'))
+ .addClass('ui-widget-content ' +
+ 'ui-chatbox-input'
+ )
+ .click(function(event) {
+ // anything?
+ })
+ .appendTo(uiChatboxContent),
+ uiChatboxInputBox = (self.uiChatboxInputBox = $('<textarea></textarea>'))
+ .addClass('ui-widget-content ' +
+ 'ui-chatbox-input-box ' +
+ 'ui-corner-all'
+ )
+ .appendTo(uiChatboxInput)
+ .keydown(function(event) {
+ if(event.keyCode && event.keyCode == $.ui.keyCode.ENTER) {
+ msg = $.trim($(this).val());
+ if(msg.length > 0) {
+ self.options.messageSent(self.options.id, self.options.user, msg);
+ }
+ $(this).val('');
+ return false;
+ }
+ })
+ .focusin(function() {
+ uiChatboxInputBox.addClass('ui-chatbox-input-focus');
+ var box = $(this).parent().prev();
+ box.scrollTop(box.get(0).scrollHeight);
+ })
+ .focusout(function() {
+ uiChatboxInputBox.removeClass('ui-chatbox-input-focus');
+ });
+
+ // disable selection
+ uiChatboxTitlebar.find('*').add(uiChatboxTitlebar).disableSelection();
+
+ // switch focus to input box when whatever clicked
+ uiChatboxContent.children().click(function(){
+ // click on any children, set focus on input box
+ self.uiChatboxInputBox.focus();
+ });
+
+ self._setWidth(self.options.width);
+ self._position(self.options.offset);
+
+ self.options.boxManager.init(self);
+
+ if(!self.options.hidden) {
+ uiChatbox.show();
+ }
+ },
+
+ _setOption: function(option, value) {
+ if(value != null){
+ switch(option) {
+ case "hidden":
+ if(value) {
+ this.uiChatbox.hide();
+ }
+ else {
+ this.uiChatbox.show();
+ }
+ break;
+ case "offset":
+ this._position(value);
+ break;
+ case "width":
+ this._setWidth(value);
+ break;
+ }
+ }
+
+ $.Widget.prototype._setOption.apply(this, arguments);
+ },
+
+ _setWidth: function(width) {
+ this.uiChatboxTitlebar.width(width + "px");
+ this.uiChatboxLog.width(width + "px");
+ // this is a hack, but i can live with it so far
+ this.uiChatboxInputBox.css("width", (width - 14) + "px");
+ },
+
+ _position: function(offset) {
+ this.uiChatbox.css("right", offset);
+ }
+ });
+
+}(jQuery));
@@ -0,0 +1,19 @@
+/*
+<% publish_to "/messages/new" do %>
+ $("#chat").append("<%= j render(@message) %>");
+ $("#new_message")[0].reset();
+<% end %>
+*/
+$(document).ready(function(){
+ // to create
+ $("#link_add").click(function(){
+ alert("Hola");
+ $("#chat_div").chatbox({
+ id : "chat_div", title : "Title", user : "can be anything", offset: 200,
+ messageSent: function(id, user, msg){alert("DOM " + id + " just typed in " + msg);}
+ });
+ // to insert a message
+ //$("#chat_div").chatbox("option", "boxManager").addMsg("Mr. Foo", "Barrr!");
+ });
+});
+
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,54 @@
+/* style sheets */
+.ui-chatbox {
+ position: fixed;
+ bottom:0;
+ padding: 2px 2px 2px 2px;
+ padding: 2px 2px 2px 2px;
+ background: #CCCCCC;
+ /* background: #CCCCCC; */
+}
+
+.ui-chatbox-titlebar {
+ padding: 3px 3px 3px 3px;
+ height: 20px;
+}
+
+.ui-chatbox-content {
+ padding: 0px 0px 0px 0px;
+ margin: 0px 0px 0px 0px;
+ border: 0px;
+}
+
+.ui-chatbox-log {
+ padding: 3px 3px 3px 3px;
+ height: 150px;
+ overflow-y: auto;
+ background: #FFFFFF;
+}
+
+.ui-chatbox-input {
+ padding: 3px 3px 3px 3px;
+ border-top: 1px solid grey;
+ overflow: hidden;
+ /* background: #FFFFFF; */
+}
+
+.ui-chatbox-input-box {
+ margin: 5px 5px 5px 5px;
+ border: 2px solid lightgrey;/* #6699FF */
+ /* padding:5px 5px 5px 5px; */
+ height: 35px;
+}
+
+.ui-chatbox-icon {
+ float: right;
+}
+
+.ui-chatbox-input-focus {
+ border-color: #6699FF;
+}
+
+.ui-chatbox-msg {
+ float: left;
+ clear: both;
+}
@@ -0,0 +1,3 @@
+// Place all the styles related to the walls controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
Oops, something went wrong.

0 comments on commit 1e20dfd

Please sign in to comment.