moved section subsection templetes down
This commit is contained in:
parent
738bfe01a5
commit
27aea8e5ab
4
app/controllers/cms/sections_controller.rb
Normal file
4
app/controllers/cms/sections_controller.rb
Normal file
@ -0,0 +1,4 @@
|
||||
module Cms
|
||||
class SectionsController < CmsController
|
||||
end
|
||||
end
|
2
app/helpers/cms/section_helper.rb
Normal file
2
app/helpers/cms/section_helper.rb
Normal file
@ -0,0 +1,2 @@
|
||||
module Cms::SectionHelper
|
||||
end
|
@ -15,10 +15,10 @@
|
||||
%button.mt-4.rounded-lg.bg-yellow-500.p-4
|
||||
=link_to "Down" , "/index"
|
||||
%button.mt-4.rounded-lg.bg-blue-400.p-4
|
||||
=link_to "Edit" , "/index"
|
||||
=link_to "Edit" , cms_page_section_path(@page.name , 1234)
|
||||
%button.mt-4.rounded-lg.bg-cyan-400.p-4
|
||||
=link_to "New" , "/index"
|
||||
%button.mt-4.rounded-lg.bg-red-400.p-4
|
||||
=link_to "Delete" , "/index"
|
||||
-section.content.each do |key , value|
|
||||
= render "cms/sections/#{key}", section: section , key: key , value: value
|
||||
= render "cms/sections/data/#{key}", section: section , key: key , value: value
|
||||
|
10
app/views/cms/sections/_form.html.haml
Normal file
10
app/views/cms/sections/_form.html.haml
Normal file
@ -0,0 +1,10 @@
|
||||
= form_for @cms_section do |f|
|
||||
- if @cms_section.errors.any?
|
||||
#error_explanation
|
||||
%h2= "#{pluralize(@cms_section.errors.count, "error")} prohibited this cms_section from being saved:"
|
||||
%ul
|
||||
- @cms_section.errors.full_messages.each do |message|
|
||||
%li= message
|
||||
|
||||
.actions
|
||||
= f.submit 'Save'
|
7
app/views/cms/sections/edit.html.haml
Normal file
7
app/views/cms/sections/edit.html.haml
Normal file
@ -0,0 +1,7 @@
|
||||
%h1 Editing cms_section
|
||||
|
||||
= render 'form'
|
||||
|
||||
= link_to 'Show', @cms_section
|
||||
\|
|
||||
= link_to 'Back', cms_sections_path
|
19
app/views/cms/sections/index.html.haml
Normal file
19
app/views/cms/sections/index.html.haml
Normal file
@ -0,0 +1,19 @@
|
||||
%h1 Listing cms_sections
|
||||
|
||||
%table
|
||||
%thead
|
||||
%tr
|
||||
%th
|
||||
%th
|
||||
%th
|
||||
|
||||
%tbody
|
||||
- @cms_sections.each do |cms_section|
|
||||
%tr
|
||||
%td= link_to 'Show', cms_section
|
||||
%td= link_to 'Edit', edit_cms_section_path(cms_section)
|
||||
%td= link_to 'Destroy', cms_section, method: :delete, data: { confirm: 'Are you sure?' }
|
||||
|
||||
%br
|
||||
|
||||
= link_to 'New Section', new_cms_section_path
|
5
app/views/cms/sections/new.html.haml
Normal file
5
app/views/cms/sections/new.html.haml
Normal file
@ -0,0 +1,5 @@
|
||||
%h1 New cms_section
|
||||
|
||||
= render 'form'
|
||||
|
||||
= link_to 'Back', cms_sections_path
|
6
app/views/cms/sections/show.html.haml
Normal file
6
app/views/cms/sections/show.html.haml
Normal file
@ -0,0 +1,6 @@
|
||||
%p#notice= notice
|
||||
|
||||
|
||||
= #link_to 'Edit', edit_cms_section_path(@cms_section)
|
||||
\|
|
||||
= #link_to 'Back', cms_sections_path
|
@ -29,17 +29,11 @@
|
||||
%a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => cms_images_path}
|
||||
Images
|
||||
%li
|
||||
%a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => "/"}
|
||||
History
|
||||
%a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => "/cms/styles"}
|
||||
Styles
|
||||
%li
|
||||
%a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => "/"}
|
||||
Services
|
||||
%li
|
||||
%a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => "/"}
|
||||
Projects
|
||||
%li
|
||||
%a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => "/"}
|
||||
Blog
|
||||
%a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => "/changes"}
|
||||
Changes
|
||||
.flex.items-center.gap-4
|
||||
.sm:flex.sm:gap-4
|
||||
%a.rounded-md.bg-teal-600.px-5.text-sm.font-medium.text-white.shadow{:class => "py-2.5", :href => "/"}
|
||||
|
@ -1,7 +1,9 @@
|
||||
Rails.application.routes.draw do
|
||||
|
||||
namespace :cms do
|
||||
resources :pages
|
||||
resources :pages do
|
||||
resources :sections
|
||||
end
|
||||
resources :images
|
||||
end
|
||||
|
||||
|
15
spec/helpers/cms/section_helper_spec.rb
Normal file
15
spec/helpers/cms/section_helper_spec.rb
Normal file
@ -0,0 +1,15 @@
|
||||
require 'rails_helper'
|
||||
|
||||
# Specs in this file have access to a helper object that includes
|
||||
# the Cms::SectionHelper. For example:
|
||||
#
|
||||
# describe Cms::SectionHelper do
|
||||
# describe "string concat" do
|
||||
# it "concats two strings with spaces" do
|
||||
# expect(helper.concat_strings("this","that")).to eq("this that")
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
RSpec.describe Cms::SectionHelper, type: :helper do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
7
spec/requests/cms/section_spec.rb
Normal file
7
spec/requests/cms/section_spec.rb
Normal file
@ -0,0 +1,7 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "Cms::Sections", type: :request do
|
||||
describe "GET /index" do
|
||||
pending "add some examples (or delete) #{__FILE__}"
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user