From b68e227531bd4adcfeb834ea08dea3cb06276b83 Mon Sep 17 00:00:00 2001
From: yuanke <249218296@qq.com>
Date: Wed, 22 Jun 2016 14:04:47 +0800
Subject: [PATCH 01/20] =?UTF-8?q?=E6=B2=A1=E6=BF=80=E6=B4=BB=E7=9A=84?=
=?UTF-8?q?=E5=B8=90=E5=8F=B7=E7=95=8C=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/account_controller.rb | 15 +-
app/controllers/users_controller.rb | 6 +
app/controllers/words_controller.rb | 20 +++
app/views/account/email_activation.html.erb | 52 ++++++
config/routes.rb | 5 +-
public/stylesheets/header.css | 176 ++++++++++++++++++++
6 files changed, 270 insertions(+), 4 deletions(-)
create mode 100644 app/views/account/email_activation.html.erb
diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb
index 33d988e35..8bf40d472 100644
--- a/app/controllers/account_controller.rb
+++ b/app/controllers/account_controller.rb
@@ -239,14 +239,21 @@ class AccountController < ApplicationController
end
def resendmail
+ status = 1
user = User.find(params[:user]) if params[:user]
token = Token.new(:user => user, :action => "register")
if token.save
Mailer.run.register(token)
-
else
yield if block_given?
+ status = 0
end
+ render :json => status
+ end
+
+ def email_activation
+
+
end
private
@@ -264,6 +271,7 @@ class AccountController < ApplicationController
if user.nil?
invalid_credentials
elsif user.status == 2
+ @user = user
invalid_credentials_new
elsif user.new_record?
onthefly_creation_failed(user, {:login => user.login, :auth_source_id => user.auth_source_id })
@@ -375,8 +383,9 @@ class AccountController < ApplicationController
def invalid_credentials_new
logger.warn "Failed login for '#{params[:username]}' from #{request.remote_ip} at #{Time.now.utc}"
- flash[:error] = l(:notice_account_invalid_creditentials_new)
- render signin_path(:login=>true)
+ # flash[:error] = l(:notice_account_invalid_creditentials_new)
+ # render signin_path(:login=>true)
+ render :action => 'email_activation'
end
# Register a user for email activation.
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 87c7d8f54..ed8a9fa36 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -1239,6 +1239,12 @@ class UsersController < ApplicationController
render :layout=>'new_base_user'
end
+ #给某人留言
+ def feedBackTo
+
+
+ end
+
def user_comments
end
diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb
index 22b7f1f52..3b540f0d0 100644
--- a/app/controllers/words_controller.rb
+++ b/app/controllers/words_controller.rb
@@ -337,6 +337,26 @@ class WordsController < ApplicationController
UserExtensions.introduction(user, message)
redirect_to user_url(user.id)
end
+
+ #邮箱激活问题留言 留言成功给出提示框
+ def leave_email_activation_message
+ status = 1 #成功
+ me = User.find(params[:user])
+ if me
+ @user = User.find(params[:id])
+ if params[:text].size>0 && @user
+ # @user.add_jour(me, params[:text])
+ #私信
+ message = "【未收到激活邮件的用户反馈,用户邮箱:"+me.mail+"】
"+params[:text]
+ @user.journals_for_messages << JournalsForMessage.new(:user_id => me.id, :notes => message, :reply_id => 0, :status => true, :is_readed => false, :private => 1)
+ else
+ status = 0
+ end
+ render :json => status
+ else
+ render_403
+ end
+ end
private
diff --git a/app/views/account/email_activation.html.erb b/app/views/account/email_activation.html.erb
new file mode 100644
index 000000000..abd010a96
--- /dev/null
+++ b/app/views/account/email_activation.html.erb
@@ -0,0 +1,52 @@
+
+
+
您的账号尚未激活,请先进入您的注册邮箱,激活您的账号。
+
+ <%#= link_to l(:label_mail_resend), { :controller => 'account', :action => 'resendmail',:user => @user}, :class=>"email_verify_btn mt30 ml30", :remote => true, :method => 'get' %>
+
+ 如果您尚未收到激活邮件,请按照以下步骤操作:
+ - 检查邮箱的“订阅邮件”、“垃圾邮件”,可能会发现激活邮件。
+ - 如果激活邮件已无效,请点击重新发送激活邮件按钮。
+ - 如果您无法收到激活邮件,请您直接给我们管理员留言:
+
+
+
+
+
diff --git a/config/routes.rb b/config/routes.rb
index ec8fa2337..6e720ffba 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -489,10 +489,13 @@ RedmineApp::Application.routes.draw do
match 'account/activate', :via => :get
match 'account/valid_ajax', :via => :get
match 'account/email_valid', :to => 'account#email_valid', :via => :get
- match 'account/resendmail', :to => 'account#resendmail', :via=> :get
+ match 'account/resendmail', :to => 'account#resendmail', :via=> :get, :as => 'resendmail'
match 'projects/:id/wiki', :to => 'wikis#edit', :via => :post
match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post]
+ #激活邮箱反馈问题
+ match 'users/:id/leave_email_activation_message', :to => 'words#leave_email_activation_message', :via => :get, :as => "leave_email_activation_message"
+
# boards
match 'boards/:board_id/topics/new', :to => 'messages#new', :via => [:get, :post], :as => 'new_board_message'
match 'boards/:id/join_to_org_subfields', :to => 'boards#join_to_org_subfields'
diff --git a/public/stylesheets/header.css b/public/stylesheets/header.css
index 767d76cb2..5700d0b00 100644
--- a/public/stylesheets/header.css
+++ b/public/stylesheets/header.css
@@ -117,3 +117,179 @@ a.f_grey:hover {color:#000000 !important;}
#loginInButton {height:54px; padding-left:10px; padding-right:10px; text-align:center; line-height:54px; vertical-align:middle; color:#ffffff; font-size:16px;}
#loginSignButton:hover {background-color:#297fb8;}
#loginInButton:hover {background-color:#297fb8;}
+
+/* 邮箱验证 */
+.email_verify body,h1,h2,h3,h4,h5,h6,hr,p,blockquote,dl,dt,dd,ul,ol,li,pre,form,fieldset,legend,button,input,textarea,th,td{ margin:0; padding:0;}
+.mt30{ margin-top:30px;}
+.ml30{ margin-left:30px;}
+.new_content{
+ width:1000px;
+ margin:10px auto;
+ padding:30px 0;
+ background-color:#fff;
+}
+.email_verify{
+ width:720px;
+ margin:0px auto;
+}
+.email_verify_prompt{
+ border:2px solid #dd0000;
+ background:#ffe3e3 url(../images/icons_prompt.png) 25px 10px no-repeat;;
+ height:35px;
+ line-height:35px;
+ padding-left:45px;
+ color:#8b0000;
+ font-size:14px;
+}
+.email_verify_btn{
+ border-style:none;
+ height:35px;
+ padding:0 15px;
+ line-height:35px;
+ color:#fff;
+ background:#3a95d7;
+ text-align:center;
+ -webkit-border-radius:5px;
+ -moz-border-radius:5px;
+ -o-border-radius:5px;
+ border-radius:5px;
+ font-size:14px;
+}
+.email_verify_btn:hover{
+ background:#017bd3;
+}
+.email_sub_btn{
+ border-style:none;
+ height:30px;
+ padding:0 25px;
+ line-height:30px;
+ color:#fff;
+ background:#3a95d7;
+ text-align:center;
+ -webkit-border-radius:5px;
+ -moz-border-radius:5px;
+ -o-border-radius:5px;
+ border-radius:5px;
+ font-size:14px;
+}
+.email_sub_btn:hover{
+ background:#017bd3;
+}
+.email_prompt_p{
+ font-size:14px;
+ color:#000;
+ margin-bottom:10px;
+}
+.email_prompt_txt{ width:480px;}
+.email_prompt_txt li{
+ margin-left:15px;
+ list-style-type: disc;
+ color:#777;
+ line-height:1.9;
+ font-size:14px;
+}
+.email_prompt_mes{
+ border:1px solid #ccc;
+ -webkit-border-radius:5px;
+ -moz-border-radius:5px;
+ -o-border-radius:5px;
+ border-radius:5px;
+ width:468px;
+ height:60px;
+ background:#fff;
+ padding:5px;
+ margin-bottom: 5px;
+}
+.email_tanbox{
+ border:2px solid #3a95d7;
+ background:#fff;
+ width:480px;
+
+}
+.email_tancon{
+ width:420px;
+ margin:0 auto;
+ text-align:center;
+ padding:20px 30px;
+ background:#fff;
+}
+.email_tan_title{
+ font-size:18px;
+ color:#3a95d7;
+ font-weight:normal;
+ margin-bottom:5px;
+}
+.email_tan_p{
+ font-size:14px;
+ color:#4c4c4c;
+
+}
+.email_verify_p{
+ font-size:14px;
+ color:#3a95d7;
+}
+
+/***** Ajax indicator ******/
+/*-------resendmail---------*/
+#ajax-indicator {
+ position: absolute; /* fixed not supported by IE */
+ background-color:#eee;
+ border: 1px solid #bbb;
+ top:35%;
+ left:40%;
+ width:20%;
+ font-weight:bold;
+ text-align:center;
+ padding:0.6em;
+ z-index:100000;
+ opacity: 0.5;
+}
+
+html>body #ajax-indicator { position: fixed; }
+
+#ajax-indicator span {
+ background-position: 0% 40%;
+ background-repeat: no-repeat;
+ background-image: url(../images/loading.gif);
+ padding-left: 26px;
+ vertical-align: bottom;
+}
+
+div.modal {
+ border-radius: 5px;
+ background: #fff;
+ z-index: 50;
+ padding: 4px;
+}
+.ui-widget-content {
+ border: 1px solid #ddd;
+ color: #333;
+}
+.ui-widget {
+ font-family: Verdana, sans-serif;
+ font-size: 1.1em;
+}
+.ui-dialog .ui-dialog-content {
+ position: relative;
+ border: 0;
+ padding: .5em 1em;
+ background: none;
+ overflow: auto;
+ zoom: 1;
+}
+.ui-widget-overlay {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+}
+.ui-widget-overlay {
+ background: #666 url(http://forge.trustie.net/stylesheets/jquery/images/xui-bg_diagonals-thick_20_666666_40x40.png.pagespeed.ic.9mfuw_R0z1.png) 50% 50% repeat;
+ opacity: .5;
+ filter: Alpha(Opacity=50);
+}
+.resourceUploadPopup {width:400px; height:auto; border:3px solid #269ac9 !important; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-200px; z-index:1000;}
+a.Blue-btn{ display:block; margin-right:15px;width:65px; height:22px; background-color:#ffffff; line-height:24px; vertical-align:middle; text-align:center; border:1px solid #3598db; color:#3598db; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;}
+a:hover.Blue-btn{ background:#3598db; color:#fff;}
+/***** end Ajax indicator ******/
\ No newline at end of file
From 9461c41fa72bd1aadd835cc47903cab985bad9f2 Mon Sep 17 00:00:00 2001
From: yuanke <249218296@qq.com>
Date: Wed, 22 Jun 2016 14:14:36 +0800
Subject: [PATCH 02/20] =?UTF-8?q?=E6=BF=80=E6=B4=BB=E7=95=99=E8=A8=80?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/words_controller.rb | 3 ++-
app/views/account/email_activation.html.erb | 6 +++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb
index 3b540f0d0..1bbbb1190 100644
--- a/app/controllers/words_controller.rb
+++ b/app/controllers/words_controller.rb
@@ -343,7 +343,8 @@ class WordsController < ApplicationController
status = 1 #成功
me = User.find(params[:user])
if me
- @user = User.find(params[:id])
+ #课程使者id=1
+ @user = User.find(1)
if params[:text].size>0 && @user
# @user.add_jour(me, params[:text])
#私信
diff --git a/app/views/account/email_activation.html.erb b/app/views/account/email_activation.html.erb
index abd010a96..d625e7fc9 100644
--- a/app/views/account/email_activation.html.erb
+++ b/app/views/account/email_activation.html.erb
@@ -10,7 +10,7 @@
如果您无法收到激活邮件,请您直接给我们管理员留言:
@@ -29,7 +29,7 @@
}
);
}
- function leave_email_activation_message(url,user,id)
+ function leave_email_activation_message(url,user)
{
if ($(".email_prompt_mes").val().length == 0){
//弹框请他输入文字
@@ -39,7 +39,7 @@
}
$.get(
url,
- {user:user,id: 1,text:$(".email_prompt_mes").val() },
+ {user:user,text:$(".email_prompt_mes").val() },
function (data) {
console.log("2222222");
console.log(data);
From e818b5fb073f4c1ef02b9d321e8a05dee8aa8d3b Mon Sep 17 00:00:00 2001
From: yuanke <249218296@qq.com>
Date: Fri, 24 Jun 2016 11:22:43 +0800
Subject: [PATCH 03/20] =?UTF-8?q?=E6=97=A7=E7=9A=84=E6=B3=A8=E5=86=8C?=
=?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=8E=BB=E6=8E=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/account/register.html.erb | 127 ----------------------------
config/routes.rb | 2 +-
2 files changed, 1 insertion(+), 128 deletions(-)
delete mode 100644 app/views/account/register.html.erb
diff --git a/app/views/account/register.html.erb b/app/views/account/register.html.erb
deleted file mode 100644
index 0bebfdf5f..000000000
--- a/app/views/account/register.html.erb
+++ /dev/null
@@ -1,127 +0,0 @@
-<% @nav_dispaly_home_path_label = 1
- @nav_dispaly_main_course_label = 1
- @nav_dispaly_main_project_label = 1
- @nav_dispaly_main_contest_label = 1 %>
-<% @nav_dispaly_forum_label = 1%>
-
-
-
-
-
-
-<%= l(:label_register) %> <%= link_to l(:label_login_with_open_id_option), signin_url if Setting.openid? %>
-
-<%= labelled_form_for @user, :url => register_path do |f| %>
- <%= error_messages_for 'user' %>
-
-
- <% if @user.auth_source_id.nil? %>
-
<%= f.text_field :login, :size => 25, :required => true %>
- <%= l(:label_max_number) %>
-
-
<%= f.password_field :password, :size => 25, :required => true %>
- <%= l(:text_caracters_minimum, :count => Setting.password_min_length) %>
-
-
<%= f.password_field :password_confirmation, :size => 25, :required => true %>
- <% end %>
-
-
- <%= f.text_field :mail,:size => 25, :required => true %>
-
-
-
-
- <%= "#{l(:label_mail_attention)} " %>
- <%= "#{l(:label_mail_attention1)} " %>
-
-
-
-
-
-
-
-
-
-
-
- <%= submit_tag l(:button_submit) %> |
-
-
-
-<% end %>
-<% if Setting.openid? %>
- <%= f.text_field :identity_url %>
-<% end %>
-<% @user.custom_field_values.select { |v| v.editable? || v.required? }.each do |value| %>
- <%= custom_field_tag_with_label :user, value %>
-<% end %>
-
-<% password_min_length = Setting.password_min_length %>
-
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 6e720ffba..8d822aafc 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -484,7 +484,7 @@ RedmineApp::Application.routes.draw do
match 'logout', :to => 'account#logout', :as => 'signout', :via => [:get, :post]
match 'agreement',:to => 'account#agreement',:as => 'agreement',:via=>[:get]
match 'about_us',:to=>'account#about_us',:as=>'about_us',:via=>[:get]
- match 'account/register', :via => [:get, :post], :as => 'register'
+ match 'account/register',:to=>'account#register', :via => [:get, :post], :as => 'register'
match 'account/lost_password', :via => [:get, :post], :as => 'lost_password'
match 'account/activate', :via => :get
match 'account/valid_ajax', :via => :get
From 383483de269bdf40c739c9b911a257f6101bc39a Mon Sep 17 00:00:00 2001
From: cxt
Date: Tue, 28 Jun 2016 15:13:04 +0800
Subject: [PATCH 04/20] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=A4=A7=E7=BA=B2?=
=?UTF-8?q?=E7=9A=84=E5=B7=A6=E4=BE=A7=E6=A0=8Fbase=EF=BC=8C=E6=96=B0?=
=?UTF-8?q?=E5=BB=BA=E8=AF=BE=E7=A8=8B=E5=A4=A7=E7=BA=B2=E3=80=81=E6=96=B0?=
=?UTF-8?q?=E5=BB=BA=E7=8F=AD=E7=BA=A7=E7=9A=84=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/courses_controller.rb | 1 +
app/controllers/syllabuses_controller.rb | 37 +++-
app/controllers/tags_controller.rb | 8 +
app/helpers/courses_helper.rb | 16 ++
app/helpers/syllabuses_helper.rb | 3 +
app/helpers/tags_helper.rb | 2 +
app/models/syllabus.rb | 4 +-
app/services/courses_service.rb | 1 +
app/views/courses/new.html.erb | 20 ++-
app/views/layouts/_syllabus_info.html.erb | 25 +++
app/views/layouts/_user_courses.html.erb | 4 +-
app/views/layouts/base_syllabus.html.erb | 158 ++++++++++++++++++
app/views/layouts/new_base.html.erb | 2 +-
app/views/layouts/new_base_user.html.erb | 5 +-
app/views/syllabuses/new.html.erb | 27 +++
app/views/syllabuses/show.html.erb | 0
app/views/tags/_syllabus_tag.html.erb | 5 +
.../tags/_tag_syllabus_new_name.html.erb | 28 ++++
app/views/tags/remove_tag.js.erb | 3 +
app/views/tags/tag_save.js.erb | 4 +
config/locales/zh.yml | 8 +-
config/routes.rb | 12 ++
.../20160627074232_add_column_to_syllabus.rb | 12 ++
db/schema.rb | 26 ++-
public/images/syllabus.jpg | Bin 0 -> 16760 bytes
public/javascripts/course.js | 40 ++++-
public/javascripts/syllabus.js | 9 +
public/stylesheets/courses.css | 4 +-
public/stylesheets/syllabus.css | 155 +++++++++++++++++
29 files changed, 599 insertions(+), 20 deletions(-)
create mode 100644 app/views/layouts/_syllabus_info.html.erb
create mode 100644 app/views/layouts/base_syllabus.html.erb
create mode 100644 app/views/syllabuses/new.html.erb
create mode 100644 app/views/syllabuses/show.html.erb
create mode 100644 app/views/tags/_syllabus_tag.html.erb
create mode 100644 app/views/tags/_tag_syllabus_new_name.html.erb
create mode 100644 db/migrate/20160627074232_add_column_to_syllabus.rb
create mode 100644 public/images/syllabus.jpg
create mode 100644 public/javascripts/syllabus.js
create mode 100644 public/stylesheets/syllabus.css
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index 7dea90e4b..e81251f63 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -715,6 +715,7 @@ class CoursesController < ApplicationController
@trackers = Tracker.sorted.all
@course = Course.new
@course.safe_attributes = params[:course]
+ @syllabus = Syllabus.where("id = #{params[:syllabus_id].to_i}").first if params[:syllabus_id]
# month = Time.now.month
render :layout => 'new_base'
else
diff --git a/app/controllers/syllabuses_controller.rb b/app/controllers/syllabuses_controller.rb
index 69982b99a..5ee3224bd 100644
--- a/app/controllers/syllabuses_controller.rb
+++ b/app/controllers/syllabuses_controller.rb
@@ -8,8 +8,43 @@ class SyllabusesController < ApplicationController
end
def show
- @courses = @syllabus.courses
+ #@courses = @syllabus.courses
+ respond_to do |format|
+ format.js
+ format.html{render :layout => 'base_syllabus'}
+ format.api
+ end
+ end
+
+ def new
+ if User.current.login?
+ @syllabus = Syllabus.new
+ render :layout => 'new_base'
+ else
+ redirect_to signin_url
+ end
+ end
+ def create
+ if User.current.user_extensions.identity
+ @syllabus = Syllabus.new
+ @syllabus.title = params[:title]
+ @syllabus.eng_name = params[:eng_name]
+ @syllabus.user_id = User.current.id
+ if @syllabus && @syllabus.save
+ respond_to do |format|
+ flash[:notice] = l(:notice_successful_create)
+ format.html {redirect_to syllabus_path(@syllabus)}
+ format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'syllabuses', :action => 'show', :id => @syllabus.id) }
+ end
+ else
+ respond_to do |format|
+ flash[:notice] = l(:notice_create_failed)
+ format.html { redirect_to new_syllabus_path } #Added by young
+ format.api { render_validation_errors(@syllabus) }
+ end
+ end
+ end
end
private
diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb
index 2c390025e..e66f88848 100644
--- a/app/controllers/tags_controller.rb
+++ b/app/controllers/tags_controller.rb
@@ -13,6 +13,7 @@ class TagsController < ApplicationController
include ForumsHelper
include AttachmentsHelper
include ContestsHelper
+ include SyllabusesHelper
include ActsAsTaggableOn::TagsHelper
include TagsHelper
include FilesHelper
@@ -529,6 +530,8 @@ class TagsController < ApplicationController
@obj = Course.find_by_id(@obj_id)
when '10'
@obj = Attachment.find_by_id(@obj_id)
+ when '11'
+ @obj = Syllabus.find_by_id(@obj_id)
else
@obj = nil
end
@@ -619,6 +622,9 @@ class TagsController < ApplicationController
when '9' then
@obj = Course.find_by_id(obj_id)
@obj_pages, @courses_results, @results_count = for_pagination(get_courses_by_tag(selected_tags))
+ when '11' then
+ @obj = Syllabus.find_by_id(obj_id)
+ @obj_pages, @syllabuses_results, @results_count = for_pagination(get_syllabuses_by_tag(selected_tags))
else
@obj = nil
end
@@ -684,6 +690,8 @@ class TagsController < ApplicationController
return 'Course'
when '10'
return 'Attachment'
+ when '11'
+ return 'Syllabus'
else
render_error :message => e.message
return
diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb
index 47d343e8f..fd3be1369 100644
--- a/app/helpers/courses_helper.rb
+++ b/app/helpers/courses_helper.rb
@@ -667,6 +667,22 @@ module CoursesHelper
is_current_term || is_next_term
end
+ #课程大纲下拉框
+ def syllabus_option
+ type = []
+ option1 = []
+ option1 << "请选择课程"
+ option1 << 0
+ type << option1
+ Syllabus.all.each do |syllabus|
+ option = []
+ option << syllabus.title
+ option << syllabus.id
+ type << option
+ end
+ type
+ end
+
#获取课程动态
def get_course_activity courses, activities
@course_ids=activities.keys()
diff --git a/app/helpers/syllabuses_helper.rb b/app/helpers/syllabuses_helper.rb
index dac84937b..d5284586e 100644
--- a/app/helpers/syllabuses_helper.rb
+++ b/app/helpers/syllabuses_helper.rb
@@ -1,2 +1,5 @@
module SyllabusesHelper
+ def get_syllabuses_by_tag(tag_name)
+ Syllabus.tagged_with(tag_name).order('updated_at desc')
+ end
end
diff --git a/app/helpers/tags_helper.rb b/app/helpers/tags_helper.rb
index 8847f4163..54753807d 100644
--- a/app/helpers/tags_helper.rb
+++ b/app/helpers/tags_helper.rb
@@ -23,6 +23,8 @@ module TagsHelper
@obj= Course.find_by_id(obj_id)
when '10'
@obj = Attachment.find_by_id(obj_id)
+ when '11'
+ @obj = Syllabus.find_by_id(obj_id)
else
raise Exception, '[TagsHelper] ===> tag type unknow.'
end
diff --git a/app/models/syllabus.rb b/app/models/syllabus.rb
index 7d6319955..b1bdfd5aa 100644
--- a/app/models/syllabus.rb
+++ b/app/models/syllabus.rb
@@ -1,5 +1,7 @@
class Syllabus < ActiveRecord::Base
+ acts_as_taggable
+
belongs_to :user
has_many :courses
- attr_accessible :description, :title
+ attr_accessible :description, :title, :eng_name, :type, :credit, :hours, :theory_hours, :practice_hours, :applicable_major, :pre_course
end
diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb
index 60c053997..b7b5e73ac 100644
--- a/app/services/courses_service.rb
+++ b/app/services/courses_service.rb
@@ -201,6 +201,7 @@ class CoursesService
#@course.safe_attributes(current_user,params[:course])
#@course.password = params[:course][:password]
@course.tea_id = current_user.id
+ @course.syllabus_id = params[:syllabus_id].to_i
@course.term = params[:term]
@course.time = params[:time]
@course.end_term = params[:end_term]
diff --git a/app/views/courses/new.html.erb b/app/views/courses/new.html.erb
index ddaf17ae8..d3326480f 100644
--- a/app/views/courses/new.html.erb
+++ b/app/views/courses/new.html.erb
@@ -4,12 +4,22 @@
<%= labelled_form_for @course do |f| %>
+ -
+
+ <% if @syllabus.nil? %>
+ <%= select_tag :syllabus_id,options_for_select(syllabus_option,@course.syllabus_id), {:id=>"new_syllabus_id", :class=>"syllabus_input"} %>
+ <% else %>
+ <%=@syllabus.title %>
+
+ <% end %>
+
+ 请选择课程大纲
+
+
-
-
-
- 课程名称不能为空且至少有两个字符
+ 班级名称不能为空且至少有两个字符
-
@@ -49,13 +59,13 @@
-
- (选中后课外用户可见该课程,否则仅对课内成员可见)
+ (选中后班级外用户可见该班级,否则仅对班级内成员可见)
-
- (选中后课外用户可见学生列表,否则仅对课内成员可见)
+ (选中后班级外用户可见学生列表,否则仅对班级内成员可见)
-
diff --git a/app/views/layouts/_syllabus_info.html.erb b/app/views/layouts/_syllabus_info.html.erb
new file mode 100644
index 000000000..4e7bc1f7b
--- /dev/null
+++ b/app/views/layouts/_syllabus_info.html.erb
@@ -0,0 +1,25 @@
+
+ <%= image_tag("../images/syllabus.jpg",width:"60px", height: "60px") %>
+
+
+
<%=@syllabus.title %>
+
+
+
+
+
+ <% if @syllabus.eng_name && !@syllabus.eng_name.empty? %>
+ <%= @syllabus.eng_name %>
+ <% else%>
+ 课程英文名称
+ <% end %>
+ <% if User.current == @syllabus.user %>
+ <%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);", :onclick => "show_edit_eng_name();"%>
+ <% end %>
+
+
+
+
\ No newline at end of file
diff --git a/app/views/layouts/_user_courses.html.erb b/app/views/layouts/_user_courses.html.erb
index ff18e68bd..546a5b14b 100644
--- a/app/views/layouts/_user_courses.html.erb
+++ b/app/views/layouts/_user_courses.html.erb
@@ -47,7 +47,7 @@
<%= link_to "+",course_boards_path(course, :flag => true, :is_new => 1), :class => 'fr fb', :title => '发布帖子',:target => '_blank' %>
- <% if User.current == @user %>
+ <% if User.current == user %>
-
<% if count == 0 %>
<%= link_to "屏蔽动态", shield_activities_path(:user_id => user.id, :course_id => course.id), :method => 'post',:remote => true %>
@@ -84,7 +84,7 @@
<% end%>
+
+
+
+
+
+<% is_current_user = User.current.logged? && User.current == @user%>
+
+ <% if User.current.logged? %>
+ <%= render :partial => 'layouts/logined_header' %>
+ <% else%>
+ <%= render :partial => 'layouts/unlogin_header' %>
+ <% end%>
+
+
+
+
+
+
+ <%=render :partial => 'layouts/syllabus_info' %>
+
+
+
+
+
+
+
+
标签:
+
+ <%= render :partial => 'tags/syllabus_tag', :locals => {:obj => @syllabus,:object_flag => "11"}%>
+
+
+
+
访问计数 343 (自2016年5月)
+
+
+
+
+ <%= render :partial => 'layouts/new_feedback' %>
+
+
+<%= render :partial => 'layouts/footer' %>
+
+
+
+
+ <%= l(:label_loading) %>
+
+
+
+