Skip to content

Commit

Permalink
+
Browse files Browse the repository at this point in the history
  • Loading branch information
mototeam committed May 25, 2020
1 parent 436b943 commit e9be778
Show file tree
Hide file tree
Showing 23 changed files with 9,649 additions and 412 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules/
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
# mp-restaurant-menu
Restaurant Menu Plugin


### Compile JS and blocks
npm run dev or npm run build

### Compile CSS
gulp
gulp less
9 changes: 5 additions & 4 deletions admin/metaboxes/order/update-order.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,25 @@
<div class="mprm-order-deliveries mprm-admin-box-inside">
<p>
<span class="label"><?php _e('Price of Delivery', 'mp-restaurant-menu'); ?>:</span>&nbsp;
<input name="mprm-order-delivery-cost" class="med-text" type="text" value="<?php echo esc_attr(apply_filters('mprm_order_delivery_cost', 0)); ?>"/>
<input name="mprm-order-delivery-cost" class="input-text" type="text" value="<?php echo esc_attr(apply_filters('mprm_order_delivery_cost', 0)); ?>"/>
</p>
</div>
<?php endif; ?>

<?php if (mprm_use_taxes()) : ?>
<div class="mprm-order-taxes mprm-admin-box-inside">
<p>
<span class="label"><?php _e('Tax', 'mp-restaurant-menu'); ?>:</span>&nbsp;
<input name="mprm-order-tax" class="med-text" type="text" value="<?php echo esc_attr(mprm_format_amount($order->tax)); ?>"/>
<span class="label"><?php _e('Taxes', 'mp-restaurant-menu'); ?>:</span>&nbsp;
<input name="mprm-order-tax" class="input-text" type="text" value="<?php echo esc_attr(mprm_format_amount($order->tax)); ?>"/>
</p>
</div>
<?php endif; ?>


<div class="mprm-order mprm-admin-box-inside">
<p>
<span class="label"><?php _e('Total Price', 'mp-restaurant-menu'); ?>:</span>&nbsp; <?php echo mprm_currency_symbol($order->currency); ?>&nbsp;<input name="mprm-order-total" type="text" class="small-text" value="<?php echo esc_attr(mprm_format_amount($order->total)); ?>"/>
<span class="label"><?php _e('Total Price', 'mp-restaurant-menu'); ?>:</span>&nbsp;
<input name="mprm-order-total" type="text" class="input-text" value="<?php echo esc_attr(mprm_format_amount($order->total)); ?>"/>
</p>
</div>

Expand Down
3 changes: 2 additions & 1 deletion classes/class-hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ public static function install_cart_actions() {
add_action('mprm_ajax_checkout_errors', 'mprm_print_errors');
add_action('mprm_cc_form', 'mprm_get_cc_form');
add_action('mprm_weekly_scheduled_events', array(Cart::get_instance(), 'delete_saved_carts'));
add_action('mprm_checkout_before', 'mprm_checkout_minimum_order_amount');
}

/**
Expand Down Expand Up @@ -1011,7 +1012,7 @@ public function clear_admin_filter($views) {
unset($views[ 'mine' ]);
unset($views[ 'draft' ]);
if (!empty($views[ 'publish' ])) {
$views[ 'publish' ] = preg_replace('/Published/', 'Payment Complete', $views[ 'publish' ]);
$views[ 'publish' ] = preg_replace('/Published/', 'New Order', $views[ 'publish' ]);
}

return $views;
Expand Down
9 changes: 7 additions & 2 deletions classes/class-media.php
Original file line number Diff line number Diff line change
Expand Up @@ -1403,8 +1403,11 @@ public function admin_enqueue_scripts() {
* @param \WP_Screen $current_screen
*/
public function current_screen(\WP_Screen $current_screen) {
$this->enqueue_style('admin-styles', 'admin-styles.css');

$prefix = $this->get_prefix();

$this->enqueue_style('admin-styles', "admin-styles{$prefix}.css");

if (!empty($current_screen)) {
switch ($current_screen->base) {
case"post":
Expand Down Expand Up @@ -1519,8 +1522,10 @@ public function enqueue_scripts() {
*/
private function add_theme_css() {
global $post_type;
$prefix = $this->get_prefix();

$this->enqueue_style('mp-restaurant-menu-font', 'lib/mp-restaurant-menu-font.min.css');
$this->enqueue_style('mprm-style', 'style.css');
$this->enqueue_style('mprm-style', "style{$prefix}.css");
wp_enqueue_script('wp-util');

switch ($post_type) {
Expand Down
2 changes: 1 addition & 1 deletion classes/models/shop/class-order.php
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ public function init_metaboxes() {

add_meta_box(
'order-purchased',
__('Purchased products:', 'mp-restaurant-menu'),
__('Purchased products', 'mp-restaurant-menu'),
array($this, 'render_meta_box'),
$this->get_post_type('order'),
'advanced',
Expand Down
4 changes: 2 additions & 2 deletions classes/models/shop/class-payments.php
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ public function get_payment_status($payment, $return_label = false) {
return $statuses[ $payment->status ];
} else {
// Account that our 'publish' status is labeled 'Complete'
$post_status = 'publish' == $payment->status ? 'Payment Complete' : $payment->post_status;
$post_status = 'publish' == $payment->status ? 'New Order' : $payment->post_status;

// Make sure we're matching cases, since they matter
$post_label = array_search(strtolower($post_status), array_map('strtolower', $statuses));
Expand All @@ -865,7 +865,7 @@ public function get_payment_status($payment, $return_label = false) {
public function get_payment_statuses() {
$payment_statuses = array(
'mprm-pending' => __('Pending Payment', 'mp-restaurant-menu'),
'publish' => __('Payment Complete', 'mp-restaurant-menu'),
'publish' => __('New Order', 'mp-restaurant-menu'),
'mprm-refunded' => __('Refunded', 'mp-restaurant-menu'),
'mprm-failed' => __('Failed', 'mp-restaurant-menu'),
'mprm-cooking' => __('Processing', 'mp-restaurant-menu'),
Expand Down
4 changes: 2 additions & 2 deletions classes/modules/class-post.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ public static function register_post_status() {
));

register_post_status('mprm-completed', array(
'label' => _x('Payment Complete', 'Order status', 'mp-restaurant-menu'),
'label' => _x('New Order', 'Order status', 'mp-restaurant-menu'),
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop('Payment Complete <span class="count">(%s)</span>', 'Payment Complete <span class="count">(%s)</span>', 'mp-restaurant-menu')
'label_count' => _n_noop('New Order <span class="count">(%s)</span>', 'New Order <span class="count">(%s)</span>', 'mp-restaurant-menu')
));

register_post_status('mprm-refunded', array(
Expand Down
7 changes: 5 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@ const gulp = require('gulp'),
autoprefixer = require('gulp-autoprefixer'),
notifier = require('gulp-notify'),
cssmin = require('gulp-cssmin');
var rename = require('gulp-rename');


gulp.task('less', function () {
return gulp.src(['./media/less/**/**/*.less', '!./media/less/no-js.less', '!./media/less/theme.less'])
return gulp.src(['./media/less/admin-styles.less', './media/less/style.less'])
.pipe(plumber({
errorHandler: notifier.onError("Error: <%= error.messageOriginal %>")
}))
.pipe(less())
.pipe(autoprefixer())
.pipe(gulp.dest('./media/css'))
.pipe(cssmin())
.pipe(rename({ extname: '.min.css' }))
.pipe(gulp.dest('./media/css'))
});

gulp.task('default', gulp.series( function (done) {
gulp.watch('./media/less/**/**/*.less', gulp.series('less'));
gulp.watch(['./media/less/admin-styles.less', './media/less/style.less'], gulp.series('less'));
done();
}));
70 changes: 53 additions & 17 deletions media/css/admin-styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
max-width: 100%;
margin: 0 auto;
padding: 0 20px;
box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.mprm-column,
.mprm-columns {
width: 100%;
float: left;
box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* For devices larger than 400px */
@media (min-width: 400px) {
Expand Down Expand Up @@ -167,8 +169,12 @@
.mprm-container.mprm-page-template-items.mprm-view-simple-list .mprm-all-items,
.mprm-container.mprm-widget-categories.mprm-view-simple-list .mprm-all-items,
.mprm-container.mprm-widget-items.mprm-view-simple-list .mprm-all-items {
columns: auto !important;
column-gap: 0;
-webkit-columns: auto !important;
-moz-columns: auto !important;
columns: auto !important;
-webkit-column-gap: 0;
-moz-column-gap: 0;
column-gap: 0;
}
.mprm-column,
.mprm-columns {
Expand Down Expand Up @@ -304,11 +310,13 @@
}
.mprm-u-full-width {
width: 100%;
box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.mprm-u-max-full-width {
max-width: 100%;
box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.mprm-u-pull-right {
float: right;
Expand Down Expand Up @@ -418,10 +426,18 @@
}
#mp_menu_gallery #mprm-menu-item-gallery .mp_menu_images {
content: " ";
display: -webkit-box;
display: -ms-flexbox;
display: flex;
flex-direction: row;
justify-content: flex-start;
flex-wrap: wrap;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-ms-flex-direction: row;
flex-direction: row;
-webkit-box-pack: start;
-ms-flex-pack: start;
justify-content: flex-start;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
max-width: 100%;
padding: 9px;
margin: 0;
Expand All @@ -447,7 +463,8 @@
#mp_menu_gallery #mprm-menu-item-gallery .mp_menu_images .mprm-image {
border: 1px solid #d5d5d5;
border-radius: 2px;
box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
cursor: move;
display: inline-block;
position: relative;
Expand All @@ -472,7 +489,8 @@
}
#mp_menu_gallery #mprm-menu-item-gallery .mp_menu_images .mprm-image .mprm-actions li a:before {
border-radius: 100%;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
content: "\f335";
height: 100%;
margin: 0;
Expand Down Expand Up @@ -542,21 +560,24 @@
}
.mprm-modal.mprm-restaurant[id^="jBoxID"] .jBox-container [data-selector=shortcode-form] .mprm-line .mprm-left-side {
display: inline-block;
box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding: 0 5px 0 0;
width: 40%;
max-width: 150px;
}
.mprm-modal.mprm-restaurant[id^="jBoxID"] .jBox-container [data-selector=shortcode-form] .mprm-line .mprm-right-side {
display: inline-block;
box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding: 0 0 0 5px;
width: 59%;
vertical-align: top;
}
.mprm-modal.mprm-restaurant[id^="jBoxID"] .jBox-container [data-selector=shortcode-form] .mprm-line .one-side {
width: 100%;
box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.mprm-modal.mprm-restaurant[id^="jBoxID"] .jBox-container [data-selector=shortcode-form] .mprm-line .mprm-right-side input,
.mprm-modal.mprm-restaurant[id^="jBoxID"] .jBox-container [data-selector=shortcode-form] .mprm-line .one-side input,
Expand All @@ -579,6 +600,9 @@
.mprm-admin-box .mprm-admin-box-inside .small-text {
width: 25%;
}
.mprm-admin-box .mprm-admin-box-inside .input-text {
width: 100%;
}
.admin-bar.post-type-mprm_order .mprm-row {
padding: 12px 0;
border-bottom: 1px solid #eee;
Expand Down Expand Up @@ -651,6 +675,7 @@
}
.wp-admin .order-status {
display: -webkit-inline-box;
display: -ms-inline-flexbox;
display: inline-flex;
line-height: 2.25em;
color: #777;
Expand Down Expand Up @@ -679,14 +704,25 @@
color: #2e4453;
}
#mprm_extensions_container {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
flex: 1 1 auto;
-webkit-box-flex: 1;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
margin: 25px 0;
}
#mprm_extensions_container .mprm-extension {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
flex-direction: column;
align-items: flex-start;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-align: start;
-ms-flex-align: start;
align-items: flex-start;
background: #fff;
border: 1px solid #ccc;
padding: 14px;
Expand Down
1 change: 1 addition & 0 deletions media/css/admin-styles.min.css

Large diffs are not rendered by default.

Loading

0 comments on commit e9be778

Please sign in to comment.