Merge branch 'dev_zanle' into szzh

Conflicts:
	config/routes.rb
This commit is contained in:
sw 2015-01-30 10:37:05 +08:00
commit 97ec208b1a
4 changed files with 17 additions and 25 deletions

15
Gemfile
View File

@ -3,13 +3,13 @@ source 'http://rubygems.org'
unless RUBY_PLATFORM =~ /w32/
# unix-like only
gem 'iconv'
gem 'iconv'
gem 'rubyzip'
gem 'zip-zip'
end
gem 'grape', '~> 0.9.0'
gem 'grape-entity'
gem 'grape', '~> 0.9.0'
gem 'grape-entity'
gem 'seems_rateable', path: 'lib/seems_rateable'
gem "rails", "3.2.13"
gem "jquery-rails", "~> 2.0.2"
@ -20,13 +20,12 @@ gem "builder", "3.0.0"
gem 'acts-as-taggable-on', '2.4.1'
gem 'spreadsheet'
gem 'ruby-ole'
gem 'email_verifier'
gem 'newrelic_rpm'
#gem 'email_verifier'
group :development do
gem 'grape-swagger'
gem 'grape-swagger-ui', git: 'https://github.com/guange2015/grape-swagger-ui.git'
#gem 'puma'
gem 'grape-swagger'
gem 'grape-swagger-ui', git: 'https://github.com/guange2015/grape-swagger-ui.git'
#gem 'puma'
gem 'better_errors', path: 'lib/better_errors'
gem 'rack-mini-profiler', path: 'lib/rack-mini-profiler'
end

View File

@ -828,6 +828,7 @@ class CoursesController < ApplicationController
end
def show
# try to redirect to the requested menu item
if params[:jump] && redirect_to_course_menu_item(@course, params[:jump])
return
@ -866,6 +867,7 @@ class CoursesController < ApplicationController
@activity.scope_select {|t| has["show_#{t}"]}
# modify by nwb
# 添加私密性判断
if User.current.member_of_course?(@course)|| User.current.admin?
events = @activity.events(@days, @course.created_at)
else
@ -890,14 +892,13 @@ class CoursesController < ApplicationController
@events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)}
# documents
@sort_by = %w(category date title author).include?(params[:sort_by]) ? params[:sort_by] : 'category'
#
@teachers= searchTeacherAndAssistant(@course)
@canShowRealName = isCourseTeacher(User.current.id,@course)
# 这写变量发现没有用而且拖慢速度
#@teachers= searchTeacherAndAssistant(@course)
#@canShowRealName = isCourseTeacher(User.current.id,@course)
if(User.find_by_id(CourseInfos.find_by_course_id(@course.id).try(:user_id)))
@user = User.find_by_id(CourseInfos.find_by_course_id(@course.id).user_id)
end
respond_to do |format|
format.html{render :layout => 'base_courses'}
format.api

View File

@ -27,7 +27,6 @@
RedmineApp::Application.routes.draw do
#match '/contests/:id/contestnotifications', :controller => 'contestnotifications', :action => 'index'
mount Mobile::API => '/api'

View File

@ -98,20 +98,13 @@ module Redmine
# Author lizanle
# Description 删除 unless scope.all因为这个执行查询并且没有加入时间限制与下边 scope.all(provider_options[:find_options].dup)重复
if options[:course]
if provider_options[:timestamp].include? "updated_on"
to = scope.scoped(:order => "#{provider_options[:timestamp]} desc").all(provider_options[:find_options].dup).first.updated_on
else
to = scope.scoped(:order => "#{provider_options[:timestamp]} desc").all(provider_options[:find_options].dup).first.created_on
end
from = (to - days.days) > created_time ? (to - days.days) : created_time.to_date
scope.all(provider_options[:find_options].dup)
else
#from = to - Setting.activity_days_default.to_i
if from && to
scope = scope.scoped(:conditions => ["#{provider_options[:timestamp]} BETWEEN ? AND ?", from, to])
scope.all(provider_options[:find_options].dup)
end
end
if from && to
scope = scope.scoped(:conditions => ["#{provider_options[:timestamp]} BETWEEN ? AND ?", from, to])
end
scope.all(provider_options[:find_options].dup)
end
# 为了首页获取数据基本复制了上面的方法,改变了用户查看权限,增加了对讨论区的识别。