Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop
This commit is contained in:
commit
2b73c4b338
|
@ -48,6 +48,7 @@ class StatisticsController < ApplicationController
|
|||
# POST /statistics.json
|
||||
def create
|
||||
@statistic = Statistic.new(params[:statistic])
|
||||
@statistic.user_id = User.current.id
|
||||
@statistic.save_attachments_containers(params[:attachments], User.current, true)
|
||||
respond_to do |format|
|
||||
if @statistic.save
|
||||
|
|
|
@ -2110,7 +2110,7 @@ class UsersController < ApplicationController
|
|||
exercise_users = ExerciseUser.where(:user_id => @user.id, :exercise_id => exercises.map{|ex| ex.id})
|
||||
@unfinished_test_count = exercises.count - exercise_users.count
|
||||
# 用户待完成的问卷
|
||||
polls = Poll.where("polls_type = 'Course' and polls_group_id in #{my_course_ids} and polls_status = 2")
|
||||
polls = Poll.where("polls_type = 'Course' and course_id in #{my_course_ids} and polls_status = 2")
|
||||
poll_users = PollUser.where(:user_id => @user.id, :poll_id => polls.map{|poll| poll.id})
|
||||
@unfinished_poll_count = polls.count - poll_users.count
|
||||
# 用户待匿评的作品
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
class Statistic < ActiveRecord::Base
|
||||
attr_accessible :description, :name, :status, :user_id
|
||||
attr_accessible :description, :name, :status, :user_id, :main_category_id, :sub_category_id
|
||||
acts_as_attachable
|
||||
|
||||
def creator
|
||||
User.find self.user_id
|
||||
end
|
||||
end
|
||||
|
|
|
@ -86,7 +86,6 @@
|
|||
}
|
||||
// 获取子类别
|
||||
function getSubCategory(id){
|
||||
alert(id);
|
||||
$.ajax({
|
||||
url: '<%= get_sub_category_statistics_path %>',
|
||||
type: 'get',
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<span class="active">不限</span>
|
||||
<% @sub_categories.each do |mc| %>
|
||||
<span><a><%= mc.name %></a></span>
|
||||
<% end %>
|
|
@ -1,5 +1,7 @@
|
|||
<% if @sub_categories.blank? %>
|
||||
$("#statistic_sub_category_id").hide();
|
||||
$("#statistic_sub_category_id").hide();
|
||||
<% elsif params[:come_from] == "statistics_index" %>
|
||||
$("#sub_categories_list").html('<%= j(render :partial => "sub_categories_list") %>');
|
||||
<% else %>
|
||||
$("#statistic_sub_category_id").html('<%= escape_javascript( render :partial => 'statistics/sub_category') %>');
|
||||
$("#statistic_sub_category_id").html('<%= escape_javascript( render :partial => 'statistics/sub_category') %>');
|
||||
<% end %>
|
||||
|
|
|
@ -5,17 +5,14 @@
|
|||
<div class="fl data_line">
|
||||
<span class="active">不限</span>
|
||||
<% @main_categories.each do |mc| %>
|
||||
<span><%= mc.name %></span>
|
||||
<span onclick="get_sub_categories(<%= mc.id %>);"><%= mc.name %></span>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="data_half cl">
|
||||
<span class="fl data_name">子类型</span>
|
||||
<div class="fl data_line">
|
||||
<span class="active">不限</span>
|
||||
<% @sub_categories.each do |mc| %>
|
||||
<span><%= mc.name %></span>
|
||||
<% end %>
|
||||
<div class="fl data_line" id="sub_categories_list">
|
||||
<%= render :partial => "sub_categories_list" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="data_half cl">
|
||||
|
@ -37,35 +34,37 @@
|
|||
<span class="fl f14 mt5 ml2">共<span class="c-blue">122</span>个检索结果</span>
|
||||
<%= link_to '+ 发布'.html_safe, new_statistic_path ,:class=>"fr send_statistic mr2" %>
|
||||
</div>
|
||||
<div class="data_list">
|
||||
<div class="data_list_item cl pr">
|
||||
<img src="https://ss1.baidu.com/6ONXsjip0QIZ8tyhnq/it/u=2138460373,2431522454&fm=58" width="50"class="fl">
|
||||
<div class="homepagePostSetting" style="top: 10px;right: 12px">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li>编辑</li>
|
||||
<li>删除</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="fl data_itemMain">
|
||||
<span class="f16 mr10">数据名称1</span><span class="list_tag">标签1</span><span class="list_tag">标签2</span>
|
||||
<p class="f13 mt5 mb5 data_detail">数据名称1的介绍数据名称1的介绍数据名称1的介绍数据名称1的介绍数据名称1的介绍数据名称1的介绍数据名称1的介绍数据名称1的介绍数据名称1的介绍数据名称1的介绍数据名称1的介绍</p>
|
||||
<div class="f13 mt7">
|
||||
<p class="mb5 c_grey"><a href="javascript:void(0)" class="mr10 attachment_file">附件1.docx</a>96KB</p>
|
||||
<p class="mb5 c_grey"><a href="javascript:void(0)" class="mr10 attachment_file">附件1.docx</a>96KB</p>
|
||||
</div>
|
||||
<div class="data_info mt7 c_grey">
|
||||
<span>蔡世</span>
|
||||
<span>2018-02-06 15:51</span>
|
||||
<span>开发数据</span>
|
||||
<span>代码数据</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="data_list">
|
||||
|
||||
<% @statistics.each do |statistic| %>
|
||||
<div class="data_list_item cl pr">
|
||||
<img src="<%= url_to_avatar(statistic.creator) %>" width="50" class="fl">
|
||||
<div class="homepagePostSetting" style="top: 10px;right: 12px">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li><%= link_to '编辑', edit_statistic_path(statistic) %></li>
|
||||
<li><%= link_to '删除', statistic, method: :delete, data: { confirm: 'Are you sure?' } %></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="fl data_itemMain">
|
||||
<span class="f16 mr10"> <%= link_to "#{statistic.name}", statistic %> </span>
|
||||
<p class="f13 mt5 mb5 data_detail"><%= statistic.description %></p>
|
||||
<div class="f13 mt7">
|
||||
<%= render :partial => 'attachments',:locals => {:attachments => statistic.try(:attachments)} %>
|
||||
</div>
|
||||
<div class="data_info mt7 c_grey">
|
||||
<span><%= statistic.creator.show_name %></span>
|
||||
<span><%= statistic.created_at %></span>
|
||||
<span>开发数据</span>
|
||||
<span>代码数据</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="data_list_item cl pr">
|
||||
<img src="https://ss1.baidu.com/6ONXsjip0QIZ8tyhnq/it/u=2138460373,2431522454&fm=58" width="50"class="fl">
|
||||
<div class="homepagePostSetting" style="top: 10px;right: 12px">
|
||||
|
@ -93,6 +92,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<table>
|
||||
<tr>
|
||||
|
@ -120,9 +120,14 @@
|
|||
|
||||
<br />
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
function get_sub_categories(id){
|
||||
$.ajax({
|
||||
url: "<%= get_sub_category_statistics_path(:come_from => "statistics_index") %>",
|
||||
data: {main_category_id: id},
|
||||
dataType: "script"
|
||||
})
|
||||
}
|
||||
function clear_search(){
|
||||
$("#search_input").val('').focus();
|
||||
}
|
||||
|
|
950
db/schema.rb
950
db/schema.rb
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue