Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts: db/schema.rb
This commit is contained in:
commit
a39672dd14
|
@ -153,6 +153,7 @@ class AdminController < ApplicationController
|
|||
@first_page.image_width = params[:image_width]
|
||||
@first_page.image_height = params[:image_height]
|
||||
@first_page.sort_type = params[:sort_type]
|
||||
@first_page.show_course = params[:show_course]
|
||||
if @first_page.save
|
||||
respond_to do |format|
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
|
|
|
@ -174,7 +174,9 @@ class AttachmentsController < ApplicationController
|
|||
respond_to do |format|
|
||||
# modify by nwb
|
||||
if !@attachment.container.nil? && (@attachment.container.is_a?(Course) || @attachment.container.course)
|
||||
if @course.nil?
|
||||
if @attachment.container.is_a?(News)
|
||||
format.html { redirect_to_referer_or news_path(@attachment.container) }
|
||||
elsif @course.nil?
|
||||
format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum, @attachment.container) }
|
||||
else
|
||||
format.html { redirect_to_referer_or course_path(@course) }
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
class ProjectsController < ApplicationController
|
||||
layout :select_project_layout
|
||||
|
||||
menu_item :overview
|
||||
menu_item :roadmap, :only => :roadmap
|
||||
menu_item :settings, :only => :settings
|
||||
|
@ -459,24 +460,10 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
|
||||
def new
|
||||
@project_type = params[:project_type] ||= params[:course]
|
||||
@issue_custom_fields = IssueCustomField.sorted.all
|
||||
@trackers = Tracker.sorted.all
|
||||
|
||||
case @project_type
|
||||
when '0' # Project
|
||||
@project = Project.new
|
||||
@project.safe_attributes = params[:project]
|
||||
when '1' # Course
|
||||
@project = Project.new
|
||||
@project.safe_attributes = params[:project]
|
||||
@course_tag = params[:course]
|
||||
@course = Course.new
|
||||
@course.safe_attributes = params[:course]
|
||||
else # default Project
|
||||
@project = Project.new
|
||||
@project.safe_attributes = params[:project]
|
||||
end
|
||||
@project = Project.new
|
||||
@project.safe_attributes = params[:project]
|
||||
render :layout => 'base'
|
||||
end
|
||||
|
||||
|
@ -490,128 +477,43 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
|
||||
@course_tag = params[:project][:project_type]
|
||||
if(@course_tag=="1")
|
||||
if User.current.user_extensions.identity#.include?(UserExtensions::TEACHER,UserExtensions::DEVELOPER)
|
||||
@course = Course.new
|
||||
@course.extra='course' + DateTime.parse(Time.now.to_s).strftime('%Y-%m-%d_%H-%M-%S').to_s
|
||||
@course.safe_attributes = params[:project][:course]
|
||||
@course.tea_id = User.current.id
|
||||
# added by bai
|
||||
@course.term = params[:term]
|
||||
@course.time = params[:time]
|
||||
#@course.school_id = params[:occupation]
|
||||
@course.school_id = User.current.user_extensions.school_id
|
||||
@course.setup_time = params[:setup_time]
|
||||
@course.endup_time = params[:endup_time]
|
||||
@course.class_period = params[:class_period]
|
||||
end
|
||||
end
|
||||
@issue_custom_fields = IssueCustomField.sorted.all
|
||||
@trackers = Tracker.sorted.all
|
||||
@project = Project.new
|
||||
@project.user_id = User.current.id
|
||||
@project.dts_test = params[:project][:dts_test]
|
||||
@project.safe_attributes = params[:project]
|
||||
if @course_tag == '1'
|
||||
@project.identifier = @course.extra
|
||||
end
|
||||
if @course_tag == '1'
|
||||
if User.current.user_extensions.identity == 0
|
||||
if@course.save
|
||||
if validate_parent_id && @project.save
|
||||
@project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
|
||||
# Add current user as a project member if he is not admin
|
||||
unless User.current.admin?
|
||||
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
|
||||
m = Member.new(:user => User.current, :roles => [r])
|
||||
project = ProjectInfo.new(:user_id => User.current.id, :project_id => @project.id)
|
||||
user_grades = UserGrade.create(:user_id => User.current.id, :project_id => @project.id)
|
||||
if params[:project][:is_public] == '1'
|
||||
project_status = ProjectStatus.create(:project_id => @project.id, :watchers_count => 0, :changesets_count => 0, :grade => 0, :project_type => @course_tag)
|
||||
end
|
||||
@project.members << m
|
||||
@project.project_infos << project
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
if params[:continue]
|
||||
attrs = {:parent_id => @project.parent_id}.reject {|k,v| v.nil?}
|
||||
redirect_to new_project_path(attrs, :course => '0')
|
||||
#Added by young
|
||||
|
||||
elsif params[:course_continue]
|
||||
redirect_to new_project_path(:course => '1')
|
||||
#Ended by young
|
||||
else
|
||||
redirect_to settings_project_path(@project,:project_type => 1)
|
||||
end
|
||||
}
|
||||
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) }
|
||||
end
|
||||
if validate_parent_id && @project.save
|
||||
@project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
|
||||
# Add current user as a project member if he is not admin
|
||||
#unless User.current.admin?
|
||||
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
|
||||
m = Member.new(:user => User.current, :roles => [r])
|
||||
project_info = ProjectInfo.new(:user_id => User.current.id, :project_id => @project.id)
|
||||
user_grades = UserGrade.create(:user_id => User.current.id, :project_id => @project.id)
|
||||
Rails.logger.debug "UserGrade created: #{user_grades.to_json}"
|
||||
if params[:project][:is_public] == '1'
|
||||
project_status = ProjectStatus.create(:project_id => @project.id, :watchers_count => 0, :changesets_count => 0, :project_type => @project.project_type)
|
||||
Rails.logger.debug "ProjectStatus created: #{project_status.to_json}"
|
||||
end
|
||||
@project.members << m
|
||||
@project.project_infos << project_info
|
||||
#end
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
if params[:continue]
|
||||
attrs = {:parent_id => @project.parent_id}.reject {|k,v| v.nil?}
|
||||
redirect_to new_project_path(attrs, :course => '0')
|
||||
else
|
||||
@course.destroy
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'new', :layout => 'base'}#Added by young
|
||||
format.api { render_validation_errors(@project) }
|
||||
end
|
||||
redirect_to settings_project_path(@project)
|
||||
end
|
||||
else
|
||||
if validate_parent_id && @project.save
|
||||
@project.delete
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'new', :layout => 'base'}#Added by young
|
||||
format.api { render_validation_errors(@project) }
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'new', :layout => 'base'}#Added by young
|
||||
format.api { render_validation_errors(@project) }
|
||||
end
|
||||
end
|
||||
end
|
||||
}
|
||||
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) }
|
||||
end
|
||||
else
|
||||
#@project.memberships.create
|
||||
if validate_parent_id && @project.save
|
||||
@project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
|
||||
# Add current user as a project member if he is not admin
|
||||
#unless User.current.admin?
|
||||
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
|
||||
m = Member.new(:user => User.current, :roles => [r])
|
||||
project = ProjectInfo.new(:user_id => User.current.id, :project_id => @project.id)
|
||||
user_grades = UserGrade.create(:user_id => User.current.id, :project_id => @project.id)
|
||||
if params[:project][:is_public] == '1' || @course_tag=="1"
|
||||
project_status = ProjectStatus.create(:project_id => @project.id, :watchers_count => 0, :changesets_count => 0, :project_type => @project.project_type)
|
||||
end
|
||||
@project.members << m
|
||||
@project.project_infos << project
|
||||
#end
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
if params[:continue]
|
||||
attrs = {:parent_id => @project.parent_id}.reject {|k,v| v.nil?}
|
||||
redirect_to new_project_path(attrs, :course => '0')
|
||||
#Added by young
|
||||
|
||||
elsif params[:course_continue]
|
||||
redirect_to new_project_path(:course => '1')
|
||||
#Ended by young
|
||||
else
|
||||
redirect_to settings_project_path(@project)
|
||||
end
|
||||
}
|
||||
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) }
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'new', :layout => 'base'}#Added by young
|
||||
format.api { render_validation_errors(@project) }
|
||||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'new', :layout => 'base'}#Added by young
|
||||
format.api { render_validation_errors(@project) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ class WelcomeController < ApplicationController
|
|||
|
||||
def index
|
||||
@first_page = FirstPage.where("page_type = 'project'").first
|
||||
@show_course = @first_page.show_course
|
||||
if @first_page.nil? || @first_page.sort_type.nil?
|
||||
@projects = find_miracle_project(10, 3,"grade desc")
|
||||
else
|
||||
|
|
|
@ -68,6 +68,10 @@ module ApplicationHelper
|
|||
link_to(name, options, html_options, *parameters_for_method_reference) if authorize_for(options[:controller] || params[:controller], options[:action])
|
||||
end
|
||||
|
||||
def link_to_if_authorized_course(name, options = {}, html_options = nil, *parameters_for_method_reference)
|
||||
link_to(name, options, html_options, *parameters_for_method_reference) if authorize_for_course(options[:controller] || params[:controller], options[:action])
|
||||
end
|
||||
|
||||
def link_to_if_authorized_contest(name, options = {}, html_options = nil, *parameters_for_method_reference)
|
||||
link_to(name, options, html_options, *parameters_for_method_reference) if authorize_for_contest(options[:controller] || params[:controller], options[:action])
|
||||
end
|
||||
|
|
|
@ -68,6 +68,7 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
return true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def self.remove_by_user? user
|
||||
if( self.user == user ||
|
||||
|
@ -87,6 +88,15 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
def reference_user
|
||||
User.find(reply_id)
|
||||
end
|
||||
|
||||
def delete_by_user?user
|
||||
# 用户可删除自己的留言
|
||||
if self.user.id == user.id || user.admin?
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
def self.reference_message(user_id)
|
||||
@user = User.find(user_id)
|
||||
|
|
|
@ -758,6 +758,7 @@ class Project < ActiveRecord::Base
|
|||
'tracker_ids',
|
||||
'issue_custom_field_ids',
|
||||
'project_type',
|
||||
'dts_test',
|
||||
'attachmenttype'
|
||||
|
||||
|
||||
|
|
|
@ -27,24 +27,28 @@
|
|||
<label for='image_height' style="vertical-align: top"> <%= l(:label_imgae_height)%>:</label>
|
||||
<%= text_field_tag 'image_height', params[:label_imgae_height], :value => @first_page.image_height,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
|
||||
</p>
|
||||
<!-- <p style="margin-left:60px;padding-right: 20px;">
|
||||
<label for='title'> <#%= l(:label_site_title) %>:</label>
|
||||
<#%= text_field_tag 'title', params[:label_site_title], :value => @first_page.title,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
|
||||
</p> -->
|
||||
<p style="margin-left:60px;padding-right: 20px;">
|
||||
<label for='title'> <%= l(:label_show_course) %>:</label>
|
||||
<select name="show_course" id="show_course" style="font-size:small;width:497px;margin-left:10px;display: inline">
|
||||
<option value="1" <%= "selected=selected" if @first_page.show_course == 1 %>><%= l(:general_text_yes) %></option>
|
||||
<option value="2" <%= "selected=selected" if @first_page.show_course == 2 %>><%= l(:general_text_no) %></option>
|
||||
</select>
|
||||
</p>
|
||||
<p style="margin-left:60px;padding-right: 20px;">
|
||||
<label for='sort_type' style="vertical-align: top"> <%= l(:label_sort_type)%>:</label>
|
||||
<select name="sort_type" id="sort_type" style="font-size:small;width:497px;margin-left:80px;">
|
||||
<option value="1" <%= "selected=selected" if @first_page.sort_type == 1 %>><%= l(:label_sort_by_active) %></option>
|
||||
<option value="2" <%= "selected=selected" if @first_page.sort_type == 2 %>><%= l(:label_sort_by_influence) %></option>
|
||||
<option value="0" <%= "selected=selected" if @first_page.sort_type == 0 %>><%= l(:label_sort_by_time) %></option>
|
||||
</select>
|
||||
</p>
|
||||
<p style="margin-left:60px;padding-right: 20px;">
|
||||
<label for='description' style="vertical-align: top"> <%= l(:label_site_description)%>:</label>
|
||||
<!-- <#%= text_area_tag 'description',@first_page.description,:rows => 8, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %> -->
|
||||
<%= text_area 'first_page', 'description', :value => @first_page.description,:cols => 80, :rows => 15, :class => 'wiki-edit' %>
|
||||
<%= wikitoolbar_for 'first_page_description' %>
|
||||
</p>
|
||||
<p style="margin-left:60px;padding-right: 20px;">
|
||||
<label for='sort_type' style="vertical-align: top"> <%= l(:label_sort_type)%>:</label>
|
||||
<select name="sort_type" id="sort_type" style="font-size:small;width:496px;margin-left:80px;">
|
||||
<option value="1" <%= "selected=selected" if @first_page.sort_type == 1 %>><%= l(:label_sort_by_active) %></option>
|
||||
<option value="2" <%= "selected=selected" if @first_page.sort_type == 2 %>><%= l(:label_sort_by_influence) %></option>
|
||||
<option value="0" <%= "selected=selected" if @first_page.sort_type == 0 %>><%= l(:label_sort_by_time) %></option>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
|
||||
<%= submit_tag l(:button_save), :class => "small", :name => nil %>
|
||||
<% end %>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
:method => :delete,
|
||||
:class => 'delete',
|
||||
:title => l(:button_delete) %>
|
||||
<% else %>
|
||||
<% else %>
|
||||
<%= link_to image_tag('delete.png'), attachment_path(attachment),
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:method => :delete,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<%= raw @issues.map {|issue| {
|
||||
'id' => issue.id,
|
||||
'label' => "#{issue.tracker} ##{issue.id}: #{truncate issue.subject.to_s, :length => 60}",
|
||||
'label' => "#{issue.tracker} ##{issue.project_index}: #{truncate issue.subject.to_s, :length => 60}",
|
||||
'value' => issue.id
|
||||
}
|
||||
}.to_json
|
||||
|
|
|
@ -78,6 +78,9 @@ function checkMaxLength() {
|
|||
'#{l(:label_reply_plural)} #{journal.user.name}: ');
|
||||
return false;"} %>
|
||||
<% end %>
|
||||
<% if journal.delete_by_user?(User.current) %>
|
||||
<%= link_to(l(:button_delete), {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => journal.user}, :method => :delete,:remote => true)%>
|
||||
<% end %>
|
||||
</span>
|
||||
</span>
|
||||
<div style="clear: both;"></div>
|
||||
|
|
|
@ -40,8 +40,10 @@
|
|||
<li style="padding:0 0; margin:0 0;display:inline;border-bottom: 0;" class="loggedas_li">
|
||||
<%=link_to_user(User.current)%>
|
||||
<ul class="sub_menu">
|
||||
<% if @show_course.nil? || @show_course != 2 %>
|
||||
<% if User.current.user_extensions && [UserExtensions::TEACHER, UserExtensions::STUDENT].include?(User.current.user_extensions.identity) -%>
|
||||
<% hasCourse=true%>
|
||||
|
||||
<li id="course_loggedas_li"><%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id, host: Setting.course_domain} %>
|
||||
<ul class="course_sub_menu">
|
||||
<% User.current.courses.each do |course| %>
|
||||
|
@ -51,7 +53,9 @@
|
|||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<% end -%>
|
||||
<% end %>
|
||||
<li id="project_loggedas_li"><%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %>
|
||||
|
||||
<% if hasCourse %>
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td align="left"><span class="font_lighter"> <%= format_time(comment.created_on) %></span></td>
|
||||
<td width="200" align="right" class="a"><%= link_to_if_authorized image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment},
|
||||
<td width="200" align="right" class="a"><%= link_to_if_authorized_course image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment},
|
||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete, :title => l(:button_delete) %></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
</div>
|
||||
<div class="wiki-description">
|
||||
<p>
|
||||
<%= textilizable(project.short_description, :project => project) %>
|
||||
<%= textilizable(project.short_description.strip, :project => project) %>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -137,7 +137,12 @@
|
|||
<% end %>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580"><p class="font_description"> <%= act.notes.html_safe %> </p>
|
||||
<% if act.notes.nil? %>
|
||||
<% desStr = '' %>
|
||||
<% else %>
|
||||
<% desStr=act.notes.html_safe %>
|
||||
<% end %>
|
||||
<td colspan="2" width="580"><p class="font_description"> <%= desStr %> </p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
|
@ -166,10 +166,10 @@
|
|||
<%= "#{l(:label_updated_time, value: time_tag_welcome(topic_last_time topic))}".html_safe %>
|
||||
</span>
|
||||
<span class="memo_author">
|
||||
楼主: <%= link_to_user(topic.author) %>
|
||||
楼主: <%= link_to topic.author.login.truncate(10, omission: '...'),user_path(topic.author),title: topic.author.login %>
|
||||
</span>
|
||||
<span class="memo_last_person">
|
||||
最后回复:<%=link_to_user topic.last_reply.try(:author) %>
|
||||
最后回复:<% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %><%=link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%><% end %>
|
||||
</span>
|
||||
<span class="memo_reply">
|
||||
回复(<%= link_to topic.try(:replies_count), topic.event_url %>)
|
||||
|
|
|
@ -498,7 +498,7 @@ zh:
|
|||
project_module_time_tracking: 时间跟踪
|
||||
project_module_news: 新闻
|
||||
project_module_documents: 文档
|
||||
project_module_files: 资料下载
|
||||
project_module_files: 作品下载
|
||||
project_module_wiki: Wiki
|
||||
project_module_repository: 版本库
|
||||
project_module_boards: 讨论区
|
||||
|
@ -579,6 +579,7 @@ zh:
|
|||
label_sort_type: 热门项目排序方式
|
||||
label_contest_notification_title: 竞赛通知标题
|
||||
label_contest_notification_content: 竞赛通知内容
|
||||
label_show_course: 显示课程
|
||||
#by young
|
||||
label_requirement: 需求
|
||||
label_new_course: 课程列表
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class FirstPageAddColumn < ActiveRecord::Migration
|
||||
def change
|
||||
add_column("first_pages","show_course",:integer,default: 1)
|
||||
end
|
||||
end
|
23
db/schema.rb
23
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20140725073357) do
|
||||
ActiveRecord::Schema.define(:version => 20140728014933) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -425,6 +425,7 @@ ActiveRecord::Schema.define(:version => 20140725073357) do
|
|||
t.integer "sort_type"
|
||||
t.integer "image_width", :default => 107
|
||||
t.integer "image_height", :default => 63
|
||||
t.integer "show_course", :default => 1
|
||||
end
|
||||
|
||||
create_table "forums", :force => true do |t|
|
||||
|
@ -845,18 +846,18 @@ ActiveRecord::Schema.define(:version => 20140725073357) do
|
|||
create_table "relative_memos", :force => true do |t|
|
||||
t.integer "osp_id"
|
||||
t.integer "parent_id"
|
||||
t.string "subject", :null => false
|
||||
t.text "content", :limit => 16777215, :null => false
|
||||
t.string "subject", :null => false
|
||||
t.text "content", :null => false
|
||||
t.integer "author_id"
|
||||
t.integer "replies_count", :default => 0
|
||||
t.integer "replies_count", :default => 0
|
||||
t.integer "last_reply_id"
|
||||
t.boolean "lock", :default => false
|
||||
t.boolean "sticky", :default => false
|
||||
t.boolean "is_quote", :default => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "viewed_count_crawl", :default => 0
|
||||
t.integer "viewed_count_local", :default => 0
|
||||
t.boolean "lock", :default => false
|
||||
t.boolean "sticky", :default => false
|
||||
t.boolean "is_quote", :default => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "viewed_count_crawl", :default => 0
|
||||
t.integer "viewed_count_local", :default => 0
|
||||
t.string "url"
|
||||
t.string "username"
|
||||
t.string "userhomeurl"
|
||||
|
|
|
@ -48,8 +48,13 @@ module Redmine
|
|||
end
|
||||
|
||||
def attachments_deletable?(user=User.current)
|
||||
(respond_to?(:visible?) ? visible?(user) : true) &&
|
||||
user.allowed_to?(self.class.attachable_options[:delete_permission], self.project)
|
||||
if (self.has_attribute?(:course) ||self.has_attribute?(:course_id)) && self.course
|
||||
(respond_to?(:visible?) ? visible?(user) : true) &&
|
||||
user.allowed_to?(self.class.attachable_options[:delete_permission], self.course)
|
||||
else
|
||||
(respond_to?(:visible?) ? visible?(user) : true) &&
|
||||
user.allowed_to?(self.class.attachable_options[:delete_permission], self.project)
|
||||
end
|
||||
end
|
||||
|
||||
def saved_attachments
|
||||
|
|
Loading…
Reference in New Issue