Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

Commit

Permalink
Merge branch 'develop' into planet-2561
Browse files Browse the repository at this point in the history
# Conflicts:
#	style.css
#	style.css.map
  • Loading branch information
onyekaa committed Mar 22, 2019
2 parents ba79bf6 + 4662d44 commit 2bafba4
Show file tree
Hide file tree
Showing 39 changed files with 1,998 additions and 501 deletions.
66 changes: 65 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ workflows:
- php70-build
- php71-build
- php72-build

- build-and-test-codeception:
context: org-global
version: 2

job-references:
Expand Down Expand Up @@ -83,3 +84,66 @@ jobs:
docker:
- image: circleci/php:7.2
- image: *mysql_image

build-and-test-codeception:
docker:
- image: gcr.io/planet-4-151612/p4-builder:latest
working_directory: /home/circleci/
environment:
APP_HOSTNAME: www.planet4.test
APP_HOSTPATH:
CLOUDSQL_INSTANCE: p4-develop-k8s
CONTAINER_PREFIX: planet4-base
GOOGLE_PROJECT_ID: planet-4-151612
HELM_NAMESPACE: develop
TYPE: "Build"
WP_DB_NAME: planet4-base_wordpress
WP_TITLE: Greenpeace Base Development
steps:
- setup_remote_docker
- run:
name: Build - Configure
command: |
activate-gcloud-account.sh
mkdir -p /tmp/workspace/var
mkdir -p /tmp/workspace/src
echo "${CIRCLE_BUILD_NUM}" > /tmp/workspace/var/circle-build-num
- run:
name: Build - Build containers
working_directory: /home/circleci
command: |
echo "Plugin blocks branch is ${CIRCLE_BRANCH}"
sleep 60
PLUGIN_BLOCKS_BRANCH=dev-${CIRCLE_BRANCH} MERGE_SOURCE=git@github.com:greenpeace/planet4-base-fork.git MERGE_REF=develop make
- run:
name: Test - Clone planet4-docker-compose
command: |
git clone https://github.com/greenpeace/planet4-docker-compose
- run:
name: Test - Run tests
command: |
export BUILD_TAG="build-$(cat /tmp/workspace/var/circle-build-num)"
export APP_IMAGE=gcr.io/planet-4-151612/planet4-base-app:${BUILD_TAG}
export OPENRESTY_IMAGE=gcr.io/planet-4-151612/planet4-base-openresty:${BUILD_TAG}
make -C planet4-docker-compose ci test
- run:
name: Test - Extract test artifacts
when: always
command: |
export BUILD_TAG="build-$(cat /tmp/workspace/var/circle-build-num)"
export APP_IMAGE=gcr.io/planet-4-151612/planet4-base-app:${BUILD_TAG}
export OPENRESTY_IMAGE=gcr.io/planet-4-151612/planet4-base-openresty:${BUILD_TAG}
make -C planet4-docker-compose ci-extract-artifacts
- persist_to_workspace:
root: /tmp/workspace
paths:
- var

- store_test_results:
path: planet4-docker-compose/artifacts

- store_artifacts:
path: planet4-docker-compose/artifacts
58 changes: 0 additions & 58 deletions .travis.yml

This file was deleted.

31 changes: 31 additions & 0 deletions admin/css/admin_blocks.css
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,34 @@ div.shortcode-ui-edit-shortcake_newcovers > div:last-child {
#bl_loading_span {
margin-left: 10px;
}

/* Carousel header */
.shortcode-ui-edit-shortcake_carousel_header .shortcake-p4-radio-div img {
max-width: 100%;
}

/* CSS trick to make the images and description click the radio too. */
.shortcode-ui-edit-shortcake_carousel_header .shortcake-p4-radio-div {
position: relative;
}

.shortcode-ui-edit-shortcake_carousel_header .shortcake-p4-radio-div label::before {
display: block;
content: " ";
opacity: 0;
width: 100%;
position: absolute;
height: 100%;
}

.shortcode-ui-edit-shortcake_carousel_header .field-block.shortcode-ui-field-text,
.shortcode-ui-edit-shortcake_carousel_header .field-block.shortcode-ui-field-url,
.shortcode-ui-edit-shortcake_carousel_header .field-block.shortcode-ui-field-url input,
.shortcode-ui-edit-shortcake_carousel_header .field-block.shortcode-ui-field-text input {
width: 400px;
}

.max-length-counter {
color: #AAAAAA;
text-align: right;
}
Binary file added admin/images/carousel-classic.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added admin/images/carousel-with-preview.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
76 changes: 76 additions & 0 deletions admin/js/blocks-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ var p4_blocks = {
$('.shortcake-columns-add-column').attr('disabled', 'disabled');
}

this.toggle_images();
this.add_click_event_handlers();
},

Expand Down Expand Up @@ -577,6 +578,10 @@ var p4_blocks = {
}
}
});

$('input[name=columns_block_style]').off('click').on('click', function() {
p4_blocks.columns.toggle_images();
});
},

/**
Expand Down Expand Up @@ -619,10 +624,73 @@ var p4_blocks = {
*/
show_column: function (row) {
$('.field-block').filter($('div[class$=\'_' + row + '\']')).show(300, function () {
p4_blocks.columns.toggle_images();
$('.media-frame-content').animate({
scrollTop: $('.shortcode-ui-content').prop('scrollHeight'),
}, 300);
});
},

/**
* Show/hide images inputs depending on column block style.
*/
toggle_images: function() {
[1, 2, 3, 4].forEach(function(row) {
var column_is_visible = $('.field-block').filter($('div[class$=\'title_' + row + '\']')).is(':visible');
var block_style_allows_images = 'no_image' != $('input[name=columns_block_style]:checked').val();
$('.shortcode-ui-attribute-attachment_'+ row).toggle(column_is_visible && block_style_allows_images);
});
}
},

carousel_header: {
render_edit: function () {
p4_blocks.carousel_header.toggle_subheaders();
p4_blocks.carousel_header.set_maxlength();

$('input[name=block_style]').off('click').on('click', function() {
p4_blocks.carousel_header.toggle_subheaders();
p4_blocks.carousel_header.set_maxlength();
});
},

toggle_subheaders: function() {
var selected_block_style = $('input[name=block_style]:checked').val();
$('input[data-subheader=true]').closest('.field-block').toggle('full-width-classic' != selected_block_style);
},

add_maxlength_with_counter: function(element, maxLength) {
$(element).attr('maxlength', maxLength);
if (!$(element).next('div').length) {
var maxLengthCounter = '<div class="max-length-counter">0/' + maxLength + '</div>';
$(maxLengthCounter).insertAfter(element);
}
$(element).off('input').on('input', function() {
var charCount = $(element).val().length;
$(element).next('div.max-length-counter').html(charCount + '/' + maxLength);
});
},

set_maxlength: function() {
var me = this;
var selected_block_style = $('input[name=block_style]:checked').val();

if (selected_block_style == 'full-width-classic') {
$('input[name^=\'header_\']').each(function() {
me.add_maxlength_with_counter(this, 32);
});
$('textarea[name^=\'description_\']').each(function() {
me.add_maxlength_with_counter(this, 200);
});
$('input[name^=\'link_text_\']').each(function() {
me.add_maxlength_with_counter(this, 24);
})
} else {
$('input[name^=\'header_\']').attr('maxlength', 40);
$('textarea[name^=\'description_\']').removeAttr('maxlength');
$('input[name^=\'link_text_\']').removeAttr('maxlength');
$('div.maxLengthCounter').remove();
}
}
}
};
Expand Down Expand Up @@ -662,6 +730,10 @@ if ('undefined' !== typeof (wp.shortcake)) {
if ('shortcake_columns' === shortcode_tag) {
p4_blocks.columns.render_new(shortcode);
}

if ('shortcake_carousel_header' === shortcode_tag) {
p4_blocks.carousel_header.render_edit();
}
});

// Trigger hooks when shortcode renders an existing p4 block.
Expand Down Expand Up @@ -698,5 +770,9 @@ if ('undefined' !== typeof (wp.shortcake)) {
if ('shortcake_columns' === shortcode_tag) {
p4_blocks.columns.render_edit(shortcode);
}

if ('shortcake_carousel_header' === shortcode_tag) {
p4_blocks.carousel_header.render_edit();
}
});
}
13 changes: 13 additions & 0 deletions admin/js/cookies.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
/* global createCookie, readCookie */
function setNoTrackCookie()
{
if ($('#necessary_cookies').is(':checked') || $('#all_cookies').is(':checked')) {
// Remove the 'no_track' cookie, if user accept the cookies consent.
createCookie('no_track', 'true', -1);
} else {
// If user manually disables all trackings, set a 'no_track' cookie.
createCookie('no_track', 'true', 20*365);
}
}

jQuery(document).ready(function () {

var cookie = readCookie('greenpeace');
Expand All @@ -21,6 +32,7 @@ jQuery(document).ready(function () {
createCookie('greenpeace', '0', -1);
$('.cookie-notice').show();
}
setNoTrackCookie();
});

// Add change event for all cookies checkbox.
Expand All @@ -37,5 +49,6 @@ jQuery(document).ready(function () {
$('.cookie-notice').show();
}
}
setNoTrackCookie();
});
});

0 comments on commit 2bafba4

Please sign in to comment.