Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts: db/schema.rbcompetition
commit
56aa2fb8dc
@ -0,0 +1,3 @@
|
||||
class CourseAttachment < ActiveRecord::Base
|
||||
attr_accessible :attachtype, :author_id, :content_type, :description, :digest, :disk_directory, :disk_filename, :downloads, :filename, :filesize, :integer, :is_public
|
||||
end
|
@ -0,0 +1,4 @@
|
||||
class ProjectScore < ActiveRecord::Base
|
||||
attr_accessible :project_id, :score
|
||||
belongs_to :project, foreign_key: :project_id
|
||||
end
|
@ -1,45 +1,45 @@
|
||||
<div class="contextual">
|
||||
<%= link_to l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add' %>
|
||||
</div>
|
||||
|
||||
<h3><%=l(:label_project_plural)%></h3>
|
||||
|
||||
<%= form_tag({}, :method => :get) do %>
|
||||
<fieldset><legend><%= l(:label_filter_plural) %></legend>
|
||||
<label for='status'><%= l(:field_status) %> :</label>
|
||||
<%= select_tag 'status', project_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %>
|
||||
<label for='name'><%= l(:label_project) %>:</label>
|
||||
<%= text_field_tag 'name', params[:name], :size => 30 %>
|
||||
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
|
||||
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'projects'}, :class => 'icon icon-reload' %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
|
||||
<div class="autoscroll">
|
||||
<table class="list">
|
||||
<thead><tr>
|
||||
<th><%=l(:label_project)%></th>
|
||||
<th><%=l(:field_is_public)%></th>
|
||||
<th><%=l(:field_created_on)%></th>
|
||||
<th></th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<% project_tree(@projects) do |project, level| %>
|
||||
<tr class="<%= cycle("odd", "even") %> <%= project.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>">
|
||||
<td class="name"><span><%= link_to_project_settings(project, {}, :title => project.short_description) %></span></td>
|
||||
<td align="center"><%= checked_image project.is_public? %></td>
|
||||
<td align="center"><%= format_date(project.created_on) %></td>
|
||||
<td class="buttons">
|
||||
<%= link_to(l(:button_archive), { :controller => 'projects', :action => 'archive', :id => project, :status => params[:status] }, :data => {:confirm => l(:text_are_you_sure)}, :method => :post, :class => 'icon icon-lock') unless project.archived? %>
|
||||
<%= link_to(l(:button_unarchive), { :controller => 'projects', :action => 'unarchive', :id => project, :status => params[:status] }, :method => :post, :class => 'icon icon-unlock') if project.archived? && (project.parent.nil? || !project.parent.archived?) %>
|
||||
<%= link_to(l(:button_copy), { :controller => 'projects', :action => 'copy', :id => project }, :class => 'icon icon-copy') %>
|
||||
<%= link_to(l(:button_delete), project_path(project), :method => :delete, :class => 'icon icon-del') %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_project_plural)) -%>
|
||||
<div class="contextual">
|
||||
<%= link_to l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add' %>
|
||||
</div>
|
||||
|
||||
<h3><%=l(:label_project_plural)%></h3>
|
||||
|
||||
<%= form_tag({}, :method => :get) do %>
|
||||
<fieldset><legend><%= l(:label_filter_plural) %></legend>
|
||||
<label for='status'><%= l(:field_status) %> :</label>
|
||||
<%= select_tag 'status', project_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %>
|
||||
<label for='name'><%= l(:label_project) %>:</label>
|
||||
<%= text_field_tag 'name', params[:name], :size => 30 %>
|
||||
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
|
||||
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'projects'}, :class => 'icon icon-reload' %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
|
||||
<div class="autoscroll">
|
||||
<table class="list" style="width: 100%;table-layout: fixed">
|
||||
<thead><tr>
|
||||
<th><%=l(:label_project)%></th>
|
||||
<th><%=l(:field_is_public)%></th>
|
||||
<th><%=l(:field_created_on)%></th>
|
||||
<th></th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<% project_tree(@projects) do |project, level| %>
|
||||
<tr class="<%= cycle("odd", "even") %> <%= project.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>">
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=project.name%>'><span><%= link_to_project_settings(project, {}) %></span></td>
|
||||
<td align="center"><%= checked_image project.is_public? %></td>
|
||||
<td align="center"><%= format_date(project.created_on) %></td>
|
||||
<td class="buttons">
|
||||
<%= link_to(l(:button_archive), { :controller => 'projects', :action => 'archive', :id => project, :status => params[:status] }, :data => {:confirm => l(:text_are_you_sure)}, :method => :post, :class => 'icon icon-lock') unless project.archived? %>
|
||||
<%= link_to(l(:button_unarchive), { :controller => 'projects', :action => 'unarchive', :id => project, :status => params[:status] }, :method => :post, :class => 'icon icon-unlock') if project.archived? && (project.parent.nil? || !project.parent.archived?) %>
|
||||
<%= link_to(l(:button_copy), { :controller => 'projects', :action => 'copy', :id => project }, :class => 'icon icon-copy') %>
|
||||
<%= link_to(l(:button_delete), project_path(project), :method => :delete, :class => 'icon icon-del') %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_project_plural)) -%>
|
||||
|
@ -0,0 +1,20 @@
|
||||
<div style="margin-left: 20px;">
|
||||
|
||||
<% if ( !(User.current.member_of? @project) && User.current.login?) %> <!--added by linchun-->
|
||||
<span class="icon-fav icon"></span><%= watcher_link(@project, User.current) %>
|
||||
<% end %>
|
||||
</div>
|
||||
<!--添加项目申请-->
|
||||
<div style="margin-left: 20px;">
|
||||
<% if ( !(User.current.member_of? @project) && User.current.login?) %>
|
||||
<span class="icon-fav icon"></span>
|
||||
<%= applied_link(@project, User.current) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<!--添加退出项目-->
|
||||
<div style="margin-left: 20px;">
|
||||
<% if ((User.current.member_of? @project) && User.current.login?) %>
|
||||
<%= exit_project_link(@project) %>
|
||||
<% end %>
|
||||
</div>
|
@ -1,5 +1,5 @@
|
||||
<% if @project %>
|
||||
<%= render :partial => 'project_show', locals: {project: @project} %>
|
||||
<% elsif @course %>
|
||||
<%= render :partial => 'course_show', locals: {course: @course} %>
|
||||
<% end %>
|
||||
<% if @project %>
|
||||
<%= render :partial => 'project_show', locals: {project: @project} %>
|
||||
<% elsif @course %>
|
||||
<%= render :partial => 'course_show', locals: {course: @course} %>
|
||||
<% end %>
|
||||
|
@ -0,0 +1 @@
|
||||
$('#join_exit_project_div').html("<%= escape_javascript(render(:partial => 'layouts/join_exit_project')) %>");
|
@ -0,0 +1,28 @@
|
||||
<% course_list.map do |course| %>
|
||||
<li class='<%= cycle("odd", "even") %>' title=<%= course.description.to_s.gsub(/<\/?.*?>/,"") %>>
|
||||
<div class='avatar'>
|
||||
<%= image_tag(get_course_avatar(course), :class => "avatar-4") %>
|
||||
</div>
|
||||
<!-- 上左下右 -->
|
||||
<div class='desc_item'>
|
||||
<span class=''>
|
||||
<% if (course.school == nil) %>
|
||||
|
||||
<% else %>
|
||||
<%= link_to course.school.name.try(:gsub, /(.+)$/, '\1:'), options={:action => 'course', :school_id => course.school.id}, html_options={:method => 'get'} %>
|
||||
<% end %>
|
||||
</span>
|
||||
<span class='font_bolder'>
|
||||
<%= link_to(course.try(:teacher).try(:realname), user_path(course.teacher)) %>
|
||||
<%#=course.try(:teacher).try(:name)%>
|
||||
</span>
|
||||
</div>
|
||||
<div class='desc_item text_nowrap'>
|
||||
[<%= get_course_term course %>]
|
||||
<%= link_to(course.name.truncate(30, omission: '...'), course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
|
||||
(<%= course.members.count %>人)
|
||||
<%# files_count = course.attachments.count.to_s %>
|
||||
(<%= link_to "#{course.attachments.count.to_s}份", course_files_path(course) %>资料)
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
@ -0,0 +1,5 @@
|
||||
<h1></h1>
|
||||
<p id="errorExplanation">
|
||||
<%= course_title%>
|
||||
</p>
|
||||
<h1></h1>
|
@ -1,4 +1,5 @@
|
||||
<div class="wiki wiki-page">
|
||||
<%= textilizable content, :text, :attachments => content.page.attachments,
|
||||
:edit_section_links => (@sections_editable && {:controller => 'wiki', :action => 'edit', :project_id => @page.project, :id => @page.title}) %>
|
||||
<%#= content.text.html_safe %>
|
||||
</div>
|
||||
|
@ -0,0 +1,10 @@
|
||||
class CreateProjectScores < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :project_scores do |t|
|
||||
t.string :project_id
|
||||
t.integer :score
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,20 @@
|
||||
class CreateCourseAttachments < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :course_attachments do |t|
|
||||
t.string :filename
|
||||
t.string :disk_filename
|
||||
t.integer :filesize
|
||||
t.string :content_type
|
||||
t.string :digest
|
||||
t.integer :downloads
|
||||
t.string :author_id
|
||||
t.string :integer
|
||||
t.string :description
|
||||
t.string :disk_directory
|
||||
t.integer :attachtype
|
||||
t.integer :is_public
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
class AddColunToCourseAttachments < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :course_attachments, :container_id, :integer, :default => 0
|
||||
end
|
||||
end
|
@ -0,0 +1,29 @@
|
||||
class UpdateCourseAttachments < ActiveRecord::Migration
|
||||
def up
|
||||
attachments = Attachment.where(" container_type = 'Course'")
|
||||
attachments.each do |attachment|
|
||||
course_attachment = CourseAttachment.new
|
||||
course_attachment.container_id = attachment.container_id
|
||||
course_attachment.filename = attachment.filename
|
||||
course_attachment.disk_filename = attachment.disk_filename
|
||||
course_attachment.filesize = attachment.filesize
|
||||
course_attachment.content_type = attachment.content_type
|
||||
course_attachment.digest = attachment.digest
|
||||
course_attachment.downloads = attachment.downloads
|
||||
course_attachment.author_id = attachment.author_id
|
||||
course_attachment.created_at = attachment.created_on
|
||||
course_attachment.description = attachment.description
|
||||
course_attachment.disk_directory = attachment.disk_directory
|
||||
course_attachment.attachtype = attachment.attachtype
|
||||
course_attachment.is_public = attachment.is_public
|
||||
course_attachment.save(:validate => false)
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
coll = CourseAttachment.all
|
||||
coll.each do |model|
|
||||
model.destroy
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||
|
||||
one:
|
||||
project_id: MyString
|
||||
score: 1
|
||||
|
||||
two:
|
||||
project_id: MyString
|
||||
score: 1
|
@ -0,0 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
class ProjectScoreTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
Loading…
Reference in new issue