zy: change utc time

This commit is contained in:
lovelyzhang 2016-12-26 11:00:51 +08:00
parent dcdd5a225a
commit 3fe03812e9
14 changed files with 2678 additions and 146 deletions

4
.gitignore vendored
View File

@ -1,3 +1,4 @@
# Ruby的忽略文件
*.gem
*.rbc
/.config
@ -49,8 +50,11 @@ build-iPhoneSimulator/
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc
# JetBrain的忽略文件
.idea/*
# rails的忽略文件
*.rbc
capybara-*.html
.rspec

View File

@ -2,8 +2,18 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="585b6f0a-0d20-4a3c-825b-5f85848cbf40" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/db/development.sqlite3" afterPath="$PROJECT_DIR$/db/development.sqlite3" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.gitignore" afterPath="$PROJECT_DIR$/.gitignore" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/controllers/application_controller.rb" afterPath="$PROJECT_DIR$/app/controllers/application_controller.rb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/controllers/comments_controller.rb" afterPath="$PROJECT_DIR$/app/controllers/comments_controller.rb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/controllers/micro_posts_controller.rb" afterPath="$PROJECT_DIR$/app/controllers/micro_posts_controller.rb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/controllers/users_controller.rb" afterPath="$PROJECT_DIR$/app/controllers/users_controller.rb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/helpers/application_helper.rb" afterPath="$PROJECT_DIR$/app/helpers/application_helper.rb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/helpers/chat_helper.rb" afterPath="$PROJECT_DIR$/app/helpers/chat_helper.rb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/helpers/main_helper.rb" afterPath="$PROJECT_DIR$/app/helpers/main_helper.rb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/helpers/micro_posts_helper.rb" afterPath="$PROJECT_DIR$/app/helpers/micro_posts_helper.rb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/helpers/users_helper.rb" afterPath="$PROJECT_DIR$/app/helpers/users_helper.rb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/views/micro_posts/show.html.erb" afterPath="$PROJECT_DIR$/app/views/micro_posts/show.html.erb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/log/development.log" afterPath="$PROJECT_DIR$/log/development.log" />
</list>
@ -23,7 +33,7 @@
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="CoverageDataManager">
<SUITE FILE_PATH="coverage/guoren@Development__guoren.coverage" NAME="Development: guoren Coverage Results" MODIFIED="1482668881238" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="guoren" />
<SUITE FILE_PATH="coverage/guoren@Development__guoren.coverage" NAME="Development: guoren Coverage Results" MODIFIED="1482720275844" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="guoren" />
</component>
<component name="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value="" />
@ -34,55 +44,11 @@
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="show.html.erb" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/views/micro_posts/show.html.erb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="153">
<caret line="117" column="83" selection-start-line="117" selection-start-column="83" selection-end-line="117" selection-end-column="83" />
<folding>
<element signature="n#style#0;n#div#1;n#div#0;n#div#0;n#div#3;n#div#0;n#row#0;n#div#0;n#div#0;n#!!top" expanded="true" />
<marker date="1482668271000" expanded="true" signature="3345:3351" ph=" " />
<marker date="1482668271000" expanded="true" signature="3965:3977" ph="..." />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="micro_posts_controller.rb" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/app/controllers/micro_posts_controller.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="51">
<caret line="3" column="2" selection-start-line="3" selection-start-column="2" selection-end-line="3" selection-end-column="2" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="user.rb" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/models/user.rb">
<file leaf-file-name=".gitignore" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/.gitignore">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="users_controller.rb" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/controllers/users_controller.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="users_helper.rb" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/helpers/users_helper.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="34">
<caret line="2" column="61" selection-start-line="2" selection-start-column="18" selection-end-line="2" selection-end-column="61" />
<caret line="0" column="6" selection-start-line="0" selection-start-column="6" selection-end-line="0" selection-end-column="6" />
<folding />
</state>
</provider>
@ -98,14 +64,22 @@
<list>
<option value="$PROJECT_DIR$/Gemfile" />
<option value="$PROJECT_DIR$/tmp/pids/server.pid" />
<option value="$PROJECT_DIR$/.gitignore" />
<option value="$PROJECT_DIR$/app/controllers/main_controller.rb" />
<option value="$PROJECT_DIR$/public/stylesheets/mystyle.css" />
<option value="$PROJECT_DIR$/log/development.log" />
<option value="$PROJECT_DIR$/app/views/main/main.html.erb" />
<option value="$PROJECT_DIR$/app/views/chat/index.html.erb" />
<option value="$PROJECT_DIR$/app/views/micro_posts/show.html.erb" />
<option value="$PROJECT_DIR$/app/helpers/main_helper.rb" />
<option value="$PROJECT_DIR$/app/helpers/micro_posts_helper.rb" />
<option value="$PROJECT_DIR$/app/helpers/users_helper.rb" />
<option value="$PROJECT_DIR$/app/controllers/micro_posts_controller.rb" />
<option value="$PROJECT_DIR$/app/controllers/application_controller.rb" />
<option value="$PROJECT_DIR$/app/controllers/comments_controller.rb" />
<option value="$PROJECT_DIR$/app/controllers/users_controller.rb" />
<option value="$PROJECT_DIR$/app/helpers/chat_helper.rb" />
<option value="$PROJECT_DIR$/app/helpers/application_helper.rb" />
<option value="$PROJECT_DIR$/.gitignore" />
</list>
</option>
</component>
@ -224,6 +198,50 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="guoren" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="guoren" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="app" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="views" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="micro_posts" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="guoren" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="guoren" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="app" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="views" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="main" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="guoren" />
@ -457,6 +475,9 @@
<component name="ShelveChangesManager" show_recycled="false">
<option name="remove_strategy" value="false" />
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="585b6f0a-0d20-4a3c-825b-5f85848cbf40" name="Default" comment="" />
@ -465,15 +486,15 @@
<option name="presentableId" value="Default" />
<updated>1482659541785</updated>
<workItem from="1482659543437" duration="1781000" />
<workItem from="1482662034465" duration="6870000" />
<workItem from="1482662034465" duration="9608000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="8651000" />
<option name="totallyTimeSpent" value="11389000" />
</component>
<component name="ToolWindowManager">
<frame x="0" y="23" width="1440" height="804" extended-state="6" />
<frame x="0" y="23" width="1440" height="804" extended-state="0" />
<editor active="true" />
<layout>
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.19670959" sideWeight="0.49292928" order="0" side_tool="false" content_ui="combo" />
@ -482,11 +503,11 @@
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3292683" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3292683" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3292683" sideWeight="0.49713877" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3292683" sideWeight="0.49713877" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.3292683" sideWeight="0.49427754" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.19670959" sideWeight="0.5070707" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.39972898" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.39972898" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3292683" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
@ -512,13 +533,6 @@
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="ruby-line">
<url>file://$PROJECT_DIR$/app/controllers/micro_posts_controller.rb</url>
<line>18</line>
<option name="timeStamp" value="4" />
</line-breakpoint>
</breakpoints>
<option name="time" value="5" />
</breakpoint-manager>
<watches-manager>
@ -555,14 +569,6 @@
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/tmp/pids/server.pid" />
<entry file="file://$PROJECT_DIR$/app/controllers/comments_controller.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/public/stylesheets/style.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
@ -595,14 +601,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/.gitignore">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="8">
<caret line="77" column="14" selection-start-line="77" selection-start-column="14" selection-end-line="77" selection-end-column="14" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Gemfile">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
@ -611,30 +609,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/views/main/main.html.erb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="529">
<caret line="176" column="28" selection-start-line="176" selection-start-column="4" selection-end-line="176" selection-end-column="28" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/controllers/main_controller.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="272">
<caret line="20" column="7" selection-start-line="20" selection-start-column="7" selection-end-line="20" selection-end-column="7" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/controllers/chat_controller.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/views/chat/index.html.erb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="3536">
@ -651,18 +625,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/views/micro_posts/show.html.erb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="153">
<caret line="117" column="83" selection-start-line="117" selection-start-column="83" selection-end-line="117" selection-end-column="83" />
<folding>
<element signature="n#style#0;n#div#1;n#div#0;n#div#0;n#div#3;n#div#0;n#row#0;n#div#0;n#div#0;n#!!top" expanded="true" />
<marker date="1482668271000" expanded="true" signature="3345:3351" ph=" " />
<marker date="1482668271000" expanded="true" signature="3965:3977" ph="..." />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/models/user.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
@ -671,7 +633,15 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/controllers/users_controller.rb">
<entry file="file://$PROJECT_DIR$/app/views/main/main.html.erb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="374">
<caret line="22" column="28" selection-start-line="22" selection-start-column="28" selection-end-line="22" selection-end-column="28" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/models/micro_post.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
@ -679,18 +649,125 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/views/micro_posts/show.html.erb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="334">
<caret line="78" column="0" selection-start-line="78" selection-start-column="0" selection-end-line="78" selection-end-column="0" />
<folding>
<marker date="1482720228000" expanded="true" signature="3425:3431" ph=" " />
<marker date="1482720228000" expanded="true" signature="4045:4057" ph="..." />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/helpers/users_helper.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="34">
<caret line="2" column="61" selection-start-line="2" selection-start-column="18" selection-end-line="2" selection-end-column="61" />
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/helpers/login_helper.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/helpers/micro_posts_helper.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="323">
<caret line="19" column="11" selection-start-line="19" selection-start-column="11" selection-end-line="19" selection-end-column="11" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/controllers/micro_posts_controller.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="51">
<caret line="3" column="2" selection-start-line="3" selection-start-column="2" selection-end-line="3" selection-end-column="2" />
<state relative-caret-position="204">
<caret line="12" column="24" selection-start-line="0" selection-start-column="0" selection-end-line="37" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/helpers/main_helper.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="391">
<caret line="23" column="59" selection-start-line="0" selection-start-column="0" selection-end-line="31" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/controllers/users_controller.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="102">
<caret line="6" column="30" selection-start-line="6" selection-start-column="30" selection-end-line="6" selection-end-column="30" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/helpers/application_helper.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="34">
<caret line="2" column="26" selection-start-line="2" selection-start-column="26" selection-end-line="2" selection-end-column="26" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/helpers/chat_helper.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="442">
<caret line="56" column="11" selection-start-line="56" selection-start-column="11" selection-end-line="56" selection-end-column="11" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/controllers/application_controller.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="85">
<caret line="5" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="15" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/controllers/chat_controller.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="187">
<caret line="11" column="30" selection-start-line="0" selection-start-column="0" selection-end-line="95" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/controllers/comments_controller.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="204">
<caret line="12" column="24" selection-start-line="0" selection-start-column="0" selection-end-line="23" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/controllers/login_controller.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="221">
<caret line="13" column="18" selection-start-line="0" selection-start-column="0" selection-end-line="27" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/controllers/main_controller.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="221">
<caret line="13" column="23" selection-start-line="0" selection-start-column="0" selection-end-line="28" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/.gitignore">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="6" selection-start-line="0" selection-start-column="6" selection-end-line="0" selection-end-column="6" />
<folding />
</state>
</provider>

View File

@ -1,8 +1,8 @@
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
include ApplicationHelper
include LoginHelper
include UsersHelper
include MicroPostsHelper
# Confirms a logged-in user.

View File

@ -4,7 +4,7 @@ class CommentsController < ApplicationController
def get
micropost_id = params["micropost_id"]
micropost_comments = get_micropost_comments micropost_id
render json: {comments:micropost_comments}
render json: {comments: micropost_comments}
end
def new
@ -14,7 +14,7 @@ class CommentsController < ApplicationController
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 = @user.comments.new(content: content, micro_post_id: micropost_id, comment_time: DateTime.now)
comments.save
end
render json: {username: username, userpic: userpic}

View File

@ -1,4 +1,5 @@
class MicroPostsController < ApplicationController
include MicroPostsHelper
before_action :logged_in_user
micro_posts_dir = "public/data"
@ -15,16 +16,19 @@ class MicroPostsController < ApplicationController
title = params[:title].to_s
content = params[:content].to_s
pictures = params[:pictures]
if pictures
pictures.each do |pic|
pic.original_filename
ext = File.extname(pic.original_filename)
save_name = Digest::MD5::hexdigest(pic.original_filename) + ext
p save_name
end
end
if post_type >= 1 and post_type <= 3 and !title.empty? and !content.empty?
micropost = @user.micro_posts.new(content:content,post_time:DateTime.now,title:title,
post_type:post_type,engage_people:0)
micropost = @user.micro_posts.new(content: content, post_time: DateTime.now, title: title,
post_type: post_type, engage_people: 0)
micropost.save
end
redirect_to microposts_path

View File

@ -2,6 +2,7 @@ class UsersController < ApplicationController
def new
@user = User.new
end
def create
@user = User.new(user_params)
if @user.save

View File

@ -1,3 +1,8 @@
module ApplicationHelper
def utc_time_to_local utctime
# 将数据库中的UTC时间转换为本地时间
return utctime.localtime.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,6 +31,7 @@ module ChatHelper
end
def process_messages(user, chat_with)
# 处理用户对话(消息)
results = []
Message.transaction do
@ -40,13 +42,13 @@ module ChatHelper
messages = messages.order(create_time: :asc)
messages.each do |message|
if message.send_user == user.id
x = {issend: true, name: user.name, userpic:user.picurl,
content: message.content, time: message.create_time}
x = {issend: true, name: user.name, userpic: user.picurl,
content: message.content, time: utc_time_to_local(message.create_time)}
else
message.readed = true
message.save
x = {issend: false, name: chat_with.name, userpic:chat_with.picurl,
content: message.content, time: message.create_time}
x = {issend: false, name: chat_with.name, userpic: chat_with.picurl,
content: message.content, time: utc_time_to_local(message.create_time)}
end
results << x
end
@ -56,11 +58,12 @@ module ChatHelper
end
def unread_msg_num user
# 未读消息数目
user.recieve_messages.where(readed: false).count
end
def unread_msg_users user
# 未读消息的用户
return_user_msg = {}
results = user.recieve_messages.where(readed: false)
if results.length != 0

View File

@ -21,7 +21,7 @@ module MainHelper
else
x["type"] = "新鲜事"
end
x["time"] = micro_post.post_time
x["time"] = utc_time_to_local(micro_post.post_time)
x["peo_num"] = micro_post.engage_people
micro_posts_array << x
end

View File

@ -18,7 +18,7 @@ module MicroPostsHelper
else
x["type"] = "新鲜事"
end
x["time"] = micro_post.post_time
x["time"] = utc_time_to_local(micro_post.post_time)
x["peo_num"] = micro_post.engage_people
micro_posts_array << x
end
@ -27,5 +27,4 @@ module MicroPostsHelper
end
end

View File

@ -1,7 +1 @@
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/avatars/#{gravatar_id}?s=#{size}"
end
end

View File

@ -61,6 +61,7 @@
<row class="posts">
<% @micro_posts.each do |micro_post| %>
<div class="widget-container fluid-height clearfix">
<button class="close" data-dismiss="alert" type="button">×</button>
<div class="heading">
<i class="icon-tags"><%= micro_post["title"] %></i>
<div class="label label-default"></div>

Binary file not shown.

File diff suppressed because it is too large Load Diff