Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
36004913c6
|
@ -32,7 +32,7 @@ module ApplicationHelper
|
||||||
|
|
||||||
extend Forwardable
|
extend Forwardable
|
||||||
def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter
|
def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter
|
||||||
|
|
||||||
#Added by young
|
#Added by young
|
||||||
#Define the course menu's link class
|
#Define the course menu's link class
|
||||||
# 不是数组的转化成数组,然后判断当前menu_item是否在给定的列表
|
# 不是数组的转化成数组,然后判断当前menu_item是否在给定的列表
|
||||||
|
@ -53,10 +53,10 @@ module ApplicationHelper
|
||||||
def authorize_for_course(controller, action)
|
def authorize_for_course(controller, action)
|
||||||
User.current.allowed_to?({:controller => controller, :action => action}, @course)
|
User.current.allowed_to?({:controller => controller, :action => action}, @course)
|
||||||
end
|
end
|
||||||
|
|
||||||
def authorize_for_contest(controller, action)
|
def authorize_for_contest(controller, action)
|
||||||
User.current.allowed_to?({:controller => controller, :action => action}, @contest)
|
User.current.allowed_to?({:controller => controller, :action => action}, @contest)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Display a link if user is authorized
|
# Display a link if user is authorized
|
||||||
#
|
#
|
||||||
|
@ -309,7 +309,7 @@ module ApplicationHelper
|
||||||
s << h(block_given? ? yield(project) : project.name)
|
s << h(block_given? ? yield(project) : project.name)
|
||||||
else
|
else
|
||||||
end
|
end
|
||||||
|
|
||||||
if project.try(:project_type) == Project::ProjectType_project
|
if project.try(:project_type) == Project::ProjectType_project
|
||||||
unless User.current.member_of?(@project)
|
unless User.current.member_of?(@project)
|
||||||
s << "<span style = 'float: right;'>"
|
s << "<span style = 'float: right;'>"
|
||||||
|
@ -382,7 +382,7 @@ module ApplicationHelper
|
||||||
s << "</ul></li>\n"
|
s << "</ul></li>\n"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
classes = (ancestors.empty? ? 'root' : 'child')
|
classes = (ancestors.empty? ? 'root' : 'child')
|
||||||
s << h(block_given? ? yield(project) : project.name)
|
s << h(block_given? ? yield(project) : project.name)
|
||||||
ancestors << project
|
ancestors << project
|
||||||
end
|
end
|
||||||
|
@ -545,11 +545,11 @@ module ApplicationHelper
|
||||||
def authoring(created, author, options={})
|
def authoring(created, author, options={})
|
||||||
l(options[:label] || :label_added_time_by, :author => link_to_user(author), :age => time_tag(created)).html_safe
|
l(options[:label] || :label_added_time_by, :author => link_to_user(author), :age => time_tag(created)).html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
def added_time(created)
|
def added_time(created)
|
||||||
l(:label_added_time, :age => time_tag(created)).html_safe
|
l(:label_added_time, :age => time_tag(created)).html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
def user_url_and_time(user_name, user_url, created)
|
def user_url_and_time(user_name, user_url, created)
|
||||||
unless user_name.nil? || user_name == ''
|
unless user_name.nil? || user_name == ''
|
||||||
l(:label_added_time_by, :author => link_to(user_name, user_url), :age => time_tag(created)).html_safe
|
l(:label_added_time_by, :author => link_to(user_name, user_url), :age => time_tag(created)).html_safe
|
||||||
|
@ -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
|
||||||
|
@ -851,7 +851,7 @@ module ApplicationHelper
|
||||||
else
|
else
|
||||||
wiki_page_id = page.present? ? Wiki.titleize(page) : nil
|
wiki_page_id = page.present? ? Wiki.titleize(page) : nil
|
||||||
parent = wiki_page.nil? && obj.is_a?(WikiContent) && obj.page && project == link_project ? obj.page.title : nil
|
parent = wiki_page.nil? && obj.is_a?(WikiContent) && obj.page && project == link_project ? obj.page.title : nil
|
||||||
url_for(:only_path => only_path, :controller => 'wiki', :action => 'show', :project_id => link_project,
|
url_for(:only_path => only_path, :controller => 'wiki', :action => 'show', :project_id => link_project,
|
||||||
:id => wiki_page_id, :version => nil, :anchor => anchor, :parent => parent)
|
:id => wiki_page_id, :version => nil, :anchor => anchor, :parent => parent)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -865,7 +865,7 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def select_option_helper option
|
def select_option_helper option
|
||||||
tmp = Hash.new
|
tmp = Hash.new
|
||||||
tmp={"" => ""}
|
tmp={"" => ""}
|
||||||
|
@ -1177,7 +1177,7 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def lang_options_for_select(blank=true)
|
def lang_options_for_select(blank=true)
|
||||||
{ 'Chinese简体中文 '=> 'zh', :English => :en}
|
{ 'Chinese简体中文 '=> 'zh', :English => :en}
|
||||||
end
|
end
|
||||||
|
|
||||||
def label_tag_for(name, option_tags = nil, options = {})
|
def label_tag_for(name, option_tags = nil, options = {})
|
||||||
|
@ -1240,7 +1240,7 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
html.html_safe
|
html.html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete_link(url, options={})
|
def delete_link(url, options={})
|
||||||
options = {
|
options = {
|
||||||
|
@ -1254,8 +1254,8 @@ module ApplicationHelper
|
||||||
|
|
||||||
def preview_link(url, form, target='preview', options={})
|
def preview_link(url, form, target='preview', options={})
|
||||||
content_tag 'a', l(:label_preview), {
|
content_tag 'a', l(:label_preview), {
|
||||||
:href => "#",
|
:href => "#",
|
||||||
:onclick => %|submitPreview("#{escape_javascript url_for(url)}", "#{escape_javascript form}", "#{escape_javascript target}"); return false;|,
|
:onclick => %|submitPreview("#{escape_javascript url_for(url)}", "#{escape_javascript form}", "#{escape_javascript target}"); return false;|,
|
||||||
:accesskey => accesskey(:preview)
|
:accesskey => accesskey(:preview)
|
||||||
}.merge(options)
|
}.merge(options)
|
||||||
end
|
end
|
||||||
|
@ -1343,12 +1343,12 @@ module ApplicationHelper
|
||||||
|
|
||||||
tags = javascript_tag(
|
tags = javascript_tag(
|
||||||
"var datepickerOptions={dateFormat: 'yy-mm-dd',minDate: new Date(), firstDay: #{start_of_week}, " +
|
"var datepickerOptions={dateFormat: 'yy-mm-dd',minDate: new Date(), firstDay: #{start_of_week}, " +
|
||||||
"showOn: 'button', buttonImageOnly: true, buttonImage: '" +
|
"showOn: 'button', buttonImageOnly: true, buttonImage: '" +
|
||||||
path_to_image('/images/calendar.png') +
|
path_to_image('/images/calendar.png') +
|
||||||
"', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true, onClose: function(dateText, inst) {TimeClose(dateText,inst);}, beforeShow : function(input){TimeBeforeShow(input);} };")
|
"', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true, onClose: function(dateText, inst) {TimeClose(dateText,inst);}, beforeShow : function(input){TimeBeforeShow(input);} };")
|
||||||
jquery_locale = l('jquery.locale', :default => current_language.to_s)
|
jquery_locale = l('jquery.locale', :default => current_language.to_s)
|
||||||
unless jquery_locale == 'en'
|
unless jquery_locale == 'en'
|
||||||
tags << javascript_include_tag("i18n/jquery.ui.datepicker-#{jquery_locale}.js")
|
tags << javascript_include_tag("i18n/jquery.ui.datepicker-#{jquery_locale}.js")
|
||||||
end
|
end
|
||||||
tags
|
tags
|
||||||
end
|
end
|
||||||
|
@ -1516,14 +1516,14 @@ module ApplicationHelper
|
||||||
options
|
options
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Add by Tao
|
# Add by Tao
|
||||||
def url_to_avatar(source)
|
def url_to_avatar(source)
|
||||||
source = nil if source.kind_of?(String)
|
source = nil if source.kind_of?(String)
|
||||||
get_avatar(source)
|
get_avatar(source)
|
||||||
end
|
end
|
||||||
# Endof Tao's code
|
# Endof Tao's code
|
||||||
|
|
||||||
def date_format_local(time)
|
def date_format_local(time)
|
||||||
date = time.strftime("%Y年%m月%d日")
|
date = time.strftime("%Y年%m月%d日")
|
||||||
end
|
end
|
||||||
|
@ -1539,7 +1539,7 @@ module ApplicationHelper
|
||||||
def link_to_content_update(text, url_params = {}, html_options = {})
|
def link_to_content_update(text, url_params = {}, html_options = {})
|
||||||
link_to(text, url_params, html_options)
|
link_to(text, url_params, html_options)
|
||||||
end
|
end
|
||||||
|
|
||||||
#added by nie
|
#added by nie
|
||||||
# Display watcher picture
|
# Display watcher picture
|
||||||
def show_more_watchers?(obj)
|
def show_more_watchers?(obj)
|
||||||
|
@ -1549,7 +1549,7 @@ module ApplicationHelper
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def show_watcher_profile(obj)
|
def show_watcher_profile(obj)
|
||||||
count = 0
|
count = 0
|
||||||
html = ''
|
html = ''
|
||||||
|
@ -1574,7 +1574,7 @@ module ApplicationHelper
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def show_bid_project(bid)
|
def show_bid_project(bid)
|
||||||
html = ''
|
html = ''
|
||||||
if bid.projects.where('is_public = 1').count == 0
|
if bid.projects.where('is_public = 1').count == 0
|
||||||
|
@ -1586,15 +1586,15 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
html.html_safe
|
html.html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
def show_bid_fans_picture(obj)
|
def show_bid_fans_picture(obj)
|
||||||
html = ''
|
html = ''
|
||||||
if obj.watcher_users.count == 0
|
if obj.watcher_users.count == 0
|
||||||
html << (content_tag "span", l(:label_project_no_follow))
|
html << (content_tag "span", l(:label_project_no_follow))
|
||||||
else
|
else
|
||||||
obj.watcher_users.take(12).each do |user|
|
obj.watcher_users.take(12).each do |user|
|
||||||
html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar", :title => user.name)
|
html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar", :title => user.name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
html.html_safe
|
html.html_safe
|
||||||
end
|
end
|
||||||
|
@ -1615,7 +1615,7 @@ module ApplicationHelper
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def show_contest_project(bid)
|
def show_contest_project(bid)
|
||||||
html = ''
|
html = ''
|
||||||
if contest.projects.where('is_public = 1').count == 0
|
if contest.projects.where('is_public = 1').count == 0
|
||||||
|
@ -1627,7 +1627,7 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
html.html_safe
|
html.html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
def show_contest_project(contest)
|
def show_contest_project(contest)
|
||||||
html = ''
|
html = ''
|
||||||
if contest.projects.where('is_public = 1').count == 0
|
if contest.projects.where('is_public = 1').count == 0
|
||||||
|
@ -1639,7 +1639,7 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
html.html_safe
|
html.html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
def show_contest_softapplication(contest)
|
def show_contest_softapplication(contest)
|
||||||
html = ''
|
html = ''
|
||||||
if contest.softapplications.where('is_public = 1').count == 0
|
if contest.softapplications.where('is_public = 1').count == 0
|
||||||
|
@ -1651,19 +1651,19 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
html.html_safe
|
html.html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
def show_contest_fans_picture(obj)
|
def show_contest_fans_picture(obj)
|
||||||
html = ''
|
html = ''
|
||||||
if obj.watcher_users.count == 0
|
if obj.watcher_users.count == 0
|
||||||
html << (content_tag "span", l(:label_project_no_follow))
|
html << (content_tag "span", l(:label_project_no_follow))
|
||||||
else
|
else
|
||||||
obj.watcher_users.take(12).each do |user|
|
obj.watcher_users.take(12).each do |user|
|
||||||
html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar", :title => user.name)
|
html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar", :title => user.name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
html.html_safe
|
html.html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
#display fans picture
|
#display fans picture
|
||||||
def show_more_fans?(obj)
|
def show_more_fans?(obj)
|
||||||
if obj.watcher_users.count > 12
|
if obj.watcher_users.count > 12
|
||||||
|
@ -1672,20 +1672,20 @@ module ApplicationHelper
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def show_fans_picture(obj)
|
def show_fans_picture(obj)
|
||||||
html = ''
|
html = ''
|
||||||
if obj.watcher_users.count == 0
|
if obj.watcher_users.count == 0
|
||||||
html << (content_tag "span", l(:label_no_current_fans))
|
html << (content_tag "span", l(:label_no_current_fans))
|
||||||
else
|
else
|
||||||
obj.watcher_users.take(12).each do |user|
|
obj.watcher_users.take(12).each do |user|
|
||||||
html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar", :title => user.name)
|
html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar", :title => user.name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
html.html_safe
|
html.html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
# added by bai
|
# added by bai
|
||||||
def show_more_participate?(obj)
|
def show_more_participate?(obj)
|
||||||
if obj.join_in_contests.count > 12
|
if obj.join_in_contests.count > 12
|
||||||
return true
|
return true
|
||||||
|
@ -1693,7 +1693,7 @@ module ApplicationHelper
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def show_participate_picture(obj)
|
def show_participate_picture(obj)
|
||||||
html = ''
|
html = ''
|
||||||
count = 0
|
count = 0
|
||||||
|
@ -1706,10 +1706,10 @@ module ApplicationHelper
|
||||||
if count >= 12
|
if count >= 12
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
html.html_safe
|
html.html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
#end
|
#end
|
||||||
|
|
||||||
# add by huang
|
# add by huang
|
||||||
|
@ -1724,7 +1724,7 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
html.html_safe
|
html.html_safe
|
||||||
end
|
end
|
||||||
# end
|
# end
|
||||||
|
|
||||||
#added by william
|
#added by william
|
||||||
|
@ -1733,7 +1733,7 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
|
||||||
def hadcommittedhomework(cur,curb)
|
def hadcommittedhomework(cur,curb)
|
||||||
bid = Bid.find_by_id(curb)
|
bid = Bid.find_by_id(curb)
|
||||||
return true if bid.nil?
|
return true if bid.nil?
|
||||||
|
@ -1748,7 +1748,7 @@ module ApplicationHelper
|
||||||
else
|
else
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_dynamic_nav
|
def render_dynamic_nav
|
||||||
|
@ -1759,10 +1759,10 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def bootstrap_render_dynamic_nav
|
def bootstrap_render_dynamic_nav
|
||||||
|
|
||||||
main_course_link = link_to l(:label_course_practice), {:controller => 'welcome', :action => 'index', :host => Setting.course_domain}
|
main_course_link = link_to l(:label_course_practice), {:controller => 'welcome', :action => 'index', :host => Setting.course_domain}
|
||||||
main_project_link = link_to l(:label_project_deposit), {:controller => 'welcome', :action => 'index', :host => Setting.project_domain}
|
main_project_link = link_to l(:label_project_deposit), {:controller => 'welcome', :action => 'index', :host => Setting.project_domain}
|
||||||
main_contest_link = link_to l(:label_contest_innovate), {:controller => 'welcome', :action => 'index', :host => Setting.contest_domain}
|
main_contest_link = link_to l(:label_contest_innovate), {:controller => 'welcome', :action => 'index', :host => Setting.contest_domain}
|
||||||
|
|
||||||
course_all_course_link = link_to l(:label_course_all), {:controller => 'courses', :action => 'index'}
|
course_all_course_link = link_to l(:label_course_all), {:controller => 'courses', :action => 'index'}
|
||||||
course_teacher_all_link = link_to l(:label_teacher_all), {:controller => 'users', :action => 'index', :role => 'teacher', :host => Setting.course_domain}
|
course_teacher_all_link = link_to l(:label_teacher_all), {:controller => 'users', :action => 'index', :role => 'teacher', :host => Setting.course_domain}
|
||||||
|
@ -1774,20 +1774,20 @@ module ApplicationHelper
|
||||||
forum_link = link_to l(:label_project_module_forums), {:controller => "forums", :action => "index"}
|
forum_link = link_to l(:label_project_module_forums), {:controller => "forums", :action => "index"}
|
||||||
stores_link = link_to l(:label_stores_index), {:controller => 'stores', :action=> 'index'}
|
stores_link = link_to l(:label_stores_index), {:controller => 'stores', :action=> 'index'}
|
||||||
|
|
||||||
|
|
||||||
school_all_school_link = link_to l(:label_school_all), {:controller => 'school', :action => 'index'}
|
school_all_school_link = link_to l(:label_school_all), {:controller => 'school', :action => 'index'}
|
||||||
|
|
||||||
|
|
||||||
#@nav_dispaly_project_label
|
#@nav_dispaly_project_label
|
||||||
nav_list = Array.new
|
nav_list = Array.new
|
||||||
nav_list.push(school_all_school_link) if @nav_dispaly_course_all_label && @show_course == 1
|
nav_list.push(school_all_school_link) if @nav_dispaly_course_all_label && @show_course == 1
|
||||||
nav_list.push(course_all_course_link) if @nav_dispaly_course_all_label && @show_course == 1
|
nav_list.push(course_all_course_link) if @nav_dispaly_course_all_label && @show_course == 1
|
||||||
nav_list.push(course_teacher_all_link) if @nav_dispaly_teacher_all_label && @show_course == 1
|
nav_list.push(course_teacher_all_link) if @nav_dispaly_teacher_all_label && @show_course == 1
|
||||||
|
|
||||||
nav_list.push(main_project_link) if @nav_dispaly_main_project_label
|
nav_list.push(main_project_link) if @nav_dispaly_main_project_label
|
||||||
nav_list.push(main_course_link) if @nav_dispaly_main_course_label && @show_course == 1
|
nav_list.push(main_course_link) if @nav_dispaly_main_course_label && @show_course == 1
|
||||||
nav_list.push(main_contest_link) if @nav_dispaly_main_contest_label && @show_contest == 1
|
nav_list.push(main_contest_link) if @nav_dispaly_main_contest_label && @show_contest == 1
|
||||||
|
|
||||||
nav_list.push(courses_link) if @nav_dispaly_course_label && @show_course == 1
|
nav_list.push(courses_link) if @nav_dispaly_course_label && @show_course == 1
|
||||||
nav_list.push(projects_link) if @nav_dispaly_project_label
|
nav_list.push(projects_link) if @nav_dispaly_project_label
|
||||||
nav_list.push(users_link) if @nav_dispaly_user_label
|
nav_list.push(users_link) if @nav_dispaly_user_label
|
||||||
|
@ -1797,7 +1797,7 @@ module ApplicationHelper
|
||||||
nav_list.push(stores_link) if @nav_dispaly_store_all_label
|
nav_list.push(stores_link) if @nav_dispaly_store_all_label
|
||||||
|
|
||||||
content_li = ''
|
content_li = ''
|
||||||
nav_list.collect do |nav_item|
|
nav_list.collect do |nav_item|
|
||||||
content_li << content_tag(:li, nav_item)
|
content_li << content_tag(:li, nav_item)
|
||||||
end
|
end
|
||||||
content_li.html_safe
|
content_li.html_safe
|
||||||
|
@ -1806,12 +1806,12 @@ module ApplicationHelper
|
||||||
def current_user
|
def current_user
|
||||||
User.current
|
User.current
|
||||||
end
|
end
|
||||||
|
|
||||||
# def hadcommittedforcontest(curu)
|
# def hadcommittedforcontest(curu)
|
||||||
# message = JournalsForMessage.find_by_sql("select * from journals_for_messages where jour_type = 'Softapplication' ")
|
# message = JournalsForMessage.find_by_sql("select * from journals_for_messages where jour_type = 'Softapplication' ")
|
||||||
# message.each do |createmessage|
|
# message.each do |createmessage|
|
||||||
# if createmessage.user_id == curu
|
# if createmessage.user_id == curu
|
||||||
# return true
|
# return true
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
|
@ -1824,11 +1824,12 @@ module ApplicationHelper
|
||||||
logos.push(link_to image_tag('/images/footer_logo/iscas.png', :alt=>"iscas"), "http://www.iscas.ac.cn" )
|
logos.push(link_to image_tag('/images/footer_logo/iscas.png', :alt=>"iscas"), "http://www.iscas.ac.cn" )
|
||||||
logos.push(link_to image_tag('/images/footer_logo/inforbus.png', :alt=>"inforbus"), "http://www.inforbus.com" )
|
logos.push(link_to image_tag('/images/footer_logo/inforbus.png', :alt=>"inforbus"), "http://www.inforbus.com" )
|
||||||
|
|
||||||
logos.collect! { |logo|
|
logos.collect! { |logo|
|
||||||
content_tag(:li, logo.html_safe, :class => li_class.to_s)
|
content_tag(:li, logo.html_safe, :class => li_class.to_s)
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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?
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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?
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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 -->
|
||||||
|
|
|
@ -4,11 +4,11 @@
|
||||||
<span class="body">
|
<span class="body">
|
||||||
<h3><%= link_to(@bid.author.lastname+@bid.author.firstname, user_path(@bid.author))%>:<%= link_to(@bid.name,respond_path(@bid)) %></h3>
|
<h3><%= link_to(@bid.author.lastname+@bid.author.firstname, user_path(@bid.author))%>:<%= link_to(@bid.name,respond_path(@bid)) %></h3>
|
||||||
<% if @bid.reward_type.nil? or @bid.reward_type == 1%>
|
<% if @bid.reward_type.nil? or @bid.reward_type == 1%>
|
||||||
<p>
|
<p>
|
||||||
<strong><%= l(:label_bids_reward_method) %><span class="bonus"><%= l(:label_call_bonus) %> <%= l(:label_RMB_sign) %><%= @bid.budget %></span></strong>
|
<strong><%= l(:label_bids_reward_method) %><span class="bonus"><%= l(:label_call_bonus) %> <%= l(:label_RMB_sign) %><%= @bid.budget %></span></strong>
|
||||||
</p>
|
</p>
|
||||||
<% elsif @bid.reward_type == 2%>
|
<% elsif @bid.reward_type == 2%>
|
||||||
<p>
|
<p>
|
||||||
<strong><%= l(:label_bids_reward_method) %><span class="bonus"><%= @bid.budget%></span></strong>
|
<strong><%= l(:label_bids_reward_method) %><span class="bonus"><%= @bid.budget%></span></strong>
|
||||||
</p>
|
</p>
|
||||||
<% else %>
|
<% else %>
|
||||||
|
|
|
@ -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' %>
|
||||||
|
|
||||||
|
|
|
@ -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 added!Added by nie
|
label_create_time: 创建时间 #Customer added!Added 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: 留言板
|
||||||
|
|
|
@ -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
|
16
db/schema.rb
16
db/schema.rb
|
@ -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|
|
||||||
|
|
Loading…
Reference in New Issue