From ade07203312286e6f207bb6b76ad2060fbb6a1f9 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Sat, 17 Jan 2015 14:19:54 +0800 Subject: [PATCH] =?UTF-8?q?=E9=82=AE=E4=BB=B6=E7=B3=BB=E7=BB=9F=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E9=87=8D=E7=BD=AE=20Signed-off-by:=20alan=20<54753343?= =?UTF-8?q?4@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 4 +++- app/models/mailer.rb | 24 ++++++++++++++++-------- app/views/layouts/mailer.html.erb | 2 +- app/views/mailer/_issue.html.erb | 25 ++++++++++++++----------- app/views/mailer/_issue.text.erb | 7 ++++--- app/views/mailer/issue_add.text.erb | 11 +---------- app/views/mailer/issue_edit.html.erb | 6 ++++-- app/views/mailer/issue_edit.text.erb | 6 ++++-- 8 files changed, 47 insertions(+), 38 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index ee8711e7e..58af43da3 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -15,8 +15,10 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class UsersController < ApplicationController + layout :setting_layout #Added by young + before_filter :auth_login1, :only => [:show, :user_activities] menu_item :activity menu_item :user_information, :only => :info menu_item :user_course, :only => :user_courses @@ -30,7 +32,7 @@ class UsersController < ApplicationController #Ended by young # edit - before_filter :auth_login1, :only => [:show] + # before_filter :can_show_course, :only => [:user_courses,:user_homeworks] before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :tag_saveEx,:user_projects, :user_newfeedback, :user_comments, :watch_bids, :watch_contests, :info, diff --git a/app/models/mailer.rb b/app/models/mailer.rb index bee0640da..72e60a0bf 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -105,18 +105,18 @@ class Mailer < ActionMailer::Base @author = issue.author @issue = issue + user = User.find_by_mail(recipients) - - token = Token.new(:user => User.find_by_mail(recipients), :action => 'autologin') + token = Token.new(:user =>user , :action => 'autologin') token.save @token = token @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id, :token => @token.value) # edit - @issue_author_url = url_for(:controller => 'users', :action => 'show', :id => issue.author_id, :token => @token.value) + @issue_author_url = url_for(user_activities_url(@author,:token => @token.value)) @project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id, :token => @token.value) - @user_url = url_for(:controller => 'my', :action => 'account', :user => User.find_by_mail(recipients) , :token => @token.value) - # + + @user_url = url_for(my_account_url(user,:token => @token.value)) cc = issue.watcher_recipients - issue.recipients subject = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}" @@ -149,10 +149,18 @@ class Mailer < ActionMailer::Base references issue @author = journal.user + user = User.find_by_mail(recipients) + + token = Token.new(:user =>user , :action => 'autologin') + token.save + @token = token + + + # edit + @issue_author_url = url_for(:controller => 'users', :action => 'show', :id => issue.author_id, :token => @token.value) + @project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id, :token => @token.value) + @user_url = url_for(my_account_url(user,:token => @token.value)) - token = Token.new(:user => User.find_by_mail(recipients), :action => 'autologin') - token.save - @token = token @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id, :anchor => "change-#{journal.id}", :token => @token.value) diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb index de7f4a837..aa43b9194 100644 --- a/app/views/layouts/mailer.html.erb +++ b/app/views/layouts/mailer.html.erb @@ -14,7 +14,7 @@ ol,ul,li{ list-style-type:none} .cl{ clear:both; overflow:hidden; } a{ text-decoration:none; } a:hover{ text-decoration:underline; } - +.mail_box,ul,li{ list-style-type:none} .mail{ width:600px; margin:20px; height:auto; color:#4b4b4b; font-size:14px; } .mail a{color:#1b55a7; font-weight: bold; } .mail_content{ margin-top:30px;} diff --git a/app/views/mailer/_issue.html.erb b/app/views/mailer/_issue.html.erb index 326a21aaa..c5e136dfc 100644 --- a/app/views/mailer/_issue.html.erb +++ b/app/views/mailer/_issue.html.erb @@ -6,23 +6,26 @@ <%= link_to(h("#{@issue.project.name}"),@project_url) %>中有了一个与您相关的最新活动,请您关注!
<%= textilizable(issue, :description, :only_path => false) %>
+- <% unless @issue.attachments.nil? %> +
<%= link_to_attachment(attach, :download => true, :token => @token.value, :only_path => false) %>
+ <% end %> <% end %> - +