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

Bring some JS and CSS code from spree_backend related to orders admin #4616

Merged
merged 5 commits into from
Jan 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added app/assets/images/credit_cards/credit_card.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/assets/javascripts/admin/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
//= require admin/spree_backend
//= require modernizr
//= require css_browser_selector_dev
//= require responsive-tables
//= require admin/spree_paypal_express

// OFN specific
Expand Down
15 changes: 15 additions & 0 deletions app/assets/javascripts/admin/spree/images/index.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
$ ->
($ '#new_image_link').click (event) ->
event.preventDefault()

($ '.no-objects-found').hide()

($ this).hide()
$.ajax
type: 'GET'
url: @href
data: (
authenticity_token: AUTH_TOKEN
)
success: (r) ->
($ '#images').html r
7 changes: 7 additions & 0 deletions app/assets/javascripts/admin/spree/images/new.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
($ '#cancel_link').click (event) ->
event.preventDefault()

($ '.no-objects-found').show()

($ '#new_image_link').show()
($ '#images').html('')
2 changes: 1 addition & 1 deletion app/assets/stylesheets/admin/all.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

*= require admin/spree_backend
*= require jquery.powertip

*= require responsive-tables
*= require jquery-ui-timepicker-addon
*= require shared/textAngular
*= require shared/ng-tags-input.min
Expand Down
56 changes: 56 additions & 0 deletions app/assets/stylesheets/admin/sections/orders.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
@import 'admin/globals/variables';

// Customize orders filter
[data-hook="admin_orders_index_search"] {
select[data-placeholder="Status"] {
width: 100%;
}

.select2-container {
width: 100% !important;
}
}

// Order-total
[data-hook="order_details_total"]{
text-align: center;

.order-total {
font-size: 35px;
font-weight: 600;
color: $color-success;
}
}

[data-hook="admin_order_form_fields"] {
legend.stock-location {
color: $color-body-text;

.shipment-number {
color: $color-success;
}
.stock-location-name {
color: $color-success;
}
}
}

// Customize orduct add fieldset
#add-line-item {
fieldset {
padding: 10px 0;

.field {
margin-bottom: 0;

input[type="text"], input[type="number"] {
width: 100%;
}
}
.actions {
.button {
margin-top: 28px;
}
}
}
}
19 changes: 19 additions & 0 deletions app/assets/stylesheets/admin/sections/products.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@import 'admin/globals/variables';

[data-hook="admin_product_form_fields"] {
label {
display: inline-block;
}
input, select, textarea, .select2-container {
width: 100%;
}
}

.outstanding-balance {
margin-bottom: 15px;
text-transform: uppercase;

strong {
color: $color-2;
}
}
42 changes: 42 additions & 0 deletions vendor/assets/javascripts/responsive-tables.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
$(document).ready(function() {
var switched = false;
var updateTables = function() {
if (($(window).width() < 767) && !switched ){
switched = true;
$("table.responsive").each(function(i, element) {
splitTable($(element));
});
return true;
}
else if (switched && ($(window).width() > 767)) {
switched = false;
$("table.responsive").each(function(i, element) {
unsplitTable($(element));
});
}
};

$(window).load(updateTables);
$(window).bind("resize", updateTables);


function splitTable(original)
{
original.wrap("<div class='table-wrapper' />");

var copy = original.clone();
copy.find("td:not(:first-child), th:not(:first-child)").css("display", "none");
copy.removeClass("responsive");

original.closest(".table-wrapper").append(copy);
copy.wrap("<div class='pinned' />");
original.wrap("<div class='scrollable' />");
}

function unsplitTable(original) {
original.closest(".table-wrapper").find(".pinned").remove();
original.unwrap();
original.unwrap();
}

});
21 changes: 21 additions & 0 deletions vendor/assets/stylesheets/responsive-tables.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* Foundation v2.1.4 http://foundation.zurb.com */
/* Artfully masterminded by ZURB */

/* Mobile */
@media only screen and (max-width: 767px) {

table.responsive { margin-bottom: 0; }

.pinned { position: absolute; left: 0; top: 0; background: #fff; width: 35%; overflow: hidden; overflow-x: scroll; border-right: 1px solid #ccc; border-left: 1px solid #ccc; }
.pinned table { border-right: none; border-left: none; width: 100%; }
.pinned table th, .pinned table td { white-space: nowrap; }
.pinned td:last-child { border-bottom: 0; }

div.table-wrapper { position: relative; margin-bottom: 20px; overflow: hidden; border-right: 1px solid #ccc; }
div.table-wrapper div.scrollable table { margin-left: 35%; }
div.table-wrapper div.scrollable { overflow: scroll; overflow-y: hidden; }

table.responsive td, table.responsive th { position: relative; white-space: nowrap; overflow: hidden; }
table.responsive th:first-child, table.responsive td:first-child, table.responsive td:first-child, table.responsive.pinned td { display: none; }

}