diff --git a/app/assets/javascripts/problems.js.coffee b/app/assets/javascripts/problems.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/problems.js.coffee @@ -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/ diff --git a/app/assets/stylesheets/problems.css.scss b/app/assets/stylesheets/problems.css.scss new file mode 100644 index 0000000..e08096e --- /dev/null +++ b/app/assets/stylesheets/problems.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the problems controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/problems_controller.rb b/app/controllers/problems_controller.rb new file mode 100644 index 0000000..b341960 --- /dev/null +++ b/app/controllers/problems_controller.rb @@ -0,0 +1,21 @@ +class ProblemsController < ApplicationController + before_action :set_problem, only: [:show] + + def index + @problems = Problem.paginate(page: params[:page]) + end + + def show + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_problem + @problem = Problem.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def problem_params + params.require(:problem) + end +end diff --git a/app/helpers/problems_helper.rb b/app/helpers/problems_helper.rb new file mode 100644 index 0000000..6989835 --- /dev/null +++ b/app/helpers/problems_helper.rb @@ -0,0 +1,2 @@ +module ProblemsHelper +end diff --git a/app/views/problems/_problem_pagination.erb b/app/views/problems/_problem_pagination.erb new file mode 100644 index 0000000..4df9095 --- /dev/null +++ b/app/views/problems/_problem_pagination.erb @@ -0,0 +1 @@ +<%= will_paginate @problems, renderer: BootstrapPagination::Rails %> \ No newline at end of file diff --git a/app/views/problems/index.html.erb b/app/views/problems/index.html.erb new file mode 100644 index 0000000..6aa7ecf --- /dev/null +++ b/app/views/problems/index.html.erb @@ -0,0 +1,22 @@ +
| ID | +Title | +
|---|---|
| <%= problem.id %> | +<%= link_to problem.title, problem %> | +
<%= notice %>
+<% end %> + +