This commit is contained in:
linhk 2014-09-17 16:03:17 +08:00
commit 05a5bf863f
25 changed files with 217 additions and 111 deletions

View File

@ -361,7 +361,7 @@ private
def login_without_softapplication
referer = request.headers['Referer']
require_login unless referer =~ /softapplication/ || referer =~ /memos/
require_login unless referer =~ /softapplication/ || @attachment.container_type == "Memo"
end
def renderTag

View File

@ -54,39 +54,29 @@ class ContestsController < ApplicationController
case params[:contest_sort_type]
when '0'
# modified by longjun
# never use unless and else
# never use unless and else, 将下面重复操作模块化放在private下
# unless @offset == 0
if @offset != 0
@contests = @contests.reorder('contests.commit').offset(@offset).limit(@limit).all.reverse
else
limit = @contest_count % @limit
limit = @limit if limit == 0
@contests = @contests.reorder('contests.commit').offset(@offset).limit(limit).all.reverse
end
# if @offset != 0
# @contests = @contests.reorder('contests.commit').offset(@offset).limit(@limit).all.reverse
# else
# limit = @contest_count % @limit
# limit = @limit if limit == 0
# @contests = @contests.reorder('contests.commit').offset(@offset).limit(limit).all.reverse
@contests = index_page_sort(@offset, @limit, @contest_count, @contests, 'contests.commit')
# end
@s_state = 0
when '1'
# modified by longjun
# never use unless and else
# unless @offset == 0
if @offset != 0
@contests = @contests.reorder('contests.created_on').offset(@offset).limit(@limit).all.reverse
else
limit = @contest_count % @limit
limit = @limit if limit == 0
@contests = @contests.reorder('contests.created_on').offset(@offset).limit(limit).all.reverse
end
@contests = index_page_sort(@offset, @limit, @contest_count, @contests, 'contests.created_on')
@s_state = 1
when '2'
# modified by longjun
# never use unless and else
# unless @offset == 0
if @offset != 0
@contests = @contests.offset(@offset).limit(@limit).all.reverse
# 目前只有 0 1 两个sort_type
# when '2'
else
limit = @contest_count % @limit
limit = @limit if limit == 0
@contests = @contests.offset(@offset).limit(@limit).all.reverse
end
# end longjun
@contests = index_page_sort(@offset, @limit, @contest_count, @contests, '')
@s_state = 0
end
else
@ -723,5 +713,20 @@ class ContestsController < ApplicationController
end
end
# added by longjun
# 将index页面中分页排序的方法抽离出来
def index_page_sort(offset, limit, contest_count, contests, contest_sort_by)
# modified by longjun
# never use unless and else
# unless @offset == 0
if offset != 0
contests = contests.reorder(contest_sort_by).offset(offset).limit(limit).all.reverse
else
limit = contest_count % limit
limit = limit if limit == 0
contests = contests.reorder(contest_sort_by).offset(offset).limit(limit).all.reverse
end
contests
end
end

View File

@ -62,7 +62,7 @@ class MemosController < ApplicationController
format.html { redirect_to back_memo_url, notice: "#{l :label_memo_create_succ}" }
format.json { render json: @memo, status: :created, location: @memo }
else
flash[:error] = "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}"
flash.now[:error] = "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}"
# back_error_page = @memo.parent_id.nil? ? forum_path(@forum) : forum_memo_path(@forum, @memo.parent_id)
pre_count = REPLIES_PER_PAGE

View File

@ -122,12 +122,24 @@ module ApplicationHelper
s
end
# Generates a link to an attachment.
# Options:
# * :text - Link text (default to attachment filename)
# * :download - Force download (default: false)
def link_to_short_attachment(attachment, options={})
text = h(truncate(options.delete(:text) || attachment.filename, length: 25, omission: '...'))
route_method = options.delete(:download) ? :download_named_attachment_path : :named_attachment_path
html_options = options.slice!(:only_path)
url = send(route_method, attachment, attachment.filename, options)
link_to text, url, html_options
end
# Generates a link to an attachment.
# Options:
# * :text - Link text (default to attachment filename)
# * :download - Force download (default: false)
def link_to_attachment(attachment, options={})
text = h(truncate(options.delete(:text) || attachment.filename, length: 60, omission: '...'))
text = options.delete(:text) || attachment.filename
route_method = options.delete(:download) ? :download_named_attachment_path : :named_attachment_path
html_options = options.slice!(:only_path)
url = send(route_method, attachment, attachment.filename, options)

View File

@ -3,13 +3,15 @@
<% if attachments.count > 1 && attachment != attachments.first%>
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<% end %>
<%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%>
<%= link_to_short_attachment attachment, :class => 'icon icon-attachment', :download => true -%>
<% if attachment.is_text? %>
<%= link_to image_tag('magnifier.png'),
:controller => 'attachments', :action => 'show',
:id => attachment, :filename => attachment.filename %>
<% end %>
<%= h(" - #{attachment.description}") unless attachment.description.blank? %>
<span title="<%= attachment.description%>">
<%= h(truncate(" - #{attachment.description}", length: 20, omission: '...')) unless attachment.description.blank? %>
</span>
<span class="size">(<%= number_to_human_size attachment.filesize %>)</span>
<% end -%>

View File

@ -2,7 +2,7 @@
<% for attachment in attachments %>
<p style="width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<span title="<%= attachment.filename%>">
<%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%>
<%= link_to_short_attachment attachment, :class => 'icon icon-attachment', :download => true -%>
</span>
<% if attachment.is_text? %>
<%= link_to image_tag('magnifier.png'),
@ -11,7 +11,9 @@
:id => attachment,
:filename => attachment.filename%>
<% end %>
<%= h(" - #{attachment.description}") unless attachment.description.blank? %>
<span title="<%= attachment.description%>">
<%= h(truncate(" - #{attachment.description}", length: 20, omission: '...')) unless attachment.description.blank? %>
</span>
<span class="size">(<%= number_to_human_size attachment.filesize %>)</span>
<% if options[:deletable] %>
<% if attachment.container_type == 'HomeworkAttach' %>

View File

@ -14,7 +14,7 @@
</td>
<td >
<%=link_to l(:field_homepage), home_path %> >
<%=link_to l(:label_contest_innovate), welcome_contest_path %> > 详情</td>
<%=link_to l(:label_contest_innovate), welcome_contest_path %> > l(:label_details)</td>
</tr>
</table>
</div>

View File

@ -41,20 +41,20 @@
<tr>
<td class="font_lighter">
<!-- <span class="font_lighter">
<%= l(:label_contest_project,
<%#= l(:label_contest_project,
:count => contest.contesting_projects.count)
%>
(<strong><span style="font-size: 17px">
<%= link_to(contest.contesting_projects.count,
<%#= link_to(contest.contesting_projects.count,
show_project_contest_path(contest),
:target => "_blank")
%></span></strong>)</span>
<span class="font_lighter">
<%= l(:label_contest_softapplication,
<%#= l(:label_contest_softapplication,
:count => contest.contesting_softapplications.count)
%>
(<strong><span style="font-size: 17px">
<%= link_to(contest.contesting_softapplications.count,
<%#= link_to(contest.contesting_softapplications.count,
show_softapplication_contest_path(contest),
:target => "_blank")
%>
@ -100,7 +100,7 @@
<div class="bid-description" style="border-left: 1px solid #d9d8d8; border-bottom: 1px solid #d9d8d8; padding-left: 20px; padding-bottom: 10px; margin-bottom: 20px;">
<table width="100%">
<tr>
<!-- <td> <%= contest.description%> </td> -->
<!-- <td> <%#= contest.description%> </td> -->
</tr>
</table>
</div>

View File

@ -62,7 +62,7 @@
<!-- 设置奖项设置的打开 关闭开关-->
</p>
<!-- <em class="info" style="margin-left:95px;"><%= l(:text_contest_reward) %></em> -->
<!-- <em class="info" style="margin-left:95px;"><%#= l(:text_contest_reward) %></em> -->
<p>
<%= f.text_field :deadline,
:required => true,

View File

@ -78,7 +78,9 @@
<%= l(:label_contest_user) %>
<% unless c_project.user.nil? %>
<!-- modified by zjc 添加超链接 -->
<%= link_to c_project.user.lastname + c_project.user.firstname,user_path(c_project.user) %>
<%= link_to c_project.user.lastname + c_project.user.firstname,
user_path(c_project.user)
%>
<% end %>
</strong>
@ -101,5 +103,7 @@
</table>
<% end %>
<% end %>
<div class="pagination"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %></div>
<div class="pagination">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
</div>

View File

@ -1,6 +1,6 @@
<%#= error_messages_for 'softapplication' %>
<script type="text/javascript">
<script type="text/javascript" xmlns="http://www.w3.org/1999/html">
//验证作品名称
function regexName()
{
@ -57,19 +57,19 @@
var workDescription = $("#softapplication_application_developers").val();
if(workDescription.length ==0)
{
$("#span_softapplication_application_developers").text("开发人员不能为空");
$("#span_softapplication_application_developers").text(<%= l(:label_no_softapplication_developers) %>);
$("#span_softapplication_application_developers").css('color','#ff0000');
return false;
}
if(workDescription.length <= 125)
{
$("#span_softapplication_application_developers").text("填写正确");
$("#span_softapplication_application_developers").text(<%= l(:label_field_correct) %>);
$("#span_softapplication_application_developers").css('color','#008000');
return true;
}
else
{
$("#span_softapplication_application_developers").text("开发人员超过125个汉字");
$("#span_softapplication_application_developers").text(<%= l(:label_softapplication_developers_condition) %>);
$("#span_softapplication_application_developers").css('color','#ff0000');
return false;
}
@ -143,8 +143,10 @@
<br/>
<tr style="width:800px;">
<td style="padding-bottom: 290px;">
<span><%= l(:label_work_description) %></span>
<span class="contest-star"> * </span>:
</td>
<td style="width: 100px">
<%= f.text_field :description,
:required => true,

View File

@ -1,8 +1,9 @@
$("#<%=object_id%>").replaceWith('<%= escape_javascript join_in_competition(@contest, user) %>');
<% if @state %>
// modified by longjun 去掉中文引用zh.yml中的标签
<% if @state == 0 %>
alert("加入成功")
alert(<%= l(:notice_successful_join) %>)
<% else %>
alert("密码错误")
alert(<%= l(:notice_account_wrong_password) %>)
<% end %>
<% end %>

View File

@ -7,7 +7,19 @@
<td rowspan="2">
<% if User.current.logged? %>
<% unless User.current.user_extensions.identity == 1 %>
<%= link_to(l(:label_newtype_contest), contest_new_contest_path, :class => 'icon icon-add', :target => "_blank") %>
<<<<<<< HEAD
<!--
modified by longjun
<%#link_to l(:label_newtype_contest), :controller => 'contests', :action => 'new_contest' %>
-->
<%= link_to(l(:label_newtype_contest),
contest_new_contests_path,
:class => 'icon icon-add',
:target => "_blank")
%>
=======
<%= link_to(l(:label_newtype_contest), new_contest_contests_path, :class => 'icon icon-add', :target => "_blank") %>
>>>>>>> 5a14798290ec4fe5a5aeedb507e7f0077df96efc
<!-- end longjun -->
<% end %>
<% end %>
@ -16,20 +28,35 @@
<div class="project-search" style="float: right">
<%= text_field_tag 'name', params[:name], :size => 30 %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => "contests_search" %>
<%= submit_tag l(:label_search),
:class => "enterprise",
:name => "contests_search"
%>
</div>
</td>
</tr>
<tr>
<td style="padding-left: 8px">
<a>
<<<<<<< HEAD
<!--modified by longjun-->
=======
>>>>>>> 5a14798290ec4fe5a5aeedb507e7f0077df96efc
<%= link_to request.host()+"/contests", contests_path %>
<!-- end longjun -->
</a>
</td>
<td >
<%=link_to l(:field_homepage), home_path %> >
<<<<<<< HEAD
<!--
modified by longjun
<%#link_to l(:label_contest_innovate), :controller => 'contests', :action => 'index' %>
-->
<%=link_to l(:label_contest_innovate), contests_path %>
=======
<%=link_to l(:label_contest_innovate), :controller => 'contests', :action => 'index' %>
>>>>>>> 5a14798290ec4fe5a5aeedb507e7f0077df96efc
<!-- end longjun -->
</td>
</tr>
@ -39,7 +66,9 @@
<% if @contests.size > 0%>
<%= sort_contest(@s_state)%>
<div id="bid-show">
<%= render :partial => 'contest_list', :locals => {:contests => @contests, :contest_pages => @contest_pages} %>
<%= render :partial => 'contest_list',
:locals => {:contests => @contests, :contest_pages => @contest_pages}
%>
</div>
<% else %>
<%= render :partial => "layouts/no_content"%>

View File

@ -1,6 +1,8 @@
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
<div style="margin-left: 20px;">
<span class="portrait"><%= image_tag(url_to_avatar(@contest.author), :class => "avatar")%></span>
<span class="portrait">
<%= image_tag(url_to_avatar(@contest.author), :class => "avatar")%>
</span>
<span class="body">
<h3>
<%= link_to(@contest.author.lastname+@contest.author.firstname,

View File

@ -3,7 +3,9 @@
<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 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">
@ -17,13 +19,15 @@
<% 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) ? '' : '' %>
<%= 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 width="200" align="right" class="font_lighter">
<%= l(:label_user_joinin) %><%= format_date(user.created_on) %>
</td>
</tr>
</table></td>

View File

@ -13,12 +13,20 @@
<tr>
<!-- modified by bai 显示人名全称-->
<td colspan="2" valign="top" width="50" >
<%= link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :title => "#{user.show_name}" %>
<%= link_to image_tag(url_to_avatar(user), :class => "avatar"),
user_path(user),
:title => "#{user.show_name}"
%>
</td>
<td>
<table width="580px" border="0">
<tr>
<td colspan="2" valign="top"><%= content_tag "div", link_to(user.show_name, user_path(user)), :class => "project_avatar_name" , :title => "#{user.show_name}" %>
<td colspan="2" valign="top">
<%= content_tag "div",
link_to(user.show_name, user_path(user)),
:class => "project_avatar_name" ,
:title => "#{user.show_name}"
%>
<!-- added by bai 增加了学员的学号 -->
<% if (im_watching_student_id? @contest) && user.user_extensions.identity.to_i.eql?(1) %>
<%= l(:label_bidding_user_studentcode) %> <%= user.user_extensions.student_id%>

View File

@ -66,7 +66,8 @@
:update => "contesting_softapplication_list",
:complete => '$("#put-bid-form").hide();' do |f|
%>
<table id="contesting_table" border="0" width="100%" style="margin-left: 40px;"> <!--该table为点击我要参加后弹出的-->
<!--该table为点击我要参加后弹出的-->
<table id="contesting_table" border="0" width="100%" style="margin-left: 40px;">
<tr>
<td>
<%= select_tag 'contest',
@ -90,7 +91,17 @@
</tr>
<tr>
<td><%= f.text_area :contest_message, :id => "contest_message", :required => true, :rows => 4, :cols => 40, :placeholder => l(:label_bid_reason), :style => "resize: none;", :class => 'noline'%></td>
<td>
<%= f.text_area :contest_message,
:id => "contest_message",
:required => true,
:rows => 4,
:cols => 40,
:placeholder => l(:label_bid_reason),
:style => "resize: none;",
:class => 'noline'
%>
</td>
</tr>
<tr>

View File

@ -2,12 +2,14 @@
<% if attachments.count > 1 && attachment != attachments.first%>
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<% end %>
<%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%>
<%= link_to_short_attachment attachment, :class => 'icon icon-attachment', :download => true -%>
<% if attachment.is_text? %>
<%= link_to image_tag('magnifier.png'),
:controller => 'attachments', :action => 'show',
:id => attachment, :filename => attachment.filename %>
<% end %>
<%= h(" - #{attachment.description}") unless attachment.description.blank? %>
<span title="<%= attachment.description%>">
<%= h(truncate(" - #{attachment.description}", length: 20, omission: '...')) unless attachment.description.blank? %>
</span>
<span class="size">(<%= number_to_human_size attachment.filesize %>)</span>
<% end -%>

View File

@ -27,8 +27,7 @@
<p><%= f.text_area :content, :required => true, :size => 80, id: 'editor01' %></p>
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor01');</script>
<br/>
<%= f.submit :value => l(:button_change) %>
<%= f.submit :value => l(:button_change) %>&nbsp;&nbsp;<%= link_to l(:button_back), back_url ,:class => "button-canel",:style => "color: #ffffff;"%>
</div>
<% end %>
<%= link_to l(:button_back), back_url %>
</div>

View File

@ -43,11 +43,14 @@
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if @memo.destroyable_by?(User.current) %>
</div>
<div class="memo-title <%= @memo.sticky ? 'sticky' : '' %> <%= @memo.locked? ? 'locked' : '' %>" style="word-break: break-all;word-wrap: break-word;"><%= label_tag l(:field_subject) %>: <%=h @memo.subject %></div>
<div>&nbsp;</div>
<div class="memo-title <%= @memo.sticky ? 'sticky' : '' %> <%= @memo.locked? ? 'locked' : '' %>"
style="word-break: break-all;word-wrap: break-word;">
<%= label_tag l(:field_subject) %>: <%=h @memo.subject %>
</div>
<div class="memo-content">
<%= textAreailizable(@memo,:content) %>
<p>

View File

@ -5,12 +5,12 @@
<div class="box ph10_5">
<!--[form:message]-->
<% unless replying %>
<p>
<%= f.text_field :subject, :size => 60, :style => "width: 99%;display:none;", :id => "message_subject" %><!--by young-->
<p><label for="message_subject"><%= l(:field_subject) %><span class="required"> *&nbsp;&nbsp;</span></label><br/>
<%= f.text_field :subject, :size => 60, :style => "width: 99%;", :id => "message_subject" %><!--by young-->
</p>
<% else %>
<p>
<%= f.text_field :subject, :size => 60, :style => "width: 99%;display:none;", :id => "message_subject", :readonly => true %>
<p><label for="message_subject"><%= l(:field_subject) %><span class="required"> *&nbsp;&nbsp;</span></label><br/>
<%= f.text_field :subject, :size => 60, :style => "width: 99%;", :id => "message_subject", :readonly => true %>
</p>
<% end %>
<p>
@ -24,7 +24,7 @@
<% end %>
</p>
<p>
<label for="message_subject"><%= l(:button_projects_feedback_respond) %>
<label for="message_subject"><%= l(:field_description) %>
<span class="required"> *&nbsp;&nbsp;</span></label>
<div id="message_quote" class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;"></div>
<%= text_area :quote,:quote,:style => 'display:none' %>

View File

@ -157,7 +157,7 @@
<span style="margin-top: -20px;float: right; display: block;">
<% if User.current.logged? %>
<% unless User.current.user_extensions.identity == 1 %>
<%= link_to(l(:label_newtype_contest), {:controller => 'bids', :action => 'new_contest'}, :class => 'icon icon-add') %>
<%= link_to(l(:label_newtype_contest), new_contest_contests_path, :class => 'icon icon-add') %>
<% end %>
<% end %>
&nbsp;&nbsp;

View File

@ -173,6 +173,7 @@ zh:
notice_successful_delete: 删除成功
notice_failed_delete: 删除失败
notice_successful_connection: 连接成功
notice_successful_join: 加入成功
notice_file_not_found: 您访问的页面不存在或已被删除。
notice_locking_conflict: 数据已被另一位用户更新
notice_not_authorized: 对不起,您无权访问此页面。
@ -1936,7 +1937,7 @@ zh:
label_forum_edit: 编辑讨论区
label_memo_create: 发布
label_memo_new: 新建主题
label_memo_edit: 修改主题label_board_new
label_memo_edit: 修改主题
label_memo_new_from_forum: 发布帖子
label_forum: 公共贴吧
label_forum_new: 新建贴吧
@ -2000,9 +2001,12 @@ zh:
label_work_deposit_project: 托管项目
label_softapplication_name_condition: 25个汉字以内50个字符
label_softapplication_description_condition: 125个汉字以内
label_softapplication_developers_condition: 开发人员超过125个汉字
label_no_softapplication_developers: 开发人员不能为空
label_user_login_softapplication_board: 您还没有登录,请登录后参与应用评价。
label_contest_description_no: 暂无描述。
label_no_contest_softapplication: 暂无参赛应用
label_field_correct: 填写正确
label_button_ok: 确定
label_tags_contest: 竞赛标签
label_tags_contest: 竞赛名称

View File

@ -657,7 +657,7 @@ RedmineApp::Application.routes.draw do
match 'delete_avatar', :to => 'avatar#delete_image',:via => :post
# Endof Tao's code
get 'robots.txt', :to => 'welcome#robots'
match 'welcome/course', :to => 'welcome#course'
##############测试留言功能 fq
post 'words/new', :to => 'words#new'
post 'words/create', :to => 'words#create'
@ -724,7 +724,7 @@ RedmineApp::Application.routes.draw do
# added by young
match 'calls', :to => 'bids#index'
match 'calls/:id', :to => 'bid#show', :as => 'respond'
match 'calls/:id', :to => 'bids#show', :as => 'respond'
# modified by longjun
# bids#contests is not exist
# match 'contest', :to => 'bids#contests', :as => 'contest' #modified @20140403

View File

@ -2794,3 +2794,19 @@ div.repos_explain{
padding-top: 20px;
padding-bottom: 20px;
}
.button-canel{
padding-bottom: 5px;
width: auto;
height: 25px;
font-family: '微软雅黑',Arial,Helvetica,sans-serif;
font-size: 12px;
color: #ffffff;
padding: 3px 9px;
background: #15bccf;
border-radius: 4px;
border: 1px solid #15bccf;
box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.2), 0px 0px 2px rgb(255, 255, 255) inset;
text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.2), 0px 1px 0px rgb(255, 255, 255);
cursor: pointer;
}