From 8039f89d92d8464ffd5dcb448fc400227356f8ce Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 20 Feb 2017 14:08:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E9=A1=B9=E7=9B=AE=E7=9A=84?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/training_tasks/_all_list.html.erb | 11 +-- .../training_tasks/_content_list.html.erb | 75 ++++++++----------- app/views/training_tasks/index.html.erb | 53 +++++++++++++ app/views/training_tasks/index.js.erb | 3 + db/schema.rb | 2 +- 5 files changed, 89 insertions(+), 55 deletions(-) create mode 100644 app/views/training_tasks/index.js.erb diff --git a/app/views/training_tasks/_all_list.html.erb b/app/views/training_tasks/_all_list.html.erb index 501c25514..59549283d 100644 --- a/app/views/training_tasks/_all_list.html.erb +++ b/app/views/training_tasks/_all_list.html.erb @@ -1,12 +1,3 @@ <% tasks.each do |task| -%> <%= render :partial => 'content_list', :locals => {:activity => task, :user_activity_id => task.id} %> -<% end %> - -
-
- -
-
-
\ No newline at end of file +<% end %> \ No newline at end of file diff --git a/app/views/training_tasks/_content_list.html.erb b/app/views/training_tasks/_content_list.html.erb index e7e2b5124..1ee35871e 100644 --- a/app/views/training_tasks/_content_list.html.erb +++ b/app/views/training_tasks/_content_list.html.erb @@ -1,49 +1,36 @@ <% unless activity.author.nil? %> -
-
- -
-
-
- <%= activity.subject.to_s %> -
+ + + <% if activity.status == 0 %> +
+ <% elsif activity.status == 1 %> +
+ <% end %> +
+
+ + step<%= activity.position %> + <%= activity.subject.to_s %> + + <% if activity.status == 0 %> + 正在解决中 + <% end %> +
+
+
+

<%= format_time(activity.created_at) %>发布

+

<%= format_time(activity.updated_at) %>更新

+
-
- <%# if activity.try(:author).try(:realname) == ' ' %> - <%#= link_to activity.try(:author), user_path(activity.author_id), :class => "fl issues_list_name" %> - <%# else %> - <%#= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "fl issues_list_name" %> - <%# end %> - -

<%= format_time(activity.created_at) %> 发布

-

<%= format_time(activity.updated_at) %> 更新

-
-
- -
+ + + <% if activity.journals.count != 0 %> + + <%= activity.journals.count %> + <% end %> + + 提交评测 + <% end %> + +
+ <% if is_project_manager?(User.current, @project) || User.current.admin? %> + 新建 +
+ <% else %> +
+

完成任务后提交代码,若通过系统测试,将为你发送下一个任务,祝你早日通关,加油!

+
+ <% end %> + <% if @training_tasks.empty? %> + <%= render :partial => "projects/no_data" %> + <% else %> +
+
+ + + + + + + + + + <%= render :partial => 'all_list', :locals => {:tasks => @training_tasks} %> + +

所有<%= @training_tasks_count %>

  
+
+
+
    + +
+
+
+
    + <%= pagination_links_full @training_tasks_pages, @training_tasks_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %> +
+
+
+
+
+
+ <% end %> + +
+ + + + + + +<% if false %>
@@ -230,3 +282,4 @@
+<% end %> \ No newline at end of file diff --git a/app/views/training_tasks/index.js.erb b/app/views/training_tasks/index.js.erb new file mode 100644 index 000000000..d0ac3f0a6 --- /dev/null +++ b/app/views/training_tasks/index.js.erb @@ -0,0 +1,3 @@ +$("#issue_list").html("<%= escape_javascript(render :partial => 'training_tasks/all_list',:locals => {:tasks => @training_tasks, :project=> @project})%>"); +$("#issue_list_pagination").html('<%= pagination_links_full @training_tasks_pages, @training_tasks_count, :training_tasks => @training_tasks, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>'); + diff --git a/db/schema.rb b/db/schema.rb index 5e2308145..17dd60485 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -2304,7 +2304,7 @@ ActiveRecord::Schema.define(:version => 20170219025424) do t.datetime "created_at", :null => false t.datetime "updated_at", :null => false t.integer "author_id" - t.integer "status", :limit => 1, :default => 1 + t.integer "status", :limit => 1, :default => 0 end create_table "user_actions", :force => true do |t|