Merge branch 'bigchange' into develop
This commit is contained in:
commit
099fffab51
|
@ -625,7 +625,7 @@ class ApplicationController < ActionController::Base
|
|||
@obj_count = obj.count
|
||||
@obj_pages = 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).all
|
||||
obj.limit(@obj_pages.per_page).offset(@obj_pages.offset)
|
||||
elsif obj.kind_of? Array
|
||||
obj[@obj_pages.offset, @obj_pages.per_page]
|
||||
else
|
||||
|
|
|
@ -1,14 +1,101 @@
|
|||
# encoding: utf-8
|
||||
# Trustie - education management software
|
||||
# Copyright (C) 2013-2014
|
||||
class StoresController < ApplicationController
|
||||
layout 'base_stores'
|
||||
# menu_item :overview
|
||||
# menu_item :roadmap, :only => :roadmap
|
||||
# menu_item :settings, :only => :settings
|
||||
|
||||
# include ActsAsTaggableOn::TagsHelper
|
||||
def search
|
||||
name = params[:name] ||= ''
|
||||
redirect_to stores_path, :notice => l(:field_course_un) if name.blank?
|
||||
# 按文件名搜索
|
||||
result = Attachment.where("attachments.container_type IS NOT NULL AND filename LIKE '%" + name + "%' ").
|
||||
reorder("created_on DESC")
|
||||
# result = result.to_a
|
||||
result.map { |res|
|
||||
if(res.container.nil? ||
|
||||
(res.container.class.to_s=="Project" && res.container.is_public == false) ||
|
||||
(res.container.has_attribute?(:project) && res.container.project.is_public == false) ||
|
||||
(res.container.class.to_s=="HomeworkAttach" && res.container.bid.reward_type == 3) ||
|
||||
false
|
||||
)
|
||||
result.delete(res)
|
||||
end
|
||||
}
|
||||
@searched_attach = paginateHelper result
|
||||
end
|
||||
|
||||
LIMIT = 12 unless const_defined?(:LIMIT)
|
||||
def index
|
||||
@projects_attach = project_classification(0).take(LIMIT)
|
||||
@courses_attach = project_classification(1).take(LIMIT)
|
||||
# @projects_attach = Attachment.includes(:project).where("projects.project_type=? AND projects.is_public = ?", 0, 1).
|
||||
# reorder("#{Attachment.table_name}.downloads DESC").
|
||||
# limit(LIMIT)
|
||||
|
||||
# @courses_attach = Attachment.includes(:project).where("projects.project_type=? AND projects.is_public = ?", 1, 1).
|
||||
# reorder("#{Attachment.table_name}.downloads DESC").
|
||||
# limit(LIMIT)
|
||||
# 悲剧 下面竞赛里没文件
|
||||
# @homeworks_attach = Attachment.
|
||||
# joins("LEFT JOIN homework_attaches ON homework_attaches.id=attachments.container_id
|
||||
# LEFT JOIN bids ON homework_attaches.bid_id=bids.id").
|
||||
# where("container_type = 'HomeworkAttach' AND bids.reward_type <> 3").
|
||||
# reorder("downloads DESC").
|
||||
# limit(LIMIT)
|
||||
@homeworks_attach = join_tools_project Message, 0
|
||||
@memos_attach = Attachment.where("container_type = 'Memo'").
|
||||
reorder("downloads DESC").
|
||||
limit(LIMIT)
|
||||
@attach_array = Array.new
|
||||
@attach_array.push(@projects_attach, @courses_attach, @homeworks_attach, @memos_attach)
|
||||
@str_arr = [ l(:label_project_deposit),
|
||||
l(:label_course_practice),
|
||||
l(:label_borad_project), #l(:label_contest_innovate),
|
||||
l(:label_forum) ]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def project_classification project_type=0
|
||||
# pro_attach = Attachment.joins("LEFT JOIN projects ON attachments.container_id = projects.id").
|
||||
# where("attachments.container_type='Project' AND projects.is_public=1 AND projects.project_type=#{project_type}").
|
||||
# reorder("downloads DESC").
|
||||
# limit(LIMIT)
|
||||
pro_attach = join_tools_project Project, project_type
|
||||
doc_attach = join_tools_project Document, project_type
|
||||
issue_attach = join_tools_project Issue, project_type
|
||||
mess_attach = []#join_tools_project Message, project_type
|
||||
news_attach = join_tools_project News, project_type
|
||||
vers_attach = join_tools_project Version, project_type
|
||||
wiki_attach = join_tools_project WikiPage, project_type
|
||||
|
||||
tmp = pro_attach
|
||||
tmp = pro_attach+doc_attach+issue_attach+mess_attach+news_attach+vers_attach+wiki_attach
|
||||
tmp.sort { |a, b| b.downloads <=> a.downloads }
|
||||
end
|
||||
def join_tools_project tableName, project_type=0
|
||||
Attachment.joins(str_join_table(tableName)).
|
||||
where("attachments.container_type='#{tableName.to_s}' AND projects.is_public=1 AND projects.project_type=#{project_type}").
|
||||
reorder('downloads DESC').
|
||||
limit(LIMIT)
|
||||
end
|
||||
|
||||
def str_join_table tableClass
|
||||
case tableClass.to_s
|
||||
when 'Project'
|
||||
"LEFT JOIN projects ON attachments.container_id = projects.id"
|
||||
when 'Document', 'Issue', 'Version', 'News' # 连接子表即有 project_id 字段,即两层连接
|
||||
"LEFT JOIN #{tableClass.table_name} ON attachments.container_id = #{tableClass.table_name}.id
|
||||
LEFT JOIN projects ON #{tableClass.table_name}.project_id = projects.id"
|
||||
when 'Message' # 三层连接
|
||||
"LEFT JOIN #{tableClass.table_name} ON attachments.container_id = #{tableClass.table_name}.id
|
||||
LEFT JOIN boards ON boards.id = #{tableClass.table_name}.board_id
|
||||
LEFT JOIN projects ON boards.project_id = projects.id"
|
||||
when 'WikiPage'# 三层连接
|
||||
"LEFT JOIN #{tableClass.table_name} ON attachments.container_id = #{tableClass.table_name}.id
|
||||
LEFT JOIN wikis ON wikis.id = #{tableClass.table_name}.wiki_id
|
||||
LEFT JOIN projects ON wikis.project_id = projects.id"
|
||||
else
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -268,7 +268,8 @@ module ProjectsHelper
|
|||
@projects << Project.visible.find_by_id("#{obj.project_id}")#where('id=:id', id: obj.project_id)
|
||||
end
|
||||
@projects
|
||||
rescue NoMethodError
|
||||
rescue NoMethodError => e
|
||||
logger.error "Logger.Error [ProjectsHelper] ===> #sort_project_by_hot, NoMethodError: #{e}"
|
||||
[]
|
||||
end
|
||||
|
||||
|
@ -285,4 +286,7 @@ module ProjectsHelper
|
|||
WHERE project_type = 0 ORDER BY grade DESC LIMIT #{limit} ) AS t ON p.id = t.project_id ")
|
||||
end
|
||||
|
||||
def method_name
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,137 @@
|
|||
module StoresHelper
|
||||
def attachFromUrl attachment
|
||||
container = attachment.container
|
||||
case container.class.to_s
|
||||
when 'Message'
|
||||
board_message_path(container.board, container)
|
||||
when 'Issue'
|
||||
issue_path(container)
|
||||
when 'Document'
|
||||
document_path container
|
||||
when 'HomeworkAttach'
|
||||
bid_path(container.bid)
|
||||
when 'Memo'
|
||||
forum_memo_path(container.forum, container)
|
||||
when 'News'
|
||||
news_path(container)
|
||||
when 'Project'
|
||||
project_files_path(container)
|
||||
when 'Version'
|
||||
# version_path(container)
|
||||
project_files_path(container.project)
|
||||
when 'WikiPage'
|
||||
project_wiki_path(container.project)
|
||||
when 'Bid'
|
||||
bid_path(container)
|
||||
else
|
||||
Rails.logger.error "ERROR: StoresHelper#attachUrl unkown type ==> #{container}"
|
||||
'#'
|
||||
end
|
||||
end
|
||||
|
||||
def result_come_from attachment
|
||||
come_from_local(attachment).join(" > ").html_safe
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
WORD_LIMIT = 100
|
||||
def come_from_local attachment
|
||||
|
||||
container = attachment.container
|
||||
case container.class.to_s
|
||||
when 'Message'
|
||||
# '项目 > zzz > 论坛 > 帖子xxx'
|
||||
# topic_str = container.project.project_type == 0 ? l(:label_board) : l(:label_new_course)
|
||||
topic_list = link_to l(:label_board), project_boards_path(container.project)
|
||||
topic_item = link_to container.subject.truncate(WORD_LIMIT, omission: '...'), board_message_path(container.board, container), title: container.subject
|
||||
project_link(container.project).push(topic_list, topic_item)
|
||||
when 'Issue'
|
||||
# '项目 > zzz > 缺陷 > 问题xxx'
|
||||
issue_list = link_to l(:label_project_issues), project_issues_path(container.project)
|
||||
issue_item = link_to container.subject.truncate(WORD_LIMIT, omission: '...'), issue_path(container), title: container.subject
|
||||
project_link(container.project).push(issue_list, issue_item)
|
||||
when 'Document'
|
||||
# '项目 > zzz > 文档 > 文档xxx'
|
||||
doc_list = link_to l(:label_document), project_documents_path(container.project)
|
||||
doc_item = link_to container.title.truncate(WORD_LIMIT, omission: '...'), document_path(container), title: container.title
|
||||
project_link(container.project).push(doc_list, doc_item)
|
||||
when 'News'
|
||||
# '课程 > zzz > 新闻 > 新闻xxx'
|
||||
news_str = container.project.project_type == 0 ? l(:label_news) : l(:label_course_news)
|
||||
news_list = link_to news_str, project_news_index_path(container.project)
|
||||
news_item = link_to container.title.truncate(WORD_LIMIT, omission: '...'), news_path(container), title: container.title
|
||||
project_link(container.project).push(news_list, news_item)
|
||||
when 'Project'
|
||||
# '项目 > zzz '
|
||||
file_str = container.project.project_type == 0 ? l(:project_module_files) : l(:label_course_file)
|
||||
files_list = link_to file_str, project_files_path(container.project)
|
||||
project_link(container).push(files_list)
|
||||
when 'Version'
|
||||
# '项目 > zzz > 里程碑 > xxx'
|
||||
ver_list = link_to l(:label_roadmap), project_roadmap_path(container.project)
|
||||
files_list = link_to l(:label_course_file), project_files_path(container.project)
|
||||
ver_item = link_to container.name.truncate(WORD_LIMIT, omission: '...'), version_path(container), title: container.name
|
||||
project_link(container.project).push(ver_list, files_list, ver_item)
|
||||
when 'WikiPage'
|
||||
# '项目 > zzz > 维基 > xxx' 有点问题
|
||||
wiki_list = link_to l(:label_wiki), project_wiki_path(container.project)
|
||||
project_link(container.project).push(wiki_list)
|
||||
when 'HomeworkAttach'
|
||||
# '课程 > zzz > 作业 > 作业xxx'
|
||||
bid_link(container.bid)
|
||||
when 'Memo'
|
||||
# '贴吧 > 讨论区 > 帖子 xxx'
|
||||
return [link_to(attachment.id, '#')] if container.forum.nil?
|
||||
forums_list = link_to l(:label_forum), forums_path
|
||||
memo_list = link_to container.forum.name, forum_path(container.forum)
|
||||
memo_item = link_to container.subject, forum_memo_path(container.forum, container)
|
||||
[forums_list, memo_list, memo_item]
|
||||
when 'Bid'
|
||||
# '竞赛 > xxx '
|
||||
bid_link(container)
|
||||
else
|
||||
Rails.logger.error "ERROR: attachment type unkown"
|
||||
[link_to('unkown', '')]
|
||||
end
|
||||
end
|
||||
|
||||
def project_link project
|
||||
if project.nil?
|
||||
Rails.logger.error "ERROR: attachment type unkown #project_link project.nil?"
|
||||
return [link_to('unkown', '')]
|
||||
end
|
||||
project_list = nil
|
||||
if project.project_type == 0
|
||||
project_list = link_to l(:label_project_plural), projects_path
|
||||
else
|
||||
project_list = link_to l(:label_new_course), course_path
|
||||
end
|
||||
project_item = link_to project.to_s, project_path(project)
|
||||
[project_list, project_item]
|
||||
end
|
||||
|
||||
def bid_link bid
|
||||
bid_list = nil
|
||||
bid_item = nil
|
||||
case bid.reward_type
|
||||
when 1 # 众包
|
||||
bid_list = link_to l(:label_requirement_enterprise_list), calls_path
|
||||
bid_item = link_to bid.name, respond_path(bid)
|
||||
when 2 # 竞赛
|
||||
bid_list = link_to l(:label_contest_list), contest_path
|
||||
bid_item = link_to bid.name, respond_path(bid)
|
||||
when 3 # 作业
|
||||
if bid.courses.first.nil?
|
||||
Rails.logger.error "ERROR: attachment type unkown #bid_link/when 3"
|
||||
return [link_to('unkown', '#')]
|
||||
end
|
||||
bid_list = link_to l(:label_homework), project_homework_path(bid.courses.first)
|
||||
bid_item = link_to bid.name, respond_path(bid)
|
||||
return project_link(bid.courses.first).push(bid_list, bid_item)
|
||||
else
|
||||
xxx
|
||||
end
|
||||
[bid_list, bid_item]
|
||||
end
|
||||
end
|
|
@ -66,7 +66,7 @@ module WelcomeHelper
|
|||
begin
|
||||
grade = project.project_status.grade if project && project.project_status
|
||||
rescue Exception => e
|
||||
logger.error "[WelcomeHelper] ===> #{e}"
|
||||
logger.error "Logger.Error [WelcomeHelper] ===> #{e}"
|
||||
end
|
||||
"项目评分:".html_safe << grade.to_s
|
||||
end
|
||||
|
|
|
@ -20,6 +20,7 @@ require "fileutils"
|
|||
|
||||
class Attachment < ActiveRecord::Base
|
||||
belongs_to :container, :polymorphic => true
|
||||
belongs_to :project, foreign_key: 'container_id', conditions: "attachments.container_type = 'Project'"
|
||||
belongs_to :author, :class_name => "User", :foreign_key => "author_id"
|
||||
|
||||
validates_presence_of :filename, :author
|
||||
|
|
|
@ -150,6 +150,8 @@ class Project < ActiveRecord::Base
|
|||
where("LOWER(identifier) LIKE :p OR LOWER(name) LIKE :p ", :p => pattern)
|
||||
end
|
||||
}
|
||||
scope :project_entities, -> { where(project_type: 0) }
|
||||
scope :course_entities, -> { where(project_type: 1) }
|
||||
|
||||
def new_course
|
||||
self.where('project_type = ?', 1)
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
<!-- huang-->
|
||||
<!-- modified by huang -->
|
||||
<div class="top-content">
|
||||
<%= form_tag(:controller => 'bids', :action => 'contest', :method => :get) do %>
|
||||
<table width="940px">
|
||||
|
@ -28,7 +26,6 @@
|
|||
</table>
|
||||
<% end %>
|
||||
</div>
|
||||
<!-- end -->
|
||||
|
||||
|
||||
|
||||
|
@ -46,6 +43,9 @@
|
|||
<!-- </ul>
|
||||
</div> -->
|
||||
<% if @bids.size > 0%>
|
||||
<div class="project_acts">
|
||||
|
||||
</div>
|
||||
<%= sort_contest(@s_state)%>
|
||||
<div id="bid-show">
|
||||
<%= render :partial => 'contest_show', :locals => {:bids => @bids, :bid_pages => @bid_pages} %>
|
||||
|
|
|
@ -1,4 +1,59 @@
|
|||
<!-- <h3> --><!-- %=l(:label_attachment_plural)%></h3 -->
|
||||
<style>
|
||||
table {
|
||||
line-height: 20px;
|
||||
font-size: 14px;
|
||||
}
|
||||
#ver-zebra
|
||||
{
|
||||
font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
|
||||
font-size: 12px;
|
||||
margin: 20px;
|
||||
width: 98%;
|
||||
text-align: left;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
#ver-zebra th
|
||||
{
|
||||
font-size: 14px;
|
||||
font-weight: normal;
|
||||
padding: 12px 15px;
|
||||
border-right: 1px solid #fff;
|
||||
border-left: 1px solid #fff;
|
||||
color: #039;
|
||||
text-align: left;
|
||||
}
|
||||
#ver-zebra td
|
||||
{
|
||||
padding: 8px 15px;
|
||||
border-right: 1px solid #fff;
|
||||
border-left: 1px solid #fff;
|
||||
color: #669;
|
||||
}
|
||||
.vzebra-odd
|
||||
{
|
||||
background: #eff2ff;
|
||||
}
|
||||
.vzebra-even
|
||||
{
|
||||
background: #e8edff;
|
||||
}
|
||||
#ver-zebra #vzebra-adventure, #ver-zebra #vzebra-children
|
||||
{
|
||||
background: #ffffff;
|
||||
border-bottom: 1px solid #c8d4fd;
|
||||
}
|
||||
#ver-zebra #vzebra-comedy, #ver-zebra #vzebra-action
|
||||
{
|
||||
background: #ffffff;
|
||||
border-bottom: 1px solid #d6dfff;
|
||||
}
|
||||
.filename{
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="content-title-top">
|
||||
<% if @project.project_type == 1 %>
|
||||
|
@ -14,32 +69,38 @@
|
|||
|
||||
<% delete_allowed = User.current.allowed_to?(:manage_files, @project) %>
|
||||
|
||||
<table class="list files">
|
||||
<table class="list files" id="ver-zebra">
|
||||
<colgroup>
|
||||
<col class="vzebra-odd" />
|
||||
<col class="vzebra-even" />
|
||||
<col class="vzebra-odd" />
|
||||
<col class="vzebra-even" />
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<%= sort_header_tag('filename', :caption => l(:field_filename)) %>
|
||||
<%= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc') %>
|
||||
<%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc') %>
|
||||
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc') %>
|
||||
<%= sort_header_tag('description', :caption => l(:field_description)) %>
|
||||
<th></th>
|
||||
<%= sort_header_tag('filename', :caption => l(:field_filename), :scope =>"col" , :id => "vzebra-adventure")%>
|
||||
<%= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc', :scope =>"col" , :id => "vzebra-comedy")%>
|
||||
<%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope =>"col", :id=> "vzebra-children")%>
|
||||
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope =>"col", :id => "vzebra-action") %>
|
||||
<%= sort_header_tag('downloads', :caption => "操作", :scope =>"col", :id => "vzebra-children") %>
|
||||
<!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> -->
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<% @containers.each do |container| %>
|
||||
<% next if container.attachments.empty? -%>
|
||||
<% if container.is_a?(Version) -%>
|
||||
<tr>
|
||||
<th colspan="6" align="left">
|
||||
<%= link_to(h(container), {:controller => 'versions', :action => 'show', :id => container}, :class => "icon icon-package") %>
|
||||
<th colspan="6" align="left" style="line-height: 30px; font-size: 14px; ">
|
||||
<%= link_to(h(container), {:controller => 'versions', :action => 'show', :id => container}, :class => "icon icon-package", :style => "color: #666666;") %>
|
||||
</th>
|
||||
</tr>
|
||||
<% end -%>
|
||||
<% container.attachments.each do |file| %>
|
||||
<tr class="file <%= cycle("odd", "even") %>">
|
||||
<td class="filename"><%= link_to_attachment file, :download => true, :title => file.description %></td>
|
||||
<td class="filename" style="font-size: 13px; max-width: 240px; "><%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %></td>
|
||||
<td class="created_on"><%= format_time(file.created_on) %></td>
|
||||
<td class="filesize"><%= number_to_human_size(file.filesize) %></td>
|
||||
<td class="downloads"><%= file.downloads %></td>
|
||||
<td class="digest" width="300px"><%= file.description %></td>
|
||||
<!-- <td class="digest" width="300px"><%= file.description %></td> -->
|
||||
<td align="center">
|
||||
<%= link_to(image_tag('delete.png'), attachment_path(file),
|
||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<html lang="<%= current_language %>">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<title><%= h html_title %></title>
|
||||
<meta name="description" content="<%= Redmine::Info.app_name %>" />
|
||||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
|
@ -38,10 +39,11 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 8px"><%= link_to stores_url , stores_url %></td>
|
||||
<td><p class="top-content-list"><%=link_to l(:label_home),home_path %> > <%=link_to l(:label_course_file),:controller => 'projects', :action => 'index', :project_type => 0 %> > <%=link_to @project, '' %></p></td>
|
||||
<td><p class="top-content-list"><%=link_to l(:label_home),home_path %> > <%=link_to l(:label_course_file),stores_url %> </p></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<%= render_flash_messages %>
|
||||
<div id="top_field">
|
||||
<%= yield :top_field %>
|
||||
</div>
|
||||
|
@ -50,7 +52,6 @@
|
|||
<%= view_layouts_base_sidebar_hook_response %>
|
||||
</div>
|
||||
<div id="store_content" style="padding-top: 0px;">
|
||||
<%= render_flash_messages %>
|
||||
<%= yield %>
|
||||
<%= call_hook :view_layouts_base_content %>
|
||||
</div>
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %>
|
||||
<% end %>
|
||||
|
||||
<!-- modified by huang -->
|
||||
<div class="top-content">
|
||||
<%= form_tag(:controller => 'projects', :action => 'search', :method => :get) do %>
|
||||
<table width="940px">
|
||||
|
@ -30,8 +29,13 @@
|
|||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
</div>
|
||||
<!-- end -->
|
||||
</div>
|
||||
<!-- activity box -->
|
||||
<div class="project_acts">
|
||||
<div class="project_acts_left"></div>
|
||||
<div class="project_acts_right">aaaa</div>
|
||||
</div>
|
||||
<div class="clear_both"></div>
|
||||
|
||||
<%= sort_course(@s_type, @project_type)%>
|
||||
|
||||
|
|
|
@ -2,12 +2,11 @@
|
|||
<%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %>
|
||||
<% end %>
|
||||
|
||||
<!-- modified by huang -->
|
||||
<div class="top-content">
|
||||
<%= form_tag(:controller => 'projects', :action => "search", :method => :get) do %>
|
||||
<table width="940px">
|
||||
<tr>
|
||||
<td class="info_font" style="width: 220px; color: #15bccf""><%= l(:label_project_deposit) %></td>
|
||||
<td class="info_font" style="width: 220px; color: #15bccf"><%= l(:label_project_deposit) %></td>
|
||||
<td class="location-list"><strong><%= l(:label_user_location) %> :</strong></td>
|
||||
<td rowspan="2">
|
||||
<% if User.current.logged? %>
|
||||
|
@ -28,9 +27,12 @@
|
|||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
</div>
|
||||
<!-- end -->
|
||||
|
||||
</div>
|
||||
<div class="project_acts ">
|
||||
<div class="project_acts_left"></div>
|
||||
<div class="project_acts_right">a</div>
|
||||
</div>
|
||||
<div class="clear_both"></div>
|
||||
<%= sort_project(@s_type, @project_type) %>
|
||||
<div id="projects-index">
|
||||
<%= render_project_hierarchy(@projects)%>
|
||||
|
|
|
@ -1,84 +1,34 @@
|
|||
<style type="text/css">
|
||||
#main *{
|
||||
/*border: 1px solid #eeeeee;*/
|
||||
}
|
||||
#content {
|
||||
max-width: 100%;
|
||||
}
|
||||
#top_field {
|
||||
max-width: 100%;
|
||||
margin: 20px auto;
|
||||
}
|
||||
.line_block{
|
||||
display: inline-block;
|
||||
width: 49%;
|
||||
margin: 10px auto;
|
||||
padding: 0px 2%;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
-box-sizing: border-box;
|
||||
}
|
||||
.resource_sum{
|
||||
height: auto;
|
||||
}
|
||||
.line_block p{
|
||||
margin: 1em 0px auto;
|
||||
background: linear-gradient(#ffffff, #e5e5e5) repeat scroll 0% 0% transparent;
|
||||
border-bottom: 1px solid rgb(226,226,226);
|
||||
border-top-left-radius : 6px;
|
||||
border-top-right-radius : 6px;
|
||||
box-shadow: 0px 1px 0px white, 0px, -1px 0px rgb(245,245,245);
|
||||
height: 39px;
|
||||
font-size: 15px;
|
||||
line-height: 26px;
|
||||
height: 30px;
|
||||
font-size: 1.5em;
|
||||
padding-left: 4%;
|
||||
border-bottom: 2px solid #FF661B
|
||||
}
|
||||
.resource_sum, .line_blo{
|
||||
border: 1px solid #eeeeee;
|
||||
}
|
||||
.line_block table{
|
||||
border: 1px solid #eeeeee;
|
||||
}
|
||||
.line_block table thead tr{
|
||||
background-color: #d1d1d1;
|
||||
}
|
||||
.line_block table td{
|
||||
height: 2em;
|
||||
}
|
||||
</style>
|
||||
|
||||
<% content_for :top_field do%>
|
||||
<div style="margin: 10px 5%;">
|
||||
<%= form_for('#', :remote => true) do |f| %>
|
||||
<%= f.text_field :name, size:"100", placeholder:'请输入要搜索的关键字' %>
|
||||
<%= f.submit value:"search", class:"whiteButton m3p10 h30"%>
|
||||
<div style="margin: 10px 5%;vertical-align: bottom;">
|
||||
<%= form_tag( search_stores_path, method: 'post') do %>
|
||||
<%= text_field_tag 'name', nil, size:"100", placeholder:'请输入要搜索的关键字', :class => 'blueinputbar', :required => true %>
|
||||
<%= submit_tag l(:label_search), :class => "enterprise"%>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% content_for :sidebar do%>
|
||||
this is sidebar in index.html.erb
|
||||
<% end %>
|
||||
|
||||
<div class="resource_sum">
|
||||
<% 4.times do |c|%>
|
||||
<% @attach_array.each do |k|%>
|
||||
<div class="line_block">
|
||||
<p>热门<%=c%></p>
|
||||
<p>
|
||||
<%= @str_arr.shift %>
|
||||
</p>
|
||||
<table style="width: 100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>文件名</td>
|
||||
<td>下载次数</td>
|
||||
<td><%=l(:label_attachment)%></td>
|
||||
<td><%=l(:field_downloads)%></td>
|
||||
<td><%=l(:button_download)%></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% 5.times do |c1|%>
|
||||
<% k.each do |c1|%>
|
||||
<tr class="<%= cycle 'odd', 'even' %>">
|
||||
<td style="width:62%;"><%=c1%></td>
|
||||
<td style="width:38%;"><%=c1%> ti</td>
|
||||
<td class="filename" style="width:62%;"><%= link_to c1.filename, (attachFromUrl c1), {:title => c1.filename, :target => "_blank"} %> </td>
|
||||
<td style="width:19%; text-align: center;"><%= c1.downloads %> </td>
|
||||
<td class="filename download_icon" style="width:19%; text-align: center;">
|
||||
<%= link_to_attachment c1, {:text => image_tag("/images/button/download.png", width: "22px", alt: "l(:button_download)") }%>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
@ -86,3 +36,15 @@
|
|||
</div>
|
||||
<% reset_cycle; end %>
|
||||
</div>
|
||||
<script type='text/javascript'>
|
||||
$(document).ready(function($) {
|
||||
$('.download_icon').each(function(){
|
||||
$(this).mouseenter(function(event) {
|
||||
$(this).find('img').attr("src", "/images/button/download_focus.png")
|
||||
});
|
||||
$(this).mouseleave(function(event) {
|
||||
$(this).find('img').attr("src", "/images/button/download.png")
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,80 @@
|
|||
<style type="text/css">
|
||||
|
||||
</style>
|
||||
<% content_for :top_field do%>
|
||||
<div style="margin: 10px 5%;">
|
||||
<%= form_tag( search_stores_path, method: 'post') do %>
|
||||
<%= text_field_tag 'name', nil, size:"100", placeholder:'请输入要搜索的关键字', :value => params[:name] , :class => 'blueinputbar', :required => true %>
|
||||
<%= submit_tag l(:label_search), :class => "enterprise"%>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% @searched_attach.each do |result| %>
|
||||
|
||||
<table border=0 cellSpacing=0 cellPadding=0>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="r1">
|
||||
<div class="cb">
|
||||
<span style=""><%= result.filename %></span>
|
||||
<span style="margin-left: 4px;">
|
||||
<%= link_to_attachment result, {:text => image_tag("/images/button/dl.png", width: "70px", alt: l(:button_download), :class => 'download_icon')}%>
|
||||
</span>
|
||||
</div>
|
||||
<%= result.description %>
|
||||
<div class="c9 gray-color"> 所属分类:<%=result_come_from result%> </div>
|
||||
<span class="gray blue-color">
|
||||
下载:<%= result.downloads%>|
|
||||
大小:<%= number_to_human_size(result.filesize) %>|
|
||||
共享者:<a class="gray" ><%= link_to result.author, user_path(result.author), target: "_blank"%></a>|
|
||||
上传时间:<%= format_time(result.created_on) %>
|
||||
</span>
|
||||
<div style="display: none"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<% end %>
|
||||
<div class="pagination"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %></div>
|
||||
<script type='text/javascript'>
|
||||
jQuery.fn.highlight = function(pat) {
|
||||
function innerHighlight(node, pat) {
|
||||
var skip = 0;
|
||||
if (node.nodeType == 3) {
|
||||
var pos = node.data.toUpperCase().indexOf(pat);
|
||||
if (pos >= 0) {
|
||||
var spannode = document.createElement('span');
|
||||
spannode.className = 'highlight';
|
||||
var middlebit = node.splitText(pos);
|
||||
var endbit = middlebit.splitText(pat.length);
|
||||
var middleclone = middlebit.cloneNode(true);
|
||||
spannode.appendChild(middleclone);
|
||||
middlebit.parentNode.replaceChild(spannode, middlebit);
|
||||
skip = 1;
|
||||
}
|
||||
}
|
||||
else if (node.nodeType == 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) {
|
||||
for (var i = 0; i < node.childNodes.length; ++i) {
|
||||
i += innerHighlight(node.childNodes[i], pat);
|
||||
}
|
||||
}
|
||||
return skip;
|
||||
}
|
||||
return this.each(function() {
|
||||
innerHighlight(this, pat.toUpperCase());
|
||||
});
|
||||
};
|
||||
$(document).ready(function($) {
|
||||
$('.cb span').highlight('<%=params[:name]%>');
|
||||
|
||||
$('.a_download_icon').each(function(){
|
||||
$(this).mouseenter(function(event) {
|
||||
$(this).attr("src", "/images/button/download_focus.png")
|
||||
});
|
||||
$(this).mouseleave(function(event) {
|
||||
$(this).attr("src", "/images/button/download.png")
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -16,7 +16,12 @@
|
|||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
RedmineApp::Application.routes.draw do
|
||||
resources :stores
|
||||
resources :stores do
|
||||
collection do
|
||||
match 'search', via: [:get, :post]
|
||||
end
|
||||
end
|
||||
|
||||
resources :forums do
|
||||
collection do
|
||||
match 'search_forum', :via => [:get, :post]
|
||||
|
|
|
@ -204,6 +204,7 @@ Redmine::MenuManager.map :top_menu do |menu|
|
|||
menu.push :contest_innovate, {:controller => 'bids', :action => 'contest', :project_type => 1}
|
||||
menu.push :requirement_enterprise, {:controller => 'bids', :action => 'index'}
|
||||
menu.push :project_module_forums, :forums_path
|
||||
menu.push :course_file, :stores_path
|
||||
|
||||
|
||||
# menu.push :investor, :home_path
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 41 KiB |
Binary file not shown.
After Width: | Height: | Size: 41 KiB |
|
@ -11,6 +11,26 @@
|
|||
.ph10_5{ /*padding horizontal 10% 5%*/
|
||||
padding: 0px 5% 0px 10%;
|
||||
}
|
||||
.clear_both{
|
||||
clear: both;
|
||||
}
|
||||
.highlight {
|
||||
background-color: #fff34d;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
-moz-box-shadow: 0px 1px 2px rgba(0,0,0,0.7);
|
||||
-webkit-box-shadow: 0px 1px 2px rgba(0,0,0,0.7);
|
||||
box-shadow: 0px 1px 2px rgba(0,0,0,0.7);
|
||||
color: #cc0033;
|
||||
/*padding: 1px 3px;*/
|
||||
/*margin: 0 -4px;*/
|
||||
filter: alpha(opacity=70);
|
||||
-moz-opacity: 0.7;
|
||||
-webkit-opacity: 0.7;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
* {
|
||||
font-family: Helvetica, Tahoma, Arial, "Microsoft YaHei", "微软雅黑", SimSun, "宋体", STXihei, "华文细黑", Heiti, "黑体", sans-serif;
|
||||
}
|
||||
|
@ -341,3 +361,137 @@ table.content-text-list tbody tr td.locked, div.memo-section .locked{
|
|||
font-size: 1.5em;
|
||||
padding-left: 4%;
|
||||
}
|
||||
/* xx动态框
|
||||
*******************************************************************************/
|
||||
.project_acts *{border:1px solid #000000;}
|
||||
.project_acts{
|
||||
height: 250px;
|
||||
|
||||
}
|
||||
.project_acts .project_acts_left{
|
||||
float: left;
|
||||
height: 100%;
|
||||
width: 61%;
|
||||
}
|
||||
.project_acts .project_acts_right{
|
||||
height: 100%;
|
||||
margin-left: 61%;
|
||||
}
|
||||
/* stores 资源库
|
||||
*******************************************************************************/
|
||||
.line_block {
|
||||
display: inline-block;
|
||||
width: 49%;
|
||||
margin: 10px auto;
|
||||
vertical-align: top;
|
||||
padding: 0px 2%;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
-box-sizing: border-box;
|
||||
}
|
||||
.resource_sum{
|
||||
height: auto;
|
||||
}
|
||||
.line_block p{
|
||||
margin: 1em 0px auto;
|
||||
/*background: linear-gradient(#ffffff, #e5e5e5) repeat scroll 0% 0% transparent;*/
|
||||
border-bottom: 1px solid rgb(226,226,226);
|
||||
border-top-left-radius : 6px;
|
||||
border-top-right-radius : 6px;
|
||||
box-shadow: 0px 1px 0px white, 0px, -1px 0px rgb(245,245,245);
|
||||
height: 39px;
|
||||
font-size: 15px;
|
||||
line-height: 26px;
|
||||
height: 30px;
|
||||
font-size: 1.5em;
|
||||
padding-left: 4%;
|
||||
border-bottom: 1px solid rgb(21, 165, 200);
|
||||
}
|
||||
.resource_sum, .line_blo{
|
||||
border: 1px solid #eeeeee;
|
||||
}
|
||||
.line_block table{
|
||||
border: 1px solid #eeeeee;
|
||||
}
|
||||
.line_block table thead tr{
|
||||
/*background-color: #d1d1d1;*/
|
||||
text-align: center;
|
||||
}
|
||||
.line_block table td{
|
||||
height: 2em;
|
||||
}
|
||||
.filename {
|
||||
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 247px;
|
||||
}
|
||||
.blue-color, .blue-color a{
|
||||
color: rgb(109,153,178);
|
||||
}
|
||||
.gray-color, .gray-color a{
|
||||
color: rgb(153,153,153);
|
||||
}
|
||||
#top_field {
|
||||
max-width: 100%;
|
||||
margin: 20px auto;
|
||||
}
|
||||
.blueinputbar{
|
||||
-o-transform-origin: 138px 46.5px;
|
||||
-o-transition: background 0.2s cubic-bezier(0, 0, 1, 1);
|
||||
-webkit-border-bottom-left-radius: 3px;
|
||||
-webkit-border-bottom-right-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
-webkit-border-top-left-radius: 3px;
|
||||
-webkit-border-top-right-radius: 3px;
|
||||
-webkit-transform-origin: 138px 46.5px;
|
||||
-webkit-transition: background 0.2s cubic-bezier(0, 0, 1, 1);
|
||||
-webkit-transition-delay: 0;
|
||||
-webkit-transition-duration: 0.2s;
|
||||
-webkit-transition-property: background;
|
||||
-webkit-transition-timing-function: cubic-bezier(0, 0, 1, 1);
|
||||
align-content: stretch;
|
||||
align-items: stretch;
|
||||
align-self: stretch;
|
||||
background: #FFFFFF;
|
||||
border-bottom: 1px solid #56B4EF;
|
||||
border-left: 1px solid #56B4EF;
|
||||
border-radius: 3px;
|
||||
border-right: 1px solid #56B4EF;
|
||||
border-top: 1px solid #56B4EF;
|
||||
color: #333333;
|
||||
justify-content: flex-start;
|
||||
margin: 0px;
|
||||
order: 0;
|
||||
outline: #333333 0px;
|
||||
overflow-wrap: break-word;
|
||||
resize: none;
|
||||
text-shadow: none;
|
||||
transform-origin: 138px 46.5px;
|
||||
transition: background 0.2s cubic-bezier(0, 0, 1, 1);
|
||||
unicode-bidi: embed;
|
||||
vertical-align: top;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
input.blueinputbar:focus {
|
||||
box-shadow: rgba(0, 0, 0, 0.047) 0px 1px 3px 0px inset, rgba(82, 168, 236, 0.600) 0px 0px 5px 0px;
|
||||
border-bottom: 1px solid #56B4EF;
|
||||
border-left: 1px solid #56B4EF;
|
||||
border-radius: 3px;
|
||||
border-right: 1px solid #56B4EF;
|
||||
border-top: 1px solid #56B4EF;
|
||||
}
|
||||
.r1 {
|
||||
font-size:13px;
|
||||
line-height: 1.7em;
|
||||
overflow-wrap: break-word;
|
||||
padding-bottom: 20px;
|
||||
padding-left: 20px;
|
||||
/*width: 50em;*/
|
||||
}
|
||||
.r1 .cb {
|
||||
font-size: 16px;
|
||||
color: #3333cc;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue