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
<%= select_tag 'team_id', options_from_collection_for_select(@teams, "id", "name") %> | |
<script> | |
$(function(){ | |
$('#team_id').bind('change', function () { | |
var url = "/Teamleader/" + $(this).val() | |
if (url) { | |
window.location.replace(url); | |
} | |
return false; |
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
function spining_calculator(target_div) { | |
if (target_div == ''){ | |
var indicator = '<table id="indicator" style="width:100%;height:100%;" class="ajax_loading indicator_small"><tr><th style="text-align:center"><img src="/images/indicator-small.gif" /></th></tr></table>'; | |
$('body').prepend(indicator); | |
} else { | |
var width = $(target_div).width(); | |
var height = $(target_div).height(); | |
var indicator = '<table id="indicator" style="width:'+width+'px; height:'+height+'px;" class="ajax_loading indicator_small"><tr><th style="text-align:center"><img src="/images/indicator-small.gif" /></th></tr></table>'; | |
$(target_div).prepend(indicator); | |
} |
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
# For running this rake run "rails data:datas or rails data:seed" | |
def open_spreadsheet_data | |
Roo::Spreadsheet.open("#{Rails.root.to_s}/lib/data/datas.xlsx") | |
end | |
namespace :data do | |
task setup: [:environment] do | |
raise 'Nah, You are at production' if Rails.env.production? |
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
$('.tree li').show() | |
$('.tree li').on 'click', (e) -> | |
children = $(this).find('> ul > li') | |
if children.is(':visible') | |
children.hide 'fast' | |
else | |
children.show 'fast' | |
e.stopPropagation() | |
return | |
return |
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
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n | |
tr: | |
devise: | |
confirmations: | |
confirmed: "Eposta adresiniz başırılı bir şekilde onaylandı." | |
send_instructions: "Bir kaç dakika içerisinde eposta adresinizi nasıl onaylayacağınız hakkında bir eposta alacaksınız." | |
send_paranoid_instructions: "Eğer eposta adresinizi veritabanımızda kayıtlı ise bir kaç dakika içerisinde eposta adresinizi nasıl onaylayacağınız hakkında bir eposta alacaksınız." | |
failure: | |
already_authenticated: "Zaten giriş yaptınız." |
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
after_save :update_subtotal | |
def calc_subtotal | |
order_items.includes(:model).collect {|oi| oi.valid? ? (oi.unit_price.to_f) : 0}.sum | |
end | |
def update_subtotal | |
self.update_column(:subtotal, calc_subtotal) | |
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
link_to "Comment wall", profile_path(@profile, :anchor => "wall") | |
// => <a href="/profiles/1#wall">Comment wall</a> | |
link_to "Ruby on Rails search", :controller => "searches", :query => "ruby on rails" | |
// => <a href="/searches?query=ruby+on+rails">Ruby on Rails search</a> | |
link_to "Nonsense search", searches_path(:foo => "bar", :baz => "quux") | |
// => <a href="/searches?foo=bar&baz=quux">Nonsense search</a> |
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
psql asdf_development < /Users/johndoe/Desktop/db_dump.sql |
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
@models = Model.joins(:categories).where('categories.id = ?', @categories_id).order("created_at DESC").paginate(page: params[:page]) | |