This commit is contained in:
chenmin 2014-08-15 11:23:53 +08:00
commit 05ed41615e
25 changed files with 157 additions and 117 deletions

View File

@ -679,15 +679,15 @@ module ApplicationHelper
def textilizable(*args) def textilizable(*args)
options = args.last.is_a?(Hash) ? args.pop : {} options = args.last.is_a?(Hash) ? args.pop : {}
case args.size case args.size
when 1 when 1
obj = options[:object] obj = options[:object]
text = args.shift text = args.shift
when 2 when 2
obj = args.shift obj = args.shift
attr = args.shift attr = args.shift
text = obj.send(attr).html_safe.to_s text = obj.send(attr).to_s
else else
raise ArgumentError, 'invalid arguments to textilizable' raise ArgumentError, 'invalid arguments to textilizable'
end end
return '' if text.blank? return '' if text.blank?
project = options[:project] || @project || (obj && obj.respond_to?(:project) ? obj.project : nil) project = options[:project] || @project || (obj && obj.respond_to?(:project) ? obj.project : nil)
@ -727,7 +727,7 @@ module ApplicationHelper
when 2 when 2
obj = args.shift obj = args.shift
attr = args.shift attr = args.shift
text = obj.send(attr).html_safe.to_s text = obj.send(attr).to_s
else else
raise ArgumentError, 'invalid arguments to textilizable' raise ArgumentError, 'invalid arguments to textilizable'
end end
@ -1831,4 +1831,5 @@ module ApplicationHelper
content_tag(:ul, logos.join("").html_safe, :class => ul_class.to_s).html_safe content_tag(:ul, logos.join("").html_safe, :class => ul_class.to_s).html_safe
end end
end end

View File

@ -11,7 +11,7 @@ class Forum < ActiveRecord::Base
'creator_id' 'creator_id'
validates_presence_of :name, :creator_id, :description validates_presence_of :name, :creator_id, :description
validates_length_of :name, maximum: 50 validates_length_of :name, maximum: 50
validates_length_of :description, maximum: 255 #validates_length_of :description, maximum: 255
validates :name, :uniqueness => true validates :name, :uniqueness => true
acts_as_taggable acts_as_taggable

View File

@ -132,7 +132,7 @@ class IssueQuery < Query
:type => :list_optional, :values => group_values :type => :list_optional, :values => group_values
) unless group_values.empty? ) unless group_values.empty?
role_values = Role.givable.collect {|r| [r.name, r.id.to_s] } role_values = Role.project_role.collect {|r| [r.name, r.id.to_s] }
add_available_filter("assigned_to_role", add_available_filter("assigned_to_role",
:type => :list_optional, :values => role_values :type => :list_optional, :values => role_values
) unless role_values.empty? ) unless role_values.empty?

View File

@ -8,7 +8,7 @@ class Memo < ActiveRecord::Base
# 若是主题帖,则内容可以是空 # 若是主题帖,则内容可以是空
#validates :content, presence: true, if: Proc.new{|o| !o.parent_id.nil? } #validates :content, presence: true, if: Proc.new{|o| !o.parent_id.nil? }
validates_length_of :subject, maximum: 50 validates_length_of :subject, maximum: 50
validates_length_of :content, maximum: 3072 #validates_length_of :content, maximum: 3072
validate :cannot_reply_to_locked_topic, :on => :create validate :cannot_reply_to_locked_topic, :on => :create
acts_as_tree :counter_cache => :replies_count, :order => "#{Memo.table_name}.created_at ASC" acts_as_tree :counter_cache => :replies_count, :order => "#{Memo.table_name}.created_at ASC"

View File

@ -67,6 +67,16 @@ class Role < ActiveRecord::Base
:in => ISSUES_VISIBILITY_OPTIONS.collect(&:first), :in => ISSUES_VISIBILITY_OPTIONS.collect(&:first),
:if => lambda {|role| role.respond_to?(:issues_visibility)} :if => lambda {|role| role.respond_to?(:issues_visibility)}
#获取项目相关角色
def self.project_role
self.givable[0..2]
end
#获取课程相关角色
def self.course_role
self.givable[3..5]
end
# Copies attributes from another role, arg can be an id or a Role # Copies attributes from another role, arg can be an id or a Role
def copy_from(arg, options={}) def copy_from(arg, options={})
return unless arg.present? return unless arg.present?

View File

@ -30,7 +30,7 @@
:data => {:confirm => l(:text_are_you_sure)}, :data => {:confirm => l(:text_are_you_sure)},
:method => :delete, :method => :delete,
:class => 'delete', :class => 'delete',
:remote => true, #:remote => true,
#:id => "attachments_" + attachment.id.to_s, #:id => "attachments_" + attachment.id.to_s,
:title => l(:button_delete) %> :title => l(:button_delete) %>
<% end %> <% end %>

View File

@ -5,7 +5,7 @@
<div id='leave-message'> <div id='leave-message'>
<%= render :partial => 'new', :locals => {:bid => @bid, :sta => @state} %> <%= render :partial => 'new', :locals => {:bid => @bid, :sta => @state} %>
</div> </div>
<% label = ''; <% label = ''
case @bid.reward_type case @bid.reward_type
when 1 when 1
label = l(:label_respond_requirement) label = l(:label_respond_requirement)

View File

@ -41,7 +41,7 @@
<table border="0" width="525px" align="center"> <table border="0" width="525px" align="center">
<tr> <tr>
<td align="right"> <%= submit_tag l(:button_leave_meassge), :name => nil , :class => "bid_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'"%> <td align="right"> <%= submit_tag l(:button_leave_meassge), :name => nil , :class => "bid_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'"%>
<%= submit_tag l(:button_clear), :name => nil, :onclick => "clearMessage('bid_message_message');", :type => 'button', :class => "bid_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'" %> </td> <%= submit_tag l(:button_clear_meassge), :name => nil, :onclick => "clearMessage('bid_message_message');", :type => 'button', :class => "bid_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'" %> </td>
</tr> </tr>
</table> </table>
<!-- end --> <!-- end -->

View File

@ -40,7 +40,7 @@
<table border="0" width="525px" align="center"> <table border="0" width="525px" align="center">
<tr> <tr>
<td align="right"> <%= submit_tag l(:button_leave_meassge), :name => nil , :class => "contest_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'"%> <td align="right"> <%= submit_tag l(:button_leave_meassge), :name => nil , :class => "contest_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'"%>
<%= submit_tag l(:button_clear), :name => nil, :onclick => "clearMessage('contest_message_message');", :type => 'button', :class => "bid_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'" %> </td> <%= submit_tag l(:button_clear_meassge), :name => nil, :onclick => "clearMessage('contest_message_message');", :type => 'button', :class => "bid_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'" %> </td>
</tr> </tr>
</table> </table>
<!-- end --> <!-- end -->

View File

@ -13,16 +13,19 @@
</ul> </ul>
</div> --> </div> -->
<% end %> <% end %>
<div class="actions" style="margin:10px"> <div style="width: 120%;">
<div class="field"> <div class="field">
<%= f.text_field :name, :required => true, :style => 'width: 100%;', :class => 'create-share' %> <%= f.text_field :name, :required => true, :style => 'width: 100%;', :class => 'create-share' %>
</div> </div>
<div class="field"> <div>
<%= f.text_area :description, :required => true, :rows => 4, :style => 'width: 100%;resize: none;', :class => 'create-share' %> <script src="/javascripts/ckeditor/ckeditor.js?1404953555" type="text/javascript"></script>
<%= f.text_area :description, :required => true, :id => 'editor01' %>
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor01',{height:300});</script>
<p style="color: #ff0000">(<%= l(:lable_forums_max_length) %>)</p>
</div> </div>
<div class="actions" style=" padding-top: 10px; float:right"> <div class="actions" style=" padding-top: 10px; float:right">
<%= f.submit :value=>(l :button_submit) ,:class => 'nyan-clean-gray', :style => 'font-size: 14px; padding: 0px 3px' %> <%= submit_tag l(:button_submit) %>
<%= link_to l(:button_back), forums_path,:class => 'nyan-clean-gray',:style => 'font-size: 14px; padding: 0px 3px; color: #000' %> <%= link_to l(:button_back), forums_path ,:style => 'font-size: 14px; padding: 0px 3px;' %>
</div> </div>
</div> </div>
<% end %> <% end %>

View File

@ -4,7 +4,7 @@
@nav_dispaly_main_contest_label = 1 %> @nav_dispaly_main_contest_label = 1 %>
<% @nav_dispaly_forum_label = 1%> <% @nav_dispaly_forum_label = 1%>
<!-- added by fq --> <!-- added by fq -->
<h3><%= l :label_forum_new %></h1> <h1><%= l :label_forum_new %></h1>
<%= render 'form' %> <%= render 'form' %>

View File

@ -18,8 +18,9 @@
<p><%= f.text_field :subject, :required => true%></p> <p><%= f.text_field :subject, :required => true%></p>
<p style="max-width:680px"><%= f.text_area :content, :required => true, :id => 'editor02' %></p> <p style="max-width:680px"><%= f.text_area :content, :required => true, :id => 'editor02' %></p>
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor02');</script> <script type="text/javascript">var ckeditor=CKEDITOR.replace('editor02');</script>
<br/> <p style="color: #ff0000">(<%= l(:lable_memos_max_length) %>)</p>
<p> <p>
<%= l(:label_attachment_plural) %><br /> <%= l(:label_attachment_plural) %><br />
<%= render :partial => 'attachments/form', :locals => {:container => @memo} %> <%= render :partial => 'attachments/form', :locals => {:container => @memo} %>
</p> </p>

View File

@ -78,7 +78,7 @@
:name => nil , :class => "enterprise", :name => nil , :class => "enterprise",
:onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -31px'"%> :onmouseover => "this.style.backgroundPosition = 'left -31px'"%>
<%= submit_tag l(:button_clear), :name => nil, :class => "enterprise", <%= submit_tag l(:button_clear_meassge), :name => nil, :class => "enterprise",
:onclick => "clearMessage('new_form_user_message');", :onclick => "clearMessage('new_form_user_message');",
:onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -31px'" %> </td> :onmouseover => "this.style.backgroundPosition = 'left -31px'" %> </td>

View File

@ -78,7 +78,7 @@
:name => nil , :class => "enterprise", :name => nil , :class => "enterprise",
:onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -31px'"%> :onmouseover => "this.style.backgroundPosition = 'left -31px'"%>
<%= submit_tag l(:button_clear), :name => nil, :class => "enterprise", <%= submit_tag l(:button_clear_meassge), :name => nil, :class => "enterprise",
:onclick => "clearMessage('new_form_user_message');", :onclick => "clearMessage('new_form_user_message');",
:onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -31px'" %> </td> :onmouseover => "this.style.backgroundPosition = 'left -31px'" %> </td>

View File

@ -1,3 +1,11 @@
<script type="text/javascript">
window.onready = function()
{
$("#issue_project_id").css("width","100%");
$("#issue_project_id").css("overflow ","hidden");
//issue_project_id
}
</script>
<%= labelled_fields_for :issue, @issue do |f| %> <%= labelled_fields_for :issue, @issue do |f| %>
<%= call_hook(:view_issues_form_details_top, { :issue => @issue, :form => f }) %> <%= call_hook(:view_issues_form_details_top, { :issue => @issue, :form => f }) %>

View File

@ -38,7 +38,7 @@
<% end -%> <% end -%>
<ul class="list-group-item-meta"> <ul class="list-group-item-meta">
<div class="issue-list-description"> <div class="issue-list-description">
<div class="wiki"> <div class="wiki" style="width: 100%;word-break: break-all;">
<%= textilizable issue, :description %> <%= textilizable issue, :description %>
</div> </div>
<!-- <#%= l(:field_description)%>:&nbsp;<#%= issue.short_description %> --> <!-- <#%= l(:field_description)%>:&nbsp;<#%= issue.short_description %> -->

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

@ -10,11 +10,12 @@
</ul> </ul>
</div> </div>
<% end %> <% end %>
<div class="actions" style="style="max-width:680px""> <div class="actions" style="max-width:680px">
<p><%= f.text_field :subject, :required => true, :size => 95 %></p> <p><%= f.text_field :subject, :required => true, :size => 95 %></p>
<p style="max-width:680px"><%= f.text_area :content, :required => true, :id => 'editor01' %></p> <p style="max-width:680px"><%= f.text_area :content, :required => true, :id => 'editor01' %></p>
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor01');</script> <script type="text/javascript">var ckeditor=CKEDITOR.replace('editor01');</script>
<br/> <br/>
<p> <p>
<%= l(:label_attachment_plural) %><br /> <%= l(:label_attachment_plural) %><br />
<%= render :partial => 'attachments/form', :locals => {:container => @memo} %> <%= render :partial => 'attachments/form', :locals => {:container => @memo} %>

View File

@ -48,7 +48,7 @@
<div class="memo-title <%= @memo.sticky ? 'sticky' : '' %> <%= @memo.locked? ? 'locked' : '' %>"><%= label_tag l(:field_subject) %>: <%=h @memo.subject %></div> <div class="memo-title <%= @memo.sticky ? 'sticky' : '' %> <%= @memo.locked? ? 'locked' : '' %>"><%= label_tag l(:field_subject) %>: <%=h @memo.subject %></div>
<div class="memo-content"> <div class="memo-content">
<%=h sanitize(@memo.content.html_safe) %> <%= textAreailizable(@memo,:content) %>
<p> <p>
<% if @memo.attachments.any?%> <% if @memo.attachments.any?%>
<% options = {:author => true, :deletable => @memo.deleted_attach_able_by?(User.current) } %> <% options = {:author => true, :deletable => @memo.deleted_attach_able_by?(User.current) } %>

View File

@ -160,7 +160,7 @@
<tr> <tr>
<td class="comments"> <td class="comments">
<div class="wiki"> <div class="wiki" style="width: 100%;word-break: break-all;">
<%= textAreailizable message,:content,:attachments => message.attachments %> <%= textAreailizable message,:content,:attachments => message.attachments %>
<%#= message.content.html_safe %> <%#= message.content.html_safe %>
</div> </div>

View File

@ -79,11 +79,12 @@
<% end %> <% end %>
<% end %> <% end %>
<% when '6' %> <% when '6' %>
<% if (User.current.logged? && <%# if (User.current.logged? &&
User.current.admin? User.current.admin?
# && (@project && User.current.member_of?(@project)) # && (@project && User.current.member_of?(@project))
) )
%> %>
<% if obj.author_id == User.current.id || User.current.admin?%>
<span class='del'> <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag, <span class='del'> <%= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
:taggable_id => obj.id, :taggable_type => object_flag %> </span> :taggable_id => obj.id, :taggable_type => object_flag %> </span>
<% end %> <% end %>
@ -101,6 +102,8 @@
:taggable_id => obj.id, :taggable_type => object_flag %> </span> :taggable_id => obj.id, :taggable_type => object_flag %> </span>
<% end %> <% end %>
<% end %> <% end %>
</span> </span>
</div> </div>

View File

@ -1334,7 +1334,7 @@ zh:
label_gantt_progress_line: Progress line label_gantt_progress_line: Progress line
setting_jsonp_enabled: Enable JSONP support setting_jsonp_enabled: Enable JSONP support
field_inherit_members: Inherit members field_inherit_members: Inherit members
field_closed_on: Closed field_closed_on: 已关闭
setting_default_projects_tracker_ids: Default trackers for new projects setting_default_projects_tracker_ids: Default trackers for new projects
label_total_time: 合计 label_total_time: 合计
label_create_time: 创建时间 #Customer addedAdded by nie label_create_time: 创建时间 #Customer addedAdded by nie
@ -1415,6 +1415,7 @@ zh:
#fq #fq
button_leave_meassge: 留言 button_leave_meassge: 留言
button_clear_meassge: 清除留言
label_leave_message_to: 给用户 %{name}留言 label_leave_message_to: 给用户 %{name}留言
label_leave_message: 留言内容 label_leave_message: 留言内容
label_message: 留言板 label_message: 留言板
@ -2109,3 +2110,6 @@ zh:
lable_goto_homepage: 返回主页 lable_goto_homepage: 返回主页
lable_trustie_team: Trustie开发团队 lable_trustie_team: Trustie开发团队
lable_memos_max_length: 帖子内容最大长度为65535个字符
lable_forums_max_length: 贴吧描述最大长度为65535个字符

View File

@ -0,0 +1,9 @@
class ChangeForumDescription < ActiveRecord::Migration
def up
change_column :forums, :description, :text, default: nil
end
def down
change_column :forums, :description, :string, default: ''
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140812065417) do ActiveRecord::Schema.define(:version => 20140814062455) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false
@ -441,21 +441,21 @@ ActiveRecord::Schema.define(:version => 20140812065417) do
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.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|
t.string "name", :null => false t.string "name", :null => false
t.string "description", :default => "" t.text "description"
t.integer "topic_count", :default => 0 t.integer "topic_count", :default => 0
t.integer "memo_count", :default => 0 t.integer "memo_count", :default => 0
t.integer "last_memo_id", :default => 0 t.integer "last_memo_id", :default => 0
t.integer "creator_id", :null => false t.integer "creator_id", :null => false
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
end end
create_table "groups_users", :id => false, :force => true do |t| create_table "groups_users", :id => false, :force => true do |t|