Compare commits

...

7 Commits
master ... test

Author SHA1 Message Date
Joe 8c17fc4c32 upload_modified 2017-01-03 14:24:56 +08:00
Joe 1ce357fb20 upload bug修复 2016-12-28 13:32:25 +08:00
Joe 3dc9155a1f 图片上传控制 2016-12-27 13:18:20 +08:00
Joe 3704a84439 图片上传控制 2016-12-27 13:12:20 +08:00
Joe 7b6f27aebf new upload 2016-12-22 23:02:36 +08:00
Joe 342c2860b3 upload 2016-12-22 21:48:42 +08:00
Joe 0c626b43d1 upload file 2016-12-18 13:00:10 +08:00
268 changed files with 149 additions and 31058 deletions

1
guoren Submodule

@ -0,0 +1 @@
Subproject commit 25c738414d33d2202fce85a6f596486c78a03283

148
多图片上传.html Normal file
View File

@ -0,0 +1,148 @@
<HTML>
<HEAD>
</HEAD>
<BODY>
<input type="button" value="添加图片" id="btnAdd" onclick="selectAttachment()">
<input type="button" value="清空图片" id="btnClear" style="display:none" onclick="clearAttachment()">
<div id="attachmentList" style="display:none"></div>
<div id="total">当前选择上传0个图片</div>
<form id='pics' action="#">
</form>
<input type="submit" value="上传">
<script type="text/javascript">
var pic_num = 0,pic_maxnum = 5; // 用来动态生成span,upfile的id,一次上传图片数量接口
function addAttachmentToList()
{
if(findAttachment(event.srcElement.value)){
var o = G('pics').getElementsByTagName('input');
var len = o.length-1;
G('pics').removeChild(o[len]);
pic_num--;
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').getElementsByTagName('span').length > 0)
{
G('btnAdd').value = '继续添加';
G('attachmentList').style.display = '';
G('btnClear').style.display = '';
}
G('total').innerText = '当前选择上传'+ G('attachmentList').childNodes.length + '个图片';
}
function selectAttachment()
{
cleanInvalidUpfile();
pic_num++;
if(pic_num <= pic_maxnum ) {//图片数量控制
var upfile = '<input type="file" style="display:none" onchange="addAttachmentToList();" id="_upfile'+ pic_num +'">';// 动态创建上传控件并与span对应
G('pics').insertAdjacentHTML('beforeEnd', upfile);
G('_upfile'+pic_num).click();
var o = G('pics').getElementsByTagName('input');
alert(o.length);
var tick=setTimeout(function(){
var m = G('attachmentList').getElementsByTagName('span');
if(o.length > m.length){
var len = o.length-1;
G("pics").removeChild(o[len]);
}
},1000*5);
}
else {
alert("一次只能上传"+pic_maxnum+"张图片!");
return ;
}
}
//判断图片格式
function extractFileName(fn)
{
var index = fn.substr(fn.lastIndexOf('.')).toLowerCase();
if (index ==".png"||index ==".jpg"||index ==".jpeg"){
return fn.substr(fn.lastIndexOf('\\')+1);
}
else{
("请上传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));
pic_num--;
// 当图片列表为空则不显示并且变化添加图片按钮文本
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 = G('pics').getElementsByTagName('input');
var len = o.length-1;
for(var i=o.len;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]);
pic_num--;
}
}
}
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)
{
G('pics').removeChild(o[i]);
}
pic_num=0;
G('btnAdd').value = '添加图片';
G('attachmentList').style.display = 'none';
G('btnClear').style.display = 'none';
G('total').innerText = '当前选择上传0个图片';
}
function G(id)
{
return document.getElementById(id);
}
</script>
</BODY>
</HTML>

BIN
果仁/.DS_Store vendored

Binary file not shown.

21
果仁/.gitignore vendored
View File

@ -1,21 +0,0 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'
# Ignore bundler config.
/.bundle
# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal
# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep
# Ignore Byebug command history file.
.byebug_history

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Settings><!--This file was automatically generated by Ruby plugin.
You are allowed to:
1. Reorder generators
2. Remove generators
3. Add installed generators
To add new installed generators automatically delete this file and reload the project.
--><GeneratorsGroup><Generator name="assets" /><Generator name="channel" /><Generator name="coffee:assets" /><Generator name="controller" /><Generator name="generator" /><Generator name="helper" /><Generator name="integration_test" /><Generator name="jbuilder" /><Generator name="job" /><Generator name="js:assets" /><Generator name="mailer" /><Generator name="migration" /><Generator name="model" /><Generator name="resource" /><Generator name="scaffold" /><Generator name="scaffold_controller" /><Generator name="task" /><Generator name="test_unit:generator" /><Generator name="test_unit:plugin" /></GeneratorsGroup></Settings>

File diff suppressed because one or more lines are too long

View File

@ -1,192 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="RUBY_MODULE" version="4">
<component name="FacetManager">
<facet type="RailsFacetType" name="Ruby on Rails">
<configuration>
<RAILS_FACET_CONFIG_ID NAME="RAILS_FACET_SUPPORT_REMOVED" VALUE="false" />
<RAILS_FACET_CONFIG_ID NAME="RAILS_TESTS_SOURCES_PATCHED" VALUE="true" />
<RAILS_FACET_CONFIG_ID NAME="RAILS_FACET_APPLICATION_ROOT" VALUE="$MODULE_DIR$" />
</configuration>
</facet>
</component>
<component name="ModuleRunConfigurationManager">
<configuration default="false" name="test: guorenPro" type="RakeRunConfigurationType" factoryName="Rake">
<module name="guorenPro" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
<envs>
<env name="RAILS_ENV" value="test" />
</envs>
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
<COVERAGE_PATTERN ENABLED="true">
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
</COVERAGE_PATTERN>
</EXTENSION>
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="test" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE=":test_unit " />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
<method />
</configuration>
<configuration default="false" name="spec: guorenPro" type="RakeRunConfigurationType" factoryName="Rake">
<module name="guorenPro" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
<envs />
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
<COVERAGE_PATTERN ENABLED="true">
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
</COVERAGE_PATTERN>
</EXTENSION>
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="spec" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE=":rspec " />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
<method />
</configuration>
<configuration default="false" name="Production: guorenPro" type="RailsRunConfigurationType" factoryName="Rails">
<predefined_log_file id="RUBY_RAILS_SERVER" enabled="true" />
<module name="guorenPro" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
<envs />
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
<COVERAGE_PATTERN ENABLED="true">
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
</COVERAGE_PATTERN>
</EXTENSION>
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="SCRIPT_ARGS" VALUE="" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="PORT" VALUE="3000" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="IP" VALUE="0.0.0.0" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="DUMMY_APP" VALUE="test/dummy" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="RAILS_SERVER_TYPE" VALUE="Default" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="ENVIRONMENT_TYPE" VALUE="production" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="LAUNCH_JS" VALUE="false" />
<method />
</configuration>
<configuration default="false" name="Development: guorenPro" type="RailsRunConfigurationType" factoryName="Rails">
<predefined_log_file id="RUBY_RAILS_SERVER" enabled="true" />
<module name="guorenPro" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
<envs />
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
<COVERAGE_PATTERN ENABLED="true">
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
</COVERAGE_PATTERN>
</EXTENSION>
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="SCRIPT_ARGS" VALUE="" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="PORT" VALUE="3000" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="IP" VALUE="0.0.0.0" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="DUMMY_APP" VALUE="test/dummy" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="RAILS_SERVER_TYPE" VALUE="Default" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="ENVIRONMENT_TYPE" VALUE="development" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="LAUNCH_JS" VALUE="false" />
<method />
</configuration>
</component>
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/.bundle" />
<excludeFolder url="file://$MODULE_DIR$/components" />
<excludeFolder url="file://$MODULE_DIR$/public/system" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
<excludeFolder url="file://$MODULE_DIR$/vendor/bundle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="actioncable (v5.0.0.1, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="actionmailer (v5.0.0.1, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="actionpack (v5.0.0.1, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="actionview (v5.0.0.1, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="activejob (v5.0.0.1, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="activemodel (v5.0.0.1, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="activerecord (v5.0.0.1, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="activesupport (v5.0.0.1, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="arel (v7.1.4, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="bcrypt (v3.1.11, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="builder (v3.2.2, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.12.5, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="byebug (v9.0.6, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="coffee-rails (v4.2.1, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="coffee-script (v2.4.1, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="coffee-script-source (v1.11.1, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.0.2, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="debug_inspector (v0.0.2, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="erubis (v2.7.0, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="execjs (v2.7.0, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="ffi (v1.9.14, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="globalid (v0.3.7, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="i18n (v0.7.0, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="jbuilder (v2.6.0, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="jquery-rails (v4.2.1, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="listen (v3.0.8, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="loofah (v2.0.3, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="mail (v2.6.4, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="method_source (v0.8.2, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="mime-types (v3.1, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="mime-types-data (v3.2016.0521, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="mini_portile2 (v2.1.0, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.9.1, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="multi_json (v1.12.1, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="nio4r (v1.2.1, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.6.8.1, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="puma (v3.6.2, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rack (v2.0.1, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rack-test (v0.6.3, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rails (v5.0.0.1, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rails-dom-testing (v2.0.1, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rails-html-sanitizer (v1.0.3, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="railties (v5.0.0.1, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rake (v11.3.0, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rb-fsevent (v0.9.8, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rb-inotify (v0.9.7, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="sass (v3.4.22, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="sass-rails (v5.0.6, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="spring (v2.0.0, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="spring-watcher-listen (v2.0.1, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="sprockets (v3.7.0, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="sprockets-rails (v3.2.0, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="sqlite3 (v1.3.12, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="thor (v0.19.1, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.5, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="tilt (v2.0.5, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="turbolinks (v5.0.1, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="turbolinks-source (v5.0.0, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v1.2.2, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="uglifier (v3.0.3, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="web-console (v3.4.0, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="websocket-driver (v0.6.4, rbenv: 2.3.1) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="websocket-extensions (v0.1.2, rbenv: 2.3.1) [gem]" level="application" />
</component>
<component name="RModuleSettingsStorage">
<LOAD_PATH number="0" />
<I18N_FOLDERS number="1" string0="$MODULE_DIR$/config/locales" />
</component>
</module>

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="rbenv: 2.3.1" project-jdk-type="RUBY_SDK" />
</project>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/guorenPro.iml" filepath="$PROJECT_DIR$/.idea/guorenPro.iml" />
</modules>
</component>
</project>

View File

@ -1,27 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Development: guorenPro" type="RailsRunConfigurationType" factoryName="Rails">
<predefined_log_file id="RUBY_RAILS_SERVER" enabled="true" />
<module name="guorenPro" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
<envs />
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
<COVERAGE_PATTERN ENABLED="true">
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
</COVERAGE_PATTERN>
</EXTENSION>
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="SCRIPT_ARGS" VALUE="" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="PORT" VALUE="3000" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="IP" VALUE="0.0.0.0" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="DUMMY_APP" VALUE="test/dummy" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="RAILS_SERVER_TYPE" VALUE="Default" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="ENVIRONMENT_TYPE" VALUE="development" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="LAUNCH_JS" VALUE="false" />
<method />
</configuration>
</component>

View File

@ -1,27 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Production: guorenPro" type="RailsRunConfigurationType" factoryName="Rails">
<predefined_log_file id="RUBY_RAILS_SERVER" enabled="true" />
<module name="guorenPro" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
<envs />
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
<COVERAGE_PATTERN ENABLED="true">
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
</COVERAGE_PATTERN>
</EXTENSION>
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="SCRIPT_ARGS" VALUE="" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="PORT" VALUE="3000" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="IP" VALUE="0.0.0.0" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="DUMMY_APP" VALUE="test/dummy" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="RAILS_SERVER_TYPE" VALUE="Default" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="ENVIRONMENT_TYPE" VALUE="production" />
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="LAUNCH_JS" VALUE="false" />
<method />
</configuration>
</component>

View File

@ -1,25 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="spec: guorenPro" type="RakeRunConfigurationType" factoryName="Rake">
<module name="guorenPro" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
<envs />
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
<COVERAGE_PATTERN ENABLED="true">
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
</COVERAGE_PATTERN>
</EXTENSION>
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="spec" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE=":rspec " />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
<method />
</configuration>
</component>

View File

@ -1,27 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="test: guorenPro" type="RakeRunConfigurationType" factoryName="Rake">
<module name="guorenPro" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
<envs>
<env name="RAILS_ENV" value="test" />
</envs>
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
<COVERAGE_PATTERN ENABLED="true">
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
</COVERAGE_PATTERN>
</EXTENSION>
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="test" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE=":test_unit " />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
<method />
</configuration>
</component>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

File diff suppressed because it is too large Load Diff

View File

@ -1,49 +0,0 @@
source 'https://rubygems.org'
# 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
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
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'
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platform: :mri
end
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'
# 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'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

View File

@ -1,176 +0,0 @@
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)
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)
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.12.5

View File

@ -1,24 +0,0 @@
# README
This README would normally document whatever steps are necessary to get the
application up and running.
Things you may want to cover:
* Ruby version
* System dependencies
* Configuration
* Database creation
* Database initialization
* How to run the test suite
* Services (job queues, cache servers, search engines, etc.)
* Deployment instructions
* ...

View File

@ -1,6 +0,0 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require_relative 'config/application'
Rails.application.load_tasks

View File

@ -1,3 +0,0 @@
//= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css

View File

@ -1,16 +0,0 @@
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file. JavaScript code in this file should be added after the last require_* statement.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .

View File

@ -1,13 +0,0 @@
// Action Cable provides the framework to deal with WebSockets in Rails.
// You can generate new channels where WebSocket features live using the rails generate channel command.
//
//= require action_cable
//= require_self
//= require_tree ./channels
(function() {
this.App || (this.App = {});
App.cable = ActionCable.createConsumer();
}).call(this);

View File

@ -1,3 +0,0 @@
# 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

@ -1,3 +0,0 @@
# 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

@ -1,3 +0,0 @@
# 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

@ -1,3 +0,0 @@
# 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

@ -1,15 +0,0 @@
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
* files in this directory. Styles in this file should be added after the last require_* statement.
* It is generally better to create a new file per style scope.
*
*= require_tree .
*= require_self
*/

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +0,0 @@
module ApplicationCable
class Channel < ActionCable::Channel::Base
end
end

View File

@ -1,4 +0,0 @@
module ApplicationCable
class Connection < ActionCable::Connection::Base
end
end

View File

@ -1,14 +0,0 @@
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
include LoginHelper
include UsersHelper
# Confirms a logged-in user.
def logged_in_user
unless logged_in?
flash[:danger] = "请先登录"
redirect_to login_url
end
end
end

View File

@ -1,76 +0,0 @@
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)
messages = process_messages(@user, @current_chat_user)
render json: messages
# else
# if !@chat_with_users.empty?
# @current_chat_user_name = @chat_with_users[0]["username"]
# @current_chat_user = User.find_by(name: @current_chat_user_name)
# @current_messages = Message.where(send_user: [@user.id, @current_chat_user_id], recieve_user:
# [@user.id, @current_chat_user_id]).order(create_time: :asc)
# end
end
end
def new
@user = current_user
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: {msg: msg, time: save_time}
else
render json: {msg: "error", time: save_time}
end
end
def notify
@user = current_user
# unreaded_lists = unread_msg_users(@uesr)
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]
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.empty?
query_name = nil
ok = false
else
query_name = query_user.name
ok = true
end
end
render json: {username: query_name, ok: ok}
end
end

View File

@ -1,27 +0,0 @@
class LoginController < ApplicationController
def init
if logged_in?
redirect_to main_path
else
render 'init'
end
end
def login
user = User.find_by(email: params[:email].downcase)
if user && user.authenticate(params[:password])
log_in(user)
redirect_to main_path
else
flash.now[:danger] = "用户名或者密码错误"
render 'init'
end
end
def logout
log_out
redirect_to login_path
end
end

View File

@ -1,15 +0,0 @@
class MainController < ApplicationController
before_action :logged_in_user
def show
@user = current_user
p @user.email
p gravatar_for @user
render 'main'
end
def index
end
end

View File

@ -1,21 +0,0 @@
class UsersController < ApplicationController
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
private
def user_params
params.require(:user).permit(:name, :email, :password,
:password_confirmation)
end
end

View File

@ -1,2 +0,0 @@
module ApplicationHelper
end

View File

@ -1,78 +0,0 @@
module ChatHelper
def get_chat_with_users user
chat_with_users = {}
user.recieve_messages.where(readed: true).select(:send_user).distinct.each do |chat|
temp_user_id = chat.send_user
find_user = User.find(temp_user_id)
user_name_sym = find_user.name.to_sym
chat_with_users[user_name_sym] = true
end
user.send_messages.select(:recieve_user).distinct.each do |chat|
temp_user_id = chat.recieve_user
find_user = User.find(temp_user_id)
user_name_sym = find_user.name.to_sym
chat_with_users[user_name_sym] = true
end
user.recieve_messages.where(readed: false).select(:send_user).distinct.each do |chat|
temp_user_id = chat.send_user
find_user = User.find(temp_user_id)
user_name_sym = find_user.name.to_sym
chat_with_users[user_name_sym] = false
end
return chat_with_users
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?
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}
else
message.readed = true
message.save
x = {issend: false, send: chat_with.name, recieve: user.name, content: message.content, time: message.create_time}
end
results << x
end
end
end
results
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
results.each do |result|
username = User.find(result.send_user).name
return_user_msg[username] = [];
return_user_msg[username] <<result.content;
end
end
return_user_msg
end
end

View File

@ -1,29 +0,0 @@
module LoginHelper
# Logs in the given user.
def log_in(user)
session[:user_id] = user.id
end
# Returns true if the given user is the current user.
def current_user?(user)
user == current_user
end
# Returns the user corresponding to the remember token cookie.
def current_user
user_id = session[:user_id]
@current_user ||= User.find_by(id: user_id)
end
# Returns true if the user is logged in, false otherwise.
def logged_in?
!current_user.nil?
end
# Logs out the current user.
def log_out
session.delete(:user_id)
@current_user = nil
end
end

View File

@ -1,2 +0,0 @@
module MainHelper
end

View File

@ -1,7 +0,0 @@
module UsersHelper
def gravatar_for(user, options = { size: 80 })
gravatar_id = Digest::MD5::hexdigest(user.email.downcase)
size = options[:size]
gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}"
end
end

View File

@ -1,2 +0,0 @@
class ApplicationJob < ActiveJob::Base
end

View File

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

View File

@ -1,3 +0,0 @@
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end

View File

@ -1,4 +0,0 @@
class Message < ApplicationRecord
belongs_to :sender, class_name: 'User', foreign_key: 'send_user'
belongs_to :reciever, class_name: 'User', foreign_key: 'recieve_user'
end

View File

@ -1,17 +0,0 @@
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'
VALID_EMAIL_REGEX = /\A[\w+\-.]+@([a-z\d\-]+\.)+[a-z]+\z/i
before_save { self.email = email.downcase }
validates :name, presence: true, length: {maximum: 50}, uniqueness: {
case_sensitive: false
}
validates :email, presence: true, length: {maximum: 255},
format: {with: VALID_EMAIL_REGEX}, uniqueness: {
case_sensitive: true
}
has_secure_password
validates :password, presence: true, length: {minimum: 6}, allow_nil: true
end

View File

@ -1,241 +0,0 @@
<div class="modal-shiftfix">
<!-- Navigation -->
<%= render 'layouts/nav' %>
<!-- 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>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="addUser" tabindex="-1" role="dialog" aria-labelledby="adduser" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">添加用户</h4>
</div>
<div class="modal-body">
<input id="query_user" type="text" class="form-control" placeholder="用户名称">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
<button id="query_submit" type="button" class="btn btn-primary">提交</button>
</div>
</div>
</div>
</div>
<script>
function insertSend(content, time) {
var from =
'<li class=" current-user"> ' +
'<img width="30" height="30" src="images/avatar-female.jpg"/>' +
'<div class="bubble">' +
'<p class="message">' +
content +
'</p> <p class="time">' +
time +
'</p> </div> </li>'
;
$("#chatList").append(from);
}
function insertRecieve(name, content, time) {
var from = '<li>' +
'<img width="30" height="30" src="images/avatar-female.jpg"/>' +
'<div class="bubble">' +
'<label>' +
name +
'</label>' +
'<p class="message">' +
content +
'</p>' +
'<p class="time">' +
time +
'</p>' +
'</div>' +
'</li>';
$("#chatList").append(from);
}
function label_click() {
name = $(this).find("label").text();
$.ajax({
type: 'get',
dataType: 'json',
data: {chat_with: name},
url: '/chat',
success: function (data, textStatus, jqXHR) {
$("#chatList").empty();
$('#chatwith').text(name);
for (var i = 0; i < data.length; i++) {
if (data[i]["issend"] == true) {
insertSend(data[i]["content"], data[i]["time"])
}
else {
insertRecieve(data[i]["send"], data[i]["content"], data[i]["time"]);
}
}
notify();
$("#msg").attr("disabled",false);
}
});
$(this).find("i").remove();
}
$("#msgSubmit").click(function () {
var text = $("#msg").val();
if ( text.length == 0 ){
return;
}
var chat_with_user = $("#chatwith").text();
$.ajax({
type: 'post',
data: {msg: text, chat_with: chat_with_user, authenticity_token: AUTH_TOKEN},
dataType: 'json',
url: '/newmsg',
success: function (data, textStatus, jqXHR) {
insertSend(data["msg"], data["time"]);
}
});
$("#msg").val("");
return false;
});
function append_user(name) {
var append_div = '<li class="user_entry">' +
'<a href="#">' +
'<img width="30" height="30" src="images/avatar-female.png"/>' +
'<label class="user_name">' +
name +
'</label>' +
'</a>' +
'</li>';
$("#contactlists").append(append_div)
}
function query_user(name) {
var all_user_name = [];
$(".user_entry label").each(function () {
all_user_name.push($(this).text());
});
if (all_user_name.indexOf(name) < 0) {
console.log(all_user_name,name);
$.ajax({
type: 'get',
data: {username: name, all: all_user_name},
dataType: 'json',
url: '/query',
success: function (data, textStatus, jqXHR) {
if (data["ok"] == true) {
append_user(data["username"]);
$('.user_entry').bind("click", label_click);
}
}
});
}
return false;
}
$("#query_submit").click(function () {
$('#addUser').modal("hide");
var queryname = $("#query_user").val();
if (queryname.length != 0) {
console.log(queryname);
query_user(queryname);
$("#query_user").val("");
}
});
$(document).ready(function () {
$('.user_entry').bind("click", label_click);
});
function addOnlineLable(uniquename) {
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 ){
$(results[i]).parent().append(yuandian);
}
}
}
}
function online() {
$.ajax({
type: 'get',
dataType: 'json',
url: '/online',
success: function (data, textStatus, jqXHR) {
if (data["users"] != null) {
for(var key in data["users"]){
console.log(key);
addOnlineLable(key);
}
}
}
});
return false;
}
setInterval('online()', 10000);
// clearInterval(notify_num_ticker);
</script>

View File

@ -1,165 +0,0 @@
<div class="modal-shiftfix">
<!-- Navigation -->
<%= render 'layouts/nav' %>
<!-- 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"></i>
</div>
<ul>
<% @chat_with_users.each do |name,readed| %>
<% if readed == false%>
<li>
<a href="#">
<img width="30" height="30" src="images/avatar-female.png"/>
<%=name.to_s%>
<i class="icon-circle text-success"></i>
</a>
</li>
<% else %>
<li>
<a href="#">
<img width="30" height="30" src="images/avatar-female.png"/>
<%=name.to_s%>
</a>
</li>
<% end %>
<% end %>
</ul>
</div>
<div class="heading">
<i class="icon-comments"></i>
<lable id="chatwith"><%= @current_chat_user.name %></lable>
</div>
<div class="widget-content padded">
<% if !@current_chat_user.nil? %>
<ul id="chatList">
<% @current_messages.each do |message| %>
<% if message.send_user == @user.id %>
<li class="current-user">
<img width="30" height="30" src="images/avatar-female.jpg"/>
<div class="bubble">
<p class="message">
<%= message.content %>
</p>
<p class="time">
<%= message.create_time %>
</p>
</div>
</li>
<% else %>
<li>
<img width="30" height="30" src="images/avatar-female.jpg"/>
<div class="bubble">
<label><%= @current_chat_user.name %></label>
<p class="message">
<%= message.content %>
</p>
<p class="time">
<%= message.create_time %>
</p>
</div>
</li>
<% end %>
<% end %>
</ul>
<% end %>
</div>
<div class="post-message">
<input id="msg" class="form-control" placeholder="新信息..." type="text">
<input id="msgSubmit" type="submit" value="发送">
</div>
</div>
</div>
</div>
</div>
</div>
<script>
function insertSend(content, time) {
var from =
'<li class=" current-user"> ' +
'<img width="30" height="30" src="images/avatar-female.jpg"/>' +
'<div class="bubble">' +
'<p class="message">' +
content +
'</p> <p class="time">' +
time +
'</p> </div> </li>'
;
$("#chatList").append(from);
}
function insertRecieve(name, content, time) {
var from = '<li>' +
'<img width="30" height="30" src="images/avatar-female.jpg"/>' +
'<div class="bubble">' +
'<label>' +
name +
'</label>' +
'<p class="message">' +
content +
'</p>' +
'<p class="time">' +
time +
'</p>' +
'</div>' +
'</li>';
$("#chatList").append(from);
}
$('.contact-list a').bind("click", function () {
name = $(this).text();
$.ajax({
type: 'get',
dataType: 'json',
data: {chat_with: name},
url: '/chat',
success: function (data, textStatus, jqXHR) {
$("#chatList").empty();
$('#chatwith').text(name);
for (var i = 0; i < data.length; i++) {
if (data[i]["issend"] == true) {
insertSend(data[i]["content"], data[i]["time"])
}
else {
insertRecieve(data[i]["send"], data[i]["content"], data[i]["time"]);
}
}
}
})
});
$("#msgSubmit").click(function () {
var text = $("#msg").val();
var chat_with_user = $("#chatwith").text();
console.log(chat_with_user);
$.ajax({
type: 'post',
data: {msg: text, chat_with: chat_with_user, authenticity_token: AUTH_TOKEN},
dataType: 'json',
url: '/newmsg',
success: function (data, textStatus, jqXHR) {
insertSend(data["msg"], data["time"]);
}
});
return false;
});
// var tock = setInterval('$(".icon-plus").click()',1000);
// $(document).ready(function () {
//
// });
</script>

View File

@ -1,84 +0,0 @@
<div class="navbar navbar-fixed-top scroll-hide">
<div class="container-fluid top-bar">
<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>
<ul class="dropdown-menu">
<li><a href="/users">
<i class="icon-user"></i>个人设置</a>
</li>
<li><a href="/logout">
<i class="icon-signout"></i>退出</a>
</li>
</ul>
</li>
</ul>
</div>
<a class="logo" href="#"></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>
<ul class="dropdown-menu">
<li>
<a href="#">失物信息</a>
</li>
<li>
<a href="#">组团信息</a>
</li>
</ul>
</li>
<li>
<a href="#"><span aria-hidden="true" class="se7en-home"></span>我的动态</a>
</li>
<li>
<a href="/chat">
<span aria-hidden="true" class="se7en-envelope"></span>
私信
<div id="msgNum" class="label label-info">0</div>
</a>
</li>
</ul>
</div>
</div>
</div>
<script>
function addNotifyLable(uniquename) {
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) {
$(results[i]).parent().append(yuandian);
}
}
}
function notify() {
$.ajax({
type: 'get',
dataType: 'json',
url: '/notify',
success: function (data, textStatus, jqXHR) {
$("#msgNum"
).text(data["unreaded"]);
}
});
return false;
}
var notify_num_ticker;
$(document).ready(function () {
notify();
notify_num_ticker = setInterval('notify()', 10000);
$("#msg").attr("disabled",true);
});
</script>

View File

@ -1,67 +0,0 @@
<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"/>
<link href="stylesheets/isotope.css" media="all" rel="stylesheet" type="text/css"/>
<link href="stylesheets/jquery.fancybox.css" media="all" rel="stylesheet" type="text/css"/>
<link href="stylesheets/fullcalendar.css" media="all" rel="stylesheet" type="text/css"/>
<link href="stylesheets/wizard.css" media="all" rel="stylesheet" type="text/css"/>
<link href="stylesheets/select2.css" media="all" rel="stylesheet" type="text/css"/>
<link href="stylesheets/morris.css" media="all" rel="stylesheet" type="text/css"/>
<link href="stylesheets/datatables.css" media="all" rel="stylesheet" type="text/css"/>
<link href="stylesheets/datepicker.css" media="all" rel="stylesheet" type="text/css"/>
<link href="stylesheets/timepicker.css" media="all" rel="stylesheet" type="text/css"/>
<link href="stylesheets/colorpicker.css" media="all" rel="stylesheet" type="text/css"/>
<link href="stylesheets/bootstrap-switch.css" media="all" rel="stylesheet" type="text/css"/>
<link href="stylesheets/daterange-picker.css" media="all" rel="stylesheet" type="text/css"/>
<link href="stylesheets/typeahead.css" media="all" rel="stylesheet" type="text/css"/>
<link href="stylesheets/summernote.css" media="all" rel="stylesheet" type="text/css"/>
<link href="stylesheets/pygments.css" media="all" rel="stylesheet" type="text/css"/>
<link href="stylesheets/style.css" media="all" rel="stylesheet" type="text/css"/>
<link href="stylesheets/color/green.css" media="all" rel="alternate stylesheet" title="green-theme"
type="text/css"/>
<link href="stylesheets/color/orange.css" media="all" rel="alternate stylesheet" title="orange-theme"
type="text/css"/>
<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/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>
<script src="javascripts/jquery.mousewheel.js" type="text/javascript"></script>
<script src="javascripts/jquery.vmap.min.js" type="text/javascript"></script>
<script src="javascripts/jquery.vmap.sampledata.js" type="text/javascript"></script>
<script src="javascripts/jquery.vmap.world.js" type="text/javascript"></script>
<script src="javascripts/jquery.bootstrap.wizard.js" type="text/javascript"></script>
<script src="javascripts/fullcalendar.min.js" type="text/javascript"></script>
<script src="javascripts/gcal.js" type="text/javascript"></script>
<script src="javascripts/jquery.dataTables.min.js" type="text/javascript"></script>
<script src="javascripts/datatable-editable.js" type="text/javascript"></script>
<script src="javascripts/jquery.easy-pie-chart.js" type="text/javascript"></script>
<script src="javascripts/excanvas.min.js" type="text/javascript"></script>
<script src="javascripts/jquery.isotope.min.js" type="text/javascript"></script>
<script src="javascripts/isotope_extras.js" type="text/javascript"></script>
<script src="javascripts/modernizr.custom.js" type="text/javascript"></script>
<script src="javascripts/jquery.fancybox.pack.js" type="text/javascript"></script>
<script src="javascripts/select2.js" type="text/javascript"></script>
<script src="javascripts/styleswitcher.js" type="text/javascript"></script>
<script src="javascripts/wysiwyg.js" type="text/javascript"></script>
<script src="javascripts/summernote.min.js" type="text/javascript"></script>
<script src="javascripts/jquery.inputmask.min.js" type="text/javascript"></script>
<script src="javascripts/jquery.validate.js" type="text/javascript"></script>
<script src="javascripts/bootstrap-fileupload.js" type="text/javascript"></script>
<script src="javascripts/bootstrap-datepicker.js" type="text/javascript"></script>
<script src="javascripts/bootstrap-timepicker.js" type="text/javascript"></script>
<script src="javascripts/bootstrap-colorpicker.js" type="text/javascript"></script>
<script src="javascripts/bootstrap-switch.min.js" type="text/javascript"></script>
<script src="javascripts/typeahead.js" type="text/javascript"></script>
<script src="javascripts/daterange-picker.js" type="text/javascript"></script>
<script src="javascripts/date.js" type="text/javascript"></script>
<script src="javascripts/morris.min.js" type="text/javascript"></script>
<script src="javascripts/skycons.js" type="text/javascript"></script>
<script src="javascripts/fitvids.js" type="text/javascript"></script>
<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>
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">

View File

@ -1 +0,0 @@
<title> <%= yield(:title) %> | 果仁 </title>

View File

@ -1,19 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<%= render 'layouts/title' %>
<%= javascript_tag "var AUTH_TOKEN = #{form_authenticity_token.inspect};" if protect_against_forgery? %>
<%= render 'layouts/refer' %>
</head>
<body class="<%= yield(:body_class) %>">
<% flash.each do |message_type, message| %>
<%= content_tag(:div, message, class: "alert alert-#{message_type}") %>
<% end %>
<%= yield %>
<%= debug(params) if Rails.env.development? %>
</body>
</html>

View File

@ -1,13 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
/* Email styles need to be inline */
</style>
</head>
<body>
<%= yield %>
</body>
</html>

View File

@ -1 +0,0 @@
<%= yield %>

View File

@ -1,36 +0,0 @@
<% provide(:title, '登陆') %>
<% provide(:body_class, 'login2') %>
<!-- Login Screen -->
<div class="login-wrapper">
<a href="#"><img width="210" height="70" src="images/logo/guoke.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="请输入登陆账号"
name="email"
type="text">
</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="password"
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>
<input class="btn btn-lg btn-primary btn-block" type="submit" value="登陆">
<% end %>
<p>
还没有果壳账号?
</p>
<%= link_to "注册新账户", signup_path, class: "btn btn-default-outline btn-block" %>
</div>
<!-- End Login Screen -->

View File

@ -1,210 +0,0 @@
<div class="modal-shiftfix">
<div class="container-fluid main-content">
<%= render 'layouts/nav' %>
<div class="row">
<div class="col-lg-12">
<div class="social-wrapper">
<div class="social-container">
<div class="social-entry">
<div class="widget-container fluid-height isotope-item">
<div class="profile-info clearfix padded">
<img width="50" height="50" class="social-avatar pull-left"
src="images/avatar-male2.png">
<div class="profile-details">
<a class="user-name" href="#">用户名称</a>
<p>
<em>发布时间</em>
</p>
</div>
</div>
<img width="300" height="200" class="social-content-media"
src="images/social-image.jpg">
<div class="padded">
<p class="content">发布的内容</p>
</div>
</div>
<div class="comments padded">
<div class="comment">
<img width="40" height="40" class="social-avatar pull-left"
src="images/avatar-female.png">
<div class="profile-details clearfix">
<a class="user-name" href="#">评论用户</a>
<p>
<em>评论时间</em>
</p>
</div>
<p class="content">
评论内容
</p>
</div>
<form role="form">
<div class="form-group">
<input class="form-control" placeholder="Add a comment..." type="text">
</div>
</form>
</div>
</div>
</div>
</div>
<div class="social-wrapper">
<div class="social-container">
<div class="social-entry">
<div class="widget-container fluid-height isotope-item">
<div class="profile-info clearfix padded">
<img width="50" height="50" class="social-avatar pull-left"
src="images/avatar-male2.png">
<div class="profile-details">
<a class="user-name" href="#">用户名称</a>
<p>
<em>发布时间</em>
</p>
</div>
</div>
<img width="300" height="200" class="social-content-media"
src="images/social-image.jpg">
<div class="padded">
<p class="content">发布的内容</p>
</div>
</div>
<div class="comments padded">
<div class="comment">
<img width="40" height="40" class="social-avatar pull-left"
src="images/avatar-female.png">
<div class="profile-details clearfix">
<a class="user-name" href="#">评论用户</a>
<p>
<em>评论时间</em>
</p>
</div>
<p class="content">
评论内容
</p>
</div>
<form role="form">
<div class="form-group">
<div class="form-group">
<input class="form-control" placeholder="Add a comment..." type="text">
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="social-wrapper">
<div class="social-container">
<div class="social-entry">
<div class="widget-container fluid-height isotope-item">
<div class="profile-info clearfix padded">
<img width="50" height="50" class="social-avatar pull-left"
src="images/avatar-male2.png">
<div class="profile-details">
<a class="user-name" href="#">用户名称</a>
<p>
<em>发布时间</em>
</p>
</div>
</div>
<div class="padded">
<p class="content">
的积分卡开始大家了解法律考试大家分开了贾老师的空间发了卡死了的解放军爱上的龙卷风阿斯兰的减肥了婕拉抗衰老的减肥了加拉克是大家拉来的解放军垃圾收来的快放假了阿里山的记录发来看埃里克圣诞节福利及拉得少两块街坊邻居拉来的减肥了垃圾是来得及 </p>
</div>
</div>
<div>
<button class="btn btn-block">显示评论</button>
</div>
<div class="comments padded hidden">
<div class="comment">
<img width="40" height="40" class="social-avatar pull-left"
src="images/avatar-female.png">
<div class="profile-details clearfix">
<a class="user-name" href="#">评论用户</a>
<p>
<em>评论时间</em>
</p>
</div>
<p class="content">
评论内容
</p>
</div>
<form role="form">
<div class="form-group">
<input class="form-control" id="exampleInputEmail1"
placeholder="Add a comment..."
type="email">
</div>
</form>
</div>
</div>
</div>
</div>
<div class="social-wrapper">
<div class="social-container">
<div class="social-entry">
<div class="widget-container fluid-height isotope-item">
<div class="profile-info clearfix padded">
<img width="50" height="50" class="social-avatar pull-left"
src="images/avatar-male2.png">
<div class="profile-details">
<a class="user-name" href="#">用户名称</a>
<p>
<em>发布时间</em>
</p>
</div>
</div>
<div class="padded">
<p class="content">
的积分卡开始大家了解法律考试大家分开了贾老师的空间发了卡死了的解放军爱上的龙卷风阿斯兰的减肥了婕拉抗衰老的减肥了加拉克是大家拉来的解放军垃圾收来的快放假了阿里山的记录发来看埃里克圣诞节福利及拉得少两块街坊邻居拉来的减肥了垃圾是来得及 </p>
</div>
<div class="social-button">
<button class="btn btn-success-outline" style="margin: 10px 10px 10px 10px">报名参加
</button>
</div>
</div>
<div class="comments padded hidden">
<div class="comment">
<img width="40" height="40" class="social-avatar pull-left"
src="images/avatar-female.png">
<div class="profile-details clearfix">
<a class="user-name" href="#">评论用户</a>
<p>
<em>评论时间</em>
</p>
</div>
<p class="content">
评论内容
</p>
</div>
<form role="form">
<div class="form-group">
<input class="form-control" id="exampleInputEmail1"
placeholder="Add a comment..."
type="email">
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<nav style="text-align: center">
<ul class="pagination">
<li><a href="#">&laquo;</a></li>
<li><a href="#">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">4</a></li>
<li><a href="#">5</a></li>
<li><a href="#">&raquo;</a></li>
</ul>
</nav>
</div>
</div>
</div>

View File

@ -1,12 +0,0 @@
<% if object.errors.any? %>
<div id="error_explanation">
<div class="alert alert-danger">
The form contains <%= pluralize(object.errors.count, "error") %>.
</div>
<ul>
<% object.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>

View File

@ -1,48 +0,0 @@
<% provide(:title, '用户注册') %>
<% provide(:body_class, 'login2') %>
<div class="login-wrapper">
<a href="#"><img width="210" height="70" src="images/logo/guoke.png"/></a>
<%= form_for(@user) 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-user"></i></span>
<%= f.text_field :name, class: 'form-control', placeholder: "请输入名称" %>
</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 %>
<p>
已经有果壳账号?
</p>
<%= link_to "登陆", login_path, class: "btn btn-default-outline btn-block" %>
</div>

View File

@ -1,12 +0,0 @@
Message.create(content:"hello",send_user:5,recieve_user:6,create_time:DateTime.now,readed:false)
user.send_messages.find_by(send_user:user.id)[:recieve_user]
user.send_messages.select("recieve_user").
user.send_messages.select(:recieve_user).find(1).recieve_user
Message.where(send_user:5,recieve_user:6)
Message.where(send_user:[6,8],recieve_user:[6,8]).select(:send_user,:recieve_user)
user.recieve_messages.where(readed: false).count

View File

@ -1,3 +0,0 @@
#!/usr/bin/env ruby
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
load Gem.bin_path('bundler', 'bundle')

View File

@ -1,9 +0,0 @@
#!/usr/bin/env ruby
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'

View File

@ -1,9 +0,0 @@
#!/usr/bin/env ruby
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
require_relative '../config/boot'
require 'rake'
Rake.application.run

View File

@ -1,34 +0,0 @@
#!/usr/bin/env ruby
require 'pathname'
require 'fileutils'
include FileUtils
# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end
chdir APP_ROOT do
# This script is a starting point to setup your application.
# Add necessary setup steps to this file.
puts '== Installing dependencies =='
system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install')
# puts "\n== Copying sample files =="
# unless File.exist?('config/database.yml')
# cp 'config/database.yml.sample', 'config/database.yml'
# end
puts "\n== Preparing database =="
system! 'bin/rails db:setup'
puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear'
puts "\n== Restarting application server =="
system! 'bin/rails restart'
end

View File

@ -1,16 +0,0 @@
#!/usr/bin/env ruby
# This file loads spring without using Bundler, in order to be fast.
# It gets overwritten when you run the `spring binstub` command.
unless defined?(Spring)
require 'rubygems'
require 'bundler'
lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
if spring = lockfile.specs.detect { |spec| spec.name == "spring" }
Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
gem 'spring', spring.version
require 'spring/binstub'
end
end

View File

@ -1,29 +0,0 @@
#!/usr/bin/env ruby
require 'pathname'
require 'fileutils'
include FileUtils
# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end
chdir APP_ROOT do
# This script is a way to update your development environment automatically.
# Add necessary update steps to this file.
puts '== Installing dependencies =='
system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install')
puts "\n== Updating database =="
system! 'bin/rails db:migrate'
puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear'
puts "\n== Restarting application server =="
system! 'bin/rails restart'
end

View File

@ -1,5 +0,0 @@
# This file is used by Rack-based servers to start the application.
require_relative 'config/environment'
run Rails.application

View File

@ -1,15 +0,0 @@
require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module GuorenPro
class Application < Rails::Application
# 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.
end
end

View File

@ -1,3 +0,0 @@
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
require 'bundler/setup' # Set up gems listed in the Gemfile.

View File

@ -1,9 +0,0 @@
development:
adapter: async
test:
adapter: async
production:
adapter: redis
url: redis://localhost:6379/1

View File

@ -1,25 +0,0 @@
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
#
default: &default
adapter: sqlite3
pool: 5
timeout: 5000
development:
<<: *default
database: db/development.sqlite3
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: db/test.sqlite3
production:
<<: *default
database: db/production.sqlite3

View File

@ -1,5 +0,0 @@
# Load the Rails application.
require_relative 'application'
# Initialize the Rails application.
Rails.application.initialize!

View File

@ -1,54 +0,0 @@
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports.
config.consider_all_requests_local = true
# Enable/disable caching. By default caching is disabled.
if Rails.root.join('tmp/caching-dev.txt').exist?
config.action_controller.perform_caching = true
config.cache_store = :memory_store
config.public_file_server.headers = {
'Cache-Control' => 'public, max-age=172800'
}
else
config.action_controller.perform_caching = false
config.cache_store = :null_store
end
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
config.action_mailer.perform_caching = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Suppress logger output for asset requests.
config.assets.quiet = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
# 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
end

View File

@ -1,86 +0,0 @@
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Mount Action Cable outside main process or domain
# config.action_cable.mount_path = nil
# config.action_cable.url = 'wss://example.com/cable'
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :debug
# Prepend all log lines with the following tags.
config.log_tags = [ :request_id ]
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Use a real queuing backend for Active Job (and separate queues per environment)
# config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "guorenPro_#{Rails.env}"
config.action_mailer.perform_caching = false
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Use a different logger for distributed setups.
# require 'syslog/logger'
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
end

View File

@ -1,42 +0,0 @@
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
# Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
'Cache-Control' => 'public, max-age=3600'
}
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false
config.action_mailer.perform_caching = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end

View File

@ -1,6 +0,0 @@
# Be sure to restart your server when you modify this file.
# ApplicationController.renderer.defaults.merge!(
# http_host: 'example.org',
# https: false
# )

View File

@ -1,11 +0,0 @@
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path
# Rails.application.config.assets.paths << Emoji.images_path
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# Rails.application.config.assets.precompile += %w( search.js )

View File

@ -1,7 +0,0 @@
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers!

View File

@ -1,5 +0,0 @@
# Be sure to restart your server when you modify this file.
# Specify a serializer for the signed and encrypted cookie jars.
# Valid options are :json, :marshal, and :hybrid.
Rails.application.config.action_dispatch.cookies_serializer = :json

View File

@ -1,4 +0,0 @@
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password]

View File

@ -1,16 +0,0 @@
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end
# These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym 'RESTful'
# end

View File

@ -1,4 +0,0 @@
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf

View File

@ -1,24 +0,0 @@
# Be sure to restart your server when you modify this file.
#
# This file contains migration options to ease your Rails 5.0 upgrade.
#
# Read the Rails 5.0 release notes for more info on each option.
# Enable per-form CSRF tokens. Previous versions had false.
Rails.application.config.action_controller.per_form_csrf_tokens = true
# Enable origin-checking CSRF mitigation. Previous versions had false.
Rails.application.config.action_controller.forgery_protection_origin_check = true
# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
# Previous versions had false.
ActiveSupport.to_time_preserves_timezone = true
# Require `belongs_to` associations by default. Previous versions had false.
Rails.application.config.active_record.belongs_to_required_by_default = true
# Do not halt callback chains when a callback returns false. Previous versions had true.
ActiveSupport.halt_callback_chains_on_return_false = false
# Configure SSL options to enable HSTS with subdomains. Previous versions had false.
Rails.application.config.ssl_options = { hsts: { subdomains: true } }

View File

@ -1,3 +0,0 @@
# Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_guorenPro_session'

View File

@ -1,14 +0,0 @@
# Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters format: [:json]
end
# To enable root element in JSON for ActiveRecord objects.
# ActiveSupport.on_load(:active_record) do
# self.include_root_in_json = true
# end

View File

@ -1,23 +0,0 @@
# Files in the config/locales directory are used for internationalization
# and are automatically loaded by Rails. If you want to use locales other
# than English, add the necessary files in this directory.
#
# To use the locales, use `I18n.t`:
#
# I18n.t 'hello'
#
# In views, this is aliased to just `t`:
#
# <%= t('hello') %>
#
# To use a different locale, set it with `I18n.locale`:
#
# I18n.locale = :es
#
# This would use the information in config/locales/es.yml.
#
# To learn more, please read the Rails Internationalization guide
# available at http://guides.rubyonrails.org/i18n.html.
en:
hello: "Hello world"

View File

@ -1,47 +0,0 @@
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum, this matches the default thread size of Active Record.
#
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
threads threads_count, threads_count
# Specifies the `port` that Puma will listen on to receive requests, default is 3000.
#
port ENV.fetch("PORT") { 3000 }
# Specifies the `environment` that Puma will run in.
#
environment ENV.fetch("RAILS_ENV") { "development" }
# Specifies the number of `workers` to boot in clustered mode.
# Workers are forked webserver processes. If using threads and workers together
# the concurrency of the application would be max `threads` * `workers`.
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
#
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write
# process behavior so workers use less memory. If you use this option
# you need to make sure to reconnect any threads in the `on_worker_boot`
# block.
#
# preload_app!
# The code in the `on_worker_boot` will be called if you are using
# clustered mode by specifying a number of `workers`. After each worker
# process is booted this block will be run, if you are using `preload_app!`
# option you will want to use this block to reconnect to any threads
# or connections that may have been created at application boot, Ruby
# cannot shared connections between processes.
#
# on_worker_boot do
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
# end
# Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart

View File

@ -1,21 +0,0 @@
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 '/main', to: 'main#show'
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'
resource :users
end

View File

@ -1,22 +0,0 @@
# Be sure to restart your server when you modify this file.
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
# You can use `rails secret` to generate a secure secret key.
# Make sure the secrets in this file are kept private
# if you're sharing your code publicly.
development:
secret_key_base: 8ab3235e7dc44697c9e006fd6671c54febf98219061b0d4dbff2fa773a193a2065a27e6c346d89ea3c2744c583ae55c39cc11961680df1fb60ccc075234ba0a9
test:
secret_key_base: 85eb5cb87c57f0a3d3d6f274489afbb7207608a4d95ac2faf5f7c3f5994aa96de132ab3b4a413cccf59542841e9d244bdb213f58d15942fcc4591871f31c28c5
# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>

View File

@ -1,6 +0,0 @@
%w(
.ruby-version
.rbenv-vars
tmp/restart.txt
tmp/caching-dev.txt
).each { |path| Spring.watch(path) }

View File

@ -1,14 +0,0 @@
class CreateUsers < ActiveRecord::Migration[5.0]
def change
create_table :users do |t|
t.string :name, unique: true
t.string :email, unique: true
t.string :picurl
t.string :profession
t.string :academy
t.boolean :sexual
t.timestamps
end
end
end

View File

@ -1,12 +0,0 @@
class CreateMessages < ActiveRecord::Migration[5.0]
def change
create_table :messages do |t|
t.text :content
t.integer :send_user
t.integer :recieve_user
t.datetime :create_time
t.boolean :readed
t.timestampcs
end
end
end

View File

@ -1,5 +0,0 @@
class AddPasswordDigestToUsers < ActiveRecord::Migration[5.0]
def change
add_column :users, :password_digest, :string
end
end

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