Skip to content

Commit

Permalink
Version 1.4.15
Browse files Browse the repository at this point in the history
  • Loading branch information
themefuse committed Nov 17, 2014
1 parent 084c7eb commit d108648
Show file tree
Hide file tree
Showing 16 changed files with 354 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@
'demo_text' => array(
'label' => __('Text', 'fw'),
'type' => 'text',
'value' => 'Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium',
'value' => 'Lorem ipsum dolor sit amet',
'desc' => __('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'fw'),
'help' => sprintf("%s \n\n'\"<br/><br/>\n\n <b>%s</b>",
__('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'fw'),
Expand All @@ -659,6 +659,7 @@
),
),
),
'template' => '{{=demo_text}}',
),
'demo_group_2' => array(
'type' => 'group',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@
'demo_text' => array(
'label' => __('Text', 'fw'),
'type' => 'text',
'value' => 'Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium',
'value' => 'Lorem ipsum dolor sit amet',
'desc' => __('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'fw'),
'help' => sprintf("%s \n\n'\"<br/><br/>\n\n <b>%s</b>",
__('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'fw'),
Expand All @@ -657,6 +657,7 @@
),
),
),
'template' => '{{=demo_text}}',
'limit' => 3,
),
'demo_group' => array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,94 @@
'defaultTime' => '12:00'
)
),
'demo_addable_popup' => array(
'label' => __('Addable Popup', 'fw'),
'type' => 'addable-popup',
'desc' => __('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'fw'),
'template' => '{{=demo_text}}',
'popup-options' => array(
'demo_text' => array(
'label' => __('Text', 'fw'),
'type' => 'text',
'value' => 'Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium',
'desc' => __('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'fw'),
'help' => sprintf("%s \n\n'\"<br/><br/>\n\n <b>%s</b>",
__('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'fw'),
__('Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium', 'fw')
),
),
'demo_image_picker' => array(
'label' => __('Image Picker', 'fw'),
'type' => 'image-picker',
'value' => '',
'desc' => __('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'fw'),
'choices' => array(
'choice-1' => array(
'label' => __('First Image', 'fw'),
'small' => array(
'height' => 70,
'src' => get_template_directory_uri() .'/images/image-picker-demo/thumb1.jpg'
),
'large' => array(
'height' => 214,
'src' => get_template_directory_uri() .'/images/image-picker-demo/tooltip1.jpg'
),
),
'choice-2' => array(
'label' => __('Second Image', 'fw'),
'small' => array(
'height' => 70,
'src' => get_template_directory_uri() .'/images/image-picker-demo/thumb2.jpg'
),
'large' => array(
'height' => 214,
'src' => get_template_directory_uri() .'/images/image-picker-demo/tooltip2.jpg'
),
),
),
'help' => sprintf("%s \n\n'\"<br/><br/>\n\n <b>%s</b>",
__('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'fw'),
__('Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium', 'fw')
),
),
'demo_upload_images' => array(
'label' => __('Single Upload (Images Only)', 'fw'),
'desc' => __('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'fw'),
'type' => 'upload',
'help' => sprintf("%s \n\n'\"<br/><br/>\n\n <b>%s</b>",
__('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'fw'),
__('Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium', 'fw')
),
),
'demo_addable_popup_inner' => array(
'label' => __('Addable Popup', 'fw'),
'type' => 'addable-popup',
'desc' => __('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'fw'),
'template' => 'Title color-picker value : {{=demo_color_picker}}',
'popup-options' => array(
'demo_multi_upload_images' => array(
'label' => __('Multi Upload (images only)', 'fw'),
'desc' => __('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'fw'),
'type' => 'multi-upload',
'help' => sprintf("%s \n\n'\"<br/><br/>\n\n <b>%s</b>",
__('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'fw'),
__('Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium', 'fw')
),
),
'demo_color_picker' => array(
'label' => __('Color Picker', 'fw'),
'type' => 'color-picker',
'value' => '',
'desc' => __('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'fw'),
'help' => sprintf("%s \n\n'\"<br/><br/>\n\n <b>%s</b>",
__('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'fw'),
__('Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium', 'fw')
),
)
)
),
),
),
'demo_addable_option' => array(
'label' => __('Addable Option', 'fw'),
'type' => 'addable-option',
Expand All @@ -533,4 +621,41 @@
__('Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium', 'fw')
)
),
'demo_addable_box' => array(
'label' => __('Addable Box', 'fw'),
'type' => 'addable-box',
'value' => array(),
'desc' => __('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'fw'),
'help' => sprintf("%s \n\n'\"<br/><br/>\n\n <b>%s</b>",
__('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'fw'),
__('Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium', 'fw')
),
'box-controls' => array(
//'custom' => '<small class="dashicons dashicons-smiley" title="Custom"></small>',
),
'box-options' => array(
'demo_text' => array(
'label' => __('Text', 'fw'),
'type' => 'text',
'value' => 'Lorem ipsum dolor sit amet',
'desc' => __('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'fw'),
'help' => sprintf("%s \n\n'\"<br/><br/>\n\n <b>%s</b>",
__('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'fw'),
__('Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium', 'fw')
),
),
'demo_textarea' => array(
'label' => __('Textarea', 'fw'),
'type' => 'textarea',
'value' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
'desc' => __('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'fw'),
'help' => array(
'icon' => 'video',
'html' => '<iframe width="420" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ" frameborder="0" allowfullscreen></iframe>'
),
),
),
'template' => '{{=demo_text}}',
'limit' => 3,
),
);
2 changes: 1 addition & 1 deletion scratch-parent/framework/core/components/backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ public function _action_ajax_options_get_values()
wp_send_json_success(array(
'values' => fw_get_options_values_from_input(
$options,
FW_Request::POST($name_prefix, array())
FW_Request::POST(fw_html_attr_name_to_array_multi_key($name_prefix), array())
)
));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ protected function _enqueue_static($id, $option, $data)
return true;
}

/*
* Puts each option into a separate array
* to keep their order inside the modal dialog
*/
private function transform_options($options)
{
$new_options = array();
foreach ($options as $id => $option) {
$new_options[] = array($id => $option);
}
return $new_options;
}

/**
* @internal
* {@inheritdoc}
Expand All @@ -50,7 +63,7 @@ protected function _render($id, $option, $data)
{
$controls = array_merge(
array(
'delete' => '<small class="dashicons dashicons-no-alt" title="'. esc_attr(__('Remove', 'fw')) .'"></small>'
'delete' => '<small class="dashicons dashicons-no-alt" title="'. esc_attr__('Remove', 'fw') .'"></small>'
),
$option['box-controls']
);
Expand All @@ -66,11 +79,25 @@ protected function _render($id, $option, $data)
}
}

// Use only groups and options
{
$collected = array();
fw_collect_first_level_options($collected, $option['box-options']);
$box_options =& $collected['groups_and_options'];
unset($collected);
}

$option['attr']['data-for-js'] = base64_encode(json_encode(array(
'options' => $this->transform_options($box_options),
'template' => $option['template'],
)));

return fw_render_view(fw_get_framework_directory('/includes/option-types/'. $this->get_type() .'/view.php'), array(
'id' => $id,
'option' => $option,
'data' => $data,
'controls' => $controls,
'id' => $id,
'option' => $option,
'data' => $data,
'controls' => $controls,
'box_options' => $box_options,
));
}

Expand Down Expand Up @@ -120,6 +147,7 @@ protected function _get_defaults()
'box-controls' => array(),
'box-options' => array(),
'limit' => 0,
'template' => '',
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

.fw-option-type-addable-box > .fw-option-boxes.ui-sortable > .fw-option-box > .fw-postbox > h3.hndle {
cursor: move !important; /* to rewrite .fw-postbox h3.hndle */
word-break: break-all; /* if box text is too long, do not move controls outside box */
}

#wpbody-content .fw-option-type-addable-box .metabox-holder {
Expand All @@ -19,6 +20,10 @@
content: '\00a0'; /* &nbsp; - when title is empty, box has too small (broken) height */
}

.fw-option-type-addable-box > .fw-option-boxes.ui-sortable > .fw-option-box > .fw-postbox > h3.hndle img {
vertical-align: middle;
}


/* Controls */

Expand Down
Loading

0 comments on commit d108648

Please sign in to comment.