diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb new file mode 100644 index 0000000000000000000000000000000000000000..eee4af5ad62e4e93d0e0dd7f6f7e41cfd1a4c97a --- /dev/null +++ b/app/controllers/subjects_controller.rb @@ -0,0 +1,29 @@ +class SubjectsController < ApplicationController + + # GET /subjects + # GET /subjects.json + def index + @subjects = subject_repository.all + end + + # GET /subjects/1 + # GET /subjects/1.json + def show + @subject = subject_repository.find("##{params[:id]}") + end + + + + + private + + def subject_repository + repository.for(:subject) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def subject_params + params[:subject_object] + end + +end diff --git a/app/views/subjects/index.html.erb b/app/views/subjects/index.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..5d16dbd2375c44be23f42257dde4a1820dd12fc4 --- /dev/null +++ b/app/views/subjects/index.html.erb @@ -0,0 +1,8 @@ +<p id="notice"><%= notice %></p> + +<h1>Listing Subject</h1> + + +<%for subject in @subjects%> + <%= render 'shared/application/object_vertical', object: subject %> +<%end%> diff --git a/app/views/subjects/show.html.erb b/app/views/subjects/show.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..d3c806d7f6dada08241f3860aaeedf6d3fa844d8 --- /dev/null +++ b/app/views/subjects/show.html.erb @@ -0,0 +1 @@ +<h1><%= @subject.name %></h1> diff --git a/config/routes.rb b/config/routes.rb index adc99e689ca67d734145629317ec58bf6779491f..5c3f7e86580c75626b2927212ae189996dfc6363 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -8,12 +8,14 @@ Rails.application.routes.draw do namespace :management do root 'welcome#index' - # statistics - get 'statistics/', to: 'statistics#index', as: 'index_statistics' - get 'statistics/users/' => 'statistics#users', as: 'users_statistics' - get 'statistics/collections' => 'statistics#collections', as: 'collections_statistics' - get 'statistics/accesses' => 'statistics#accesses', as: 'accesses_statistics' - get 'statistics/downloads' => 'statistics#downloads', as: 'downloads_statistics' + resources :statistics do + collection do + get :users + get :collections + get :accesses + get :downloads + end + end resources :users resources :highlights @@ -21,14 +23,17 @@ Rails.application.routes.draw do root 'welcome#index' - resources :learning_objects - post '/learning_objects/:id/like' => 'learning_objects#like', as: 'like_learning_object' + resources :learning_objects do + member do + post :like + end + end resources :institutions resources :collections + resources :subjects, only: [:index, :show] get 'users/:id', to: 'users#show', as: 'users_show' - get '/faq' => 'welcome#faq' get '/contact' => 'welcome#contact', as: 'contact' get '/complaint' => 'welcome#complaint', as: 'complaint'