#1297修复学生能看到发布通知按钮的BUG

2.增加课程是否对学生开发的数据迁移
 3.页面代码整理
 解决方案:增加当前登录用户是否在课程有发布通知权限的判断
This commit is contained in:
sw 2014-10-08 10:27:19 +08:00
parent f6561395a4
commit b6551f8955
3 changed files with 118 additions and 92 deletions

View File

@ -24,17 +24,17 @@
<script type="text/javascript">
function startXMLHttp()
{
$.ajax({
url: '<%= update_score_user_path(:format => 'js') %>',
type: 'get',
data: 'id=<%= @user.id %>',
remote: true
}) ;
$.ajax({
url: '<%= update_score_user_path(:format => 'js') %>',
type: 'get',
data: 'id=<%= @user.id %>',
remote: true
}) ;
}
function t()
{
setInterval("startXMLHttp()",5000);
setInterval("startXMLHttp()",5000);
}
</script>
@ -48,24 +48,30 @@
<div id="main">
<!--added by huang-->
<div class="top-content">
<table>
<tr>
<td class="info_font" style="width: 238px; color: #15bccf"><%= l(:label_user_home) %></td>
<td style="width: 430px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
<td rowspan="2" width="250px">
<div class="top-content-search <%='hidden' if show_search_bar(params) %>">
<%= form_tag(:controller => 'users', :action => 'search', :method => :get) do %>
<%= text_field_tag 'name', params[:name], :size => 20 %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<% end %>
</div>
</td>
</tr>
<tr>
<td style="padding-left: 8px"><%=link_to request.host()+"/users" ,:controller => 'users', :action => 'index' %></td>
<!-- modified by bai --> <td><%=link_to "主页", home_path %> > <%=link_to "软件创客", :controller => 'users', :action => 'index' %> > <span><%=link_to @user.name, user_path %></span></td>
</tr>
</table>
<table>
<tr>
<td class="info_font" style="width: 238px; color: #15bccf"><%= l(:label_user_home) %></td>
<td style="width: 430px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
<td rowspan="2" width="250px">
<div class="top-content-search <%='hidden' if show_search_bar(params) %>">
<%= form_tag(:controller => 'users', :action => 'search', :method => :get) do %>
<%= text_field_tag 'name', params[:name], :size => 20 %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<% end %>
</div>
</td>
</tr>
<tr>
<td style="padding-left: 8px">
<%=link_to request.host()+"/users" ,:controller => 'users', :action => 'index' %>
</td>
<td>
<%=link_to "主页", home_path %> >
<%=link_to "软件创客", :controller => 'users', :action => 'index' %> >
<span><%=link_to @user.name, user_path %></span>
</td>
</tr>
</table>
</div>
<!--end-->
<!--user page, add by huang-->
@ -92,11 +98,12 @@
<% end %></td>
</tr>
<tr><td class="score">
<div id="score_div">
<%= render :partial => 'users/user_score', :locals => {:user => @user}%>
</div>
</td>
<tr>
<td class="score">
<div id="score_div">
<%= render :partial => 'users/user_score', :locals => {:user => @user}%>
</div>
</td>
</tr>
<!-- end -->
@ -104,40 +111,45 @@
</tr>
</table>
<div>
<strong class="font_small_watch"><%= link_to l(:label_user_watcher)+"("+User.watched_by(@user.id).count.to_s+")" ,:controller=>"users", :action=>"user_watchlist"%></strong> &nbsp;
<strong class="font_small_watch">
<%= link_to l(:label_user_watcher)+"("+User.watched_by(@user.id).count.to_s+")" ,:controller=>"users", :action=>"user_watchlist"%>
</strong> &nbsp;
<strong class="font_small_watch"><%= 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" %></strong>&nbsp;
<!-- <strong class="font_small_watch"><%= link_to l(:label_requirement_focus)+"("+Bid.watched_by(@user).where('reward_type = ?', 1).count.to_s+")" ,:controller=>"users", :action=>"watch_bids"%></strong>--> &nbsp; <!-- added by huang -->
<!-- added by bai 个人签名-->
<strong class="font_small_watch">
<%= 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" %>
</strong>&nbsp;&nbsp;
<% if @user.id == User.current.id %>
<p>
<%= toggle_link l(:label_brief_introduction), 'introduction', {:focus => 'new_form_user_introduction'} %>
</p>
<% end %>
<% unless @user.user_extensions.nil? %>
<p style="width: 100%;word-break: break-all;word-wrap: break-word;">
<%= @user.user_extensions.brief_introduction %>
</p>
<p style="width: 100%;word-break: break-all;word-wrap: break-word;">
<%= @user.user_extensions.brief_introduction %>
</p>
<% end %>
<div id="introduction" style="display: none">
<%= form_for('new_form', :method => :post,
:url => {:controller => 'words', :action => 'add_brief_introdution'}) do |f|%>
<table border="0" width="100%" align="center" >
<tr>
<td><%= f.text_area 'user_introduction', :rows => 3,
:cols => 65,
:placeholder => "#{l(:label_my_brief_introduction)}",
:style => "resize: none;",
:class => 'noline'%></td>
</tr>
</table>
<table border="0" width="200px" align="center">
<tr>
<td align="right"> <%= submit_tag l(:button_submit), :name => nil ,
:class => "bid_btn" %></td>
</tr>
</table>
:url => {:controller => 'words', :action => 'add_brief_introdution'}) do |f|%>
<table border="0" width="100%" align="center" >
<tr>
<td>
<%= f.text_area 'user_introduction', :rows => 3,
:cols => 65,
:placeholder => "#{l(:label_my_brief_introduction)}",
:style => "resize: none;",
:class => 'noline'%>
</td>
</tr>
</table>
<table border="0" width="200px" align="center">
<tr>
<td align="right">
<%= submit_tag l(:button_submit), :name => nil ,
:class => "bid_btn" %>
</td>
</tr>
</table>
<% end %>
</div>
<!-- end -->
@ -148,55 +160,64 @@
<div class="inf_user_context">
<table style="font-family:'微软雅黑'" width="240">
<tr>
<td style="padding-left: 5px" width="70px"><%= l(:label_user_joinin) %></td><td class="font_lighter_sidebar" style="padding-left: 0px" width="170px"><%= format_time(@user.created_on) %></td>
<td style="padding-left: 5px" width="70px">
<%= l(:label_user_joinin) %>
</td>
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
<%= format_time(@user.created_on) %>
</td>
</tr>
<tr>
<td style="padding-left: 5px"><%= l(:label_user_login) %></td><td class="font_lighter_sidebar" style="padding-left: 0px"><%= format_time(@user.last_login_on) %></td>
<td style="padding-left: 5px">
<%= l(:label_user_login) %>
</td>
<td class="font_lighter_sidebar" style="padding-left: 0px">
<%= format_time(@user.last_login_on) %>
</td>
</tr>
<!--
<tr>
<td valign="top" style="padding-left: 5px;"><%#= l(:label_user_mail) %></td><td class="font_lighter_sidebar" style="padding-left: 0px; word-wrap: break-word; word-break: break-all"><%#= mail_to(h(@user.mail), nil, :encode => 'javascript') %></td>
</tr>
-->
<!-- added by bai 在个人主页里显示“工作单位”“地区”"教师的职称"-->
<!-- modified by linchun 在个人主页里显示“加入时间”,“最后登录”,“邮件地址”后面添加冒号-->
<!-- modified by zjc 高校添加超链接 -->
<% unless @user.user_extensions.nil? %>
<% unless @user.user_extensions.identity == 2 %>
<tr>
<td style="padding-left: 5px" width="70px"><%= l(:field_occupation) %></td><td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
<% unless @user.user_extensions.school.nil? %>
<a href="http://course.trustie.net/?school_id=<%= @user.user_extensions.school.id%>"><%= @user.user_extensions.school.name %></a>
<% end %>
</td>
</tr>
<% end %>
<% unless @user.user_extensions.identity == 2 %>
<tr>
<td style="padding-left: 5px" width="70px"><%= l(:field_occupation) %></td><td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
<% unless @user.user_extensions.school.nil? %>
<a href="http://course.trustie.net/?school_id=<%= @user.user_extensions.school.id%>"><%= @user.user_extensions.school.name %></a>
<% end %>
</td>
</tr>
<% end %>
<tr>
<td style="padding-left: 5px" width="76px"><%= l(:label_location) %>:</td><td class="font_lighter_sidebar" style="padding-left: 0px" width="170px"><%= @user.user_extensions.location %><%= @user.user_extensions.location_city %></td>
</tr>
<tr>
<% if @user.user_extensions.identity == 0 %>
<td style="padding-left: 5px" width="76px">
<%= l(:label_technical_title) %>:</td><td class="font_lighter_sidebar" style="padding-left: 0px" width="170px"><%= @user.user_extensions.technical_title %></td>
<td style="padding-left: 5px" width="76px">
<%= l(:label_technical_title) %>:
</td>
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
<%= @user.user_extensions.technical_title %>
</td>
<% end %>
</tr>
<% if( (@user.user_extensions.identity == 1) && (is_watching?(@user) ) )%>
<tr>
<td style="padding-left: 8px" width="70px"><%= l(:label_bidding_user_studentcode)%>:</td><td class="font_lighter_sidebar" style="padding-left: 0px" width="170px"><%= @user.user_extensions.student_id %></td>
</tr>
<tr>
<td style="padding-left: 8px" width="70px">
<%= l(:label_bidding_user_studentcode)%>:
</td>
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
<%= @user.user_extensions.student_id %>
</td>
</tr>
<% end %>
<% else%>
<tr>
<td style="padding-left: 8px" width="70px"><%= l(:field_occupation) %>:</td>
</tr>
<tr>
<td style="padding-left: 8px" width="70px"><%= l(:label_location) %>:</td>
</tr>
<tr>
<td style="padding-left: 8px" width="70px"><%= l(:field_occupation) %>:</td>
</tr>
<tr>
<td style="padding-left: 8px" width="70px"><%= l(:label_location) %>:</td>
</tr>
<% end %>
<!-- end -->
</table>
</div>
<!--Modified by nie-->
<div class="user_underline"></div>
@ -251,9 +272,9 @@
<div id="content" style="padding-top: 0px;">
<div class="tabs_new">
<% if @user.user_extensions.identity == 2 %>
<%= render_menu :user_enterprise_menu %>
<%= render_menu :user_enterprise_menu %>
<% else %>
<%= render_menu :user_menu %>
<%= render_menu :user_menu %>
<% end %>
</div>

View File

@ -64,12 +64,12 @@
<span style="font-size: 16px; border-bottom:1px solid #f0f0f0; margin-right: 15px;">
<%= label_tips %>
</span>
<%= link_to(btn_tips,
new_course_news_path(@course),
:class => 'icon icon-add',
:onclick => 'showAndScrollTo("add-news", "news_title"); return false;') %>
<% if @course && User.current.allowed_to?(:manage_news, @course) %>
<%= link_to(btn_tips, new_course_news_path(@course),
:class => 'icon icon-add',
:onclick => 'showAndScrollTo("add-news", "news_title"); return false;') %>
<div id="add-news" class="add_frame" style="display:none;">
<%= labelled_form_for @news, :url => course_news_index_path(@course),
:html => {:id => 'news-form', :multipart => true} do |f| %>

View File

@ -0,0 +1,5 @@
class AddOpenStudentToCourse < ActiveRecord::Migration
def change
add_column :courses, :open_student, :integer, :default => 0
end
end