This commit is contained in:
sw 2014-09-16 15:38:49 +08:00
commit 7c97c0391b
13 changed files with 78 additions and 29 deletions

View File

@ -110,6 +110,8 @@ class AccountController < ApplicationController
@cache_city = params[:city]||"" #城市 @cache_city = params[:city]||"" #城市
@cache_enterprise_name = params[:enterprise_name]||"" #企业 @cache_enterprise_name = params[:enterprise_name]||"" #企业
firstname_code = ""
lastname_code = ""
(redirect_to(home_url); return) unless Setting.self_registration? || session[:auth_source_registration] (redirect_to(home_url); return) unless Setting.self_registration? || session[:auth_source_registration]
if request.get? if request.get?
session[:auth_source_registration] = nil session[:auth_source_registration] = nil
@ -119,6 +121,8 @@ class AccountController < ApplicationController
@user = User.new @user = User.new
@user.safe_attributes = user_params @user.safe_attributes = user_params
if params[:identity] == "2" # 2 企业 if params[:identity] == "2" # 2 企业
firstname_code = @user.firstname
lastname_code = @user.lastname
@user.firstname = params[:enterprise_name] @user.firstname = params[:enterprise_name]
@user.lastname = l(:field_enterprise) @user.lastname = l(:field_enterprise)
end end
@ -141,10 +145,18 @@ class AccountController < ApplicationController
end end
if(@cache_identityy == "") if(@cache_identityy == "")
if params[:identity] == "2"
@user.firstname = firstname_code
@user.lastname = lastname_code
end
flash.now[:error]= l(:label_identity)+l(:'activerecord.errors.messages.empty') flash.now[:error]= l(:label_identity)+l(:'activerecord.errors.messages.empty')
return return
end end
if(@cache_city == "") if(@cache_city == "")
if params[:identity] == "2"
@user.firstname = firstname_code
@user.lastname = lastname_code
end
flash.now[:error]= l(:label_location)+l(:'activerecord.errors.messages.empty') flash.now[:error]= l(:label_location)+l(:'activerecord.errors.messages.empty')
return return
end end
@ -174,6 +186,10 @@ class AccountController < ApplicationController
end end
end end
if params[:identity] == "2"
@user.firstname = firstname_code
@user.lastname = lastname_code
end
end end
# Token based account activation # Token based account activation

View File

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

View File

@ -1,4 +1,5 @@
class ContestNotificationController < ApplicationController class ContestNotificationController < ApplicationController
layout 'contest_base'
def show def show
@notification = ContestNotification.find(params[:id]) @notification = ContestNotification.find(params[:id])
end end

View File

@ -54,6 +54,11 @@ class JournalsController < ApplicationController
end end
(render_404; return false) unless @issue && @detail (render_404; return false) unless @issue && @detail
@diff = Redmine::Helpers::Diff.new(@detail.value, @detail.old_value) @diff = Redmine::Helpers::Diff.new(@detail.value, @detail.old_value)
respond_to do |format|
format.html {
render :layout => 'project_base'
}
end
end end
def new def new

View File

@ -555,7 +555,6 @@ class ProjectsController < ApplicationController
# Show @project # Show @project
def show def show
@project_type = params[:project_type] @project_type = params[:project_type]
# try to redirect to the requested menu item # try to redirect to the requested menu item
@ -842,7 +841,6 @@ class ProjectsController < ApplicationController
@project = nil @project = nil
end end
# added by bai
def show_projects_score def show_projects_score
render :layout => false render :layout => false
end end

View File

@ -635,6 +635,11 @@ module ApplicationHelper
end end
def html_title(*args) def html_title(*args)
#點擊項目版本庫 多觸發一次 字符串為"/"
#暫時解決方法 直接判斷
if(args == ["/"])
args = []
end
first_page = FirstPage.where("page_type = 'project'").first first_page = FirstPage.where("page_type = 'project'").first
if args.empty? if args.empty?
title = @html_title || [] title = @html_title || []

View File

@ -179,7 +179,7 @@ module ProjectsHelper
# never use unless and else # never use unless and else
# unless project.is_public == 1 # unless project.is_public == 1
if project.is_public != 1 if project.is_public != 1
s = "<span class='private_project'>#{l(:lable_private)}</span>".html_safe s = "<span class='private_project'>#{l(:label_private)}</span>".html_safe
else else
s = "".html_safe s = "".html_safe
end end
@ -193,7 +193,7 @@ module ProjectsHelper
# unless project.is_public # unless project.is_public
if !project.is_public if !project.is_public
# end longjun # end longjun
s = "<span class='private_project'>#{l(:lable_private)}</span>".html_safe s = "<span class='private_project'>#{l(:label_private)}</span>".html_safe
else else
s = "".html_safe s = "".html_safe
end end

View File

@ -23,7 +23,8 @@
)if !@memo.locked? && User.current.logged? %> )if !@memo.locked? && User.current.logged? %>
<%= link_to( <%= link_to(
image_tag('edit.png'), #image_tag('edit.png'),
l(:button_edit),
{:action => 'edit', :id => @memo}, {:action => 'edit', :id => @memo},
:method => 'get', :method => 'get',
:title => l(:button_edit) :title => l(:button_edit)

View File

@ -1,6 +1,4 @@
<!-- added by bai --> <div><%= l(:label_issue_number) %> * 4 = <%= issue_num(project) %> * 4 = <%= format("%.2f" , issue_num(project) * 4).to_i %></div>
<div><%= l(:label_issue_number) %> * 4 = <%= issue_num(@project) %> * 4 = <%= format("%.2f" , issue_num(@project) * 4).to_i %></div> <div><%= l(:label_issue_journal_number) %> * 1 = <%= issue_journal_num(project) %> * 1 = <%= format("%.2f" , issue_journal_num(project)).to_i %></div>
<div><%= l(:label_issue_journal_number) %> * 1 = <%= issue_journal_num(@project) %> * 1 = <%= format("%.2f" , issue_journal_num(@project)).to_i %></div> <div><%= l(:label_issue_score) %> = <%= format("%.2f" , issue_num(project) * 4).to_i %> + <%= format("%.2f" , issue_journal_num(project)).to_i %>
<div><%= l(:label_issue_score) %> = <%= format("%.2f" , issue_num(@project) * 4).to_i %> + <%= format("%.2f" , issue_journal_num(@project)).to_i %> = <%= format("%.2f" , issue_score(project)).to_i %></div>
= <%= format("%.2f" , issue_score(@project)).to_i %></div>
<!-- end -->

View File

@ -1,5 +1,2 @@
<!-- added by bai -->
<div><%= l(:label_new_number) %> * 1 = <%= news_num(@project) %> * 1 = <%= format("%.2f" , news_score(@project)).to_i %></div> <div><%= l(:label_new_number) %> * 1 = <%= news_num(@project) %> * 1 = <%= format("%.2f" , news_score(@project)).to_i %></div>
<div><%= l(:label_news_score) %> = <%= format("%.2f" , news_score(@project)).to_i %></div> <div><%= l(:label_news_score) %> = <%= format("%.2f" , news_score(@project)).to_i %></div>
<!-- end -->

View File

@ -3,8 +3,8 @@
<%= l(:label_projects_score) %> <%= l(:label_projects_score) %>
<div> = <%= l(:label_issue_score) %> + <%= l(:label_news_score) %> + <%= l(:label_file_score) %> + <div> = <%= l(:label_issue_score) %> + <%= l(:label_news_score) %> + <%= l(:label_file_score) %> +
<%= l(:label_code_submit_score) %> + <%= l(:label_topic_score) %></div> <%= l(:label_code_submit_score) %> + <%= l(:label_topic_score) %></div>
<div> = <%= format("%.2f" , issue_score(@project)).to_i %> + <%= format("%.2f" , news_score(@project)).to_i %> + <div> = <%= format("%.2f" , issue_score(project)).to_i %> + <%= format("%.2f" , news_score(project)).to_i %> +
<%= format("%.2f" , documents_score(@project)).to_i %> + <%= format("%.2f" , changesets_score(@project)).to_i %> + <%= format("%.2f" , documents_score(project)).to_i %> + <%= format("%.2f" , changesets_score(project)).to_i %> +
<%= format("%.2f" , board_message_score(@project)).to_i %></div> <%= format("%.2f" , board_message_score(project)).to_i %></div>
<div> = <%= format("%.2f" , project_scores(@project)).to_i %></div> <div> = <%= format("%.2f" , project_scores(project)).to_i %></div>
<!-- end --> <!-- end -->

View File

@ -21,35 +21,65 @@
</table> </table>
</div> </div>
<script type="text/javascript">
function show_div(url)
{
if(url == 'project_score_index')
{
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/project_score_index', :locals => {:project => @project}) %>');
}
else if(url == 'issue_score_index')
{
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/issue_score_index', :locals => {:project => @project}) %>');
}
else if(url == 'news_score_index')
{
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/news_score_index', :locals => {:project => @project}) %>');
}
else if(url == 'file_score_index')
{
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/file_score_index', :locals => {:project => @project}) %>');
}
else if(url == 'code_submit_score_index')
{
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/code_submit_score_index', :locals => {:project => @project}) %>');
}
else if(url == 'projects_topic_score_index')
{
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/projects_topic_score_index', :locals => {:project => @project}) %>');
}
}
</script>
<div class="tabs_new"> <div class="tabs_new">
<ul> <ul>
<li> <li>
<%= link_to l(:label_projects_score), {:controller => 'projects', :action => 'show_projects_score', :remote => true}%> : <%= link_to l(:label_projects_score),"javascript:void(0)", :onclick => "show_div('project_score_index')"%> :
<%= format("%.2f" , project_scores(@project) ).to_i %> <%= format("%.2f" , project_scores(@project) ).to_i %>
</li> </li>
<li> <li>
<%= link_to l(:label_issue_score), {:controller => 'projects', :action => 'issue_score_index', :remote => true}%> : <%= link_to l(:label_issue_score), "javascript:void(0)", :onclick => "show_div('issue_score_index')"%> :
<%= format("%.2f" , issue_score(@project)).to_i %> <%= format("%.2f" , issue_score(@project)).to_i %>
</li> </li>
<li> <li>
<%= link_to l(:label_news_score), {:controller => 'projects', :action => 'news_score_index', :remote => true}%> : <%= link_to l(:label_news_score), "javascript:void(0)", :onclick => "show_div('news_score_index')"%> :
<%= format("%.2f" , news_score(@project)).to_i %> <%= format("%.2f" , news_score(@project)).to_i %>
</li> </li>
<li> <li>
<%= link_to l(:label_file_score), {:controller => 'projects', :action => 'file_score_index', :remote => true}%> : <%= link_to l(:label_file_score), "javascript:void(0)", :onclick => "show_div('file_score_index')"%> :
<%= format("%.2f" , documents_score(@project)).to_i %> <%= format("%.2f" , documents_score(@project)).to_i %>
</li> </li>
<li> <li>
<%= link_to l(:label_code_submit_score), {:controller => 'projects', :action => 'code_submit_score_index', :remote => true}%> : <%= link_to l(:label_code_submit_score), "javascript:void(0)", :onclick => "show_div('code_submit_score_index')" %> :
<%= format("%.2f" , changesets_score(@project)).to_i %> <%= format("%.2f" , changesets_score(@project)).to_i %>
</li> </li>
<li> <li>
<%= link_to l(:label_topic_score), {:controller => 'projects', :action => 'projects_topic_score_index', :remote => true}%> : <%= link_to l(:label_topic_score), "javascript:void(0)", :onclick => "show_div('projects_topic_score_index')"%> :
<%= format("%.2f" , board_message_score(@project)).to_i %> <%= format("%.2f" , board_message_score(@project)).to_i %>
</li> </li>
</ul> </ul>
</div> </div>
<div id="show_score_detail"> <div id="show_score_detail">
<%= render :partial => 'projects/project_score_index', :locals => {:index => 0 } %> <%= render :partial => 'projects/project_score_index', :locals => {:project => @project } %>
</div> </div>
<!-- end --> <!-- end -->

View File

@ -1,5 +1,3 @@
<!-- added by bai -->
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'projects/show_projects_score') %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'projects/show_projects_score') %>');
showModal('ajax-modal', '400px'); showModal('ajax-modal', '400px');
$('#ajax-modal').addClass('new-watcher'); $('#ajax-modal').addClass('new-watcher');
<!-- end -->