Advertisement
Guest User

Untitled

a guest
Feb 26th, 2019
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. wp.blocks.registerBlockType('jack/awardlsblock', {
  2.     title: 'AwardLS Promotion 1x3',
  3.     icon: 'dashicons-welcome-widgets-menus',
  4.     category: 'layout',
  5.     attributes: {
  6.         titleMain: {type: 'string'},
  7.         title1: {type: 'string'},
  8.         content1: {type: 'string'},
  9.         title2: {type: 'string'},
  10.         content2: {type: 'string'},
  11.         title3: {type: 'string'},
  12.         content3: {type: 'string'},
  13.     },
  14.     edit: function(props) {
  15.         function updateContent (event) {
  16.             props.setAttributes({titleMain: event.target.value});
  17.         }
  18.         function updateContent1 (event) {
  19.             props.setAttributes({title1: event.target.value});
  20.         }
  21.         function updateContent2 (event) {
  22.             props.setAttributes({content1: event.target.value});
  23.         }
  24.         function updateContent3 (event) {
  25.             props.setAttributes({title2: event.target.value});
  26.         }
  27.         function updateContent4 (event) {
  28.             props.setAttributes({content2: event.target.value});
  29.         }
  30.         function updateContent5 (event) {
  31.             props.setAttributes({title3: event.target.value});
  32.         }
  33.         function updateContent6 (event) {
  34.             props.setAttributes({content3: event.target.value});
  35.         }
  36.         return React.createElement("div", null, React.createElement("h3", null, "Create a video promotion (1x3 layout)"), React.createElement("p", null, "Three columns with a 2:3:2 width ratio. Centre column reserved for a video showcase."), React.createElement("div", null, React.createElement("p", null, React.createElement("input", {
  37.   type: "text",
  38.   placeholder: "Block title",
  39.   value: props.attributes.titleMain,
  40.   onChange: updateContent
  41. })), React.createElement("input", {
  42.   type: "text",
  43.   placeholder: "Heading left",
  44.   value: props.attributes.title1,
  45.   onChange: updateContent1
  46. }), React.createElement("br", null), React.createElement("textarea", {
  47.   placeholder: "Content",
  48.   value: props.attributes.content1,
  49.   onChange: updateContent2,
  50.   cols: '60',
  51.   rows: '3'
  52. })), React.createElement("div", null, React.createElement("input", {
  53.   type: "text",
  54.   placeholder: "Heading centre",
  55.   value: props.attributes.title2,
  56.   onChange: updateContent3
  57. }), React.createElement("br", null), React.createElement("textarea", {
  58.   placeholder: "YouTube video URL",
  59.   value: props.attributes.content2,
  60.   onChange: updateContent4,
  61.   cols: '50',
  62.   rows: '1'
  63. })), React.createElement("div", null, React.createElement("input", {
  64.   type: "text",
  65.   placeholder: "Heading right",
  66.   value: props.attributes.title3,
  67.   onChange: updateContent5
  68. }), React.createElement("br", null), React.createElement("textarea", {
  69.   placeholder: "Content",
  70.   value: props.attributes.content3,
  71.   onChange: updateContent6,
  72.   cols: '60',
  73.   rows: '3'
  74. })));;
  75.     },
  76.     save: function (props) {
  77.         return React.createElement("div", {
  78.   class: "container home-2"
  79. }, React.createElement("h1", null, props.attributes.titleMain), React.createElement("div", null, React.createElement("h2", null, props.attributes.title1), React.createElement("p", null, props.attributes.content1)), React.createElement("div", null, React.createElement("h2", null, props.attributes.title2), React.createElement("iframe", {
  80.   src: props.attributes.content2,
  81.   width: "100%",
  82.   height: "275",
  83.   frameborder: "0"
  84. })), React.createElement("div", null, React.createElement("h2", null, props.attributes.title3), React.createElement("p", null, props.attributes.content3)));
  85.     }
  86. })
  87.  
  88. wp.blocks.registerBlockType('jack/awardlsblock2'){
  89.     title: 'AwardLS Promotion 1x4 (no header)',
  90.     icon: 'dashicons-welcome-widgets-menus',
  91.     category: 'layout',
  92.     attributes: {
  93.         title1: {type: 'string'},
  94.         content1: {type: 'string'},
  95.         title2: {type: 'string'},
  96.         content2: {type: 'string'},
  97.         title3: {type: 'string'},
  98.         content3: {type: 'string'},
  99.         title4: {type: 'string'},
  100.         content4: {type: 'string'},
  101.     },
  102.     edit: function (props){
  103.         React.createElement("div", null, React.createElement("h3", null, "Create a promotion 1x4"), React.createElement("p", null, "Three columns with a 1:1:1:1 ratio. If you want more rows, add this block type again but don't include a heading!"), React.createElement("div", null, React.createElement("p", null, React.createElement("input", {
  104.   type: "text",
  105.   placeholder: "Block title",
  106.   value: props.attributes.titleMain,
  107.   onChange: updateContent
  108. })), React.createElement("input", {
  109.   type: "text",
  110.   placeholder: "Heading 1",
  111.   value: props.attributes.title1,
  112.   onChange: updateContent1
  113. }), React.createElement("br", null), React.createElement("textarea", {
  114.   placeholder: "Content",
  115.   value: props.attributes.content1,
  116.   onChange: updateContent2
  117. })), React.createElement("div", null, React.createElement("input", {
  118.   type: "text",
  119.   placeholder: "Heading 2",
  120.   value: props.attributes.title2,
  121.   onChange: updateContent3
  122. }), React.createElement("br", null), React.createElement("textarea", {
  123.   placeholder: "Content",
  124.   value: props.attributes.content2,
  125.   onChange: updateContent4
  126. })), React.createElement("div", null, React.createElement("input", {
  127.   type: "text",
  128.   placeholder: "Heading 3",
  129.   value: props.attributes.title3,
  130.   onChange: updateContent5
  131. }), React.createElement("br", null), React.createElement("textarea", {
  132.   placeholder: "Content",
  133.   value: props.attributes.content3,
  134.   onChange: updateContent6
  135. })), React.createElement("div", null, React.createElement("input", {
  136.   type: "text",
  137.   placeholder: "Heading 4",
  138.   value: props.attributes.title3,
  139.   onChange: updateContent7
  140. }), React.createElement("br", null), React.createElement("textarea", {
  141.   placeholder: "Content",
  142.   value: props.attributes.content3,
  143.   onChange: updateContent8
  144. })));
  145.     },
  146.     save: return null,
  147. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement