image list first version
This commit is contained in:
parent
dfbab99ca7
commit
43a759cec4
19
app/controllers/cms/image_controller.rb
Normal file
19
app/controllers/cms/image_controller.rb
Normal file
@ -0,0 +1,19 @@
|
||||
module Cms
|
||||
|
||||
class ImageController < ApplicationController
|
||||
|
||||
@@root = "app/assets/images/cms/"
|
||||
@@files = Dir.new(Rails.root + @@root).children
|
||||
|
||||
def index
|
||||
@files = files
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def files
|
||||
@@files
|
||||
end
|
||||
end
|
||||
|
||||
end
|
6
app/helpers/cms/image_helper.rb
Normal file
6
app/helpers/cms/image_helper.rb
Normal file
@ -0,0 +1,6 @@
|
||||
module Cms
|
||||
|
||||
module ImageHelper
|
||||
end
|
||||
|
||||
end
|
15
app/views/cms/image/index.haml
Normal file
15
app/views/cms/image/index.haml
Normal file
@ -0,0 +1,15 @@
|
||||
.grid.grid-cols-6.gap-4.m-8
|
||||
-@files.each do |file|
|
||||
.relative.block.border.border-gray-100
|
||||
%button.absolute.right-4.top-4.rounded-full.bg-black.p-2.text-white{:type => "button"}
|
||||
%span.sr-only Wishlist
|
||||
%svg.h-4.w-4{:fill => "none", :stroke => "currentColor", :viewbox => "0 0 24 24", :xmlns => "http://www.w3.org/2000/svg"}
|
||||
%path{:d => "M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z", "stroke-linecap" => "round", "stroke-linejoin" => "round", "stroke-width" => "2"}
|
||||
=image_tag("cms/#{file}" , class: "h-56 w-full object-contain lg:h-72")
|
||||
.p-6
|
||||
%strong.inline-block.bg-yellow-400.px-3.py-1.text-xs.font-medium
|
||||
New
|
||||
%h3.mt-4.text-lg.font-bold= file
|
||||
%p.mt-2.text-sm.text-gray-700 $14.99
|
||||
%button.mt-4.block.w-full.rounded-sm.bg-yellow-500.p-4.text-sm.font-medium{:type => "button"}
|
||||
Add to Cart
|
@ -1,5 +1,9 @@
|
||||
Rails.application.routes.draw do
|
||||
|
||||
namespace :cms do
|
||||
resources :image
|
||||
end
|
||||
|
||||
get 'pages/:id' , to: 'high_voltage/pages#show', id: 'index'
|
||||
|
||||
# root to: 'high_voltage/pages#show', id: 'index'
|
||||
|
Loading…
Reference in New Issue
Block a user