diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index de9477b8a..790718e5d 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -162,7 +162,8 @@ class IssuesController < ApplicationController respond_to do |format| format.html { render_attachment_warning_if_needed(@issue) - flash[:notice] = l(:notice_issue_successful_create, :id => view_context.link_to("#{@issue.subject}", issue_path(@issue), :title => @issue.subject)) + flash[:notice] = l(:label_successful_create) + #flash[:notice] = l(:notice_issue_successful_create, :id => view_context.link_to("#{@issue.subject}", issue_path(@issue), :title => @issue.subject)) #flash[:notice] = l(:notice_issue_successful_create, :id => view_context.link_to("##{@issue.id}", issue_path(@issue), :title => @issue.subject)) if params[:continue] attrs = {:tracker_id => @issue.tracker, :parent_issue_id => @issue.parent_issue_id}.reject {|k,v| v.nil?} diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index 02bc3d8b3..bff7831d1 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -43,7 +43,7 @@ module WatchersHelper ) method = watched ? 'delete' : 'post' - link_to text, url, :remote => true, :method => method, :style => "color: #fff; display:block; padding: 0px 5px; margin-right: 10px; height: 22px; line-height: 21px;padding-top:1px; background: none repeat scroll 0% 0% #64BDD9; TES" + link_to text, url, :remote => true, :method => method, :class => css end ############## added by linchun @@ -278,11 +278,46 @@ module WatchersHelper ) method = applied ? 'delete' : 'post' - link_to text, url, :remote => true, :method => method ,:style => "color: #fff; display:block; padding: 0px 5px; margin-right: 10px; height: 21px; line-height: 22px;padding-top:1px; background: none repeat scroll 0% 0% #64BDD9; TES" + link_to text, url, :remote => true, :method => method , :class => css end def exit_project_link(project) link_to(l(:label_exit_project),exit_cur_project_path(project.id), - :remote => true, :confirm => l(:lable_sure_exit_project), :style => "color: #fff; display:block; padding: 0px 5px; margin-right: 10px; height: 21px; line-height: 22px; background: none repeat scroll 0% 0% #64BDD9; TES;padding-top:1px;" ) + :remote => true, :confirm => l(:lable_sure_exit_project), + :style => "color: #fff; display:block; padding: 0px 5px; margin-right: 10px; height: 21px; line-height: 22px; background: none repeat scroll 0% 0% #64BDD9; TES;padding-top:1px;" ) + end + + #项目关注、取消关注 + #REDO:项目样式确定后方法需要对CSS变量进行改进 + def watcher_link_for_project(objects, user, options=[]) + return '' unless user && user.logged? + objects = Array.wrap(objects) + watched = objects.any? {|object| object.watched_by?(user)} + @watch_flag = objects.first.instance_of?(Project) + text = @watch_flag ? + (watched ? l(:button_unfollow) : l(:button_follow)) : (watched ? l(:button_unwatch) : l(:button_watch)) + url = watch_path(:object_type => objects.first.class.to_s.underscore, + :object_id => (objects.size == 1 ? objects.first.id : objects.map(&:id).sort)) + method = watched ? 'delete' : 'post' + link_to text, url, :remote => true, :method => method, + :class => "project_watch_new" + end + + #申请加入项目 + def join_in_project_link(project, user, options=[]) + return '' unless user && user.logged? + applied = project.applied_projects.find_by_user_id(user.id) + text = applied ? l(:label_unapply_project) : l(:label_apply_project) + @applied_flag = project.instance_of?(Project) + if applied + appliedid = applied.id + end + url = appliedproject_path( + :id=>appliedid, + :user_id => user.id, + :project_id => project.id) + method = applied ? 'delete' : 'post' + link_to text, url, :remote => true, :method => method , :class => "project_watch_new" end + end diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb index c428522fe..b026fead2 100644 --- a/app/views/attachments/_form.html.erb +++ b/app/views/attachments/_form.html.erb @@ -1,6 +1,6 @@ <% if defined?(container) && container && container.saved_attachments %> - <% container.saved_attachments.each_with_index do |attachment, i| %> + <% container.attachments.each_with_index do |attachment, i| %> <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%> <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> diff --git a/app/views/contests/watcherlist.html.erb b/app/views/contests/watcherlist.html.erb index 4987f3616..5628e5e95 100644 --- a/app/views/contests/watcherlist.html.erb +++ b/app/views/contests/watcherlist.html.erb @@ -15,7 +15,7 @@

<% unless user.memberships.empty? %> - <%= l(:label_contribute_to, :project_count => "#{user.memberships.count}") %> + <%= l(:label_contribute_to, :count => "#{user.memberships.count}") %> <% for member in user.memberships %> <%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : ',' %> <% end %> diff --git a/app/views/issues/_action_menu.html.erb b/app/views/issues/_action_menu.html.erb index bcd7b30c5..61cea920c 100644 --- a/app/views/issues/_action_menu.html.erb +++ b/app/views/issues/_action_menu.html.erb @@ -12,7 +12,7 @@ <% end %> - +<%= watcher_link(@issue, User.current) %> <%= link_to l(:button_copy), project_copy_issue_path(@project, @issue), :class => 'icon icon-copy' if User.current.allowed_to?(:add_issues, @project) %> <%= link_to l(:button_delete), issue_path(@issue.id), :data => {:confirm => issues_destroy_confirmation_message(@issue)}, :method => :delete, :class => 'icon icon-del' if User.current.allowed_to?(:delete_issues, @project) %> diff --git a/app/views/layouts/_join_exit_project.html.erb b/app/views/layouts/_join_exit_project.html.erb index 0c4e54317..a5269d422 100644 --- a/app/views/layouts/_join_exit_project.html.erb +++ b/app/views/layouts/_join_exit_project.html.erb @@ -1,11 +1,11 @@

<% if ( !(User.current.member_of? @project) && User.current.login?) %> - <%= watcher_link(@project, User.current) %> + <%= watcher_link_for_project(@project, User.current) %> <% end %> <% if ( !(User.current.member_of? @project) && User.current.login?) %> - <%= applied_link(@project, User.current) %> + <%= join_in_project_link(@project, User.current) %> <% end %> <% if ((User.current.member_of? @project) && diff --git a/config/locales/projects/en.yml b/config/locales/projects/en.yml index ce9f8bf28..8c8ab7bc4 100644 --- a/config/locales/projects/en.yml +++ b/config/locales/projects/en.yml @@ -136,6 +136,7 @@ en: # 项目托管平台 # # 问题跟踪 + label_successful_create: Successfully created # diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml index bf392ec98..5b888de09 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -139,6 +139,7 @@ zh: # 项目托管平台 # # 问题跟踪 + label_successful_create: 创建成功 # diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 9e9bc9859..2b9d1586f 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -629,7 +629,7 @@ function img_thumbnails() { $('.thumbnails a').colorbox({rel:'nofollow'}); $('.attachments').find('a').each(function(index, element) { var href_value = $(element).attr('href'); - if (/\.(jpg|png|gif|bmp)$/.test(href_value)) { + if (/\.(jpg|png|gif|bmp|PNG|BMP|GIF|JPG)$/.test(href_value)) { $(element).colorbox({rel:'nofollow'}); } diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index ca8f0c3b6..1270f6bcf 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -31,7 +31,7 @@ a{ text-decoration:none; } .fl{ float: left;} .fr{ float:right;} .project_h4{ font-size:14px; color:#3b3b3b;} - +.project_watch_new{color: #fff !important; display:block !important; padding: 0px 5px !important; margin-right: 10px !important; height: 22px !important; line-height: 21px !important;padding-top:1px !important; background: none repeat scroll 0% 0% #64BDD9 !important;} .project_content{ width:940px; margin:10px auto;} .project_left{ float:left;} @@ -51,7 +51,6 @@ a{ text-decoration:none; } a.info_foot_num{ font-weight: bold; color:#3ca5c6; } .pr_info_foot{ color:#7f7f7f; margin-top:5px; font-size:12px } a:hover.info_foot_num{ color:#2390b2;} - /*左侧导航*/ .subNavBox{width:222px; background:#fff;margin:10px 10px 0 0;} .subNav{border-bottom:solid 1px #e5e3da;cursor:pointer;font-weight:bold;font-size:14px;color:#3ca5c6;line-height:28px;padding-left:10px;background-color:#fff;} @@ -74,6 +73,7 @@ a:hover.subnav_green{ background:#14ad5a;} .course_description_none{max-height: none;} .lg-foot{ border:1px solid #e8eef2; color: #929598; text-align:center; width:220px; height:23px; cursor:pointer;} .lg-foot:hover{ color:#787b7e;} +. /****标签(和资源库的tag样式一致)***/ .project_Label{ width:220px; padding-left:10px; padding-right:10px; background:#fff; margin-top:10px;} a.yellowBtn{ display:inline-block;color:#0d90c3; height:22px;}