diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index 0900f0446..008a08f2f 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -274,6 +274,13 @@ module Mobile get ":course_id/members" do cs = CoursesService.new count = cs.course_members params + # 我如果在学生当中,那么我将放在第一位 + count.each do |m| + if m.user.id == current_user.id + count.delete m + count.unshift m + end + end present :data, count, with: Mobile::Entities::Member present :status, 0 end @@ -290,6 +297,20 @@ module Mobile present :data,homeworkscore,with: Mobile::Entities::Homeworkscore present :status,0 end + + desc '发布课程通知' + params do + requires :token,type:String + requires :course_id,type:Integer,desc:'课程id' + requires :title,type:String,desc:'通知标题' + requires :desc,type:String,desc:'通知描述' + end + post ':course_id/create_course_notice' do + cs = CoursesService.new + news = cs.create_course_notice params,current_user + present :data,news,with:Mobile::Entities::News + present :status,0 + end end end end diff --git a/app/api/mobile/apis/users.rb b/app/api/mobile/apis/users.rb index 62c9c3926..147cbfda5 100644 --- a/app/api/mobile/apis/users.rb +++ b/app/api/mobile/apis/users.rb @@ -85,6 +85,7 @@ module Mobile requires :search_by, type: String,desc: '搜索依据:0 昵称,1 用户名,2 邮箱,3 昵称和姓名' optional :is_search_assitant,type:Integer,desc:'是否搜索注册用户来作为助教' optional :course_id,type:Integer,desc: '课程id,搜索注册用户不为该课程教师的其他用户' + optional :user_id,type:Integer,desc:'用户id' end get 'search/search_user' do us = UsersService.new diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 36d542d58..26d8df16f 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -508,6 +508,12 @@ class CoursesService end end + def create_course_notice params ,current_user + n = News.new(:course_id =>params[:course_id], :author_id => current_user.id,:title =>params[:title],:description=> params[:desc]) + n.save + {:id => n.id,:title => n.title,:author_name => n.author.name,:author_id => n.author.id, :description => n.description,:created_on => format_time(n.created_on),:comments_count => n.comments_count} + end + private def searchmember_by_name members, name #searchPeopleByRoles(project, StudentRoles) diff --git a/app/views/courses/settings.html.erb b/app/views/courses/settings.html.erb index 69ce4f5dc..4ca8d3d43 100644 --- a/app/views/courses/settings.html.erb +++ b/app/views/courses/settings.html.erb @@ -23,6 +23,7 @@ +
  • diff --git a/app/views/forums/_show_topics.html.erb b/app/views/forums/_show_topics.html.erb index e61995ecc..9af8538ed 100644 --- a/app/views/forums/_show_topics.html.erb +++ b/app/views/forums/_show_topics.html.erb @@ -1,5 +1,4 @@ - - +
    共有 <%=link_to @forum.memos.count %> 个贴子
    <% if memos.any? %> diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 6923b17c2..6820ccaf3 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -52,7 +52,7 @@ <%= l(:label_search)%> -
    +
    <% end %>
    diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index 651067475..1f74ccd5d 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -68,7 +68,7 @@ - <%=link_to l(:field_homepage), home_path %> > + <%=link_to l(:field_homepage), home_path %> > <%=link_to @user.name, user_path %> @@ -122,7 +122,7 @@ <%= link_to l(:label_user_watcher)+"("+User.watched_by(@user.id).count.to_s+")" ,:controller=>"users", :action=>"user_watchlist"%>   - + <%= link_to l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count)+"("+@user.watcher_users.count.to_s+")", :controller=>"users", :action=>"user_fanslist" %>    @@ -190,16 +190,16 @@ <% unless @user.user_extensions.nil? %> <% if @user.user_extensions.identity == 0 || @user.user_extensions.identity == 1 %> + <% unless @user.user_extensions.school.nil? %> <%= l(:field_occupation) %>: - <% unless @user.user_extensions.school.nil? %> <%= @user.user_extensions.school.name %> - <% end %> + <% end %> - <% elsif @user.user_extensions.identity == 3 %> + <% elsif @user.user_extensions.identity == 3 && @user.user_extensions.occupation.empty? %> <%= l(:field_occupation) %>: diff --git a/app/views/school/index.html.erb b/app/views/school/index.html.erb index aeb7d0943..00f419aab 100644 --- a/app/views/school/index.html.erb +++ b/app/views/school/index.html.erb @@ -18,9 +18,6 @@ } }) }); - - - - - -