changed .size to .count

This commit is contained in:
Adrian Hinz 2021-04-11 17:54:54 +02:00
parent e3cd42a0a1
commit 5f07b9ff25
16 changed files with 23 additions and 23 deletions

View File

@ -90,7 +90,7 @@ module PsAdmin
unless (@published_page = @all_page.published_page
)
@published_page = PublishedPage.new
@published_page.priority = PublishedPage.all.size + 1
@published_page.priority = PublishedPage.all.count + 1
@published_page.created_by = current_admin.id
@published_page.created_at = Time.now
end

View File

@ -90,7 +90,7 @@ module PsAdmin
@published_page.small_text = @all_page.small_text
@published_page.full_text = @all_page.full_text
@published_page.article_id = @all_page.article_id
@published_page.priority = PublishedPage.all.size + 1;
@published_page.priority = PublishedPage.all.count + 1
@published_page.updated_by = current_admin.id
@published_page.updated_at = Time.now
@published_page.created_by = current_admin.id

View File

@ -13,11 +13,11 @@ module PsAdmin
params[:images].each do |image|
if @product.images.blank?
@product.images.create(image: image, updated_by: current_admin.id,
position: @product.images.size + 1,
position: @product.images.count + 1,
cover: true)
else
@product.images.create(image: image, updated_by: current_admin.id,
position: @product.images.size + 1)
position: @product.images.count + 1)
end
end
end

View File

@ -34,11 +34,11 @@ module PsAdmin
params[:images].each do |image|
if @product.images.blank?
@product.images.create(image: image, updated_by: current_admin.id,
position: @product.images.size + 1,
position: @product.images.count + 1,
cover: true)
else
@product.images.create(image: image, updated_by: current_admin.id,
position: @product.images.size + 1)
position: @product.images.count + 1)
end
end
end

View File

@ -19,7 +19,7 @@ module ApplicationHelper
ret = ''
categories.each do |node|
ret += '<li>'
size = node.active_childrens.size
size = node.active_childrens.count
if size.zero?
ret += link_to(node.name, category_path(node))
else

View File

@ -1,3 +1,3 @@
$("#ps_cart_items").html("<%= escape_javascript(render('/cart/partials/cart_products')) %>");
$('#ps_cart_size').html("(<%= @cart.blank? ? 0 : @cart.cart_products.size %>)");
$('#ps_cart_size').html("(<%= @cart.blank? ? 0 : @cart.cart_products.count %>)");
$.notify('<%= @message[1] %>', '<%= @message[0] %>');

View File

@ -1,4 +1,4 @@
$("#ps_cart_items").html("<%= escape_javascript(render('/cart/partials/cart_products')) %>");
$('#ps_cart_size').html("(<%= @cart.blank? ? 0 : @cart.cart_products.size %>)");
$('#ps_cart_size').html("(<%= @cart.blank? ? 0 : @cart.cart_products.count %>)");
$("#ps_cart_summary_items").html("<%= escape_javascript(render('/cart/partials/cart_summary_products')) %>");
$.notify("Koszyk został wyczyszczony", "warn");

View File

@ -1,5 +1,5 @@
$("#ps_cart_items").html("<%= escape_javascript(render('/cart/partials/cart_products')) %>");
$('#ps_cart_size').html("(<%= @cart.blank? ? 0 : @cart.cart_products.size %>)");
$('#ps_cart_size').html("(<%= @cart.blank? ? 0 : @cart.cart_products.count %>)");
<% if params[:ca] == 'cart' %>
$("#ps_cart_summary_items").html("<%= escape_javascript(render(partial: '/cart/partials/cart_summary_products', locals: { ca: 'cart' })) %>");
<% elsif params[:ca] == 'order' %>

View File

@ -1,5 +1,5 @@
<%= render '/product/partials/product_modal' %>
<% if @category.active_childrens.size > 0 %>
<% if @category.active_childrens.count > 0 %>
<div class="title-wrap">
<h2 class="title lines">Kategorie</h2>
</div>
@ -37,7 +37,7 @@
</div>
<% end %>
<% end %>
<% if @products.size > 0 %>
<% if @products.count > 0 %>
<div class="title-wrap">
<h2 class="title lines">Produkty</h2>
</div>

View File

@ -1,10 +1,10 @@
<% if @order_complete.eql?(true) %>
$("#ps_cart_items").html("<%= escape_javascript(render('/cart/partials/cart_products')) %>");
$('#ps_cart_size').html("(<%= @cart.blank? ? 0 : @cart.cart_products.size %>)");
$('#ps_cart_size').html("(<%= @cart.blank? ? 0 : @cart.cart_products.count %>)");
$("#main_container").html("<%= escape_javascript(render(partial: '/checkout/partials/order_confirmation')) %>");
<% elsif @order_complete.eql?(false) %>
$("#ps_cart_items").html("<%= escape_javascript(render('/cart/partials/cart_products')) %>");
$('#ps_cart_size').html("(<%= @cart.blank? ? 0 : @cart.cart_products.size %>)");
$('#ps_cart_size').html("(<%= @cart.blank? ? 0 : @cart.cart_products.count %>)");
$("#main_container").html("<%= escape_javascript(render(partial: '/checkout/partials/order_error')) %>");
<% else %>
$('#error').html("<%= escape_javascript(raw @message[1]) %>");

View File

@ -4,7 +4,7 @@
</div>
</div>
<hr class="spacer-5"><hr class="spacer-20 no-border">
<% if @cart.blank? || @cart.cart_products.size == 0 %>
<% if @cart.blank? || @cart.cart_products.count == 0 %>
<div class="row">
<div class="col-sm-12">
<%= render partial: '/checkout/partials/order_error' %>

View File

@ -69,7 +69,7 @@
<a href="javascript:void(0);">
<i class="fa fa-shopping-basket mr-5"></i>
<span class="hidden-xs">
Koszyk<sup class="text-primary" id="ps_cart_size">(<%= @cart ? @cart.cart_products.size : 0 %>)</sup>
Koszyk<sup class="text-primary" id="ps_cart_size">(<%= @cart ? @cart.cart_products.count : 0 %>)</sup>
<i class="fa fa-angle-down ml-5"></i>
</span>
</a>

View File

@ -1,5 +1,5 @@
<%= render '/product/partials/product_modal' %>
<% if @products.size > 0 %>
<% if @products.count > 0 %>
<div class="title-wrap">
<h2 class="title lines">Produkty</h2>
</div>

View File

@ -16,8 +16,8 @@
<% for ap in @articles %>
<tr>
<td><%= link_to ap.name, {controller: '/ps_admin/article', action: 'show', id: ap.id} %></td>
<td><%= raw('<span class="badge bg-yellow">' + ap.all_page_articles.size.to_s + '</span>') %></td>
<td><%= raw('<span class="badge bg-green">' + ap.published_page_articles.size.to_s + '</span>') %></td>
<td><%= raw('<span class="badge bg-yellow">' + ap.all_page_articles.count.to_s + '</span>') %></td>
<td><%= raw('<span class="badge bg-green">' + ap.published_page_articles.count.to_s + '</span>') %></td>
<td><%= ap.updated_at %></td>
<td>
<%= link_to raw('<i class="fa fa-edit"></i> Edycja'), {controller: '/ps_admin/article', action: 'edit', id: ap.id}, class: 'btn btn-xs btn-info', remote: true %>

View File

@ -28,9 +28,9 @@
<% end %>
</td>
<td><%= link_to cat.name, {controller: '/ps_admin/category', action: 'index', parent_id: cat.id} %></td>
<td><%= raw('<span class="badge bg-green">' + cat.children.size.to_s + '</span>') %></td>
<td><%= raw('<span class="badge bg-green">' + cat.products.size.to_s + '</span>') %></td>
<td><%= raw('<span class="badge bg-' + (cat.active_products.size == 0 ? 'red' : 'green') + '">' + cat.active_products.size.to_s + '</span>') %></td>
<td><%= raw('<span class="badge bg-green">' + cat.children.count.to_s + '</span>') %></td>
<td><%= raw('<span class="badge bg-green">' + cat.products.count.to_s + '</span>') %></td>
<td><%= raw('<span class="badge bg-' + (cat.active_products.count == 0 ? 'red' : 'green') + '">' + cat.active_products.count.to_s + '</span>') %></td>
<td><%= raw cat.active.eql?(true) ? link_to(raw('<i class="fa fa-eye text-green"></i>'), {controller: '/ps_admin/category', action: 'set_active', id: cat.id,
active: 0}, remote: true) : link_to(raw('<i class="fa fa-eye-slash text-red"></i>'),
{controller: '/ps_admin/category', action: 'set_active', id: cat.id, active: 1}, remote: true) %></td>

View File

@ -21,7 +21,7 @@
<% else %>
<%= link_to raw('<i class="fa fa-caret-square-o-up"></i>'), {controller: '/ps_admin/image', action: 'pos_up', id: image.id, product_id: @product.id}, class: 'btn btn-xs btn-success', remote: true, title: 'Do góry' %>
<% end %>
<% if image.position >= @product.images.size %>
<% if image.position >= @product.images.count %>
<%= link_to raw('<i class="fa fa-caret-square-o-down"></i>'), '#', class: 'btn btn-xs btn-primary', remote: true, title: 'W dół', disabled: 'disabled' %>
<% else %>
<%= link_to raw('<i class="fa fa-caret-square-o-down"></i>'), {controller: '/ps_admin/image', action: 'pos_down', id: image.id, product_id: @product.id}, class: 'btn btn-xs btn-primary', remote: true, title: 'W dół' %>