From cdf1ce1c176a356acfb4d82810bdb7ad29bab026 Mon Sep 17 00:00:00 2001
From: whimlex
Date: Tue, 14 Apr 2015 19:56:03 +0800
Subject: [PATCH] =?UTF-8?q?=E7=BC=BA=E9=99=B7=E9=A1=B5=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/application_helper.rb | 11 ++++
app/helpers/watchers_helper.rb | 35 ++++++++--
app/views/attachments/_form.html.erb | 2 +-
app/views/issues/_attributes.html.erb | 93 ++++++++++++++-------------
app/views/issues/_form.html.erb | 26 +++++++-
app/views/issues/new.html.erb | 65 +++++++++----------
public/stylesheets/jstoolbar.css | 4 +-
public/stylesheets/project.css | 16 ++---
8 files changed, 153 insertions(+), 99 deletions(-)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 5207be823..b9d40303b 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -554,6 +554,17 @@ module ApplicationHelper
s.html_safe
end
+ #缺陷追踪者列表复选框生成
+ def issue_watcher_check_box_tags_ex name, principals
+ s = ''
+ principals.each do |principal|
+ s << "#{ check_box_tag name, principal.id, false, :id => nil } #{h link_to principal.userInfo, user_path( principal.id)}\n"
+ end
+ s.html_safe
+ end
+
+
+
#扩展的checkbox生成
def principals_check_box_tags_ex(name, principals)
s = ''
diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb
index af08fe1d3..6edb171c8 100644
--- a/app/helpers/watchers_helper.rb
+++ b/app/helpers/watchers_helper.rb
@@ -261,17 +261,28 @@ module WatchersHelper
content.present? ? content_tag('ul', content, :class => 'watchers') : content
end
+
+
+
+
+
+
+
def watchers_checkboxes(object, users, checked=nil)
if users.nil?
else
+ # scope = users.sort
+ # watchers = paginateHelper scope,10
+ # s = content_tag('ul', issue_watcher_check_box_tags_ex('issue[watcher_user_ids][]', watchers), :class => 'mb10 ml80')
+ # links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true){|text, parameters, options|
+ # link_to text, watchers_autocomplete_for_user_path(@users, parameters.merge(:q => params[:q],:format => 'js',:flag => 'ture')), :remote => true
+ # }
+ # s + content_tag('ul', links,:class => 'wlist', :style =>"float:left;margin-top:0px;")
users.map do |user|
c = checked.nil? ? object.watched_by?(user) : checked
- tag = check_box_tag 'issue[watcher_user_ids][]', user.id, c, :id => nil
- content_tag 'label', "#{tag} #{h(user)}".html_safe,
- :id => "issue_watcher_user_ids_#{user.id}",
- :class => "floating"
end.join.html_safe
+ s = content_tag('ul', issue_watcher_check_box_tags_ex('issue[watcher_user_ids][]', users), :class => 'mb10 ml80')
end
end
@@ -305,7 +316,7 @@ module WatchersHelper
link_to(l(:label_exit_project),exit_cur_project_path(project.id),
:remote => true, :confirm => l(:lable_sure_exit_project),
:class => "pr_join_a_quit" )
- end
+ end
#项目关注、取消关注
#REDO:项目样式确定后方法需要对CSS变量进行改进
@@ -342,4 +353,18 @@ module WatchersHelper
link_to text, url, :remote => true, :method => method , :class => "pr_join_a",:id => id
end
+ def paginateHelper obj, pre_size=20
+ @obj_count = obj.count
+ @obj_pages = Redmine::Pagination::Paginator.new @obj_count, pre_size, params['page']
+ if obj.kind_of? ActiveRecord::Base or obj.kind_of? ActiveRecord::Relation
+ obj.limit(@obj_pages.per_page).offset(@obj_pages.offset)
+ elsif obj.kind_of? Array
+ obj[@obj_pages.offset, @obj_pages.per_page]
+ else
+ logger.error "[ApplicationController] Error : application_controller#paginateHelper ===> unknow category: #{obj.class}"
+ raise RuntimeError, 'unknow type, Please input you type into this helper.'
+ end
+ end
+
+
end
diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb
index b026fead2..ce78274a3 100644
--- a/app/views/attachments/_form.html.erb
+++ b/app/views/attachments/_form.html.erb
@@ -48,7 +48,7 @@
<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %>
- <%= button_tag l(:button_browse), :type=>"button", :onclick=>"_file.click()",:onmouseover => 'this.focus()', :style => ie8? ? 'display:none' : '' %>
+ <%= button_tag "文件浏览",:class => 'sub_btn', :type=>"button", :onclick=>"_file.click()",:onmouseover => 'this.focus()', :style => ie8? ? 'display:none' : '' %>
<%= file_field_tag 'attachments[dummy][file]',
:id => '_file',
:class => 'file_selector',
diff --git a/app/views/issues/_attributes.html.erb b/app/views/issues/_attributes.html.erb
index 413299b2d..177e5abf0 100644
--- a/app/views/issues/_attributes.html.erb
+++ b/app/views/issues/_attributes.html.erb
@@ -4,83 +4,96 @@
- - <% if @issue.safe_attribute? 'start_date' %>
-
<%= f.text_field :start_date, :size => 10, :disabled => !@issue.leaf?,
- :class => "w150",
+
-
+
+ <% if @issue.safe_attribute? 'start_date' %>
+ <%= f.text_field :start_date,
+ :size => 22,
+ :disabled => !@issue.leaf?,
+ :no_label=> true,
:required => @issue.required_attribute?('start_date') %>
- <%= calendar_for('issue_start_date','start_date') if @issue.leaf? %>
+ <%= calendar_for('issue_start_date','start_date') if @issue.leaf? %>
<% end %>
- <% if @issue.safe_attribute? 'due_date' %>
- <%= f.text_field :due_date, :size => 10,
- :class => "w150",
+
+
+ <% if @issue.safe_attribute? 'due_date' %>
+ <%= f.text_field :due_date, :size => 22,
:disabled => !@issue.leaf?,
+ :no_label=> true,
:required => @issue.required_attribute?('due_date') %>
- <%= calendar_for('issue_due_date','start_date') if @issue.leaf? %>
+ <%= calendar_for('issue_due_date','start_date') if @issue.leaf? %>
<% end %>
- <% if @issue.safe_attribute? 'estimated_hours' %>
- <%= f.text_field :estimated_hours, :size => 3,
+
+
+ <% if @issue.safe_attribute? 'estimated_hours' %>
+ <%= f.text_field :estimated_hours, :size => 22,
:disabled => !@issue.leaf?,
- :class => "w150",
- :required => @issue.required_attribute?('estimated_hours') %> <%= l(:field_hours) %>
+ :no_label=> true,
+ :required => @issue.required_attribute?('estimated_hours') %>
+ <%= l(:field_hours) %>
<% end %>
-
+ <% if @issue.safe_attribute?('done_ratio') && @issue.leaf? && Issue.use_field_for_done_ratio? %>
+ <%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }),
+ {:required => @issue.required_attribute?('done_ratio'), :no_label=> true ,:onchange => "PrecentChange(this.value)"},
+ :class => "w150" %>
+ <% end %>
@@ -144,13 +157,7 @@
}
}
- <% if @issue.safe_attribute?('done_ratio') && @issue.leaf? && Issue.use_field_for_done_ratio? %>
- <%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }), {:required => @issue.required_attribute?('done_ratio')},
- {:onchange => "PrecentChange(this.value)"} %>
- <% end %>
-
-
<% if @issue.safe_attribute? 'custom_field_values' %>
<%= render :partial => 'issues/form_custom_fields' %>
diff --git a/app/views/issues/_form.html.erb b/app/views/issues/_form.html.erb
index 5145d110a..dfee1b1b4 100644
--- a/app/views/issues/_form.html.erb
+++ b/app/views/issues/_form.html.erb
@@ -1,9 +1,8 @@
-
@@ -76,7 +75,28 @@
<% end %>
-
+
+ <% if @copy_from && @copy_from.attachments.any? %>
+
+
+
+
+ <% end %>
+ <% if @copy_from && !@copy_from.leaf? %>
+
+
+ <%= check_box_tag 'copy_subtasks', '1', @copy_subtasks %>
+
+ <% end %>
+
+
+
+
+ <%= render :partial => 'attachments/form', :locals => {:container => @issue} %>
+
+
+
<%= render :partial => 'issues/attributes' %>
diff --git a/app/views/issues/new.html.erb b/app/views/issues/new.html.erb
index a12d6d335..3ae8cd368 100644
--- a/app/views/issues/new.html.erb
+++ b/app/views/issues/new.html.erb
@@ -1,4 +1,4 @@
-
+
问题跟踪
<%= call_hook(:view_issues_new_top, {:issue => @issue}) %>
@@ -9,46 +9,39 @@
<%= hidden_field_tag 'copy_from', params[:copy_from] if params[:copy_from] %>
<%= render :partial => 'issues/form', :locals => {:f => f} %>
-
- <% if @copy_from && @copy_from.attachments.any? %>
-
-
-
-
- <% end %>
- <% if @copy_from && !@copy_from.leaf? %>
-
-
- <%= check_box_tag 'copy_subtasks', '1', @copy_subtasks %>
-
- <% end %>
-
-
-
<%= render :partial => 'attachments/form', :locals => {:container => @issue} %>
-
+
+
<% if @issue.safe_attribute? 'watcher_user_ids' -%>
-
-
-
- <%= watchers_checkboxes(@issue, @available_watchers) %>
-
-
- <%= link_to l(:label_search_for_watchers),
+
+
+
+
+ <%= link_to "",
{:controller => 'watchers', :action => 'new', :project_id => @issue.project},
:remote => true,
- :method => 'get' %>
-
-
- <% end %>
-
-
+ :method => 'get',
+ :class=>"pic_sch mt5 ml5" %>
+
+
+ <%= javascript_tag "observeSearchfield('user_search', 'users_for_watcher', '#{ escape_javascript watchers_autocomplete_for_user_path(:user=> @available_watchers, :format => 'js',:flag => 'ture') }')" %>
+
+
+ <%= watchers_checkboxes(@issue, @available_watchers) %>
+
+
+
+
+
+
+
+
+
+ <% end %>
+
<%= l(:button_create)%>
- <%= preview_link preview_new_issue_path(:project_id => @project), 'issue-form','preview',{:class => "ButtonColor m3p10"}%>
-
+ <%= preview_link preview_new_issue_path(:project_id => @project), 'issue-form','preview',{:class => "blue_btn fl ml10"}%>
+
<%= javascript_tag "$('#issue_subject').focus();" %>
<% end %>
diff --git a/public/stylesheets/jstoolbar.css b/public/stylesheets/jstoolbar.css
index a4af73278..6fb07f974 100644
--- a/public/stylesheets/jstoolbar.css
+++ b/public/stylesheets/jstoolbar.css
@@ -1,8 +1,10 @@
.jstEditor {
+
padding-left: 0px;
}
.jstEditor textarea, .jstEditor iframe {
- margin: 0 !important;
+ margin: 0 ;
+ margin-left: 80px;
}
.jstHandle {
diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css
index 556717e9e..4633c95f7 100644
--- a/public/stylesheets/project.css
+++ b/public/stylesheets/project.css
@@ -166,16 +166,7 @@ a:hover.upload_btn_grey{background:#8a8a8a;}
a.link_file{ background:url(../images/pic_file.png) 0 2px no-repeat; padding-left:20px; color:#64bdd9; }
a:hover.link_file{ background:url(../images/pic_file.png) 0 -25px no-repeat; color:#3ca5c6;}
.r_txt_tit{width:510px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color:#15bccf; float:left; color:#09658c; font-size:14px;}
-/* 新建问题 */
-.newpro_box{ color:#6d6d6d;}
-.newpro_box02{ color:#6d6d6d; margin-left:30px; margin-bottom:10px; }
-.newpro_box ul li{ }
-.newpro_box input{ height:26px; float:left; margin-bottom:10px;}
-.newpro_box textarea{ height:150px; float:left; margin-bottom:10px;}
-.newpro_box select{ height:26px; float:left; margin-bottom:10px;}
-.label{ width:80px; text-align:right; font-size:14px; display:block; float:left;}
-.label02{ width:110px; text-align:right; font-size:14px; display:block; float:left;}
-.collapsible{ border-left:none;border-right:none;border-bottom:none; border-top:1px solid #e4e4e4; padding-left:30px; padding-top:10px; }
+
/* 弹框 新样式还没设计出来,暂时用的课程那边的样式 */
.alert .close{width:26px;height:26px;overflow:hidden;position:absolute;top:-10px;right:-502px;background:url(images/close.png) no-repeat;cursor:pointer;}
@@ -338,6 +329,11 @@ a:hover.st_add{ color:#ff8e15;}
padding-bottom: 3px;
}
+/* 新建问题 */
+.label{ width:80px; text-align:right; font-size:14px; display:block; float:left;}
+.label02{ width:110px; text-align:right; font-size:14px; display:block; float:left;}
+.collapsible{ border-left:none;border-right:none;border-bottom:none; border-top:1px solid #e4e4e4; padding-top:10px; }
+
/*add by sw*/
blockquote {
border-left: 1px solid #e0e0e0;