This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% Category.all.each do |category| %> | |
<option value="<%= category_path(category) %>"><%= category.name %></option> | |
<% end %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
context "create order" do | |
let(:current_api_user) do | |
user = Spree.user_class.new(:email => "[email protected]") | |
# other stuff goes here | |
end | |
it "can create an order" do | |
variant = create(:variant) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def smart_titleize(word, pattern) | |
words = word.split(' ') | |
processed_words = [] | |
words.each do |aWord| | |
aWord = Regexp.escape(aWord) | |
aWord = aWord.capitalize unless Regexp.escape("#{pattern}").match(aWord) || /^[A-Z]*$/.match(aWord) || /^[a-z]{2,}$/.match(aWord) || /^[0-9]*$/.match(aWord) | |
aWord = aWord.gsub(/-([A-Za-z0-9]+)/) {|s| s.upcase} | |
aWord = aWord.gsub(/(AR\-15)/i) {$&.upcase} | |
aWord = aWord.gsub(/(TAC-)/i) {$&.upcase} | |
processed_words << aWord |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def edit_measurements | |
@estimate = Estimate.find(params[:id]) | |
@measurements = @estimate.measurements | |
end | |
def update_measurements | |
#Find object using form parameters | |
@estimate = Estimate.find(params[:id]) | |
#Update subject | |
if @estimate.update_attributes(params[:estimate]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ApplicationHelper | |
def full_title(page_title) | |
base_title = "Vende Comigo" | |
if page_title.empty? | |
base_title | |
else | |
"#{base_title} | #{page_title}" | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= display_messages %> | |
# returns {:error=>"Email/senha incorretos."} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def button_link(action_name, link_source) | |
klass = case action_name | |
when 'show' then { "icon-eye-open" => 'btn mini green-txt'} | |
when 'edit' then { "icon-pencil" => 'btn mini blue-txt' } | |
when 'delete' then { "icon-remove" => 'btn mini red-txt' } | |
end | |
content = "#{content_tag(:i, "", class: klass.keys)} #{content_tag :b, action_name.capitalize}".html_safe | |
if action_name == 'delete' | |
link_to(content, link_source, class: klass.values, | |
method: 'delete', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nesting of 20 is too deep (JSON::NestingError) | |
./features/support/interactors.rb:4:in `hover_over' | |
./features/step_definitions/shortlist_new_steps.rb:11 | |
./features/step_definitions/shortlist_new_steps.rb:10:in `/^I click the product shortlist link in the main navigation$/' | |
features/public/shortlists/view_product_shortlist.feature:10:in `And I click the product shortlist link in the main navigation' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@all_authentications.marshal_dump.each do |k,v| | |
v.each do |auth| | |
node(auth.id.to_sym) {{ created_at: auth.created_at }} | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var totalPages = 50, buttons = 3; | |
var currentPage = lowerLimit = upperLimit = Math.min(50, totalPages); | |
for (var b = 1; b < buttons && b < totalPages;) { | |
if (lowerLimit > 1 ) { lowerLimit--; b++; } | |
if (b < buttons && upperLimit < totalPages) { upperLimit++; b++; } | |
} | |