Skip to content

Instantly share code, notes, and snippets.

@jwo
Created June 4, 2012 15:04
Show Gist options
  • Save jwo/2868919 to your computer and use it in GitHub Desktop.
Save jwo/2868919 to your computer and use it in GitHub Desktop.
Print out any UI alerts in your app/views (and next 10 lines).
#!/bin/bash
# Useful for documentation to the client about what alert messages to users you added to the system
# For Rails, obvs, but useful to any app/views directory structure
FILES=$(grep -lr "alert" app/views)
for file_name in $FILES; do
echo "---------------------------------------";
echo $file_name;
echo "---------------------------------------";
awk '/alert/ { l=10; } l&&l' $file_name;
echo "";
echo "";
done
---------------------------------------
app/views/orders/show.html.haml
---------------------------------------
.alert.alert-info
%strong Pending Shipment.
You will recieve an email with the tracking information as soon as your stuff has shipped.
---------------------------------------
app/views/shipments/new.html.haml
---------------------------------------
.alert.alert-info
%strong Thanks for taking time to tell us about a shipment you are sending to us.
Once it arrives we will email you and take pictures of the items. You will then see the items in your locker. From there you can consolidate them and ship them wherever you want.
---------------------------------------
app/views/shopping_cart_items/destroy.js.erb
---------------------------------------
$(this).html("<td colspan='3' class='alert'><span>" + title + " was removed from your Shopping Cart.</span></td>");
---------------------------------------
app/views/users/show.html.haml
---------------------------------------
.alert.alert-info
Tip! You can edit and update items by clicking on their photo
= render partial: "items/item_listing", locals: { status: "Locker", items: @locker_items }
---------------------------------------
app/views/warehouse/pack/consolidation_pictures/new.html.haml
---------------------------------------
.alert.alert-info
%strong These pictures are to show the customer what their consolidation looks like.
= f.input :image
---------------------------------------
app/views/warehouse/receive/items/edit.html.haml
---------------------------------------
.alert
%strong You need to add images to this item!
You can't finish working on a shipment until every item has at least one image. Our customers need to see that the item arrived and is in good shape. Thanks!
= link_to "Add an image now.", new_warehouse_receive_user_shipment_item_item_picture_path(@user, @shipment, @item)
---------------------------------------
app/views/warehouse/receive/shipment_pictures/new.html.haml
---------------------------------------
.alert.alert-info
%strong These pictures are to ensure the customers that their package arrived safely and undamaged.
= f.input :image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment