move option model over

This commit is contained in:
Torsten 2022-12-10 18:40:37 +02:00
parent d822c20d0e
commit 2abdf7add1
4 changed files with 20 additions and 206 deletions

View File

@ -1,11 +1,11 @@
module Merged module Merged
class Option class Option < ActiveYaml::Base
@@options = {} @@options = {}
attr_reader :name , :default , :description fields :name , :default , :description , :values , :type
def initialize(options) def initialize_old(options)
@name = options["name"] @name = options["name"]
@default = options["default"] @default = options["default"]
@description = options["description"] @description = options["description"]

View File

@ -1,90 +1,90 @@
--- ---
- name: fixed - name: fixed
desciption: description:
Paralax effect where background stays fixed Paralax effect where background stays fixed
during scrolling during scrolling
values: on off values: on off
default: off default: off
- name: columns - name: columns
desciption: description:
Number of columns in a layout that supports cards Number of columns in a layout that supports cards
values: 2 3 4 values: 2 3 4
default: 3 default: 3
- name: background - name: background
desciption: description:
Background colors. Light colors stay with black text. Background colors. Light colors stay with black text.
Solid colors invert to white text. Solid colors invert to white text.
values: white none light_blue light_gray light_orange solid_blue solid_red solid_indigo values: white none light_blue light_gray light_orange solid_blue solid_red solid_indigo
default: none default: none
- name: color - name: color
desciption: description:
Text colors. Don't use with solid background colors. Text colors. Don't use with solid background colors.
Same colors as background available. Default none, meas as parent. Same colors as background available. Default none, meas as parent.
values: none white black light_blue light_gray solid_black solid_blue solid_red solid_indigo values: none white black light_blue light_gray solid_black solid_blue solid_red solid_indigo
default: none default: none
- name: shade_color - name: shade_color
desciption: description:
Color of transparent shaded area. Color of transparent shaded area.
The number means transparency. The number means transparency.
values: none black_25 white_25 light_red_25 light_blue_25 solid_blue_25 solid_red_25 values: none black_25 white_25 light_red_25 light_blue_25 solid_blue_25 solid_red_25
default: none default: none
- name: align - name: align
desciption: description:
Align text of children. Normal Word meaning Align text of children. Normal Word meaning
values: left center right values: left center right
default: left default: left
- name: order - name: order
desciption: description:
For two column layout determine order of sub-cards For two column layout determine order of sub-cards
Values of left and right usually refer to where the image is Values of left and right usually refer to where the image is
For cards it can also mean up and down For cards it can also mean up and down
values: left right values: left right
default: left default: left
- name: margin - name: margin
desciption: description:
Most sections have standard margin of 20. Most sections have standard margin of 20.
This option makes it possible to remove that This option makes it possible to remove that
values: 0 20 values: 0 20
default: 20 default: 20
- name: button_text - name: button_text
desciption: description:
Text for an optional button. Must also set button_link Text for an optional button. Must also set button_link
values: values:
default: default:
- name: subheader - name: subheader
desciption: description:
Smaller header between Header and text Smaller header between Header and text
values: values:
default: default:
- name: text - name: text
desciption: description:
Second text. Just a second paragraph Second text. Just a second paragraph
values: values:
default: default:
- name: button_link - name: button_link
desciption: description:
Link for an option button. Must also set button_text. Link for an option button. Must also set button_text.
Link must be a page name, ie only internal links allowed. Link must be a page name, ie only internal links allowed.
values: values:
default: default:
- name: compulsory - name: compulsory
desciption: description:
Form fields may be compulsory or not. By default they are. Form fields may be compulsory or not. By default they are.
values: yes no values: yes no
default: no default: no
- name: form_type - name: form_type
desciption: description:
Form fields may have a type for special handling. The default is text Form fields may have a type for special handling. The default is text
but message would be a longer text, and email checked to be a name. but message would be a longer text, and email checked to be a name.
values: text message email phone date values: text message email phone date
default: text default: text
- name: ok_message - name: ok_message
desciption: description:
Message shown to the user when a form was submitted Message shown to the user when a form was submitted
values: values:
default: default:
- name: handler - name: handler
desciption: description:
Form handler Form handler
values: FormHandler values: FormHandler
default: FormHandler default: FormHandler

View File

@ -1,186 +0,0 @@
---
sections:
- template: section_cards
header: Two or more column layout with header
text: A header with text and two column layout. Columns have a little gap, so
background color comes through. 2,3 or 4 columns. Cards freely choosable
cards: true
fields:
- header
- text
options:
- background
- columns
- color
- template: section_full_up
header: Centered Header with text
text: Full width header with centered headline and optional text
fields:
- header
- text
options:
- background
- color
- margin
- subheader
- button_link
- button_text
- template: section_half_image
header: Split section with image left or right
text: Image on one side, header and text on the other.
Order depends on order option. Optional button.
fields:
- header
- text
options:
- order
- background
- color
- subheader
- text
- align
- button_link
- button_text
- template: section_full_image
header: Full image header with adjustable text
text: Large picture background with Header and text on top.
Adjustable alignment (left, center, right).
Text may be slightly shaded for readability,
text color can be changed too.
fields:
- header
- text
options:
- fixed
- color
- align
- shade_color
- template: section_large_image
header: Two third image header with adjustable text
text: Large picture background with Header and text offset.
Adjustable alignment (left, center, right).
Text section may have background color.
Text color can be changed too
fields:
- header
- text
options:
- subheader
- margin
- order
- color
- background
- template: section_spacer
header: Spacer
text: Just for extra padding
fields:
cards:
- template: card_full_image
header: Full background
text: With text in bottom right corner, offset with solid color
fields:
- header
- text
options:
- background
- color
- align
- template: card_gap_square
header: Narrow card with up down section
text: Smaller image, large margins, possible subheader
Order turns it upside down, image bottom
fields:
- header
- text
options:
- background
- color
- order
- align
- subheader
- template: card_normal_square
header: Standard card with square image
text: Image, header, text, normal stuff
fields:
- header
- text
options:
- background
- color
- align
- subheader
- template: card_normal_round
header: Standard card with square image
text: Image, header, text, normal stuff
fields:
- header
- text
options:
- name: fixed
desciption:
Paralax effect where background stays fixed
during scrolling
values: on off
default: off
- name: columns
desciption:
Number of columns in a layout that supports cards
values: 2 3 4
default: 3
- name: background
desciption:
Background colors. Light colors stay with black text.
Solid colors invert to white text.
values: white none light_blue light_gray light_orange solid_blue solid_red solid_indigo
default: none
- name: color
desciption:
Text colors. Don't use with solid background colors.
Same colors as background available. Default none, meas as parent.
values: none white black light_blue light_gray solid_black solid_blue solid_red solid_indigo
default: none
- name: shade_color
desciption:
Color of transparent shaded area.
The number means transparency.
values: none black_25 white_25 light_red_25 light_blue_25 solid_blue_25 solid_red_25
default: none
- name: align
desciption:
Align text of children. Normal Word meaning
values: left center right
default: left
- name: order
desciption:
For two column layout determine order of sub-cards
Values of left and right usually refer to where the image is
For cards it can also mean up and down
values: left right
default: left
- name: margin
desciption:
Most sections have standard margin of 20.
This option makes it possible to remove that
values: 0 20
default: 20
- name: button_text
desciption:
Text for an optional button. Must also set button_link
values:
default:
- name: subheader
desciption:
Smaller header between Header and text
values:
default:
- name: text
desciption:
Second text. Just a second paragraph
values:
default:
- name: button_link
desciption:
Link for an option button. Must also set button_text.
Link must be a page name, ie only internal links allowed.
values:
default:

View File

@ -8,7 +8,7 @@ module Merged
expect(Option.options.class).to be Hash expect(Option.options.class).to be Hash
end end
it "there are options" do it "there are options" do
expect(Option.options.length).to be 12 expect(Option.options.length).to be 16
end end
it "has option objects" do it "has option objects" do
expect(first.class).to be Option expect(first.class).to be Option