Merge branch 'szzh' into develop

This commit is contained in:
sw 2015-06-13 11:49:16 +08:00
commit b4b1882e6b
31 changed files with 323 additions and 386 deletions

View File

@ -94,6 +94,9 @@ class CoursesController < ApplicationController
def new_join
@course = Course.find(params[:object_id])
respond_to do |format|
format.js
end
end
# 课程搜索

View File

@ -464,7 +464,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
sheet1[count_row, i + 1] = poll_answer.answer_text.gsub(/<\/?.*?>/,"").gsub(/&nbsp;/," ")
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
@ -477,7 +477,7 @@ class PollController < ApplicationController
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
sheet1[count_row,0] = poll_vote.vote_text.gsub(/<\/?.*?>/,"").gsub(/&nbsp;/," ")
count_row += 1
end
count_row += 1

View File

@ -10,158 +10,158 @@ homework_type == 1 文件提交
homework_type == 2 Project提交
=end
class Bid < ActiveRecord::Base
Enterprise = 1
Contest = 2
Homework = 3
HomeworkFile = 1
HomeworkProject = 2
attr_accessible :author_id, :budget, :deadline, :name, :description, :homework_type, :password
include Redmine::SafeAttributes
include ApplicationHelper
has_many_kindeditor_assets :assets, :dependent => :destroy
belongs_to :author, :class_name => 'User', :foreign_key => :author_id
belongs_to :course
has_many :biding_projects, :dependent => :destroy
has_many :projects, :through => :biding_projects
has_many :courses_member, :class_name => 'User', :through => :courses
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
has_many :homework_for_courses, :dependent => :destroy
has_many :courses, :through => :homework_for_courses, :source => :course
has_many :homeworks, :class_name => 'HomeworkAttach', :dependent => :destroy
has_many :homework_evaluations, :through => :homeworks
has_many :join_in_contests, :dependent => :destroy
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
# has_many :fork_homework, :class_name => 'Bid', :conditions => "#{Bid.table_name}.parent_id = #{id}"
acts_as_attachable
NAME_LENGTH_LIMIT = 60
DESCRIPTION_LENGTH_LIMIT = 3000
validates :name, length: {maximum: NAME_LENGTH_LIMIT}, presence: true
validates :description, length: {maximum: DESCRIPTION_LENGTH_LIMIT}
validates :author_id, presence: true
validates :deadline, presence: true, format: {:with => /^[\d]{4}[-][\d]{1,2}[-][\d]{1,2}$/}
validates :name, length: {maximum: NAME_LENGTH_LIMIT}
validates :budget, format: { with: ->(p) { if p.reward_type == 1 then /^(\d+)$|^(\d+).([0-9]{2})|^(\d+).([0-9]{1})$/
elsif p.reward_type == 3 then /^(\d+)$|^(\d+).([0-9]{1})$/ end } }
validate :validate_user
validate :validate_reward_type
after_create :act_as_activity
after_destroy :delete_kindeditor_assets
scope :visible, lambda {|*args|
nil
}
scope :like, lambda {|arg|
if arg.blank?
where(nil)
else
pattern = "%#{arg.to_s.strip.downcase}%"
where("LOWER(id) LIKE :p OR LOWER(name) LIKE :p OR LOWER(description) LIKE :p", :p => pattern)
end
}
scope :course_visible, lambda {|*args|
includes(:courses).where(Course.allowed_to_condition(args.shift || User.current, :view_homeworks, *args))
}
acts_as_watchable
acts_as_taggable
acts_as_event :title => Proc.new {|o| "#{l(:label_course_homework)} ##{o.id}: #{o.name}" },
:description => :description,
:author => :author,
:url => Proc.new {|o| {:controller => 'bids', :action => 'show', :id => o.id}}
acts_as_activity_provider :type => 'homeworks',
:author_key => :author_id
acts_as_activity_provider :find_options => {:include => [:projects, :author]},
:author_key => :author_id
safe_attributes 'name',
'description',
'budget',
'deadline',
'homework_type',
'reward_type',
'password'
# Enterprise = 1
# Contest = 2
# Homework = 3
# HomeworkFile = 1
# HomeworkProject = 2
# attr_accessible :author_id, :budget, :deadline, :name, :description, :homework_type, :password
# include Redmine::SafeAttributes
# include ApplicationHelper
# has_many_kindeditor_assets :assets, :dependent => :destroy
# belongs_to :author, :class_name => 'User', :foreign_key => :author_id
# belongs_to :course
# has_many :biding_projects, :dependent => :destroy
# has_many :projects, :through => :biding_projects
# has_many :courses_member, :class_name => 'User', :through => :courses
# has_many :journals_for_messages, :as => :jour, :dependent => :destroy
# has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
# has_many :homework_for_courses, :dependent => :destroy
# has_many :courses, :through => :homework_for_courses, :source => :course
# has_many :homeworks, :class_name => 'HomeworkAttach', :dependent => :destroy
# has_many :homework_evaluations, :through => :homeworks
# has_many :join_in_contests, :dependent => :destroy
# has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
# # has_many :fork_homework, :class_name => 'Bid', :conditions => "#{Bid.table_name}.parent_id = #{id}"
# acts_as_attachable
#
# NAME_LENGTH_LIMIT = 60
# DESCRIPTION_LENGTH_LIMIT = 3000
# validates :name, length: {maximum: NAME_LENGTH_LIMIT}, presence: true
# validates :description, length: {maximum: DESCRIPTION_LENGTH_LIMIT}
# validates :author_id, presence: true
# validates :deadline, presence: true, format: {:with => /^[\d]{4}[-][\d]{1,2}[-][\d]{1,2}$/}
# validates :name, length: {maximum: NAME_LENGTH_LIMIT}
# validates :budget, format: { with: ->(p) { if p.reward_type == 1 then /^(\d+)$|^(\d+).([0-9]{2})|^(\d+).([0-9]{1})$/
# elsif p.reward_type == 3 then /^(\d+)$|^(\d+).([0-9]{1})$/ end } }
#
# validate :validate_user
# validate :validate_reward_type
# after_create :act_as_activity
# after_destroy :delete_kindeditor_assets
# scope :visible, lambda {|*args|
# nil
# }
#
# scope :like, lambda {|arg|
# if arg.blank?
# where(nil)
# else
# pattern = "%#{arg.to_s.strip.downcase}%"
# where("LOWER(id) LIKE :p OR LOWER(name) LIKE :p OR LOWER(description) LIKE :p", :p => pattern)
# end
# }
#
# scope :course_visible, lambda {|*args|
# includes(:courses).where(Course.allowed_to_condition(args.shift || User.current, :view_homeworks, *args))
# }
#
# acts_as_watchable
# acts_as_taggable
#
# acts_as_event :title => Proc.new {|o| "#{l(:label_course_homework)} ##{o.id}: #{o.name}" },
# :description => :description,
# :author => :author,
# :url => Proc.new {|o| {:controller => 'bids', :action => 'show', :id => o.id}}
#
# acts_as_activity_provider :type => 'homeworks',
# :author_key => :author_id
#
# acts_as_activity_provider :find_options => {:include => [:projects, :author]},
# :author_key => :author_id
#
# safe_attributes 'name',
# 'description',
# 'deadline'
def add_jour(user, notes, reference_user_id = 0, options = {})
if options.count == 0
jfm = JournalsForMessage.new(:user_id => user.id, :notes => notes, :reply_id => reference_user_id)
self.journals_for_messages << jfm
jfm
else
jfm = self.journals_for_messages.build(options)
jfm.save
jfm
end
end
def self.creat_bids(budget, deadline, name, description=nil, reward_type)
self.create(:author_id => User.current.id, :budget => budget,
:deadline => deadline, :name => name, :description => description, :commit => 0, :reward_type => reward_type)
# self.acts << Activity.new(:user_id => self.author_id)
end
def update_bids(budget, deadline, name, description=nil)
if(User.current.id == self.author_id)
self.name = name
self.budget = budget
self.deadline = deadline
self.description = description
self.save
end
end
def delete_bids
unless self.nil?
if User.current.id == self.author_id
self.destroy
end
end
end
def set_commit(commit)
self.update_attribute(:commit, commit)
end
private
def validate_user
errors.add :author_id, :invalid if author.nil? || !author.active?
end
def validate_reward_type
errors.add :reward_type, :invalid if self.reward_type == 0
end
def act_as_activity
self.acts << Activity.new(:user_id => self.author_id)
end
# used to validate weather the user is the creater of the bid
# added by william
def validate_bid_manager(user_id)
unless user_id.nil?
if self.author_id == user_id
return true
else
return false
end
end
end
# Time 2015-04-01 14:19:06
# Author lizanle
# Description 删除对应课程通知的图片资源
def delete_kindeditor_assets
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::BID
end
# 'description',
# 'budget',
# 'deadline',
# 'homework_type',
# 'reward_type',
# 'password'
#
#
# # safe_attributes 'name',
# # 'description',
# # 'deadline'
# def add_jour(user, notes, reference_user_id = 0, options = {})
# if options.count == 0
# jfm = JournalsForMessage.new(:user_id => user.id, :notes => notes, :reply_id => reference_user_id)
# self.journals_for_messages << jfm
# jfm
# else
# jfm = self.journals_for_messages.build(options)
# jfm.save
# jfm
# end
# end
#
# def self.creat_bids(budget, deadline, name, description=nil, reward_type)
# self.create(:author_id => User.current.id, :budget => budget,
# :deadline => deadline, :name => name, :description => description, :commit => 0, :reward_type => reward_type)
# # self.acts << Activity.new(:user_id => self.author_id)
# end
#
# def update_bids(budget, deadline, name, description=nil)
# if(User.current.id == self.author_id)
# self.name = name
# self.budget = budget
# self.deadline = deadline
# self.description = description
# self.save
# end
# end
#
# def delete_bids
# unless self.nil?
# if User.current.id == self.author_id
# self.destroy
# end
# end
# end
#
# def set_commit(commit)
# self.update_attribute(:commit, commit)
# end
#
# private
#
# def validate_user
# errors.add :author_id, :invalid if author.nil? || !author.active?
# end
#
# def validate_reward_type
# errors.add :reward_type, :invalid if self.reward_type == 0
# end
#
# def act_as_activity
# self.acts << Activity.new(:user_id => self.author_id)
# end
#
# # used to validate weather the user is the creater of the bid
# # added by william
# def validate_bid_manager(user_id)
# unless user_id.nil?
# if self.author_id == user_id
# return true
# else
# return false
# end
# end
# end
#
# # Time 2015-04-01 14:19:06
# # Author lizanle
# # Description 删除对应课程通知的图片资源
# def delete_kindeditor_assets
# delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::BID
# end
end

View File

@ -1,9 +1,11 @@
// @status: 0 该项目不存在1 不重复加入2 成功加入; 3 已是项目成员;其它 加入失败
<% if @status == 0%>
alert("<%= l('project.join.tips.notexist') %>");
<% elsif @status == 1%>
alert("<%= l('project.join.tips.repeat') %>");
<% elsif @status == 2%>
alert("<%= l('project.join.tips.success') %>");
hideModal($("#popbox"));
<% elsif @status == 3%>
alert("<%= l('project.join.tips.has') %>");
<%else%>

View File

@ -29,7 +29,7 @@
<% is_float ||= false %>
<% for attachment in attachments %>
<div style="float:left;">
<p style="height:14px;line-height:10px;width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<p style="height:14px;line-height:12px;width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%if is_float%>
<div style="max-width:55%;white-space: nowrap; overflow: hidden; text-overflow: ellipsis;float: left;">
<% end%>

View File

@ -1,25 +0,0 @@
<!-- fq --> <!-- modified by bai -->
<%= error_messages_for 'bid' %>
<!--[form:project]-->
<p><%= l(:label_fork_form_new_description) %></p>
<!-- modified by bai -->
<p style="margin-left:-68px;padding-right: 20px;"><strong><%= l(:label_choose_course) %><span class="required"> *&nbsp;</span></strong><%= select_tag 'course', course_options_for_select(@courses) %></p>
<p><%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT, :value => @bid.name %></p>
<!-- end -->
<p style="margin-left:-10px;padding-right: 20px;">
<%= f.text_area :description, :rows => 8, :value => @bid.description, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT %></p>
<!-- <p><%#= select_tag 'bid_reward_type', "<option value = '0'>#{l(:label_choose_reward)}</option><option value = '1'>#{l(:label_money)}</option><option value = '3'>#{l(:label_bids_credit)}</option><option value = '2'>#{l(:label_reward_1)}</option>".html_safe,
:onChange => "show('bid_reward_type', 'bid_budget', '"+l(:label_bids_reward_what)+"','"+l(:label_bids_new_money)+"','"+l(:label_bids_new_credit)+"','"+l(:label_bids_new_content)+"')" %>
<%#= f.text_field :budget, :required => true, :size => 60, :style => "width:350px;", :placeholder => l(:label_bids_reward_what) %>
</p> -->
<p><%= f.text_field :deadline, :value => nil,:required => true, :size => 60, :style => "width:150px;" , :readonly => true %><%= calendar_for('bid_deadline')%>
<!--
<p><%#= f.select :homework_type, homework_type_option %>
</p>
-->
<p><%= f.select :is_evaluation, is_evaluation_option %>
<fieldset><legend><%= l(:label_attachment_plural) %></legend>
<p><%= render :partial => 'attachments/form', :locals => {:container => @homework} %></p>
</fieldset>

View File

@ -1,36 +0,0 @@
<!-- huang -->
<script type="text/javascript" language="javascript">
function show(id, id_t, label_reward, label_money, label_credit, label_content) {
var text = $('#' + id);
var text_t = $('#' + id_t);
if (text.val() == 0) {
text_t.attr("placeholder", label_reward);
}
if (text.val() == 1) {
text_t.attr("placeholder", label_money);
}
if (text.val() == 3) {
text_t.attr("placeholder", label_credit);
}
if (text.val() == 2) {
text_t.attr("placeholder", label_content);
}
return content;
}
</script>
<%= error_messages_for 'bid' %>
<!--[form:project]-->
<p style="width:500px;"><%= l(:label_bids_form_contest_new_description) %></p>
<p><%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT, :placeholder => "#{l(:label_contest_name)}" %></p>
<p style="margin-left:-10px;padding-right: 20px;"><%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT, :placeholder => "#{l(:label_contest_description)}" %></p>
<p style="margin-left:-10px;"><%= f.text_field :password, :size => 60, :style => "width:488px;margin-left: 10px;" %></p>
<p>
<%= f.text_field :budget, :required => true, :size => 60, :style => "width:350px;", :placeholder => l(:label_bids_reward_what) %>
<!-- 设置奖项设置的打开 关闭开关-->
</p>
<!-- <em class="info" style="margin-left:95px;"><%= l(:text_contest_reward) %></em> -->
<p><%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;", :readonly => true, :placeholder => "#{l(:label_deadline)}" %><%= calendar_for('bid_deadline')%></p>

View File

@ -1,30 +0,0 @@
<div class="inf_user_image">
<% for user in @bid.watcher_users %>
<ul class="list_watch"><li>
<table width="660px" border="0" align="center">
<tr>
<td colspan="2" valign="top" width="50" ><%= image_tag(url_to_avatar(user), :class => "avatar") %></td>
<td><table width="580px" border="0">
<tr>
<td colspan="2" valign="top"><strong><%= content_tag "div", link_to_user(user), :class => "project_avatar_name" %>
</td>
</tr>
<tr>
<td colspan="2" width="580px" ><p class="font_description">
<% unless user.memberships.empty? %>
<%= l(:label_x_contribute_to, :count => user.memberships.count) %>
<% for member in user.memberships %>
<%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : '' %>
<% end %>
<% end %>
</p></td>
</tr>
<tr>
<td width="200" align="right" class="font_lighter"><%= l(:label_user_joinin) %><%= format_date(user.created_on) %>
</td>
</tr>
</table></td>
</tr>
</table></li></ul>
<% end %>
</div>

View File

@ -54,6 +54,7 @@
<script type="text/javascript">
$(function(){
function init_editor(params){
var editor = params.kindutil.create(params.textarea, {
resizeType : 1,minWidth:"1px",width:"100%",height:"150px",
@ -160,8 +161,8 @@
params.div_form = $(">.respond-form",params.container);
params.form = $("form",params.div_form);
params.textarea = $("textarea[name='user_notes']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form),
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.cancel_btn = $("input[nhname='cancel_btn']",params.div_form);
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
@ -171,6 +172,7 @@
});
}
params.cancel_btn.click();
toggleAndSettingWordsVal(params.div_form, params.textarea);
setTimeout(function(){
if(!params.div_form.is(':hidden')){
params.textarea.show();
@ -192,8 +194,8 @@
return;
}
params.textarea = $("textarea[nhname='new_message_textarea']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form),
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);

View File

@ -29,8 +29,9 @@
:class => "delete", :title => l(:button_delete)) %>
<% end %>
<% if reply_allow %>
<%= link_to l(:label_bid_respond_quote),'',
<%#= link_to l(:label_bid_respond_quote),'',
{:focus => 'project_respond',:nhname=>"reply_btn", :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea')); $('##{ids} textarea') ;return false;"} %>
<%= link_to l(:label_bid_respond_quote),'javascript:;',{:nhname=>"reply_btn"} %>
<% end %>
</div>
<div class="cl"></div>

View File

@ -32,7 +32,6 @@
<script type="text/javascript">
function submit_form(obj)
{
hideModal(obj);
$("#new-watcher-form").submit();
}

View File

@ -4,7 +4,7 @@
<% if @state %>
<% if @state == 0 %>
alert("加入成功");
hideModal("#popbox02");
hideModal($("#popbox"));
<% elsif @state == 1 %>
alert("密码错误");
<% elsif @state == 2 %>

View File

@ -47,6 +47,7 @@
<br />
<p class="mt5 break_word"><%= e.event_description.html_safe %>
<br />
<div class="cl"></div>
<%= l :label_activity_time %> <%= format_activity_day(day) %>&nbsp;<%= format_time(e.event_datetime, false) %>
</p>
<%= link_to_attachments_course(e) if e.class.to_s == "News" %>

View File

@ -48,7 +48,7 @@
</div>
<div class="search fl">
<%= form_tag({:controller => 'courses', :action => 'search'},:id => "course_search_form", :method => :get, :class => "search_form") do %>
<%= text_field_tag 'name', params[:name], :placeholder => l(:label_course_name), :class => "search_text fl", :onkeyup => "regexName('#{l(:label_search_conditions_not_null)}');" %>
<input class="search_text fl" id="name" name="name" onkeyup="regexName('搜索条件不能为空');" placeholder="课程名称" type="text">
<a href="javascript:void(0)" onclick="submitSerch('<%= l(:label_search_conditions_not_null) %>');" class="search_btn fl f14 c_white" >
<%= l(:label_search)%>
</a>

View File

@ -107,7 +107,9 @@
<!--邀请加入-->
<div class="subNavBox">
<% if User.current.member_of?(@project) %>
<div class="subNav currentDd currentDt subNav_jiantou" id="expand_tools_expand_invit" nhtype="toggle4cookie" data-id="expand_invit" data-target="#navContent_invit"><%= l(:label_invite)%></div>
<div class="subNav currentDd currentDt subNav_jiantou" id="expand_tools_expand_invit" nhtype="toggle4cookie" data-id="expand_invit" data-target="#navContent_invit">
<%= l(:label_invite)%>
</div>
<ul class="navContent " style="display:block" id="navContent_invit">
<li><%= link_to l(:label_invite_new_user), :controller=>"projects", :action=>"invite_members_by_mail", :id => @project %></li>
<% if User.current.allowed_to?(:manage_members, @project) %>

View File

@ -9,7 +9,8 @@
<span><%= link_to journal.user, user_path(journal.user), :class => 'c_blue fb fl mb10', :target => "_blank" %>
</span><span class="c_grey fr"><%= format_time(journal.created_on) %></span>
<div class="cl"></div>
<p><%= textilizable journal.notes%></p>
<!--<p><%#= textilizable journal.notes%></p>-->
<p><%=journal.notes.html_safe%>
</div>
<div class="ping_disfoot">
<% ids = 'project_respond_form_'+ journal.id.to_s%>
@ -20,8 +21,9 @@
:class => "delete", :title => l(:button_delete)) %>
<% end %>
<% if reply_allow %>
<%= link_to l(:label_bid_respond_quote),'',
<%#= link_to l(:label_bid_respond_quote),'',
{:focus => 'project_respond',:nhname=>"reply_btn", :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea')); $('##{ids} textarea') ;return false;"} %>
<%= link_to l(:label_bid_respond_quote),'javascript:;', {:nhname=>"reply_btn"} %>
<% end %>
</span>

View File

@ -21,7 +21,7 @@
.C_form{ margin:20px 0 0 60px;}
.C_form ul li{ font-size:14px; color:#3f3a39; line-height:30px; padding-left: 60px;}
.C_form ul li input{ margin-left:20px; border:0px; border:1px solid #e1e1e1; color:#898989; padding-left:5px; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; padding: 0 !important; }
.C_form ul li.mB5{ color:#898989; font-size:12px; padding-left:150px;}
.C_form ul li.mB5{ color:#898989; font-size:12px; padding-left:140px;}
.width190{ width:190px; height:26px; border-color:#e1e1e1;}
.C_form a{ font-size:12px; color:#15bccf; float:left; display:block; height:40px; width:200px; margin-top:25px;}
.C_form a:hover{ text-decoration:underline;}
@ -31,7 +31,6 @@
<script type="text/javascript">
function submit_form(obj)
{
hideModal(obj);
$("#new-watcher-form").submit();
// alert("申请成功");
}
@ -52,25 +51,25 @@
</div>
<div class="C_form">
<%= form_tag({:controller => 'applied_project',
:action => 'applied_join_project'},
:remote => true,
:method => :post,
:id => 'new-watcher-form') do %>
:action => 'applied_join_project'},
:remote => true,
:method => :post,
:id => 'new-watcher-form') do %>
<ul>
<li style="padding-top: 15px;">
<span class="tips"><%= l('project.join.id.label')%></span>
<input type="hidden" name="project_join" value="1">
<input type="hidden" name="user_id" value="<%= User.current.id%>">
<input type="hidden" name="user_id" value="<%= User.current.id %>">
<input class=" width190" name="project_id" id="project_id" type="text" value="" >
<input type="text" style="display: none"/>
</li>
<li class="mB5" style="width: 260px"><%= l('project.join.id.tips')%></li>
<li>
<a href="#" class="btn" style="margin-left: 50px;" onclick="submit_form(this);">
<%= l(:label_apply_project) %>
<%= l(:label_apply_project) %>
</a>
<a href="#" class="btn" style="margin-left: 20px;" onclick="hideModal(this);">
<%= l(:button_cancel)%>
<%= l(:button_cancel) %>
</a>
</li>
</ul>

View File

@ -43,6 +43,7 @@
<div style="display:none;"><a href="#" id="nhjump"></a></div>
<script type="text/javascript">
$(function(){
function init_editor(params){
var editor = params.kindutil.create(params.textarea, {
resizeType : 1,minWidth:"1px",width:"100%",height:"150px",
@ -149,7 +150,7 @@
params.div_form = $(">.respond-form",params.container);
params.form = $("form",params.div_form);
params.textarea = $("textarea[name='user_notes']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form),
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.cancel_btn = $("input[nhname='cancel_btn']",params.div_form);
if(params.textarea.data('init') == undefined){
@ -160,6 +161,7 @@
});
}
params.cancel_btn.click();
toggleAndSettingWordsVal(params.div_form, params.textarea);
setTimeout(function(){
if(!params.div_form.is(':hidden')){
params.textarea.show();
@ -181,8 +183,8 @@
return;
}
params.textarea = $("textarea[nhname='new_message_textarea']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form),
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);

View File

@ -70,6 +70,7 @@
:class => "problem_tit fl fb " %>
<br />
<p class="mt5 break_word"><%= textAreailizable act,:content %><br />
<div class="cl"></div>
<%= l :label_create_time %> <%= format_activity_day(act.created_on) %> <%= format_time(act.created_on, false) %></p>
</div>
<div class="cl"></div>

View File

@ -1,54 +1,53 @@
<% show_revision_graph = ( @repository.supports_revision_graph? && path.blank? ) %>
<%= if show_revision_graph && revisions && revisions.any?
indexed_commits, graph_space = index_commits(revisions, @repository.branches) do |scmid|
url_for(
:controller => 'repositories',
:action => 'revision',
:id => project,
:repository_id => @repository.identifier_param,
:rev => scmid)
end
render :partial => 'revision_graph',
:locals => {
:commits => indexed_commits,
:space => graph_space
}
end %>
indexed_commits, graph_space = index_commits(revisions, @repository.branches) do |scmid|
url_for(
:controller => 'repositories',
:action => 'revision',
:id => project,
:repository_id => @repository.identifier_param,
:rev => scmid)
end
render :partial => 'revision_graph',
:locals => {
:commits => indexed_commits,
:space => graph_space
}
end %>
<%= form_tag(
{:controller => 'repositories', :action => 'diff', :id => project,
:repository_id => @repository.identifier_param, :path => to_path_param(path)},
:method => :get
) do %>
<table class="list changesets">
<thead><tr>
<th>#</th>
<th></th>
<th></th>
<th><%= l(:label_date) %></th>
<th><%= l(:field_author) %></th>
<th><%= l(:field_comments) %></th>
</tr></thead>
<tbody>
<% show_diff = revisions.size > 1 %>
<% line_num = 1 %>
<% revisions.each do |changeset| %>
<tr class="changeset <%= cycle 'odd', 'even' %>">
<% id_style = (show_revision_graph ? "padding-left:#{(graph_space + 1) * 20}px" : nil) %>
<%= content_tag(:td, :class => 'id', :style => id_style) do %>
<%= link_to_revision(changeset, @repository) %>
<% end %>
<td class="checkbox"><%= radio_button_tag('rev', changeset.identifier, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('#cbto-#{line_num+1}').attr('checked',true);") if show_diff && (line_num < revisions.size) %></td>
<td class="checkbox"><%= radio_button_tag('rev_to', changeset.identifier, (line_num==2), :id => "cbto-#{line_num}", :onclick => "if ($('#cb-#{line_num}').attr('checked')) {$('#cb-#{line_num-1}').attr('checked',true);}") if show_diff && (line_num > 1) %></td>
<td class="committed_on"><%= format_time(changeset.committed_on) %></td>
<td class="author"><%= h truncate(changeset.author.to_s, :length => 30) %></td>
<td class="comments"><%= textilizable(truncate_at_line_break(changeset.comments)) %></td>
</tr>
<% line_num += 1 %>
<% end %>
</tbody>
</table>
<p style="padding-top: 10px;">
{:controller => 'repositories', :action => 'diff', :id => project,
:repository_id => @repository.identifier_param, :path => to_path_param(path)},
:method => :get
) do %>
<table class="list changesets">
<thead><tr>
<th>#</th>
<th></th>
<th></th>
<th><%= l(:label_date) %></th>
<th><%= l(:field_author) %></th>
<th><%= l(:field_comments) %></th>
</tr></thead>
<tbody>
<% show_diff = revisions.size > 1 %>
<% line_num = 1 %>
<% revisions.each do |changeset| %>
<tr class="changeset <%= cycle 'odd', 'even' %>">
<% id_style = (show_revision_graph ? "padding-left:#{(graph_space + 1) * 20}px" : nil) %>
<%= content_tag(:td, :class => 'id', :style => id_style) do %>
<%= link_to_revision(changeset, @repository) %>
<% end %>
<td class="checkbox"><%= radio_button_tag('rev', changeset.identifier, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('#cbto-#{line_num+1}').attr('checked',true);") if show_diff && (line_num < revisions.size) %></td>
<td class="checkbox"><%= radio_button_tag('rev_to', changeset.identifier, (line_num==2), :id => "cbto-#{line_num}", :onclick => "if ($('#cb-#{line_num}').attr('checked')) {$('#cb-#{line_num-1}').attr('checked',true);}") if show_diff && (line_num > 1) %></td>
<td class="committed_on"><%= format_time(changeset.committed_on) %></td>
<td class="author"><%= h truncate(changeset.author.to_s, :length => 30) %></td>
<td class="comments"><%= textilizable(truncate_at_line_break(changeset.comments)) %></td>
</tr>
<% line_num += 1 %>
<% end %>
</tbody>
</table>
<p style="padding-top: 10px;">
<%= submit_tag(l(:label_view_diff), :name => nil, :class=>"c_blue") if show_diff %>
</p>
</p>
<% end %>

View File

@ -5,9 +5,8 @@
<div class="repository_con" style="line-height:1.9;">
<div class="repositorytitle" style="float:left;">
<%= render :partial => 'breadcrumbs',
:locals => {:path => @path, :kind => 'dir', :revision => @rev} %>
:locals => {:path => @path, :kind => 'dir', :revision => @rev} %>
<%= render :partial => 'navigation' %>
</div>
<!--contextual end-->
<div class="cl"></div>
@ -25,18 +24,18 @@
link_to h(repo.name),
{:controller => 'repositories', :action => 'show',
:id => @project, :repository_id => repo.identifier_param, :rev => nil, :path => nil},
:class => 'repository' + (repo == @repository ? ' selected' : ''),
:class => "mb10 break_word c_orange" }.join('&nbsp|&nbsp').html_safe %>)
:class => 'repository' + (repo == @repository ? ' selected' : ''),
:class => "mb10 break_word c_orange" }.join('&nbsp|&nbsp').html_safe %>)
</p>
</div>
</div>
<div class="repos_more"><a id="showgithelp" value="show_help" onclick ="showhelpAndScrollTo('repos_git_more'); " class="c_dblue lh23">展开Git操作指南</a></div>
<div class="repos_more"><a href="#" id="showgithelp" value="show_help" onclick ="showhelpAndScrollTo('repos_git_more'); " class="c_dblue lh23">展开Git操作指南</a></div>
<div id="repos_git_more">
<br>
<div class=" c_dark f14">
<p>项目代码请设置好正确的编码方式utf-8否则中文会出现乱码。</p>
<p>通过cmd命令提示符进入代码对应文件夹的根目录假设当前用户的登录名为user版本库名称为demo需要操作的版本库分支为branch。
如果是首次提交代码,执行如下命令:</p>
如果是首次提交代码,执行如下命令:</p>
</div>
<div class="repos_explain">
<p>git init</p>
@ -53,7 +52,7 @@
<p>git push -u origin branch:branch</p>
</div>
<!--repos_explain end-->
<!--repos_explain end-->
<div class="c_dark f14">
<p>已经有本地库,还没有配置远程地址,打开命令行执行如下:</p>
</div>
@ -68,7 +67,7 @@
<p>git push -u origin branch:branch</p>
</div>
<!--repos_explain end-->
<!--repos_explain end-->
<div class="c_dark f14">
<p>已有远程地址,创建一个远程分支,并切换到该分支,打开命令行执行如下:</p>
</div>
@ -81,7 +80,7 @@
<p>git push origin branch_name</p>
</div>
<!--repos_explain end-->
<!--repos_explain end-->
<div class="c_dark f14">
<p>从网上获取别人的开源版本库转交到trustie网站上打开命令行执行如下</p>
</div>
@ -101,56 +100,59 @@
<p><a href="/users/646" class="c_orange">李海</a>提供</p>
</div>
</div>
<% if !@entries.nil? && authorize_for('repositories', 'browse') %>
<%= render :partial => 'dir_list' %>
<% end %>
<!-- 代码库显示 -->
<% if !@entries.nil? && authorize_for('repositories', 'browse') %>
<%= render :partial => 'dir_list' %>
<% end %>
<%= render_properties(@properties) %>
<%= render_properties(@properties) %>
<% if authorize_for('repositories', 'revisions') %>
<% if @changesets && !@changesets.empty? %>
<h3>
<%= l(:label_latest_revision_plural) %>
</h3>
<%= render :partial => 'revisions',
:locals => {:project => @project, :path => @path,
:revisions => @changesets, :entry => nil} %>
<!-- 代码修订 -->
<% if authorize_for('repositories', 'revisions') %>
<%# if @changesets && !@changesets.empty? %>
<h3>
<%= l(:label_latest_revision_plural) %>
</h3>
<%= render :partial => 'revisions',
:locals => {:project => @project, :path => @path,
:revisions => @changesets, :entry => nil} %>
<%# end %>
<p style="padding-top: 10px;">
<% has_branches = (!@repository.branches.nil? && @repository.branches.length > 0)
sep = '' %>
<% if @repository.supports_all_revisions? && @path.blank? %>
<%= link_to l(:label_view_all_revisions), {:action => 'revisions', :id => @project,
:repository_id => @repository.identifier_param},
:class => "orange_u_btn" %>
<% sep = '|' %>
<% end %>
<p style="padding-top: 10px;">
<% has_branches = (!@repository.branches.nil? && @repository.branches.length > 0)
sep = '' %>
<% if @repository.supports_all_revisions? && @path.blank? %>
<%= link_to l(:label_view_all_revisions), {:action => 'revisions', :id => @project,
:repository_id => @repository.identifier_param},
:class => "orange_u_btn" %>
<% sep = '|' %>
<% end %>
<% if @repository.supports_directory_revisions? && (has_branches || !@path.blank? || !@rev.blank?) %>
<%= sep %>
<%= link_to l(:label_view_revisions),
{:action => 'changes',
:path => to_path_param(@path),
:id => @project,
:repository_id => @repository.identifier_param,
:rev => @rev},
:class => "orange_u_btn" %>
<% end %>
</p>
<% if @repository.supports_all_revisions? %>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(
:atom, params.merge(
{:format => 'atom', :action => 'revisions',
:id => @project, :page => nil, :key => User.current.rss_key})) %>
<% end %>
<% if @repository.supports_directory_revisions? && (has_branches || !@path.blank? || !@rev.blank?) %>
<%= sep %>
<%= link_to l(:label_view_revisions),
{:action => 'changes',
:path => to_path_param(@path),
:id => @project,
:repository_id => @repository.identifier_param,
:rev => @rev},
:class => "orange_u_btn" %>
<% end %>
<% end %>
</p>
<% if @repository.supports_all_revisions? %>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(
:atom, params.merge(
{:format => 'atom', :action => 'revisions',
:id => @project, :page => nil, :key => User.current.rss_key})) %>
<% end %>
<% end %>
<% end %>
<!-- added by bai -->
<p class="fb c_dark mt10">查看如何提交代码:
<%= link_to(l(:label_how_commit_code_chinese), ch_usage_path, :class => "c_blue") %>
<%= link_to('English', en_usage_path, :class => "c_blue") %>
<!-- added by bai -->
<p class="fb c_dark mt10">查看如何提交代码:
<%= link_to(l(:label_how_commit_code_chinese), ch_usage_path, :class => "c_blue") %>
<%= link_to('English', en_usage_path, :class => "c_blue") %>
<div class="cl"></div>
<div class="cl"></div>
<% content_for :header_tags do %>
<%= stylesheet_link_tag "scm" %>

View File

@ -35,7 +35,7 @@
<%= c1.downloads %>
</div>
<div class="table_cell1 downicon1 filename download_icon" >
<%= link_to_attachment c1, {:download => true, :text => image_tag("/images/button/download.png", width: "22px", alt: l(:button_download)) }%>c
<%= link_to_attachment c1, {:download => true, :text => image_tag("/images/button/download.png", width: "22px", alt: l(:button_download)) }%>
</div>
</div>
<% end -%>

View File

@ -61,7 +61,7 @@
</ul>
<div class="ping_box mt10" id="score_list_<%= @work.id%>" style="<%= @work.student_works_scores.empty? ? 'padding:0px;' : ''%>">
<%@work.student_works_scores.order("created_at desc").each do |score|%>
<%@work.student_works_scores.order("updated_at desc").each do |score|%>
<div id="work_score_<%= score.id%>">
<%= render :partial => 'student_work_score',:locals => {:score => score}%>
</div>

View File

@ -8,7 +8,7 @@
<a href="javascript:void(0);" class="c_orange fl" ><%= score.score%>分</a>
<a href="javascript:void(0);" class="fr c_purple mr5" onclick="$('#add_score_reply_<%= score.id%>').slideToggle();">回复</a>
<span class=" fr c_grey mr20">
<%=format_time score.created_at %>
<%=format_time score.updated_at %>
</span>
<div class="cl mb5"></div>
<p class="break_word">

View File

@ -11,7 +11,8 @@
<!-- <a style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" target="_blank" href="#">gugu01</a> -->
<span><%= link_to journal.user, user_path(journal.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%></span><span style="color:#a6a6a6; margin-right:40px; margin-left:30px;"><%= format_time(journal.created_on) %></span>
<div class="cl"></div>
<p><%= textilizable journal.notes%></p>
<!--<p><%#= textilizable journal.notes%></p>-->
<p><%=journal.notes.html_safe%></p>
</div>
<div class="ping_disfoot">
<% ids = 'project_respond_form_'+ journal.id.to_s%>
@ -23,8 +24,9 @@
:class => "delete", :title => l(:button_delete)) %>
<% end %>
<% if reply_allow %>
<%= link_to l(:label_bid_respond_quote),'',
<%#= link_to l(:label_bid_respond_quote),'',
{:focus => 'project_respond',:nhname=>'reply_btn', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea')); $('##{ids} textarea') ;return false;"} %>
<%= link_to l(:label_bid_respond_quote),'javascript:;',{:nhname=>'reply_btn'} %>
<% end %>
</span>

View File

@ -67,6 +67,7 @@
<div style="display:none;"><a href="#" id="nhjump"></a></div>
<script type="text/javascript">
$(function(){
function init_editor(params){
var editor = params.kindutil.create(params.textarea, {
resizeType : 1,minWidth:"1px",width:"100%",height:"150px",
@ -177,8 +178,8 @@
params.div_form = $(">.respond-form",params.container);
params.form = $("form",params.div_form);
params.textarea = $("textarea[name='user_notes']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form),
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.cancel_btn = $("input[nhname='cancel_btn']",params.div_form);
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
@ -188,6 +189,7 @@
});
}
params.cancel_btn.click();
toggleAndSettingWordsVal(params.div_form, params.textarea);
setTimeout(function(){
if(!params.div_form.is(':hidden')){
params.textarea.show();
@ -209,11 +211,15 @@
return;
}
params.textarea = $("textarea[nhname='new_message_textarea']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form),
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.cancel_btn = $("#new_message_cancel_btn");
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);
params.cancel_btn.click(function(){
nh_reset_form(params);
});
// $("a[nhname='cancel_btn']",params.div_form).click(function(){
// nh_reset_form(params);
// });

View File

@ -42,7 +42,7 @@
<%# memberships = user.memberships.all(:conditions => cond) %>
<% user_courses = user_courses_list(user) %>
<%= l(:label_x_course_contribute_to, :count => user_courses.count) %>
<%= "" unless user_courses.empty? %>
<%#= "" unless user_courses.empty? %>
<% for course in user_courses %>
<%# if course.name != nil %>
<%= link_to course.name,{:controller => 'courses',:action => 'show',id:course.id, host: Setting.host_course} %><%= (user_courses.last == course) ? '' : '' %>

View File

@ -22,7 +22,7 @@
<% end %>
<p>
<%= reply.notes %>
<%= reply.notes.html_safe %>
</p>
<span class="c_grey fl">
<%= format_time reply.created_on %>
@ -33,8 +33,9 @@
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %>
<% end %>
<% if reply_allow %>
<%= link_to l(:button_reply),'',
<%#= link_to l(:button_reply),'',
{:focus => 'project_respond',:nhname=>"reply_btn", :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), ''); return false;"} %>
<%= link_to l(:button_reply),'javascript:;',{:nhname=>"reply_btn"} %>
<% end %> <!-- #{l(:label_reply_plural)} #{m_reply_id.user.name}: -->
</div>
<div class="cl"></div>

View File

@ -57,6 +57,7 @@
<p nhname="contentmsg"></p>
<div style="padding-top:5px;float:left;" nhname="toolbar_container"></div>
<%= submit_tag l(:button_leave_meassge), :name => nil , :class => "enterprise" , :style => "display: block; float: right; margin-top: 5px;"%>
<a href="javascript:;" id="new_message_cancel_btn" style="display:none;"></a>
<%else %>
<div style="font-size: 14px;margin:10px;">
<%= l(:label_user_login_tips) %>

View File

@ -3,4 +3,7 @@ $('#history').html('<%= escape_javascript(render(:partial => 'users/history',:lo
$('#jour_count').html('<%= @obj_count%>')
$('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>');
$('#new_form_user_message').val("");
if($('#new_message_cancel_btn') != undefined && $('#new_message_cancel_btn').length!=0){
$('#new_message_cancel_btn').click();
}
$('#new_form_reference_user_id').val("");

View File

@ -5621,7 +5621,7 @@ _plugin('core', function(K) {
if (data.error === 0) {
var url = K.formatUrl(data.url, 'absolute');
//self.exec('insertimage', url, 'image','','','1','left');
self.insertHtml('<img src="'+url+'"/>');
self.insertHtml('<img src="'+url+'"/>');
var asset_id = data.asset_id;
if ( asset_id != "" && parent.document.getElementById('asset_id') != null ) {
parent.document.getElementById('asset_id').value += asset_id.toString();