开源项目基本框架完成
This commit is contained in:
parent
d381423c0e
commit
6fdb037b6b
|
@ -17,12 +17,14 @@ class OpenSourceProjectsController < ApplicationController
|
|||
@created_at = params[:created_at]
|
||||
per_page_option = 10
|
||||
|
||||
@open_source_projects = OpenSourceProject.all
|
||||
@open_source_projects = OpenSourceProject.filter(@app_dir, @language, @created_at)
|
||||
|
||||
@os_project_count = @open_source_projects.count
|
||||
@os_project_pages = Paginator.new @os_project_count, per_page_option, params['page']
|
||||
|
||||
@open_source_projects = @open_source_projects.offset(@os_project_pages.offset).limit(@os_project_pages.per_page)
|
||||
|
||||
@open_source_projects = OpenSourceProject.all
|
||||
# @open_source_projects = OpenSourceProject.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
|
|
|
@ -19,6 +19,54 @@ class OpenSourceProject < ActiveRecord::Base
|
|||
{ :include => :apply_project_master,
|
||||
:conditions => ["#{ApplyProjectMaster.table_name}.user_id = ?", user_id] }
|
||||
}
|
||||
|
||||
def filter(app_dir, language, created_at)
|
||||
filter_app_dir(app_dir).filter_language(language).filter_time(created_at)
|
||||
end
|
||||
|
||||
def self.filter(app_dir, language, created_at)
|
||||
self.filter_app_dir(app_dir).filter_language(language).filter_time(created_at)
|
||||
end
|
||||
|
||||
scope :filter_app_dir, lambda {|args|
|
||||
nil
|
||||
}
|
||||
|
||||
scope :filter_language, lambda {|*arg|
|
||||
if arg[0].nil?
|
||||
where(nil)
|
||||
else
|
||||
tagged_with(arg).order('updated_at desc')
|
||||
end
|
||||
}
|
||||
|
||||
scope :filter_time, lambda {|args|
|
||||
nil
|
||||
}
|
||||
|
||||
# def filter_app_dir(app_dir)
|
||||
# nil
|
||||
# end
|
||||
#
|
||||
# def self.filter_app_dir(app_dir)
|
||||
# nil
|
||||
# end
|
||||
#
|
||||
# def filter_language(language)
|
||||
# nil
|
||||
# end
|
||||
#
|
||||
# def self.filter_language(language)
|
||||
# nil
|
||||
# end
|
||||
#
|
||||
# def filter_time(created_at)
|
||||
# nil
|
||||
# end
|
||||
#
|
||||
# def self.filter_time(created_at)
|
||||
# nil
|
||||
# end
|
||||
|
||||
|
||||
def short_description(length = 255)
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
<% @open_source_project = OpenSourceProject.find(params[:id])%>
|
||||
<table>
|
||||
<tr>
|
||||
<td><%= image_tag(url_to_avatar(Project.find(2)), :class => 'avatar2') %></td>
|
||||
<td><%= image_tag('../images/avatars/Project/0', :class => 'avatar2') %></td>
|
||||
<td>
|
||||
<div class="info-course">
|
||||
<%= @open_source_project.name %>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div class="project-block">
|
||||
<div class="img-tag">
|
||||
图片
|
||||
<%= image_tag('../images/avatars/Project/0', :class => 'avatar2') %>
|
||||
</div>
|
||||
<div class="wiki-description">
|
||||
<p>
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
<% memos.each do |topic| %>
|
||||
<table class="content-text-list">
|
||||
<tr>
|
||||
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) if topic.author%></td>
|
||||
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) if topic.author%>
|
||||
<%= image_tag('../images/avatars/User/0', :class => "avatar") unless topic.author%> </td>
|
||||
<td>
|
||||
<table width="630px" border="0">
|
||||
<tr>
|
||||
|
|
|
@ -174,10 +174,10 @@ li {
|
|||
</div>
|
||||
<div class="nav-category ">
|
||||
<h4 title="网络类型">开发语言<span>:</span></h4>
|
||||
<%= link_to "java", open_source_projects_path(:language => "java", :app_dir => @app_dir, :created_at => @created_at), :class => "nav-more J_More show" %>
|
||||
<%= link_to "c++", open_source_projects_path(:language => "c++", :app_dir => @app_dir, :created_at => @created_at), :class => "nav-more J_More show" %>
|
||||
<%= link_to "c", open_source_projects_path(:language => "c", :app_dir => @app_dir, :created_at => @created_at), :class => "nav-more J_More show" %>
|
||||
<%= link_to "c#", open_source_projects_path(:language => "c#", :app_dir => @app_dir, :created_at => @created_at), :class => "nav-more J_More show" %>
|
||||
<%= link_to "JAVA", open_source_projects_path(:language => "JAVA", :app_dir => @app_dir, :created_at => @created_at), :class => "nav-more J_More show" %>
|
||||
<%= link_to "C++", open_source_projects_path(:language => "c++", :app_dir => @app_dir, :created_at => @created_at), :class => "nav-more J_More show" %>
|
||||
<%= link_to "C", open_source_projects_path(:language => "c", :app_dir => @app_dir, :created_at => @created_at), :class => "nav-more J_More show" %>
|
||||
<%= link_to "C#", open_source_projects_path(:language => "c#", :app_dir => @app_dir, :created_at => @created_at), :class => "nav-more J_More show" %>
|
||||
<%= link_to "ruby", open_source_projects_path(:language => "ruby", :app_dir => @app_dir, :created_at => @created_at), :class => "nav-more J_More show" %>
|
||||
<%= link_to "其他", open_source_projects_path(:language => "其他", :app_dir => @app_dir, :created_at => @created_at), :class => "nav-more J_More show" %>
|
||||
|
||||
|
|
Loading…
Reference in New Issue