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
source 'http://rubygems.org' | |
gem 'rails', '3.0.4' | |
gem 'mysql2' | |
gem 'jquery-rails' | |
... |
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
cable_to :events do |event| | |
collection do | |
get :schedule | |
end | |
end | |
rake routes | grep events | |
schedule_admin_events GET /admin/events/schedule(.:format) {:action=>"schedule", :controller=>"admin/events"} | |
admin_events GET /admin/events(.:format) {:action=>"index", :controller=>"admin/events"} |
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
require 'set' | |
data = [ "ss_1111_f1_01_s0_r1", "ss_1111_f1_02_s0", "ss_1111_f1_03_s0", "ss_1111_f1_01_s3", "ss_1111_f1_02_s3", "ss_1111_f1_01_s0_r0" , "ss_1111_f1_03_s3","ss_1111_f1_01_s0"].collect{|d| Set.new(d.split("_")) } | |
query = Set.new("ss_1111_f1_01_s0_r0_i4".split("_")) | |
matching_image = data.select {|f| f.subset?( query ) } |
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 display_tree_navigation(tree, parent_id) | |
ret = "<ul>" | |
tree.each do |node| | |
if node.parent_id == parent_id | |
ret += "<li>" | |
ret += link_to node.title, node | |
ret += display_tree_navigation(node.children, node.id) | |
ret += "</li>" | |
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
def sign_in_out_button | |
out = [] | |
if current user | |
out << link_to "Sign out", '/logout', :class => "login_button round" | |
else | |
out << link_to "Sign in (or up)", '/login', :class => "login_button round" | |
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
<ul> | |
<li> | |
<ul> | |
<li first> | |
<li> | |
<li last> | |
</ul> | |
</li> | |
<li> | |
<ul> |
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
map.namespace :admin do |admin| | |
admin.resources :news, :collection => {:post_data => :post, :sort => :post, :search => :post} | |
end | |
$ rake routes | grep news | |
search_admin_news POST /admin/news/search(.:format) {:controller=>"admin/news", :action=>"search"} | |
post_data_admin_news POST /admin/news/post_data(.:format) {:controller=>"admin/news", :action=>"post_data"} | |
sort_admin_news POST /admin/news/sort(.:format) {:controller=>"admin/news", :action=>"sort"} | |
admin_news_index GET /admin/news(.:format) {:controller=>"admin/news", :action=>"index"} |
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
<ul id="id_0"> | |
<li id="id_1">1.0</li> | |
<li id="id_2">2.0</li> | |
<li id="id_3">3.0 | |
<ul> | |
<li id="id_4">3.1</li> | |
<li id="id_5">3.2</li> | |
</ul> | |
</li> | |
</ul> |
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
# @menu.special_action ="contact" | |
def show | |
@menu = Menu.find(params[:id]) | |
@resource = @menu.resource | |
unless @menu.special_action.nil? | |
render @menu.special_action.to_sym | |
else | |
render 'show' | |
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
@tn = params[:tn][:tracking_number] | |
@tns = @tn.split(',') | |
if @tns.count >= 2 | |
@tns.each do |tn| | |
@tracking_number = TrackingNumber.new | |
@tracking_number.tracking_number = tn | |
@tracking_number.order_id = @order.id | |
@tracking_number.save | |
count +=1 | |
end |