Compare commits

...

69 Commits
test ... master

Author SHA1 Message Date
lovelyzhang 90385bafcf zy:add document 2017-01-14 18:44:56 +08:00
lovelyzhang 6904dce21e zy: finish 2017-01-14 16:24:53 +08:00
lovelyzhang dc6569c4dd zy: activity show people name 2017-01-14 16:23:53 +08:00
lovelyzhang 790ac40def zy:check for finish 2017-01-14 16:13:23 +08:00
lovelyzhang 49138c748b zy:add sendgird send mail 2017-01-14 15:43:34 +08:00
lovelyzhang 9dad27c6da zy:view routes profile 2017-01-07 12:33:43 +08:00
lovelyzhang c29cd77767 zy: fix add user chat bug 2017-01-07 11:18:42 +08:00
lovelyzhang a4b1ac9448 zy: fix micro_post view activity view bug 2017-01-06 21:15:51 +08:00
lovelyzhang 45c05a4881 zy: fix micro_post view activity view bug 2017-01-06 21:13:28 +08:00
lovelyzhang b601bcf6f1 zy: fix micro_post comments bugs 2017-01-06 21:09:03 +08:00
lovelyzhang 143e384838 zy:change gitignore 2017-01-05 22:15:34 +08:00
lovelyzhang 9bf238a96e merge mail 2017-01-05 22:13:58 +08:00
lovelyzhang d20cb8ec83 zy: add mail send code to change password 2017-01-05 22:07:22 +08:00
lovelyzhang 1746c9dde7 zy:test pic 2017-01-02 23:31:07 +08:00
lovelyzhang 92821cfd87 zy: add verify code 2017-01-02 22:57:19 +08:00
lovelyzhang 2c21dc9142 zy:reset db 2016-12-27 22:39:43 +08:00
lovelyzhang b18ed5c4e0 zy:fix joinactivity 2016-12-27 22:33:37 +08:00
lovelyzhang 40f8bfc049 zy: user only comments and activity finished 2016-12-27 22:21:50 +08:00
lovelyzhang face9b417f zy: delete post 2016-12-27 17:45:57 +08:00
lovelyzhang af26c41a7d zy:modify activity signup and quit 2016-12-27 16:49:34 +08:00
lovelyzhang 4a24c82a0e zy: db migrate 2016-12-27 11:53:07 +08:00
lovelyzhang 11410f9b86 zy: add new column to micro_posts 2016-12-27 11:51:36 +08:00
lovelyzhang b42036399e zy:modify time zone 2016-12-27 11:24:34 +08:00
lovelyzhang 910246f78d zy: new dev feacture 2016-12-27 11:09:27 +08:00
lovelyzhang 25c738414d zy:rm .idead/ sqlite3 2016-12-27 10:54:31 +08:00
lovelyzhang 962900f274 zy:timestamp for pic 2016-12-27 10:46:28 +08:00
lovelyzhang 0b5691a99b zy: change todolist 2016-12-27 10:24:57 +08:00
lovelyzhang 701a151602 Merge branch 'dev' of https://git.trustie.net/zhujingqiao/guoren into dev 2016-12-26 16:33:10 +08:00
lovelyzhang d35c37f7dd zy:modify gitignore 2016-12-26 16:32:37 +08:00
lovelyzhang 5d2d576cdf zy: change gemfile to delete bcrypt-ruby 2016-12-26 16:25:00 +08:00
lovelyzhang 52d6b1bf8f zy heroku deploy 2016-12-26 16:08:03 +08:00
lovelyzhang 0c0f725ec6 zy: heroku deploy 2016-12-26 15:57:40 +08:00
lovelyzhang 9b4215db04 zy: deploy to heroku 2016-12-26 15:55:36 +08:00
lovelyzhang a18ac0c3d8 Merge branch 'dev' of https://git.trustie.net/zhujingqiao/guoren into dev 2016-12-26 15:36:05 +08:00
lovelyzhang b8a5cea995 paginate finished 2016-12-26 15:36:00 +08:00
BaiFangzhou 98ee5aea5a bfz:Secondtest 2016-12-26 06:46:43 +00:00
lovelyzhang a7cae21e7c zy:tolist changed. 2016-12-26 14:40:34 +08:00
lovelyzhang b599305816 zy: modify gitignore 2016-12-26 14:26:42 +08:00
lovelyzhang 80a4d13dbb zy add picture function 2016-12-26 14:24:20 +08:00
lovelyzhang 7e0c882bb7 zy: rectify user_helper 2016-12-26 11:03:30 +08:00
lovelyzhang 3fe03812e9 zy: change utc time 2016-12-26 11:00:51 +08:00
lovelyzhang dcdd5a225a zy:start upload file 2016-12-25 22:18:43 +08:00
lovelyzhang c0ba62107f zy: sign up activity 2016-12-25 19:33:15 +08:00
lovelyzhang 79a3b58382 zy: add gitingore 2016-12-25 18:04:20 +08:00
lovelyzhang ac33a06e92 zy:fix merge 2016-12-25 18:01:31 +08:00
lovelyzhang 19fc06d990 zy:delete .idea 2016-12-25 17:57:05 +08:00
lovelyzhang 38c737b360 zy: modify gitingore file 2016-12-25 17:45:46 +08:00
yjx 2a644cb60b yjx:add profil path 2016-12-25 16:44:43 +08:00
yjx c317cfa851 yjx:test 2016-12-25 16:38:07 +08:00
lovelyzhang be63444463 Merge branch 'dev' of https://git.trustie.net/zhujingqiao/guoren into dev 2016-12-25 15:10:13 +08:00
lovelyzhang e934a901ee zjq:modify mutipy picture 2016-12-25 15:10:05 +08:00
lovelyzhang 775a8b2f6f zy: to zjq to modify multi-picture 2016-12-25 14:50:37 +08:00
BaiFangzhou 91357e6026 bfz:Fisttest 2016-12-25 06:49:04 +00:00
lovelyzhang 3da3d00232 zy:add TODO List 2016-12-25 14:18:04 +08:00
lovelyzhang 346ddd1e06 zy:add gitignore 2016-12-25 14:10:11 +08:00
lovelyzhang 759bd82ad7 zy:add profile page for yjx 2016-12-25 14:03:11 +08:00
lovelyzhang 3416ad6bb6 zy:add test case 2016-12-25 14:02:06 +08:00
lovelyzhang df353360f5 zy:add profile page 2016-12-25 13:59:01 +08:00
lovelyzhang 6c7c4483f0 bfz:add a test case 2016-12-25 13:47:43 +08:00
lovelyzhang 6fc7ec9d88 fix comments bugs and modify some style css 2016-12-22 23:23:22 +08:00
lovelyzhang ff5f2f6ea3 git rm test.txt 2016-12-22 22:04:09 +08:00
lovelyzhang 2a0f6ec167 delete test.txt 2016-12-22 22:00:20 +08:00
Lieber2016 5241346ad5 nilingbin test 2016-12-22 13:22:05 +00:00
lovelyzhang c5cbe7128f push to heroku: 2016-12-22 20:10:31 +08:00
lovelyzhang 9a221afbb0 new project 2016-12-22 20:05:38 +08:00
lovelyzhang a7c044c53c new guoren project 2016-12-22 20:00:08 +08:00
lovelyzhang bf07e74ece test.txt 2016-12-22 19:58:26 +08:00
lovelyzhang 402725a795 delete all files 2016-12-22 19:56:55 +08:00
joe 2428b90a23 Merge branch 'test' into 'master'
合并测试分支



See merge request !1
2016-12-18 13:05:59 +08:00
320 changed files with 2605 additions and 2520 deletions

109
.gitignore vendored Normal file
View File

@ -0,0 +1,109 @@
# Ruby的忽略文件
*.gem
*.rbc
/.config
/coverage/
/InstalledFiles
/pkg/
/spec/reports/
/spec/examples.txt
/test/tmp/
/test/version_tmp/
/tmp/
# Used by dotenv library to load environment variables.
# .env
## Specific to RubyMotion:
.dat*
.repl_history
build/
*.bridgesupport
build-iPhoneOS/
build-iPhoneSimulator/
## Specific to RubyMotion (use of CocoaPods):
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# vendor/Pods/
## Documentation cache and generated files:
/.yardoc/
/_yardoc/
/doc/
/rdoc/
## Environment normalization:
/.bundle/
/vendor/bundle
/lib/bundler/man/
# for a library or gem, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# Gemfile.lock
# .ruby-version
# .ruby-gemset
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc
# JetBrain的忽略文件
.idea/*
public/data/*
public/userpics/*
# rails的忽略文件
*.rbc
capybara-*.html
.rspec
/log/*
/tmp/*
/public/system
/coverage/
/spec/tmp
**.orig
rerun.txt
pickle-email-*.html
# TODO Comment out this rule if you are OK with secrets being uploaded to the repo
config/initializers/secret_token.rb
# Only include if you have production secrets in this file, which is no longer a Rails default
# config/secrets.yml
# dotenv
# TODO Comment out this rule if environment variables can be committed
.env
## Environment normalization:
/.bundle
/vendor/bundle
# these should all be checked in to normalize the environment:
# Gemfile.lock, .ruby-version, .ruby-gemset
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc
# if using bower-rails ignore default bower_components path bower.json files
/vendor/assets/bower_components
*.bowerrc
bower.json
# Ignore pow environment settings
.powenv
# Ignore Byebug command history file.
.byebug_history
db/*.sqlite3
logs.txt

35
AllTestCase/testcase1.txt Normal file
View File

@ -0,0 +1,35 @@
1.登录
是否只输入用户名不输入密码就可以直接登录。
2.内容更新
发表的状态、组团信息以及评论私信等是否在发表后就得以显示并按时间顺序显示。
3.用户名查找
当用户更改用户名之后是否还可以通过原用户名来查找到该用户。
4.用户交流
用户之间的评论私信会与用户对应,是否会出现信息混淆的现象。是否会不能评论或不能发私信。
5.报名信息
组团活动报名,失物招领领取是否会随着有人报名而及时更新,发布人是否也可以看到这些信息。
6.评论以及动态发送
输入评论后是否按回车可以直接发送,输入空白的是否会发送?
是否输入空白依然可以发送我的动态?
7.图片上传
正常的图片上传后是否会模糊
图片所能使用的格式
图片上传后是否会出现断裂、压缩、丢失,或无法显示。
8.删除
所发表的内容、评论以及私信,在删除后是否会彻底消失,还是依然存在。
9.文字显示
发表的内容文字过多时,是否会排版错误,显示错误。
10.文本字符
字符判断,手机号只能输入数字。
11.翻页
翻页时,没有加载数据为空,第二页数据没有请求
翻页时,一直重复请求第一页的数据
翻页时,没有图片的内容有时候会引用有图片的内容
12.截止时间
组团活动超过截止时间之后,是否会显示停止报名。
13.个人资料
用户修改个人资料后资料是否进行保存,头像是否有变化。
14.导航功能
界面的各导航模块可以实现正确的导航,是否会出现导航错乱的现象。
15.退出
用户点击退出之后,是否会退出当前帐号,并回到登陆界面重新进行登录。

View File

@ -1,11 +1,9 @@
source 'https://rubygems.org'
gem 'rake'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
@ -27,11 +25,15 @@ gem 'jbuilder', '~> 2.5'
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'
# will_paginate
gem 'will_paginate', '~> 3.1.0'
gem 'sendgrid-ruby'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
gem 'sqlite3'
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platform: :mri
end
@ -45,5 +47,9 @@ group :development do
gem 'spring-watcher-listen', '~> 2.0.0'
end
group :production do
gem 'pg'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

View File

@ -40,6 +40,7 @@ GEM
tzinfo (~> 1.1)
arel (7.1.4)
bcrypt (3.1.11)
bcrypt (3.1.11-x64-mingw32)
builder (3.2.2)
byebug (9.0.6)
coffee-rails (4.2.1)
@ -54,6 +55,7 @@ GEM
erubis (2.7.0)
execjs (2.7.0)
ffi (1.9.14)
ffi (1.9.14-x64-mingw32)
globalid (0.3.7)
activesupport (>= 4.1.0)
i18n (0.7.0)
@ -81,6 +83,10 @@ GEM
nio4r (1.2.1)
nokogiri (1.6.8.1)
mini_portile2 (~> 2.1.0)
nokogiri (1.6.8.1-x64-mingw32)
mini_portile2 (~> 2.1.0)
pg (0.19.0)
pg (0.19.0-x64-mingw32)
puma (3.6.2)
rack (2.0.1)
rack-test (0.6.3)
@ -112,6 +118,7 @@ GEM
rb-fsevent (0.9.8)
rb-inotify (0.9.7)
ffi (>= 0.5.0)
ruby_http_client (3.0.0)
sass (3.4.22)
sass-rails (5.0.6)
railties (>= 4.0.0, < 6)
@ -119,6 +126,8 @@ GEM
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
sendgrid-ruby (4.0.6)
ruby_http_client (~> 3.0.0)
spring (2.0.0)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
@ -132,6 +141,7 @@ GEM
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.12)
sqlite3 (1.3.12-x64-mingw32)
thor (0.19.1)
thread_safe (0.3.5)
tilt (2.0.5)
@ -140,6 +150,8 @@ GEM
turbolinks-source (5.0.0)
tzinfo (1.2.2)
thread_safe (~> 0.1)
tzinfo-data (1.2016.10)
tzinfo (>= 1.0.0)
uglifier (3.0.3)
execjs (>= 0.3.0, < 3)
web-console (3.4.0)
@ -150,9 +162,11 @@ GEM
websocket-driver (0.6.4)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
will_paginate (3.1.5)
PLATFORMS
ruby
x64-mingw32
DEPENDENCIES
bcrypt (~> 3.1.7)
@ -161,9 +175,12 @@ DEPENDENCIES
jbuilder (~> 2.5)
jquery-rails
listen (~> 3.0.5)
pg
puma (~> 3.0)
rails (~> 5.0.0, >= 5.0.0.1)
rake
sass-rails (~> 5.0)
sendgrid-ruby
spring
spring-watcher-listen (~> 2.0.0)
sqlite3
@ -171,6 +188,7 @@ DEPENDENCIES
tzinfo-data
uglifier (>= 1.3.0)
web-console
will_paginate (~> 3.1.0)
BUNDLED WITH
1.12.5
1.13.6

178
Gemfile.lock.bak Normal file
View File

@ -0,0 +1,178 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (5.0.0.1)
actionpack (= 5.0.0.1)
nio4r (~> 1.2)
websocket-driver (~> 0.6.1)
actionmailer (5.0.0.1)
actionpack (= 5.0.0.1)
actionview (= 5.0.0.1)
activejob (= 5.0.0.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.0.0.1)
actionview (= 5.0.0.1)
activesupport (= 5.0.0.1)
rack (~> 2.0)
rack-test (~> 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.0.0.1)
activesupport (= 5.0.0.1)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
activejob (5.0.0.1)
activesupport (= 5.0.0.1)
globalid (>= 0.3.6)
activemodel (5.0.0.1)
activesupport (= 5.0.0.1)
activerecord (5.0.0.1)
activemodel (= 5.0.0.1)
activesupport (= 5.0.0.1)
arel (~> 7.0)
activesupport (5.0.0.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
tzinfo (~> 1.1)
arel (7.1.4)
bcrypt (3.1.11)
builder (3.2.2)
byebug (9.0.6)
coffee-rails (4.2.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.2.x)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.11.1)
concurrent-ruby (1.0.2)
debug_inspector (0.0.2)
erubis (2.7.0)
execjs (2.7.0)
ffi (1.9.14)
globalid (0.3.7)
activesupport (>= 4.1.0)
i18n (0.7.0)
jbuilder (2.6.0)
activesupport (>= 3.0.0, < 5.1)
multi_json (~> 1.2)
jquery-rails (4.2.1)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
loofah (2.0.3)
nokogiri (>= 1.5.9)
mail (2.6.4)
mime-types (>= 1.16, < 4)
method_source (0.8.2)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_portile2 (2.1.0)
minitest (5.9.1)
multi_json (1.12.1)
nio4r (1.2.1)
nokogiri (1.6.8.1)
mini_portile2 (~> 2.1.0)
pg (0.18.4)
puma (3.6.2)
rack (2.0.1)
rack-test (0.6.3)
rack (>= 1.0)
rails (5.0.0.1)
actioncable (= 5.0.0.1)
actionmailer (= 5.0.0.1)
actionpack (= 5.0.0.1)
actionview (= 5.0.0.1)
activejob (= 5.0.0.1)
activemodel (= 5.0.0.1)
activerecord (= 5.0.0.1)
activesupport (= 5.0.0.1)
bundler (>= 1.3.0, < 2.0)
railties (= 5.0.0.1)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.1)
activesupport (>= 4.2.0, < 6.0)
nokogiri (~> 1.6.0)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
railties (5.0.0.1)
actionpack (= 5.0.0.1)
activesupport (= 5.0.0.1)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (11.3.0)
rb-fsevent (0.9.8)
rb-inotify (0.9.7)
ffi (>= 0.5.0)
sass (3.4.22)
sass-rails (5.0.6)
railties (>= 4.0.0, < 6)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
spring (2.0.0)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)
sprockets (3.7.0)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.0)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.12)
thor (0.19.1)
thread_safe (0.3.5)
tilt (2.0.5)
turbolinks (5.0.1)
turbolinks-source (~> 5)
turbolinks-source (5.0.0)
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (3.0.3)
execjs (>= 0.3.0, < 3)
web-console (3.4.0)
actionview (>= 5.0)
activemodel (>= 5.0)
debug_inspector
railties (>= 5.0)
websocket-driver (0.6.4)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
PLATFORMS
ruby
DEPENDENCIES
bcrypt (~> 3.1.7)
byebug
coffee-rails (~> 4.2)
jbuilder (~> 2.5)
jquery-rails
listen (~> 3.0.5)
pg (~> 0.18.4)
puma (~> 3.0)
rails (~> 5.0.0, >= 5.0.0.1)
sass-rails (~> 5.0)
spring
spring-watcher-listen (~> 2.0.0)
sqlite3
turbolinks (~> 5)
tzinfo-data
uglifier (>= 1.3.0)
web-console
BUNDLED WITH
1.13.6

View File

@ -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/

View File

@ -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/

View File

@ -0,0 +1,3 @@
// Place all the styles related to the Comments controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@ -0,0 +1,3 @@
// Place all the styles related to the MicroPosts controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@ -1,5 +1,7 @@
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
include ApplicationHelper
include LoginHelper
include UsersHelper

View File

@ -0,0 +1,100 @@
class ChatController < ApplicationController
before_action :logged_in_user
include ChatHelper
def index
@user = current_user
@current_chat_user_name = params[:chat_with]
@chat_with_users = get_chat_with_users(@user)
if !@current_chat_user_name.nil?
@current_chat_user = User.find_by(name: @current_chat_user_name)
if !@current_chat_user_name.nil?
messages = process_messages(@user, @current_chat_user)
render json: messages
end
end
end
def new
# 用户发送新的消息
@user = current_user
username = @user.name
userpic = @user.picurl
msg = params[:msg]
current_chat_user_name = params[:chat_with]
current_chat_user = User.find_by(name: current_chat_user_name)
save_time = DateTime.now
msg_db = Message.new(content: msg, send_user: @user.id, recieve_user: current_chat_user.id,
create_time: save_time, readed: false)
if msg_db.save
render json: {username: username, userpic: userpic, content: msg, time: get_strftime(save_time)}
else
render json: {username: username, userpic: userpic, content: "error", time: get_strftime(save_time)}
end
end
def notify
# 获取未读短信数
@user = current_user
render json: {unreaded: unread_msg_num(@user)}
end
def online
# # 获取未读短信和对对应的联系人
@user = current_user
results = unread_msg_users(@user)
if results.empty?
results = nil
end
render json: {users: results}
end
def query
# 添加新的联系人
@user = current_user
query_name = params[:username]
all_user_names = params[:all]
query_pic = String.new()
if all_user_names.nil?
query_user = User.find_by(name: query_name)
if query_user.nil?
query_name = nil
ok = false
else
if query_name == @user.name
query_name = nil
ok = false
else
query_name = query_user.name
query_pic = query_user.picurl
ok = true
end
end
else
if all_user_names.include? query_name or query_name == @user.name
query_name = nil
ok = false
else
query_user = User.find_by(name: query_name)
if query_user.nil?
query_name = nil
ok = false
else
query_name = query_user.name
query_pic = query_user.picurl
ok = true
end
end
end
render json: {username: query_name, userpic: query_pic, ok: ok}
end
end

View File

@ -0,0 +1,23 @@
class CommentsController < ApplicationController
include CommentsHelper
def get
micropost_id = params["micropost_id"]
micropost_comments = get_micropost_comments micropost_id
render json: {comments: micropost_comments}
end
def new
@user = current_user
username = @user.name
userpic = @user.picurl
content = params[:content].to_s
micropost_id = params[:micropost_id]
if !content.empty? and !micropost_id.nil?
comments = @user.comments.new(content: content, micro_post_id: micropost_id, comment_time: DateTime.now)
comments.save
end
render json: {username: username, userpic: userpic}
end
end

View File

@ -0,0 +1,38 @@
class MainController < ApplicationController
include MainHelper
before_action :logged_in_user
def show
@user = current_user
page_num = params[:page]
post_type = params[:type]
if !page_num
page_num = 1
end
if !post_type
post_type=[1, 2, 3]
end
@posts = MicroPost.where(post_type: post_type).paginate(:page => page_num, :per_page => 10).order(post_time: :desc)
@micro_posts_array = get_post(@posts)
render 'main'
end
def activity
@user = current_user
micro_post_id = params[:micropost_id]
join = params[:join].to_s
if join == "true"
num, names = new_engaged_people(micro_post_id, current_user.name)
else
num, names = delete_engaged_people(micro_post_id, current_user.name)
end
render json: {total_num: num, total_names: names}
end
end

View File

@ -0,0 +1,49 @@
class MicroPostsController < ApplicationController
include MicroPostsHelper
before_action :logged_in_user
def show
@user = current_user
@micro_posts = read_each_post @user
end
def new
@user = current_user
post_type = params[:post_type].to_i
title = params[:title].to_s
content = params[:content].to_s
pictures = params[:pictures]
if pictures
pic_path = Array.new
pictures.each do |pic|
savename = savePicture(pic)
pic_path << savename
end
pic_path = pic_path.join(',')
end
if post_type >= 1 and post_type <= 3 and !title.empty? and !content.empty?
micropost = @user.micro_posts.new(title: title, content: content, pic: pic_path,
post_time: DateTime.now, post_type: post_type,
engage_people: 1, engaged_people_names: current_user.name)
micropost.save
end
redirect_to microposts_path
end
def delete
@user = current_user
micropost_id = params[:micropost_id].to_i
micropost_id = @user.micro_posts.find_by(id: micropost_id)
if micropost_id
micropost_id.destroy
render json: {status:true}
else
render json: {status:false}
end
end
end

View File

@ -0,0 +1,148 @@
class UsersController < ApplicationController
before_action :logged_in_user,except: [:new,:create,:forgetpasswd,:changepasswd]
@@user_pics_dir = "public/userpics"
def new
@user = User.new
end
def create
@user = User.new(user_params)
if @user.save
log_in @user
redirect_to main_path
else
render 'new'
end
end
def edit
@user = current_user
render 'edit'
end
def update
end
def forgetpasswd
useremail = params[:email]
if useremail
@user = User.find_by(email: useremail)
if !@user.nil?
send_code @user
flash[:success] = "验证码已发送至您的邮箱"
redirect_to changepasswd_path(email: @user.email)
else
flash[:danger] = "用户不存在"
render 'forgetpasswd'
end
else
render 'forgetpasswd'
end
end
def changepasswd
if request.get?
user_email = params[:email]
if user_email
@user = User.find_by(email: user_email)
if !@user.nil?
render 'changepasswd'
else
flash[:danger] = "用户不存在"
redirect_to login_path
end
else
redirect_to login_path
end
else
result = check_change_params(params[:email], params[:verify_code], params[:password], params[:password_confirm])
if result
flash[:success]="密码更新成功"
else
flash[:danger]="密码更新失败"
end
redirect_to login_path
end
end
def changeprofile
@user = current_user
result, user, err_string = check_change_profile_params(params[:user])
if result == false
flash[:danger] = err_string
else
pic_url = save_user_pic params[:user][:pic]
if pic_url.nil? == false
user[:picurl] = pic_url
end
@user.update_attributes(user)
end
redirect_to profile_path
end
private
def user_params
params.require(:user).permit(:name, :email, :password,
:password_confirmation)
end
def check_change_profile_params user_params
if user_params.nil?
return false, nil, "修改参数为空"
end
if user_params[:username].length <= 0
return false, nil, "姓名错误"
end
user = Hash.new
user[:name] = user_params[:username]
user[:profession] = user_params[:profession]
user[:sexual] = user_params[:sexual]
return true, user, nil
end
def save_user_pic pic
if pic.nil?
return nil
end
if !(File.directory? @@user_pics_dir)
FileUtils.mkdir_p(@@user_pics_dir)
end
ext = File.extname(pic.original_filename)
timestamp = Time.now.to_s
picname = Digest::MD5::hexdigest(pic.original_filename + timestamp) + ext
File.open(File.join(@@user_pics_dir, picname), 'wb') { |f| f.write(pic.read) }
save_name = File.join("userpics", picname)
return save_name
end
def send_code user
verify_code = rand(999999).to_s
result = UserMailer.send_verify_code(user.email, verify_code).deliver_now
p result
user.update_attribute(:verify_code, verify_code)
end
def check_change_params(email, verify_code, password, password_confirmation)
if password != password_confirmation
return false
end
user = User.find_by(email: email)
if user.nil?
return false
end
if user.verify_code != verify_code
return false
end
hold = Hash.new
hold[:password] = password
hold[:password_confirmation] = password_confirmation
user.update_attributes(hold)
return true
end
end

View File

@ -0,0 +1,9 @@
module ApplicationHelper
def get_strftime intime
# 将数据库中的UTC时间转换为本地时间
return intime.utc.in_time_zone('Beijing').strftime(format='%F %T')
end
end

View File

@ -2,6 +2,7 @@ module ChatHelper
def get_chat_with_users user
# 获得与当前用户有聊天记录的用户
chat_with_users = {}
user.recieve_messages.where(readed: true).select(:send_user).distinct.each do |chat|
@ -30,19 +31,24 @@ module ChatHelper
end
def process_messages(user, chat_with)
# 处理用户对话(消息)
results = []
Message.transaction do
messages = Message.lock.where(send_user: [user.id, chat_with.id],
recieve_user: [user.id, chat_with.id]).order(create_time: :asc)
if !messages.empty?
recieve_user: [user.id, chat_with.id])
if messages.length >= 1
messages = messages.order(create_time: :asc)
messages.each do |message|
if message.send_user == user.id
x = {issend: true, send: user.name, recieve: chat_with.name, content: message.content, time: message.create_time}
x = {issend: true, name: user.name, userpic: user.picurl,
content: message.content, time: get_strftime(message.create_time)}
else
message.readed = true
message.save
x = {issend: false, send: chat_with.name, recieve: user.name, content: message.content, time: message.create_time}
x = {issend: false, name: chat_with.name, userpic: chat_with.picurl,
content: message.content, time: get_strftime(message.create_time)}
end
results << x
end
@ -52,21 +58,15 @@ module ChatHelper
end
def unread_msg_num user
# 未读消息数目
user.recieve_messages.where(readed: false).count
end
def unread_msg_users user
# unreaded_lists = []
# unreaded_users = user.recieve_messages.where(readed: false).select(:send_user).distinct
# if !unreaded_users.empty?
# unreaded_users do |unreaded_id|
# unreaded_lists << User.find(unreaded_id).id
# end
# end
# unreaded_lists
# 未读消息的用户
return_user_msg = {}
results = user.recieve_messages.where(readed: false)
if results.count != 0
if results.length != 0
results.each do |result|
username = User.find(result.send_user).name
return_user_msg[username] = [];

View File

@ -0,0 +1,18 @@
module CommentsHelper
def get_micropost_comments micropost_id
comments_array = Array.new()
micropost = MicroPost.find_by(id: micropost_id)
comments = micropost.comments.order(comment_time: :desc)
if !comments.empty?
comments.each do |com|
temp = Hash.new()
temp["username"] = com.user.name
temp["userpic"] = com.user.picurl
temp["content"] = com.content
comments_array << temp
end
end
return comments_array
end
end

View File

@ -0,0 +1,97 @@
module MainHelper
def get_post posts
micro_posts_array = []
if !posts.empty?
posts.each do |micro_post|
x = Hash.new()
x["username"] = micro_post.user.name
x["userpic"] = micro_post.user.picurl
x["postid"] = micro_post.id
x["title"] = micro_post.title
x["content"] = micro_post.content
case micro_post.post_type
when 1
x["type"] = "新鲜事"
when 2
x["type"] = "组团信息"
when 3
x["type"] = "失物招领"
else
x["type"] = "新鲜事"
end
x["time"] = get_strftime(micro_post.post_time)
x["pics"] = micro_post.pic.split(',') if micro_post.pic
x["peo_num"] = micro_post.engage_people
micro_posts_array << x
end
end
return micro_posts_array
end
def get_engaged_people micropost_id
# 获得参加活动的人数和姓名
MicroPost.transaction do
micropost = MicroPost.lock.find_by(id: micropost_id)
engage_people = micropost.engage_people
engage_people_name = micropost.engaged_people_names
return engage_people, engage_people_name
end
end
def save_engaged_people(micropost_id, num, names)
# 将参加活动的人数和姓名存入数据库中
MicroPost.transaction do
micropost = MicroPost.lock.find_by(id: micropost_id)
micropost.engage_people = num
micropost.engaged_people_names = names
micropost.save
end
end
def new_engaged_people(micropost_id, name)
# 新参加活动登记
engage_people, engage_people_names = get_engaged_people micropost_id
if engage_people_names.nil?
engage_people += 1
engage_people_names = name
else
engage_people_names = engage_people_names.split(',')
if engage_people_names.include?(name) != true
engage_people_names << name
engage_people += 1
end
engage_people_names = engage_people_names.join(',')
end
save_engaged_people(micropost_id, engage_people, engage_people_names)
return engage_people, engage_people_names
end
def delete_engaged_people(micropost_id, name)
# 退出活动登记
engage_people, engage_people_names = get_engaged_people micropost_id
engage_people_names = engage_people_names.split(',')
if engage_people_names.delete(name)
engage_people_names = engage_people_names.join(',')
engage_people -= 1
save_engaged_people(micropost_id, engage_people, engage_people_names)
end
return engage_people,engage_people_names
end
def joinded_activity(micropost_id,name)
engage_people, engage_people_names = get_engaged_people micropost_id
if engage_people_names.nil?
return false
end
engage_people_names = engage_people_names.split(',')
return engage_people_names.include?(name)
end
def micro_post_belong_to_user(micropost_id,user)
find_result = user.micro_posts.where(id: micropost_id)
return !find_result.empty?
end
end

View File

@ -0,0 +1,47 @@
module MicroPostsHelper
require 'fileutils'
@@micro_posts_dir = "public/data"
def read_each_post user
micro_posts_array = []
micro_posts = user.micro_posts.all.order(post_time: :desc)
if !micro_posts.empty?
micro_posts.each do |micro_post|
x = Hash.new()
x["postid"] = micro_post.id
x["title"] = micro_post.title
x["content"] = micro_post.content
case micro_post.post_type
when 1
x["type"] = "新鲜事"
when 2
x["type"] = "组团信息"
when 3
x["type"] = "失物招领"
else
x["type"] = "新鲜事"
end
x["time"] = get_strftime(micro_post.post_time)
x["pics"] = micro_post.pic.split(',') if micro_post.pic
x["peo_num"] = micro_post.engage_people
x["peo_names"] = micro_post.engaged_people_names
x["comments"] = micro_post.comments
micro_posts_array << x
end
end
return micro_posts_array
end
def savePicture pic
if !(File.directory? @@micro_posts_dir)
FileUtils.mkdir_p(@@micro_posts_dir)
end
ext = File.extname(pic.original_filename)
timestamp = Time.now.to_s
save_name = Digest::MD5::hexdigest(pic.original_filename + timestamp) + ext
File.open(File.join(@@micro_posts_dir, save_name), 'wb') { |f| f.write(pic.read) }
return save_name
end
end

View File

@ -0,0 +1,11 @@
module UsersHelper
def get_user_name_from_id user_id
user = User.find_by(id: user_id)
return user.name if !user.nil?
end
def get_user_sexual user
user.sexual
end
end

View File

@ -1,4 +1,4 @@
class ApplicationMailer < ActionMailer::Base
default from: 'from@example.com'
default from: "ucasguoren@heroku.com"
layout 'mailer'
end

View File

@ -0,0 +1,9 @@
class UserMailer < ApplicationMailer
default from: "ucasguoren@heroku.com"
def send_verify_code mail_address, code
@verify_code = code
mail(to: mail_address, subject: "验证码")
end
end

4
app/models/comment.rb Normal file
View File

@ -0,0 +1,4 @@
class Comment < ApplicationRecord
belongs_to :user, class_name: 'User', foreign_key: 'user_id'
belongs_to :micro_post, class_name: 'MicroPost', foreign_key: 'micro_post_id'
end

4
app/models/micro_post.rb Normal file
View File

@ -0,0 +1,4 @@
class MicroPost < ApplicationRecord
belongs_to :user
has_many :comments, class_name: 'Comment', foreign_key: 'micro_post_id', dependent: :destroy
end

View File

@ -1,6 +1,16 @@
class User < ApplicationRecord
has_many :send_messages, class_name: 'Message', foreign_key: 'send_user'
has_many :recieve_messages, class_name: 'Message', foreign_key: 'recieve_user'
before_save :default_values
def default_values
if self.picurl.nil?
self.picurl = 'images/avatars/default/avatar.png'
end
end
has_many :send_messages, class_name: 'Message', foreign_key: 'send_user', dependent: :destroy
has_many :recieve_messages, class_name: 'Message', foreign_key: 'recieve_user', dependent: :destroy
has_many :micro_posts, dependent: :destroy
has_many :comments, class_name: 'Comment', foreign_key: 'user_id', dependent: :destroy
VALID_EMAIL_REGEX = /\A[\w+\-.]+@([a-z\d\-]+\.)+[a-z]+\z/i
before_save { self.email = email.downcase }
@ -14,4 +24,6 @@ class User < ApplicationRecord
has_secure_password
validates :password, presence: true, length: {minimum: 6}, allow_nil: true
end

View File

@ -1,3 +1,5 @@
<% provide(:title, @user.name) %>
<div class="modal-shiftfix">
<!-- Navigation -->
@ -5,49 +7,44 @@
<!-- End Navigation -->
<div class="container-fluid main-content">
<div class="row">
<!-- Conversation -->
<div class="col-lg-12">
<div class="widget-container scrollable chat chat-page">
<div class="contact-list">
<div class="heading">
我的联系人<i class="icon-plus pull-right" data-toggle="modal" data-target="#addUser"></i>
</div>
<ul id="contactlists">
<% @chat_with_users.each do |name, readed| %>
<% if readed == false %>
<li class="user_entry">
<a href="#">
<img width="30" height="30" src="images/avatar-female.png"/>
<label class="user_name"><%= name.to_s %></label>
<i class="icon-circle text-success"></i>
</a>
</li>
<% else %>
<li class="user_entry">
<a href="#">
<img width="30" height="30" src="images/avatar-female.png"/>
<label class="user_name"><%= name.to_s %></label>
</a>
</li>
<% end %>
<% end %>
</ul>
</div>
<div class="heading">
<i class="icon-comments"></i>
<lable id="chatwith"></lable>
</div>
<div class="widget-content padded">
<ul id="chatList">
</ul>
</div>
<div class="post-message">
<input id="msg" class="form-control" placeholder="新信息..." type="text">
<input id="msgSubmit" type="submit" value="发送">
</div>
<!-- Conversation -->
<div class="widget-container scrollable chat chat-page row">
<div class="contact-list">
<div class="heading">
我的联系人<i class="icon-plus pull-right" data-toggle="modal" data-target="#addUser"></i>
</div>
<ul id="contactlists">
<% @chat_with_users.each do |name, readed| %>
<% if readed == false %>
<li class="user_entry">
<a>
<label class="user_name"><%= name.to_s %></label>
<i class="icon-circle text-success">新短信</i>
</a>
</li>
<% else %>
<li class="user_entry">
<a>
<label class="user_name"><%= name.to_s %></label>
</a>
</li>
<% end %>
<% end %>
</ul>
</div>
<div class="heading">
<i class="icon-comments"></i>
<lable id="chatwith"></lable>
</div>
<div id="chatScroll" class="widget-content padded">
<ul id="chatList">
</ul>
</div>
<div class="post-message">
<input id="msg" class="form-control" placeholder="新信息..." type="text">
<input id="msgSubmit" type="submit" value="发送">
</div>
</div>
</div>
</div>
@ -72,11 +69,16 @@
<script>
function insertSend(content, time) {
function insertSend(name, pic, content, time) {
var from =
'<li class=" current-user"> ' +
'<img width="30" height="30" src="images/avatar-female.jpg"/>' +
'<img width="30" height="30" src="' +
pic +
'"/>' +
'<div class="bubble">' +
'<a class="user-name">' +
name +
'</a>' +
'<p class="message">' +
content +
'</p> <p class="time">' +
@ -87,13 +89,17 @@
}
function insertRecieve(name, content, time) {
var from = '<li>' +
'<img width="30" height="30" src="images/avatar-female.jpg"/>' +
function insertRecieve(name, pic, content, time) {
var from =
'<li>' +
'<img width="30" height="30" ' +
'src="' +
pic +
'"/>' +
'<div class="bubble">' +
'<label>' +
'<a class="user-name">' +
name +
'</label>' +
'</a>' +
'<p class="message">' +
content +
'</p>' +
@ -117,23 +123,25 @@
$('#chatwith').text(name);
for (var i = 0; i < data.length; i++) {
if (data[i]["issend"] == true) {
insertSend(data[i]["content"], data[i]["time"])
insertSend(data[i]["name"], data[i]["userpic"], data[i]["content"], data[i]["time"])
}
else {
insertRecieve(data[i]["send"], data[i]["content"], data[i]["time"]);
insertRecieve(data[i]["name"], data[i]["userpic"], data[i]["content"], data[i]["time"]);
}
}
notify();
$("#msg").attr("disabled",false);
$("#msg").attr("disabled", false);
$("#chatScroll").scrollTop($("#chatScroll")[0].scrollHeight);
}
});
$(this).find("i").remove();
}
$("#msgSubmit").click(function () {
function sendMsg() {
var text = $("#msg").val();
if ( text.length == 0 ){
return;
if (text.length == 0) {
return false;
}
var chat_with_user = $("#chatwith").text();
$.ajax({
@ -142,17 +150,21 @@
dataType: 'json',
url: '/newmsg',
success: function (data, textStatus, jqXHR) {
insertSend(data["msg"], data["time"]);
insertSend(data["username"], data["userpic"], data["content"], data["time"]);
$("#chatScroll").scrollTop($("#chatScroll")[0].scrollHeight);
}
});
$("#msg").val("");
return false;
return true;
}
$("#msgSubmit").click(function () {
sendMsg();
});
function append_user(name) {
var append_div = '<li class="user_entry">' +
'<a href="#">' +
'<img width="30" height="30" src="images/avatar-female.png"/>' +
'<a>' +
'<label class="user_name">' +
name +
'</label>' +
@ -170,7 +182,7 @@
});
if (all_user_name.indexOf(name) < 0) {
console.log(all_user_name,name);
console.log(all_user_name, name);
$.ajax({
type: 'get',
data: {username: name, all: all_user_name},
@ -203,11 +215,11 @@
function addOnlineLable(uniquename) {
var yuandian = '<i class="icon-circle text-success"></i>';
var yuandian = '<i class="icon-circle text-success">新消息</i>';
var results = $('.user_name:contains(' + uniquename + ')');
for (var i = 0; i < results.length; i++) {
if($(results[i]).text() === uniquename ) {
if($(results[i]).parent().find("i").length == 0 ){
if ($(results[i]).text() === uniquename) {
if ($(results[i]).parent().find("i").length == 0) {
$(results[i]).parent().append(yuandian);
}
}
@ -221,9 +233,16 @@
url: '/online',
success: function (data, textStatus, jqXHR) {
if (data["users"] != null) {
for(var key in data["users"]){
console.log(key);
for (var key in data["users"]) {
addOnlineLable(key);
var current_chat_with = $("#chatwith").text();
if (current_chat_with.length > 0 && current_chat_with == key) {
$(".user_name").each(function () {
if ($(this).text() == current_chat_with) {
$(this).click();
}
})
}
}
}
}
@ -232,10 +251,12 @@
}
setInterval('online()', 10000);
setInterval('online()', 10000);
// clearInterval(notify_num_ticker);
</script>
$("#msg").bind("keyup", function (e) {
if (e.keyCode == "13") {
sendMsg();
}
});
</script>

View File

@ -3,9 +3,9 @@
<div class="pull-right">
<ul class="nav navbar-nav pull-right">
<li class="dropdown user hidden-xs"><a data-toggle="dropdown" class="dropdown-toggle" href="/logout">
<img width="34" height="34" src="<%= gravatar_for(@user) %>"/><%= @user.name %><b class="caret"></b></a>
<img width="34" height="34" src="<%= @user.picurl %>"/><%= @user.name %><b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="/users">
<li><a href="/profile">
<i class="icon-user"></i>个人设置</a>
</li>
<li><a href="/logout">
@ -15,26 +15,31 @@
</li>
</ul>
</div>
<a class="logo" href="#"></a>
<a class="logo" href="/main"></a>
<button class="navbar-toggle"><span class="icon-bar"></span><span class="icon-bar"></span><span
class="icon-bar"></span></button>
</div>
<div class="container-fluid main-nav clearfix">
<div class="nav-collapse">
<ul class="nav">
<li class="dropdown"><a data-toggle="dropdown" href="#">
<span aria-hidden="true" class="se7en-star"></span>随便看看<b class="caret"></b></a>
<li class="dropdown">
<a data-toggle="dropdown" href="#">
<span aria-hidden="true" class="se7en-star"></span>随便看看<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li>
<a href="#">失物信息</a>
<a href="/main">果仁动态</a>
</li>
<li>
<a href="#">组团信息</a>
<a href="/main?type=2">组团信息</a>
</li>
<li>
<a href="/main?type=3">失物信息</a>
</li>
</ul>
</li>
<li>
<a href="#"><span aria-hidden="true" class="se7en-home"></span>我的动态</a>
<a href="/microposts"><span aria-hidden="true" class="se7en-home"></span>我的动态</a>
</li>
<li>
<a href="/chat">
@ -43,6 +48,9 @@
<div id="msgNum" class="label label-info">0</div>
</a>
</li>
<li>
<a href="/logout"><span aria-hidden="true" class="se7en-pages"></span>退出</a>
</li>
</ul>
</div>
</div>
@ -77,7 +85,7 @@
$(document).ready(function () {
notify();
notify_num_ticker = setInterval('notify()', 10000);
$("#msg").attr("disabled",true);
$("#msg").attr("disabled", true);
});

View File

@ -1,3 +1,5 @@
<!--引入文件-->
<link href="stylesheets/bootstrap.min.css" media="all" rel="stylesheet" type="text/css"/>
<link href="stylesheets/font-awesome.css" media="all" rel="stylesheet" type="text/css"/>
<link href="stylesheets/se7en-font.css" media="all" rel="stylesheet" type="text/css"/>
@ -24,8 +26,10 @@
<link href="stylesheets/color/magenta.css" media="all" rel="alternate stylesheet" title="magenta-theme"
type="text/css"/>
<link href="stylesheets/color/gray.css" media="all" rel="alternate stylesheet" title="gray-theme" type="text/css"/>
<!--引入文件-->
<script src="javascripts/jquery.min.js" type="text/javascript"></script>
<script src="http://cdn.bootcss.com/jqueryui/1.10.3/jquery-ui.min.js" type="text/javascript"></script>
<script src="javascripts/jquery-ui-1.12.1.min.js" type="text/javascript"></script>
<script src="javascripts/bootstrap.min.js" type="text/javascript"></script>
<script src="javascripts/raphael.min.js" type="text/javascript"></script>
<script src="javascripts/selectivizr-min.js" type="text/javascript"></script>
@ -64,4 +68,9 @@
<script src="javascripts/jquery.sparkline.min.js" type="text/javascript"></script>
<script src="javascripts/main.js" type="text/javascript"></script>
<script src="javascripts/respond.js" type="text/javascript"></script>
<!--自定义CSS文件-->
<link href="stylesheets/mystyle.css" media="all" rel="stylesheet" type="text/css"/>
<!--自定义CSS文件-->
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">

View File

@ -3,13 +3,13 @@
<!-- Login Screen -->
<div class="login-wrapper">
<a href="#"><img width="210" height="70" src="images/logo/guoke.png"/></a>
<a href="#"><img width="210" height="70" src="images/logo/guoren.png"/></a>
<%= form_tag(controller: "login", action: "login", method: "post") do %>
<div class="form-group">
<div class="input-group">
<span class="input-group-addon"><i class="icon-envelope"></i></span><input class="form-control"
placeholder="请输入登陆账号"
<span class="input-group-addon"><i class="icon-user"></i></span><input class="form-control"
placeholder="请输入登陆邮箱"
name="email"
type="text">
</div>
@ -22,10 +22,10 @@
type="password">
</div>
</div>
<a class="pull-right" href="#">忘记密码?</a>
<div class="text-left">
<label class="checkbox"><input type="checkbox" name="remember" ><span>记住我</span></label>
</div>
<a class="pull-right" href="/forgetpasswd">忘记密码?</a>
<!--<div class="text-left">-->
<!--<label class="checkbox"><input type="checkbox" name="remember"><span>记住我</span></label>-->
<!--</div>-->
<input class="btn btn-lg btn-primary btn-block" type="submit" value="登陆">
<% end %>
<p>

View File

@ -0,0 +1,205 @@
<% provide(:title, @user.name) %>
<div class="modal-shiftfix">
<div class="container-fluid main-content">
<%= render 'layouts/nav' %>
<div class="row">
<div class="col-lg-12">
<% @micro_posts_array.each do |micro_post| %>
<div class="social-wrapper">
<div class="social-container">
<div class="social-entry" id="postid_<%= micro_post["postid"] %>">
<div class="widget-container fluid-height isotope-item">
<div class="profile-info clearfix" style="padding: 20px 20px 0 20px">
<img width="50" height="50" class="social-avatar pull-left"
src="<%= micro_post["userpic"] %>">
<a class="user-name"><i class="icon-user"></i><%= micro_post["username"] %></a><br>
<div class="profile-details">
<p>
<label class="label label-info" style="margin: 0"><%= micro_post["type"] %></label>
<i class="icon-time"><em><%= micro_post["time"] %></em></i>
</p>
</div>
</div>
<div class="padded">
<p class="content postcontent"><%= micro_post["content"] %></p>
<% if micro_post["pics"] %>
<div class="text-center">
<% micro_post["pics"].each do |pic| %>
<img width="250" class="social-content-media" src="<%= "data/" + pic %>"/>
<% end %>
</div>
<% end %>
</div>
<% if micro_post_belong_to_user(micro_post["postid"], @user) == false %>
<% if micro_post["type"] == "组团信息" %>
<div class="social-button">
<% if joinded_activity(micro_post["postid"], @user.name) %>
<button class="btn btn-lg btn-success-outline activity">取消报名</button>
<div class="activity-detail text-center"></div>
<% else %>
<button class="btn btn-lg btn-success-outline activity">报名参加</button>
<div class="activity-detail text-center"></div>
<% end %>
</div>
<% end %>
<% if micro_post["type"] == "失物招领" %>
<div class="social-button">
<button class="btn btn-success-outline lost">跟ta联系
</button>
</div>
<% end %>
<% end %>
</div>
<div class="comment-button">
<button class="btn btn-block btn-default-outline showcomment">
显示评论
</button>
</div>
<div class="comments padded hidden">
<input class="form-control makecomment" placeholder="写评论..." type="text">
</div>
</div>
</div>
</div>
<% end %>
</div>
</div>
<div class="row">
<nav class="text-center">
<%= will_paginate @posts, :page_links => false, :previous_label => "前一页", :next_label => "后一页" %>
</nav>
</div>
</div>
</div>
<script>
function comment_process(username, userpic, comment) {
var commentElem = '<div class="comment">' +
'<img width="40" height="40" class="social-avatars pull-left"' +
'src=' +
userpic +
'/>' +
'<a class="user-name">' +
username +
'</a>' +
'<p>' +
comment +
'</p>' +
'</div>';
return commentElem;
}
function getComments(id) {
$.ajax({
type: 'get',
dataType: 'json',
data: {micropost_id: id},
url: '/comments',
success: function (data, textStatus, jqXHR) {
var micro_post_id = "#" + "postid_" + id;
var comments = $(micro_post_id.toString()).parent().next();
var comments = $(micro_post_id.toString()).find(".comments");
comments.find(".comment").remove();
comments.find("p").remove();
if (data["comments"].length == 0) {
comments.prepend("<p class='text-center'>无评论</p>");
}
else {
var comments_array = data["comments"];
for (var i = 0; i < comments_array.length; i++) {
comments.prepend(comment_process(comments_array[i]["username"],
comments_array[i]["userpic"], comments_array[i]["content"]))
}
}
}
});
}
$(".showcomment").bind("click", function () {
var text = $(this).text();
if (text == "隐藏评论") {
$(this).parent().next(".comments").addClass("hidden");
$(this).text("显示评论");
}
else {
$(this).parent().next(".comments").removeClass("hidden");
$(this).text("隐藏评论");
var micropost_id = $(this).parent().parent().attr("id");
if (micropost_id.indexOf('_') > 0) {
var id = micropost_id.slice(micropost_id.indexOf('_') + 1);
getComments(id);
}
}
});
$(".makecomment").bind("keyup", function (e) {
var inputText = $(this).val();
if (inputText.length <= 0) {
return;
}
var username = "";
var userpic = "";
var enterObject = $(this);
var micropost = $(this).parent().parent().attr("id");
var micropost_id = micropost.slice(micropost.indexOf("_") + 1);
if (e.keyCode == "13") {
$.ajax({
type: 'post',
dataType: 'json',
data: {micropost_id: micropost_id, content: inputText, authenticity_token: AUTH_TOKEN},
url: '/newcomment',
success: function (data, textStatus, jqXHR) {
if (data["username"] && data["userpic"]) {
enterObject.parent().children("p").remove();
enterObject.before(comment_process(data["username"], data["userpic"], inputText));
}
$(".makecomment").val("");
}
});
}
});
$(".activity").bind("click", function () {
var activity = $(this);
var text = activity.text().trim();
var micropost = $(this).parent().parent().parent();
var micropost_id = micropost.attr("id");
if (micropost_id.indexOf('_') > 0) {
var id = micropost_id.slice(micropost_id.indexOf('_') + 1);
if (text == "报名参加") {
$.ajax({
type: 'get',
dataType: 'json',
data: {micropost_id: id, join: true},
url: '/activity',
success: function (data, textStatus, jqXHR) {
//console.log(data["total_num"]);
var engage_people = data["total_num"];
var show_text = "已有" + engage_people + "人参加该活动" + '\n' + data["total_names"] + "参加了活动";
activity.text("取消报名");
micropost.find(".activity-detail").text(show_text);
}
});
}
else {
$.ajax({
type: 'get',
dataType: 'json',
data: {micropost_id: id, join: false},
url: '/activity',
success: function (data, textStatus, jqXHR) {
activity.text("报名参加");
micropost.find(".activity-detail").text("成功取消报名");
}
});
}
}
});
$(".lost").bind("click", function () {
window.open("/chat");
});
</script>

View File

@ -0,0 +1,261 @@
<% provide(:title, @user.name) %>
<div class="modal-shiftfix">
<!-- Navigation -->
<%= render 'layouts/nav' %>
<!-- End Navigation -->
<div class="container-fluid main-content padded" id="user-page">
<div class="row" id="new-post">
<div class="widget-container fluid-height clearfix">
<div class="heading">
<i class="icon-reorder"></i>发布新信息
</div>
<%= form_tag("/newpost", method: "post", class: "form-horizontal", enctype: "multipart/form-data") do %>
<div class="form-group ">
<div class="col-md-2">
<select class="form-control" name="post_type">
<option value="1">新鲜事</option>
<option value="2">组团信息</option>
<option value="3">失物招领</option>
</select>
</div>
<div class="col-md-10">
<input class="form-control" placeholder="标题" type="text" name="title">
</div>
</div>
<div class="form-group">
<div class="col-md-12">
<textarea class="form-control" rows="3" name="content"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-md-12">
<div id="image-upload">
<div id="total">当前选择上传0个图片</div>
<input class="btn btn-default" type="button" value="添加图片" id="btnAdd" onclick="selectAttachment();">&nbsp;
<input class="btn btn-default" type="button" value="清空图片" id="btnClear" style="display:none" onclick="clearAttachment();">
<div id="attachmentList" style="display: none"></div>
<div id="pics">
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-12 text-center">
<button class="btn btn-primary" type="submit">发布</button>
</div>
</div>
<% end %>
</div>
</div>
<div class="posts">
<% @micro_posts.each do |micro_post| %>
<div class="micro-post" id="<%= micro_post["postid"] %>">
<button class="close delete-post" data-dismiss="alert" type="button">×</button>
<div class="widget-container fluid-height padded">
<div class="heading col-md-12">
<i class="icon-tags"><%= micro_post["type"] %></i>
<i class="icon-time"><%= micro_post["time"] %></i>
</div>
<div class="col-md-12">
<p class="content"><%= micro_post["content"] %></p>
<% if micro_post["pics"] %>
<div class="text-center">
<% micro_post["pics"].each do |pic| %>
<img width="250" class="social-content-media" src="<%= "data/" + pic %>"/>
<% end %>
</div>
<% end %>
</div>
<div class="col-md-12">
<div class="btn btn-default btn-block show-details">
查看详情
</div>
</div>
</div>
<div class="activity-details" hidden>
<% if micro_post["type"] == "组团信息" %>
<div class="widget-container fluid-height">
<div class="heading">
<i class="icon-align-center"> 活动详情 </i>
</div>
<div class="widget-content padded">
<h3 class="text-center">已有<%= micro_post["peo_num"] %>人参加活动</h3>
<p><%= micro_post["peo_names"] %>参加了该活动</p>
</div>
</div>
<% end %>
<% if !micro_post["comments"].empty? %>
<div class="widget-container fluid-height scrollable list user-comments">
<div class="heading">
<i class="icon-mail-forward"> 评论 </i>
</div>
<div class="widget-content fluid-height">
<ul>
<% micro_post["comments"].each do |comment| %>
<li>
<div>
<a class="user-name"><%= get_user_name_from_id(comment.user_id) %></a><em></em>
</div>
<div>
<p><%= comment.content %></p>
</div>
</li>
<% end %>
</ul>
</div>
</div>
<% else %>
<p class="text-center alert-info">暂无评论</p>
<% end %>
</div>
</div>
<% end %>
</div>
</div>
</div>
<script type="text/javascript">
var pic_num = 0; // 用来动态生成span,upfile的id
function addAttachmentToList() {
if (findAttachment(event.srcElement.value)) return; //如果此文档已在图片列表中则不再添加
if (extractFileName(event.srcElement.value)) {
// 动态创建图片信息栏并添加到图片列表中
var span = document.createElement('span');
span.id = '_attachment' + pic_num;
span.innerHTML = extractFileName(event.srcElement.value) +
'&nbsp;<a href="javascript:delAttachment(' + (pic_num++) + ')">删除</a><br/>';
span.title = event.srcElement.value;
G('attachmentList').appendChild(span);
}
// 显示图片列表并变换添加图片按钮文本
if (G('attachmentList').style.display == 'none') {
G('btnAdd').value = '继续添加';
G('attachmentList').style.display = '';
G('btnClear').style.display = '';
}
G('total').innerText = '当前选择上传' + G('attachmentList').childNodes.length + '个图片';
}
function selectAttachment() {
// 先清除无效动态生成的多余upfile
cleanInvalidUpfile();
// 动态创建上传控件并与span对应
var upfile = '<input type="file" style="display:none" multiple name="pictures[]" onchange="addAttachmentToList();" id="_upfile' + pic_num + '">';
G('pics').insertAdjacentHTML('beforeEnd', upfile);
G('_upfile' + pic_num).click();
}
function extractFileName(fn) {
var index = fn.substr(fn.lastIndexOf('.')).toLowerCase();
if (index == '.png' || index == '.jpg' || index == '.jpeg') {
return fn.substr(fn.lastIndexOf('\\') + 1);
}
else {
alert('请上传.png或.jpg格式的图片!');
return 0;
}
}
function findAttachment(fn) {
var o = G('attachmentList').getElementsByTagName('span');
for (var i = 0; i < o.length; i++)
if (o[i].title == fn) return true;
return false;
}
function delAttachment(id) {
G('attachmentList').removeChild(G('_attachment' + id));
G('pics').removeChild(G('_upfile' + id));
// 当图片列表为空则不显示并且变化添加图片按钮文本
if (G('attachmentList').childNodes.length == 0) {
G('btnAdd').value = '添加图片';
G('attachmentList').style.display = 'none';
G('btnClear').style.display = 'none';
}
G('total').innerText = '当前选择上传' + G('attachmentList').childNodes.length + '个图片';
}
function cleanInvalidUpfile() {
var o = document.body.getElementsByTagName('input');
for (var i = o.length - 1; i >= 0; i--)
if (o[i].type == 'file' && o[i].id.indexOf('_upfile') == 0) {
if (!G('_attachment' + o[i].id.substr(7)))
G('pics').removeChild(o[i]);
}
}
function clearAttachment() {
var o = G('attachmentList').childNodes;
for (var i = o.length - 1; i >= 0; i--)
G('attachmentList').removeChild(o[i]);
o = document.body.getElementsByTagName('input');
for (var i = o.length - 1; i >= 0; i--)
if (o[i].type == 'file' && o[i].id.indexOf('_upfile') == 0) {
document.body.removeChild(o[i]);
}
G('btnAdd').value = '添加图片';
G('attachmentList').style.display = 'none';
G('btnClear').style.display = 'none';
G('total').innerText = '当前选择上传0个图片';
}
function G(id) {
return document.getElementById(id);
}
$(".delete-post").bind("click", function () {
var errorhtml = '<div class="alert alert-danger">' +
'<button class="close" data-dismiss="alert" type="button">×</button>删除失败</div>';
var successhtml = '<div class="alert alert-success">' +
'<button class="close" data-dismiss="alert" type="button">×</button>删除成功</div>';
var micropost_id = $(this).parent().attr("id");
$.ajax({
type: 'get',
dataType: 'json',
data: {micropost_id: micropost_id},
url: '/deletepost',
success: function (data, textStatus, jqXHR) {
if (data['status'] == true) {
$('.posts').before(successhtml);
}
else {
$('.posts').before(errorhtml);
}
}
});
});
$('.show-details').bind("click", function () {
var current_button = $(this);
var micropost = current_button.parent().parent().parent();
var text = current_button.text().trim();
if (text == "查看详情") {
micropost.find(".activity-details").show();
current_button.text("隐藏详情");
}
else {
micropost.find(".activity-details").hide();
current_button.text("查看详情");
}
})
</script>

View File

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!-- 新 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap.min.css">
<!-- 可选的Bootstrap主题文件一般不用引入 -->
<link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap-theme.min.css">
<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script>
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="http://cdn.bootcss.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
您的验证码是: <%= @verify_code %>
</div>
</body>
</html>

View File

@ -0,0 +1,47 @@
<% provide(:title, '忘记密码') %>
<% provide(:body_class, 'login2') %>
<div class="login-wrapper">
<a href="#"><img width="210" height="70" src="images/logo/guoren.png"/></a>
<%= form_tag("/changepasswd", method: "post") do %>
<div class="form-group">
<div class="input-group">
<span class="input-group-addon"><i class="icon-envelope"></i></span><input class="form-control"
placeholder="请输入邮箱地址"
name="email"
type="email">
</div>
</div>
<div class="form-group">
<div class="input-group">
<span class="input-group-addon"><i class="icon-lock"></i></span><input class="form-control"
placeholder="请输入邮箱验证码"
name="verify_code"
type="number">
</div>
</div>
<div class="form-group">
<div class="input-group">
<span class="input-group-addon"><i class="icon-ok"></i></span><input class="form-control"
placeholder="请输入新密码"
name="password"
type="password">
</div>
</div>
<div class="form-group">
<div class="input-group">
<span class="input-group-addon"><i class="icon-ok"></i></span><input class="form-control"
placeholder="请再次输入新密码"
name="password_confirm"
type="password">
</div>
</div>
<%= submit_tag "重置密码", class: "btn btn-primary btn-block" %>
<% end %>
</div>

View File

@ -0,0 +1,97 @@
<% provide(:title, @user.name) %>
<div class="modal-shiftfix">
<div id="profile-container" class="container-fluid main-content">
<%= render 'layouts/nav' %>
<%= form_tag("/changeprofile", method: "post", class: "form-horizontal", id: "profile", enctype: "multipart/form-data") do %>
<div class="row">
<div class="widget-container">
<div class="heading">
<i class="icon-user"></i>个人设置
</div>
</div>
</div>
<div class="row">
<div class="widget-container">
<div class="heading">
<i class="icon-user"></i>用户图像
</div>
<div class="col-md-12 text-center">
<div class="fileupload fileupload-new" data-provides="fileupload">
<div class="fileupload-new img-thumbnail" style="width: 200px; height: 200px;">
<!--原照片-->
<img src="<%= @user.picurl %>">
</div>
<div class="fileupload-preview fileupload-exists img-thumbnail"
style="width: 200px; max-height: 200px">
</div>
<div class="padded">
<span class="btn btn-default btn-file">
<span
class="fileupload-new">选择照片
</span>
<span
class="fileupload-exists">
重新选择
</span>
<input type="file" name="user[pic]">
</span>
<a class="btn btn-default fileupload-exists" data-dismiss="fileupload">清除照片</a>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="widget-container fluid-height clearfix">
<div class="heading">
<i class="icon-reorder"></i>基本信息
</div>
<div class="padded">
<div class="form-group">
<label class="control-label col-md-2">姓名</label>
<div class="col-md-9">
<input class="form-control" placeholder="请输入您的姓名" value="<%= @user.name %>"
type="text" name="user[username]">
</div>
</div>
<div class="form-group">
<label class="control-label col-md-2">专业</label>
<div class="col-md-9">
<input class="form-control" placeholder="请输入您的专业" value="<%= @user.profession %>"
type="text" name="user[profession]">
</div>
</div>
<div class="form-group">
<label class="control-label col-md-2">性别</label>
<div class="col-md-9">
<label class="radio-inline"><input name="user[sexual]" type="radio" value="1"
<% if get_user_sexual(@user) == true %>checked
<% end %>
><span>男</span></label>
<label class="radio-inline"><input name="user[sexual]" type="radio" value="0"
<% if get_user_sexual(@user) == false %>checked
<% end %>
><span>女</span></label>
</div>
</div>
<div class="form-group">
<div class="col-md-12 text-center">
<button class="btn btn-primary" type="submit">修改</button>
</div>
</div>
</div>
</div>
</div>
<% end %>
</div>
</div>

View File

@ -0,0 +1,22 @@
<% provide(:title, '忘记密码') %>
<% provide(:body_class, 'login2') %>
<div class="login-wrapper">
<a href="#"><img width="210" height="70" src="images/logo/guoren.png"/></a>
<%= form_tag("/forgetpasswd", method: "get") do %>
<div class="form-group">
<div class="input-group">
<span class="input-group-addon"><i class="icon-envelope"></i></span><input class="form-control"
placeholder="请输入邮箱地址"
name="email"
type="email">
</div>
</div>
<%= submit_tag "找回密码", class: "btn btn-primary btn-block" %>
<% end %>
</div>

View File

@ -2,7 +2,7 @@
<% provide(:body_class, 'login2') %>
<div class="login-wrapper">
<a href="#"><img width="210" height="70" src="images/logo/guoke.png"/></a>
<a href="#"><img width="210" height="70" src="images/logo/guoren.png"/></a>

0
果仁/bin/bundle → bin/bundle Normal file → Executable file
View File

0
果仁/bin/rails → bin/rails Normal file → Executable file
View File

0
果仁/bin/rake → bin/rake Normal file → Executable file
View File

0
果仁/bin/setup → bin/setup Normal file → Executable file
View File

0
果仁/bin/spring → bin/spring Normal file → Executable file
View File

0
果仁/bin/update → bin/update Normal file → Executable file
View File

33
code.bak Normal file
View File

@ -0,0 +1,33 @@
<%= form_for @user, url: {action: "changepasswd"} do |f| %>
<%= render 'shared/error_messages', object: f.object %>
<div class="form-group">
<div class="input-group">
<span class="input-group-addon"><i class="icon-lock"></i></span>
<input class="form-control" placeholder="请输入邮箱验证码" name="verify_code" type="text">
</div>
</div>
<div class="form-group">
<div class="input-group">
<span class="input-group-addon"><i class="icon-envelope"></i></span>
<%= f.email_field :email, class: 'form-control', placeholder: "请输入邮箱" %>
</div>
</div>
<div class="form-group">
<div class="input-group">
<span class="input-group-addon"><i class="icon-ok"></i></span>
<%= f.password_field :password, class: 'form-control', placeholder: "请输入密码" %>
</div>
</div>
<div class="form-group">
<div class="input-group">
<span class="input-group-addon"><i class="icon-ok"></i></span>
<%= f.password_field :password_confirmation, class: 'form-control', placeholder: "请再次输入密码" %>
</div>
</div>
<%= f.submit "重置密码", class: "btn btn-primary btn-block" %>
<% end %>

View File

@ -11,5 +11,6 @@ module GuorenPro
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
config.time_zone = 'Beijing'
end
end

View File

@ -18,7 +18,7 @@ Rails.application.configure do
config.cache_store = :memory_store
config.public_file_server.headers = {
'Cache-Control' => 'public, max-age=172800'
'Cache-Control' => 'public, max-age=172800'
}
else
config.action_controller.perform_caching = false
@ -51,4 +51,19 @@ Rails.application.configure do
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
host = 'ucasguoren.herokuapp.com'
config.action_mailer.default_url_options = {host: host}
config.action_mailer.raise_delivery_errors = true
config.action_mailer.smtp_settings = {
:address => "smtp.sendgrid.net",
:port => 587,
:user_name => "app61271187@heroku.com",
:password => "5cysx5kw9899",
:authentication => "plain",
:domain => 'herokuapp.com',
:enable_starttls_auto => true
}
end

View File

@ -83,4 +83,19 @@ Rails.application.configure do
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
host = 'ucasguoren.herokuapp.com'
config.action_mailer.default_url_options = {host: host}
config.action_mailer.raise_delivery_errors = true
config.action_mailer.smtp_settings = {
:address => "smtp.sendgrid.net",
:port => 587,
:user_name => ENV['SENDGRID_USERNAME'],
:password => ENV['SENDGRID_PASSWORD'],
:authentication => "plain",
:domain => 'herokuapp.com',
:enable_starttls_auto => true
}
end

36
config/routes.rb Normal file
View File

@ -0,0 +1,36 @@
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
root 'login#init'
get '/login', to: 'login#init'
post '/login', to: 'login#login'
get 'logout', to: 'login#logout'
get '/signup', to: 'users#new'
get '/profile', to: 'users#edit'
get '/forgetpasswd', to: 'users#forgetpasswd'
get '/changepasswd', to: 'users#changepasswd'
post '/changepasswd', to: 'users#changepasswd'
post '/changeprofile', to: 'users#changeprofile'
get '/main', to: 'main#show'
get '/activity', to: 'main#activity'
get '/chat', to: 'chat#index'
post '/newmsg', to: 'chat#new'
get '/notify', to: 'chat#notify'
get '/query', to: 'chat#query'
get '/online', to: 'chat#online'
get '/microposts', to: 'micro_posts#show'
post '/newpost', to: 'micro_posts#new'
get '/deletepost', to: 'micro_posts#delete'
get '/comments', to: 'comments#get'
post '/newcomment', to: 'comments#new'
resource :users
resource :micro_posts
end

Some files were not shown because too many files have changed in this diff Show More