filter pages by type
This commit is contained in:
parent
d375bad897
commit
547d750034
BIN
app/assets/images/merged/section_preview/section_text.png
Normal file
BIN
app/assets/images/merged/section_preview/section_text.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 56 KiB |
@ -5,6 +5,9 @@ module Merged
|
||||
|
||||
def index
|
||||
@pages = Page.all
|
||||
if(! params[:type].blank?)
|
||||
@pages = @pages.where(type: params[:type])
|
||||
end
|
||||
@page_styles = PageStyle.all
|
||||
end
|
||||
|
||||
@ -22,7 +25,6 @@ module Merged
|
||||
options = params[:option]
|
||||
if options
|
||||
@page.option_definitions.each do |option|
|
||||
puts "Option #{option.name}:#{options[option.name]}"
|
||||
@page.set_option(option.name, options[option.name])
|
||||
end
|
||||
@page.edit_save(current_member.email)
|
||||
|
@ -17,6 +17,7 @@ module Merged
|
||||
if( precision == "precise")
|
||||
return date.to_formatted_s(:short) + " " + date.year.to_s
|
||||
end
|
||||
return Date.today if date.blank?
|
||||
if(date.day < 10)
|
||||
attr = "Beginning"
|
||||
elsif date.day < 20
|
||||
|
@ -1,6 +1,8 @@
|
||||
- content_for( :merged_menu ) do
|
||||
.text-xl.font-bold.text-gray-900
|
||||
All Pages
|
||||
= link_to( "All" , merged.pages_path(type: '') , class: "p-2 px-4 border border-gray-200 font-bold rounded-lg hover:bg-sky-100 #{params[:type].blank? ? 'bg-blue-200':''}")
|
||||
- @page_styles.each do |style|
|
||||
= link_to( "Only #{style.type.capitalize}s" , merged.pages_path(type: style.type) , class: "p-2 px-4 border border-gray-200 font-bold rounded-lg hover:bg-sky-100 #{(params[:type] == style.type) ? 'bg-blue-200':''}")
|
||||
|
||||
= render "layouts/merged_header"
|
||||
.overflow-hidden.overflow-x-auto.rounded-lg.border.border-gray-200.m-20
|
||||
|
9
app/views/merged/view/_section_text.haml
Normal file
9
app/views/merged/view/_section_text.haml
Normal file
@ -0,0 +1,9 @@
|
||||
%section{ options(section , :background , :margin)}
|
||||
.px-4.py-16.mx-20{options(section , :text_align , :color)}
|
||||
%h1.text-2xl.font-bold.tracking-tight.sm:text-4xl
|
||||
= section.header
|
||||
-if section.has_option?("subheader")
|
||||
%h4.text-xl.mt-10.md:text-2xl
|
||||
= section.option("subheader")
|
||||
.prose.mt-4.text-lg.pt-10
|
||||
= markdown(section)
|
@ -28,6 +28,18 @@
|
||||
- item_align
|
||||
- button_link
|
||||
- button_text
|
||||
- template: section_text
|
||||
header: Text only section for longer passages of text, mostly news
|
||||
text: Text may be markdown
|
||||
fields:
|
||||
- header
|
||||
- text
|
||||
options:
|
||||
- background
|
||||
- color
|
||||
- margin
|
||||
- subheader
|
||||
- text_align
|
||||
- template: section_half_image
|
||||
header: Split section with image left or right
|
||||
text: Image on one side, header and text on the other.
|
||||
|
@ -11,7 +11,7 @@ module Merged
|
||||
assert_equal OptionDefinition.first.class , OptionDefinition
|
||||
end
|
||||
def test_there_options
|
||||
assert_equal OptionDefinition.all.length , 19
|
||||
assert_equal OptionDefinition.all.length , 20
|
||||
end
|
||||
def test_has_option_objects
|
||||
assert_equal first.class , OptionDefinition
|
||||
|
@ -12,7 +12,7 @@ module Merged
|
||||
assert spacer
|
||||
end
|
||||
def test_has_sections
|
||||
assert_equal SectionStyle.all.length , 7
|
||||
assert_equal SectionStyle.all.length , 9
|
||||
end
|
||||
def test_finds_section_by_template
|
||||
spacer = SectionStyle.find_by_template("section_spacer")
|
||||
|
Loading…
Reference in New Issue
Block a user