This commit is contained in:
z9hang 2014-08-28 15:41:14 +08:00
commit e8cde5f1cd
18 changed files with 161 additions and 60 deletions

View File

@ -55,12 +55,15 @@ class AvatarController < ApplicationController
# saved = @avatar.save # saved = @avatar.save
begin begin
f = Magick::ImageList.new(diskfile) f = Magick::ImageList.new(diskfile)
# gif格式不再做大小处理
if f.format != 'GIF'
width = 300.0 width = 300.0
proportion = (width/f[0].columns) proportion = (width/f[0].columns)
height = (f[0].rows*proportion) height = (f[0].rows*proportion)
f.resize_to_fill!(width,height) f.resize_to_fill!(width,height)
# f.scale!(width,height)
f.write(diskfile) f.write(diskfile)
end
rescue Exception => e rescue Exception => e
logger.error "[Error] avatar : avatar_controller#upload ===> #{e}" logger.error "[Error] avatar : avatar_controller#upload ===> #{e}"
end end

View File

@ -605,6 +605,15 @@ class CoursesController < ApplicationController
events = @activity.events(@date_from, @date_to, :is_public => 1) events = @activity.events(@date_from, @date_to, :is_public => 1)
end end
# 无新动态时,显示老动态
if events.count == 0
if User.current.member_of_course?(@course)|| User.current.admin?
events = @activity.events
else
events = @activity.events(:is_public => 1)
end
end
@offset, @limit = api_offset_and_limit({:limit => 10}) @offset, @limit = api_offset_and_limit({:limit => 10})
@events_count = events.count @events_count = events.count
@events_pages = Paginator.new @events_count, @limit, params['page'] @events_pages = Paginator.new @events_count, @limit, params['page']

View File

@ -57,36 +57,45 @@ class FilesController < ApplicationController
elsif params[:course_id] elsif params[:course_id]
@isproject = false @isproject = false
sort = ""
if params[:sort] if params[:sort]
if params[:sort].include?":" params[:sort].split(",").each do |sort_type|
@orderBy = params[:sort].split(":")[0] order_by = sort_type.split(":")
@orderType = params[:sort].split(":")[1].split(",")[0]
else case order_by[0]
@orderBy = params[:sort].split(",")[0] when "filename"
@orderType = "asc" attribute = "filename"
end when "size"
attribute = "filesize"
when "attach_type"
attribute = "attachtype"
when "content_type"
attribute = "created_on"
when "field_file_dense"
attribute = "is_public"
when "downloads"
attribute = "downloads"
when "created_on"
attribute = "created_on"
end end
if @orderBy=="size" if order_by.count == 1
@orderBy="filesize" sort += "#{Attachment.table_name}.#{attribute} desc "
elsif @orderBy=="field_file_dense" elsif order_by.count == 2
@orderBy="is_public" sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} "
elsif @orderBy=="attach_type"
@orderBy="attachtype"
elsif @orderBy=="content_type"
@orderBy="attachtype"
end end
if sort_type != params[:sort].split(",").last
if @orderBy sort += ","
@containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.#{@orderBy} #{@orderType}").find(@course.id)]
else
@containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on desc").find(@course.id)]
end end
end
end
@containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)]
show_attachments @containers show_attachments @containers
render :layout => 'base_courses' render :layout => 'base_courses'
end end
end end
def new def new

View File

@ -594,6 +594,7 @@ class ProjectsController < ApplicationController
"show_news" => true, "show_news" => true,
"show_bids" => true, "show_bids" => true,
"show_contests" => true, "show_contests" => true,
"show_wiki_edits"=>true,
"show_journals_for_messages" => true "show_journals_for_messages" => true
} }
@date_to ||= Date.today + 1 @date_to ||= Date.today + 1

View File

@ -326,7 +326,7 @@ module IssuesHelper
if detail.property == 'attr' && detail.prop_key == 'description' if detail.property == 'attr' && detail.prop_key == 'description'
s = l(:text_journal_changed_no_detail, :label => label) s = l(:text_journal_changed_no_detail, :label => label)
unless no_html unless no_html
diff_link = link_to 'diff', diff_link = link_to l(:label_diff),
{:controller => 'journals', :action => 'diff', :id => detail.journal_id, {:controller => 'journals', :action => 'diff', :id => detail.journal_id,
:detail_id => detail.id, :only_path => options[:only_path]}, :detail_id => detail.id, :only_path => options[:only_path]},
:title => l(:label_view_diff) :title => l(:label_view_diff)

View File

@ -39,7 +39,8 @@ class Repository < ActiveRecord::Base
validates_length_of :password, :maximum => 255, :allow_nil => true validates_length_of :password, :maximum => 255, :allow_nil => true
validates_length_of :identifier, :maximum => IDENTIFIER_MAX_LENGTH, :allow_blank => true validates_length_of :identifier, :maximum => IDENTIFIER_MAX_LENGTH, :allow_blank => true
validates_presence_of :identifier#, :unless => Proc.new { |r| r.is_default? || r.set_as_default? } validates_presence_of :identifier#, :unless => Proc.new { |r| r.is_default? || r.set_as_default? }
validates_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true #validates_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true
validates_uniqueness_of :identifier, :allow_blank => true
validates_exclusion_of :identifier, :in => %w(show entry raw changes annotate diff show stats graph) validates_exclusion_of :identifier, :in => %w(show entry raw changes annotate diff show stats graph)
# donwcase letters, digits, dashes, underscores but not digits only # donwcase letters, digits, dashes, underscores but not digits only
validates_format_of :identifier, :with => /^[a-z0-9_\-]+$/, :allow_blank => true validates_format_of :identifier, :with => /^[a-z0-9_\-]+$/, :allow_blank => true

View File

@ -22,15 +22,22 @@
<%= error_messages_for 'bid' %> <%= error_messages_for 'bid' %>
<p><%= l(:label_homeworks_form_new_description) %></p> <p><%= l(:label_homeworks_form_new_description) %></p>
<p><%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT %></p> <p>
<%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT, :onblur => "regexName();" %>
<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 %></p> </p>
<p><span id="bid_name_span"></span></p>
<p><%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;", :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, <!-- <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)+"')" %> :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) %> <%#= f.text_field :budget, :required => true, :size => 60, :style => "width:350px;", :placeholder => l(:label_bids_reward_what) %>
</p> --> </p> -->
<% time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') %> <% time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') %>
<p><%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;",:value => "#{time}",:readonly => "readonly") %><%= calendar_for('bid_deadline')%> <p><%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;",:value => "#{time}", :onchange => "regexDeadLine();") %><%= calendar_for('bid_deadline')%>
<span id="bid_deadline_span">
</span>
</p> </p>
<p><%= f.select :is_evaluation, is_evaluation_option %> <p><%= f.select :is_evaluation, is_evaluation_option %>
</p> </p>

View File

@ -1,9 +1,60 @@
<script type="text/javascript">
function regexName()
{
var name = $("#bid_name").val();
if(name=="")
{
$("#bid_name_span").text("名称不能为空");
$("#bid_name_span").css('color','#ff0000');
return false;
}
else
{
$("#bid_name_span").text("填写正确");
$("#bid_name_span").css('color','#008000');
return true;
}
}
function regexDeadLine()
{
var deadline = $("#bid_deadline").val();
var regex = /^\d{4}-\d{2}-\d{2}$/;
if(deadline=="")
{
$("#bid_deadline_span").text("截止日期不能为空");
$("#bid_deadline_span").css('color','#ff0000');
return false;
}
else if(regex.test(deadline))
{
$("#bid_deadline_span").text("填写正确");
$("#bid_deadline_span").css('color','#008000');
return true;
}
else
{
$("#bid_deadline_span").text("截止日期格式错误");
$("#bid_deadline_span").css('color','#ff0000');
return false;
}
}
function submitHomework()
{
if(regexDeadLine()&&regexName())
{
$("#new_bid").submit();
}
}
</script>
<h3><%=l(:label_course_new_homework)%></h3> <h3><%=l(:label_course_new_homework)%></h3>
<%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_homework',:course_id => "#{params[:id] || params[:course_id]}"} do |f| %> <%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_homework',:course_id => "#{params[:id] || params[:course_id]}"} do |f| %>
<div class="box tabular"> <div class="box tabular">
<%= render :partial => 'homework_form', :locals => { :f => f } %> <%= render :partial => 'homework_form', :locals => { :f => f } %>
<%= submit_tag l(:button_create), :class => "enterprise" %> <input type="button" onclick="submitHomework();" value="<%= l(:button_create)%>" class="enterprise">
<%= javascript_tag "$('#bid_name').focus();" %> <%= javascript_tag "$('#bid_name').focus();" %>
<% end %> <% end %>
</div> </div>

View File

@ -37,21 +37,21 @@
<!-- <!--
<fieldset class="collapsible collapsed"> <fieldset class="collapsible collapsed">
<legend onclick="toggleFieldset(this);"> <legend onclick="toggleFieldset(this);">
<%= l(:label_options) %> <%#= l(:label_options) %>
</legend> </legend>
<div style="display: none;"> <div style="display: none;">
<table> <table>
<tr> <tr>
<td><%= l(:field_column_names) %></td> <td><%#= l(:field_column_names) %></td>
<td><%= render_query_columns_selection(@query) %></td> <td><%#= render_query_columns_selection(@query) %></td>
</tr> </tr>
<tr> <tr>
<td><label for='group_by'><%= l(:field_group_by) %></label></td> <td><label for='group_by'><%= l(:field_group_by) %></label></td>
<td><%= select_tag('group_by', options_for_select([[]] + @query.groupable_columns.collect { |c| [c.caption, c.name.to_s] }, @query.group_by)) %></td> <td><%#= select_tag('group_by', options_for_select([[]] + @query.groupable_columns.collect { |c| [c.caption, c.name.to_s] }, @query.group_by)) %></td>
</tr> </tr>
<tr> <tr>
<td><%= l(:button_show) %></td> <td><%#= l(:button_show) %></td>
<td><%= available_block_columns_tags(@query) %></td> <td><%#= available_block_columns_tags(@query) %></td>
</tr> </tr>
</table> </table>
</div> </div>

View File

@ -1,7 +1,7 @@
<h3><%=h @issue.tracker %> #<%= @issue.id %></h3> <h3><%=h @issue.tracker %> #<%= @issue.id %></h3>
<p><%= authoring @journal.created_on, @journal.user, :label => :label_updated_time_by %></p> <p><%= authoring @journal.created_on, @journal.user, :label => :label_updated_time_by %></p>
<div class="text-diff"> <div class="text-diff" style="word-break: break-all;width: 100%;">
<%= simple_format_without_paragraph @diff.to_html %> <%= simple_format_without_paragraph @diff.to_html %>
</div> </div>

View File

@ -32,7 +32,7 @@
<%= f.select :board_id, boards_options_for_select(@message.course.boards) %></p> <%= f.select :board_id, boards_options_for_select(@message.course.boards) %></p>
<% end %> <% end %>
<% end %> <% end %>
<div id="message_quote" class="wiki"></div> <div id="message_quote" class="wiki" style="width: 100%;word-break: break-all"></div>
<%= text_area :quote,:quote,:style => 'display:none' %> <%= text_area :quote,:quote,:style => 'display:none' %>
<p> <p>

View File

@ -4,7 +4,7 @@
<%= course_board_breadcrumb(@message) %> <%= course_board_breadcrumb(@message) %>
<% end %> <% end %>
<h3><%= avatar(@topic.author, :size => "24") %><%=h @topic.subject %></h3> <h3><%= avatar(@topic.author, :size => "24") %><span style = "width:100%;word-break:break-all;"><%=h @topic.subject %></span></h3>
<%= form_for @message, { <%= form_for @message, {
:as => :message, :as => :message,

View File

@ -7,7 +7,7 @@
<% @events_by_day.keys.sort.reverse.each do |day| %> <% @events_by_day.keys.sort.reverse.each do |day| %>
<% sort_activity_events(@events_by_day[day]).each do |e, in_group| -%> <% sort_activity_events(@events_by_day[day]).each do |e, in_group| -%>
<div class="activity-item underline-evreycontent" style="font-size: 14px;line-height:1.5em;"> <div class="activity-item underline-evreycontent" style="font-size: 14px;line-height:1.5em;width: 100%;word-break: break-all;">
<div class="activity-avatar" style="float: left; margin:3px; height: 100%;"> <div class="activity-avatar" style="float: left; margin:3px; height: 100%;">
<%= image_tag(url_to_avatar(e.event_author), :class => "avatar") %> <%= image_tag(url_to_avatar(e.event_author), :class => "avatar") %>
</div> </div>

View File

@ -72,7 +72,7 @@
<% end %> <% end %>
<tr> <tr>
<td colspan="2" width="580"> <td colspan="2" width="580">
<p class="font_description"> <%= textilizable act.notes %> </p> <p class="font_description"> <%= textAreailizable act.notes %> </p>
<div style="display: inline-block; float: right; margin-top: 0px"><span><%= link_to(l(:label_goto), user_newfeedback_user_path(e.user_id)) %> <div style="display: inline-block; float: right; margin-top: 0px"><span><%= link_to(l(:label_goto), user_newfeedback_user_path(e.user_id)) %>
</span></div> </span></div>
@ -113,7 +113,7 @@
</tr> </tr>
<tr> <tr>
<td colspan="2" width="580"> <td colspan="2" width="580">
<p class="font_description"> <%= act.description.html_safe %> </p></td> <p class="font_description"> <%=textAreailizable act, :description %> </p></td>
</tr> </tr>
<tr> <tr>
<td> <td>
@ -141,7 +141,7 @@
<% if act.notes.nil? %> <% if act.notes.nil? %>
<% desStr = '' %> <% desStr = '' %>
<% else %> <% else %>
<% desStr=act.notes.html_safe %> <% desStr= textAreailizable(act, :notes) %>
<% end %> <% end %>
<td colspan="2" width="580"><p class="font_description"> <%= desStr %> </p> <td colspan="2" width="580"><p class="font_description"> <%= desStr %> </p>
</td> </td>
@ -168,7 +168,7 @@
</tr> </tr>
<tr> <tr>
<td colspan="2" width="580"> <td colspan="2" width="580">
<p class="font_description"> <%= act.long_comments.html_safe %> </p></td> <p class="font_description"> <%= textAreailizable act,:long_comments %> </p></td>
</tr> </tr>
<tr> <tr>
<td> <td>
@ -194,7 +194,7 @@
</tr> </tr>
<tr> <tr>
<td colspan="2" width="580"> <td colspan="2" width="580">
<p class="font_description"> <%= h act.content.truncate(240, omission: '...') %> </p> <p class="font_description"> <%= textAreailizable(act,:content) %> </p>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -242,7 +242,7 @@
</tr> </tr>
<tr> <tr>
<td colspan="2" width="580"> <td colspan="2" width="580">
<p class="font_description"> <%= act.description.html_safe %> </p></td> <p class="font_description"> <%= textAreailizable act,:description %> </p></td>
</tr> </tr>
<tr> <tr>
<td> <td>
@ -287,7 +287,7 @@
</div> </div>
</div> </div>
--> -->
<%= textilizable act, :description %> <%= textAreailizable act, :description %>
<!-- <p class="font_description"> <%#= textilizable(act.description) %> </p> --> <!-- <p class="font_description"> <%#= textilizable(act.description) %> </p> -->
</td> </td>
</tr> </tr>
@ -314,7 +314,7 @@
<% end %> <% end %>
</tr> </tr>
<tr> <tr>
<td colspan="2" width="580"><p class="font_description"> <%= h act.description %> </p> <td colspan="2" width="580"><p class="font_description"> <%= textAreailizable act, :description %> </p>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -384,7 +384,7 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<td colspan="2" width="580"><p class="font_description"> <%= textilizable e.notes %> </p></td> <td colspan="2" width="580"><p class="font_description"> <%= textAreailizable e.notes %> </p></td>
</tr> </tr>
<tr> <tr>
<td align="left"><a class="font_lighter"></a></td> <td align="left"><a class="font_lighter"></a></td>

View File

@ -22,6 +22,6 @@
%>, <%= format_time(@diff.content_to.updated_on) %>)</em> %>, <%= format_time(@diff.content_to.updated_on) %>)</em>
</p> </p>
<div class="text-diff"> <div class="text-diff" style=" width: 100%;word-break: break-all;">
<%= simple_format_without_paragraph @diff.to_html %> <%= simple_format_without_paragraph @diff.to_html %>
</div> </div>

View File

@ -1214,7 +1214,7 @@ zh:
notice_issue_successful_create: 问题 %{id} 已创建。 notice_issue_successful_create: 问题 %{id} 已创建。
label_between: 介于 label_between: 介于
setting_issue_group_assignment: 允许问题被分配给组 setting_issue_group_assignment: 允许问题被分配给组
label_diff: diff label_diff: 查看差别
description_query_sort_criteria_direction: 排序方式 description_query_sort_criteria_direction: 排序方式
description_project_scope: 搜索范围 description_project_scope: 搜索范围
description_filter: 过滤器 description_filter: 过滤器

View File

@ -437,14 +437,14 @@ ActiveRecord::Schema.define(:version => 20140826072838) do
t.string "web_title" t.string "web_title"
t.string "title" t.string "title"
t.text "description" t.text "description"
t.string "page_type"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.string "page_type"
t.integer "sort_type" t.integer "sort_type"
t.integer "image_width", :default => 107
t.integer "image_height", :default => 63
t.integer "show_course", :default => 1 t.integer "show_course", :default => 1
t.integer "show_contest", :default => 1 t.integer "show_contest", :default => 1
t.integer "image_width", :default => 107
t.integer "image_height", :default => 63
end end
create_table "forums", :force => true do |t| create_table "forums", :force => true do |t|
@ -458,6 +458,26 @@ ActiveRecord::Schema.define(:version => 20140826072838) do
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
end end
create_table "gitlab_projects", :force => true do |t|
t.integer "gitlab_project_id"
t.integer "project_id"
t.string "repository_url"
t.string "web_url"
t.string "localfile_url"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "gitlab_users", :force => true do |t|
t.integer "gitlab_user_id"
t.integer "user_id"
t.string "email"
t.string "password"
t.string "login", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "groups_users", :id => false, :force => true do |t| create_table "groups_users", :id => false, :force => true do |t|
t.integer "group_id", :null => false t.integer "group_id", :null => false
t.integer "user_id", :null => false t.integer "user_id", :null => false