parent
404568be89
commit
d935152ed7
@ -0,0 +1,2 @@
|
||||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
@ -0,0 +1,4 @@
|
||||
/*
|
||||
Place all the styles related to the matching controller here.
|
||||
They will automatically be included in application.css.
|
||||
*/
|
@ -0,0 +1,96 @@
|
||||
class OpenSourceProjectsController < ApplicationController
|
||||
# GET /open_source_projects
|
||||
# GET /open_source_projects.json
|
||||
def index
|
||||
per_page_option = 10
|
||||
|
||||
@open_source_projects = OpenSourceProject.all
|
||||
|
||||
@os_project_count = @open_source_projects.count
|
||||
@os_project_pages = Paginator.new @os_project_count, per_page_option, params['page']
|
||||
|
||||
@open_source_projects = OpenSourceProject.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @open_source_projects }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /open_source_projects/1
|
||||
# GET /open_source_projects/1.json
|
||||
def show
|
||||
@open_source_project = OpenSourceProject.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
render :layout => "base_opensource_p"
|
||||
}
|
||||
format.json { render json: @open_source_project }
|
||||
end
|
||||
end
|
||||
|
||||
def search
|
||||
|
||||
end
|
||||
|
||||
# GET /open_source_projects/new
|
||||
# GET /open_source_projects/new.json
|
||||
def new
|
||||
@open_source_project = OpenSourceProject.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @open_source_project }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /open_source_projects/1/edit
|
||||
def edit
|
||||
@open_source_project = OpenSourceProject.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /open_source_projects
|
||||
# POST /open_source_projects.json
|
||||
def create
|
||||
@open_source_project = OpenSourceProject.new(params[:open_source_project])
|
||||
|
||||
respond_to do |format|
|
||||
if @open_source_project.save
|
||||
format.html { redirect_to @open_source_project, notice: 'Open source project was successfully created.' }
|
||||
format.json { render json: @open_source_project, status: :created, location: @open_source_project }
|
||||
else
|
||||
format.html { render action: "new" }
|
||||
format.json { render json: @open_source_project.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /open_source_projects/1
|
||||
# PUT /open_source_projects/1.json
|
||||
def update
|
||||
@open_source_project = OpenSourceProject.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @open_source_project.update_attributes(params[:open_source_project])
|
||||
format.html { redirect_to @open_source_project, notice: 'Open source project was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
format.html { render action: "edit" }
|
||||
format.json { render json: @open_source_project.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /open_source_projects/1
|
||||
# DELETE /open_source_projects/1.json
|
||||
def destroy
|
||||
@open_source_project = OpenSourceProject.find(params[:id])
|
||||
@open_source_project.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to open_source_projects_url }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,14 @@
|
||||
module OpenSourceProjectsHelper
|
||||
def render_opensource_project(os_projects)
|
||||
s=''
|
||||
s << "<ul class='projects'>\n"
|
||||
os_projects.each do |project|
|
||||
s << "<li class='project-table'><div class='#{classes}'>"
|
||||
s << "div class='root'"
|
||||
|
||||
s << "</div>\n"
|
||||
s << "</li>\n"
|
||||
end
|
||||
s << "</ul>"
|
||||
end
|
||||
end
|
@ -0,0 +1,6 @@
|
||||
class OpenSourceProject < ActiveRecord::Base
|
||||
attr_accessible :String
|
||||
def short_description(length = 255)
|
||||
description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
|
||||
end
|
||||
end
|
@ -0,0 +1,21 @@
|
||||
<%= form_for(@open_source_project) do |f| %>
|
||||
<% if @open_source_project.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<h2><%= pluralize(@open_source_project.errors.count, "error") %> prohibited this open_source_project from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<% @open_source_project.errors.full_messages.each do |msg| %>
|
||||
<li><%= msg %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :String %><br />
|
||||
<%= f.text_field :String %>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<%= f.submit %>
|
||||
</div>
|
||||
<% end %>
|
@ -0,0 +1,56 @@
|
||||
<!--Added by nie-->
|
||||
<div class="project-block">
|
||||
<div class="img-tag">
|
||||
图片
|
||||
</div>
|
||||
<div class="wiki-description">
|
||||
<p>
|
||||
<%= textilizable(project.short_description, :project => project) %>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="information">
|
||||
<p class="stats">
|
||||
<strong><span style="font-size: 17px;margin-left: 145px">
|
||||
<%= 1%></span></strong>
|
||||
<%= content_tag('span', l(:label_x_follow_people,:count =>0)) %>
|
||||
</p>
|
||||
<p class="stats">
|
||||
<strong><span style="font-size: 17px;margin-left: 145px">
|
||||
<%= 1%></span></strong>
|
||||
<%= content_tag('span', l(:label_x_current_contributors, :count => 0)) %>
|
||||
</p>
|
||||
<p class="stats">
|
||||
<strong><span style="font-size: 17px;margin-left: 145px">
|
||||
<%= 1 %></span></strong>
|
||||
<%= content_tag('span', l(:label_since_last_commits)) %>
|
||||
</p>
|
||||
<p class="stats">
|
||||
<strong><span style="font-size: 17px;margin-left: 145px">
|
||||
<%= 1 %></span></strong>
|
||||
<%= content_tag('span', l(:label_commit_on)) %>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="add-info">
|
||||
<div class="main-language">
|
||||
|
||||
<%= content_tag('span', "#{l(:default_role_manager)}: ") %>
|
||||
|
||||
</div>
|
||||
<div class="licences">
|
||||
<%= content_tag('span', "#{l(:label_create_time)}: ") %><%= content_tag('span', format_time(project.created_at)) %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="tags">
|
||||
<!-- added by william -for tag -->
|
||||
<div id="tags">
|
||||
|
||||
<%= image_tag( "/images/sidebar/tags.png") %>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,6 @@
|
||||
<h1>Editing open_source_project</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Show', @open_source_project %> |
|
||||
<%= link_to 'Back', open_source_projects_path %>
|
@ -0,0 +1,45 @@
|
||||
<div class="top-content">
|
||||
<%= form_tag(:controller => 'open_source_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="location-list"><strong><%= l(:label_user_location) %> :</strong></td>
|
||||
<td rowspan="2"></td>
|
||||
<td rowspan="2" >
|
||||
<div class="project-search" style="float: right">
|
||||
<%= text_field_tag 'name', params[:name], :size => 30 %>
|
||||
<%= hidden_field_tag 'project_type', params[:project_type] %>
|
||||
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
||||
</div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 8px"><a><%= link_to request.host()+"/projects", :controller => 'projects', :action => 'index', :project_type => 0 %> </a></td>
|
||||
<td ><%= link_to l(:field_homepage), home_path %> > <%= link_to l(:label_project_deposit), :controller => 'projects', :action => 'index', :project_type => 0 %></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div id="projects-index">
|
||||
|
||||
<ul class='projects'>
|
||||
<% @open_source_projects.each do |project| %>
|
||||
<li class='project-table'>
|
||||
<div class = 'root'>
|
||||
<%= link_to project.name, open_source_projects_path(project), :class=>"project root leaf"%>
|
||||
<span style="float: right;"></span>
|
||||
<%= render :partial => 'open_source_projects/os_project', :locals => {:project => project}%>
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="pagination">
|
||||
<ul>
|
||||
<%= pagination_links_full @os_project_pages, @os_project_count %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_project_plural)) -%>
|
||||
|
@ -0,0 +1,5 @@
|
||||
<h1>New open_source_project</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Back', open_source_projects_path %>
|
@ -0,0 +1,10 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<p>
|
||||
<b>String:</b>
|
||||
<%= @open_source_project.name %>
|
||||
</p>
|
||||
|
||||
|
||||
<%= link_to 'Edit', edit_open_source_project_path(@open_source_project) %> |
|
||||
<%= link_to 'Back', open_source_projects_path %>
|
@ -0,0 +1,15 @@
|
||||
class CreateOpenSourceProjects < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :open_source_projects do |t|
|
||||
t.column "name", :string, :default => nil, :null => true
|
||||
t.column "description", :string, :default => '', :null => true
|
||||
t.column "commit_count", :integer, :default => 0
|
||||
t.column "code_line", :integer, :default => 0
|
||||
t.column "users_count",:integer, :default => 0
|
||||
t.column "last_commit_time", :date, :null => true
|
||||
t.column "url", :string, :default => nil, :null => true
|
||||
t.column "date_collected", :date, :null => true
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,11 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||
|
||||
one:
|
||||
act_id:
|
||||
act_type: MyString
|
||||
user_id:
|
||||
|
||||
two:
|
||||
act_id:
|
||||
act_type: MyString
|
||||
user_id:
|
@ -0,0 +1,11 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||
|
||||
# This model initially had no columns defined. If you add columns to the
|
||||
# model remove the '{}' from the fixture names and add the columns immediately
|
||||
# below each fixture, per the syntax in the comments below
|
||||
#
|
||||
one: {}
|
||||
# column: value
|
||||
#
|
||||
two: {}
|
||||
# column: value
|
@ -0,0 +1,11 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||
|
||||
one:
|
||||
journal_id: 1
|
||||
user_id: 1
|
||||
reply_id: 1
|
||||
|
||||
two:
|
||||
journal_id: 1
|
||||
user_id: 1
|
||||
reply_id: 1
|
@ -0,0 +1,7 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||
|
||||
one:
|
||||
String:
|
||||
|
||||
two:
|
||||
String:
|
@ -0,0 +1,49 @@
|
||||
require 'test_helper'
|
||||
|
||||
class ForumsControllerTest < ActionController::TestCase
|
||||
setup do
|
||||
@forum = forums(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get :index
|
||||
assert_response :success
|
||||
assert_not_nil assigns(:forums)
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
get :new
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create forum" do
|
||||
assert_difference('Forum.count') do
|
||||
post :create, forum: { }
|
||||
end
|
||||
|
||||
assert_redirected_to forum_path(assigns(:forum))
|
||||
end
|
||||
|
||||
test "should show forum" do
|
||||
get :show, id: @forum
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
get :edit, id: @forum
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update forum" do
|
||||
put :update, id: @forum, forum: { }
|
||||
assert_redirected_to forum_path(assigns(:forum))
|
||||
end
|
||||
|
||||
test "should destroy forum" do
|
||||
assert_difference('Forum.count', -1) do
|
||||
delete :destroy, id: @forum
|
||||
end
|
||||
|
||||
assert_redirected_to forums_path
|
||||
end
|
||||
end
|
@ -0,0 +1,49 @@
|
||||
require 'test_helper'
|
||||
|
||||
class OpenSourceProjectsControllerTest < ActionController::TestCase
|
||||
setup do
|
||||
@open_source_project = open_source_projects(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get :index
|
||||
assert_response :success
|
||||
assert_not_nil assigns(:open_source_projects)
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
get :new
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create open_source_project" do
|
||||
assert_difference('OpenSourceProject.count') do
|
||||
post :create, open_source_project: { String: @open_source_project.String }
|
||||
end
|
||||
|
||||
assert_redirected_to open_source_project_path(assigns(:open_source_project))
|
||||
end
|
||||
|
||||
test "should show open_source_project" do
|
||||
get :show, id: @open_source_project
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
get :edit, id: @open_source_project
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update open_source_project" do
|
||||
put :update, id: @open_source_project, open_source_project: { String: @open_source_project.String }
|
||||
assert_redirected_to open_source_project_path(assigns(:open_source_project))
|
||||
end
|
||||
|
||||
test "should destroy open_source_project" do
|
||||
assert_difference('OpenSourceProject.count', -1) do
|
||||
delete :destroy, id: @open_source_project
|
||||
end
|
||||
|
||||
assert_redirected_to open_source_projects_path
|
||||
end
|
||||
end
|
@ -0,0 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
class ActivityTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
@ -0,0 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
class ForumTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
@ -0,0 +1,4 @@
|
||||
require 'test_helper'
|
||||
|
||||
class ForumsHelperTest < ActionView::TestCase
|
||||
end
|
@ -0,0 +1,4 @@
|
||||
require 'test_helper'
|
||||
|
||||
class OpenSourceProjectsHelperTest < ActionView::TestCase
|
||||
end
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue