Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Admin to Work with New UI #31

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Refactor Admin to Work with New UI #31

wants to merge 8 commits into from

Conversation

tn3rb
Copy link
Member

@tn3rb tn3rb commented Apr 13, 2022

This PR:

better datepickers

Screenshot 2022-04-12 184634

better filters

Screenshot 2022-04-12 184700

better events list

Screenshot 2022-04-12 184725

better pagination

Screenshot 2022-04-12 185306

@tn3rb
Copy link
Member Author

tn3rb commented Apr 13, 2022

will fix linting, later, have to go make dinner

Copy link

@hoseinrafiei hoseinrafiei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great.

*/
public static function add_promotions_form_inputs($before_payment_options)
{
public static function add_promotions_form_inputs(EE_Form_Section_Proper $before_payment_options

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public static function add_promotions_form_inputs(EE_Form_Section_Proper $before_payment_options
public static function add_promotions_form_inputs(EE_Form_Section_Proper $before_payment_options): EE_Form_Section_Proper

Copy link
Member

@knazart knazart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Most of my suggestions are formatting, so sorry if I'm a visual nerd 😅 But I think it helps readability. Although I don't like the excess of indenting and when brackets float in the mid air to line up 😁

let i = 0;
let num = 0;
let out = '';
let ts=String(new Date().getTime());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let ts=String(new Date().getTime());
let ts = String(new Date().getTime());

Comment on lines -72 to +80
uniqid: function() {
var ts=String(new Date().getTime()), i = 0, out = '',num=0;
var host = window.location.host;
uniqID: function() {
const host = window.location.host;
let i = 0;
let num = 0;
let out = '';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -151,7 +160,7 @@ jQuery(document).ready(function($){
* @return {eePromotionsHelper}
*/
getScopeSelectionItems: function(page) {
var data={};
const data={};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const data={};
const data = {};

var doingstart = data.context == 'start' ? true : false;
dttPickerHelper.resetpicker().setDefaultDateRange('months', 1).picker(start, end, next, doingstart);
const data= $(this).data();
// const container = data.container === 'main' ? '#promotion-details-mbox' : '#promotions-applied-to-mbox';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed, is it ?

$postBody.on( 'click', '.ee-toggle-datepicker', function(e) {
e.preventDefault();
e.stopPropagation();
const data = $(this).data();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const data = $(this).data();
const data = $(this).data();

throw new EE_Error(sprintf(__('Something might be wrong with the models or the given Promotion ID in the request (%s) is not for a valid Promotion in the DB.', 'event_espresso'), $this->_req_data['PRO_ID']));
throw new EE_Error(
sprintf(
__(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
__(
esc_html__(

add_meta_box('promotions-applied-to-mbox', __('Promotion applies to...', 'event_espresso'), array( $this, 'promotions_applied_to_metabox'), $this->_wp_page_slug, 'side', 'default');
add_meta_box(
'promotion-details-mbox',
__('Promotions', 'event_espresso'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
__('Promotions', 'event_espresso'),
esc_html__('Promotions', 'event_espresso'),

);
add_meta_box(
'promotions-applied-to-mbox',
__('Promotion applies to...', 'event_espresso'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
__('Promotion applies to...', 'event_espresso'),
esc_html__('Promotion applies to...', 'event_espresso'),

*/
public function promotions_applied_to_metabox()
{
// we use the scope to get the metabox content.
$scope = $this->_promotion->scope_obj();

// if there is no scope then this is a default promotion object so the content will for promotions metabox will be generic.
$content = empty($scope) ? __('When you select a scope for the promotion this area will have options related to the selection.', 'event_espresso') : $scope->get_admin_applies_to_selector($this->_promotion->ID());
$content = empty($scope) ? __(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$content = empty($scope) ? __(
$content = empty($scope) ? esc_html__(

A lot of these in this file. If even interested in fixing those here.

Comment on lines +1283 to +1286
} elseif (
property_exists($this->_config, $property)
&& $this->_config->{$property}
!== $value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} elseif (
property_exists($this->_config, $property)
&& $this->_config->{$property}
!== $value
} elseif (
property_exists($this->_config, $property)
&& $this->_config->{$property}
!== $value

@garthkoyle
Copy link

garthkoyle commented Apr 13, 2022

From the customer reporting the issue: https://secure.helpscout.net/conversation/1844626136/896914?folderId=284418

I'm on Google Chrome Version 100.0.4896.88 (Official Build) (arm64)

I'm experiencing this issue on my laptop (16-inch (3456 × 2234)) and
also on my external display (27-inch (3840 × 2160))

@garthkoyle
Copy link

This is one of the sites having issues on ES: https://originatorconnect.eventsmart.com/wp-admin/admin.php?page=espresso_promotions

@tn3rb
Copy link
Member Author

tn3rb commented Apr 13, 2022

fix pushed to MENW && the promotions-refactor branch.

plz confirm the fix. you will need to create a lot of events (10+)

@garthkoyle
Copy link

@garthkoyle
Copy link

garthkoyle commented May 17, 2022

These are the issues I'm having here: https://garth47.makeeventsnotwar.com/wp-admin/admin.php?page=espresso_promotions&action=create_new

  • Categories are not filtering, no categories appear in the dropdown
  • The dates are not filtering, when I choose a date for an event (e.g. May 31), it's not displaying any results.
  • Include expired events? is not retrieving expired events.
    And it still looks bad:
    image

@garthkoyle
Copy link

Still having these issues on the promotions editor as reported above ^.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants