= search_form_for @search, builder: SimpleForm::FormBuilder do |f|
.input-group
= f.input_field :name_cont, label: false, input_html: {class: 'form-control'}, placeholder: 'Quick search...'
%span.input-group-btn
= button_tag( class: 'btn') do
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
# This is a skeleton for testing models including examples of validations, callbacks, | |
# scopes, instance & class methods, associations, and more. | |
# Pick and choose what you want, as all models don't NEED to be tested at this depth. | |
# | |
# I'm always eager to hear new tips & suggestions as I'm still new to testing, | |
# so if you have any, please share! | |
# | |
# @kyletcarlson | |
# | |
# This skeleton also assumes you're using the following gems: |
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
if sudo dpkg -s apache2 | grep -q Status; then | |
echo "Package 'apache2' is installed." | |
echo "Removin 'apache2'. Please wait..." | |
service apache2 stop | |
sudo apt-get -y --purge remove apache2* | |
else | |
echo "Package 'apache2' is NOT installed." | |
fi | |
if sudo dpkg -s mysql-server | grep -q Status; then |
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
# Use this setup block to configure all options available in SimpleForm. | |
# File Path: RAILS_ROOT/config/initializers/simple_form_bootstrap.rb | |
SimpleForm.setup do |config| | |
config.wrappers :bootstrap, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| | |
b.use :html5 | |
b.use :placeholder | |
b.use :label, class: 'control-label' | |
b.use :input | |
b.use :error, wrap_with: { tag: 'span', class: 'help-block' } | |
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } |
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 format_state(state, large = false) | |
capture_haml do | |
css_classes = %w(label) | |
css_classes << state | |
css_classes << 'large' if large | |
haml_tag :span, class: css_classes do | |
haml_concat t("helpers.state.#{state}") | |
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
str = "Привет" | |
str.mb_chars.downcase.to_s#=> "привет" |
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
devise_for :users, | |
:controllers => { :sessions => 'sessions', :registrations => 'registrations'}, | |
:path => 'accounts', | |
:path_names => { :sign_in => 'login', :sign_up => 'new', :sign_out => 'logout', :password => 'secret', | |
:confirmation => 'verification' } |
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
%script{:type=>"text/javascript"} | |
alert("sa") |
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
= f.select :suburb_town_region_country_id_eq, @countries.map{|country| [country.name, country.id]}, {}, :id => 'country' | |
= f.select :suburb_town_region_id_eq, @regions.map{|region| [region.name, region.id]}, {}, :id => 'region' | |
= f.select :suburb_town_id_eq, @towns.map{|town| [town.name, town.id]}, {}, :id => 'town' | |
= f.select :suburb_id_eq, @suburbs.map{|suburb| [suburb.name, suburb.id]}, {}, :id => 'suburb' |