This file contains 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 get_data_from_apple id | |
@object = JSON.parse(open("https://itunes.apple.com/lookup?id=#{id}").read) | |
end |
This file contains 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
$('.radio-skin, .checkbox-skin').on('click', function(event){ | |
event.preventDefault(); | |
var $label = $(this), | |
$input = $label.find('input'); | |
if ($input.attr('checked')) { |
This file contains 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
<<<<<<< HEAD | |
<div class="row"> | |
<div class="col-md-6 col-sm-6 col-xs-12"> | |
<div class="checkbox"> | |
<label class="checkbox-skin" data-toggle="#billing-address"> | |
<%= f.check_box :separate_billing_address %> | |
<%= t :want_separate_billing_address %></label> | |
</div> | |
</div> | |
</div> |
This file contains 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
Controller Action | |
def newsletter_opt_out | |
@newsletter = Newsletter.find_by_email(:email) | |
@newsletter.destroy | |
respond_to do |format| | |
format.html {redirect_to :back, notice: t('newsletter_opt_out')} | |
end | |
end | |
This file contains 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
I have a multiselect with checkboxes: | |
<%= f.label :Category, :class => 'control-label' %> | |
<% Category.all.each do |category| -%> | |
<div> | |
<%= check_box_tag :category_ids, category.id, @job.categories.include?(category), :name => 'job[category_ids][]' %> | |
<%= label_tag :category_ids, category.name %> | |
</div> | |
<% end %> | |
This file contains 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
<% if @customer.errors.any? %> | |
<div class="warning"> | |
<h2><%= @customer.errors.count %> <%= t :error_prohibited_save %></h2> | |
<ul> | |
<% @customer.errors.full_messages.each do |message| %> | |
<li><%= message %></li> | |
<% end %> | |
</ul> | |
</div> | |
<% end %> |
This file contains 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
Routes: | |
scope ":country", country: /#{Country.pluck(:code2).join("|")}/ do | |
scope ":locale", locale: /#{I18n.available_locales.join("|")}/ do | |
root :to => "pages#home" | |
end | |
end |
This file contains 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
my route | |
get 'products/:id(/:color_id(/:size_id))' => 'products#show', :as => "select_product_option" | |
in my product_group model | |
def size size_id | |
return nil unless size_id | |
product_sizes.find(size_id) | |
end |
This file contains 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
<%= form_for :country, :url => {:action =>"change_shipping_country", :controller => "/application"}, :html => {:method => "post"} do |f| %> | |
<%= select_tag :code2, options_from_collection_for_select(Country.ordered, :code2, :name, @shipping_country.code2), :onchange => "this.form.submit()" %> | |
<% end %> | |
<ul> | |
<%= form_for :country, :url => {:action =>"change_shipping_country", :controller => "/application"}, :html => {:method => "post"} do |f| %> | |
<li> | |
<%= submit_tag "#{t :germany}", :name => "germany_button" do %> | |
<img src="/images/location-de.png"> | |
<% end %> |
NewerOlder