Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop

This commit is contained in:
cxt 2016-01-22 17:29:29 +08:00
commit a96d8ce5a4
25 changed files with 99 additions and 31 deletions

View File

@ -312,7 +312,8 @@ class ApplicationController < ActionController::Base
elsif @course
allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @course || @courses, :global => global)
else
allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project || @projects, :global => global)
# allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project || @projects, :global => global)
allowed = true
end
allowed
end

View File

@ -52,10 +52,14 @@ class BlogCommentsController < ApplicationController
render_attachment_warning_if_needed(@article)
else
end
if params[:is_homepage]
redirect_to user_blogs_path(params[:user_id])
if params[:in_act]
redirect_to user_path(params[:user_id])
else
redirect_to user_blog_blog_comment_path(:user_id=>params[:user_id],:blog_id=>params[:blog_id],:id=>params[:id])
if params[:is_homepage]
redirect_to user_blogs_path(params[:user_id])
else
redirect_to user_blog_blog_comment_path(:user_id=>params[:user_id],:blog_id=>params[:blog_id],:id=>params[:id])
end
end
end
def destroy

View File

@ -2,7 +2,6 @@ class BlogsController < ApplicationController
before_filter :find_blog,:except => [:index,:create,:new,:set_homepage, :cancel_homepage]
before_filter :find_user
def index
@articls = @user.blog.articles
@article = BlogComment.new
respond_to do |format|
format.html {render :layout=>'new_base_user'}

View File

@ -55,6 +55,7 @@ class OrganizationsController < ApplicationController
@organization.name = params[:organization][:name]
@organization.description = params[:organization][:description]
@organization.is_public = params[:organization][:is_public]
@organization.allow_guest_download = params[:organization][:allow_guest_download] == 'on' ? 1 : 0
@organization.creator_id = User.current.id
member = OrgMember.new(:user_id => User.current.id)

View File

@ -1791,13 +1791,24 @@ class UsersController < ApplicationController
def share_news_to_project
news = News.find(params[:send_id])
project_ids = params[:project_ids]
# project_ids.each do |project_id|
# if Project.find(project_id).news.map(&:id).exclude?(news.id)
# project_news = News.create(:project_id => project_id.to_i, :title => news.title, :summary => news.summary, :description => news.description,:author_id => User.current.id, :created_on => Time.now)
# news.attachments.each do |attach|
# project_news.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest,
# :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype,
# :is_public => attach.is_public, :quotes => 0)
# end
# end
# end
project_ids.each do |project_id|
if Project.find(project_id).news.map(&:id).exclude?(news.id)
project_news = News.create(:project_id => project_id.to_i, :title => news.title, :summary => news.summary, :description => news.description,:author_id => User.current.id, :created_on => Time.now)
project = Project.find(project_id)
if project.news.map(&:id).exclude?(news.id)
message = Message.create(:board_id => project.boards.first.id, :subject => news.title, :content => news.description, :author_id => User.current.id)
news.attachments.each do |attach|
project_news.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest,
:downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype,
:is_public => attach.is_public, :quotes => 0)
message.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest,
:downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype,
:is_public => attach.is_public, :quotes => 0)
end
end
end

View File

@ -381,7 +381,7 @@ class Mailer < ActionMailer::Base
# issue截止时间提醒
def issue_due_date(issue, recipients)
@author = issue.author.login
@author = issue.author
@issue_name = issue.subject
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id)
@subject = "#{l(:mail_issue)}#{issue.subject} #{l(:mail_issue_due_date)} "

View File

@ -825,6 +825,9 @@ class User < Principal
end
def admin_of_org?(org)
if self.admin?
return true
end
if OrgMember.where("user_id =? and organization_id =?", self.id, org.id).count == 0
return false
end

View File

@ -1,5 +1,5 @@
<% if User.current.logged? && User.current.id == @user.id %>
<%= form_for @article, :url =>{:controller=>'blog_comments',:action => 'update',:user_id=>@user.id , :blog_id => @article.id, :is_homepage => params[:is_homepage]},:method=>'PUT',
<%= form_for @article, :url =>{:controller=>'blog_comments',:action => 'update',:user_id=>@user.id , :blog_id => @article.id, :is_homepage => params[:is_homepage],:in_act => params[:in_act]},:method=>'PUT',
:html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %>
<%= render :partial => 'blog_comments/edit', :locals => {:f => f, :article => @article, :edit_mode => true, :user => @user} %>
<% end %>

View File

@ -45,7 +45,7 @@
<li>
<%= link_to(
l(:button_edit),
{:action => 'edit', :id => @article.id},
{:action => 'edit', :id => @article.id,:in_act => params[:in_act]},
:class => 'postOptionLink'
) if User.current && User.current.id == @article.author.id %>
</li>

View File

@ -30,7 +30,7 @@
<%= import_ke(enable_at: false, prettify: false) %>
<%= render :partial => 'blogs/article_list', :locals => {:blog=>@user.blog,:topics => @user.blog.articles.reorder("#{BlogComment.table_name}.sticky desc,#{BlogComment.table_name}.created_on desc"), :page => 0, :user => @user} %>
<%= render :partial => 'blogs/article_list', :locals => {:blog=>@user.blog,:topics => @user.blog.articles.reorder("#{BlogComment.table_name}.sticky desc,#{BlogComment.table_name}.updated_on desc"), :page => 0, :user => @user} %>
<script type="text/javascript">//侧导航

View File

@ -2,7 +2,7 @@
<ul style="list-style-type:none; margin:0; padding:0;">
<li style="list-style-type:none; margin:0; padding:0;"><span style="float: left;"><strong><%= l(:mail_issue_content)%></strong></span>
<span style="float: left; width: 526px">
<p><%=link_to @author, user_url(@author) %> 发布的问题跟踪:<%=link_to @issue_name, @issue_url %> <span style="color: red">截止时间快到了,请您关注!</span></p>
<p><%=link_to @author.login, user_url(@author) %> 发布的问题跟踪:<%=link_to @issue_name, @issue_url %> <span style="color: red">截止时间快到了,请您关注!</span></p>
</span>
</li>
</ul>

View File

@ -23,7 +23,7 @@
<div class="homepageRight mt0 ml10">
<div class="homepageRightBanner">
<div class="NewsBannerName">
项目通知
新闻
</div>
</div>
<% if @project && User.current.allowed_to?(:manage_news, @project) %>

View File

@ -6,7 +6,7 @@
<div id="new_course_news">
<div class="homepagePostBrief c_grey">
<div>
<input type="text" name="news[title]" id="news_title" class="InputBox w713" maxlength="60" onfocus="$('#news_editor').show()" onkeyup="regexTitle();" placeholder="发布通知,请先输入通知标题" value="<%= news.title%>" >
<input type="text" name="news[title]" id="news_title" class="InputBox w713" maxlength="60" onfocus="$('#news_editor').show()" onkeyup="regexTitle();" placeholder="发布新闻,请先输入新闻标题" value="<%= news.title%>" >
<p id="title_notice_span"></p>
</div>
<div id="news_editor" style="display: none;">

View File

@ -72,7 +72,7 @@
</div>
<%end%>
<div class="postDetailTitle fl">
<a href="javascript:void(0);" class="f14 linkGrey4 fb" style="overflow:hidden;">通知: <%= @news.title%></a>
<a href="javascript:void(0);" class="f14 linkGrey4 fb" style="overflow:hidden;">新闻: <%= @news.title%></a>
</div>
<div class="cl"></div>

View File

@ -11,7 +11,7 @@
<div class="homepageRight mt0 ml10">
<div class="homepageRightBanner">
<div class="NewsBannerName">
编辑通知
编辑<%= @news.project_id != -1 ? '新闻':'通知' %>
</div>
</div>
<%= labelled_form_for :news, @news, :url => news_path(@news),

View File

@ -12,7 +12,7 @@
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
<% end %>
TO
<%= link_to activity.board.org_subfield.name.to_s+" | 帖子栏目讨论区",org_subfield_boards_path(activity.board.org_subfield), :class => "newsBlue ml15 mr5"%>
<%= link_to activity.board.org_subfield.name.to_s+" | 帖子栏目讨论区",organization_path(activity.board.org_subfield.organization, :org_subfield_id => activity.board.org_subfield.id), :class => "newsBlue ml15 mr5"%>
<!--<a href="javascript:void(0);" class="newsBlue ml15 mr5"><%= activity.board.org_subfield.name %>(项目讨论区)</a>-->
</div>
<div class="homepagePostTitle break_word">

View File

@ -35,7 +35,21 @@
<li class="homepagePostSettingIcon">
<% if User.current.logged? %>
<ul class="homepagePostSettiongText">
<li><%= link_to("发&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}','#{User.current.id}','news')") %></li>
<li><%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %></li>
<li>
<%= link_to(
l(:button_edit),
{:controller => 'news', :action => 'edit', :id => activity},
:class => 'postOptionLink'
) if activity.author == User.current %>
</li>
<li>
<%= delete_link(
news_path(activity),
:data => {:confirm => l(:text_are_you_sure)},
:class => 'postOptionLink'
) if activity.author == User.current %>
</li>
</ul>
<% end %>
</li>

View File

@ -65,8 +65,9 @@
<div class="orgRow mb10 mt5"><span style="margin-left:38px;" >公开&nbsp;: </span>
<input type="checkbox" name="organization[is_public]" <%= @organization.is_public ? 'checked': ''%> class="ml3" />
</div>
<div class="orgRow mb10 mt5"><span>允许游客下载: </span>
<input type="checkbox" name="organization[allow_guest_download]" <%= @organization.allow_guest_download ? 'checked': ''%> class="ml3" />
<div class="orgRow mb10 mt5"><span style="margin-left:10px;">下载支持&nbsp;: </span>
<input type="checkbox" style="margin-top:5px;" name="organization[allow_guest_download]" <%= @organization.allow_guest_download ? 'checked': ''%> class="ml3" />
&nbsp;<span>允许游客下载</span>
</div>
<a href="javascript:void(0);" class="saveBtn ml80 db fl" onclick="update_org(<%=@organization.id %>);">保存</a>
<% end %>

View File

@ -108,7 +108,7 @@
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="comment[comments]"></textarea>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="comment"></textarea>
<div nhname='toolbar_container_<%= user_activity_id%>' style="float:left;padding-top:3px; margin-left: 5px;"></div>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>

View File

@ -40,7 +40,21 @@
<li class="homepagePostSettingIcon">
<% if User.current.logged? %>
<ul class="homepagePostSettiongText">
<li><%= link_to("发&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %></li>
<li><%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %></li>
<li>
<%= link_to(
l(:button_edit),
{controller:'news', :action => 'edit', :id => activity.id},
:class => 'postOptionLink'
) if User.current.allowed_to?(:manage_news, activity.course) %>
</li>
<li>
<%= delete_link(
news_path(activity),
:data => {:confirm => l(:text_are_you_sure)},
:class => 'postOptionLink'
) if User.current.allowed_to?(:manage_news, activity.course) %>
</li>
</ul>
<% end %>
</li>

View File

@ -10,8 +10,8 @@
<%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %>
<% else %>
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
<% end %> TO <!--+"(课程名称)"-->
<%= link_to activity.project.name.to_s+" | 项目通知", project_news_index_path(activity.project), :class => "newsBlue ml15" %>
<% end %> TO <!--+"(名称)"-->
<%= link_to activity.project.name.to_s+" | 新闻", project_news_index_path(activity.project), :class => "newsBlue ml15" %>
</div>
<div class="homepagePostTitle break_word hidden fl m_w600"> <!--+"(通知标题)"-->
<%= link_to activity.title.to_s, news_path(activity), :class => "postGrey" %>
@ -37,7 +37,21 @@
<li class="homepagePostSettingIcon">
<% if User.current.logged? %>
<ul class="homepagePostSettiongText">
<li><%= link_to("发&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}','#{User.current.id}','news')") %></li>
<li><%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %></li>
<li>
<%= link_to(
l(:button_edit),
{:action => 'edit', :id => activity},
:class => 'postOptionLink'
) if activity.author == User.current %>
</li>
<li>
<%= delete_link(
news_path(activity),
:data => {:confirm => l(:text_are_you_sure)},
:class => 'postOptionLink'
) if activity.author == User.current %>
</li>
</ul>
<% end %>
</li>

View File

@ -15,7 +15,7 @@
</div>
<div class="homepagePostTitle break_word"> <!--+"(通知标题)"-->
<div class="fl">
<%= link_to activity.title.to_s, user_blog_blog_comment_path(:user_id=>activity.author_id,:blog_id=>activity.blog_id,:id=>activity.id), :class => "postGrey" %>
<%= link_to activity.title.to_s, user_blog_blog_comment_path(:user_id=>activity.author_id,:blog_id=>activity.blog_id,:id=>activity.id,:in_act => true), :class => "postGrey" %>
</div>
<% if activity.sticky == 1%>
<span class="sticky_btn_cir ml10">置顶</span>

View File

@ -82,6 +82,10 @@ RedmineApp::Application.routes.draw do
get '/', to: 'organizations#show', defaults: { id: 23 }, constraints: {subdomain: 'nubot'}
get '/', to: 'organizations#show', defaults: { id: 1 }, constraints: {subdomain: 'team'}
get '/', to: 'users#show', defaults: {id: 7}, constraints: {subdomain: 'whm'}
get '/', to: 'users#show', defaults: {id: 5}, constraints: {subdomain: 'yg'}
get '/', to: 'users#show', defaults: {id:11}, constraints: {subdomain: 'wt'}
resources :org_member do
member do

View File

@ -8,7 +8,9 @@ namespace :issue_due_date do
if ForgeMessage.where("forge_message_type =? and forge_message_id =? and status =?", "Issue", issue.id, 1).first.nil?
recipients = []
assigner = User.find(issue.assigned_to_id)
recipients << issue.author
unless assigner.id == issue.author.id
recipients << issue.author
end
recipients << assigner
recipients.each do |r|
issue.forge_messages << ForgeMessage.new(:user_id => r.id, :project_id => issue.project_id, :viewed => false, :status => 1)

View File

@ -693,7 +693,7 @@ a.postReplyCancel:hover {color:#ffffff;}
.homepagePostSettingIcon {background:url(../images/homepage_icon.png) -93px -5px no-repeat; width:20px; height:20px;}
.homepagePostSettiongText {width:85px; line-height:2; font-size:12px; color:#616060; background-color:#ffffff; border:1px solid #eaeaea; border-radius:3px; position:absolute; left:-68px; top:20px; padding:5px 0px; display:none;}
.homepagePostSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;}
a.postOptionLink {color:#616060; display:block; width:55px; padding:0px 15px;}
a.postOptionLink {color:#616060; display:block; width:55px; padding:0px 15px;text-align:center;}
a.postOptionLink:hover {color:#ffffff; background-color:#269ac9;}
.homepagePostReplyPortrait {float:left; width:33px;}
.imageFuzzy {filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity:0.5;opacity: 0.5;}