From beac15475dd9fdbd6441083fcab379c75dd7e1f6 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 6 Mar 2015 14:55:21 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E9=A1=B9=E7=9B=AE=E5=8F=8A?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=8F=8D=E9=A6=88=E6=A1=86=E7=9A=84=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=EF=BC=81=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/boards_controller.rb | 1 + app/controllers/documents_controller.rb | 4 + app/controllers/files_controller.rb | 6 +- app/controllers/issues_controller.rb | 2 + app/controllers/projects_controller.rb | 22 +- app/helpers/application_helper.rb | 2 +- app/helpers/watchers_helper.rb | 2 +- app/views/boards/_project_show.html.erb | 8 +- app/views/calendars/show.html.erb | 4 +- app/views/documents/index.html.erb | 27 +- app/views/documents/show.html.erb | 4 +- app/views/files/_newfile_index.html.erb | 250 +++++++++++++++ app/views/files/_project_file.html.erb | 9 +- app/views/files/index.html.erb | 251 +-------------- app/views/files/index.js.erb | 2 + app/views/files/new.html.erb | 4 +- app/views/gantts/show.html.erb | 6 +- app/views/issues/_newissue_index.html.erb | 137 ++++++++ app/views/issues/index.html.erb | 136 +------- app/views/issues/index.js.erb | 1 + app/views/issues/new.html.erb | 3 + app/views/issues/show.html.erb | 5 +- app/views/layouts/_base_feedback.html.erb | 63 ++-- app/views/layouts/_join_exit_project.html.erb | 24 +- app/views/layouts/base_projects.html.erb | 298 +++++++++--------- app/views/projects/_form.html.erb | 2 +- app/views/projects/_newproject_show.html.erb | 107 +++++++ app/views/projects/_tools_expand.html.erb | 64 ++-- app/views/projects/feedback.html.erb | 3 + app/views/projects/member.html.erb | 7 +- app/views/projects/new.html.erb | 4 +- app/views/projects/settings.html.erb | 4 +- app/views/projects/share.html.erb | 4 +- app/views/projects/show.html.erb | 105 +----- app/views/projects/show.js.erb | 1 + app/views/projects/watcherlist.html.erb | 4 +- app/views/repositories/new.html.erb | 4 +- app/views/repositories/show.html.erb | 4 +- app/views/wiki/show.html.erb | 99 +++--- app/views/words/_new.html.erb | 5 +- config/locales/zh.yml | 3 +- .../app/views/code_review/index.html.erb | 6 +- public/images/sidebar_bg.png | Bin 9419 -> 9739 bytes public/stylesheets/application.css | 129 +++++++- .../stylesheets/application.css | 108 +++---- 45 files changed, 1036 insertions(+), 898 deletions(-) create mode 100644 app/views/files/_newfile_index.html.erb create mode 100644 app/views/files/index.js.erb create mode 100644 app/views/issues/_newissue_index.html.erb create mode 100644 app/views/issues/index.js.erb create mode 100644 app/views/projects/_newproject_show.html.erb create mode 100644 app/views/projects/show.js.erb diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 383da0bbe..67355fdfa 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -57,6 +57,7 @@ class BoardsController < ApplicationController def show respond_to do |format| + format.js format.html { sort_init 'updated_on', 'desc' sort_update 'created_on' => "#{Message.table_name}.created_on", diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb index 932ffaa7a..545d61155 100644 --- a/app/controllers/documents_controller.rb +++ b/app/controllers/documents_controller.rb @@ -61,6 +61,10 @@ class DocumentsController < ApplicationController if @project.project_type ==1 render :action => 'show', :layout => 'base_courses' end + respond_to do |format| + format.html + format.api + end end def new diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 56f760e13..8421e9be1 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -148,7 +148,11 @@ class FilesController < ApplicationController show_attachments @containers - render :layout => !request.xhr? + + respond_to do |format| + format.html + format.js + end elsif params[:course_id] @isproject = false diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index c0d83fdcd..4e3c28468 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -90,6 +90,7 @@ class IssuesController < ApplicationController respond_to do |format| + format.js format.html { render :template => 'issues/index', :layout => @project_base_tag }#by young format.api { Issue.load_visible_relations(@issues) if include_in_api_response?('relations') @@ -103,6 +104,7 @@ class IssuesController < ApplicationController format.html { render(:template => 'issues/index', :layout => @project_base_tag) }#by young format.any(:atom, :csv, :pdf) { render(:nothing => true) } format.api { render_validation_errors(@query) } + format.js end end rescue ActiveRecord::RecordNotFound diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 02bfc9e19..c67b5197b 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -278,7 +278,7 @@ class ProjectsController < ApplicationController :with_subprojects => @with_subprojects, :author => @author) @activity.scope_select {|t| !has["show_#{t}"].nil?} - + # 根据私密性,取出符合条件的所有数据 if User.current.member_of?(@project) || User.current.admin? events = @activity.events(@date_from, @date_to) @@ -286,7 +286,6 @@ class ProjectsController < ApplicationController events = @activity.events(@date_from, @date_to, :is_public => 1) end - @offset, @limit = api_offset_and_limit({:limit => 10}) @events_count = events.count @events_pages = Paginator.new @events_count, @limit, params['page'] @@ -295,11 +294,14 @@ class ProjectsController < ApplicationController events = events.slice(@offset,@limit) # 按天分组 @events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)} - + # 获取讨论区总数 + boards = @project.boards.includes(:last_message => :author).all + @topic_count = @project.boards.count # 根据对应的请求,返回对应的数据 respond_to do |format| format.html format.api + format.js end end @@ -311,6 +313,20 @@ class ProjectsController < ApplicationController @wiki ||= @project.wiki end + + #发送邮件邀请新用户 + def invite_members_by_mail + + end + + # 邀请Trustie注册用户 + def invite_members_had_loged + @member ||= @project.members.new + respond_to do |format| + format.js + end + end + def edit end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5579fe79b..dbe292f76 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -48,7 +48,7 @@ module ApplicationHelper def authorize_for(controller, action) User.current.allowed_to?({:controller => controller, :action => action}, @project) end - + # add by nwb def authorize_for_course(controller, action) User.current.allowed_to?({:controller => controller, :action => action}, @course) diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index 842e1f1b7..f47ced545 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -283,6 +283,6 @@ module WatchersHelper 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) ) + :remote => true, :confirm => l(:lable_sure_exit_project), :style => "color: #fff; display:block; padding: 0px 5px;margin-right:10px;height:20px;text-aligh:center;" ) end end diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index 1a5cbd2fa..97ed903d9 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -9,9 +9,7 @@ -
- <%= h @board.name %> +
+

<%= h @board.name %>

<% if !User.current.logged? %> diff --git a/app/views/calendars/show.html.erb b/app/views/calendars/show.html.erb index dae061251..39cab4a53 100644 --- a/app/views/calendars/show.html.erb +++ b/app/views/calendars/show.html.erb @@ -1,4 +1,6 @@ -

<%= @query.new_record? ? l(:label_calendar) : h(@query.name) %>

+
+

<%= @query.new_record? ? l(:label_calendar) : h(@query.name) %>

+
<%= form_tag({:controller => 'calendars', :action => 'show', :project_id => @project}, :method => :get, :id => 'query_form') do %> diff --git a/app/views/documents/index.html.erb b/app/views/documents/index.html.erb index f7f76a812..e0c39eb33 100644 --- a/app/views/documents/index.html.erb +++ b/app/views/documents/index.html.erb @@ -1,3 +1,6 @@ +
+

<%=l(:label_document_plural)%>

+
<%= l(:label_documents_sort) %> @@ -8,24 +11,22 @@ | <%= link_to l(:label_document_new), new_project_document_path(@project), :class => 'icon icon-add', - :onclick => 'showAndScrollTo("add-document", "document_title"); return false;' if User.current.allowed_to?(:add_documents, @project) %> + :onclick => 'showAndScrollTo("add-document", "document_title"); return false;' if User.current.allowed_to?(:add_documents, @project) %>
-

<%=l(:label_document_plural)%>

- <% if @grouped.empty? %>

<%= l(:label_no_data) %> diff --git a/app/views/documents/show.html.erb b/app/views/documents/show.html.erb index 45f54ad9b..5632c9d63 100644 --- a/app/views/documents/show.html.erb +++ b/app/views/documents/show.html.erb @@ -1,3 +1,6 @@ +

+

<%=h @document.title %>

+
@@ -9,7 +12,6 @@ <% end %>
-

<%=h @document.title %>

<%#=h @document.category.name %>
<%= format_date @document.created_on %>

diff --git a/app/views/files/_newfile_index.html.erb b/app/views/files/_newfile_index.html.erb new file mode 100644 index 000000000..5ffaacae4 --- /dev/null +++ b/app/views/files/_newfile_index.html.erb @@ -0,0 +1,250 @@ + +
+ <% if @isproject %> + <%= render :partial => 'project_file', locals: {project: @project} %> + <% else %> + <%= render :partial => 'course_file', locals: {course: @course} %> + <% end %> +
+ + + + + diff --git a/app/views/files/_project_file.html.erb b/app/views/files/_project_file.html.erb index e2f928332..e204030f1 100644 --- a/app/views/files/_project_file.html.erb +++ b/app/views/files/_project_file.html.erb @@ -1,11 +1,8 @@ - <% attachmenttypes = @project.attachmenttypes %> <% sufixtypes = @project.contenttypes %> - - - <%= (@project.project_type == 1) ? t(:label_user_course) : t(:label_project) %> - 资源共享区 - +
+

资源共享区

+
<%#= link_to(l(:label_attachment_new), 'javascript:void(0);', :onclick=>"$('#file_buttons').slideToggle();", :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @project) %> diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index fe04c4e3f..39bc8b52e 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -1,250 +1 @@ - -
-<% if @isproject %> - <%= render :partial => 'project_file', locals: {project: @project} %> -<% else %> - <%= render :partial => 'course_file', locals: {course: @course} %> -<% end %> -
- - - - - +<%= render :partial => 'files/newfile_index' %> \ No newline at end of file diff --git a/app/views/files/index.js.erb b/app/views/files/index.js.erb new file mode 100644 index 000000000..59bc2407f --- /dev/null +++ b/app/views/files/index.js.erb @@ -0,0 +1,2 @@ +alert("eeee"); +$('#content').html('<%= escape_javascript(render :partial => 'issues/newissue_index') %>'); diff --git a/app/views/files/new.html.erb b/app/views/files/new.html.erb index 8fd99b195..be9bcd722 100644 --- a/app/views/files/new.html.erb +++ b/app/views/files/new.html.erb @@ -1,4 +1,6 @@ -

<%=l(:label_attachment_new)%>

+
+

<%=l(:label_attachment_new)%>

+
<%= error_messages_for 'attachment' %> <%= form_tag(project_files_path(@project), :multipart => true, :class => "tabular") do %> diff --git a/app/views/gantts/show.html.erb b/app/views/gantts/show.html.erb index 6ec189256..2808a99cc 100644 --- a/app/views/gantts/show.html.erb +++ b/app/views/gantts/show.html.erb @@ -1,5 +1,7 @@ -<% @gantt.view = self %> -

<%= @query.new_record? ? l(:label_gantt) : h(@query.name) %>

+
+

<% @gantt.view = self %> + <%= @query.new_record? ? l(:label_gantt) : h(@query.name) %>

+
<%= form_tag({:controller => 'gantts', :action => 'show', :project_id => @project, :month => params[:month], diff --git a/app/views/issues/_newissue_index.html.erb b/app/views/issues/_newissue_index.html.erb new file mode 100644 index 000000000..f0b7c0108 --- /dev/null +++ b/app/views/issues/_newissue_index.html.erb @@ -0,0 +1,137 @@ +
+

问题跟踪

+
+
+ <% if @project.enabled_modules.where("name = 'issue_tracking'").count > 0 %> + + <%= link_to l(:label_issue_new), {:controller => 'issues', :action => 'new', :copy_from => nil}, :param => :project_id, :caption => :label_issue_new, + :html => {:accesskey => Redmine::AccessKeys.key_for(:new_issue)}, :class => 'icon icon-add' %> + <%= link_to l(:label_query), '#', :class => 'icon icon-help', + :onclick => '$("#custom_query").slideToggle(400); ' if true || User.current.logged? %> + + <% end %> + 问题总数:100 未解决:20 +
+
+ <% if !@query.new_record? && @query.editable_by?(User.current) %> + <%= link_to l(:button_edit), edit_query_path(@query), :class => 'icon icon-edit' %> + <%= delete_link query_path(@query) %> + <% end %> +
+ +<% html_title(@query.new_record? ? l(:label_issue_plural) : @query.name) %> +
+ <%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project}, :method => :get, :id => 'query_form', :class => 'query_form') do %> + <%= hidden_field_tag 'set_filter', '1' %> + +
+ ---<%= l :label_query_new %>--- + +
+
"> + + <%= l(:label_issue_query_condition) %> + +
"> + <%= render :partial => 'queries/filters', :locals => {:query => @query} %> +
+
+ +
+ <%= link_to_function l(:label_issue_query), 'submit_query_form("query_form")', :class => 'icon icon-checked' %> + <%= link_to l(:label_issue_cancel_query), {:set_filter => 1, :project_id => @project}, :class => 'icon icon-reload' %> +
+
+
+ <% end %> +
+ +<%= error_messages_for 'query' %> + +<% if @query.valid? %> + <% if @issues.empty? %> +

+ <%= l(:label_no_data) %> +

+ <% else %> + <%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %> + + <% end %> +
+ <% other_formats_links do |f| %> + <%= f.link_to 'Atom', :url => params.merge(:key => User.current.rss_key) %> + <%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '330px'); return false;" %> + <%= f.link_to 'PDF', :url => params %> + <% end %> +
+ + + + +<% end %> + +<%= call_hook(:view_issues_index_bottom, {:issues => @issues, :project => @project, :query => @query}) %> + +<% content_for :sidebar do %> + <%= render :partial => 'issues/sidebar' %> +<% end %> + +<% content_for :header_tags do %> + <%= auto_discovery_link_tag(:atom, + {:query_id => @query, :format => 'atom', + :page => nil, :key => User.current.rss_key}, + :title => l(:label_issue_plural)) %> + <%= auto_discovery_link_tag(:atom, + {:controller => 'journals', :action => 'index', + :query_id => @query, :format => 'atom', + :page => nil, :key => User.current.rss_key}, + :title => l(:label_changes_details)) %> +<% end %> + +<%= context_menu issues_context_menu_path %> diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index 219a0f641..b3750a770 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -1,135 +1 @@ -
- <% if @project.enabled_modules.where("name = 'issue_tracking'").count > 0 %> -
- <%= link_to l(:label_issue_new), {:controller => 'issues', :action => 'new', :copy_from => nil}, :param => :project_id, :caption => :label_issue_new, - :html => {:accesskey => Redmine::AccessKeys.key_for(:new_issue)}, :class => 'icon icon-add' %> - - <%= link_to l(:label_query), '#', :class => 'icon icon-help', - :onclick => '$("#custom_query").slideToggle(400); ' if true || User.current.logged? %> -
- <% end %> -
- -
- <% if !@query.new_record? && @query.editable_by?(User.current) %> - <%= link_to l(:button_edit), edit_query_path(@query), :class => 'icon icon-edit' %> - <%= delete_link query_path(@query) %> - <% end %> -
- -<% html_title(@query.new_record? ? l(:label_issue_plural) : @query.name) %> -
- <%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project}, :method => :get, :id => 'query_form', :class => 'query_form') do %> - <%= hidden_field_tag 'set_filter', '1' %> - -
- ---<%= l :label_query_new %>--- - -
-
"> - - <%= l(:label_issue_query_condition) %> - -
"> - <%= render :partial => 'queries/filters', :locals => {:query => @query} %> -
-
- -
- <%= link_to_function l(:label_issue_query), 'submit_query_form("query_form")', :class => 'icon icon-checked' %> - <%= link_to l(:label_issue_cancel_query), {:set_filter => 1, :project_id => @project}, :class => 'icon icon-reload' %> -
-
-
- <% end %> -
- -<%= error_messages_for 'query' %> - -<% if @query.valid? %> - <% if @issues.empty? %> -

- <%= l(:label_no_data) %> -

- <% else %> - <%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %> - - <% end %> -
- <% other_formats_links do |f| %> - <%= f.link_to 'Atom', :url => params.merge(:key => User.current.rss_key) %> - <%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '330px'); return false;" %> - <%= f.link_to 'PDF', :url => params %> - <% end %> -
- - - - -<% end %> - -<%= call_hook(:view_issues_index_bottom, {:issues => @issues, :project => @project, :query => @query}) %> - -<% content_for :sidebar do %> - <%= render :partial => 'issues/sidebar' %> -<% end %> - -<% content_for :header_tags do %> - <%= auto_discovery_link_tag(:atom, - {:query_id => @query, :format => 'atom', - :page => nil, :key => User.current.rss_key}, - :title => l(:label_issue_plural)) %> - <%= auto_discovery_link_tag(:atom, - {:controller => 'journals', :action => 'index', - :query_id => @query, :format => 'atom', - :page => nil, :key => User.current.rss_key}, - :title => l(:label_changes_details)) %> -<% end %> - -<%= context_menu issues_context_menu_path %> +<%= render :partial => 'issues/newissue_index' %> \ No newline at end of file diff --git a/app/views/issues/index.js.erb b/app/views/issues/index.js.erb new file mode 100644 index 000000000..866882053 --- /dev/null +++ b/app/views/issues/index.js.erb @@ -0,0 +1 @@ +$('#content').html('<%= escape_javascript(render :partial => 'issues/newissue_index') %>'); diff --git a/app/views/issues/new.html.erb b/app/views/issues/new.html.erb index 05ec50c11..51ebd139e 100644 --- a/app/views/issues/new.html.erb +++ b/app/views/issues/new.html.erb @@ -1,3 +1,6 @@ +
+

问题跟踪

+
<%= call_hook(:view_issues_new_top, {:issue => @issue}) %> <%= labelled_form_for @issue, :url => project_issues_path(@project), diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 204dd519a..47ba63ebf 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -1,5 +1,6 @@ -<%# html_title "#{@issue.tracker.name} ##{@issue.id}: #{@issue.subject}" %> - +
+

问题跟踪

+
<% html_title "#{@issue.tracker.name} #{@issue.source_from}: #{@issue.subject}" %> <%= render :partial => 'action_menu' %> diff --git a/app/views/layouts/_base_feedback.html.erb b/app/views/layouts/_base_feedback.html.erb index c4479b43a..2444af68c 100644 --- a/app/views/layouts/_base_feedback.html.erb +++ b/app/views/layouts/_base_feedback.html.erb @@ -1,32 +1,30 @@