Merge branch 'develop' into weixin_guange
Conflicts: app/models/student_work.rb app/models/student_work_test.rb app/views/blog_comments/show.html.erb public/javascripts/homework.js
This commit is contained in:
commit
e802629d27
|
@ -0,0 +1,3 @@
|
|||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
|
@ -0,0 +1,3 @@
|
|||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the ArticleHomepages controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the Homepages controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -0,0 +1,78 @@
|
|||
class ArticleHomepagesController < ApplicationController
|
||||
before_filter :find_article_homepage, :only => [:show, :edit, :update, :destroy]
|
||||
|
||||
def new
|
||||
@article = ArticleHomepage.new
|
||||
respond_to do |format|
|
||||
format.html {render :layout=>'static_base'}
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
if User.current.logged?
|
||||
@article = ArticleHomepage.new
|
||||
@article.user = User.current
|
||||
@article.homepage_id = User.current.homepage.id
|
||||
@article.title = params[:article_homepage][:title]
|
||||
@article.content = params[:article_homepage][:content]
|
||||
if @article.save
|
||||
if params[:set_homepage]
|
||||
User.current.homepage.update_attribute(:article_id, @article.id)
|
||||
end
|
||||
redirect_to user_homepages_path(:user_id => User.current.id)
|
||||
end
|
||||
else
|
||||
redirect_to signin_path
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
respond_to do |format|
|
||||
format.html {render :layout => 'clear_base'}
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
if User.current.admin? || User.current.id == @article.user_id
|
||||
respond_to do |format|
|
||||
format.html { render :layout => 'static_base' }
|
||||
end
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
if User.current.logged?
|
||||
@article.title = params[:article_homepage][:title]
|
||||
@article.content = params[:article_homepage][:content]
|
||||
if params[:set_homepage]
|
||||
User.current.homepage.update_attribute(:article_id, @article.id)
|
||||
else
|
||||
if User.current.homepage.article_id == @article.id
|
||||
User.current.homepage.update_attribute(:article_id, nil)
|
||||
end
|
||||
end
|
||||
if @article.save
|
||||
redirect_to user_homepages_path(:user_id => User.current.id)
|
||||
end
|
||||
else
|
||||
redirect_to signin_path
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @article
|
||||
if @article.homepage.article_id == @article.id
|
||||
@article.homepage.update_attribute(:article_id, nil)
|
||||
end
|
||||
@article.destroy
|
||||
redirect_to user_homepages_path(:user_id => User.current.id)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def find_article_homepage
|
||||
@article = ArticleHomepage.find params[:id]
|
||||
end
|
||||
end
|
|
@ -0,0 +1,63 @@
|
|||
class HomepagesController < ApplicationController
|
||||
before_filter :find_user
|
||||
|
||||
def index
|
||||
if User.current.logged? && User.current == @user
|
||||
@b_sort = params[:sort] || 1
|
||||
@b_sort = @b_sort.to_i == 1 ? 2 : 1
|
||||
sort_type = @b_sort == 1 ? "asc" : "desc"
|
||||
if @user.base_homepage.nil?
|
||||
@articles = @user.homepage.article_homepages.reorder("updated_at #{sort_type}")
|
||||
else
|
||||
@articles = @user.homepage.article_homepages.where("id != #{@user.base_homepage.id}").reorder("updated_at #{sort_type}").all
|
||||
@articles.insert(0, @user.base_homepage) unless @user.base_homepage.nil?
|
||||
end
|
||||
@limit = 20
|
||||
@is_remote = true
|
||||
@atta_count = @articles.count
|
||||
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
|
||||
@offset ||= @atta_pages.offset
|
||||
@articles = paginateHelper @articles,@limit
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {render :layout=>'new_base_user'}
|
||||
end
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
end
|
||||
|
||||
def set_homepage
|
||||
@homepage = Homepage.find(params[:id])
|
||||
@homepage.update_attribute(:article_id, params[:article_id])
|
||||
if @user.base_homepage.nil?
|
||||
@articles = @user.homepage.article_homepages.reorder("updated_at desc")
|
||||
else
|
||||
@articles = @user.homepage.article_homepages.where("id != #{@user.base_homepage.id}").reorder("updated_at desc").all
|
||||
@articles.insert(0, @user.base_homepage) unless @user.base_homepage.nil?
|
||||
end
|
||||
redirect_to user_homepages_path(:user_id => @user.id)
|
||||
end
|
||||
|
||||
def cancel_homepage
|
||||
@homepage = Homepage.find(params[:id])
|
||||
@homepage.update_attribute(:article_id, nil)
|
||||
if @user.base_homepage.nil?
|
||||
@articles = @user.homepage.article_homepages.reorder("updated_at desc")
|
||||
else
|
||||
@articles = @user.homepage.article_homepages.where("id != #{@user.base_homepage.id}").reorder("updated_at desc").all
|
||||
@articles.insert(0, @user.base_homepage) unless @user.base_homepage.nil?
|
||||
end
|
||||
redirect_to user_homepages_path(:user_id => @user.id)
|
||||
end
|
||||
|
||||
private
|
||||
def find_user
|
||||
@user = User.find(params[:user_id])
|
||||
end
|
||||
end
|
|
@ -705,7 +705,7 @@ class PollController < ApplicationController
|
|||
sheet1[count_row + 1,0] = l(:label_poll_subtotal)
|
||||
sheet1[count_row + 2,0] = l(:label_poll_proportion)
|
||||
poll_question.poll_answers.each_with_index do |poll_answer,i|
|
||||
sheet1[count_row, i + 1] = poll_answer.answer_text.gsub(/<\/?.*?>/,"").gsub(/ /," ")
|
||||
sheet1[count_row, i + 1] = poll_answer.answer_text == "" ? l(:label_poll_other) : poll_answer.answer_text.gsub(/<\/?.*?>/,"").gsub(/ /," ")
|
||||
sheet1[count_row + 1, i + 1] = poll_answer.poll_votes.count
|
||||
sheet1[count_row + 2, i + 1] = statistics_result_percentage(poll_answer.poll_votes.count, total_answer(poll_question.id)).to_s + "%"
|
||||
end
|
||||
|
@ -717,27 +717,58 @@ class PollController < ApplicationController
|
|||
sheet1[count_row,0] = l(:label_poll_question_num,:num => poll_question.question_number)
|
||||
sheet1[count_row,1] = poll_question.question_title
|
||||
count_row += 1
|
||||
poll_question.poll_votes.each do |poll_vote|
|
||||
sheet1[count_row,0] = poll_vote.vote_text.gsub(/<\/?.*?>/,"").gsub(/ /," ")
|
||||
if poll_question.question_type == 3
|
||||
poll_question.poll_votes.each do |poll_vote|
|
||||
sheet1[count_row,0] = poll_vote.vote_text.gsub(/<\/?.*?>/,"").gsub(/ /," ")
|
||||
count_row += 1
|
||||
end
|
||||
count_row += 1
|
||||
else
|
||||
count = 0
|
||||
poll_question.poll_answers.reorder("answer_position asc").each_with_index do |poll_answer,i|
|
||||
sheet1.row(count_row).default_format = blue
|
||||
sheet1[count_row, i] = poll_answer.answer_text.gsub(/<\/?.*?>/,"").gsub(/ /," ")
|
||||
count = poll_question.poll_votes.where("poll_answer_id = #{poll_answer.id}").count > count ? poll_question.poll_votes.where("poll_answer_id = #{poll_answer.id}").count : count
|
||||
poll_question.poll_votes.where("poll_answer_id = #{poll_answer.id}").each_with_index do |poll_vote, j|
|
||||
sheet1[count_row + j + 1,i] = poll_vote.vote_text.gsub(/<\/?.*?>/,"").gsub(/ /," ")
|
||||
end
|
||||
end
|
||||
count_row = count_row + count + 2
|
||||
end
|
||||
count_row += 1
|
||||
end
|
||||
end
|
||||
|
||||
sheet1.row(count_row).default_format = blue
|
||||
sheet1[count_row ,0] = l(:label_bidding_user_studentname)
|
||||
poll_questions.each_with_index do |poll_question, i|
|
||||
sheet1[count_row ,i + 1] = poll_question.question_title
|
||||
current_index = 1
|
||||
poll_questions.each do |poll_question|
|
||||
if poll_question.question_type == 4
|
||||
poll_question.poll_answers.reorder("answer_position asc").each do |ans|
|
||||
sheet1[count_row ,current_index] = poll_question.question_title + "(#{ans.answer_text})"
|
||||
current_index += 1
|
||||
end
|
||||
else
|
||||
sheet1[count_row ,current_index] = poll_question.question_title
|
||||
current_index += 1
|
||||
end
|
||||
end
|
||||
count_row += 1
|
||||
@poll.users.each do |user|
|
||||
sheet1[count_row ,0] = user.show_name
|
||||
current_index = 1
|
||||
poll_questions.each_with_index do |poll_question, i|
|
||||
if poll_question.question_type == 1 || poll_question.question_type == 2
|
||||
sheet1[count_row ,i + 1] = user.poll_votes.where(:poll_question_id => poll_question.id).map{|poll_vote| poll_vote.poll_answer.answer_text.gsub(/<\/?.*?>/,"").gsub(/ /," ") if poll_vote.poll_answer}.join(";")
|
||||
sheet1[count_row ,current_index] = user.poll_votes.where(:poll_question_id => poll_question.id).map{|poll_vote| poll_vote.poll_answer.answer_text.gsub(/<\/?.*?>/,"").gsub(/ /," ") if poll_vote.poll_answer}.join(";")
|
||||
current_index += 1
|
||||
elsif poll_question.question_type == 3
|
||||
sheet1[count_row ,current_index] = user.poll_votes.where(:poll_question_id => poll_question.id).map{|poll_vote| poll_vote.vote_text.gsub(/<\/?.*?>/,"").gsub(/ /," ")}.join(";")
|
||||
current_index += 1
|
||||
else
|
||||
sheet1[count_row ,i + 1] = user.poll_votes.where(:poll_question_id => poll_question.id).map{|poll_vote| poll_vote.vote_text.gsub(/<\/?.*?>/,"").gsub(/ /," ")}.join(";")
|
||||
poll_question.poll_answers.reorder("answer_position asc").each do |ans|
|
||||
poll_vote = user.poll_votes.where(:poll_question_id => poll_question.id, :poll_answer_id => ans.id).first
|
||||
sheet1[count_row ,current_index] = poll_vote.nil? ? "" : poll_vote.vote_text
|
||||
current_index += 1
|
||||
end
|
||||
end
|
||||
end
|
||||
count_row += 1
|
||||
|
|
|
@ -190,7 +190,7 @@ class StudentWorkController < ApplicationController
|
|||
status = student_work_test.status
|
||||
resultObj[:testid] = student_work_test.id
|
||||
end
|
||||
|
||||
student_work.save
|
||||
#超时或编译错误则直接返回了并存入数据库
|
||||
if resultObj[:status] == 2 || resultObj[:status] == -2 || index == @homework.homework_tests.size
|
||||
if status == 0
|
||||
|
|
|
@ -42,7 +42,7 @@ class UsersController < ApplicationController
|
|||
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource,
|
||||
:user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction,
|
||||
:user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist,:sort_syllabus_list,
|
||||
:sort_project_list,:my_homeworks,:manage_or_receive_homeworks,:search_m_r_homeworks, :cancel_or_collect,:expand_courses]
|
||||
:sort_project_list,:my_homeworks,:manage_or_receive_homeworks,:search_m_r_homeworks, :cancel_or_collect,:expand_courses,:homepage]
|
||||
before_filter :auth_user_extension, only: :show
|
||||
#before_filter :rest_user_score, only: :show
|
||||
#before_filter :select_entry, only: :user_projects
|
||||
|
@ -3580,6 +3580,15 @@ class UsersController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def homepage
|
||||
if @user.base_homepage
|
||||
@article = @user.base_homepage
|
||||
respond_to do |format|
|
||||
format.html {render :layout => 'clear_base'}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_user
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
module ArticleHomepagesHelper
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
module HomepagesHelper
|
||||
end
|
|
@ -9,4 +9,5 @@ module OwnerTypeHelper
|
|||
HOMEWORKCOMMON = 8
|
||||
BLOGCOMMENT = 9
|
||||
SYLLABUS = 10
|
||||
ArticleHomepage = 11
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class ArticleHomepage < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
belongs_to :homepage
|
||||
attr_accessible :content, :title, :user_id, :homepage_id
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class Homepage < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
has_many :article_homepages
|
||||
attr_accessible :name, :article_id, :user_id
|
||||
end
|
|
@ -30,15 +30,15 @@ class StudentWork < ActiveRecord::Base
|
|||
student_work_tests.order('id desc').first
|
||||
end
|
||||
|
||||
private
|
||||
private
|
||||
def set_program_score
|
||||
if self.homework_common.is_program_homework? #编程作业,学生提交作品后计算系统得分
|
||||
#根据最后一次测试计算得分
|
||||
unless last_test
|
||||
self.system_score = 0
|
||||
else
|
||||
self.system_score = last_test.test_score self.homework_common.homework_tests.size
|
||||
end
|
||||
#根据最后一次测试计算得分
|
||||
unless last_test
|
||||
self.system_score = 0
|
||||
else
|
||||
self.system_score = last_test.test_score self.homework_common.homework_tests.size
|
||||
end
|
||||
end
|
||||
set_final_score self.homework_common,self
|
||||
end
|
||||
|
@ -133,7 +133,7 @@ class StudentWork < ActiveRecord::Base
|
|||
else
|
||||
student_work.work_score = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
else #不考虑教师评分
|
||||
if student_work.teaching_asistant_score.nil? #教辅未评分
|
||||
if student_work.student_score.nil?
|
||||
|
|
|
@ -38,7 +38,7 @@ class StudentWorkTest < ActiveRecord::Base
|
|||
100
|
||||
elsif self.results.empty?
|
||||
0
|
||||
else
|
||||
else
|
||||
get_success_count * 100 / testcount
|
||||
end
|
||||
end
|
||||
|
|
|
@ -208,6 +208,9 @@ class User < Principal
|
|||
acts_as_watchable
|
||||
|
||||
has_one :user_extensions,:dependent => :destroy
|
||||
has_one :homepage, :dependent => :destroy
|
||||
has_many :article_homepages, :dependent => :destroy
|
||||
|
||||
## end
|
||||
|
||||
# default_scope -> { includes(:user_extensions, :user_score) }
|
||||
|
@ -347,6 +350,25 @@ class User < Principal
|
|||
@blog
|
||||
end
|
||||
|
||||
def homepage
|
||||
@homepage = Homepage.where("user_id = #{self.id}").all[0]
|
||||
if @homepage.nil?
|
||||
#如果某个user的blog不存在,那么就创建一条,并且跳转
|
||||
@homepage = Homepage.create(:name=>(User.find(self.id).login), :user_id=>self.id)
|
||||
@homepage.save
|
||||
end
|
||||
@homepage
|
||||
end
|
||||
|
||||
def base_homepage
|
||||
@base_homepage = nil
|
||||
@homepage = self.homepage
|
||||
if @homepage.article_id and ArticleHomepage.where("id=?", @homepage.article_id).count > 0
|
||||
@base_homepage = ArticleHomepage.where("id=?", @homepage.article_id).first
|
||||
end
|
||||
@base_homepage
|
||||
end
|
||||
|
||||
# 查询指派给我的缺陷记录
|
||||
def count_new_issue_assign_to
|
||||
self.issue_assigns
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: false, prettify: false) %>
|
||||
<%= javascript_include_tag 'homepage' %>
|
||||
<% end %>
|
||||
|
||||
<div>
|
||||
<input type="text" name="article_homepage[title]" id="message_subject" class="InputBox" style="width: 99.5%;" maxlength="255" onkeyup="regexTopicSubject();" placeholder="请输入标题,该标题不会在个人主页中显示" value="<%=@article.title %>" />
|
||||
<p id="subjectmsg"></p>
|
||||
</div>
|
||||
<div>
|
||||
<div class="mt10">
|
||||
<div id="message_quote" class="wiki" style="width: 92%;word-break: break-all;word-wrap: break-word;margin-left: 40px;"></div>
|
||||
<%= text_area :quote,:quote,:style => 'display:none' %>
|
||||
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
|
||||
|
||||
<%= f.kindeditor :content, :editor_id => 'message_content_editor',
|
||||
:owner_id => @article.nil? ? 0: @article.id,
|
||||
:owner_type => OwnerTypeHelper::ArticleHomepage,
|
||||
:width => '100%',
|
||||
:height => 500,
|
||||
:minHeight=>500,
|
||||
:class => 'talk_text fl',
|
||||
:input_html => { :id => 'message_content',
|
||||
:class => 'talk_text fl',
|
||||
:maxlength => 5000 }%>
|
||||
<div class="cl"></div>
|
||||
<p id="message_content_span"></p>
|
||||
<p id="e_tip" class="c_grey"></p>
|
||||
<p id="e_tips" class="c_grey"></p>
|
||||
</div>
|
||||
<div class="mt10">
|
||||
<input type="checkbox" value="1" id="set_homepage" name="set_homepage"/>
|
||||
<label for="set_homepage">设为主页</label>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt5">
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_article();">确定</a>
|
||||
<span class="fr mr10 mt3">或</span>
|
||||
<a href="javascript:void(0);" class="fr mr10 mt3" onclick="reset_article();">取消</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function reset_article(){
|
||||
window.location.href = "<%=user_homepages_path(:user_id => User.current.id) %>";
|
||||
}
|
||||
$(function() {
|
||||
<% if is_edit && @article.homepage.article_id == @article.id %>
|
||||
$("#set_homepage").attr('checked',true);
|
||||
<% end %>
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,60 @@
|
|||
<div class="homepageContentContainer" style="margin-top: 25px;">
|
||||
<div class="homepageContent">
|
||||
<div class="postContainer mb10 pr">
|
||||
<% if User.current && User.current == @article.user %>
|
||||
<div class="homepagePostSetting" id="message_setting_<%= @article.id%>" style="top: -25px;">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li>
|
||||
<% if @article.id == @article.homepage.article_id %>
|
||||
<%= link_to(
|
||||
l(:button_cancel_base_homepage),
|
||||
{:controller => 'homepages',:action => 'cancel_homepage',:user_id=>@article.user_id,:id=>@article.homepage_id, :article_id => @article.id, :show => 1},
|
||||
:method => :post,
|
||||
:class => 'postOptionLink'
|
||||
)%>
|
||||
<% else %>
|
||||
<%= link_to(
|
||||
l(:button_set_base_homepage),
|
||||
{:controller => 'homepages',:action => 'set_homepage',:user_id=>@article.user_id,:id=>@article.homepage_id, :article_id => @article.id, :show => 1},
|
||||
:method => :post,
|
||||
:class => 'postOptionLink'
|
||||
) %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_edit),
|
||||
{:controller => 'article_homepages',:action => 'edit', :id => @article.id},
|
||||
:class => 'postOptionLink'
|
||||
) %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:controller => 'article_homepages',:action => 'destroy', :id => @article.id},
|
||||
:method => :delete,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'postOptionLink'
|
||||
) %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="break_word" style="padding: 5px 5px 0 0" id="intro_content">
|
||||
<%=@article.content.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function(){
|
||||
autoUrl('intro_content');
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,18 @@
|
|||
<div class="homepageContentContainer">
|
||||
<div class="homepageContent">
|
||||
<div class="postContainer mb10">
|
||||
<%= labelled_form_for @article, :url =>{:controller=>'article_homepages',:action => 'update'},
|
||||
:html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %>
|
||||
<%= render :partial => 'article_form', :locals => {:is_edit => true, :f => f} %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
setTimeout(function(){
|
||||
elocalStorage(message_content_editor,'article_homepage_edit_<%=User.current.id %>');
|
||||
}, 10000);
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,18 @@
|
|||
<div class="homepageContentContainer">
|
||||
<div class="homepageContent">
|
||||
<div class="postContainer mb10">
|
||||
<%= labelled_form_for @article, :url =>{:controller=>'article_homepages',:action => 'create'},
|
||||
:html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %>
|
||||
<%= render :partial => 'article_form', :locals => {:is_edit => false, :f => f} %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
setTimeout(function(){
|
||||
elocalStorage(message_content_editor,'article_homepage_<%=User.current.id %>');
|
||||
}, 10000);
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1 @@
|
|||
<%= render :partial => 'article_show' %>
|
|
@ -3,7 +3,7 @@
|
|||
<%= javascript_include_tag 'blog' %>
|
||||
<% end %>
|
||||
|
||||
<div class="resources mt10">
|
||||
<div class="resources">
|
||||
<div id="new_course_topic">
|
||||
<div class="homepagePostBrief c_grey">
|
||||
<div>
|
||||
|
|
|
@ -60,21 +60,21 @@
|
|||
) if User.current.admin? || User.current.id == @article.author.id %>
|
||||
</li>
|
||||
<!--<li>-->
|
||||
<%# if @article.id == @article.blog.homepage_id %>
|
||||
<!--<%# if @article.id == @article.blog.homepage_id %>-->
|
||||
<%#= link_to(
|
||||
l(:button_cancel_homepage),
|
||||
{:controller => 'blogs',:action => 'cancel_homepage',:user_id=>@article.author_id,:id=>@article.blog_id, :article_id => @article.id},
|
||||
:method => :post,
|
||||
:class => 'postOptionLink'
|
||||
# l(:button_cancel_homepage),
|
||||
# {:controller => 'blogs',:action => 'cancel_homepage',:user_id=>@article.author_id,:id=>@article.blog_id, :article_id => @article.id},
|
||||
# :method => :post,
|
||||
# :class => 'postOptionLink'
|
||||
) if User.current && User.current.id == @article.blog.author_id %>
|
||||
<%# else %>
|
||||
<!--<%# else %>-->
|
||||
<%#= link_to(
|
||||
l(:button_set_homepage),
|
||||
{:controller => 'blogs',:action => 'set_homepage',:user_id=>@article.author_id,:id=>@article.blog_id, :article_id => @article.id},
|
||||
:method => :post,
|
||||
:class => 'postOptionLink'
|
||||
# l(:button_set_homepage),
|
||||
# {:controller => 'blogs',:action => 'set_homepage',:user_id=>@article.author_id,:id=>@article.blog_id, :article_id => @article.id},
|
||||
# :method => :post,
|
||||
# :class => 'postOptionLink'
|
||||
) if User.current && User.current.id == @article.blog.author_id %>
|
||||
<%# end %>
|
||||
<!--<%# end %>-->
|
||||
<!--</li>-->
|
||||
</ul>
|
||||
</li>
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
<div class="cl"> </div>
|
||||
<div id="blog-list">
|
||||
<div class="listbox mt10">
|
||||
<div class="list-h2 fl" style="font-weight: normal">个人主页列表</div>
|
||||
<div class="fr">
|
||||
<%=link_to '新 建', new_article_homepage_path(), :target => "_blank", :class => 'BlueCirBtn' %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="category">
|
||||
<span class="grayTxt">排序:</span>
|
||||
<%= link_to "时间", {:controller => 'homepages', :action => 'index', :user_id =>@user.id, :sort => @b_sort}, :class => "sortTxt", :remote => true %>
|
||||
<%= link_to "", {:controller => 'homepages', :action => 'index', :user_id =>@user.id, :sort => @b_sort}, :class => "#{@b_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="bloglistbox">
|
||||
<% if @articles.any? %>
|
||||
<% @articles.each do |activity| %>
|
||||
<ul class="list-file pr" onmouseover='$("#message_setting_<%= activity.id%>").show();' onmouseout='$("#message_setting_<%= activity.id%>").hide();'>
|
||||
<li><span class="item_list fl"></span>
|
||||
<%= link_to activity.title.to_s.html_safe, user_homepage_article_homepage_path(:user_id=>activity.user_id, :homepage_id=>activity.homepage_id,:id=>activity), :class=> "list-title fl", :target => '_blank' %>
|
||||
<% if activity.homepage.article_id and activity.id == activity.homepage.article_id %>
|
||||
<span class="red_homework_btn_cir ml5">主页</span>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class="ml15">
|
||||
<span class="grayTxt">更新:<%= format_time(activity.updated_at) %></span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostSetting" id="message_setting_<%= activity.id%>" style="display: none">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li>
|
||||
<% if activity.id == activity.homepage.article_id %>
|
||||
<%= link_to(
|
||||
l(:button_cancel_base_homepage),
|
||||
{:controller => 'homepages',:action => 'cancel_homepage',:user_id=>activity.user_id,:id=>activity.homepage_id, :article_id => activity.id},
|
||||
:method => :post,
|
||||
:class => 'postOptionLink'
|
||||
) if User.current && User.current.id == activity.homepage.user_id %>
|
||||
<% else %>
|
||||
<%= link_to(
|
||||
l(:button_set_base_homepage),
|
||||
{:controller => 'homepages',:action => 'set_homepage',:user_id=>activity.user_id,:id=>activity.homepage_id, :article_id => activity.id},
|
||||
:method => :post,
|
||||
:class => 'postOptionLink'
|
||||
) if User.current && User.current.id == activity.homepage.user_id %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_edit),
|
||||
{:controller => 'article_homepages',:action => 'edit', :id => activity.id},
|
||||
:class => 'postOptionLink'
|
||||
) if User.current.admin? || User.current.id == activity.user_id %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:controller => 'article_homepages',:action => 'destroy', :id => activity.id},
|
||||
:method => :delete,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'postOptionLink'
|
||||
) if User.current.admin? || User.current.id == activity.user_id %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</ul>
|
||||
<% end %>
|
||||
<div>
|
||||
<ul class="wlist" id="pages" >
|
||||
<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
//如果右边的博客列表比左边的高度低则将右边的高度设为与左边对齐
|
||||
$(function() {
|
||||
var leftHeight = $("#LSide").height() - $(".fontGrey5").height() - 10;
|
||||
var rightHeight = $(".homepageRight").height();
|
||||
if (rightHeight < leftHeight) {
|
||||
var diffHeight = leftHeight - rightHeight;
|
||||
var tmpHeight = $(".listbox").height() + diffHeight;
|
||||
$(".listbox").css("height", tmpHeight);
|
||||
}
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,8 @@
|
|||
<% if !@articles.empty? && @user.base_homepage.nil? %>
|
||||
<p class="nodata mt10 mb0" style="text-align: left;">您还没有设置个人主页,其他用户无法查看哦</p>
|
||||
<% end %>
|
||||
<% if !@articles.empty? %>
|
||||
<%= render :partial => 'article_list' %>
|
||||
<% else %>
|
||||
<p class="nodata mt10" style="text-align: left;">您还没有创建属于自己的个人主页。<%=link_to '新建', new_user_homepage_article_homepage_path(:user_id=> @user.id, :homepage_id => @user.homepage.id), :target => "_blank", :class => 'linkBlue' %></p>
|
||||
<% end%>
|
|
@ -0,0 +1,12 @@
|
|||
<div class="homepageRight mt0">
|
||||
<div class="homepageRightBanner">
|
||||
<div class="f16 fl fontGrey3">
|
||||
个人主页
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div id="user_homepages">
|
||||
<%= render :partial => 'articles' %>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1 @@
|
|||
$("#blog-list").replaceWith('<%= escape_javascript( render :partial => 'article_list') %>');
|
|
@ -1,11 +1,25 @@
|
|||
<% if User.current.logged?%>
|
||||
<% if User.current == target%>
|
||||
<%= link_to("编辑个人资料", my_account_path, :class => "user_editinfo")%>
|
||||
<% else%>
|
||||
<%if(target.watched_by?(User.current))%>
|
||||
<%= link_to "取消关注",watch_path(:object_type=> 'user',:object_id=>target.id,:target_id=>target.id),:class => "user_editinfo", :method => "delete",:remote => "true", :title => "取消关注"%>
|
||||
<% else %>
|
||||
<%= link_to "添加关注",watch_path(:object_type=> 'user',:object_id=>target.id,:target_id=>target.id),:class => "user_editinfo", :method => "post",:remote => "true", :title => "添加关注"%>
|
||||
<% end %>
|
||||
<% end%>
|
||||
<% end %>
|
||||
<ul>
|
||||
<% if User.current.logged?%>
|
||||
<% if User.current == target%>
|
||||
<li style="width: 119px; float: left; border-right: 1px solid #ddd;"><%= link_to("编辑基本资料", my_account_path, :class => "user_editinfo") %></li>
|
||||
<li style="width: 118px; float: left;"><%= link_to '个人主页', user_homepages_path(:user_id => @user.id) , :class => "user_editinfo" %></li>
|
||||
<li class="cl"></li>
|
||||
<% else%>
|
||||
<li style="width: 119px; float: left; border-right: 1px solid #ddd;">
|
||||
<% if target.base_homepage.nil? %>
|
||||
<a href="javascript:void(0)" class ="user_editinfo" style="color: #cccccc" title="该用户暂未设置主页">主页</a>
|
||||
<% else %>
|
||||
<%=link_to "主页", homepage_user_path(@user), :class => 'user_editinfo', :target => '_blank' %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li style="width: 118px; float: left;">
|
||||
<%if(target.watched_by?(User.current))%>
|
||||
<%= link_to "取消关注",watch_path(:object_type=> 'user',:object_id=>target.id,:target_id=>target.id),:class => "user_editinfo", :method => "delete",:remote => "true", :title => "取消关注"%>
|
||||
<% else %>
|
||||
<%= link_to "添加关注",watch_path(:object_type=> 'user',:object_id=>target.id,:target_id=>target.id),:class => "user_editinfo", :method => "post",:remote => "true", :title => "添加关注"%>
|
||||
<% end %>
|
||||
</li>
|
||||
<li class="cl"></li>
|
||||
<% end%>
|
||||
<% end %>
|
||||
</ul>
|
|
@ -0,0 +1,46 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="<%= current_language %>">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title><%=h html_title %></title>
|
||||
<meta name="description" content="<%= Redmine::Info.app_name %>" />
|
||||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan','prettify', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= javascript_include_tag "jquery.leanModal.min",'prettify' %>
|
||||
<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
|
||||
<%= heads_for_theme %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
<%= stylesheet_link_tag 'css/common','css/structure','css/public','css/popup', :media => 'all'%>
|
||||
<!-- MathJax的配置 -->
|
||||
<script type="text/javascript"
|
||||
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
<!-- 配置 : 在生成的公式图片上去掉Math定义的右键菜单,$$ $$ \( \) \[ \] 中的公式给予显示-->
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
showMathMenu: false,
|
||||
showMathMenuMSIE: false,
|
||||
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
<%= yield %>
|
||||
<div style="clear:both;"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div id="ajax-modal" style="display:none;"></div>
|
||||
<div id="ajax-indicator" style="display:none;">
|
||||
<span><%= l(:label_loading) %></span>
|
||||
</div>
|
||||
<%= call_hook :view_layouts_base_body_bottom %>
|
||||
</body>
|
||||
</html>
|
|
@ -36,7 +36,7 @@
|
|||
<li>地区 : </li>
|
||||
<li>邮件通知 : </li>
|
||||
<!--<li>个人签名 : </li>-->
|
||||
<li>个人简介 : </li>
|
||||
<li>个人主页 : </li>
|
||||
<li> </li>
|
||||
</ul>
|
||||
<ul class="setting_right ">
|
||||
|
@ -179,7 +179,18 @@
|
|||
<label class="ml10"><%= check_box_tag 'no_self_notified', 1, @user.pref[:no_self_notified], :style => "height:14px;" %>不要发送对我自己提交的修改的通知</label>
|
||||
</li>
|
||||
<!--<li><input name="brief_introduction" class="w450" type="text" maxlength="255" value="<%#= (@user.user_extensions.nil?) ? '' : @user.user_extensions.brief_introduction %>"></li>-->
|
||||
<li style="height:auto;"><textarea name="description" class="w450 h200" maxlength="255" style="resize:none;"><%= (@user.user_extensions.nil?) ? '' : @user.user_extensions.description %></textarea></li>
|
||||
<li style="height:auto;">
|
||||
<% if @user.homepage && !@user.homepage.article_homepages.empty? %>
|
||||
<% if @user.base_homepage %>
|
||||
<%=link_to '查看', homepage_user_path(@user), :class => 'linkBlue',:target => '_blank' %>
|
||||
<% else %>
|
||||
<%=link_to '查看', user_homepages_path(:user_id => @user.id),:target => '_blank', :class => 'linkBlue' %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<p class="nodata" style="height: 22px; font-size: 14px; text-align: left; line-height: 20px;">您还没有创建属于自己的个人主页。<%=link_to '新建', new_user_homepage_article_homepage_path(:user_id=> @user.id, :homepage_id => @user.homepage.id), :target => "_blank", :class => 'linkBlue' %></p>
|
||||
<% end %>
|
||||
<!--<textarea name="description" class="w450 h200" maxlength="255" style="resize:none;"><%#= (@user.user_extensions.nil?) ? '' : @user.user_extensions.description %></textarea>-->
|
||||
</li>
|
||||
<li style="display:none;"><%= f.select :language, :Chinese => :zh, :English => :en %></li>
|
||||
<li class="ml2">
|
||||
<a href="javascript:void(0);" id="my_account_form_link" class="blue_btn fl" onclick="my_account_form_submit();" style="background: #3b94d6; padding: 0 25px;">确定</a>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<%= render :partial => 'article_homepages/article_show' %>
|
|
@ -911,6 +911,8 @@ zh:
|
|||
button_edit: 编辑
|
||||
button_delete: 删除
|
||||
button_approve: 批准
|
||||
button_set_base_homepage: 设为主页
|
||||
button_cancel_base_homepage: 取消主页
|
||||
button_set_homepage: 设为首页
|
||||
button_cancel_homepage: 取消首页
|
||||
button_edit_homepage: 编辑首页
|
||||
|
@ -2019,6 +2021,7 @@ zh:
|
|||
label_poll_title: 问卷标题
|
||||
label_poll_description: 问卷描述
|
||||
label_poll_options: 选项
|
||||
label_poll_other: 其他
|
||||
label_poll_subtotal: 小计
|
||||
label_poll_question_num: "第%{num}题"
|
||||
label_poll_proportion: 比例
|
||||
|
|
|
@ -674,6 +674,7 @@ RedmineApp::Application.routes.draw do
|
|||
get 'search_m_r_homeworks'
|
||||
get 'expand_courses'
|
||||
get 'cancel_or_collect'
|
||||
get 'homepage'
|
||||
# end
|
||||
end
|
||||
#resources :blogs
|
||||
|
@ -685,12 +686,32 @@ RedmineApp::Application.routes.draw do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
resources :homepages do
|
||||
resources :article_homepages do
|
||||
member do
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
resources :blog_comments do
|
||||
collection do
|
||||
get :search
|
||||
end
|
||||
end
|
||||
resource :homepages do
|
||||
member do
|
||||
post 'set_homepage'
|
||||
post 'cancel_homepage'
|
||||
end
|
||||
collection do
|
||||
|
||||
end
|
||||
end
|
||||
resources :article_homepages do
|
||||
member do
|
||||
end
|
||||
end
|
||||
match 'users/:id/user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "feedback"
|
||||
match 'users/:id/user_projects', :to => 'users#user_projects', :via => :get
|
||||
#消息
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
class CreateHomepages < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :homepages do |t|
|
||||
t.string :name
|
||||
t.integer :article_id
|
||||
t.references :user
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
add_index :homepages, :user_id
|
||||
|
||||
count = User.all.count / 30 + 2
|
||||
transaction do
|
||||
for i in 1 ... count do i
|
||||
User.page(i).per(30).each do |user|
|
||||
Homepage.create(:user_id => user.id, :name => user.login)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,27 @@
|
|||
# encoding: utf-8
|
||||
class CreateArticleHomepages < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :article_homepages do |t|
|
||||
t.string :title
|
||||
t.text :content
|
||||
t.references :user
|
||||
t.references :homepage
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
add_index :article_homepages, :user_id
|
||||
add_index :article_homepages, :homepage_id
|
||||
|
||||
count = User.all.count / 30 + 2
|
||||
transaction do
|
||||
for i in 1 ... count do i
|
||||
User.page(i).per(30).each do |user|
|
||||
if user.user_extensions && !user.user_extensions.description.nil? && user.user_extensions.description != ""
|
||||
article = ArticleHomepage.create(:user_id => user.id,:title => '个人简介', :content => user.user_extensions.description, :homepage_id => user.homepage.id)
|
||||
user.homepage.update_column('article_id', article.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,54 @@
|
|||
function regexTopicSubject() {
|
||||
var name = $("#message_subject").val();
|
||||
if(name.length ==0)
|
||||
{
|
||||
$("#subjectmsg").text("标题不能为空");
|
||||
$("#subjectmsg").css('color','#ff0000');
|
||||
$("#message_subject").focus();
|
||||
return false;
|
||||
}
|
||||
else if(name.length <= 255)
|
||||
{
|
||||
$("#subjectmsg").text("填写正确");
|
||||
$("#subjectmsg").css('color','#008000');
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#subjectmsg").text("标题超过255个字符");
|
||||
$("#subjectmsg").css('color','#ff0000');
|
||||
$("#message_subject").focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function submit_article()
|
||||
{
|
||||
if(regexTopicSubject() && regexTopicDescription())
|
||||
{
|
||||
message_content_editor.sync();
|
||||
$("#message-form").submit();
|
||||
}
|
||||
}
|
||||
|
||||
function regexTopicDescription()
|
||||
{
|
||||
var name = message_content_editor.html();
|
||||
if(message_content_editor.isEmpty())
|
||||
{
|
||||
$("#message_content_span").text("描述不能为空");
|
||||
$("#message_content_span").css('color','#ff0000');
|
||||
return false;
|
||||
}
|
||||
else if(name.length >=20000){
|
||||
$("#message_content_span").text("描述最多20000个汉字(或40000个英文字符)");
|
||||
$("#message_content_span").css('color','#ff0000');
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#message_content_span").text("填写正确");
|
||||
$("#message_content_span").css('color','#008000');
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
$(function(){
|
||||
//提交作业
|
||||
|
||||
|
||||
var bt=baidu.template;
|
||||
bt.LEFT_DELIMITER='<!';
|
||||
bt.RIGHT_DELIMITER='!>';
|
||||
|
||||
|
||||
var tested = false;
|
||||
var valid_form = function() {
|
||||
var src = $('#program-src').val();
|
||||
|
@ -44,7 +44,7 @@ $(function(){
|
|||
'/student_work/program_test_ex',
|
||||
{homework: homework_id, student_work_id: student_work_id,
|
||||
src: src, title: title, is_test: is_test,tIndex:i,
|
||||
testid: testid},
|
||||
testid: testid},
|
||||
function(data,status){
|
||||
if (data.status==-4 || data.status==-5 ){
|
||||
//弹框
|
||||
|
@ -141,7 +141,7 @@ $(function(){
|
|||
};
|
||||
$('#commit-program-work-btn').hide();
|
||||
$('#test-program-btn').hide();
|
||||
$(".HomeWorkCon form").submit();
|
||||
$(".HomeWorkCon form").submit();
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ $(function(){
|
|||
$('#program-src').focus(function(){
|
||||
$(this).css('height', '100px');
|
||||
});
|
||||
|
||||
|
||||
var datepickerOptions={dateFormat:'yy-mm-dd',firstDay:0,showWeek:true,showOtherMonths:true,selectOtherMonths:true};
|
||||
|
||||
$('input.date-input').datepicker(datepickerOptions);
|
||||
|
@ -219,10 +219,10 @@ $(function(){
|
|||
|
||||
|
||||
$("#BluePopupBox").dialog({
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
dialogClass: 'BluePopupBox',
|
||||
minWidth: 771
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
dialogClass: 'BluePopupBox',
|
||||
minWidth: 771
|
||||
});
|
||||
$('#BluePopupBox').parent().resizable("disable");
|
||||
$('#BluePopupBox').parent().removeClass("ui-state-disabled");
|
||||
|
@ -261,7 +261,7 @@ $(function(){
|
|||
|
||||
var saveProgramAnswers = function() {
|
||||
var test_numbers = 0;
|
||||
var valid = true;
|
||||
var valid = true;
|
||||
var input = null;
|
||||
var output = null;
|
||||
var input_groups = [];
|
||||
|
@ -312,7 +312,7 @@ $(function(){
|
|||
$("#BluePopupBox a.BlueCirBtn").live('click', function(){
|
||||
if(saveProgramAnswers()){
|
||||
if($( "#BluePopupBox" ).dialog( "isOpen" )){
|
||||
$("#BluePopupBox").dialog( "close" );
|
||||
$("#BluePopupBox").dialog( "close" );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -461,7 +461,7 @@ $(function(){
|
|||
var program_name = "text/x-csrc";
|
||||
var language = $('#data-language').attr('data-language');
|
||||
if (language == 1) {
|
||||
program_name = 'text/x-csrc';
|
||||
program_name = 'text/x-csrc';
|
||||
} else if(language==2){
|
||||
program_name = 'text/x-c++src';
|
||||
}else if(language==3){
|
||||
|
@ -495,8 +495,8 @@ class Main\n\
|
|||
}\n\
|
||||
}\n\
|
||||
';
|
||||
}
|
||||
else if(language==1){
|
||||
}
|
||||
else if(language==1){
|
||||
src = '\
|
||||
//注意\n\
|
||||
//1:该程序每次运行的时间必须小于200毫秒,否则会超时,程序超时将不会测试剩余的测试集\n\
|
||||
|
@ -516,8 +516,8 @@ int main()\n\
|
|||
return 0;\n\
|
||||
}\n\
|
||||
';
|
||||
} else if(language==2){
|
||||
src = '\
|
||||
} else if(language==2){
|
||||
src = '\
|
||||
//注意\n\
|
||||
//1:该程序每次运行的时间必须小于200毫秒,否则会超时,程序超时将不会测试剩余的测试集\n\
|
||||
//2:该程序每次运行使用的内存不能超过1M,否则会返回错误\n\
|
||||
|
@ -537,8 +537,8 @@ int main()\n\
|
|||
return 0;\n\
|
||||
}\n\
|
||||
';
|
||||
} else if(language==3){
|
||||
src = '\
|
||||
} else if(language==3){
|
||||
src = '\
|
||||
#-*-coding:utf-8-*-\n\
|
||||
#注意\n\
|
||||
#1:该程序每次运行的时间必须小于200毫秒,否则会超时,程序超时将不会测试剩余的测试集\n\
|
||||
|
@ -553,15 +553,15 @@ import sys \n\
|
|||
#结果输出使用 print \n\
|
||||
#print (str(int(a)+int(b)))\n\
|
||||
';
|
||||
}
|
||||
}
|
||||
|
||||
$('#program-src').val(src);
|
||||
$('#program-src').val(src);
|
||||
};
|
||||
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("program-src"), {
|
||||
mode: {name: program_name,
|
||||
version: 2,
|
||||
singleLineStringErrors: false},
|
||||
version: 2,
|
||||
singleLineStringErrors: false},
|
||||
lineNumbers: true,
|
||||
indentUnit: 2,
|
||||
matchBrackets: true
|
||||
|
@ -572,7 +572,7 @@ import sys \n\
|
|||
$('#program-src').val(cMirror.getValue());
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
|
@ -131,7 +131,7 @@ a.btn_pu{ border:1px solid #3cb761; color:#3cb761; }
|
|||
a:hover.btn_pu{ background:#3cb761;}
|
||||
.pollsbtn_grey{ border:1px solid #b1b1b1; color:#b1b1b1; padding:0px 9px; height:19px; padding-top:3px; }
|
||||
.polls_title_w { max-width:280px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
|
||||
.polls_title_st { max-width:530px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
|
||||
.polls_title_st { max-width:450px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
|
||||
.polls_de_grey{ color:#b1b1b1; margin-top:3px;}
|
||||
.polls_btn a{ float:left;}
|
||||
.polls_n{ float:left; background:#ff5d31; color:#fff; width:32px; padding-left:2px; height:7px; padding-bottom:7px; }
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ArticleHomepagesController, :type => :controller do
|
||||
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe HomepagesController, :type => :controller do
|
||||
|
||||
end
|
|
@ -0,0 +1,10 @@
|
|||
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||
|
||||
FactoryGirl.define do
|
||||
factory :article_homepage do
|
||||
title "MyString"
|
||||
content "MyText"
|
||||
user nil
|
||||
homepage nil
|
||||
end
|
||||
end
|
|
@ -0,0 +1,10 @@
|
|||
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||
|
||||
FactoryGirl.define do
|
||||
factory :homepage do
|
||||
title "MyString"
|
||||
content "MyText"
|
||||
default 1
|
||||
user nil
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ArticleHomepage, :type => :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Homepage, :type => :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
Loading…
Reference in New Issue