Merge remote-tracking branch 'origin/dev_zanle' into szzh

Conflicts:
	Gemfile
	app/views/welcome/index.html.erb
This commit is contained in:
lizanle 2015-01-14 16:15:09 +08:00
commit aca74bf937
44 changed files with 317 additions and 112 deletions

3
.gitignore vendored
View File

@ -6,7 +6,8 @@
/config/database.yml
/files/*
/log/*
/tmp/*
/public/tmp/*
/public/cache/*
.gitignore
/public/images/avatars/*
/Gemfile

View File

@ -209,3 +209,111 @@ java.lang.UnsupportedOperationException: Not supported yet.
at com.aptana.index.core.IndexRequestJob.indexFileStores(IndexRequestJob.java:205)
at com.aptana.index.core.IndexContainerJob.run(IndexContainerJob.java:114)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
!SESSION 2015-01-05 10:21:34.093 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_24
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=zh_CN
Command-line arguments: -os win32 -ws win32 -arch x86
!ENTRY org.eclipse.core.resources 4 567 2015-01-05 10:21:56.435
!MESSAGE Workspace restored, but some problems occurred.
!SUBENTRY 1 org.eclipse.core.resources 4 567 2015-01-05 10:21:56.435
!MESSAGE Could not read metadata for 'demo'.
!STACK 1
org.eclipse.core.internal.resources.ResourceException: The project description file (.project) for 'demo' is missing. This file contains important information about the project. The project will not function properly until this file is restored.
at org.eclipse.core.internal.localstore.FileSystemResourceManager.read(FileSystemResourceManager.java:851)
at org.eclipse.core.internal.resources.SaveManager.restoreMetaInfo(SaveManager.java:874)
at org.eclipse.core.internal.resources.SaveManager.restoreMetaInfo(SaveManager.java:854)
at org.eclipse.core.internal.resources.SaveManager.restore(SaveManager.java:703)
at org.eclipse.core.internal.resources.SaveManager.startup(SaveManager.java:1528)
at org.eclipse.core.internal.resources.Workspace.startup(Workspace.java:2503)
at org.eclipse.core.internal.resources.Workspace.open(Workspace.java:2251)
at org.eclipse.core.resources.ResourcesPlugin.start(ResourcesPlugin.java:439)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:299)
at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:440)
at org.eclipse.osgi.internal.loader.BundleLoader.setLazyTrigger(BundleLoader.java:268)
at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:107)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:463)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)
at org.eclipse.osgi.internal.loader.SingleSourcePackage.loadClass(SingleSourcePackage.java:35)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:473)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.aptana.rcp.IDEApplication.start(IDEApplication.java:125)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
!SUBENTRY 2 org.eclipse.core.resources 4 567 2015-01-05 10:21:56.435
!MESSAGE The project description file (.project) for 'demo' is missing. This file contains important information about the project. The project will not function properly until this file is restored.
!ENTRY com.aptana.terminal 1 0 2015-01-05 10:22:03.546
!MESSAGE Starting terminal process failed.
!STACK 1
org.eclipse.core.runtime.CoreException: Shell executable could not be found.
at com.aptana.core.ShellExecutable.getPath(ShellExecutable.java:113)
at com.aptana.terminal.internal.configurations.WindowsMingwConfiguration.getCommandLine(WindowsMingwConfiguration.java:40)
at com.aptana.terminal.internal.ProcessLauncher.launch(ProcessLauncher.java:38)
at com.aptana.terminal.connector.LocalTerminalConnector.startProcess(LocalTerminalConnector.java:220)
at com.aptana.terminal.connector.LocalTerminalConnector.access$0(LocalTerminalConnector.java:208)
at com.aptana.terminal.connector.LocalTerminalConnector$1.run(LocalTerminalConnector.java:102)
!SUBENTRY 1 com.aptana.core 4 0 2015-01-05 10:22:03.546
!MESSAGE Shell executable could not be found.
!ENTRY org.eclipse.core.jobs 2 2 2015-01-05 10:27:30.988
!MESSAGE Job found still running after platform shutdown. Jobs should be canceled by the plugin that scheduled them during shutdown: org.eclipse.tm.internal.terminal.emulator.VT100TerminalControl$1
!ENTRY org.eclipse.core.jobs 2 2 2015-01-05 10:27:30.989
!MESSAGE Job found still running after platform shutdown. Jobs should be canceled by the plugin that scheduled them during shutdown: com.aptana.usage.internal.DefaultAnalyticsEventHandler$1
!SESSION 2015-01-05 10:27:31.720 -----------------------------------------------
eclipse.buildId=3.4.2.201308081805
java.version=1.6.0_24
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=zh_CN
Command-line arguments: -os win32 -ws win32 -arch x86
!ENTRY com.aptana.terminal 1 0 2015-01-05 10:27:34.915
!MESSAGE Starting terminal process failed.
!STACK 1
org.eclipse.core.runtime.CoreException: Shell executable could not be found.
at com.aptana.core.ShellExecutable.getPath(ShellExecutable.java:113)
at com.aptana.terminal.internal.configurations.WindowsMingwConfiguration.getCommandLine(WindowsMingwConfiguration.java:40)
at com.aptana.terminal.internal.ProcessLauncher.launch(ProcessLauncher.java:38)
at com.aptana.terminal.connector.LocalTerminalConnector.startProcess(LocalTerminalConnector.java:220)
at com.aptana.terminal.connector.LocalTerminalConnector.access$0(LocalTerminalConnector.java:208)
at com.aptana.terminal.connector.LocalTerminalConnector$1.run(LocalTerminalConnector.java:102)
!SUBENTRY 1 com.aptana.core 4 0 2015-01-05 10:27:34.915
!MESSAGE Shell executable could not be found.
!ENTRY com.aptana.terminal 1 0 2015-01-05 10:27:37.984
!MESSAGE Starting terminal process failed.
!STACK 1
org.eclipse.core.runtime.CoreException: Shell executable could not be found.
at com.aptana.core.ShellExecutable.getPath(ShellExecutable.java:113)
at com.aptana.terminal.internal.configurations.WindowsMingwConfiguration.getCommandLine(WindowsMingwConfiguration.java:40)
at com.aptana.terminal.internal.ProcessLauncher.launch(ProcessLauncher.java:38)
at com.aptana.terminal.connector.LocalTerminalConnector.startProcess(LocalTerminalConnector.java:220)
at com.aptana.terminal.connector.LocalTerminalConnector.access$0(LocalTerminalConnector.java:208)
at com.aptana.terminal.connector.LocalTerminalConnector$1.run(LocalTerminalConnector.java:102)
!SUBENTRY 1 com.aptana.core 4 0 2015-01-05 10:27:37.984
!MESSAGE Shell executable could not be found.
!ENTRY org.eclipse.core.jobs 2 2 2015-01-05 10:27:55.438
!MESSAGE Job found still running after platform shutdown. Jobs should be canceled by the plugin that scheduled them during shutdown: org.eclipse.tm.internal.terminal.emulator.VT100TerminalControl$1

View File

@ -2,6 +2,6 @@
<connection>
<connection>
<name>Default</name>
<source>file:/C:/Users/nudt</source>
<source>file:/C:/Users/Administrator</source>
</connection>
</connection>

View File

@ -0,0 +1,3 @@
#safe table
#Mon Jan 05 10:27:54 CST 2015
connections=connections.15

View File

@ -1,3 +0,0 @@
#safe table
#Tue Mar 11 17:27:27 CST 2014
connections=connections.9

View File

@ -0,0 +1,4 @@
#safe table
#Mon Jan 05 10:27:54 CST 2015
defaultConnection=defaultConnection.15
sites=sites.15

View File

@ -1,4 +0,0 @@
#safe table
#Tue Mar 11 17:27:27 CST 2014
defaultConnection=defaultConnection.9
sites=sites.9

View File

@ -0,0 +1,3 @@
#safe table
#Mon Jan 05 10:27:28 CST 2015
webservers=webservers.12

View File

@ -1,3 +0,0 @@
#safe table
#Tue Mar 11 17:27:27 CST 2014
webservers=webservers.8

View File

@ -1,2 +1,2 @@
eclipse.preferences.version=1
last_known_studio_version=3.4.0.1358388620
last_known_studio_version=3.4.2.1368863613

View File

@ -1,7 +1,7 @@
ACTIVE_HYPERLINK_COLOR=84,143,160
ACTIVE_THEME=Aptana Studio
HYPERLINK_COLOR=84,143,160
THEME_CHANGED=1394527579080
THEME_CHANGED=1420424854199
eclipse.preferences.version=1
hyperlinkColor=84,143,160
hyperlinkColor.SystemDefault=false

View File

@ -2,6 +2,6 @@ PROBLEMS_FILTERS_MIGRATE=true
SHOW_COOLBAR=true
SHOW_PERSPECTIVEBAR=true
eclipse.preferences.version=1
platformState=1394526372425
platformState=1420424495377
quickStart=false
tipsAndTricks=true

View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<session version="1.0">&#x0A;<refactoring comment="Delete resource &apos;trustie2&apos;" deleteContents="false" description="Delete resource &apos;trustie2&apos;" element1="/trustie2" flags="7" id="org.eclipse.ltk.core.refactoring.delete.resources" resources="1" stamp="1420424676858"/>&#x0A;<refactoring comment="Delete resource &apos;trustie2&apos;" deleteContents="false" description="Delete resource &apos;trustie2&apos;" element1="/trustie2" flags="7" id="org.eclipse.ltk.core.refactoring.delete.resources" resources="1" stamp="1420424775104"/>
</session>

View File

@ -0,0 +1,2 @@
1420424676858 Delete resource 'trustie2'
1420424775104 Delete resource 'trustie2'

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<section name="Workbench">
<section name="RefactoringWizard.preview">
<item value="400" key="height"/>
<item value="600" key="width"/>
</section>
</section>

View File

@ -1,14 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<section name="Workbench">
<list key="installedFeatures">
<item value="com.aptana.feature.rcp:3.4.0.201304151603-7o7nFDBFFeFt3XrpXNucaz0uIWkY"/>
<item value="com.aptana.feature.studio:3.4.0.201304151542-7E7G-7MEMVKUHgFcLgFbkKoz0t-7"/>
<item value="com.aptana.feature:3.4.0.1365900908-BW7R8FBu-Ylk0DFYW1DC44EXt-dS"/>
<item value="com.aptana.php.feature:3.3.0.201304151524-7J7E-7IOW_UXOSJY"/>
<item value="com.aptana.feature.rcp:3.4.2.201308081805-7o7nFDFFFcLz-2l0rkQ0UYz0u_Wm"/>
<item value="com.aptana.feature.studio:3.4.2.201308081736-7W7I57boG98RAi489ctbvKi7VXbq"/>
<item value="com.aptana.feature:3.4.2.1376005939-B87T88BWOnwWRYdZO1DC44EXtPxS"/>
<item value="com.aptana.php.feature:3.4.2.201308081728-7J7E-7IOYXVXXUJS"/>
<item value="com.aptana.pydev.feature:2.7.0.2013032300-7g9I-8Jez0cfdJcee"/>
<item value="org.eclipse.help:1.3.0.v20110530-0844-7i7uFFmFFl8nvqbDpEqTvx"/>
<item value="org.eclipse.platform:3.7.2.v20120207-1839-9gF7UHPDFxGjd-PqDr2jX_4yKaumkoHTz04_q-q"/>
<item value="org.eclipse.rcp:3.7.2.v20120120-1424-9DB5FmnFq5JCf1UA38R-kz0S0272"/>
<item value="org.radrails.rails:3.3.0.201304151525-7e-7Q7f5GRKMDENR"/>
<item value="org.radrails.rails:3.4.2.201308081726-7n-7Z7oKfjkqlemv"/>
</list>
<section name="ChooseWorkspaceDialogSettings">
<item value="316" key="DIALOG_Y_ORIGIN"/>
<item value="656" key="DIALOG_X_ORIGIN"/>
</section>
<section name="WORKBENCH_SETTINGS">
<list key="ENABLED_TRANSFERS">
</list>
</section>
<section name="ExternalProjectImportWizard">
<item value="false" key="WizardProjectsImportPage.STORE_ARCHIVE_SELECTED"/>
<item value="false" key="WizardProjectsImportPage.STORE_COPY_PROJECT_ID"/>
</section>
</section>

View File

@ -1,7 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<section name="Workbench">
<section name="NewWizardAction">
</section>
<section name="ImportExportAction">
<item value="com.aptana.projects.internal.wizards.PromoteToProjectWizard" key="ImportExportPage.STORE_SELECTED_IMPORT_WIZARD_ID"/>
<item value="org.eclipse.ui.wizards.import.ExternalProject" key="ImportExportPage.STORE_SELECTED_IMPORT_WIZARD_ID"/>
<list key="ImportExportPage.STORE_EXPANDED_IMPORT_CATEGORIES">
<item value="org.eclipse.ui.Basic"/>
<item value="com.aptana.git.ui.clone.category"/>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<workbench progressCount="30" version="2.0">
<workbench progressCount="23" version="2.0">
<workbenchAdvisor/>
<window height="940" maximized="true" width="1200" x="13" y="31">
<fastViewData fastViewLocation="1024"/>
@ -8,14 +8,14 @@
</perspectiveBar>
<coolbarLayout>
<coolItem id="group.file" itemType="typeGroupMarker"/>
<coolItem id="org.eclipse.ui.workbench.file" itemType="typeToolBarContribution" x="126" y="22"/>
<coolItem id="org.eclipse.ui.workbench.file" itemType="typeToolBarContribution" x="124" y="22"/>
<coolItem id="additions" itemType="typeGroupMarker"/>
<coolItem id="org.eclipse.debug.ui.launchActionSet" itemType="typeToolBarContribution" x="145" y="22"/>
<coolItem id="org.eclipse.search.searchActionSet" itemType="typeToolBarContribution" x="88" y="22"/>
<coolItem id="com.aptana.ui.globalActionSet" itemType="typeToolBarContribution" x="172" y="22"/>
<coolItem id="org.eclipse.debug.ui.launchActionSet" itemType="typeToolBarContribution" x="141" y="22"/>
<coolItem id="org.eclipse.search.searchActionSet" itemType="typeToolBarContribution" x="86" y="22"/>
<coolItem id="com.aptana.ui.globalActionSet" itemType="typeToolBarContribution" x="170" y="22"/>
<coolItem id="org.eclipse.ui.edit.text.actionSet.presentation" itemType="typeToolBarContribution" x="84" y="22"/>
<coolItem id="group.nav" itemType="typeGroupMarker"/>
<coolItem id="org.eclipse.ui.workbench.navigate" itemType="typeToolBarContribution" x="99" y="22"/>
<coolItem id="org.eclipse.ui.workbench.navigate" itemType="typeToolBarContribution" x="95" y="22"/>
<coolItem id="group.editor" itemType="typeGroupMarker"/>
<coolItem id="group.help" itemType="typeGroupMarker"/>
<coolItem id="org.eclipse.ui.workbench.help" itemType="typeToolBarContribution" x="-1" y="-1"/>
@ -37,7 +37,7 @@
<view id="com.aptana.terminal.views.terminal:demo" partName="demo">
<viewState>
<title>demo</title>
<workingDirectory>E:\code\demo</workingDirectory>
<workingDirectory>C:\Users\Administrator</workingDirectory>
</viewState>
</view>
<view id="com.aptana.snippets.ui.views.SnippetsView" partName="Snippets">
@ -46,7 +46,7 @@
<view id="com.aptana.terminal.views.terminal" partName="Terminal">
<viewState>
<title>Terminal</title>
<workingDirectory>C:\Users\nudt</workingDirectory>
<workingDirectory>C:\Users\Administrator</workingDirectory>
</viewState>
</view>
<view id="com.aptana.samples.ui.SamplesView" partName="Samples">
@ -66,19 +66,13 @@
<viewState/>
</view>
<view id="com.aptana.explorer.view" partName="App Explorer">
<viewState CommonNavigator.LINKING_ENABLED="0" GitChangedFilesFilterEnabled="" activeProject="demo">
<project name="demo">
<selection>
<element path="/demo/app"/>
</selection>
</project>
</viewState>
<viewState CommonNavigator.LINKING_ENABLED="0" GitChangedFilesFilterEnabled="" activeProject="demo"/>
</view>
<view id="org.eclipse.ui.views.ContentOutline" partName="Outline">
<viewState/>
</view>
</views>
<perspectives activePart="com.aptana.explorer.view" activePerspective="com.aptana.ui.WebPerspective">
<perspectives activePart="org.eclipse.ui.console.ConsoleView" activePerspective="com.aptana.ui.WebPerspective">
<perspective editorAreaTrimState="2" editorAreaVisible="1" fixed="0" version="0.016">
<descriptor class="com.aptana.ui.internal.WebPerspectiveFactory" id="com.aptana.ui.WebPerspective" label="Web"/>
<alwaysOnActionSet id="com.aptana.browser.actionSet"/>
@ -150,7 +144,7 @@
</info>
<info part="org.eclipse.ui.editorss" ratio="0.19931857" ratioLeft="234" ratioRight="940" relationship="2" relative="left"/>
<info folder="true" part="terminalArea" ratio="0.75" ratioLeft="627" ratioRight="209" relationship="4" relative="org.eclipse.ui.editorss">
<folder activePageID="com.aptana.terminal.views.terminal:demo" appearance="2" expanded="2">
<folder activePageID="org.eclipse.ui.console.ConsoleView" appearance="2" expanded="2">
<page content="org.eclipse.ui.console.ConsoleView" label="Console"/>
<page content="com.aptana.terminal.views.terminal" label="Terminal"/>
<page content="org.eclipse.ui.views.ProblemView" label="Problems"/>
@ -166,7 +160,7 @@
</folder>
</info>
<info folder="true" part="org.eclipse.ui.internal.ViewStack@d90254" ratio="0.75" ratioLeft="627" ratioRight="209" relationship="4" relative="left">
<folder activePageID="com.aptana.snippets.ui.views.SnippetsView" appearance="2" expanded="2">
<folder activePageID="org.eclipse.ui.views.ContentOutline" appearance="2" expanded="2">
<page content="org.eclipse.ui.views.ContentOutline" label="Outline"/>
<page content="com.aptana.samples.ui.SamplesView" label="Samples"/>
<page content="com.aptana.snippets.ui.views.SnippetsView" label="Snippets"/>

53
Gemfile
View File

@ -1,5 +1,4 @@
source 'http://rubygems.org'
#source 'http://ruby.sdutlinux.org/'
source 'https://rubygems.org'
unless RUBY_PLATFORM =~ /w32/
# unix-like only
@ -16,43 +15,24 @@ gem "coderay", "~> 1.0.6"
gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby]
gem "builder", "3.0.0"
gem 'acts-as-taggable-on', '2.4.1'
gem 'spreadsheet'
gem 'ruby-ole'
group :development do
gem 'better_errors', path: 'lib/better_errors'
gem 'rack-mini-profiler', path: 'lib/rack-mini-profiler'
end
group :test do
gem "shoulda", "~> 3.5.0"
gem "mocha", "~> 1.1.0"
gem 'capybara', '~> 2.4.1'
gem 'nokogiri', '~> 1.6.3'
gem 'factory_girl', '~> 4.4.0'
gem 'selenium-webdriver', '~> 2.42.0'
# platforms :mri, :mingw do
# group :rmagick do
# # RMagick 2 supports ruby 1.9
# # RMagick 1 would be fine for ruby 1.8 but Bundler does not support
# # different requirements for the same gem on different platforms
# gem "rmagick", ">= 2.0.0"
# end
#end
end
group :development, :test do
# gem "guard-rails", '~> 0.5.3'
gem 'spork-testunit', '~> 0.0.8'
# gem 'guard-spork', '~> 1.5.1'
# gem 'guard-test', '~> 1.0.0'
gem 'ruby-prof', '~> 0.15.1' unless RUBY_PLATFORM =~ /w32/
if ENV['PRY']
gem 'pry'
gem 'pry-nav'
end
end
# group :test do
# # shoulda的版本做了改动
# #gem "shoulda", "~> 3.3.2"
# gem "shoulda", "> 3.3.2"
# gem "mocha", "~> 0.13.3"
# gem 'capybara', '~> 2.0.0'
# gem 'nokogiri', '< 1.6.0'
# end
# Gems used only for assets and not required
@ -73,6 +53,15 @@ group :ldap do
end
# platforms :mri, :mingw do
# group :rmagick do
# # RMagick 2 supports ruby 1.9
# # RMagick 1 would be fine for ruby 1.8 but Bundler does not support
# # different requirements for the same gem on different platforms
# gem "rmagick", ">= 2.0.0"
# end
# end
# Optional gem for OpenID authentication
group :openid do
gem "ruby-openid", "~> 2.1.4", :require => "openid"

View File

@ -0,0 +1,16 @@
module ExpireHelper
#index.html 中 “projects”塊 緩存過期
def expire_project_cache
ActionController::Base.new.expire_fragment('projects')
end
#index.html 中 “activities”塊 緩存過期
def expire_activitie_cache
ActionController::Base.new.expire_fragment('activities')
end
#welcome/index.html 中 “forums”塊 緩存過期
def expire_forum_cache
ActionController::Base.new.expire_fragment('forums')
end
end

View File

@ -17,6 +17,7 @@ class Bid < ActiveRecord::Base
HomeworkProject = 2
attr_accessible :author_id, :budget, :deadline, :name, :description, :homework_type, :password
include Redmine::SafeAttributes
include ExpireHelper
belongs_to :author, :class_name => 'User', :foreign_key => :author_id
belongs_to :course
@ -34,6 +35,10 @@ class Bid < ActiveRecord::Base
# has_many :fork_homework, :class_name => 'Bid', :conditions => "#{Bid.table_name}.parent_id = #{id}"
after_create :expire_activitie_cache
after_update :expire_activitie_cache
before_destroy :expire_activitie_cache
acts_as_attachable
NAME_LENGTH_LIMIT = 60
@ -149,4 +154,6 @@ class Bid < ActiveRecord::Base
end
end
end
end

View File

@ -16,6 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class Changeset < ActiveRecord::Base
include ExpireHelper
belongs_to :repository
belongs_to :user
include UserScoreHelper
@ -64,8 +65,9 @@ class Changeset < ActiveRecord::Base
includes(:repository => :project).where(Project.allowed_to_condition(args.shift || User.current, :view_changesets, *args))
}
after_create :scan_for_issues,:refresh_changests#:be_user_score # user_score
after_update :be_user_score
after_create :scan_for_issues,:refresh_changests,:expire_activitie_cache#:be_user_score # user_score
after_update :be_user_score,:expire_activitie_cache
before_destroy :expire_activitie_cache
after_destroy :down_user_score
before_create :before_create_cs

View File

@ -1,4 +1,10 @@
class ContestNotification < ActiveRecord::Base
include ExpireHelper
attr_accessible :content, :title
validates :title, length: {maximum: 30}
after_create :expire_forum_cache
after_update :expire_forum_cache
before_destroy :expire_forum_cache
end

View File

@ -17,13 +17,16 @@
class Document < ActiveRecord::Base
include Redmine::SafeAttributes
include ExpireHelper
belongs_to :project
belongs_to :user
belongs_to :category, :class_name => "DocumentCategory", :foreign_key => "category_id"
include UserScoreHelper
after_save :be_user_score # user_score
after_destroy :down_user_score
after_create :expire_activitie_cache
after_update :expire_activitie_cache
before_destroy :expire_activitie_cache
acts_as_attachable :delete_permission => :delete_documents
acts_as_searchable :columns => ['title', "#{table_name}.description"], :include => :project
@ -76,4 +79,8 @@ class Document < ActiveRecord::Base
update_document(self.user,1)
update_document(self.user,2,self.project)
end
def expire_cache
ActionController::Base.new.expire_fragment('activities')
end
end

View File

@ -1,8 +1,13 @@
class Forum < ActiveRecord::Base
include Redmine::SafeAttributes
include ExpireHelper
has_many :topics, :class_name => 'Memo', :conditions => "#{Memo.table_name}.parent_id IS NULL", :order => "#{Memo.table_name}.created_at DESC", :dependent => :destroy
has_many :memos, :dependent => :destroy, conditions: "parent_id IS NULL"
belongs_to :creator, :class_name => "User", :foreign_key => 'creator_id'
after_create :expire_forum_cache
after_update :expire_forum_cache
before_destroy :expire_forum_cache
safe_attributes 'name',
'description',
'topic_count',
@ -41,4 +46,6 @@ class Forum < ActiveRecord::Base
" last_memo_id = (SELECT MAX(id) FROM #{Memo.table_name} WHERE forum_id=#{forum_id})",
["id = ?", forum_id])
end
end

View File

@ -19,7 +19,7 @@ class Issue < ActiveRecord::Base
include Redmine::SafeAttributes
include Redmine::Utils::DateCalculation
include UserScoreHelper
include ExpireHelper
belongs_to :project
belongs_to :tracker
belongs_to :status, :class_name => 'IssueStatus', :foreign_key => 'status_id'
@ -80,6 +80,9 @@ class Issue < ActiveRecord::Base
after_create :act_as_activity,:be_user_score_new_issue
after_update :be_user_score
after_destroy :down_user_score
after_create :expire_activitie_cache
after_update :expire_activitie_cache
before_destroy :expire_activitie_cache
# after_create :be_user_score
# end
@ -1553,4 +1556,5 @@ class Issue < ActiveRecord::Base
end
end

View File

@ -4,6 +4,7 @@
class JournalsForMessage < ActiveRecord::Base
include Redmine::SafeAttributes
include UserScoreHelper
include ExpireHelper
safe_attributes "jour_type", # 留言所属类型
"jour_id", # 留言所属类型的id
"notes", # 留言内容
@ -54,7 +55,9 @@ class JournalsForMessage < ActiveRecord::Base
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
validates :notes, presence: true
after_create :act_as_activity #huang
after_create :act_as_activity ,:expire_activitie_cache#huang
after_update :expire_activitie_cache
before_destroy :expire_activitie_cache
after_create :reset_counters!
after_destroy :reset_counters!
after_save :be_user_score
@ -162,4 +165,6 @@ class JournalsForMessage < ActiveRecord::Base
end
end
end
end

View File

@ -1,9 +1,13 @@
class Memo < ActiveRecord::Base
include Redmine::SafeAttributes
include UserScoreHelper
include ExpireHelper
belongs_to :forum
belongs_to :author, :class_name => "User", :foreign_key => 'author_id'
after_create :expire_cache
after_update :expire_cache
before_destroy :expire_cache
validates_presence_of :author_id, :forum_id, :subject,:content
# 若是主题帖,则内容可以是空
#validates :content, presence: true, if: Proc.new{|o| !o.parent_id.nil? }
@ -164,5 +168,8 @@ class Memo < ActiveRecord::Base
update_memo_number(User.current,1)
update_replay_for_memo(User.current,1)
end
def expire_cache
expire_forum_cache
expire_activitie_cache
end
end

View File

@ -18,7 +18,7 @@
class Message < ActiveRecord::Base
include Redmine::SafeAttributes
include UserScoreHelper
include ExpireHelper
belongs_to :board
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
@ -59,8 +59,9 @@ class Message < ActiveRecord::Base
validates_length_of :subject, :maximum => 255
validate :cannot_reply_to_locked_topic, :on => :create
after_create :add_author_as_watcher, :reset_counters!
after_update :update_messages_board
after_create :add_author_as_watcher, :reset_counters!,:expire_activitie_cache
after_update :update_messages_board,:expire_activitie_cache
before_destroy :expire_activitie_cache
after_destroy :reset_counters!,:down_user_score
# fq
@ -195,4 +196,6 @@ class Message < ActiveRecord::Base
end
end
end
end

View File

@ -17,6 +17,7 @@
class News < ActiveRecord::Base
include Redmine::SafeAttributes
include ExpireHelper
belongs_to :project
#added by nwb
belongs_to :course
@ -47,6 +48,9 @@ class News < ActiveRecord::Base
# fq
after_create :act_as_activity
# end
after_create :expire_activitie_cache
after_update :expire_activitie_cache
before_destroy :expire_activitie_cache
scope :visible, lambda {|*args|
includes(:project).where(Project.allowed_to_condition(args.shift || User.current, :view_news, *args))
@ -91,4 +95,6 @@ class News < ActiveRecord::Base
def act_as_activity
self.acts << Activity.new(:user_id => self.author_id)
end
end

View File

@ -17,6 +17,7 @@
class Project < ActiveRecord::Base
include Redmine::SafeAttributes
include ExpireHelper
ProjectType_project = 0
ProjectType_course = 1
@ -127,8 +128,9 @@ class Project < ActiveRecord::Base
#after_save :update_position_under_parent, :if => Proc.new {|project| project.name_changed?}
after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?}
# 创建project之后默认创建一个board之后的board去掉了board的概念
after_create :create_board_sync
before_destroy :delete_all_members
after_create :create_board_sync,:expire_project_cache
after_update :expire_project_cache
before_destroy :delete_all_members,:expire_project_cache
def remove_references_before_destroy
return if self.id.nil?
Watcher.delete_all ['watchable_id = ?', id]

View File

@ -70,8 +70,10 @@
</span>
<div class="d-p-projectlist-box">
<ul class="d-p-projectlist">
<% cache("projects") do %>
<% @projects.map do |project| %>
<li style="overflow:hidden;word-break:break-all;height:100%;word-wrap: break-word;" class='<%= cycle("odd", "even") %>'>
<% cache project do %>
<li style="overflow:auto;word-break:break-all;height:100%;word-wrap: break-word;" class='<%= cycle("odd", "even") %>'>
<div style="float: left;">
<%= image_tag(get_project_avatar(project), :class => "avatar-4") %>
</div>
@ -98,8 +100,9 @@
:id => "tooltip-#{project.id}" %>
</div>
</li>
<!--<%#end %> -->
<% end %>
<% end; reset_cycle %>
<% end %>
</ul>
</div>
</div>
@ -112,8 +115,10 @@
</strong>
</h3>
<div class="user-message-box-list" style="margin-top: 10px;">
<% cache("activities") do %>
<%activities = find_all_activities%>
<% activities.each do |event| %>
<% cache event do %>
<li style="display: block;height:60px; padding-bottom: 4px;">
<div class="inner-right" style="float: left; height: 100%; ">
<%= image_tag url_to_avatar(event.event_author), :class => "avatar-3" %>
@ -127,7 +132,7 @@
<p style="margin-top: 4px;">
<span style="color: rgb(172, 174, 177)">
<%= l(:field_updated_on) %>
<%= time_tag_welcome event.event_datetime %>前
<%= format_time event.event_datetime %>
</span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="float: right; color: rgb(172, 174, 177);">
@ -136,6 +141,8 @@
</p>
</div>
</li>
<% end %>
<% end %>
<% end %>
</div>
</ul>
@ -157,9 +164,10 @@
</span>
</div>
<div class="welcome-box-list-new memo_activity">
<% cache("forums") do %>
<% topics = find_new_forum_topics(6) %>
<% topics.includes(:forum, :last_reply, :author).each do |topic|%>
<!--<%# cache cache_key_for_topic(topic) do %> -->
<% cache topic do %>
<li class="message-brief-intro">
<div class='memo_title text_nowrap'>
<%= link_to '['+topic.forum.name + ']',forum_path(topic.forum),:class => 'memo_Bar_title' %>
@ -167,7 +175,9 @@
</div>
<div class='memo_attr'>
<span class='memo_timestamp'>
<%= "#{l(:label_updated_time, value: time_tag_welcome(topic_last_time topic))}".html_safe %>
<%#= "#{l(:field_updated_on, value: format_time(topic_last_time topic))}" %>
<%= l(:field_updated_on) %>
<%= format_time topic_last_time topic %>
</span>
<span class="memo_author">
<%= l(:label_question_sponsor)%>
@ -185,7 +195,8 @@
</span>
</div>
</li>
<!--<%#end %> --> <!-- cache -->
<%end %>
<% end %>
<% end %>
</div>
</ul>

View File

@ -10,8 +10,8 @@ RedmineApp::Application.configure do
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.action_controller.perform_caching = true
config.cache_store = :file_store, "#{Rails.root }/public/tmp/"
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false

View File

@ -18,7 +18,7 @@ RedmineApp::Application.configure do
# Full error reports are disabled and caching is turned on
config.action_controller.perform_caching = true
config.cache_store = :file_store, "#{Rails.root }/public/tmp/"
# Enable serving of images, stylesheets, and javascripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"

View File

@ -43,6 +43,7 @@ module Redmine
base.extend ClassMethods
end
%w(datetime title description author type).each do |attr|
src = <<-END_SRC
def event_#{attr}

View File

@ -0,0 +1,4 @@
require 'test_helper'
class ExpireHelperTest < ActionView::TestCase
end

View File

@ -1 +0,0 @@
Put your Redmine plugins here.