code
stringlengths
1
1.73M
language
stringclasses
1 value
# Don't change this file! # Configure your app in config/environment.rb and config/environments/*.rb RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) module Rails class << self def boot! unless booted? preinitialize pick_boot.run end end def booted? ...
Ruby
ActionController::Routing::Routes.draw do |map| # The priority is based upon order of creation: first created -> highest priority. # Sample of regular route: # map.connect 'products/:id', :controller => 'catalog', :action => 'view' # Keep in mind you can assign values other than :controller and :action # ...
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper def easysave(frm,url) observe_form frm, :url => url, :frequency => 1 end def find_online(id) Online.find(:all,:conditions=>{:banner_id=>id}) end def first_online(id) ...
Ruby
module SpecHelper end
Ruby
module ClientHelper end
Ruby
module OrderHelper def wtfuser(id) if id.nil? or not User.exists?(id) tmpuser = User.new; tmpuser.fio = "Не существует"; tmpuser.phone="нет"; else tmpuser = User.find(id) end return tmpuser; end def wtfclient(id) if id.nil? or not Client...
Ruby
module OnlineHelper end
Ruby
# # Distributed with Rails Date Kit # http://www.methods.co.nz/rails_date_kit/rails_date_kit.html # # Author: Stuart Rackham <srackham@methods.co.nz> # License: This source code is released under the MIT license. # module DateHelper # Rails text_field helper plus drop-down calendar control for date input. Same # ...
Ruby
module InfoHelper end
Ruby
module BannerHelper def button_to_remote (name, options ={}, html_options = {}) button_to_function(name, remote_function(options), html_options) end def loaddek(price) ret = Hash.new() rumonthes().each do |m| Price.find(:all, :conditions => {:banner_id => price.id, :order_id => session[:or...
Ruby
module AccountHelper end
Ruby
module OfficeHelper def loadext(m) pr = Price.new Price.find(:all, :conditions =>{:order_id => session[:order], :banner_id => params[:id], :month => m }).each do |p| pr = p if not p.extra_id.nil? end sel = "нет" sel = pr.wtf if (not pr.nil?) and (not pr.wtf.nil?) return sel end def ...
Ruby
module PromoHelper end
Ruby
module PersonnelHelper end
Ruby
module ContractorHelper end
Ruby
class Banner < ActiveRecord::Base has_many :photos has_many :prices has_many :onlines belongs_to :contractor before_destroy { |record| Photo.destroy_all "banner_id = #{record.id}" } before_destroy { |record| Photo.destroy_all "online_id = #{record.id}" } end
Ruby
class Special < ActiveRecord::Base has_attachment :max_size => 16.megabyte validates_as_attachment end
Ruby
class Rekvizit < ActiveRecord::Base belongs_to :ourfirm belongs_to :client end
Ruby
class Extra < ActiveRecord::Base has_many :prices end
Ruby
class Order < ActiveRecord::Base belongs_to :client belongs_to :user belongs_to :dogovor has_many :prices has_many :plategs has_one :prilojen before_destroy { |record| Price.destroy_all "order_id = #{record.id}" } before_destroy { |record| Plateg.destroy_all "order_id = #{record.id}" } before_destro...
Ruby
class Plateg < ActiveRecord::Base belongs_to :order end
Ruby
class Online < ActiveRecord::Base belongs_to :banners end
Ruby
class Photo < ActiveRecord::Base has_attachment :content_type => :image, :max_size => 16.megabyte belongs_to :banner belongs_to :promo belongs_to :user validates_as_attachment end
Ruby
class Client < ActiveRecord::Base has_many :contacts has_many :orders has_many :dogovors has_many :rekvizits before_destroy { |record| Contact.destroy_all "client_id = #{record.id}" } before_destroy { |record| Rekvizit.destroy_all "client_id = #{record.id}" } before_destroy { |record| Order.destroy_al...
Ruby
class Contact < ActiveRecord::Base belongs_to :client belongs_to :contractor has_many :phones before_destroy { |record| Phone.destroy_all "contact_id = #{record.id}" } end
Ruby
class Contractor < ActiveRecord::Base has_many :banners has_many :contacts before_destroy { |record| Contact.destroy_all "contractor_id = #{record.id}" } #validates_presence_of :fio, :message => ": ФИО не может быть пустым" #validates_presence_of :tel, :message => ": Телефон не может быть пустым" #validat...
Ruby
require 'digest/sha1' class User < ActiveRecord::Base # Virtual attribute for the unencrypted password has_many :photos before_destroy { |record| Photo.destroy_all "user_id = #{record.id}" } has_many :orders named_scope :archived, :conditions => {:archived => 'Да'}, :order=> 'fio' named_scope :not_archive...
Ruby
class Price < ActiveRecord::Base belongs_to :order belongs_to :banner belongs_to :extra #named_scope :dopusl, lambda {|*args|{:conditions => {:banner_id => args[0], :order_id => args[1]}}} end
Ruby
class Ourfirm < ActiveRecord::Base has_many :dogovors has_many :rekvizits end
Ruby
class Dogovor < ActiveRecord::Base has_many :orders belongs_to :client belongs_to :ourfirm end
Ruby
class Promo < ActiveRecord::Base has_many :photos before_destroy { |record| Photo.destroy_all "promo_id = #{record.id}" } end
Ruby
class Phone < ActiveRecord::Base belongs_to :contact end
Ruby
class Prilojen < ActiveRecord::Base belongs_to :order end
Ruby
$KCODE = 'u' require 'jcode' class BannerController < ApplicationController protect_from_forgery :except => [:livesearch,:cart,:flex, :edit, :addphoto] include AuthenticatedSystem before_filter :login_from_cookie #before_filter :login_required, :except => [:fademain, :set_price_size, :show, :index, :file_id, :l...
Ruby
class InfoController < ApplicationController end
Ruby
class PromoController < ApplicationController include AuthenticatedSystem before_filter :login_from_cookie before_filter :login_required auto_complete_for :promo, :city auto_complete_for :promo, :color auto_complete_for :promo, :metro auto_complete_for :promo, :livepoint def promo end def index ...
Ruby
class ContractorController < ApplicationController include AuthenticatedSystem protect_from_forgery :only => [:chid] before_filter :login_from_cookie before_filter :login_required in_place_edit_for :contact, :name in_place_edit_for :contact, :post in_place_edit_for :phone, :number in_place_edit_for :...
Ruby
class OnlineController < ApplicationController $KCODE = 'u' require 'jcode' include AuthenticatedSystem before_filter :login_from_cookie def setonline session[:onlinepos] = 'online' if params[:onlinepos] == 'online' session[:onlinepos] = 'all' if params[:onlinepos] == 'all' if session[:search].ni...
Ruby
class PersonnelController < ApplicationController include AuthenticatedSystem before_filter :login_from_cookie before_filter :login_required def personnel end def index @users = User.not_archived end def arch @users = User.archived render :template => 'personnel/index' end def sho...
Ruby
require "rubygems" class ClientController < ApplicationController include AuthenticatedSystem before_filter :login_from_cookie before_filter :login_required in_place_edit_for :contact, :name in_place_edit_for :contact, :post in_place_edit_for :phone, :number in_place_edit_for :rekvizit, :gendir in_plac...
Ruby
# Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base helper :all # include all helpers, all the time Time::DATE_FORMATS[:rusdate] = '%Y-%m-%d' # See ActionContr...
Ruby
class OfficeController < ApplicationController include AuthenticatedSystem before_filter :login_from_cookie #before_filter :login_required, :except => [:addnotregister] in_place_edit_for :order, :status in_place_edit_for :client, :login in_place_edit_for :client, :password in_place_edit_for :client, :gend...
Ruby
class OrderController < ApplicationController include AuthenticatedSystem before_filter :login_from_cookie before_filter :login_required, :except => [:update, :new, :enter, :client, :help, :setextra, :delorder, :add2rec, :erasefree] in_place_edit_for :client, :zametka in_place_edit_for :order, :status in_pl...
Ruby
class AccountController < ApplicationController protect_from_forgery :except => [:login] include AuthenticatedSystem before_filter :login_from_cookie def index end def login unless (request.post? or params[:format]=='xml') and params[:login].size > 2 render(:layout => 'main') if request.xhr? ...
Ruby
class SpecController < ApplicationController protect_from_forgery :except => [:new, :create, :show, :list] include AuthenticatedSystem before_filter :login_from_cookie #before_filter :login_required, :except => [:fademain, :set_price_size, :show, :index, :file_id, :livesearch, :recycler, :tip, :showall] befo...
Ruby
module Technoweenie module AttachmentFu module InstanceMethods def self.included( base ) base.define_callbacks *[:after_resize, :after_attachment_saved, :before_thumbnail_saved] end def callback_with_args(method, arg = self) notify(method) result = run_callbacks(...
Ruby
# Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require(File.join(File.dirname(__FILE__), 'config', 'boot')) require 'rake' require 'rake/testtask' require 'rake/rdoctask' require 'tasks/rails'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/console'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/runner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/benchmarker'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/benchmarker'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/request'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/profiler'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/profiler'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/request'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/plugin'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/runner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/generate'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/console'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/reaper'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/inspector'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/inspector'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/spawner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/reaper'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/spawner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/generate'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/plugin'
Ruby
deldivc вид: <tr id="delUSER_div_<%= u.id.to_s%>"> <td><span id="delUSER_PRE_div_<%= u.id.to_s%>">11111111111111111</td> <td><%= deldivc('CONTROLLER', "ACTION", u.id, "delUSER_PRE_div_#{u.id.to_s}", '[x]', текст на подтверждение) %></td> </tr> контроллер: def ACTION #{}Extra.delete(params[:id]) render :p...
Ruby
class AddContactOrder < ActiveRecord::Migration def self.up add_column :orders, :contact, :date, :default => Time.now.to_date end def self.down remove_column :orders, :contact end end
Ruby
class CreateOrders < ActiveRecord::Migration def self.up create_table :orders do |t| t.references :client t.references :user t.references :dogovor t.text :order t.text :zametka t.string :status t.timestamps end end def self.down drop_table :orders end end
Ruby
class CreatePromos < ActiveRecord::Migration def self.up create_table :promos do |t| t.string :fio t.datetime :birthday t.string :rost t.string :color t.string :medbook, :default => 'есть' t.string :clothsize t.text :pasport t.string :livepoint t.string :metro...
Ruby
class AddOtrasl < ActiveRecord::Migration def self.up add_column :contractors, :otrasl, :string, :default => 'Наружная реклама' end def self.down remove_column :contractors, :otrasl end end
Ruby
class Newid < ActiveRecord::Migration def self.up add_column :contractors, :nid, :string end def self.down remove_column :contractors, :nid end end
Ruby
class CreateBanners < ActiveRecord::Migration def self.up create_table :banners do |t| t.string :city t.string :street t.string :house t.string :stroen t.string :primech t.string :tp t.string :ulic t.string :light t.string :storona t.string :xnomer ...
Ruby
class CreateContacts < ActiveRecord::Migration def self.up create_table :contacts do |t| t.references :client t.references :contractor t.string :name t.string :post t.string :visible, :default => 'false' t.timestamps end end def self.down drop_table :contacts end...
Ruby
class CreatePlategs < ActiveRecord::Migration def self.up create_table :plategs do |t| t.references :order t.string :nomer t.string :sum t.string :plateg t.date :data t.timestamps end end def self.down drop_table :plategs end end
Ruby
class PhotoForUser < ActiveRecord::Migration def self.up add_column :photos, :user_id, :integer end def self.down remove_column :photos, :user_id end end
Ruby
class AddToMenagers < ActiveRecord::Migration def self.up add_column :users, :birthday, :datetime, :default => '01-01-1901'.to_datetime add_column :users, :archived, :string, :default => 'Нет' add_column :users, :post, :string, :default => 'Менеджер' add_column :users, :percent, :string, :default => '...
Ruby
class CreateRekvizits < ActiveRecord::Migration def self.up create_table :rekvizits do |t| t.references :client t.references :ourfirm t.string :name t.string :adressur t.string :inn t.string :kpp t.string :rschet t.string :bank t.string :kschet t.string ...
Ruby
class Korpus < ActiveRecord::Migration def self.up add_column :banners, :korpus, :string end def self.down remove_column :banners, :korpus end end
Ruby
class CreatePhotos < ActiveRecord::Migration def self.up create_table :photos do |t| t.column "content_type", :string t.column "filename", :string t.column "size", :integer t.references :banner # used with thumbnails, always required t.column "parent_id", :integer ...
Ruby
class CreateSpecials < ActiveRecord::Migration def self.up create_table :specials do |t| t.string :name t.string :msg t.column "content_type", :string t.column "filename", :string t.column "size", :integer t.column "parent_id", :integer t.column "db_file_id", :integer t.timestamps end e...
Ruby
class AddToOnlineDates < ActiveRecord::Migration def self.up add_column :onlines, :databegin, :datetime add_column :onlines, :dataend, :datetime end def self.down remove_column :onlines, :databegin remove_column :onlines, :dataend end end
Ruby
class CreateOurfirms < ActiveRecord::Migration def self.up create_table :ourfirms do |t| t.string :ourfirm t.string :name t.timestamps end end def self.down drop_table :ourfirms end end
Ruby
class CreateClients < ActiveRecord::Migration def self.up create_table :clients do |t| t.string :name t.string :login t.string :adresreal t.string :password t.date :contact t.text :zametka t.timestamps end end def self.down drop_table :clients en...
Ruby
class CreateContractors < ActiveRecord::Migration def self.up create_table :contractors do |t| t.string :name t.string :fio t.string :tel t.string :zametka t.timestamps end end def self.down drop_table :contractors end end
Ruby
class CreatePhones < ActiveRecord::Migration def self.up create_table :phones do |t| t.references :contact t.string :number t.string :tip t.string :visible, :default => 'false' t.timestamps end end def self.down drop_table :phones end end
Ruby
class CreatePrilojens < ActiveRecord::Migration def self.up create_table :prilojens do |t| t.references :order t.text :prilojen t.timestamps end end def self.down drop_table :prilojens end end
Ruby
class CreateOnlines < ActiveRecord::Migration def self.up add_column :banners, :online, :string, :default => 'нет' create_table :onlines do |t| t.references :banner t.string :month t.string :coast t.string :realcoast t.timestamps end end def self.down drop_table :onl...
Ruby
class CreateExtras < ActiveRecord::Migration def self.up create_table :extras do |t| t.string :name t.string :who t.string :minsrok t.string :coast t.string :realcoast t.timestamps end end def self.down drop_table :extras end end
Ruby
class CreateSessions < ActiveRecord::Migration def self.up create_table :sessions do |t| t.string :session_id, :null => false t.text :data t.timestamps end add_index :sessions, :session_id add_index :sessions, :updated_at end def self.down drop_table :sessions end end
Ruby
class CreateUsers < ActiveRecord::Migration def self.up create_table "users", :force => true do |t| t.string :fio t.string :oklad t.string :zp t.string :phone t.string :cfg, :default => 'client' t.string :icq t.string :otdel t.references :order t.column :login...
Ruby
class CreatePrices < ActiveRecord::Migration def self.up create_table :prices do |t| t.string :coast t.string :realcoast t.string :wtf t.string :month t.string :minsrok t.date :databegin t.date :dataend t.string :size, :default => '1' t.string :edinizm, :defau...
Ruby
class CreateDogovors < ActiveRecord::Migration def self.up create_table :dogovors do |t| t.text :dogovor t.string :tip t.text :shapka t.text :tail t.date :data t.string :status t.references :client t.references :ourfirm t.timestamps end end def self.d...
Ruby