code
stringlengths
1
1.73M
language
stringclasses
1 value
module TransportPackagesHelper end
Ruby
module TourTypesHelper end
Ruby
module HotelsHelper end
Ruby
module HotelTransactionsHelper end
Ruby
module TourDaysHelper end
Ruby
module HotelTicketHelper end
Ruby
module HotelImagesHelper end
Ruby
module FacilitiesHelper end
Ruby
module PaymentTypesHelper end
Ruby
module TransportImagesHelper end
Ruby
module TransportTypesHelper end
Ruby
module PagesHelper end
Ruby
module ToursHelper end
Ruby
module TourImagesHelper end
Ruby
class TourImageUploader < CarrierWave::Uploader::Base include CarrierWave::MiniMagick storage :file def store_dir "uploads/#{model.class.to_s.underscore}/#{model.tour_id}" end version :large do resize_to_fill(693, 283) end version :thumb do resize_to_fill(128, 102) end ...
Ruby
# encoding: utf-8 class PrimaryRoomUploader < CarrierWave::Uploader::Base include CarrierWave::MiniMagick # Include RMagick or MiniMagick support: # include CarrierWave::RMagick # include CarrierWave::MiniMagick # Choose what kind of storage to use for this uploader: storage :file # storage...
Ruby
class HotelUploader < CarrierWave::Uploader::Base include CarrierWave::MiniMagick storage :file def store_dir "uploads/#{model.class.to_s.underscore}/#{model.hotel_id}" end version :large do resize_to_fill(693, 283) end version :thumb do resize_to_fill(128, 102) end v...
Ruby
class RoomTypeUploader < CarrierWave::Uploader::Base include CarrierWave::MiniMagick storage :file def store_dir "uploads/#{model.class.to_s.underscore}/#{model.id}" end version :large do resize_to_fill(693, 283) end version :thumb do resize_to_fill(128, 102) end vers...
Ruby
class TourUploader < CarrierWave::Uploader::Base include CarrierWave::MiniMagick storage :file def store_dir "uploads/#{model.class.to_s.underscore}/#{model.id}" end version :large do resize_to_fill(693, 283) end version :thumb do resize_to_fill(217, 131) end version ...
Ruby
class TransportImageUploader < CarrierWave::Uploader::Base include CarrierWave::MiniMagick storage :file def store_dir "uploads/#{model.class.to_s.underscore}/#{model.transport_id}" end version :large do resize_to_fill(693, 283) end version :thumb do resize_to_fill(128, 102) ...
Ruby
class TourDayUploader < CarrierWave::Uploader::Base include CarrierWave::MiniMagick storage :file def store_dir "uploads/#{model.class.to_s.underscore}/#{model.tour_day_id}" end version :large do resize_to_fill(693, 283) end version :thumb do resize_to_fill(128, 102) end ...
Ruby
class ImageUploader < CarrierWave::Uploader::Base include CarrierWave::MiniMagick storage :file def store_dir "uploads/#{model.class.to_s.underscore}/#{model.id}" end version :large do resize_to_fill(693, 283) end version :thumb do resize_to_fill(128, 102) end version :small do re...
Ruby
class CarUploader < CarrierWave::Uploader::Base include CarrierWave::MiniMagick storage :file def store_dir "uploads/#{model.class.to_s.underscore}/#{model.id}" end version :large do resize_to_fill(693, 283) end version :thumb do resize_to_fill(217, 131) end version :...
Ruby
class TourDayImage < ActiveRecord::Base attr_accessible :tour_day_id, :image, :description_eng, :description_idn belongs_to :tour_day, foreign_key: "tour_day_id" mount_uploader :image, TourDayUploader end
Ruby
class RoomTypeImage < ActiveRecord::Base attr_accessible :image_id, :room_type_id belongs_to :hotel_room_type, foreign_key: "room_type_id" belongs_to :image, foreign_key: "image_id" end
Ruby
class Transport < ActiveRecord::Base attr_accessible :description_eng, :description_idn, :is_on_promoted, :stars, :tranport_type_id, :is_published, :is_recomended, :person, :primary_picture, :transport_name mount_uploader :primary_picture, CarUploader validates :description_eng, :description_idn, :person, :prima...
Ruby
class Tour < ActiveRecord::Base attr_accessible :days, :idr_price, :idr_promotion_price, :is_on_promoted, :is_published, :is_recomended, :night, :tour_name_eng, :tour_name_idn, :tour_type_id, :transport_eng, :transport_idn, :usd_price, :usd_promotion_price, :area_id, :primary_picture, :description_eng, :description_i...
Ruby
class TourDay < ActiveRecord::Base attr_accessible :day_number, :description_eng, :description_idn , :tour_id validates :day_number, :description_eng, :description_idn, :tour_id, presence: true belongs_to :tour, foreign_key: "tour_id" has_many :tour_day_images has_many :tour_days end
Ruby
class UserType < ActiveRecord::Base attr_accessible :user_type_name has_many :users end
Ruby
class Province < ActiveRecord::Base attr_accessible :province_name has_many :hotels end
Ruby
class RoomFacility < ActiveRecord::Base attr_accessible :facility_name_eng, :facility_name_idn has_many :room_type_facilities end
Ruby
class TourImage < ActiveRecord::Base attr_accessible :tour_id, :image, :description_idn, :description_eng belongs_to :tour, foreign_key: "tour_id" mount_uploader :image, TourImageUploader end
Ruby
class HotelTransaction < ActiveRecord::Base attr_accessible :address, :first_name, :hotel_room_type_id, :last_name, :payment_type_id, :phone, :price, :queries, :status_id belongs_to :statuses, foreign_key: "status_id" belongs_to :hotel_room_type, foreign_key: "hotel_room_type_id" belongs_to :payment_type, fore...
Ruby
class TourType < ActiveRecord::Base attr_accessible :description, :tour_type_name has_many :tours end
Ruby
class RoomTypeFacility < ActiveRecord::Base attr_accessible :room_facility_id, :room_type_id belongs_to :hotel_room_type, foreign_key: "room_type_id" belongs_to :room_facility, foreign_key: "room_facility_id" end
Ruby
class TransportType < ActiveRecord::Base attr_accessible :name_eng, :name_idn end
Ruby
class PaymentType < ActiveRecord::Base attr_accessible :payment_type has_many :hotel_transactions has_many :transport_transactions has_many :tour_transactions end
Ruby
class Status < ActiveRecord::Base attr_accessible :status_eng, :status_idn has_many :hotel_transactions end
Ruby
class TransportPackage < ActiveRecord::Base attr_accessible :title_idn, :title_eng, :description_eng, :description_ind, :idr_price, :idr_promotion_price, :is_on_promoted, :transport_id, :usd_price, :usd_promotion_price validates :title_idn, :title_eng, :description_eng, :description_ind, :idr_price, :transport_id,...
Ruby
class District < ActiveRecord::Base attr_accessible :district_name has_many :hotels end
Ruby
class Facility < ActiveRecord::Base attr_accessible :facility_name_eng, :facility_name_idn has_many :hotel_facilities end
Ruby
class User < ActiveRecord::Base attr_accessible :password, :address, :city, :country, :email, :first_name, :index_phone, :last_name, :password_confirmation, :phone, :user_type_id, :zip_code attr_accessor :password, :password_confirmation validates :password, :presence => true before_save :encrypt_password b...
Ruby
class HotelRoomType < ActiveRecord::Base attr_accessible :hotel_id, :is_on_promoted, :max_guest, :idr_price, :usd_price, :idr_promotion_price, :usd_promotion_price, :room_name, :primary_picture validates :room_name, :hotel_id, :max_guest, :idr_price, :usd_price, :idr_promotion_price, :usd_promotion_price, :presenc...
Ruby
class HotelRoomTypeImage < ActiveRecord::Base attr_accessible :description_idn, :description_eng , :hotel_room_type_id, :image mount_uploader :image, RoomTypeUploader belongs_to :hotel_room_type, foreign_key: "hotel_room_type_id" end
Ruby
class Area < ActiveRecord::Base attr_accessible :area has_many :hotels has_many :tours end
Ruby
class Image < ActiveRecord::Base attr_accessible :foreign_id, :image_name, :table_name end
Ruby
class HotelImage < ActiveRecord::Base attr_accessible :description_eng, :description_idn, :hotel_id, :image belongs_to :hotel, foreign_key: "hotel_id" mount_uploader :image, HotelUploader validates :hotel_id, :image, presence: true end
Ruby
class Hotel < ActiveRecord::Base attr_accessible :x1, :x2, :y1, :y2, :w, :h, :user_id, :address, :area_id, :check_in_time, :check_out_time, :country_id, :description_eng, :description_idn, :district_id, :hotel_name, :hotel_rooms, :is_on_promoted, :is_published, :is_recomended, :postal_code, :primary_picture, :propert...
Ruby
class PropertyType < ActiveRecord::Base attr_accessible :property_type_name has_many :hotels end
Ruby
class Country < ActiveRecord::Base attr_accessible :contry_name has_many :hotels end
Ruby
class HotelFacility < ActiveRecord::Base attr_accessible :facility_id, :hotel_id belongs_to :hotel, foreign_key: "hotel_id" belongs_to :facility, foreign_key: "facility_id" end
Ruby
class TransportImage < ActiveRecord::Base attr_accessible :image, :transport_id mount_uploader :image, TransportImageUploader belongs_to :transport, foreign_key: "transport_id" end
Ruby
class PagesController < ApplicationController before_filter :current_user layout 'application' def index @hotels = Hotel.all respond_to do |format| format.html # index.html.erb # format.json { render json: @index } end end def hotel_index @hotels = Hotel.joining_and_search(ho...
Ruby
class HotelImagesController < ApplicationController # GET /hotel_images # GET /hotel_images.json layout 'admin' def index if params[:hid] @hotel_images = HotelImage.where('hotel_id =?', params[:hid]) @hotel_image = HotelImage.new respond_to do |format| format.js { render layout: ...
Ruby
class ImagesController < ApplicationController # GET /images # GET /images.json def index @images = Image.all respond_to do |format| format.html # index.html.erb format.json { render json: @images } end end # GET /images/1 # GET /images/1.json def show @image = Image.find(par...
Ruby
class ProvincesController < ApplicationController layout 'admin' # GET /provinces # GET /provinces.json def index @provinces = Province.all respond_to do |format| format.html # index.html.erb format.json { render json: @provinces } end end # GET /provinces/1 # GET /provinces/1.js...
Ruby
class HotelsController < ApplicationController # GET /hotels # GET /hotels.json layout 'admin' helper_method :sort_column, :sort_direction, :hotel_search def index @hotels = Hotel.order(sort_column + ' ' + sort_direction) .paginate(:per_page => 10, :page => params[:page]) ...
Ruby
class HotelTransactionsController < ApplicationController # GET /hotel_transactions # GET /hotel_transactions.json def index @hotel_transactions = HotelTransaction.all respond_to do |format| format.html # index.html.erb format.json { render json: @hotel_transactions } end end # GET /...
Ruby
class AreasController < ApplicationController layout 'admin' # GET /areas # GET /areas.json def index @areas = Area.all respond_to do |format| format.html # index.html.erb format.json { render json: @areas } end end # GET /areas/1 # GET /areas/1.json def show @area = Area.f...
Ruby
class ApplicationController < ActionController::Base protect_from_forgery helper_method :current_user force_ssl require 'net/http' private def current_user current_user ||= User.find(session[:user_id]) if session[:user_id] end def is_admin if current_user.blank? redirect_...
Ruby
class TransportImagesController < ApplicationController # GET /transport_images # GET /transport_images.json def index @transport_images = TransportImage.where('transport_id =?', params[:tsid]) @transport_image = TransportImage.new respond_to do |format| format.js { render layout: false } e...
Ruby
require 'mini_magick' class Picture attr_accessor :id, :file def initialize(id,file) @id = id @file = file @filename = base_part_of(file.original_filename) @content_type = file.content_type.chomp end def base_part_of(file_nam...
Ruby
class HotelRoomTypeImagesController < ApplicationController # GET /hotel_room_type_images # GET /hotel_room_type_images.json layout 'admin' def index @hotel_room_type_images = HotelRoomTypeImage.where('hotel_room_type_id =?', params[:hrt]) @hotel_room_type_image = HotelRoomTypeImage.new respond...
Ruby
class DistrictsController < ApplicationController layout 'admin' # GET /districts # GET /districts.json def index @districts = District.all respond_to do |format| format.html # index.html.erb format.json { render json: @districts } end end # GET /districts/1 # GET /districts/1.js...
Ruby
class ToursController < ApplicationController layout 'admin' # GET /tours # GET /tours.json def index @tours = Tour.all respond_to do |format| format.js { render layout: false } end end # GET /tours/1 # GET /tours/1.json def show @tour = Tour.find(params[:id]) respond_to...
Ruby
class TransportsController < ApplicationController # GET /transports # GET /transports.json def index @transports = Transport.all respond_to do |format| format.js { render layout: false } end end # GET /transports/1 # GET /transports/1.json def show @transport = Transport.find(para...
Ruby
class HotelTicketController < ApplicationController require 'will_paginate/array' require 'uri' def index check_token @token = session["token"] search = session[:hotel_ticket_search] uri = URI('http://api.master18.tiket.com/search/hotel?') @sort = params[:sort] q = params[:q] ...
Ruby
class PaymentTypesController < ApplicationController layout 'admin' # GET /payment_types # GET /payment_types.json def index @payment_types = PaymentType.all respond_to do |format| format.html # index.html.erb format.json { render json: @payment_types } end end # GET /payment_types...
Ruby
class RoomFacilitiesController < ApplicationController layout 'admin' # GET /room_facilities # GET /room_facilities.json def index @room_facilities = RoomFacility.all respond_to do |format| format.html # index.html.erb format.json { render json: @room_facilities } end end # GET /ro...
Ruby
class TransportTypesController < ApplicationController # GET /transport_types # GET /transport_types.json def index @transport_types = TransportType.all respond_to do |format| format.html # index.html.erb format.json { render json: @transport_types } end end # GET /transport_types/1 ...
Ruby
class TransportPackagesController < ApplicationController # GET /transport_packages # GET /transport_packages.json def index @transport_packages = TransportPackage.where('transport_id = ?', params[:tsid]) respond_to do |format| format.js { render layout: false } end end # GET /transport_pa...
Ruby
class TourDaysController < ApplicationController layout 'admin' # GET /tour_days # GET /tour_days.json def index if params[:tid] @tour_days = TourDay.where('tour_id =?', params[:tid]) respond_to do |format| format.js { render layout: false } end end end # GET /tour_...
Ruby
class TourDayImagesController < ApplicationController layout 'admin' # GET /tour_day_images # GET /tour_day_images.json def index @tour_day_images = TourDayImage.where('tour_day_id =?', params[:tdid]) @tour_day_image = TourDayImage.new respond_to do |format| format.js { render layout: fal...
Ruby
class UsersController < ApplicationController layout 'admin' # GET /users # GET /users.json def index @users = User.all respond_to do |format| format.html # index.html.erb format.json { render json: @users } end end # GET /users/1 # GET /users/1.json def show @user = Use...
Ruby
class FacilitiesController < ApplicationController layout 'admin' # GET /facilities # GET /facilities.json def index @facilities = Facility.all respond_to do |format| format.html # index.html.erb format.json { render json: @facilities } end end # GET /facilities/1 # GET /faciliti...
Ruby
class TourImagesController < ApplicationController layout 'admin' # GET /tour_images # GET /tour_images.json def index @tour_images = TourImage.where('tour_id =?', params[:tid]) @tour_image = TourImage.new respond_to do |format| format.js { render layout: false } end end # GET /t...
Ruby
class TourTypesController < ApplicationController layout 'admin' # GET /tour_types # GET /tour_types.json def index @tour_types = TourType.all respond_to do |format| format.js { render layout: false } end end # GET /tour_types/1 # GET /tour_types/1.json def show @tour_type = ...
Ruby
class PropertyTypesController < ApplicationController layout 'admin' # GET /property_types # GET /property_types.json def index @property_types = PropertyType.all respond_to do |format| format.html # index.html.erb format.json { render json: @property_types } end end # GET /propert...
Ruby
class AdminController < ApplicationController before_filter :current_user, :is_admin def index end end
Ruby
class StatusesController < ApplicationController layout 'admin' # GET /statuses # GET /statuses.json def index @statuses = Status.all respond_to do |format| format.html # index.html.erb format.json { render json: @statuses } end end # GET /statuses/1 # GET /statuses/1.json def ...
Ruby
class CountriesController < ApplicationController layout 'admin' # GET /countries # GET /countries.json def index @countries = Country.all respond_to do |format| format.html # index.html.erb format.json { render json: @countries } end end # GET /countries/1 # GET /countries/1.jso...
Ruby
class SessionsController < ApplicationController layout 'devise' def new end def create user = User.authenticate(params[:email], params[:password]) if user session[:user_id] = user.id session[:user_type_id] = user.user_type_id session[:email] = user.email session[:first...
Ruby
class HotelRoomTypesController < ApplicationController # GET /hotel_room_types # GET /hotel_room_types.json def index if params[:hid] @hotel_room_types = HotelRoomType.where('hotel_id =?', params[:hid]) respond_to do |format| format.js { render layout: false } end end end #...
Ruby
# Be sure to restart your server when you modify this file. # Add new inflection rules using the following format # (all these examples are active by default): # ActiveSupport::Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person', ...
Ruby
# Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } # You can also remove all the silencers if you're trying to debug a probl...
Ruby
# Be sure to restart your server when you modify this file. # # This file contains settings for ActionController::ParamsWrapper which # is enabled by default. # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_controller) do wrap_parameters ...
Ruby
# Be sure to restart your server when you modify this file. # Your secret key for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attac...
Ruby
# Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register_alias "text/html", :iphone
Ruby
# Be sure to restart your server when you modify this file. BaliFantastico::Application.config.session_store :cookie_store, key: '_Bali-Fantastico_session' # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information # (create the session tabl...
Ruby
BaliFantastico::Application.routes.draw do resources :transport_types resources :transport_packages resources :transports resources :transport_images resources :hotel_room_types do collection do delete 'destroy_multiple' get 'room_facility_list' post 'room_facility_selected' end ...
Ruby
require 'rubygems' # Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
Ruby
require File.expand_path('../boot', __FILE__) require 'rails/all' if defined?(Bundler) # If you precompile assets before deploying to production, use this line Bundler.require(*Rails.groups(:assets => %w(development test))) # If you want your assets lazily compiled in production, use this line # Bundler.requi...
Ruby
# Load the rails application require File.expand_path('../application', __FILE__) # Initialize the rails application BaliFantastico::Application.initialize!
Ruby
BaliFantastico::Application.configure do # Settings specified here will take precedence over those in config/application.rb # Code is not reloaded between requests config.cache_classes = true # Full error reports are disabled and caching is turned on config.consider_all_requests_local = false config...
Ruby
BaliFantastico::Application.configure do # Settings specified here will take precedence over those in config/application.rb # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the...
Ruby
BaliFantastico::Application.configure do # Settings specified here will take precedence over those in config/application.rb # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the ...
Ruby
# This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) run BaliFantastico::Application
Ruby
#!/usr/bin/env rake # 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.expand_path('../config/application', __FILE__) BaliFantastico::Application.load_tasks
Ruby
class CreateUsers < ActiveRecord::Migration def up create_table :users do |t| t.string :profile_id t.string :email t.string :refresh_token end add_index :users, :profile_id end def down drop_table :users end end
Ruby
# Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Ruby