Skip to content

Commit

Permalink
#8 Add view quick link
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinMcNeil committed Jul 26, 2018
1 parent d00ffde commit b510eec
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 20 deletions.
8 changes: 6 additions & 2 deletions app/assets/stylesheets/nucore.scss
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,17 @@ li.nav-spacer {
}
}

.product_listing{
.quick_links {
display: flex;
}
.product_listing .add_to_cart{

.quick_links .add_to_cart {
margin-left: 5px;
}

.quick_links .view_product {
margin-left: 5px;
}
/*
Product View
*/
Expand Down
39 changes: 21 additions & 18 deletions app/views/facilities/_product_list.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,30 @@
- products.sort.each do |product|
.product_listing
%li{ class: product.class.model_name.to_s.downcase }
= product.name
- if local_assigns[:f]
= f.fields_for :order_details do |builder|
- if session_user.can_override_restrictions?(product) || product.can_be_used_by?(acting_user)
= builder.text_field :quantity, value: 0, class: "product_quantity", index: nil
= builder.hidden_field :product_id, value: product.id, index: nil

= public_calendar_link(product, indent: indent_for_icon)
= link_to product.name + (product.is_hidden? ? ' (hidden)' : ''), facility_product_path(current_facility || product.facility, product)
- if acting_user.present? && !product.can_be_used_by?(acting_user)
%i.fa.fa-lock
= " (#{product.class.human_attribute_name(:requires_approval_show)})"

- if product.offline?
= tooltip_icon "fa fa-exclamation-triangle icon-large", t("instruments.offline.note")
%li{class: 'add_to_cart' }
- if not session_user
= link_to "Add to cart (requires login)", new_user_session_path
- elsif session_user.can_override_restrictions?(product) || product.can_be_used_by?(acting_user)
- if not session_user.accounts.empty?
= link_to "Add to cart", add_order_path(acting_user.cart(session_user), order: {order_details: [{product_id: product.id, quantity: 1}] }), method: :put
.quick_links
.add_to_cart
- if not session_user
= link_to "Add to cart (requires login)", new_user_session_path
- elsif session_user.can_override_restrictions?(product) || product.can_be_used_by?(acting_user)
- if not session_user.accounts.empty?
= link_to "Add to cart", add_order_path(acting_user.cart(session_user), order: {order_details: [{product_id: product.id, quantity: 1}] }), method: :put
- else
No payment source
- else
No payment source
- else
Cannot purchase
Cannot purchase
.view_product
= public_calendar_link(product, indent: indent_for_icon)
= link_to 'View' + (product.is_hidden? ? ' (hidden)' : ''), facility_product_path(current_facility || product.facility, product)
- if acting_user.present? && !product.can_be_used_by?(acting_user)
%i.fa.fa-lock
= " (#{product.class.human_attribute_name(:requires_approval_show)})"

- if product.offline?
= tooltip_icon "fa fa-exclamation-triangle icon-large", t("instruments.offline.note")

0 comments on commit b510eec

Please sign in to comment.