style overview, sections only for now
This commit is contained in:
@ -8,7 +8,7 @@ module Merged
|
||||
|
||||
def create
|
||||
new_image = Image.create_new(params['filename'] , params['image_file'])
|
||||
redirect = :merged_images
|
||||
redirect = :images
|
||||
if(params[:redirect])
|
||||
redirect = params[:redirect].gsub("NEW" ,new_image.name)
|
||||
puts "image redirect #{redirect}"
|
||||
|
9
app/controllers/merged/styles_controller.rb
Normal file
9
app/controllers/merged/styles_controller.rb
Normal file
@ -0,0 +1,9 @@
|
||||
module Merged
|
||||
class StylesController < MergedController
|
||||
|
||||
def index
|
||||
@styles = Style.all
|
||||
end
|
||||
|
||||
end
|
||||
end
|
4
app/helpers/merged/styles_helper.rb
Normal file
4
app/helpers/merged/styles_helper.rb
Normal file
@ -0,0 +1,4 @@
|
||||
module Merged
|
||||
module StylesHelper
|
||||
end
|
||||
end
|
@ -48,7 +48,7 @@ module Merged
|
||||
end
|
||||
|
||||
def save
|
||||
file_name = Rails.root.join(@root , name + ".yaml")
|
||||
file_name = Rails.root.join(@@root , name + ".yaml")
|
||||
File.write( file_name , @content.to_yaml)
|
||||
end
|
||||
|
||||
|
35
app/models/merged/style.rb
Normal file
35
app/models/merged/style.rb
Normal file
@ -0,0 +1,35 @@
|
||||
module Merged
|
||||
class Style
|
||||
include ActiveModel::API
|
||||
|
||||
|
||||
attr_reader :content
|
||||
|
||||
def initialize content
|
||||
@content = content
|
||||
end
|
||||
|
||||
def template
|
||||
@content["template"]
|
||||
end
|
||||
def header
|
||||
@content["header"]
|
||||
end
|
||||
def text
|
||||
@content["text"]
|
||||
end
|
||||
def cards
|
||||
@content["cards"] == true
|
||||
end
|
||||
def preview
|
||||
"merged/section_preview/" + template
|
||||
end
|
||||
|
||||
def self.all
|
||||
# should account for app styles. now just loading engines
|
||||
@@styles = YAML.load_file(Engine.root.join("config/styles.yaml"))
|
||||
@@styles.collect{ |content| Style.new(content) }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
@ -29,7 +29,7 @@
|
||||
%a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => images_path}
|
||||
Images
|
||||
%li
|
||||
%a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => "/merged/styles"}
|
||||
%a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => styles_index_path}
|
||||
Styles
|
||||
%li
|
||||
%a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => "/changes"}
|
||||
|
@ -11,7 +11,7 @@
|
||||
.p-4
|
||||
%h3.mt-4.text-lg.font-bold Section #{index + 1}
|
||||
%button.mt-4.rounded-lg.bg-yellow-500.p-4
|
||||
=link_to "Up" , "/index"
|
||||
=link_to( "Up" , "/index")
|
||||
%button.mt-4.rounded-lg.bg-yellow-500.p-4
|
||||
=link_to "Down" , "/index"
|
||||
%button.mt-4.rounded-lg.bg-blue-400.p-4
|
||||
|
@ -1,5 +1,6 @@
|
||||
.relative.block.border.border-gray-100
|
||||
%h3.mt-4.text-lg.font-bold= key.upcase
|
||||
%p= value
|
||||
%h3.mt-4.text-lg.font-bold= key.upcase + " : " + value
|
||||
%button.ml-3.inline-block.rounded-lg.bg-blue-500.px-5.py-3.text-md.font-medium.text-white
|
||||
=link_to "Change Template" , page_section_select_template_url(@page.name,@section.id)
|
||||
.relative.block.border.border-gray-100
|
||||
=image_tag("merged/section_preview/#{section.template}" , class: "w-full object-contain")
|
||||
|
25
app/views/merged/styles/index.haml
Normal file
25
app/views/merged/styles/index.haml
Normal file
@ -0,0 +1,25 @@
|
||||
.grid.grid-cols-3.gap-4.m-8
|
||||
-@styles.each do |style|
|
||||
%article.overflow-hidden.rounded-lg.border.border-gray-100.shadow-sm
|
||||
=image_tag(style.preview , class: "h-56 w-full object-contain lg:h-72")
|
||||
%p.mt-2.text-sm.text-gray-500
|
||||
=style.template
|
||||
%article.overflow-hidden.rounded-lg.border.border-gray-100.shadow-sm
|
||||
.p-6
|
||||
%h3.text-lg.font-medium.text-gray-900
|
||||
=style.header
|
||||
%p.mt-2.text-sm.leading-relaxed.text-gray-500.line-clamp-3
|
||||
= style.text
|
||||
%article.overflow-hidden.rounded-lg.border.border-gray-100.shadow-sm
|
||||
.p-6
|
||||
%h3.text-lg.font-medium.text-gray-900
|
||||
Option
|
||||
%p.mt-2.text-sm.leading-relaxed.text-gray-500.line-clamp-3
|
||||
Following options: none (wip)
|
||||
%h3.text-lg.font-medium.text-gray-900
|
||||
Cards
|
||||
%p.mt-2.text-sm.leading-relaxed.text-gray-500.line-clamp-3
|
||||
-if(style.cards)
|
||||
Section may include cards. See card styles below
|
||||
-else
|
||||
Section may not include cards
|
Reference in New Issue
Block a user