From 4a459d1f493eaa10240e1eb432c4194206448b28 Mon Sep 17 00:00:00 2001 From: Alexander Date: Sun, 25 Sep 2016 22:59:52 +0200 Subject: [PATCH] Fix if else statements for images & change navbar look --- .DS_Store | Bin 6148 -> 6148 bytes Gemfile | 5 +- Gemfile.lock | 12 ++++- app/.DS_Store | Bin 6148 -> 6148 bytes app/assets/.DS_Store | Bin 6148 -> 6148 bytes app/assets/images/.DS_Store | Bin 0 -> 6148 bytes app/assets/images/empty.jpg | Bin 26644 -> 0 bytes app/assets/images/fallback/empty.jpg | Bin 0 -> 2293 bytes app/assets/javascripts/application.js | 1 + app/assets/javascripts/channels/channel.rb | 4 ++ app/assets/javascripts/channels/connection.rb | 4 ++ app/assets/javascripts/messages.coffee | 3 ++ app/assets/javascripts/socket.io.js | 4 ++ app/assets/stylesheets/application.sass | 6 +++ app/assets/stylesheets/sections/_chatbar.sass | 9 ++++ app/assets/stylesheets/sections/_navbar.sass | 21 +++++---- .../stylesheets/sections/_post-form.sass | 5 ++ .../stylesheets/sections/_user-form.sass | 3 ++ app/controllers/application_controller.rb | 6 ++- app/controllers/messages_controller.rb | 27 +++++++++++ app/controllers/users_controller.rb | 6 +-- app/helpers/messages_helper.rb | 2 + app/helpers/sessions_helper.rb | 22 +++++++++ app/models/ability.rb | 15 ++++++ app/models/message.rb | 5 ++ app/models/user.rb | 3 ++ app/models/wall.rb | 1 + app/uploaders/avatar_uploader.rb | 2 +- app/views/layouts/application.html.erb | 3 ++ app/views/messages/_message.html.erb | 8 ++++ app/views/messages/_messages.html.erb | 7 +++ app/views/messages/_messages_form.html.erb | 6 +++ app/views/messages/index.html.erb | 4 ++ app/views/posts/_form.html.erb | 4 ++ app/views/shared/_chatbar.html.erb | 5 ++ app/views/shared/_navbar.html.erb | 6 ++- app/views/users/_form.html.erb | 2 +- app/views/users/index.html.erb | 44 +++++++++++++++++- app/views/users/show.html.erb | 6 ++- app/views/walls/index.html.erb | 2 +- config/routes.rb | 3 ++ db/migrate/20160916160040_create_messages.rb | 10 ++++ .../20160925201647_add_admin_to_users.rb | 5 ++ db/schema.rb | 21 ++++++--- test/controllers/messages_controller_test.rb | 14 ++++++ test/fixtures/messages.yml | 11 +++++ test/models/message_test.rb | 7 +++ 47 files changed, 304 insertions(+), 30 deletions(-) create mode 100644 app/assets/images/.DS_Store delete mode 100644 app/assets/images/empty.jpg create mode 100644 app/assets/images/fallback/empty.jpg create mode 100644 app/assets/javascripts/channels/channel.rb create mode 100644 app/assets/javascripts/channels/connection.rb create mode 100644 app/assets/javascripts/messages.coffee create mode 100644 app/assets/javascripts/socket.io.js create mode 100644 app/assets/stylesheets/sections/_chatbar.sass create mode 100644 app/assets/stylesheets/sections/_user-form.sass create mode 100644 app/controllers/messages_controller.rb create mode 100644 app/helpers/messages_helper.rb create mode 100644 app/helpers/sessions_helper.rb create mode 100644 app/models/ability.rb create mode 100644 app/models/message.rb create mode 100644 app/views/messages/_message.html.erb create mode 100644 app/views/messages/_messages.html.erb create mode 100644 app/views/messages/_messages_form.html.erb create mode 100644 app/views/messages/index.html.erb create mode 100644 app/views/shared/_chatbar.html.erb create mode 100644 db/migrate/20160916160040_create_messages.rb create mode 100644 db/migrate/20160925201647_add_admin_to_users.rb create mode 100644 test/controllers/messages_controller_test.rb create mode 100644 test/fixtures/messages.yml create mode 100644 test/models/message_test.rb diff --git a/.DS_Store b/.DS_Store index fadd49af93a07740151b4698fdea46e28fdbf625..953923a1611159acca6127452a6a9844eefca9b3 100644 GIT binary patch literal 6148 zcmeHK%Wl&^6ulFN)Zrl_RH=xSH%Kg^DlP?8LY2~x3Uz^m2!aKm){aAK)$v5J(+EOP zHv9t;`~cs=f+Ziq2f&#J$exsK1Zb`_bLMgGota~g$3sM{Gl_hn1`)YP0;?C1onxY3 zq$R89mTN#JV(@;L@DMc-&YD%gD)6@}Aoi|90gY&Mkd*fCJ@nlAAx$nqv%+aM(!2ai zI7;FyZ?(R$ic`H%TXXAmw|>Qa**oFWULNF=tP_l%%UT=_LS25sdGfm)giqta^suph zpQm{cr-N~U{^D7jMts`glQha?oJT=^0$(}MVdKVZ=C^ikH@$6td*1YBzQ48A^mgvv zna^E!{$4L=9G*qn>Adk%}6I*@qBJ`~=u8s5VRg)(BlJT3`+i(Ho; zysK6`E~I3X^*<}5V#3lqVfn#Xk7HDQjX{u=0G~tH8gdfcQRmNCMj$7YgO41DU)60IO)0 zhO+$m2YR9b*w(mEh!z-Au0Z9=^c92Yy8~11=x=NOLZNaeCPzjbJu=fb6sE5p%#(Ct zZG|?s3Rnfo3OK6T5a<8?pYQ)=CtI@$SOxwo1z5G)>vpgteYP$wPMozK(h-s{!CNSl lF39w8EDPc&zK$dfeV!-)+Zq=N(E_tS0#XK>Sp`AjHu~68Ak%57MnIVy(fT19zI5{UNKR*W~1O`k{8YBS30t`_3&4L_a pESnWLCNXbj=iui6ngkU2&ODi4M3IqkvZ;vjWPcux%`qY?m;o7$6kh-U diff --git a/Gemfile b/Gemfile index 1cd4e32..ae001f9 100644 --- a/Gemfile +++ b/Gemfile @@ -22,7 +22,7 @@ gem 'turbolinks', '~> 5' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.5' # Use Redis adapter to run Action Cable in production -# gem 'redis', '~> 3.0' +gem 'redis', '~> 3.0' # Use ActiveModel has_secure_password # gem 'bcrypt', '~> 3.1.7' @@ -34,9 +34,9 @@ gem 'rmagick' gem "animate-rails" gem 'best_in_place', '~> 3.0.1' gem 'simple_form' -gem 'carrierwave' gem "fog-aws" gem "figaro" +gem 'cancancan', '~> 1.10' # Use Capistrano for deployment # gem 'capistrano-rails', group: :development @@ -51,6 +51,7 @@ group :development do # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. gem 'web-console' gem 'listen', '~> 3.0.5' + gem "better_errors" # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' gem 'spring-watcher-listen', '~> 2.0.0' diff --git a/Gemfile.lock b/Gemfile.lock index 9bc3044..2772858 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -45,14 +45,20 @@ GEM best_in_place (3.0.3) actionpack (>= 3.2) railties (>= 3.2) + better_errors (2.1.1) + coderay (>= 1.0.0) + erubis (>= 2.6.6) + rack (>= 0.9.0) builder (3.2.2) byebug (9.0.5) + cancancan (1.15.0) carrierwave (0.11.2) activemodel (>= 3.2.0) activesupport (>= 3.2.0) json (>= 1.7) mime-types (>= 1.16) mimemagic (>= 0.3.0) + coderay (1.1.1) coffee-rails (4.2.1) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.2.x) @@ -158,6 +164,7 @@ GEM rb-fsevent (0.9.7) rb-inotify (0.9.7) ffi (>= 0.5.0) + redis (3.3.1) responders (2.3.0) railties (>= 4.2.0, < 5.1) rmagick (2.16.0) @@ -210,7 +217,9 @@ PLATFORMS DEPENDENCIES animate-rails best_in_place (~> 3.0.1) + better_errors byebug + cancancan (~> 1.10) carrierwave coffee-rails (~> 4.2) devise @@ -224,6 +233,7 @@ DEPENDENCIES pg puma (~> 3.0) rails (~> 5.0.0) + redis (~> 3.0) rmagick sass-rails (~> 5.0) simple_form @@ -236,4 +246,4 @@ DEPENDENCIES web-console BUNDLED WITH - 1.12.5 + 1.13.1 diff --git a/app/.DS_Store b/app/.DS_Store index c32883842752acf742ff9e4a68f0123bb24f31f0..0e3ff79b33aafe60f5507d8a3739e08f8174aee4 100644 GIT binary patch literal 6148 zcmeHK%Wl&^6upzUi9{;gt^=8DBd6>*;gcZYL4$1yi~>f1|4jk0c01%#h9{!x`W2hPBlx|a(&W%9+@Q#2 zdaZvAW=Wjo!{K+mD4Rp1pmyyjZ>eBqu@)Tb8t&8h^uQWGd4Pvq=(Qpdz4BaXy}>2~S_6 zT-4b#p((UX@kEqV_ClfM7x=oC+u(C>bD9GaJP~s1J1C;qPA#g7K1A!YjqDFKwncBy zcF<_`M~&B|GmJdmJcgEEV|T#j6mFVj>syW6qXovAfbYwQ#thpBwTLY`$4DY7>Z6ul zFKCJzu~2NHo}wrt0|NsP3otO0Fcha0C+8&P=jTi;RA*$IEYB*lS%gEF qWn+U6^JaDqeh#3n&4L`?nJ4p$=yHNI9spv7$u>OFn`13 zg{OcQ;8}P89tXbJU8=Y#91%i0((Jc8JL5k;TV5{_iNQSfiMmAO!C4z^G&dN}vu{|# zMz*0sA0wslai&I5rlO5(7x)(m@Uv^th!o}Yj_S{kUy7&jhd;FG%Wom)j6xbyLdDv% z=G?D;%8eGq)V>$rqG^^EWxxMjG`5 zrLwDj7`;rB#Yy+>GnJQNnkTch^f#~4JXVW=n&)w$kMle%C#cmYI_chDF8%)gqn_OJ z_f|c*^!?r4p4@-(c(wApod^EG@#)#chvmoBa>om$il905nb5itKL5+L|H5m>E^>Q4t6y#;_a5!Qx2{|a)Av>I5gjA8~R zOexfq3cJM+rW|o;^8%}tQBzLBZa#!Pv#>i9q0f%vOPx+4FzQ-Iz!9hu*fPT|um4BC z-~ZQ(+{h7d1pX@mqIozx9N?Dh+PZObyw*ziDV&Y-Dx+5==;);wxx5tLgKI-vat9h% Tt&Ac9b3XzagKHdtze?aIFVc;v delta 91 zcmZoMXfc=|#>CJzu~2NHo}wrt0|NsP3otOGG8Cs2C+8&P=jTi;RA*$I?9D8*`3ti! q%O(~d=FRLJ{2V}Cn?EvtXP(S2qRR==cmRkQCfo2xZ;laJ!VCZilomYz diff --git a/app/assets/images/.DS_Store b/app/assets/images/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..4de5617969cc328704b0117567235716206005d1 GIT binary patch literal 6148 zcmeHK%Wl&^6upxKYKK;2fmFoG8zdG9ibFw_P$esrMR!O+umIHBNk|N?CyJd~Z3yy) ze?WpC;9FR*HqI`}AIY?-%jku8I$`WD-O&{(CTq!X$0Cf3ixocJ2CxW!sj$WxeT*dDct) zbe44e=_`2`4u*mDpK~5v_#E5ER4Sv<%}+gr{#c2F^~br3laqska}PH+*RFkg_U+rdXYbzq zJckbM=i%kqyZ4~rL0&$70Re%12ZRm_@*h6LFTno>1jx?v;o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sv3asz*ACj=J-%Ut6j`^vK3M$blFWl*SUqiJ5QbxVb837KLs585dlA zz-3B}jh6~Ek4>)7XE5If>k4cg!B$c(pPP9al*pNY(OyaeoMHqN+Z$XJlV*`d%eG(FG#SY>L8Ui;B!JI7eU%AqLsI+oH{* zC_0n%#PLBjrR5+?^`1S++=oV*tWin$G0a1VjT!5ln&~VO2>cNL6M05eg$l{i)6ll$ z=eEh@r(X>T$ux{BxmQgYm&j|EfwX_Dj1K<<#E0rrap#v7d^;EB-M=1LNv1uiEn$5? zNZ)4t@+wGcjCphDjqPC*P`_HB^{rVSxa0s)zp?t4 zv-yefo_4Z!majGexfb)ak8`R7&jHv4s)H(|t~V3z@#S~ckmR*M!mK_bYerbl@cREW zijTqA%wFI!XCX(%n8r4p0rVvJI@o}p ze_QguRADK*8jz7pU@h|D8{n%L-2bqqF8%b;rWGl;2idreY2>*a@dyA}E9jjKk&X2X z8#_C;WNyLQ9P}?HU~Va9s5yXhOvot!e@dT(IqKxHc0(K>@IWp=>1BR``m7A0TQBU4 z`Rji%2*7C%!^awhoSkW*!_E3MEqQH}^MiP%&c8`-vv#X{vIFr<+fp1vNOYW?Ifqszsb$kJt$Yf6mdkZclw3>7j6Fj?@!l(|l42&Mvvs@DsefAby3)6+=tRSoC)Q5#9~Z`e{#X&(X*3)TtirGiDC|Ccm8MHzztTPzh6YSk2Zj)Tv6~ z;UQ(==0IU^Y+=F)+|(rX(Egx*GXS99>{qVn=SKpRR)Tz{v3D-%u!~ixq=coyF7?iM z5zR%*-6r;b7l#V>{x_p2Cw-AS7$|WxbKQNsU=tAIS;uzgQ8Z^!8H}yDBEq31VzcA_11zjQ^#A|> diff --git a/app/assets/images/fallback/empty.jpg b/app/assets/images/fallback/empty.jpg new file mode 100644 index 0000000000000000000000000000000000000000..aad7d3b87d15a7506ac7a83a6ab1ede78f413f83 GIT binary patch literal 2293 zcma)53s6&M7QUB|5P5|ZaH&AO4O-c)5N@6(5@|?4umj~`#RaSzk}HXj+>jd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1UV> z6=IIhiYN(=6=d>?lxIz>_%$~!IrTkJf8%fiUnmQxb#8XZ%=(rO%s@p}grXdp@K6;6 zw+~ISzFAURb1rG~aBex+zpLc6w?oN_Qt)DN6|knnwG(^x^V(}a#O@tz?J)!FOLe!6 zODQGVW212WjM0<3+Uw*d+nS-Hlqg4i=O8$l=l>+?c&US^v~1wcq0=ywV-&{Pu9Xb- z_U)~aUf>*dkHof*SCtCRNdGx?pyd?x;#@=WW$_^ns+(&}gq{uLtXs)f2a5Xst@_%t zgLL9ELn)hxvAfcF?&+~@l!Jy0GqCE)*(v#CkvA}Ql5F~PHd+5F#_wNTR`qQZn0YT} zX+>gfeO`QcaQK9+@7z z(FXv+_g;&|@|)fHvcwEDUwpJ~Rl$9B44NC;(-_`Ljc-2l+_d}HE%>SNQ&P6oB9@%T Qe){Cm?C@a!F7prn1?NLtRR910 literal 0 HcmV?d00001 diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 2400da3..d4510f1 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -13,6 +13,7 @@ //= require jquery //= require best_in_place //= require jquery-ui +//= require socket.io //= require jquery_ujs //= require turbolinks //= require_tree . diff --git a/app/assets/javascripts/channels/channel.rb b/app/assets/javascripts/channels/channel.rb new file mode 100644 index 0000000..d672697 --- /dev/null +++ b/app/assets/javascripts/channels/channel.rb @@ -0,0 +1,4 @@ +module ApplicationCable + class Channel < ActionCable::Channel::Base + end +end diff --git a/app/assets/javascripts/channels/connection.rb b/app/assets/javascripts/channels/connection.rb new file mode 100644 index 0000000..0ff5442 --- /dev/null +++ b/app/assets/javascripts/channels/connection.rb @@ -0,0 +1,4 @@ +module ApplicationCable + class Connection < ActionCable::Connection::Base + end +end diff --git a/app/assets/javascripts/messages.coffee b/app/assets/javascripts/messages.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/messages.coffee @@ -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://coffeescript.org/ diff --git a/app/assets/javascripts/socket.io.js b/app/assets/javascripts/socket.io.js new file mode 100644 index 0000000..7a7b485 --- /dev/null +++ b/app/assets/javascripts/socket.io.js @@ -0,0 +1,4 @@ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.io=f()}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o0){this.extraHeaders=opts.extraHeaders}}this.open()}Socket.priorWebsocketSuccess=false;Emitter(Socket.prototype);Socket.protocol=parser.protocol;Socket.Socket=Socket;Socket.Transport=_dereq_("./transport");Socket.transports=_dereq_("./transports");Socket.parser=_dereq_("engine.io-parser");Socket.prototype.createTransport=function(name){debug('creating transport "%s"',name);var query=clone(this.query);query.EIO=parser.protocol;query.transport=name;if(this.id)query.sid=this.id;var transport=new transports[name]({agent:this.agent,hostname:this.hostname,port:this.port,secure:this.secure,path:this.path,query:query,forceJSONP:this.forceJSONP,jsonp:this.jsonp,forceBase64:this.forceBase64,enablesXDR:this.enablesXDR,timestampRequests:this.timestampRequests,timestampParam:this.timestampParam,policyPort:this.policyPort,socket:this,pfx:this.pfx,key:this.key,passphrase:this.passphrase,cert:this.cert,ca:this.ca,ciphers:this.ciphers,rejectUnauthorized:this.rejectUnauthorized,perMessageDeflate:this.perMessageDeflate,extraHeaders:this.extraHeaders});return transport};function clone(obj){var o={};for(var i in obj){if(obj.hasOwnProperty(i)){o[i]=obj[i]}}return o}Socket.prototype.open=function(){var transport;if(this.rememberUpgrade&&Socket.priorWebsocketSuccess&&this.transports.indexOf("websocket")!=-1){transport="websocket"}else if(0===this.transports.length){var self=this;setTimeout(function(){self.emit("error","No transports available")},0);return}else{transport=this.transports[0]}this.readyState="opening";try{transport=this.createTransport(transport)}catch(e){this.transports.shift();this.open();return}transport.open();this.setTransport(transport)};Socket.prototype.setTransport=function(transport){debug("setting transport %s",transport.name);var self=this;if(this.transport){debug("clearing existing transport %s",this.transport.name);this.transport.removeAllListeners()}this.transport=transport;transport.on("drain",function(){self.onDrain()}).on("packet",function(packet){self.onPacket(packet)}).on("error",function(e){self.onError(e)}).on("close",function(){self.onClose("transport close")})};Socket.prototype.probe=function(name){debug('probing transport "%s"',name);var transport=this.createTransport(name,{probe:1}),failed=false,self=this;Socket.priorWebsocketSuccess=false;function onTransportOpen(){if(self.onlyBinaryUpgrades){var upgradeLosesBinary=!this.supportsBinary&&self.transport.supportsBinary;failed=failed||upgradeLosesBinary}if(failed)return;debug('probe transport "%s" opened',name);transport.send([{type:"ping",data:"probe"}]);transport.once("packet",function(msg){if(failed)return;if("pong"==msg.type&&"probe"==msg.data){debug('probe transport "%s" pong',name);self.upgrading=true;self.emit("upgrading",transport);if(!transport)return;Socket.priorWebsocketSuccess="websocket"==transport.name;debug('pausing current transport "%s"',self.transport.name);self.transport.pause(function(){if(failed)return;if("closed"==self.readyState)return;debug("changing transport and sending upgrade packet");cleanup();self.setTransport(transport);transport.send([{type:"upgrade"}]);self.emit("upgrade",transport);transport=null;self.upgrading=false;self.flush()})}else{debug('probe transport "%s" failed',name);var err=new Error("probe error");err.transport=transport.name;self.emit("upgradeError",err)}})}function freezeTransport(){if(failed)return;failed=true;cleanup();transport.close();transport=null}function onerror(err){var error=new Error("probe error: "+err);error.transport=transport.name;freezeTransport();debug('probe transport "%s" failed because of error: %s',name,err);self.emit("upgradeError",error)}function onTransportClose(){onerror("transport closed")}function onclose(){onerror("socket closed")}function onupgrade(to){if(transport&&to.name!=transport.name){debug('"%s" works - aborting "%s"',to.name,transport.name);freezeTransport()}}function cleanup(){transport.removeListener("open",onTransportOpen);transport.removeListener("error",onerror);transport.removeListener("close",onTransportClose);self.removeListener("close",onclose);self.removeListener("upgrading",onupgrade)}transport.once("open",onTransportOpen);transport.once("error",onerror);transport.once("close",onTransportClose);this.once("close",onclose);this.once("upgrading",onupgrade);transport.open()};Socket.prototype.onOpen=function(){debug("socket open");this.readyState="open";Socket.priorWebsocketSuccess="websocket"==this.transport.name;this.emit("open");this.flush();if("open"==this.readyState&&this.upgrade&&this.transport.pause){debug("starting upgrade probes");for(var i=0,l=this.upgrades.length;i';iframe=document.createElement(html)}catch(e){iframe=document.createElement("iframe");iframe.name=self.iframeId;iframe.src="javascript:0"}iframe.id=self.iframeId;self.form.appendChild(iframe);self.iframe=iframe}initIframe();data=data.replace(rEscapedNewline,"\\\n");this.area.value=data.replace(rNewline,"\\n");try{this.form.submit()}catch(e){}if(this.iframe.attachEvent){this.iframe.onreadystatechange=function(){if(self.iframe.readyState=="complete"){complete()}}}else{this.iframe.onload=complete}}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:typeof global!=="undefined"?global:{})},{"./polling":8,"component-inherit":16}],7:[function(_dereq_,module,exports){(function(global){var XMLHttpRequest=_dereq_("xmlhttprequest-ssl");var Polling=_dereq_("./polling");var Emitter=_dereq_("component-emitter");var inherit=_dereq_("component-inherit");var debug=_dereq_("debug")("engine.io-client:polling-xhr");module.exports=XHR;module.exports.Request=Request;function empty(){}function XHR(opts){Polling.call(this,opts);if(global.location){var isSSL="https:"==location.protocol;var port=location.port;if(!port){port=isSSL?443:80}this.xd=opts.hostname!=global.location.hostname||port!=opts.port;this.xs=opts.secure!=isSSL}else{this.extraHeaders=opts.extraHeaders}}inherit(XHR,Polling);XHR.prototype.supportsBinary=true;XHR.prototype.request=function(opts){opts=opts||{};opts.uri=this.uri();opts.xd=this.xd;opts.xs=this.xs;opts.agent=this.agent||false;opts.supportsBinary=this.supportsBinary;opts.enablesXDR=this.enablesXDR;opts.pfx=this.pfx;opts.key=this.key;opts.passphrase=this.passphrase;opts.cert=this.cert;opts.ca=this.ca;opts.ciphers=this.ciphers;opts.rejectUnauthorized=this.rejectUnauthorized;opts.extraHeaders=this.extraHeaders;return new Request(opts)};XHR.prototype.doWrite=function(data,fn){var isBinary=typeof data!=="string"&&data!==undefined;var req=this.request({method:"POST",data:data,isBinary:isBinary});var self=this;req.on("success",fn);req.on("error",function(err){self.onError("xhr post error",err)});this.sendXhr=req};XHR.prototype.doPoll=function(){debug("xhr poll");var req=this.request();var self=this;req.on("data",function(data){self.onData(data)});req.on("error",function(err){self.onError("xhr poll error",err)});this.pollXhr=req};function Request(opts){this.method=opts.method||"GET";this.uri=opts.uri;this.xd=!!opts.xd;this.xs=!!opts.xs;this.async=false!==opts.async;this.data=undefined!=opts.data?opts.data:null;this.agent=opts.agent;this.isBinary=opts.isBinary;this.supportsBinary=opts.supportsBinary;this.enablesXDR=opts.enablesXDR;this.pfx=opts.pfx;this.key=opts.key;this.passphrase=opts.passphrase;this.cert=opts.cert;this.ca=opts.ca;this.ciphers=opts.ciphers;this.rejectUnauthorized=opts.rejectUnauthorized;this.extraHeaders=opts.extraHeaders;this.create()}Emitter(Request.prototype);Request.prototype.create=function(){var opts={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};opts.pfx=this.pfx;opts.key=this.key;opts.passphrase=this.passphrase;opts.cert=this.cert;opts.ca=this.ca;opts.ciphers=this.ciphers;opts.rejectUnauthorized=this.rejectUnauthorized;var xhr=this.xhr=new XMLHttpRequest(opts);var self=this;try{debug("xhr open %s: %s",this.method,this.uri);xhr.open(this.method,this.uri,this.async);try{if(this.extraHeaders){xhr.setDisableHeaderCheck(true);for(var i in this.extraHeaders){if(this.extraHeaders.hasOwnProperty(i)){xhr.setRequestHeader(i,this.extraHeaders[i])}}}}catch(e){}if(this.supportsBinary){xhr.responseType="arraybuffer"}if("POST"==this.method){try{if(this.isBinary){xhr.setRequestHeader("Content-type","application/octet-stream")}else{xhr.setRequestHeader("Content-type","text/plain;charset=UTF-8")}}catch(e){}}if("withCredentials"in xhr){xhr.withCredentials=true}if(this.hasXDR()){xhr.onload=function(){self.onLoad()};xhr.onerror=function(){self.onError(xhr.responseText)}}else{xhr.onreadystatechange=function(){if(4!=xhr.readyState)return;if(200==xhr.status||1223==xhr.status){self.onLoad()}else{setTimeout(function(){self.onError(xhr.status)},0)}}}debug("xhr data %s",this.data);xhr.send(this.data)}catch(e){setTimeout(function(){self.onError(e)},0);return}if(global.document){this.index=Request.requestsCount++;Request.requests[this.index]=this}};Request.prototype.onSuccess=function(){this.emit("success");this.cleanup()};Request.prototype.onData=function(data){this.emit("data",data);this.onSuccess()};Request.prototype.onError=function(err){this.emit("error",err);this.cleanup(true)};Request.prototype.cleanup=function(fromError){if("undefined"==typeof this.xhr||null===this.xhr){return}if(this.hasXDR()){this.xhr.onload=this.xhr.onerror=empty}else{this.xhr.onreadystatechange=empty}if(fromError){try{this.xhr.abort()}catch(e){}}if(global.document){delete Request.requests[this.index]}this.xhr=null};Request.prototype.onLoad=function(){var data;try{var contentType;try{contentType=this.xhr.getResponseHeader("Content-Type").split(";")[0]}catch(e){}if(contentType==="application/octet-stream"){data=this.xhr.response}else{if(!this.supportsBinary){data=this.xhr.responseText}else{try{data=String.fromCharCode.apply(null,new Uint8Array(this.xhr.response))}catch(e){var ui8Arr=new Uint8Array(this.xhr.response);var dataArray=[];for(var idx=0,length=ui8Arr.length;idxbytes){end=bytes}if(start>=bytes||start>=end||bytes===0){return new ArrayBuffer(0)}var abv=new Uint8Array(arraybuffer);var result=new Uint8Array(end-start);for(var i=start,ii=0;i>2]; +base64+=chars[(bytes[i]&3)<<4|bytes[i+1]>>4];base64+=chars[(bytes[i+1]&15)<<2|bytes[i+2]>>6];base64+=chars[bytes[i+2]&63]}if(len%3===2){base64=base64.substring(0,base64.length-1)+"="}else if(len%3===1){base64=base64.substring(0,base64.length-2)+"=="}return base64};exports.decode=function(base64){var bufferLength=base64.length*.75,len=base64.length,i,p=0,encoded1,encoded2,encoded3,encoded4;if(base64[base64.length-1]==="="){bufferLength--;if(base64[base64.length-2]==="="){bufferLength--}}var arraybuffer=new ArrayBuffer(bufferLength),bytes=new Uint8Array(arraybuffer);for(i=0;i>4;bytes[p++]=(encoded2&15)<<4|encoded3>>2;bytes[p++]=(encoded3&3)<<6|encoded4&63}return arraybuffer}})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")},{}],14:[function(_dereq_,module,exports){(function(global){var BlobBuilder=global.BlobBuilder||global.WebKitBlobBuilder||global.MSBlobBuilder||global.MozBlobBuilder;var blobSupported=function(){try{var a=new Blob(["hi"]);return a.size===2}catch(e){return false}}();var blobSupportsArrayBufferView=blobSupported&&function(){try{var b=new Blob([new Uint8Array([1,2])]);return b.size===2}catch(e){return false}}();var blobBuilderSupported=BlobBuilder&&BlobBuilder.prototype.append&&BlobBuilder.prototype.getBlob;function mapArrayBufferViews(ary){for(var i=0;i=31}exports.formatters.j=function(v){return JSON.stringify(v)};function formatArgs(){var args=arguments;var useColors=this.useColors;args[0]=(useColors?"%c":"")+this.namespace+(useColors?" %c":" ")+args[0]+(useColors?"%c ":" ")+"+"+exports.humanize(this.diff);if(!useColors)return args;var c="color: "+this.color;args=[args[0],c,"color: inherit"].concat(Array.prototype.slice.call(args,1));var index=0;var lastC=0;args[0].replace(/%[a-z%]/g,function(match){if("%%"===match)return;index++;if("%c"===match){lastC=index}});args.splice(lastC,0,c);return args}function log(){return"object"===typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function save(namespaces){try{if(null==namespaces){exports.storage.removeItem("debug")}else{exports.storage.debug=namespaces}}catch(e){}}function load(){var r;try{r=exports.storage.debug}catch(e){}return r}exports.enable(load());function localstorage(){try{return window.localStorage}catch(e){}}},{"./debug":18}],18:[function(_dereq_,module,exports){exports=module.exports=debug;exports.coerce=coerce;exports.disable=disable;exports.enable=enable;exports.enabled=enabled;exports.humanize=_dereq_("ms");exports.names=[];exports.skips=[];exports.formatters={};var prevColor=0;var prevTime;function selectColor(){return exports.colors[prevColor++%exports.colors.length]}function debug(namespace){function disabled(){}disabled.enabled=false;function enabled(){var self=enabled;var curr=+new Date;var ms=curr-(prevTime||curr);self.diff=ms;self.prev=prevTime;self.curr=curr;prevTime=curr;if(null==self.useColors)self.useColors=exports.useColors();if(null==self.color&&self.useColors)self.color=selectColor();var args=Array.prototype.slice.call(arguments);args[0]=exports.coerce(args[0]);if("string"!==typeof args[0]){args=["%o"].concat(args)}var index=0;args[0]=args[0].replace(/%([a-z%])/g,function(match,format){if(match==="%%")return match;index++;var formatter=exports.formatters[format];if("function"===typeof formatter){var val=args[index];match=formatter.call(self,val);args.splice(index,1);index--}return match});if("function"===typeof exports.formatArgs){args=exports.formatArgs.apply(self,args)}var logFn=enabled.log||exports.log||console.log.bind(console);logFn.apply(self,args)}enabled.enabled=true;var fn=exports.enabled(namespace)?enabled:disabled;fn.namespace=namespace;return fn}function enable(namespaces){exports.save(namespaces);var split=(namespaces||"").split(/[\s,]+/);var len=split.length;for(var i=0;i1){return{type:packetslist[type],data:data.substring(1)}}else{return{type:packetslist[type]}}}var asArray=new Uint8Array(data);var type=asArray[0];var rest=sliceBuffer(data,1);if(Blob&&binaryType==="blob"){rest=new Blob([rest])}return{type:packetslist[type],data:rest}};exports.decodeBase64Packet=function(msg,binaryType){var type=packetslist[msg.charAt(0)];if(!global.ArrayBuffer){return{type:type,data:{base64:true,data:msg.substr(1)}}}var data=base64encoder.decode(msg.substr(1));if(binaryType==="blob"&&Blob){data=new Blob([data])}return{type:type,data:data}};exports.encodePayload=function(packets,supportsBinary,callback){if(typeof supportsBinary=="function"){callback=supportsBinary;supportsBinary=null}var isBinary=hasBinary(packets);if(supportsBinary&&isBinary){if(Blob&&!dontSendBlobs){return exports.encodePayloadAsBlob(packets,callback)}return exports.encodePayloadAsArrayBuffer(packets,callback)}if(!packets.length){return callback("0:")}function setLengthHeader(message){return message.length+":"+message}function encodeOne(packet,doneCallback){exports.encodePacket(packet,!isBinary?false:supportsBinary,true,function(message){doneCallback(null,setLengthHeader(message))})}map(packets,encodeOne,function(err,results){return callback(results.join(""))})};function map(ary,each,done){var result=new Array(ary.length);var next=after(ary.length,done);var eachWithIndex=function(i,el,cb){each(el,function(error,msg){result[i]=msg;cb(error,result)})};for(var i=0;i0){var tailArray=new Uint8Array(bufferTail);var isString=tailArray[0]===0;var msgLength="";for(var i=1;;i++){if(tailArray[i]==255)break;if(msgLength.length>310){numberTooLong=true;break}msgLength+=tailArray[i]}if(numberTooLong)return callback(err,0,1);bufferTail=sliceBuffer(bufferTail,2+msgLength.length);msgLength=parseInt(msgLength);var msg=sliceBuffer(bufferTail,0,msgLength);if(isString){try{msg=String.fromCharCode.apply(null,new Uint8Array(msg))}catch(e){var typed=new Uint8Array(msg);msg="";for(var i=0;i1e4)return;var match=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str);if(!match)return;var n=parseFloat(match[1]);var type=(match[2]||"ms").toLowerCase();switch(type){case"years":case"year":case"yrs":case"yr":case"y":return n*y;case"days":case"day":case"d":return n*d;case"hours":case"hour":case"hrs":case"hr":case"h":return n*h;case"minutes":case"minute":case"mins":case"min":case"m":return n*m;case"seconds":case"second":case"secs":case"sec":case"s":return n*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}function short(ms){if(ms>=d)return Math.round(ms/d)+"d";if(ms>=h)return Math.round(ms/h)+"h";if(ms>=m)return Math.round(ms/m)+"m";if(ms>=s)return Math.round(ms/s)+"s";return ms+"ms"}function long(ms){return plural(ms,d,"day")||plural(ms,h,"hour")||plural(ms,m,"minute")||plural(ms,s,"second")||ms+" ms"}function plural(ms,n,name){if(ms=55296&&value<=56319&&counter65535){value-=65536;output+=stringFromCharCode(value>>>10&1023|55296);value=56320|value&1023}output+=stringFromCharCode(value)}return output}function checkScalarValue(codePoint){if(codePoint>=55296&&codePoint<=57343){throw Error("Lone surrogate U+"+codePoint.toString(16).toUpperCase()+" is not a scalar value")}}function createByte(codePoint,shift){return stringFromCharCode(codePoint>>shift&63|128)}function encodeCodePoint(codePoint){if((codePoint&4294967168)==0){return stringFromCharCode(codePoint)}var symbol="";if((codePoint&4294965248)==0){symbol=stringFromCharCode(codePoint>>6&31|192)}else if((codePoint&4294901760)==0){checkScalarValue(codePoint);symbol=stringFromCharCode(codePoint>>12&15|224);symbol+=createByte(codePoint,6)}else if((codePoint&4292870144)==0){symbol=stringFromCharCode(codePoint>>18&7|240);symbol+=createByte(codePoint,12);symbol+=createByte(codePoint,6)}symbol+=stringFromCharCode(codePoint&63|128);return symbol}function utf8encode(string){var codePoints=ucs2decode(string);var length=codePoints.length;var index=-1;var codePoint;var byteString="";while(++index=byteCount){throw Error("Invalid byte index")}var continuationByte=byteArray[byteIndex]&255;byteIndex++;if((continuationByte&192)==128){return continuationByte&63}throw Error("Invalid continuation byte")}function decodeSymbol(){var byte1;var byte2;var byte3;var byte4;var codePoint;if(byteIndex>byteCount){throw Error("Invalid byte index")}if(byteIndex==byteCount){return false}byte1=byteArray[byteIndex]&255;byteIndex++;if((byte1&128)==0){return byte1}if((byte1&224)==192){var byte2=readContinuationByte();codePoint=(byte1&31)<<6|byte2;if(codePoint>=128){return codePoint}else{throw Error("Invalid continuation byte")}}if((byte1&240)==224){byte2=readContinuationByte();byte3=readContinuationByte();codePoint=(byte1&15)<<12|byte2<<6|byte3;if(codePoint>=2048){checkScalarValue(codePoint);return codePoint}else{throw Error("Invalid continuation byte")}}if((byte1&248)==240){byte2=readContinuationByte();byte3=readContinuationByte();byte4=readContinuationByte();codePoint=(byte1&15)<<18|byte2<<12|byte3<<6|byte4;if(codePoint>=65536&&codePoint<=1114111){return codePoint}}throw Error("Invalid UTF-8 detected")}var byteArray;var byteCount;var byteIndex;function utf8decode(byteString){byteArray=ucs2decode(byteString);byteCount=byteArray.length;byteIndex=0;var codePoints=[];var tmp;while((tmp=decodeSymbol())!==false){codePoints.push(tmp)}return ucs2encode(codePoints)}var utf8={version:"2.0.0",encode:utf8encode,decode:utf8decode};if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define(function(){return utf8})}else if(freeExports&&!freeExports.nodeType){if(freeModule){freeModule.exports=utf8}else{var object={};var hasOwnProperty=object.hasOwnProperty;for(var key in utf8){hasOwnProperty.call(utf8,key)&&(freeExports[key]=utf8[key])}}}else{root.utf8=utf8}})(this)}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:typeof global!=="undefined"?global:{})},{}],30:[function(_dereq_,module,exports){"use strict";var alphabet="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),length=64,map={},seed=0,i=0,prev;function encode(num){var encoded="";do{encoded=alphabet[num%length]+encoded;num=Math.floor(num/length)}while(num>0);return encoded}function decode(str){var decoded=0;for(i=0;i0&&!this.encoding){var pack=this.packetBuffer.shift();this.packet(pack)}};Manager.prototype.cleanup=function(){debug("cleanup");var sub;while(sub=this.subs.shift())sub.destroy();this.packetBuffer=[];this.encoding=false;this.lastPing=null;this.decoder.destroy()};Manager.prototype.close=Manager.prototype.disconnect=function(){debug("disconnect");this.skipReconnect=true;this.reconnecting=false;if("opening"==this.readyState){this.cleanup()}this.backoff.reset();this.readyState="closed";if(this.engine)this.engine.close()};Manager.prototype.onclose=function(reason){debug("onclose");this.cleanup();this.backoff.reset();this.readyState="closed";this.emit("close",reason);if(this._reconnection&&!this.skipReconnect){this.reconnect()}};Manager.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var self=this;if(this.backoff.attempts>=this._reconnectionAttempts){debug("reconnect failed");this.backoff.reset();this.emitAll("reconnect_failed");this.reconnecting=false}else{var delay=this.backoff.duration();debug("will wait %dms before reconnect attempt",delay);this.reconnecting=true;var timer=setTimeout(function(){if(self.skipReconnect)return;debug("attempting reconnect");self.emitAll("reconnect_attempt",self.backoff.attempts);self.emitAll("reconnecting",self.backoff.attempts);if(self.skipReconnect)return;self.open(function(err){if(err){debug("reconnect attempt error");self.reconnecting=false;self.reconnect();self.emitAll("reconnect_error",err.data)}else{debug("reconnect success");self.onreconnect()}})},delay);this.subs.push({destroy:function(){clearTimeout(timer)}})}};Manager.prototype.onreconnect=function(){var attempt=this.backoff.attempts;this.reconnecting=false;this.backoff.reset();this.updateSocketIds();this.emitAll("reconnect",attempt)}},{"./on":33,"./socket":34,backo2:36,"component-bind":37,"component-emitter":38,debug:39,"engine.io-client":1,indexof:42,"socket.io-parser":47}],33:[function(_dereq_,module,exports){module.exports=on;function on(obj,ev,fn){obj.on(ev,fn);return{destroy:function(){obj.removeListener(ev,fn)}}}},{}],34:[function(_dereq_,module,exports){var parser=_dereq_("socket.io-parser");var Emitter=_dereq_("component-emitter");var toArray=_dereq_("to-array");var on=_dereq_("./on");var bind=_dereq_("component-bind");var debug=_dereq_("debug")("socket.io-client:socket");var hasBin=_dereq_("has-binary");module.exports=exports=Socket;var events={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1};var emit=Emitter.prototype.emit;function Socket(io,nsp){this.io=io;this.nsp=nsp;this.json=this;this.ids=0;this.acks={};this.receiveBuffer=[];this.sendBuffer=[];this.connected=false;this.disconnected=true;if(this.io.autoConnect)this.open()}Emitter(Socket.prototype);Socket.prototype.subEvents=function(){if(this.subs)return;var io=this.io;this.subs=[on(io,"open",bind(this,"onopen")),on(io,"packet",bind(this,"onpacket")),on(io,"close",bind(this,"onclose"))]};Socket.prototype.open=Socket.prototype.connect=function(){if(this.connected)return this;this.subEvents();this.io.open();if("open"==this.io.readyState)this.onopen();this.emit("connecting");return this};Socket.prototype.send=function(){var args=toArray(arguments);args.unshift("message");this.emit.apply(this,args);return this};Socket.prototype.emit=function(ev){if(events.hasOwnProperty(ev)){emit.apply(this,arguments);return this}var args=toArray(arguments);var parserType=parser.EVENT;if(hasBin(args)){parserType=parser.BINARY_EVENT}var packet={type:parserType,data:args};packet.options={};packet.options.compress=!this.flags||false!==this.flags.compress;if("function"==typeof args[args.length-1]){debug("emitting packet with ack id %d",this.ids);this.acks[this.ids]=args.pop();packet.id=this.ids++}if(this.connected){this.packet(packet)}else{this.sendBuffer.push(packet)}delete this.flags;return this};Socket.prototype.packet=function(packet){packet.nsp=this.nsp;this.io.packet(packet)};Socket.prototype.onopen=function(){debug("transport is open - connecting");if("/"!=this.nsp){this.packet({type:parser.CONNECT})}};Socket.prototype.onclose=function(reason){debug("close (%s)",reason);this.connected=false;this.disconnected=true;delete this.id;this.emit("disconnect",reason)};Socket.prototype.onpacket=function(packet){if(packet.nsp!=this.nsp)return;switch(packet.type){case parser.CONNECT:this.onconnect();break;case parser.EVENT:this.onevent(packet);break;case parser.BINARY_EVENT:this.onevent(packet);break;case parser.ACK:this.onack(packet);break;case parser.BINARY_ACK:this.onack(packet);break;case parser.DISCONNECT:this.ondisconnect();break;case parser.ERROR:this.emit("error",packet.data);break}};Socket.prototype.onevent=function(packet){var args=packet.data||[];debug("emitting event %j",args);if(null!=packet.id){debug("attaching ack callback to event");args.push(this.ack(packet.id))}if(this.connected){emit.apply(this,args)}else{this.receiveBuffer.push(args)}};Socket.prototype.ack=function(id){var self=this;var sent=false;return function(){if(sent)return;sent=true;var args=toArray(arguments);debug("sending ack %j",args);var type=hasBin(args)?parser.BINARY_ACK:parser.ACK;self.packet({type:type,id:id,data:args})}};Socket.prototype.onack=function(packet){var ack=this.acks[packet.id];if("function"==typeof ack){debug("calling ack %s with %j",packet.id,packet.data);ack.apply(this,packet.data);delete this.acks[packet.id]}else{debug("bad ack %s",packet.id)}};Socket.prototype.onconnect=function(){this.connected=true;this.disconnected=false;this.emit("connect");this.emitBuffered()};Socket.prototype.emitBuffered=function(){var i;for(i=0;i0&&opts.jitter<=1?opts.jitter:0;this.attempts=0}Backoff.prototype.duration=function(){var ms=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var rand=Math.random();var deviation=Math.floor(rand*this.jitter*ms);ms=(Math.floor(rand*10)&1)==0?ms-deviation:ms+deviation}return Math.min(ms,this.max)|0};Backoff.prototype.reset=function(){this.attempts=0};Backoff.prototype.setMin=function(min){this.ms=min};Backoff.prototype.setMax=function(max){this.max=max};Backoff.prototype.setJitter=function(jitter){this.jitter=jitter}},{}],37:[function(_dereq_,module,exports){var slice=[].slice;module.exports=function(obj,fn){if("string"==typeof fn)fn=obj[fn];if("function"!=typeof fn)throw new Error("bind() requires a function");var args=slice.call(arguments,2);return function(){return fn.apply(obj,args.concat(slice.call(arguments)))}}},{}],38:[function(_dereq_,module,exports){module.exports=Emitter;function Emitter(obj){if(obj)return mixin(obj)}function mixin(obj){for(var key in Emitter.prototype){obj[key]=Emitter.prototype[key]}return obj}Emitter.prototype.on=Emitter.prototype.addEventListener=function(event,fn){this._callbacks=this._callbacks||{};(this._callbacks["$"+event]=this._callbacks["$"+event]||[]).push(fn);return this};Emitter.prototype.once=function(event,fn){function on(){this.off(event,on);fn.apply(this,arguments)}on.fn=fn;this.on(event,on);return this};Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(event,fn){this._callbacks=this._callbacks||{};if(0==arguments.length){this._callbacks={};return this}var callbacks=this._callbacks["$"+event];if(!callbacks)return this;if(1==arguments.length){delete this._callbacks["$"+event];return this}var cb;for(var i=0;i1)))/4)-floor((year-1901+month)/100)+floor((year-1601+month)/400)}}if(!(isProperty=objectProto.hasOwnProperty)){isProperty=function(property){var members={},constructor;if((members.__proto__=null,members.__proto__={toString:1},members).toString!=getClass){isProperty=function(property){var original=this.__proto__,result=property in(this.__proto__=null,this);this.__proto__=original;return result}}else{constructor=members.constructor;isProperty=function(property){var parent=(this.constructor||constructor).prototype;return property in this&&!(property in parent&&this[property]===parent[property])}}members=null;return isProperty.call(this,property)}}forEach=function(object,callback){var size=0,Properties,members,property;(Properties=function(){this.valueOf=0}).prototype.valueOf=0;members=new Properties;for(property in members){if(isProperty.call(members,property)){size++}}Properties=members=null;if(!size){members=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"];forEach=function(object,callback){var isFunction=getClass.call(object)==functionClass,property,length;var hasProperty=!isFunction&&typeof object.constructor!="function"&&objectTypes[typeof object.hasOwnProperty]&&object.hasOwnProperty||isProperty;for(property in object){if(!(isFunction&&property=="prototype")&&hasProperty.call(object,property)){callback(property)}}for(length=members.length;property=members[--length];hasProperty.call(object,property)&&callback(property));}}else if(size==2){forEach=function(object,callback){var members={},isFunction=getClass.call(object)==functionClass,property;for(property in object){if(!(isFunction&&property=="prototype")&&!isProperty.call(members,property)&&(members[property]=1)&&isProperty.call(object,property)){callback(property)}}}}else{forEach=function(object,callback){var isFunction=getClass.call(object)==functionClass,property,isConstructor;for(property in object){if(!(isFunction&&property=="prototype")&&isProperty.call(object,property)&&!(isConstructor=property==="constructor")){callback(property)}}if(isConstructor||isProperty.call(object,property="constructor")){callback(property)}}}return forEach(object,callback)};if(!has("json-stringify")){var Escapes={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"};var leadingZeroes="000000";var toPaddedString=function(width,value){return(leadingZeroes+(value||0)).slice(-width)};var unicodePrefix="\\u00";var quote=function(value){var result='"',index=0,length=value.length,useCharIndex=!charIndexBuggy||length>10;var symbols=useCharIndex&&(charIndexBuggy?value.split(""):value);for(;index-1/0&&value<1/0){if(getDay){date=floor(value/864e5);for(year=floor(date/365.2425)+1970-1;getDay(year+1,0)<=date;year++);for(month=floor((date-getDay(year,0))/30.42);getDay(year,month+1)<=date;month++);date=1+date-getDay(year,month);time=(value%864e5+864e5)%864e5;hours=floor(time/36e5)%24;minutes=floor(time/6e4)%60;seconds=floor(time/1e3)%60;milliseconds=time%1e3}else{year=value.getUTCFullYear();month=value.getUTCMonth();date=value.getUTCDate();hours=value.getUTCHours();minutes=value.getUTCMinutes();seconds=value.getUTCSeconds();milliseconds=value.getUTCMilliseconds()}value=(year<=0||year>=1e4?(year<0?"-":"+")+toPaddedString(6,year<0?-year:year):toPaddedString(4,year))+"-"+toPaddedString(2,month+1)+"-"+toPaddedString(2,date)+"T"+toPaddedString(2,hours)+":"+toPaddedString(2,minutes)+":"+toPaddedString(2,seconds)+"."+toPaddedString(3,milliseconds)+"Z"}else{value=null}}else if(typeof value.toJSON=="function"&&(className!=numberClass&&className!=stringClass&&className!=arrayClass||isProperty.call(value,"toJSON"))){value=value.toJSON(property)}}if(callback){value=callback.call(object,property,value)}if(value===null){return"null"}className=getClass.call(value);if(className==booleanClass){return""+value}else if(className==numberClass){return value>-1/0&&value<1/0?""+value:"null"}else if(className==stringClass){return quote(""+value)}if(typeof value=="object"){for(length=stack.length;length--;){if(stack[length]===value){throw TypeError()}}stack.push(value);results=[];prefix=indentation;indentation+=whitespace;if(className==arrayClass){for(index=0,length=value.length;index0){for(whitespace="",width>10&&(width=10);whitespace.length=48&&charCode<=57||charCode>=97&&charCode<=102||charCode>=65&&charCode<=70)){abort()}}value+=fromCharCode("0x"+source.slice(begin,Index));break;default:abort()}}else{if(charCode==34){break}charCode=source.charCodeAt(Index);begin=Index;while(charCode>=32&&charCode!=92&&charCode!=34){charCode=source.charCodeAt(++Index)}value+=source.slice(begin,Index)}}if(source.charCodeAt(Index)==34){Index++;return value}abort();default:begin=Index;if(charCode==45){isSigned=true;charCode=source.charCodeAt(++Index)}if(charCode>=48&&charCode<=57){if(charCode==48&&(charCode=source.charCodeAt(Index+1),charCode>=48&&charCode<=57)){abort()}isSigned=false;for(;Index=48&&charCode<=57);Index++);if(source.charCodeAt(Index)==46){position=++Index;for(;position=48&&charCode<=57);position++);if(position==Index){abort()}Index=position}charCode=source.charCodeAt(Index);if(charCode==101||charCode==69){charCode=source.charCodeAt(++Index);if(charCode==43||charCode==45){Index++}for(position=Index;position=48&&charCode<=57);position++);if(position==Index){abort()}Index=position}return+source.slice(begin,Index)}if(isSigned){abort()}if(source.slice(Index,Index+4)=="true"){Index+=4;return true}else if(source.slice(Index,Index+5)=="false"){Index+=5;return false}else if(source.slice(Index,Index+4)=="null"){Index+=4;return null}abort()}}return"$"};var get=function(value){var results,hasMembers;if(value=="$"){abort()}if(typeof value=="string"){if((charIndexBuggy?value.charAt(0):value[0])=="@"){return value.slice(1)}if(value=="["){results=[];for(;;hasMembers||(hasMembers=true)){value=lex();if(value=="]"){break}if(hasMembers){if(value==","){value=lex();if(value=="]"){abort()}}else{abort()}}if(value==","){abort()}results.push(get(value))}return results}else if(value=="{"){results={};for(;;hasMembers||(hasMembers=true)){value=lex();if(value=="}"){break}if(hasMembers){if(value==","){value=lex();if(value=="}"){abort()}}else{abort()}}if(value==","||typeof value!="string"||(charIndexBuggy?value.charAt(0):value[0])!="@"||lex()!=":"){abort()}results[value.slice(1)]=get(lex()) +}return results}abort()}return value};var update=function(source,property,callback){var element=walk(source,property,callback);if(element===undef){delete source[property]}else{source[property]=element}};var walk=function(source,property,callback){var value=source[property],length;if(typeof value=="object"&&value){if(getClass.call(value)==arrayClass){for(length=value.length;length--;){update(value,length,callback)}}else{forEach(value,function(property){update(value,property,callback)})}}return callback.call(source,property,value)};exports.parse=function(source,callback){var result,value;Index=0;Source=""+source;result=get(lex());if(lex()!="$"){abort()}Index=Source=null;return callback&&getClass.call(callback)==functionClass?walk((value={},value[""]=result,value),"",callback):result}}}exports["runInContext"]=runInContext;return exports}if(freeExports&&!isLoader){runInContext(root,freeExports)}else{var nativeJSON=root.JSON,previousJSON=root["JSON3"],isRestored=false;var JSON3=runInContext(root,root["JSON3"]={noConflict:function(){if(!isRestored){isRestored=true;root.JSON=nativeJSON;root["JSON3"]=previousJSON;nativeJSON=previousJSON=null}return JSON3}});root.JSON={parse:JSON3.parse,stringify:JSON3.stringify}}if(isLoader){define(function(){return JSON3})}}).call(this)}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:typeof global!=="undefined"?global:{})},{}],51:[function(_dereq_,module,exports){module.exports=toArray;function toArray(list,index){var array=[];index=index||0;for(var i=index||0;i { order(:created_at).limit(50)} +end diff --git a/app/models/user.rb b/app/models/user.rb index ed6bd87..3797e55 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -11,6 +11,9 @@ class User < ApplicationRecord has_many :posts, dependent: :delete_all has_many :comments, dependent: :delete_all + validates :username, presence: true, uniqueness: true + has_many :messages + attr_accessor :login validates :username, diff --git a/app/models/wall.rb b/app/models/wall.rb index ea7d11b..dc5d846 100644 --- a/app/models/wall.rb +++ b/app/models/wall.rb @@ -2,6 +2,7 @@ class Wall < ApplicationRecord has_many :post has_many :users has_many :comments + has_many :messages, dependent: :destroy delegate :username, :username=,:avatar, :avatar=, :email, :email=, :to => :user, allow_nil: true devise :database_authenticatable, :registerable, diff --git a/app/uploaders/avatar_uploader.rb b/app/uploaders/avatar_uploader.rb index fe3bcae..2f51dec 100644 --- a/app/uploaders/avatar_uploader.rb +++ b/app/uploaders/avatar_uploader.rb @@ -23,7 +23,7 @@ def store_dir end def default_url - ActionController::Base.helpers.asset_path([version_name, "empty.jpg"].compact.join('_')) + ActionController::Base.helpers.asset_path("fallback/" + [version_name, "empty.jpg"].compact.join('_')) end version :slider do diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 3830418..cea99c3 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -10,6 +10,9 @@ <%= render partial: "shared/navbar" %> + + + <% if notice %>

<%= notice %>

<% end %> diff --git a/app/views/messages/_message.html.erb b/app/views/messages/_message.html.erb new file mode 100644 index 0000000..2e2cdc5 --- /dev/null +++ b/app/views/messages/_message.html.erb @@ -0,0 +1,8 @@ +
+
+ <%= message.user.username %>: +
+
+ <%= message.content %> +
+
diff --git a/app/views/messages/_messages.html.erb b/app/views/messages/_messages.html.erb new file mode 100644 index 0000000..62dbcf8 --- /dev/null +++ b/app/views/messages/_messages.html.erb @@ -0,0 +1,7 @@ +
+
+ <% if @messages.any? %> + <%= render @messages %> + <% end %> +
+
diff --git a/app/views/messages/_messages_form.html.erb b/app/views/messages/_messages_form.html.erb new file mode 100644 index 0000000..8a4e4ff --- /dev/null +++ b/app/views/messages/_messages_form.html.erb @@ -0,0 +1,6 @@ +
+ <%= form_for(@message) do |f| %> + <%= f.text_area :content %> + <%= f.submit "Send" %> + <% end %> +
diff --git a/app/views/messages/index.html.erb b/app/views/messages/index.html.erb new file mode 100644 index 0000000..3d286d9 --- /dev/null +++ b/app/views/messages/index.html.erb @@ -0,0 +1,4 @@ +
+ <%= render 'messages' %> + <%= render 'message_form' %> +
diff --git a/app/views/posts/_form.html.erb b/app/views/posts/_form.html.erb index 8c3ca8d..f1b87d3 100644 --- a/app/views/posts/_form.html.erb +++ b/app/views/posts/_form.html.erb @@ -19,7 +19,11 @@
+ <% if @post.avatar.present? %> <%= image_tag current_user.avatar.mini %> + <% else %> + <%= image_tag current_user.avatar %> + <% end %>
<%= f.text_area :content, placeholder: "What are you doing right now?" %> diff --git a/app/views/shared/_chatbar.html.erb b/app/views/shared/_chatbar.html.erb new file mode 100644 index 0000000..f58a433 --- /dev/null +++ b/app/views/shared/_chatbar.html.erb @@ -0,0 +1,5 @@ +
+ +

Chat here

+ +
diff --git a/app/views/shared/_navbar.html.erb b/app/views/shared/_navbar.html.erb index 7d9a6c4..3680303 100644 --- a/app/views/shared/_navbar.html.erb +++ b/app/views/shared/_navbar.html.erb @@ -10,7 +10,11 @@ <%= link_to current_user do %> <% if user_signed_in? %> - <%= image_tag (current_user.avatar.mini) %> + <% if current_user.avatar.present? %> + <%= image_tag current_user.avatar.mini %> + <% else %> + <%= image_tag current_user.avatar %> + <% end %> <%= current_user.username %> <% else %> diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb index 6dccb75..5c09cca 100644 --- a/app/views/users/_form.html.erb +++ b/app/views/users/_form.html.erb @@ -1,4 +1,4 @@ -
+
<%= form_for @user ,html: { multipart: true } do |f| %> <% if @user.errors.any? %>
diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index 61241b9..6583f1d 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -1 +1,43 @@ -

Users

+
+ +

<%= notice %>

+

Listing Users

+ + + + + + + + + + + + + +<% if user_signed_in? && current_user.admin %> + <% @users.each do |user| %> + + + + + <% if user.admin? %> + + <% else %> + + <% end %> + + + + + + <% end %> +<% end %> + +
#First nameLast nameAdminEmailShow userEdit userDestroy user
<%= user.id %><%= user.first_name %><%= user.last_name %>YesNo<%= user.email %><%= link_to 'Show', user %><%= link_to 'Edit', edit_user_path(user) %><%= link_to 'Destroy', user, method: :delete, data: { confirm: 'Are you sure?' } %>
+<% if signed_in? && current_user.admin? %> +
+ <%= link_to 'New User', new_user_path, class: "btn btn-default" %> +
+<% end %> +
diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index c45f934..d97f6bc 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -2,7 +2,11 @@
- <%= image_tag (@user.avatar.avatar) %> + <% if @user.avatar.present? %> + <%= image_tag (@user.avatar.avatar) %> + <% else %> + <%= image_tag (@user.avatar) %> + <% end %>
diff --git a/app/views/walls/index.html.erb b/app/views/walls/index.html.erb index d025824..4e25d3a 100644 --- a/app/views/walls/index.html.erb +++ b/app/views/walls/index.html.erb @@ -1,7 +1,7 @@
- <%= render "posts/form" %> + <%= render "posts/form" %> <% @posts.each do |post| %>