Packages controller added
This commit is contained in:
parent
f28c637d10
commit
c2a695aec0
15 changed files with 110 additions and 1 deletions
3
app/assets/javascripts/packages.js.coffee
Normal file
3
app/assets/javascripts/packages.js.coffee
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Place all the behaviors and hooks related to the matching controller here.
|
||||||
|
# All this logic will automatically be available in application.js.
|
||||||
|
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||||
3
app/assets/stylesheets/packages.css.scss
Normal file
3
app/assets/stylesheets/packages.css.scss
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
// Place all the styles related to the packages controller here.
|
||||||
|
// They will automatically be included in application.css.
|
||||||
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||||
14
app/controllers/packages_controller.rb
Normal file
14
app/controllers/packages_controller.rb
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
class PackagesController < ApplicationController
|
||||||
|
def index
|
||||||
|
@packages = Package.order('name').first(20)
|
||||||
|
end
|
||||||
|
|
||||||
|
def with_screenshots
|
||||||
|
end
|
||||||
|
|
||||||
|
def without_screenshots
|
||||||
|
end
|
||||||
|
|
||||||
|
def moderate
|
||||||
|
end
|
||||||
|
end
|
||||||
2
app/helpers/packages_helper.rb
Normal file
2
app/helpers/packages_helper.rb
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
module PackagesHelper
|
||||||
|
end
|
||||||
2
app/models/package.rb
Normal file
2
app/models/package.rb
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
class Package < ActiveRecord::Base
|
||||||
|
end
|
||||||
10
app/views/packages/index.html.erb
Normal file
10
app/views/packages/index.html.erb
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
<h1>Packages#index</h1>
|
||||||
|
<p>Find me in app/views/packages/index.html.erb</p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<% @packages.each do |package| %>
|
||||||
|
<li>
|
||||||
|
<%= package.name %> <i>(<%= package.description %>)</i>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
2
app/views/packages/moderate.html.erb
Normal file
2
app/views/packages/moderate.html.erb
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
<h1>Packages#moderate</h1>
|
||||||
|
<p>Find me in app/views/packages/moderate.html.erb</p>
|
||||||
2
app/views/packages/with_screenshots.html.erb
Normal file
2
app/views/packages/with_screenshots.html.erb
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
<h1>Packages#with_screenshots</h1>
|
||||||
|
<p>Find me in app/views/packages/with_screenshots.html.erb</p>
|
||||||
2
app/views/packages/without_screenshots.html.erb
Normal file
2
app/views/packages/without_screenshots.html.erb
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
<h1>Packages#without_screenshots</h1>
|
||||||
|
<p>Find me in app/views/packages/without_screenshots.html.erb</p>
|
||||||
|
|
@ -1,9 +1,16 @@
|
||||||
Debshots::Application.routes.draw do
|
Debshots::Application.routes.draw do
|
||||||
|
#get "packages/index"
|
||||||
|
get "packages" => "packages#index"
|
||||||
|
get "packages/with_screenshots"
|
||||||
|
get "packages/without_screenshots"
|
||||||
|
get "packages/moderate"
|
||||||
|
get "welcome/index"
|
||||||
# The priority is based upon order of creation: first created -> highest priority.
|
# The priority is based upon order of creation: first created -> highest priority.
|
||||||
# See how all your routes lay out with "rake routes".
|
# See how all your routes lay out with "rake routes".
|
||||||
|
|
||||||
# You can have the root of your site routed with "root"
|
# You can have the root of your site routed with "root"
|
||||||
# root 'welcome#index'
|
# root 'welcome#index'
|
||||||
|
root to: "welcome#index"
|
||||||
|
|
||||||
# Example of regular route:
|
# Example of regular route:
|
||||||
# get 'products/:id' => 'catalog#view'
|
# get 'products/:id' => 'catalog#view'
|
||||||
|
|
@ -39,7 +46,7 @@ Debshots::Application.routes.draw do
|
||||||
# get 'recent', on: :collection
|
# get 'recent', on: :collection
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
|
|
||||||
# Example resource route with concerns:
|
# Example resource route with concerns:
|
||||||
# concern :toggleable do
|
# concern :toggleable do
|
||||||
# post 'toggle'
|
# post 'toggle'
|
||||||
|
|
|
||||||
24
test/controllers/packages_controller_test.rb
Normal file
24
test/controllers/packages_controller_test.rb
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class PackagesControllerTest < ActionController::TestCase
|
||||||
|
test "should get index" do
|
||||||
|
get :index
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should get with_screenshots" do
|
||||||
|
get :with_screenshots
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should get without_screenshots" do
|
||||||
|
get :without_screenshots
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should get moderate" do
|
||||||
|
get :moderate
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
23
test/fixtures/packages.yml
vendored
Normal file
23
test/fixtures/packages.yml
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||||
|
|
||||||
|
one:
|
||||||
|
name: MyText
|
||||||
|
description: MyString
|
||||||
|
long_description: MyString
|
||||||
|
section: MyString
|
||||||
|
maintainer: MyString
|
||||||
|
maintainer_email: MyString
|
||||||
|
homepage: MyString
|
||||||
|
version: MyString
|
||||||
|
origin: MyString
|
||||||
|
|
||||||
|
two:
|
||||||
|
name: MyText
|
||||||
|
description: MyString
|
||||||
|
long_description: MyString
|
||||||
|
section: MyString
|
||||||
|
maintainer: MyString
|
||||||
|
maintainer_email: MyString
|
||||||
|
homepage: MyString
|
||||||
|
version: MyString
|
||||||
|
origin: MyString
|
||||||
4
test/helpers/packages_helper_test.rb
Normal file
4
test/helpers/packages_helper_test.rb
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class PackagesHelperTest < ActionView::TestCase
|
||||||
|
end
|
||||||
4
test/helpers/welcome_helper_test.rb
Normal file
4
test/helpers/welcome_helper_test.rb
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class WelcomeHelperTest < ActionView::TestCase
|
||||||
|
end
|
||||||
7
test/models/package_test.rb
Normal file
7
test/models/package_test.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class PackageTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
||||||
Loading…
Add table
Add a link
Reference in a new issue