first commit
This commit is contained in:
commit
32c9f9be04
|
@ -0,0 +1,8 @@
|
||||||
|
.bundle/
|
||||||
|
log/*.log
|
||||||
|
pkg/
|
||||||
|
test/dummy/db/*.sqlite3
|
||||||
|
test/dummy/db/*.sqlite3-journal
|
||||||
|
test/dummy/log/*.log
|
||||||
|
test/dummy/tmp/
|
||||||
|
test/dummy/.sass-cache
|
|
@ -0,0 +1,15 @@
|
||||||
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
|
# Declare your gem's dependencies in property_hire.gemspec.
|
||||||
|
# Bundler will treat runtime dependencies like base dependencies, and
|
||||||
|
# development dependencies will be added by default to the :development group.
|
||||||
|
gemspec
|
||||||
|
|
||||||
|
# Declare any dependencies that are still in development here instead of in
|
||||||
|
# your gemspec. These might include edge Rails or gems from your path or
|
||||||
|
# Git. Remember to move these dependencies to your gemspec before releasing
|
||||||
|
# your gem to rubygems.org.
|
||||||
|
|
||||||
|
# To use a debugger
|
||||||
|
# gem 'byebug', group: [:development, :test]
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
Copyright 2017 Harry Bomrah
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,3 @@
|
||||||
|
= PropertyHire
|
||||||
|
|
||||||
|
This project rocks and uses MIT-LICENSE.
|
|
@ -0,0 +1,37 @@
|
||||||
|
begin
|
||||||
|
require 'bundler/setup'
|
||||||
|
rescue LoadError
|
||||||
|
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
||||||
|
end
|
||||||
|
|
||||||
|
require 'rdoc/task'
|
||||||
|
|
||||||
|
RDoc::Task.new(:rdoc) do |rdoc|
|
||||||
|
rdoc.rdoc_dir = 'rdoc'
|
||||||
|
rdoc.title = 'PropertyHire'
|
||||||
|
rdoc.options << '--line-numbers'
|
||||||
|
rdoc.rdoc_files.include('README.rdoc')
|
||||||
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
||||||
|
end
|
||||||
|
|
||||||
|
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
||||||
|
load 'rails/tasks/engine.rake'
|
||||||
|
|
||||||
|
|
||||||
|
load 'rails/tasks/statistics.rake'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Bundler::GemHelper.install_tasks
|
||||||
|
|
||||||
|
require 'rake/testtask'
|
||||||
|
|
||||||
|
Rake::TestTask.new(:test) do |t|
|
||||||
|
t.libs << 'lib'
|
||||||
|
t.libs << 'test'
|
||||||
|
t.pattern = 'test/**/*_test.rb'
|
||||||
|
t.verbose = false
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
task default: :test
|
|
@ -0,0 +1,13 @@
|
||||||
|
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
||||||
|
// listed below.
|
||||||
|
//
|
||||||
|
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
||||||
|
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
||||||
|
//
|
||||||
|
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
||||||
|
// compiled file.
|
||||||
|
//
|
||||||
|
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
||||||
|
// about supported directives.
|
||||||
|
//
|
||||||
|
//= require_tree .
|
|
@ -0,0 +1,597 @@
|
||||||
|
var Calendar = function(dom,property_id){
|
||||||
|
|
||||||
|
c = this;
|
||||||
|
this.title = $("#current_title");
|
||||||
|
this.calendar = $(dom);
|
||||||
|
this.nextBtn = $("#next_month_btn");
|
||||||
|
this.prevBtn = $("#prev_month_btn");
|
||||||
|
this.todayBtn = $("#today_btn");
|
||||||
|
this.modeBtns = $(".calendar_mode button");
|
||||||
|
this.refreshBtn = $("#refresh_btn");
|
||||||
|
this.dialog = new EventDialog(c);
|
||||||
|
this.loading = $('#calendar-loading');
|
||||||
|
this.agenda_space = $("#calendar_agenda");
|
||||||
|
this.currentView = "month";
|
||||||
|
this.property_id = property_id;
|
||||||
|
this.navigation = $("#navigation");
|
||||||
|
this.rangeSelection = $("#range_selection");
|
||||||
|
var agendaView = new AgendaView(c);
|
||||||
|
var loadeventsonviewchange = false;
|
||||||
|
this.initialize = function(){
|
||||||
|
var date = new Date();
|
||||||
|
var d = date.getDate();
|
||||||
|
var m = date.getMonth();
|
||||||
|
var y = date.getFullYear();
|
||||||
|
var dview = (c.currentView == "agenda" ? "month" : c.currentView);
|
||||||
|
c.calendar.fullCalendar({
|
||||||
|
editable: false,
|
||||||
|
selectable: false,
|
||||||
|
events: "/xhr/property_hires/get_bookings?property_id="+c.property_id,
|
||||||
|
header: false,
|
||||||
|
default: dview,
|
||||||
|
height: $("body").height() - 141,
|
||||||
|
loading: function(bool) {
|
||||||
|
if (bool) c.loading.css("left",($(window).width()/2 - 60) + "px").show();
|
||||||
|
else c.loading.hide();
|
||||||
|
},
|
||||||
|
windowResize : function(view){
|
||||||
|
view.setHeight($("body").height() - 141);
|
||||||
|
c.calendar.fullCalendar("refetchEvents");
|
||||||
|
},
|
||||||
|
viewDisplay: function(view) {
|
||||||
|
c.title.html(view.title);
|
||||||
|
},
|
||||||
|
eventClick: function(calEvent, e, view) {
|
||||||
|
c.dialog.dismiss();
|
||||||
|
c.dialog.inflate(calEvent);
|
||||||
|
c.dialog.show({"x":e.originalEvent.clientX,"y":e.originalEvent.clientY});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
c.nextBtn.click(function(){
|
||||||
|
c.dialog.dismiss();
|
||||||
|
c.calendar.fullCalendar('next');
|
||||||
|
});
|
||||||
|
c.prevBtn.click(function(){
|
||||||
|
c.dialog.dismiss();
|
||||||
|
c.calendar.fullCalendar('prev');
|
||||||
|
});
|
||||||
|
c.todayBtn.click(function(){
|
||||||
|
c.dialog.dismiss();
|
||||||
|
c.calendar.fullCalendar('today');
|
||||||
|
});
|
||||||
|
c.modeBtns.click(function(){
|
||||||
|
c.dialog.dismiss();
|
||||||
|
toggleViews($(this).data("mode"));
|
||||||
|
});
|
||||||
|
c.refreshBtn.click(function(){
|
||||||
|
c.dialog.dismiss();
|
||||||
|
if(c.currentView == "agenda")
|
||||||
|
agendaView.refresh();
|
||||||
|
else
|
||||||
|
c.calendar.fullCalendar("refetchEvents");
|
||||||
|
});
|
||||||
|
|
||||||
|
var toggleViews = function(view){
|
||||||
|
c.modeBtns.removeClass("active");
|
||||||
|
c.modeBtns.each(function(){
|
||||||
|
if ($(this).data("mode") == view)
|
||||||
|
$(this).addClass("active");
|
||||||
|
})
|
||||||
|
if(view != "agenda"){
|
||||||
|
if(c.currentView == "agenda"){
|
||||||
|
// $("#sec1").addClass("span3").removeClass("span7");
|
||||||
|
$("#sec2").show();
|
||||||
|
// $("#sec3").addClass("span4").removeClass("span5");
|
||||||
|
agendaView.hide();
|
||||||
|
}
|
||||||
|
c.calendar.fullCalendar('changeView',view);
|
||||||
|
}else{
|
||||||
|
// $("#sec1").addClass("span7").removeClass("span3");
|
||||||
|
$("#sec2").hide();
|
||||||
|
// $("#sec3").addClass("span5").removeClass("span4");
|
||||||
|
agendaView.inflate();
|
||||||
|
}
|
||||||
|
c.currentView = view;
|
||||||
|
if(loadeventsonviewchange){
|
||||||
|
c.calendar.fullCalendar("refetchEvents");
|
||||||
|
loadeventsonviewchange = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(c.currentView == "agenda"){toggleViews("agenda");loadeventsonviewchange = true;}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
this.renderEvent = function(eventStick){
|
||||||
|
if(eventStick.recurring == true)
|
||||||
|
c.calendar.fullCalendar("refetchEvents");
|
||||||
|
else
|
||||||
|
c.calendar.fullCalendar("renderEvent",eventStick);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
c.initialize();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var EventDialog = function(calendar,event){
|
||||||
|
_t = this;
|
||||||
|
var event_quick_view = null;
|
||||||
|
var template = "";
|
||||||
|
var _this_event = null;
|
||||||
|
var month_names = ["Jan","Feb","March","April","May","June","July","Aug","Sep","Oct","Nov","Dec"];
|
||||||
|
this.inflate = function(_event){
|
||||||
|
if(!_event) throw new UserException("EventStick can't be null!");
|
||||||
|
_this_event = _event;
|
||||||
|
var start_time = "",
|
||||||
|
end_time = "",
|
||||||
|
time_string = null;
|
||||||
|
|
||||||
|
if(_event.allDay) {
|
||||||
|
start_time = $.fullCalendar.formatDate(_event._start,"MMM dd, yyyy");
|
||||||
|
if(_event._end)
|
||||||
|
end_time = $.fullCalendar.formatDate(_event._end,"MMM dd, yyyy");
|
||||||
|
time_string = (_event._start === _event._end || !_event._end ? "<p class='start-date'><i class='icons-calendar' /> " + start_time + "</p>" : "<i class='icons-calendar' /> " + start_time + " <i class='icons-arrow-right-5' /> " + end_time + "");
|
||||||
|
} else {
|
||||||
|
var sh = _event._start.getHours() > 12 ? _event._start.getHours() - 12 : _event._start.getHours(),
|
||||||
|
eh = _event._end.getHours() > 12 ? _event._end.getHours() - 12 : _event._end.getHours(),
|
||||||
|
sm = _event._start.getMinutes() < 10 ? '0' + _event._start.getMinutes() : _event._start.getMinutes(),
|
||||||
|
em = _event._end.getMinutes() < 10 ? '0' + _event._end.getMinutes() : _event._end.getMinutes(),
|
||||||
|
stime = _event._start.getHours() > 12 ? sh + ':' + sm + " PM" : sh + ':' + sm + " AM",
|
||||||
|
etime = _event._end.getHours() > 12 ? eh + ':' + em + " PM" : eh + ':' + em + " AM",
|
||||||
|
same = (_event._start.getDate() == _event._end.getDate() && _event._start.getMonth() == _event._end.getMonth() && _event._start.getFullYear() == _event._end.getFullYear());
|
||||||
|
start_time = month_names[_event._start.getMonth()] + " " + _event._start.getDate() + ", " + _event._start.getFullYear();
|
||||||
|
end_time = month_names[_event._end.getMonth()] + " " + _event._end.getDate() + ", " + _event._end.getFullYear();
|
||||||
|
|
||||||
|
time_string = (same ? "<p class='date'><i class='icons-calendar' /> " + start_time + "</p><p class='time'><i class='icons-clock' /> " + stime + " <i class='icons-arrow-right-5' /> " + etime : "<p class='start-date'><i class='icons-arrow-right-2' /> " + start_time + "<span class='pull-right'>" + stime + "</span></p><p class='end-date'><i class='icons-arrow-left-2' /> " + end_time + "<span class='pull-right'>" + etime + "</p>");
|
||||||
|
}
|
||||||
|
event_quick_view = $('<div class="calendar-modal" style="display:none;"></div>');
|
||||||
|
template = '<div class="modal-content">' +
|
||||||
|
'<div class="modal-header">' +
|
||||||
|
'<button type="button" class="close event-close-btn" data-dismiss="modal" aria-hidden="true">×</button>' +
|
||||||
|
'<h3>' + _event.title + '</h3>' +
|
||||||
|
'</div>' +
|
||||||
|
'<div class="modal-body">' +
|
||||||
|
'<div class="event_summary">' + time_string + '</div>' +
|
||||||
|
_event.note +
|
||||||
|
'</div>' +
|
||||||
|
'<div class="modal-footer" />' +
|
||||||
|
'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
this.show = function(pos){
|
||||||
|
if(pos){
|
||||||
|
var pos = getPosition(pos);
|
||||||
|
event_quick_view.css({"left":pos.x+"px","top":pos.y+"px"});
|
||||||
|
}
|
||||||
|
event_quick_view.html(template).appendTo("body").show();
|
||||||
|
event_quick_view.find(".event-close-btn").one("click",function(){_t.dismiss();});
|
||||||
|
event_quick_view.find("a.delete").one("click",function(){calendar.deleteEvent(_this_event.delete_url,_this_event._id);return false;});
|
||||||
|
event_quick_view.find("a.edit").one("click",function(){calendar.editEvent(_this_event.edit_url,_this_event.allDay);return false;});
|
||||||
|
}
|
||||||
|
|
||||||
|
this.dismiss = function(){
|
||||||
|
if(event_quick_view)
|
||||||
|
event_quick_view.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
var getPosition = function(pos){
|
||||||
|
var x = pos.x,
|
||||||
|
y = pos.y,
|
||||||
|
winheight = $(window).height();
|
||||||
|
if((x + event_quick_view.width()) > $(window).width()){
|
||||||
|
x = x - event_quick_view.width();
|
||||||
|
}
|
||||||
|
if((y + event_quick_view.height()) > winheight){
|
||||||
|
y = y - event_quick_view.height();
|
||||||
|
}
|
||||||
|
return {"x":x,"y":y};
|
||||||
|
}
|
||||||
|
|
||||||
|
if(event)
|
||||||
|
_t.inflate(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
var UserException = function(message) {
|
||||||
|
this.message = message;
|
||||||
|
this.name = "UserException";
|
||||||
|
this.toString = function(){
|
||||||
|
return this.message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var AgendaView = function(calendar){
|
||||||
|
var av = this;
|
||||||
|
var _calendar = calendar;
|
||||||
|
var agenda_space = _calendar.agenda_space;
|
||||||
|
var today = new Date();
|
||||||
|
var minDifference = 6;
|
||||||
|
var start_month = today.getMonth();
|
||||||
|
var start_year = today.getFullYear();
|
||||||
|
var end_month = ((start_month + minDifference) > 11 ? (start_month + minDifference) - 11 : start_month + minDifference);
|
||||||
|
var end_year = ((start_month + minDifference) > 11 ? start_year+1 : start_year);
|
||||||
|
var monthNames = ['January','February','March','April','May','June','July','August','September','October','November','December'];
|
||||||
|
var month_template = '<div class="col-md-4">' +
|
||||||
|
'<h4></h4>' +
|
||||||
|
'<div class="tiny_calendar">' +
|
||||||
|
'<table class="table table-condensed table-bordered">' +
|
||||||
|
'<tbody>' +
|
||||||
|
'<tr>' +
|
||||||
|
'<th class="week_title">Sun</th>' +
|
||||||
|
'<th class="week_title">Mon</th>' +
|
||||||
|
'<th class="week_title">Tue</th>' +
|
||||||
|
'<th class="week_title">Wed</th>' +
|
||||||
|
'<th class="week_title">Thu</th>' +
|
||||||
|
'<th class="week_title">Fri</th>' +
|
||||||
|
'<th class="week_title">Sat</th>' +
|
||||||
|
'</tr>' +
|
||||||
|
'</tbody>' +
|
||||||
|
'</table>' +
|
||||||
|
'</div>' +
|
||||||
|
'</div>';
|
||||||
|
|
||||||
|
var event_list_template = '<div class="col-md-8 agenda-event">' +
|
||||||
|
'<table class="table table-condensed table-bordered event_list">' +
|
||||||
|
'<thead>' +
|
||||||
|
'<tr>' +
|
||||||
|
'<th>Date</th>' +
|
||||||
|
'<th>Time</th>' +
|
||||||
|
'<th>Events</th>' +
|
||||||
|
'</tr>' +
|
||||||
|
'</thead>' +
|
||||||
|
'<tbody>' +
|
||||||
|
'<tr>' +
|
||||||
|
'<td colspan="3" class="no_events">No events for this month.</td>' +
|
||||||
|
'</tr>' +
|
||||||
|
'</tbody>' +
|
||||||
|
'</table>' +
|
||||||
|
'</div>';
|
||||||
|
|
||||||
|
var head_template = '<div>' +
|
||||||
|
'<label>From</label>' +
|
||||||
|
'<select name="start_month" class="form-control input-sm" />' +
|
||||||
|
'<select name="start_year" class="form-control input-sm" />' +
|
||||||
|
'<label>To</label>' +
|
||||||
|
'<select name="end_month" class="form-control input-sm" />' +
|
||||||
|
'<select name="end_year" class="form-control input-sm" />' +
|
||||||
|
'<button id="show_events" class="btn btn-sm bt-filter btn-primary">Show Events</button>' +
|
||||||
|
'</div>';
|
||||||
|
|
||||||
|
var event_template = '<tr>' +
|
||||||
|
'<td />' +
|
||||||
|
'<td class="event_time" />' +
|
||||||
|
'<td>' +
|
||||||
|
'<div class="event" />' +
|
||||||
|
'</td>' +
|
||||||
|
'</tr>';
|
||||||
|
// var month_template = '<div class="span4"><h4></h4><div class="tiny_calendar"><table class="table"><tbody><tr><th class="week_title">Sun</th><th class="week_title">Mon</th><th class="week_title">Tue</th><th class="week_title">Wed</th><th class="week_title">Thu</th><th class="week_title">Fri</th><th class="week_title">Sat</th></tr></tbody></table></div></div>';
|
||||||
|
|
||||||
|
// var event_list_template = '<div class="span8"><table class="table event_list"><thead><tr height="0"><th class="span3"></th><th class="span2"></th><th class=""></th></tr></thead><tbody><tr><td colspan="3" class="no_events">No events for this month.</td></tr></tbody></table></div>';
|
||||||
|
|
||||||
|
// var head_template = '<div><label>From</label> <select name="start_month" class="input-small"></select><select name="start_year" class="input-small"></select><label>To</label> <select name="end_month" class="input-small"></select><select name="end_year" class="input-small"></select><button id="show_events" class="btn bt-filter">Show Events</button></div>';
|
||||||
|
|
||||||
|
// var event_template = "<tr><th></th><td class='event_time'></td><td><div class='event'></div></td></tr>";
|
||||||
|
|
||||||
|
var cache = false;
|
||||||
|
var show_event_clicked = false;
|
||||||
|
|
||||||
|
this.refresh = function(){
|
||||||
|
av.inflate(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.inflate = function(forceInflation){
|
||||||
|
loading(true);
|
||||||
|
_calendar.calendar.hide();
|
||||||
|
_calendar.navigation.hide();
|
||||||
|
|
||||||
|
if(!forceInflation){
|
||||||
|
if(cache){
|
||||||
|
av.show();
|
||||||
|
loading(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
agenda_space.empty();
|
||||||
|
if(!show_event_clicked){
|
||||||
|
_calendar.rangeSelection.empty();
|
||||||
|
_calendar.rangeSelection.append(renderHead().html()).show();
|
||||||
|
_calendar.rangeSelection.find("button#show_events").click(function(){
|
||||||
|
show_event_clicked = true;
|
||||||
|
start_month = parseInt($("select[name=start_month]").val());
|
||||||
|
end_month = parseInt($("select[name=end_month]").val());
|
||||||
|
start_year = parseInt($("select[name=start_year]").val());
|
||||||
|
end_year = parseInt($("select[name=end_year]").val());
|
||||||
|
av.inflate(true);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
show_event_clicked = false;
|
||||||
|
eventsManager();
|
||||||
|
var s = start_month,
|
||||||
|
e = end_month
|
||||||
|
y = start_year;
|
||||||
|
e = (e > s && start_year == end_year? e : e + 11);
|
||||||
|
if(end_year > start_year)
|
||||||
|
e = e + ((end_year - start_year -1) * 12);
|
||||||
|
else e--;
|
||||||
|
for(var i = s;i <= e+1; i++){
|
||||||
|
var m = new Month(s,y);
|
||||||
|
s++;
|
||||||
|
if(s > 11){
|
||||||
|
s = 0;
|
||||||
|
y++;
|
||||||
|
}
|
||||||
|
if(e == 0)
|
||||||
|
agenda_space.text("Invalid Range of Dates.")
|
||||||
|
else
|
||||||
|
agenda_space.append(m.monthDom);
|
||||||
|
}
|
||||||
|
|
||||||
|
loading(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.hide = function(){
|
||||||
|
cache = true;
|
||||||
|
_calendar.rangeSelection.hide();
|
||||||
|
agenda_space.hide();
|
||||||
|
_calendar.navigation.show();
|
||||||
|
_calendar.calendar.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.show = function(){
|
||||||
|
_calendar.rangeSelection.show();
|
||||||
|
agenda_space.show();
|
||||||
|
}
|
||||||
|
var copyObject = function(x){
|
||||||
|
return x.clone();
|
||||||
|
}
|
||||||
|
var eventsManager = function(){
|
||||||
|
var url = "/xhr/calendars/agenda",
|
||||||
|
sd = new Date(start_year,start_month,1),
|
||||||
|
ed = new Date(end_year,end_month+1,0),
|
||||||
|
usd = Math.round(sd/1000),
|
||||||
|
ued = Math.round(ed/1000);
|
||||||
|
$.ajax({
|
||||||
|
type : "get",
|
||||||
|
url : url,
|
||||||
|
data : {"agenda_start":sd.toLocaleString(),"agenda_end":ed.toLocaleString(),"page_id" : _calendar.page_id,"unix_start":usd,"unix_end":ued},
|
||||||
|
success : function(data){
|
||||||
|
$.each(data.events,function(i,e){
|
||||||
|
var ed = eventDom(e),
|
||||||
|
s = new Date(e.start),
|
||||||
|
e = new Date(e.end),
|
||||||
|
e_m = ((e.getMonth() > s.getMonth() || s.getMonth() == e.getMonth()) && s.getFullYear() == e.getFullYear() ? e.getMonth() : e.getMonth() + 12)
|
||||||
|
s_m = s.getMonth(),
|
||||||
|
s_y = s.getFullYear();
|
||||||
|
if(e.getFullYear() > s.getFullYear())
|
||||||
|
e_m = e_m + ((e.getFullYear() - s.getFullYear() -1) * 12);
|
||||||
|
for(var i = s_m; i < e_m + 1; i++){
|
||||||
|
var temp_ed = copyObject(ed);
|
||||||
|
var list = agenda_space.find("div[data-month="+s_m+"][data-year="+s_y+"] table.event_list tbody");
|
||||||
|
list.append(temp_ed);
|
||||||
|
s_m++;
|
||||||
|
if(s_m > 11){
|
||||||
|
s_m = 0;
|
||||||
|
s_y++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(s.getDate() == e.getDate() && s.getMonth() == s.getMonth() && e.getFullYear() == e.getFullYear()){
|
||||||
|
var td = agenda_space.find("td[data-date-node="+s.getDate()+"-"+s.getMonth()+"-"+s.getFullYear()+"]");
|
||||||
|
td.addClass("has_event");
|
||||||
|
}else{
|
||||||
|
var timeDiff = Math.abs(e.getTime() - s.getTime()),
|
||||||
|
diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24)),
|
||||||
|
c_m = s.getMonth(),
|
||||||
|
c_d = s.getDate(),
|
||||||
|
c_y = s.getFullYear(),
|
||||||
|
end_of_c_month = new Date(s.getFullYear(),s.getMonth()+1,0).getDate();
|
||||||
|
|
||||||
|
for(var i = 0; i <= diffDays; i++){
|
||||||
|
var td = agenda_space.find("td[data-date-node="+c_d+"-"+c_m+"-"+c_y+"]");
|
||||||
|
td.addClass("has_event");
|
||||||
|
c_d++;
|
||||||
|
if(c_d > end_of_c_month){
|
||||||
|
c_d = 1;
|
||||||
|
c_m++;
|
||||||
|
if(c_m > 11){
|
||||||
|
c_m = 0;
|
||||||
|
c_y++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
agenda_space.find("table.event_list tbody").each(function(){
|
||||||
|
if($(this).find("tr").length > 1)
|
||||||
|
$(this).find("td.no_events").parent().remove();
|
||||||
|
})
|
||||||
|
// nano scroller here
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
var eventDom = function(event){
|
||||||
|
var e_t = $(event_template),
|
||||||
|
s = new Date(event.start),
|
||||||
|
e = new Date(event.end),
|
||||||
|
dateFormat = "";
|
||||||
|
if(s.getDate() == e.getDate() && s.getMonth() == s.getMonth() && e.getFullYear() == e.getFullYear())
|
||||||
|
dateFormat = $.fullCalendar.formatDate(s, "ddd dd");
|
||||||
|
else
|
||||||
|
dateFormat = $.fullCalendar.formatDates(s, e, "ddd dd, MMM - {ddd dd, MMM}");
|
||||||
|
e_t.find("td:first").text(dateFormat);
|
||||||
|
e_t.find("td.event_time").text((event.allDay ? "All Day" : $.fullCalendar.formatDate(s, "hh:mm")));
|
||||||
|
e_t.find("div.event").text(event.title).css("color",event.color);
|
||||||
|
return e_t;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var loading = function(bool) {
|
||||||
|
if (bool) _calendar.loading.css("left",($(window).width()/2 - 60) + "px").show();
|
||||||
|
else _calendar.loading.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
var renderHead = function(){
|
||||||
|
var head = $(head_template);
|
||||||
|
var start_month_select = head.find("select[name=start_month]");
|
||||||
|
for(var i = 0; i < 12; i++){
|
||||||
|
var option = $("<option value='"+i+"'>"+monthNames[i]+"</option>");
|
||||||
|
if(i == start_month)
|
||||||
|
option.attr("selected","selected");
|
||||||
|
start_month_select.append(option);
|
||||||
|
}
|
||||||
|
var end_month_select = head.find("select[name=end_month]");
|
||||||
|
for(var i = 0; i < 12; i++){
|
||||||
|
var option = $("<option value='"+i+"'>"+monthNames[i]+"</option>");
|
||||||
|
if(i == end_month)
|
||||||
|
option.attr("selected","selected");
|
||||||
|
end_month_select.append(option);
|
||||||
|
}
|
||||||
|
|
||||||
|
var start_year_select = head.find("select[name=start_year]");
|
||||||
|
var y = start_year - 5;
|
||||||
|
for(var i = 0; i < 10; i++){
|
||||||
|
var option = $("<option value='"+y+"'>"+y+"</option>");
|
||||||
|
if(y == start_year)
|
||||||
|
option.attr("selected","selected");
|
||||||
|
start_year_select.append(option);
|
||||||
|
y++;
|
||||||
|
}
|
||||||
|
var end_year_select = head.find("select[name=end_year]");
|
||||||
|
y = start_year - 5;
|
||||||
|
for(var i = 0; i < 10; i++){
|
||||||
|
var option = $("<option value='"+y+"'>"+y+"</option>");
|
||||||
|
if(y == end_year)
|
||||||
|
option.attr("selected","selected");
|
||||||
|
end_year_select.append(option);
|
||||||
|
y++;
|
||||||
|
}
|
||||||
|
return head;
|
||||||
|
}
|
||||||
|
|
||||||
|
var Month = function(month,year){
|
||||||
|
_this = this;
|
||||||
|
this.monthDom = $("<div class='row' data-year='"+year+"' data-month='"+month+"'></div>");
|
||||||
|
var template = $(month_template);
|
||||||
|
var list_template = $(event_list_template);
|
||||||
|
var firstDay = new Date(year,month,1);
|
||||||
|
var lastDay = new Date(year,month+1,0);
|
||||||
|
var last_inserted_date = 1;
|
||||||
|
|
||||||
|
var renderMonth = function(){
|
||||||
|
var num_of_rows = getNumberOfRows(year,month)
|
||||||
|
for(var i = 0; i < num_of_rows; i++){
|
||||||
|
var tr = null;
|
||||||
|
if(i == 0)
|
||||||
|
tr = makeRow("first");
|
||||||
|
else if(i == (num_of_rows - 1)){
|
||||||
|
tr = makeRow("last");
|
||||||
|
}else{
|
||||||
|
tr = makeRow("middle");
|
||||||
|
}
|
||||||
|
if(tr == null){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
template.find("table.table tbody").append(tr);
|
||||||
|
template.find("h4").text(monthNames[firstDay.getMonth()] + " - " + firstDay.getFullYear());
|
||||||
|
}
|
||||||
|
_this.monthDom.append(template);
|
||||||
|
_this.monthDom.append(list_template);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getNumberOfRows(year, month) {
|
||||||
|
var day = 1,
|
||||||
|
sat_counter = 0,
|
||||||
|
sunday_counter = 0,
|
||||||
|
date = new Date(year, month, day);
|
||||||
|
|
||||||
|
while(date.getMonth() === month) {
|
||||||
|
if(date.getDay() === 0) {
|
||||||
|
sunday_counter++;
|
||||||
|
}else if(date.getDay() === 6) {
|
||||||
|
sat_counter++;
|
||||||
|
}
|
||||||
|
day++;
|
||||||
|
date = new Date(year, month, day);
|
||||||
|
}
|
||||||
|
return (sunday_counter == 5 && sat_counter == 5 ? 6 : 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
var makeRow = function(position){
|
||||||
|
if(last_inserted_date <= lastDay.getDate()){
|
||||||
|
var row = $("<tr></tr>");
|
||||||
|
switch (position){
|
||||||
|
case "first":
|
||||||
|
for(var i = 0;i < 7;i++){
|
||||||
|
var td = $("<td></td>");
|
||||||
|
if(i >= firstDay.getDay()){
|
||||||
|
td.text(last_inserted_date);
|
||||||
|
td.attr("data-date-node",last_inserted_date+"-"+firstDay.getMonth()+"-"+firstDay.getFullYear());
|
||||||
|
last_inserted_date++;
|
||||||
|
}
|
||||||
|
row.append(td);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "middle":
|
||||||
|
for(var i = 0;i < 7;i++){
|
||||||
|
var td = $("<td></td>");
|
||||||
|
td.text(last_inserted_date);
|
||||||
|
td.attr("data-date-node",last_inserted_date+"-"+firstDay.getMonth()+"-"+firstDay.getFullYear());
|
||||||
|
last_inserted_date++;
|
||||||
|
row.append(td);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "last":
|
||||||
|
for(var i = 0;i < 7;i++){
|
||||||
|
var td = $("<td></td>");
|
||||||
|
if(i <= lastDay.getDay()){
|
||||||
|
td.text(last_inserted_date);
|
||||||
|
td.attr("data-date-node",last_inserted_date+"-"+firstDay.getMonth()+"-"+firstDay.getFullYear());
|
||||||
|
last_inserted_date++;
|
||||||
|
}
|
||||||
|
row.append(td);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
var row = null;
|
||||||
|
}
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
|
||||||
|
renderMonth();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,15 @@
|
||||||
|
/*
|
||||||
|
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
||||||
|
* listed below.
|
||||||
|
*
|
||||||
|
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
||||||
|
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
||||||
|
*
|
||||||
|
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
||||||
|
* compiled file so the styles you add here take precedence over styles defined in any styles
|
||||||
|
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
||||||
|
* file per style scope.
|
||||||
|
*
|
||||||
|
*= require_tree .
|
||||||
|
*= require_self
|
||||||
|
*/
|
|
@ -0,0 +1,741 @@
|
||||||
|
/* orbit calendar */
|
||||||
|
#orbit_calendar {
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
-webkit-transition: all 0.3s ease;
|
||||||
|
-moz-transition: all 0.3s ease;
|
||||||
|
|
||||||
|
.cal-fn {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
#sec1 {
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
|
||||||
|
.internal-page & {
|
||||||
|
float: left;
|
||||||
|
|
||||||
|
@media screen and (max-width: 767px) {
|
||||||
|
float: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-toolbar {
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-inline {
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 767px) {
|
||||||
|
float: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#sec2 {
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
.current_day_title {
|
||||||
|
width: 100%;
|
||||||
|
line-height: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 767px) {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
|
||||||
|
.current_day_title {
|
||||||
|
margin: 0;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 479px) {
|
||||||
|
position: static;
|
||||||
|
|
||||||
|
.current_day_title {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#sec3 {
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
float: left;
|
||||||
|
|
||||||
|
.internal-page & {
|
||||||
|
.calendar_mode {
|
||||||
|
float: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 767px) {
|
||||||
|
float: none;
|
||||||
|
width: 100%;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 767px) {
|
||||||
|
float: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#range_selection {
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-right: 5px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
font-size: 12px;
|
||||||
|
|
||||||
|
& > * {
|
||||||
|
margin: 0 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 479px) {
|
||||||
|
margin-right: 0;
|
||||||
|
|
||||||
|
& > * {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
& > label,
|
||||||
|
#show_events {
|
||||||
|
display: block;
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
& > select {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 767px) {
|
||||||
|
& > select {
|
||||||
|
.internal-page & {
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-view {
|
||||||
|
font-size: 1em;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#view_holder {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.calendar_color_tag {
|
||||||
|
display: inline-block;
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
margin-right: 4px;
|
||||||
|
vertical-align: bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
.calendar_mode {
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mode_switch {
|
||||||
|
text-transform: capitalize;
|
||||||
|
}
|
||||||
|
|
||||||
|
.today {
|
||||||
|
background-color: #D9EDF7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.event {
|
||||||
|
font-size: 12px;
|
||||||
|
border-radius: 3px;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 1px 3px;
|
||||||
|
font-weight: bold;
|
||||||
|
box-shadow: inset 0 0 1px black;
|
||||||
|
-webkit-box-shadow: inset 0 0 1px black;
|
||||||
|
-moz-box-shadow: inset 0 0 1px black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-body {
|
||||||
|
max-height: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.event_list_wrapper {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.event_list {
|
||||||
|
.cell {
|
||||||
|
height: 39px;
|
||||||
|
border: solid 1px #ddd;
|
||||||
|
border-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.divide {
|
||||||
|
height: 19px;
|
||||||
|
margin-bottom: 18px;
|
||||||
|
border-bottom: solid 1px #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.day_time {
|
||||||
|
height: 31px;
|
||||||
|
border-bottom: solid 1px #ddd;
|
||||||
|
border-left: solid 1px #ddd;
|
||||||
|
text-align: right;
|
||||||
|
padding: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.event {
|
||||||
|
dl, dt, dd {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
dl {
|
||||||
|
padding: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
dt {
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: normal;
|
||||||
|
line-height: 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* day view */
|
||||||
|
#calendar_day {
|
||||||
|
.event_holder {
|
||||||
|
width: 100%;
|
||||||
|
/*height: 100%;*/
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header th {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.event {
|
||||||
|
margin-bottom: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.all_day_event {
|
||||||
|
background: #eee;
|
||||||
|
border: solid 1px #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.event_list .table {
|
||||||
|
border-top: solid 1px #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.event_list td {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.event_holder {
|
||||||
|
.inner {
|
||||||
|
position: relative;
|
||||||
|
margin: 0 16px 0 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.event {
|
||||||
|
padding: 0px;
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.event.half {}
|
||||||
|
|
||||||
|
.event.over {
|
||||||
|
border: solid 1px #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* month view */
|
||||||
|
#calendar_month {
|
||||||
|
border-bottom: solid 1px #ddd;
|
||||||
|
|
||||||
|
.month_row {
|
||||||
|
position: relative;
|
||||||
|
border: solid 1px #ddd;
|
||||||
|
border-bottom: 0;
|
||||||
|
height: 60px;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
&.header {
|
||||||
|
height: 28px;
|
||||||
|
border: 0;
|
||||||
|
|
||||||
|
th {
|
||||||
|
font-size: 12px;
|
||||||
|
padding: 4px;
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.table {
|
||||||
|
table-layout: fixed;
|
||||||
|
margin-bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
position: absolute;
|
||||||
|
|
||||||
|
td {
|
||||||
|
border: 0;
|
||||||
|
border-left: solid 1px #ddd;
|
||||||
|
padding: 2px 4px 0 4px;
|
||||||
|
|
||||||
|
&.today {
|
||||||
|
border-bottom: solid 1px #fff;
|
||||||
|
border-top: solid 1px #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.disable {
|
||||||
|
background-color: #f6f6f6;
|
||||||
|
color: #ccc;
|
||||||
|
border-left: solid 1px #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:first-child {
|
||||||
|
border-left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.month_table {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.month_date {
|
||||||
|
color: #666;
|
||||||
|
font-size: 11px;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
td {
|
||||||
|
border-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.day_title:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.event:hover {
|
||||||
|
text-decoration: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.event {
|
||||||
|
margin: 0 -2px;
|
||||||
|
position: relative;
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.event.single {
|
||||||
|
-webkit-box-shadow: none;
|
||||||
|
-moz-box-shadow: none;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* agenda view */
|
||||||
|
#calendar_agenda {
|
||||||
|
margin-top: 20px;
|
||||||
|
font-size: 12px;
|
||||||
|
|
||||||
|
> .row {
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table {
|
||||||
|
margin-bottom: 0;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tiny_calendar {
|
||||||
|
.table {
|
||||||
|
th {
|
||||||
|
text-align: center;
|
||||||
|
border-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.event {
|
||||||
|
-webkit-box-shadow: none;
|
||||||
|
-moz-box-shadow: none;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row-fluid {
|
||||||
|
margin-top: 20px;
|
||||||
|
padding-top: 20px;
|
||||||
|
border-top: dashed 1px #ddd;
|
||||||
|
|
||||||
|
&:first-child {
|
||||||
|
border-top: 0;
|
||||||
|
padding-top: 0;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.event_time {
|
||||||
|
font-family: Tahoma, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
.has_event {
|
||||||
|
background-color: #08c;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* week view */
|
||||||
|
#calendar_week {
|
||||||
|
.cell_wrapper {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
margin-bottom: 12px;
|
||||||
|
border-top: 0;
|
||||||
|
table-layout: fixed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
th {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
border: solid 1px #ddd;
|
||||||
|
/*background-color: #eee;*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.week_day {
|
||||||
|
padding: 0 2px;
|
||||||
|
border: solid 1px #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header .week_day {
|
||||||
|
padding: 2px 4px 0px 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.event_list .event {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cell_map {
|
||||||
|
margin-bottom: 18px;
|
||||||
|
|
||||||
|
td {
|
||||||
|
border-top: 0;
|
||||||
|
border-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
tr:first-child td {
|
||||||
|
border-top: solid 1px #ddd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.event_holder .inner {
|
||||||
|
margin: 0 8px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.all_day_event_holder {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
table-layout: fixed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.all_day_event_holder td {
|
||||||
|
border: 0;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.all_day_event {
|
||||||
|
background: #eee;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* calendars(category) */
|
||||||
|
.calendars_color_tag {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
display: inline-block;
|
||||||
|
border-radius: 3px;
|
||||||
|
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Event Controller */
|
||||||
|
.event_controller {
|
||||||
|
.form-horizontal {
|
||||||
|
margin-bottom: 0;
|
||||||
|
|
||||||
|
.control-label {
|
||||||
|
width: 60px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.controls {
|
||||||
|
margin-left: 80px;
|
||||||
|
|
||||||
|
input[type="text"],
|
||||||
|
select,
|
||||||
|
textarea,
|
||||||
|
.uneditable-input {
|
||||||
|
width: 100%;
|
||||||
|
height: 30px;
|
||||||
|
line-height: 30px;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="checkbox"] {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
height: auto;
|
||||||
|
line-height: 1em;
|
||||||
|
resize: vertical;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.last {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row-fluid {
|
||||||
|
margin-bottom: 6px;
|
||||||
|
|
||||||
|
.control-label {
|
||||||
|
line-height: 30px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.close {
|
||||||
|
border: 0;
|
||||||
|
background: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* miniColors tweak */
|
||||||
|
.miniColors-trigger {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
margin-left: 10px;
|
||||||
|
border-color: #f1f1f1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.miniColors-selector {
|
||||||
|
float: none;
|
||||||
|
margin: 4px 0 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* category edit */
|
||||||
|
.edit_cal {
|
||||||
|
margin: -8px;
|
||||||
|
background-color: whitesmoke;
|
||||||
|
|
||||||
|
.table,
|
||||||
|
.table td {
|
||||||
|
border: 0 !important;
|
||||||
|
background-color: transparent !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-list td {
|
||||||
|
border-top: solid 1px #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* create / edit event panel */
|
||||||
|
#tags_panel {
|
||||||
|
top: auto;
|
||||||
|
bottom: 34px;
|
||||||
|
width: 258px;
|
||||||
|
height: 170px;
|
||||||
|
padding: 8px 0;
|
||||||
|
overflow: hidden;
|
||||||
|
position: absolute;
|
||||||
|
clear: none;
|
||||||
|
|
||||||
|
.viewport {
|
||||||
|
height: 170px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scrollbar {
|
||||||
|
top: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#tags_list {
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bootstrap-datetimepicker-widget.dropdown-menu {
|
||||||
|
z-index: 1051;
|
||||||
|
}
|
||||||
|
|
||||||
|
#main-wrap {
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-other-month {
|
||||||
|
background-color: #F6F6F6;
|
||||||
|
}
|
||||||
|
|
||||||
|
#calendar-loading {
|
||||||
|
position: absolute;
|
||||||
|
top: 40%;
|
||||||
|
z-index: 10;
|
||||||
|
width: 120px;
|
||||||
|
height: 120px;
|
||||||
|
padding: 5px;
|
||||||
|
border-radius: 4px;
|
||||||
|
border: 1px solid #dbdbdb;
|
||||||
|
background-color: rgba(255, 255, 255, 0.95);
|
||||||
|
background-image: url("/assets/loading1.gif");
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: center 20px;
|
||||||
|
background-size: 50%;
|
||||||
|
box-shadow: 0 0 25px 0 rgba(0, 0, 0, 0.2);
|
||||||
|
|
||||||
|
&:after {
|
||||||
|
content: "Loading...";
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
line-height: 4em;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#event_create_space {
|
||||||
|
display: none;
|
||||||
|
position: fixed;
|
||||||
|
width: 400px;
|
||||||
|
margin: 0;
|
||||||
|
background-color: #fff;
|
||||||
|
z-index: 1050;
|
||||||
|
-webkit-border-radius: 6px;
|
||||||
|
-moz-border-radius: 6px;
|
||||||
|
border-radius: 6px;
|
||||||
|
outline: none;
|
||||||
|
-webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
|
||||||
|
-moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
|
||||||
|
box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
|
||||||
|
-webkit-background-clip: padding-box;
|
||||||
|
-moz-background-clip: padding-box;
|
||||||
|
background-clip: padding-box;
|
||||||
|
|
||||||
|
.alert {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.new_event {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
.modal-body {
|
||||||
|
overflow-x: hidden;
|
||||||
|
padding: 25px 25px 15px 15px;
|
||||||
|
}
|
||||||
|
.datetimepick {
|
||||||
|
> input {
|
||||||
|
width: 90%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.calendar-modal {
|
||||||
|
position: fixed;
|
||||||
|
z-index: 1050;
|
||||||
|
width: 300px;
|
||||||
|
margin: 0;
|
||||||
|
font-size: 12px;
|
||||||
|
|
||||||
|
& > .modal-content {
|
||||||
|
h3 {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.event_summary {
|
||||||
|
margin-right: -15px;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
margin-left: -15px;
|
||||||
|
padding-right: 15px;
|
||||||
|
padding-bottom: 15px;
|
||||||
|
padding-left: 15px;
|
||||||
|
border-bottom: 1px solid #eee;
|
||||||
|
|
||||||
|
> p {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
i {
|
||||||
|
color: #989898;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.calendar-form-actions {
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 0;
|
||||||
|
padding-top: 10px;
|
||||||
|
padding-right: 0;
|
||||||
|
padding-bottom: 0;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.agenda-event {
|
||||||
|
overflow-x: hidden;
|
||||||
|
overflow-y: auto;
|
||||||
|
height: 200px;
|
||||||
|
margin-top: 40px;
|
||||||
|
@media screen and (max-width: 767px) {
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,579 @@
|
||||||
|
/*!
|
||||||
|
* FullCalendar v1.6.1 Stylesheet
|
||||||
|
* Docs & License: http://arshaw.com/fullcalendar/
|
||||||
|
* (c) 2013 Adam Shaw
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
.fc {
|
||||||
|
direction: ltr;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
border-spacing: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
html .fc,
|
||||||
|
.fc table {
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc td,
|
||||||
|
.fc th {
|
||||||
|
padding: 0;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Header
|
||||||
|
------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
.fc-header td {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-header-left {
|
||||||
|
width: 25%;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-header-center {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-header-right {
|
||||||
|
width: 25%;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-header-title {
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-header-title h2 {
|
||||||
|
margin-top: 0;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc .fc-header-space {
|
||||||
|
padding-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-header .fc-button {
|
||||||
|
margin-bottom: 1em;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* buttons edges butting together */
|
||||||
|
|
||||||
|
.fc-header .fc-button {
|
||||||
|
margin-right: -1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-header .fc-corner-right, /* non-theme */
|
||||||
|
.fc-header .ui-corner-right { /* theme */
|
||||||
|
margin-right: 0; /* back to normal */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* button layering (for border precedence) */
|
||||||
|
|
||||||
|
.fc-header .fc-state-hover,
|
||||||
|
.fc-header .ui-state-hover {
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-header .fc-state-down {
|
||||||
|
z-index: 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-header .fc-state-active,
|
||||||
|
.fc-header .ui-state-active {
|
||||||
|
z-index: 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Content
|
||||||
|
------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
.fc-content {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-view {
|
||||||
|
width: 100%; /* needed for view switching (when view is absolute) */
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Cell Styles
|
||||||
|
------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
.fc-widget-header, /* <th>, usually */
|
||||||
|
.fc-widget-content { /* <td>, usually */
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-state-highlight { /* <td> today cell */ /* TODO: add .fc-today to <th> */
|
||||||
|
background: #fcf8e3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-cell-overlay { /* semi-transparent rectangle while dragging */
|
||||||
|
background: #bce8f1;
|
||||||
|
opacity: .3;
|
||||||
|
filter: alpha(opacity=30); /* for IE */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Buttons
|
||||||
|
------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
.fc-button {
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
padding: 0 .6em;
|
||||||
|
overflow: hidden;
|
||||||
|
height: 1.9em;
|
||||||
|
line-height: 1.9em;
|
||||||
|
white-space: nowrap;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-state-default { /* non-theme */
|
||||||
|
border: 1px solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-state-default.fc-corner-left { /* non-theme */
|
||||||
|
border-top-left-radius: 4px;
|
||||||
|
border-bottom-left-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-state-default.fc-corner-right { /* non-theme */
|
||||||
|
border-top-right-radius: 4px;
|
||||||
|
border-bottom-right-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Our default prev/next buttons use HTML entities like ‹ › « »
|
||||||
|
and we'll try to make them look good cross-browser.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.fc-text-arrow {
|
||||||
|
margin: 0 .1em;
|
||||||
|
font-size: 2em;
|
||||||
|
font-family: "Courier New", Courier, monospace;
|
||||||
|
vertical-align: baseline; /* for IE7 */
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-button-prev .fc-text-arrow,
|
||||||
|
.fc-button-next .fc-text-arrow { /* for ‹ › */
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* icon (for jquery ui) */
|
||||||
|
|
||||||
|
.fc-button .fc-icon-wrap {
|
||||||
|
position: relative;
|
||||||
|
float: left;
|
||||||
|
top: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-button .ui-icon {
|
||||||
|
position: relative;
|
||||||
|
float: left;
|
||||||
|
margin-top: -50%;
|
||||||
|
*margin-top: 0;
|
||||||
|
*top: -50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
button states
|
||||||
|
borrowed from twitter bootstrap (http://twitter.github.com/bootstrap/)
|
||||||
|
*/
|
||||||
|
|
||||||
|
.fc-state-default {
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);
|
||||||
|
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6));
|
||||||
|
background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6);
|
||||||
|
background-image: -o-linear-gradient(top, #ffffff, #e6e6e6);
|
||||||
|
background-image: linear-gradient(to bottom, #ffffff, #e6e6e6);
|
||||||
|
background-repeat: repeat-x;
|
||||||
|
border-color: #e6e6e6 #e6e6e6 #bfbfbf;
|
||||||
|
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||||
|
color: #333;
|
||||||
|
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
|
||||||
|
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-state-hover,
|
||||||
|
.fc-state-down,
|
||||||
|
.fc-state-active,
|
||||||
|
.fc-state-disabled {
|
||||||
|
color: #333333;
|
||||||
|
background-color: #e6e6e6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-state-hover {
|
||||||
|
color: #333333;
|
||||||
|
text-decoration: none;
|
||||||
|
background-position: 0 -15px;
|
||||||
|
-webkit-transition: background-position 0.1s linear;
|
||||||
|
-moz-transition: background-position 0.1s linear;
|
||||||
|
-o-transition: background-position 0.1s linear;
|
||||||
|
transition: background-position 0.1s linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-state-down,
|
||||||
|
.fc-state-active {
|
||||||
|
background-color: #cccccc;
|
||||||
|
background-image: none;
|
||||||
|
outline: 0;
|
||||||
|
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-state-disabled {
|
||||||
|
cursor: default;
|
||||||
|
background-image: none;
|
||||||
|
opacity: 0.65;
|
||||||
|
filter: alpha(opacity=65);
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Global Event Styles
|
||||||
|
------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
.fc-event {
|
||||||
|
border: 1px solid #3a87ad; /* default BORDER color */
|
||||||
|
background-color: #3a87ad; /* default BACKGROUND color */
|
||||||
|
color: #fff; /* default TEXT color */
|
||||||
|
font-size: .85em;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.fc-event {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.fc-event,
|
||||||
|
.fc-event-draggable {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-rtl .fc-event {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-event-inner {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-event-time,
|
||||||
|
.fc-event-title {
|
||||||
|
padding: 0 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc .ui-resizable-handle {
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 99999;
|
||||||
|
overflow: hidden; /* hacky spaces (IE6/7) */
|
||||||
|
font-size: 300%; /* */
|
||||||
|
line-height: 50%; /* */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Horizontal Events
|
||||||
|
------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
.fc-event-hori {
|
||||||
|
border-width: 1px 0;
|
||||||
|
margin-bottom: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-ltr .fc-event-hori.fc-event-start,
|
||||||
|
.fc-rtl .fc-event-hori.fc-event-end {
|
||||||
|
border-left-width: 1px;
|
||||||
|
border-top-left-radius: 3px;
|
||||||
|
border-bottom-left-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-ltr .fc-event-hori.fc-event-end,
|
||||||
|
.fc-rtl .fc-event-hori.fc-event-start {
|
||||||
|
border-right-width: 1px;
|
||||||
|
border-top-right-radius: 3px;
|
||||||
|
border-bottom-right-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* resizable */
|
||||||
|
|
||||||
|
.fc-event-hori .ui-resizable-e {
|
||||||
|
top: 0 !important; /* importants override pre jquery ui 1.7 styles */
|
||||||
|
right: -3px !important;
|
||||||
|
width: 7px !important;
|
||||||
|
height: 100% !important;
|
||||||
|
cursor: e-resize;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-event-hori .ui-resizable-w {
|
||||||
|
top: 0 !important;
|
||||||
|
left: -3px !important;
|
||||||
|
width: 7px !important;
|
||||||
|
height: 100% !important;
|
||||||
|
cursor: w-resize;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-event-hori .ui-resizable-handle {
|
||||||
|
_padding-bottom: 14px; /* IE6 had 0 height */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Reusable Separate-border Table
|
||||||
|
------------------------------------------------------------*/
|
||||||
|
|
||||||
|
table.fc-border-separate {
|
||||||
|
border-collapse: separate;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-border-separate th,
|
||||||
|
.fc-border-separate td {
|
||||||
|
border-width: 1px 0 0 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-border-separate th.fc-last,
|
||||||
|
.fc-border-separate td.fc-last {
|
||||||
|
border-right-width: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-border-separate tr.fc-last th,
|
||||||
|
.fc-border-separate tr.fc-last td {
|
||||||
|
border-bottom-width: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-border-separate tbody tr.fc-first td,
|
||||||
|
.fc-border-separate tbody tr.fc-first th {
|
||||||
|
border-top-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Month View, Basic Week View, Basic Day View
|
||||||
|
------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
.fc-grid th {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc .fc-week-number {
|
||||||
|
width: 22px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc .fc-week-number div {
|
||||||
|
padding: 0 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-grid .fc-day-number {
|
||||||
|
float: right;
|
||||||
|
padding: 0 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-grid .fc-other-month .fc-day-number {
|
||||||
|
opacity: 0.3;
|
||||||
|
filter: alpha(opacity=30); /* for IE */
|
||||||
|
/* opacity with small font can sometimes look too faded
|
||||||
|
might want to set the 'color' property instead
|
||||||
|
making day-numbers bold also fixes the problem */
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-grid .fc-day-content {
|
||||||
|
clear: both;
|
||||||
|
padding: 2px 2px 1px; /* distance between events and day edges */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* event styles */
|
||||||
|
|
||||||
|
.fc-grid .fc-event-time {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* right-to-left */
|
||||||
|
|
||||||
|
.fc-rtl .fc-grid .fc-day-number {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-rtl .fc-grid .fc-event-time {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Agenda Week View, Agenda Day View
|
||||||
|
------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
.fc-agenda table {
|
||||||
|
border-collapse: separate;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-agenda-days th {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-agenda .fc-agenda-axis {
|
||||||
|
width: 50px;
|
||||||
|
padding: 0 4px;
|
||||||
|
vertical-align: middle;
|
||||||
|
text-align: right;
|
||||||
|
white-space: nowrap;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-agenda .fc-week-number {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-agenda .fc-day-content {
|
||||||
|
padding: 2px 2px 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* make axis border take precedence */
|
||||||
|
|
||||||
|
.fc-agenda-days .fc-agenda-axis {
|
||||||
|
border-right-width: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-agenda-days .fc-col0 {
|
||||||
|
border-left-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* all-day area */
|
||||||
|
|
||||||
|
.fc-agenda-allday th {
|
||||||
|
border-width: 0 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-agenda-allday .fc-day-content {
|
||||||
|
/*min-height: 34px; *//* TODO: doesnt work well in quirksmode */
|
||||||
|
_height: 34px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* divider (between all-day and slots) */
|
||||||
|
|
||||||
|
.fc-agenda-divider-inner {
|
||||||
|
height: 2px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-widget-header .fc-agenda-divider-inner {
|
||||||
|
background: #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* slot rows */
|
||||||
|
|
||||||
|
.fc-agenda-slots th {
|
||||||
|
border-width: 1px 1px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-agenda-slots td {
|
||||||
|
border-width: 1px 0 0;
|
||||||
|
background: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-agenda-slots td div {
|
||||||
|
height: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-agenda-slots tr.fc-slot0 th,
|
||||||
|
.fc-agenda-slots tr.fc-slot0 td {
|
||||||
|
border-top-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-agenda-slots tr.fc-minor th,
|
||||||
|
.fc-agenda-slots tr.fc-minor td {
|
||||||
|
border-top-style: dotted;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-agenda-slots tr.fc-minor th.ui-widget-header {
|
||||||
|
*border-top-style: solid; /* doesn't work with background in IE6/7 */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Vertical Events
|
||||||
|
------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
.fc-event-vert {
|
||||||
|
border-width: 0 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-event-vert.fc-event-start {
|
||||||
|
border-top-width: 1px;
|
||||||
|
border-top-left-radius: 3px;
|
||||||
|
border-top-right-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-event-vert.fc-event-end {
|
||||||
|
border-bottom-width: 1px;
|
||||||
|
border-bottom-left-radius: 3px;
|
||||||
|
border-bottom-right-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-event-vert .fc-event-time {
|
||||||
|
white-space: nowrap;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-event-vert .fc-event-inner {
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-event-vert .fc-event-bg { /* makes the event lighter w/ a semi-transparent overlay */
|
||||||
|
position: absolute;
|
||||||
|
z-index: 1;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background: #fff;
|
||||||
|
opacity: .25;
|
||||||
|
filter: alpha(opacity=25);
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc .ui-draggable-dragging .fc-event-bg, /* TODO: something nicer like .fc-opacity */
|
||||||
|
.fc-select-helper .fc-event-bg {
|
||||||
|
display: none\9; /* for IE6/7/8. nested opacity filters while dragging don't work */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* resizable */
|
||||||
|
|
||||||
|
.fc-event-vert .ui-resizable-s {
|
||||||
|
bottom: 0 !important; /* importants override pre jquery ui 1.7 styles */
|
||||||
|
width: 100% !important;
|
||||||
|
height: 8px !important;
|
||||||
|
overflow: hidden !important;
|
||||||
|
line-height: 8px !important;
|
||||||
|
font-size: 11px !important;
|
||||||
|
font-family: monospace;
|
||||||
|
text-align: center;
|
||||||
|
cursor: s-resize;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-agenda .ui-resizable-resizing { /* TODO: better selector */
|
||||||
|
_overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,147 @@
|
||||||
|
class Admin::PropertyHiresController < OrbitAdminController
|
||||||
|
|
||||||
|
def index
|
||||||
|
@tags = @module_app.tags
|
||||||
|
@categories = @module_app.categories.enabled
|
||||||
|
@filter_fields = filter_fields(@categories, @tags)
|
||||||
|
@table_fields = ["property_hire.title", :category, "property_hire.location", "property_hire.available_for_hire"]
|
||||||
|
|
||||||
|
@properties = Property.where(:title.ne => "")
|
||||||
|
.order_by(sort)
|
||||||
|
.with_categories(filters("category"))
|
||||||
|
.with_tags(filters("tag"))
|
||||||
|
|
||||||
|
@properties = search_data(@properties,[:title]).page(params[:page]).per(10)
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
@property = Property.new
|
||||||
|
@locations = PropertyLocation.all.desc(:created_at).collect{|loc| [loc.title, loc.id.to_s]}
|
||||||
|
@locations << ["Other", "other_location"]
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
@property = Property.where(:uid => params[:id].split("-").last).first rescue nil
|
||||||
|
@locations = PropertyLocation.all.desc(:created_at).collect{|loc| [loc.title, loc.id.to_s]}
|
||||||
|
@locations << ["Other", "other_location"]
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
@table_fields = ["property_hire.hiring_person_name", "property_hire.reason_for_hire", "property_hire.hiring_person_number", "property_hire.period", "property_hire.passed", :actions]
|
||||||
|
@property = Property.where(:uid => params[:id].split("-").last).first rescue nil
|
||||||
|
@bookings = @property.p_hires.desc(:created_at).page(params[:page]).per(10)
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
property = Property.find(params[:id]) rescue nil
|
||||||
|
property.destroy if !property.nil?
|
||||||
|
if params[:page]
|
||||||
|
redirect_to admin_property_hires_path(:page => params[:page])
|
||||||
|
else
|
||||||
|
redirect_to admin_property_hires_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
property = Property.where(:uid => params[:id].split("-").last).first rescue nil
|
||||||
|
redirect_to admin_property_hires_path and return if property.nil?
|
||||||
|
property.update_attributes(property_params)
|
||||||
|
if params[:page]
|
||||||
|
redirect_to admin_property_hires_path(:page => params[:page])
|
||||||
|
else
|
||||||
|
redirect_to admin_property_hires_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
property = Property.new(property_params)
|
||||||
|
if property.save
|
||||||
|
redirect_to admin_property_hires_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def show_booking_details
|
||||||
|
@booking = PHire.find(params[:id]) rescue nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def pass_booking
|
||||||
|
phire = PHire.find(params[:id]) rescue nil
|
||||||
|
case params[:status]
|
||||||
|
when "accept"
|
||||||
|
phire.passed = true
|
||||||
|
when "reject"
|
||||||
|
phire.passed = false
|
||||||
|
end
|
||||||
|
phire.save
|
||||||
|
if params[:ref] == "index"
|
||||||
|
if params[:page]
|
||||||
|
redirect_to admin_property_hire_path(phire.property, :page => params[:page])
|
||||||
|
else
|
||||||
|
redirect_to admin_property_hire_path(phire.property)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
redirect_to show_booking_details_admin_property_hire_path(phire)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def manage_locations
|
||||||
|
@table_fields = ["property_hire.location", "property_hire.property_count"]
|
||||||
|
@locations = PropertyLocation.all.desc(:created_at).page(params[:page]).per(10)
|
||||||
|
end
|
||||||
|
|
||||||
|
def add_location
|
||||||
|
@location = PropertyLocation.new
|
||||||
|
render :layout => false
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_location
|
||||||
|
PropertyLocation.create(location_params)
|
||||||
|
redirect_to manage_locations_admin_property_hires_path
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit_location
|
||||||
|
@location = PropertyLocation.find(params[:id])
|
||||||
|
render :layout => false
|
||||||
|
end
|
||||||
|
|
||||||
|
def update_location
|
||||||
|
location = PropertyLocation.find(params[:id]) rescue nil
|
||||||
|
if location.nil?
|
||||||
|
redirect_to manage_locations_admin_property_hires_path
|
||||||
|
else
|
||||||
|
location.update_attributes(location_params)
|
||||||
|
if params[:page]
|
||||||
|
redirect_to manage_locations_admin_property_hires_path(:page => params[:page])
|
||||||
|
else
|
||||||
|
redirect_to manage_locations_admin_property_hires_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy_location
|
||||||
|
location = PropertyLocation.find(params[:id]) rescue nil
|
||||||
|
if location.nil?
|
||||||
|
redirect_to manage_locations_admin_property_hires_path
|
||||||
|
else
|
||||||
|
location.destroy
|
||||||
|
if params[:page]
|
||||||
|
redirect_to manage_locations_admin_property_hires_path(:page => params[:page])
|
||||||
|
else
|
||||||
|
redirect_to manage_locations_admin_property_hires_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def location_params
|
||||||
|
params.require(:property_location).permit!
|
||||||
|
end
|
||||||
|
|
||||||
|
def property_params
|
||||||
|
prop = params.require(:property).permit!
|
||||||
|
prop.delete(:property_location) if prop[:property_location] == "other"
|
||||||
|
prop
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,211 @@
|
||||||
|
class PropertyHiresController < ApplicationController
|
||||||
|
include Admin::PropertyHiresHelper
|
||||||
|
def index
|
||||||
|
properties = Property.filter_by_categories.filter_by_tags.desc(:created_at)
|
||||||
|
data = properties.collect do |property|
|
||||||
|
actions = []
|
||||||
|
if property.can_be_hired
|
||||||
|
actions << {
|
||||||
|
"text" => t("property_hire.hire"),
|
||||||
|
"btn-class" => "btn-primary",
|
||||||
|
"link" => OrbitHelper.url_to_show(property.to_param) + "?method=hire"
|
||||||
|
}
|
||||||
|
actions << {
|
||||||
|
"text" => t("property_hire.view_calendar"),
|
||||||
|
"btn-class" => "btn-info",
|
||||||
|
"link" => OrbitHelper.url_to_show(property.to_param) + "?method=view_calendar"
|
||||||
|
}
|
||||||
|
end
|
||||||
|
{
|
||||||
|
"title" => property.title,
|
||||||
|
"image" => property.image.url,
|
||||||
|
"image-thumb" => property.image.thumb.url,
|
||||||
|
"url_to_show" => OrbitHelper.url_to_show(property.to_param),
|
||||||
|
"location" => property.get_location_name,
|
||||||
|
"actions" => actions
|
||||||
|
}
|
||||||
|
end
|
||||||
|
headers = [
|
||||||
|
{
|
||||||
|
"column" => t("property_hire.title")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column" => t("property_hire.image")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column" => t("property_hire.location")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column" => t("property_hire.actions")
|
||||||
|
}
|
||||||
|
]
|
||||||
|
{
|
||||||
|
"properties" => data,
|
||||||
|
"headers" => headers,
|
||||||
|
"total_pages" => properties.total_pages
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
params = OrbitHelper.params
|
||||||
|
property = Property.where(:uid => params[:uid]).first rescue nil
|
||||||
|
page = Page.where(:page_id => params[:page_id]).first
|
||||||
|
return {} if property.nil?
|
||||||
|
data = []
|
||||||
|
|
||||||
|
data << {
|
||||||
|
"header" => t("property_hire.title"),
|
||||||
|
"value" => property.title
|
||||||
|
}
|
||||||
|
if !property.property_usage.blank?
|
||||||
|
data << {
|
||||||
|
"header" => t("property_hire.property_usage"),
|
||||||
|
"value" => property.property_usage
|
||||||
|
}
|
||||||
|
end
|
||||||
|
if !property.note.blank?
|
||||||
|
data << {
|
||||||
|
"header" => t("property_hire.note"),
|
||||||
|
"value" => property.note
|
||||||
|
}
|
||||||
|
end
|
||||||
|
data << {
|
||||||
|
"header" => t("property_hire.property_number"),
|
||||||
|
"value" => property.property_number
|
||||||
|
}
|
||||||
|
data << {
|
||||||
|
"header" => t("property_hire.can_be_hired"),
|
||||||
|
"value" => (property.can_be_hired ? "<span class='label label-success'>Yes</span>" : "<span class='label label-danger'>No</span>")
|
||||||
|
}
|
||||||
|
data << {
|
||||||
|
"header" => t("property_hire.purchase_date"),
|
||||||
|
"value" => property.purchase_date.strftime("%Y-%m-%d")
|
||||||
|
}
|
||||||
|
if property.owners.empty?
|
||||||
|
owners = property.other_owner
|
||||||
|
else
|
||||||
|
owners = property.owner_profiles.collect{|mp| mp.name}.join(",")
|
||||||
|
end
|
||||||
|
data << {
|
||||||
|
"header" => t("property_hire.owners"),
|
||||||
|
"value" => owners
|
||||||
|
}
|
||||||
|
data << {
|
||||||
|
"header" => t("property_hire.owner_email"),
|
||||||
|
"value" => property.owner_email
|
||||||
|
}
|
||||||
|
data << {
|
||||||
|
"header" => t("property_hire.owner_phone"),
|
||||||
|
"value" => property.owner_phone
|
||||||
|
}
|
||||||
|
data << {
|
||||||
|
"header" => t("property_hire.price"),
|
||||||
|
"value" => property.price
|
||||||
|
}
|
||||||
|
data << {
|
||||||
|
"header" => t("property_hire.location"),
|
||||||
|
"value" => property.get_location_name
|
||||||
|
}
|
||||||
|
actions = []
|
||||||
|
if property.can_be_hired
|
||||||
|
actions << {
|
||||||
|
"text" => t("property_hire.hire"),
|
||||||
|
"btn-class" => "btn-primary",
|
||||||
|
"link" => OrbitHelper.url_to_show(property.to_param) + "?method=hire"
|
||||||
|
}
|
||||||
|
actions << {
|
||||||
|
"text" => t("property_hire.view_calendar"),
|
||||||
|
"btn-class" => "btn-info",
|
||||||
|
"link" => OrbitHelper.url_to_show(property.to_param) + "?method=view_calendar"
|
||||||
|
}
|
||||||
|
end
|
||||||
|
{
|
||||||
|
"data" => data,
|
||||||
|
"actions" => actions,
|
||||||
|
"extras" => {
|
||||||
|
"image" => property.image.url,
|
||||||
|
"image-thumb" => property.image.thumb.url,
|
||||||
|
"back_url" => page.url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def view_calendar
|
||||||
|
params = OrbitHelper.params
|
||||||
|
property = Property.where(:uid => params[:uid]).first rescue nil
|
||||||
|
page = Page.where(:page_id => params[:page_id]).first
|
||||||
|
return {} if property.nil?
|
||||||
|
{
|
||||||
|
"property" => property,
|
||||||
|
"url" => page.url,
|
||||||
|
"current_user" => OrbitHelper.current_user
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def make_booking
|
||||||
|
booking_p = booking_params
|
||||||
|
data = check_for_availability(booking_p[:start_time],booking_p[:end_time],booking_p[:property_id])
|
||||||
|
property = Property.find(booking_p[:property_id]) rescue nil
|
||||||
|
if data["success"] == true
|
||||||
|
hire = PHire.new(booking_p)
|
||||||
|
hire.save
|
||||||
|
redirect_to params[:url]
|
||||||
|
else
|
||||||
|
session["hire-save-msg"] = data["msg"]
|
||||||
|
if property.nil?
|
||||||
|
redirect_to "/" + I18n.locale.to_s + params[:url]
|
||||||
|
else
|
||||||
|
redirect_to "/" + I18n.locale.to_s + params[:url] + "/#{property.to_param}?method=hire"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def hire
|
||||||
|
params = OrbitHelper.params
|
||||||
|
property = Property.where(:uid => params[:uid]).first rescue nil
|
||||||
|
page = Page.where(:page_id => params[:page_id]).first
|
||||||
|
return {} if property.nil?
|
||||||
|
hire = PHire.new
|
||||||
|
{
|
||||||
|
"hire" => hire,
|
||||||
|
"property" => property,
|
||||||
|
"page" => page.url,
|
||||||
|
"current_user" => OrbitHelper.current_user
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_availability
|
||||||
|
data = check_for_availability params[:stime], params[:etime], params[:property_id]
|
||||||
|
render :json => data.to_json
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_bookings
|
||||||
|
events =[]
|
||||||
|
property = Property.find(params[:property_id]) rescue nil
|
||||||
|
if !property.nil?
|
||||||
|
if params[:start].present? && params[:end].present?
|
||||||
|
sdt = Time.at(params[:start].to_i)
|
||||||
|
edt = Time.at(params[:end].to_i)
|
||||||
|
events = PHire.monthly_event(sdt,edt,params[:property_id])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
respond_to do |format|
|
||||||
|
format.html # index.html.erb
|
||||||
|
format.json { render json: events.to_json }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def booking_params
|
||||||
|
params.require(:p_hire).permit!
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
module Admin::PropertyHiresHelper
|
||||||
|
|
||||||
|
def check_for_availability(stime, etime, pid)
|
||||||
|
property = Property.find(pid)
|
||||||
|
return {"success" => false, "msg" => "Values are not ok."} if property.nil? || stime.blank? || etime.blank?
|
||||||
|
stime = DateTime.parse(stime + Time.zone.to_s) rescue nil
|
||||||
|
etime = DateTime.parse(etime + Time.zone.to_s) rescue nil
|
||||||
|
data = {}
|
||||||
|
return {"success" => false, "msg" => "Starting time cannot be greater than ending time."} if stime > etime
|
||||||
|
if property.is_available_for_hire?(stime, etime)
|
||||||
|
if property.is_already_hired?(stime, etime)
|
||||||
|
data = {"success" => true}
|
||||||
|
else
|
||||||
|
data = {"success" => false, "msg" => "Property is already hired during this time."}
|
||||||
|
end
|
||||||
|
else
|
||||||
|
data = {"success" => false, "msg" => "Property is unavailable during this time."}
|
||||||
|
end
|
||||||
|
return data
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,45 @@
|
||||||
|
class PHire
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
field :start_time, type: DateTime
|
||||||
|
field :end_time, type: DateTime
|
||||||
|
field :hiring_person_email
|
||||||
|
field :hiring_person_number
|
||||||
|
field :hiring_person_id
|
||||||
|
field :hiring_person_name
|
||||||
|
field :reason_for_hire
|
||||||
|
field :note_for_hire
|
||||||
|
field :passed, type: Boolean, default: false
|
||||||
|
|
||||||
|
belongs_to :property
|
||||||
|
|
||||||
|
def as_json(options = {})
|
||||||
|
{
|
||||||
|
:id => self.id.to_s,
|
||||||
|
:title => self.reason_for_hire,
|
||||||
|
:note => self.note_for_hire || "",
|
||||||
|
:start => self.start_time.rfc822,
|
||||||
|
:end => self.end_time.rfc822,
|
||||||
|
:allDay => false,
|
||||||
|
:color => "#FC4040"
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def period
|
||||||
|
return self.start_time.strftime("%y-%m-%d %H:%M") + " ~ " + self.end_time.strftime("%y-%m-%d %H:%M")
|
||||||
|
end
|
||||||
|
|
||||||
|
def hirer_name
|
||||||
|
return self.hiring_person_name.nil? ? self.hiring_person_profile.name : self.hiring_person_name
|
||||||
|
end
|
||||||
|
|
||||||
|
def hiring_person_profile
|
||||||
|
return MemberProfile.find(self.hiring_person_id) rescue nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.monthly_event(start_date,end_date,property_id)
|
||||||
|
self.where(:property_id => property_id).any_of(:start_time.gte => start_date, :end_time.gte => start_date).and(:start_time.lte => end_date).asc(:start_time)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,111 @@
|
||||||
|
class Property
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
include OrbitTag::Taggable
|
||||||
|
include OrbitCategory::Categorizable
|
||||||
|
include Slug
|
||||||
|
|
||||||
|
field :title, as: :slug_title, :localize => true
|
||||||
|
field :property_usage, :localize => true
|
||||||
|
field :note, :localize => true
|
||||||
|
field :property_number
|
||||||
|
field :can_be_hired, type: Boolean, default: true
|
||||||
|
field :purchase_date, type: DateTime
|
||||||
|
field :owners, type: Array
|
||||||
|
field :other_owner
|
||||||
|
field :owner_email
|
||||||
|
field :owner_phone
|
||||||
|
field :price
|
||||||
|
field :other_location
|
||||||
|
|
||||||
|
mount_uploader :image, ImageUploader
|
||||||
|
|
||||||
|
# unavailibility fields
|
||||||
|
|
||||||
|
field :set_unavailibility, type: Boolean, default: false
|
||||||
|
field :start_time
|
||||||
|
field :end_time
|
||||||
|
field :weekdays, type: Array, default: []
|
||||||
|
field :start_date, type: DateTime
|
||||||
|
field :end_date, type: DateTime
|
||||||
|
field :description, :localize => true
|
||||||
|
field :unavailibility_note, :localize => true
|
||||||
|
|
||||||
|
belongs_to :property_location
|
||||||
|
has_many :p_hires
|
||||||
|
|
||||||
|
WEEKDAYS = [
|
||||||
|
"Sunday",
|
||||||
|
"Monday",
|
||||||
|
"Tuesday",
|
||||||
|
"Wednesday",
|
||||||
|
"Thursday",
|
||||||
|
"Friday",
|
||||||
|
"Saturday"
|
||||||
|
]
|
||||||
|
|
||||||
|
def get_location_name
|
||||||
|
return self.property_location.nil? ? self.other_location : self.property_location.title
|
||||||
|
end
|
||||||
|
|
||||||
|
def owner_profiles
|
||||||
|
MemberProfile.find(self.owners) rescue []
|
||||||
|
end
|
||||||
|
|
||||||
|
def is_available_for_hire?(stime, etime)
|
||||||
|
return true if self.set_unavailibility == false
|
||||||
|
return true if self.weekdays.empty?
|
||||||
|
return true if !self.start_date.nil? && (self.start_date > stime && self.start_date > etime)
|
||||||
|
return true if !self.end_date.nil? && self.end_date < stime
|
||||||
|
startt = self.start_date.nil? ? self.created_at : self.start_date
|
||||||
|
endt = self.end_date.nil? && !startt.nil? ? (startt + 5.years) : self.end_date
|
||||||
|
weekdays = self.weekdays.collect{|w| w.to_i}
|
||||||
|
if !startt.nil?
|
||||||
|
common_dates = (startt..endt) & (stime..etime)
|
||||||
|
return true if common_dates.nil?
|
||||||
|
time_weekdays = []
|
||||||
|
Property.time_iterate(common_dates.min, common_dates.max, 1.day) do |t|
|
||||||
|
time_weekdays << t.wday
|
||||||
|
end
|
||||||
|
time_weekdays.uniq!
|
||||||
|
weekdays = weekdays & time_weekdays
|
||||||
|
return true if weekdays.blank?
|
||||||
|
startt = DateTime.parse(stime.strftime("%Y-%m-%d " + self.start_time + Time.zone.to_s))
|
||||||
|
endt = DateTime.parse(etime.strftime("%Y-%m-%d " + self.end_time + Time.zone.to_s))
|
||||||
|
common_dates = (startt..endt) & (stime..etime)
|
||||||
|
if common_dates.nil?
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def is_already_hired?(stime, etime)
|
||||||
|
bookings = self.p_hires.where(:end_time.gte => stime)
|
||||||
|
available = true
|
||||||
|
bookings.each do |booking|
|
||||||
|
common_time = (booking.start_time..booking.end_time) & (stime..etime)
|
||||||
|
if !common_time.nil?
|
||||||
|
available = false
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return available
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.time_iterate(start_time, end_time, step, &block)
|
||||||
|
begin
|
||||||
|
yield(start_time)
|
||||||
|
end while (start_time += step) <= end_time
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
class PropertyLocation
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
field :title, :localize => true
|
||||||
|
has_many :properties
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,299 @@
|
||||||
|
<% content_for :page_specific_css do %>
|
||||||
|
<%= stylesheet_link_tag "lib/main-forms" %>
|
||||||
|
<%= stylesheet_link_tag "lib/fileupload" %>
|
||||||
|
<%= stylesheet_link_tag "lib/main-list" %>
|
||||||
|
<% end %>
|
||||||
|
<% content_for :page_specific_javascript do %>
|
||||||
|
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
|
||||||
|
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
|
||||||
|
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
|
||||||
|
<%= javascript_include_tag "lib/file-type" %>
|
||||||
|
<%= javascript_include_tag "lib/module-area" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<!-- Input Area -->
|
||||||
|
<div class="input-area">
|
||||||
|
|
||||||
|
<!-- Module Tabs -->
|
||||||
|
<div class="nav-name"><strong><%= t(:module) %></strong></div>
|
||||||
|
<ul class="nav nav-pills module-nav">
|
||||||
|
<li class="active"><a href="#basic" data-toggle="tab"><%= t(:basic) %></a></li>
|
||||||
|
<li><a href="#tag" data-toggle="tab"><%= t(:tags) %></a></li>
|
||||||
|
<li><a href="#imageupload" data-toggle="tab"><%= t(:image) %></a></li>
|
||||||
|
<li><a href="#unavailability" data-toggle="tab"><%= t('property_hire.unavailability')%></a></li>
|
||||||
|
</ul>
|
||||||
|
<!-- Module -->
|
||||||
|
<div class="tab-content module-area">
|
||||||
|
<!-- Basic Module -->
|
||||||
|
<div class="tab-pane fade in active" id="basic">
|
||||||
|
<!-- Category -->
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted"><%= t(:category) %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= select_category(f, @module_app) %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :property_location, t("property_hire.property_location"), :class => "control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<% if @property.new_record? %>
|
||||||
|
<%= f.select :property_location, @locations %>
|
||||||
|
<% elsif @property.property_location.nil? %>
|
||||||
|
<%= f.select :property_location, @locations, {:selected => "other_location"} %>
|
||||||
|
<% else %>
|
||||||
|
<%= f.select :property_location, @locations %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group" id="other-location-div" style="<%= @property.new_record? || !@property.property_location.nil? ? "display: none;" : "" %>">
|
||||||
|
<%= f.label :other_location, t("property_hire.other_location"), :class => "control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :other_location %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :property_number, t("property_hire.property_number"), :class => "control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :property_number %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :can_be_hired, t("property_hire.can_be_hired"), :class => "control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.check_box :can_be_hired %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :purchase_date, t("property_hire.purchase_date"), :class => "control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.datetime_picker :purchase_date, :no_label => true, :new_record => @property.new_record?, :picker_type => "date", :format => "yyyy/MM/dd" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :owners, t("property_hire.owners"), :class => "control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'property[owners][]', email_members: @property.owner_profiles} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :other_owner, t("property_hire.other_owner"), :class => "control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :other_owner %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :owner_email, t("property_hire.owner_email"), :class => "control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :owner_email %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :owner_phone, t("property_hire.owner_phone"), :class => "control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :owner_phone %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :price, t("property_hire.price"), :class => "control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :price %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- tags -->
|
||||||
|
<div class="tab-pane fade" id="tag">
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted"><%= t(:tags) %></label>
|
||||||
|
<%= select_tags(f, @module_app) %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- image -->
|
||||||
|
<div class="tab-pane fade" id="imageupload">
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted"><%= t(:image) %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<div class="fileupload fileupload-new clearfix <%= 'fileupload-edit' if @property.image.file %>" data-provides="fileupload">
|
||||||
|
<div class="fileupload-new thumbnail pull-left">
|
||||||
|
<% if @property.image.file %>
|
||||||
|
<%= image_tag @property.image %>
|
||||||
|
<% else %>
|
||||||
|
<img src="http://www.placehold.it/50x50/EFEFEF/AAAAAA" />
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
|
||||||
|
<span class="btn btn-file">
|
||||||
|
<span class="fileupload-new"><%= t(:select_image) %></span>
|
||||||
|
<span class="fileupload-exists"><%= t(:change) %></span>
|
||||||
|
<%= f.file_field :image %>
|
||||||
|
</span>
|
||||||
|
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload"><%= t(:cancel) %></a>
|
||||||
|
<div class="controls" data-toggle="buttons-checkbox">
|
||||||
|
<label class="checkbox inline btn btn-danger fileupload-remove">
|
||||||
|
<%= f.check_box :remove_image %><%= t(:remove) %>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- unavailability -->
|
||||||
|
<div class="tab-pane fade" id="unavailability">
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :set_unavailibility, t("property_hire.set_unavailibility"), :class => "control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.check_box :set_unavailibility %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% if @property.new_record? %>
|
||||||
|
<div id="set_unavailibility_div" style="display: none;">
|
||||||
|
<% elsif @property.set_unavailibility %>
|
||||||
|
<div id="set_unavailibility_div">
|
||||||
|
<% else %>
|
||||||
|
<div id="set_unavailibility_div" style="display: none;">
|
||||||
|
<% end %>
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :start_time, t("property_hire.start_time"), :class => "control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.datetime_picker :start_time, :picker_type => "time", :no_label => true, :new_record => @property.new_record?, :value => (Time.parse(@property.start_time) rescue "") %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :end_time, t("property_hire.end_time"), :class => "control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.datetime_picker :end_time, :picker_type => "time", :no_label => true, :new_record => @property.new_record?, :value => (Time.parse(@property.end_time) rescue "") %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted">Weekdays</label>
|
||||||
|
<div class="controls">
|
||||||
|
<% weekdays = @property.weekdays rescue [] %>
|
||||||
|
<label for="sunday">
|
||||||
|
<input id="sunday" type="checkbox" name="property[weekdays][]" value="0" <%= weekdays.include?("0") ? "checked=checked" : "" %> /> Sunday
|
||||||
|
</label>
|
||||||
|
<label for="monday">
|
||||||
|
<input id="monday" type="checkbox" name="property[weekdays][]" value="1" <%= weekdays.include?("1") ? "checked=checked" : "" %> /> Monday
|
||||||
|
</label>
|
||||||
|
<label for="tuesday">
|
||||||
|
<input id="tuesday" type="checkbox" name="property[weekdays][]" value="2" <%= weekdays.include?("2") ? "checked=checked" : "" %> /> Tuesday
|
||||||
|
</label>
|
||||||
|
<label for="wednesday">
|
||||||
|
<input id="wednesday" type="checkbox" name="property[weekdays][]" value="3" <%= weekdays.include?("3") ? "checked=checked" : "" %> /> Wednesday
|
||||||
|
</label>
|
||||||
|
<label for="thursday">
|
||||||
|
<input id="thursday" type="checkbox" name="property[weekdays][]" value="4" <%= weekdays.include?("4") ? "checked=checked" : "" %> /> Thursday
|
||||||
|
</label>
|
||||||
|
<label for="friday">
|
||||||
|
<input id="friday" type="checkbox" name="property[weekdays][]" value="5" <%= weekdays.include?("5") ? "checked=checked" : "" %> /> Friday
|
||||||
|
</label>
|
||||||
|
<label for="saturday">
|
||||||
|
<input id="saturday" type="checkbox" name="property[weekdays][]" value="6" <%= weekdays.include?("6") ? "checked=checked" : "" %> /> Saturday
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :start_date, t("property_hire.start_date"), :class => "control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.datetime_picker :start_date, :picker_type => "date", :no_label => true, :new_record => @property.new_record?, :data=>{"picker-type" => "range", "range" => "start"}, :format => "yyyy/MM/dd" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :end_date, t("property_hire.end_date"), :class => "control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.datetime_picker :end_date, :picker_type => "date", :no_label => true, :new_record => @property.new_record?, :data=>{"picker-type" => "range", "range" => "end"}, :format => "yyyy/MM/dd" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% @site_in_use_locales.each do |locale| %>
|
||||||
|
<%= f.fields_for :description_translations do |f| %>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted" for="description_<%= locale.to_s %>"><%= t(:description) + " (#{t(locale.to_s)})" %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field locale, value: (@property.description_translations[locale.to_s] rescue nil) %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% @site_in_use_locales.each do |locale| %>
|
||||||
|
<%= f.fields_for :unavailibility_note do |f| %>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted" for="note_<%= locale.to_s %>"><%= t(:note) + " (#{t(locale.to_s)})" %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_area locale, value: (@property.unavailibility_note_translations[locale.to_s] rescue nil) %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Language Tabs -->
|
||||||
|
<div class="nav-name"><strong><%= t(:language) %></strong></div>
|
||||||
|
<ul class="nav nav-pills language-nav">
|
||||||
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||||
|
<li class="<%= 'active' if i == 0 %>">
|
||||||
|
<a data-toggle="tab" href=".<%= locale %>"><%= t(locale) %></a>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<!-- Language -->
|
||||||
|
<div class="tab-content language-area">
|
||||||
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||||
|
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
|
||||||
|
<!-- Title-->
|
||||||
|
<div class="control-group input-title">
|
||||||
|
<label class="control-label muted"><%= t("property_hire.title") %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.fields_for :title_translations do |f| %>
|
||||||
|
<%= f.text_field locale, class: "input-block-level", placeholder: t("property_hire.title"), value: (@property.title_translations[locale] rescue nil) %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group input-title">
|
||||||
|
<label class="control-label muted"><%= t("property_hire.property_usage") %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.fields_for :property_usage_translations do |f| %>
|
||||||
|
<%= f.text_area locale, class: "input-block-level", placeholder: t("property_hire.property_usage"), value: (@property.property_usage_translations[locale] rescue nil) %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group input-title">
|
||||||
|
<label class="control-label muted"><%= t("property_hire.note") %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.fields_for :note_translations do |f| %>
|
||||||
|
<%= f.text_area locale, class: "input-block-level", placeholder: t("property_hire.note"), value: (@property.note_translations[locale] rescue nil) %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Form Actions -->
|
||||||
|
<div class="form-actions">
|
||||||
|
<% if params[:page] %>
|
||||||
|
<input type="hidden" name="page" value="<%= params[:page] %>" />
|
||||||
|
<% end %>
|
||||||
|
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
||||||
|
<%= link_to t('cancel'), admin_property_hires_path, :class=>"btn" %>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$("#property_set_unavailibility").on("click",function(){
|
||||||
|
if($(this).is(":checked")){
|
||||||
|
$("#set_unavailibility_div").show();
|
||||||
|
}else{
|
||||||
|
$("#set_unavailibility_div").hide();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
$("#property_property_location").on("change",function(){
|
||||||
|
if($(this).val() == "other_location"){
|
||||||
|
$("#other-location-div").show();
|
||||||
|
}else{
|
||||||
|
$("#other-location-div").hide();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted"><%= t(:title) + " (" + t(locale) + ")" %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.fields_for :title_translations do |f| %>
|
||||||
|
<%= f.text_field locale, placeholder: t(:title), value: (@location.title_translations[locale] rescue nil) %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<%= f.submit t(:submit), :class => "hide" %>
|
||||||
|
<% if params[:page].present? %>
|
||||||
|
<input type="hidden" name="page" value="<%= params[:page]%>">
|
||||||
|
<% end %>
|
|
@ -0,0 +1,3 @@
|
||||||
|
<%= form_for @location , :url => {:action => "create_location"}, html: {class: "form-horizontal"} do |f| %>
|
||||||
|
<%= render :partial => "location_form", locals: {:f => f} %>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<%= form_for @property , :url => {:action => "update"}, html: {class: "form-horizontal main-forms"} do |f| %>
|
||||||
|
<fieldset>
|
||||||
|
<%= render :partial => "form", locals: {:f => f} %>
|
||||||
|
</fieldset>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,3 @@
|
||||||
|
<%= form_for @location , :url => {:action => "update_location"}, html: {class: "form-horizontal"} do |f| %>
|
||||||
|
<%= render :partial => "location_form", locals: {:f => f} %>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,42 @@
|
||||||
|
<table class="table main-list">
|
||||||
|
<thead>
|
||||||
|
<tr class="sort-header">
|
||||||
|
<% @table_fields.each do |f| %>
|
||||||
|
<%= thead(f) %>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @properties.each do |property| %>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="<%= admin_property_hire_path(property) %>"><%= property.title %></a>
|
||||||
|
<div class="quick-edit">
|
||||||
|
<ul class="nav nav-pills">
|
||||||
|
<% if can_edit_or_delete?(property) %>
|
||||||
|
<li><a href="<%= edit_admin_property_hire_path(property, :page => params[:page]) %>"><%= t(:edit) %></a></li>
|
||||||
|
<li><a href="<%= admin_property_hire_path(property.id, :page => params[:page]) %>" data-method="delete" data-confirm="Are you sure?"><%= t(:delete_) %></a></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= property.category.title %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= property.get_location_name %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<% if property.can_be_hired %>
|
||||||
|
<span class="badge badge-success">Yes</span>
|
||||||
|
<% else %>
|
||||||
|
<span class="badge badge-important">No</span>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="bottomnav clearfix">
|
||||||
|
<%= content_tag(:div, paginate(@properties), class: "pagination pagination-centered") %>
|
||||||
|
</div>
|
|
@ -0,0 +1,75 @@
|
||||||
|
<table class="table main-list">
|
||||||
|
<thead>
|
||||||
|
<tr class="sort-header">
|
||||||
|
<% @table_fields.each do |f| %>
|
||||||
|
<%= thead(f) %>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
<% @locations.each do |loc| %>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="#" target="_blank"><%= loc.title %></a>
|
||||||
|
<div class="quick-edit">
|
||||||
|
<ul class="nav nav-pills">
|
||||||
|
<% if can_edit_or_delete?(loc) %>
|
||||||
|
<li><a href="<%= edit_location_admin_property_hire_path(loc, :page => params[:page]) %>" data-toggle="modal" data-target="#edit-location-modal"><%= t(:edit) %></a></li>
|
||||||
|
<li><a href="<%= destroy_location_admin_property_hire_path(loc, :page => params[:page]) %>" data-method="delete" data-confirm="Are you sure?"><%= t(:delete_) %></a></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= loc.properties.count %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div id="location-modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="location-modalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
<h3 id="location-modalLabel"><%= t("property_hire.add_location") %></h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div style="text-align: center;">
|
||||||
|
<img src="/assets/spin.gif" alt="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
|
||||||
|
<button class="btn btn-primary" id="add-location-btn">Save</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="edit-location-modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="edit-location-modalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
<h3 id="edit-location-modalLabel"><%= t("property_hire.edit_location") %></h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div style="text-align: center;">
|
||||||
|
<img src="/assets/spin.gif" alt="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
|
||||||
|
<button class="btn btn-primary" id="edit-location-btn">Save</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="bottomnav clearfix">
|
||||||
|
<%= content_tag(:div, paginate(@locations), class: "pagination pagination-centered") %>
|
||||||
|
<div class="pull-right">
|
||||||
|
<%= link_to t(:add), add_location_admin_property_hires_path, :class => "btn btn-primary", :data => {"toggle" => "modal", "target" => "#location-modal"} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$("#add-location-btn").on("click",function(){
|
||||||
|
$("#location-modal form").submit();
|
||||||
|
})
|
||||||
|
$("#edit-location-btn").on("click",function(){
|
||||||
|
$("#edit-location-modal form").submit();
|
||||||
|
})
|
||||||
|
</script>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<%= form_for @property , :url => {:action => "create"}, html: {class: "form-horizontal main-forms"} do |f| %>
|
||||||
|
<fieldset>
|
||||||
|
<%= render :partial => "form", locals: {:f => f} %>
|
||||||
|
</fieldset>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,46 @@
|
||||||
|
<table class="table main-list">
|
||||||
|
<thead>
|
||||||
|
<tr class="sort-header">
|
||||||
|
<% @table_fields.each do |f| %>
|
||||||
|
<%= thead(f) %>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @bookings.each do |p_hire| %>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<%= p_hire.hirer_name %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= p_hire.reason_for_hire %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= p_hire.hiring_person_number %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= p_hire.period %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<% if p_hire.passed %>
|
||||||
|
<span class="badge badge-success">Yes</span>
|
||||||
|
<% else %>
|
||||||
|
<span class="badge badge-important">No</span>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="<%= show_booking_details_admin_property_hire_path(p_hire, :page => params[:page]) %>" class="btn btn-info">View</a>
|
||||||
|
<% if p_hire.passed %>
|
||||||
|
<a href="<%= pass_booking_admin_property_hire_path(p_hire, :page => params[:page], :status => "reject", :ref => "index") %>" class="btn btn-danger">Reject</a>
|
||||||
|
<% else %>
|
||||||
|
<a href="<%= pass_booking_admin_property_hire_path(p_hire, :page => params[:page], :status => "accept", :ref => "index") %>" class="btn btn-success">Accept</a>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="bottomnav clearfix">
|
||||||
|
<a href="<%= admin_property_hires_path %>" class="btn btn-warning">Back</a>
|
||||||
|
<%= content_tag(:div, paginate(@bookings), class: "pagination pagination-centered") %>
|
||||||
|
</div>
|
|
@ -0,0 +1,48 @@
|
||||||
|
<h3><%= @booking.property.title %></h3>
|
||||||
|
<table class="table main-list">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td><%= t("property_hire.hiring_person_name") %></td>
|
||||||
|
<td><%= @booking.hirer_name %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><%= t("property_hire.hiring_person_number") %></td>
|
||||||
|
<td><%= @booking.hiring_person_number %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><%= t("property_hire.hiring_person_email") %></td>
|
||||||
|
<td><%= @booking.hiring_person_email %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><%= t("property_hire.period") %></td>
|
||||||
|
<td><%= @booking.period %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><%= t("property_hire.reason_for_hire") %></td>
|
||||||
|
<td><%= @booking.reason_for_hire %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><%= t("property_hire.note_for_hire") %></td>
|
||||||
|
<td><%= @booking.note_for_hire %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><%= t("property_hire.passed") %></td>
|
||||||
|
<td>
|
||||||
|
<% if @booking.passed %>
|
||||||
|
<span class="badge badge-success">Yes</span>
|
||||||
|
<% else %>
|
||||||
|
<span class="badge badge-important">No</span>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<a href="<%= admin_property_hire_path(@booking.property, :page => params[:page]) %>" class="btn btn-warning">Back</a>
|
||||||
|
<% if @booking.passed %>
|
||||||
|
<a href="<%= pass_booking_admin_property_hire_path(@booking, :status => "reject") %>" class="btn btn-danger">Reject</a>
|
||||||
|
<% else %>
|
||||||
|
<a href="<%= pass_booking_admin_property_hire_path(@booking, :status => "accept") %>" class="btn btn-success">Accept</a>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,150 @@
|
||||||
|
<% OrbitHelper.render_css_in_head(["basic/bootstrap-datetimepicker.css"]) %>
|
||||||
|
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
|
||||||
|
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
|
||||||
|
<%= javascript_include_tag "validator.js" %>
|
||||||
|
<%
|
||||||
|
data = action_data
|
||||||
|
hire = data["hire"]
|
||||||
|
property = data["property"]
|
||||||
|
url = data["page"]
|
||||||
|
current_user = data["current_user"]
|
||||||
|
%>
|
||||||
|
<% if !property.can_be_hired %>
|
||||||
|
<script type="text/javascript">
|
||||||
|
alert("This property is unavailable for hire.");
|
||||||
|
window.location.href = "<%= "/" + I18n.locale.to_s + url %>";
|
||||||
|
</script>
|
||||||
|
<% end %>
|
||||||
|
<h3><%= property.title %></h3>
|
||||||
|
<% if session["hire-save-msg"].present? %>
|
||||||
|
<div id="property-unavaialable-alert" class="alert alert-danger" role="alert"><b>Sorry! </b><span> <%= session["hire-save-msg"] %></span></div>
|
||||||
|
<% session.delete("hire-save-msg") %>
|
||||||
|
<% end %>
|
||||||
|
<%= form_for hire, :url => "/xhr/property_hires/make_booking", html: { class: "form-horizontal" } do |f| %>
|
||||||
|
<div class="form-group">
|
||||||
|
<%= f.label :start_time, t("property_hires.start_time"), :class => "col-sm-2 control-label" %>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<%= f.datetime_picker :start_time, :no_label => true, :new_record => hire.new_record?, :data=>{"picker-type" => "range", "range" => "start", "fv-validation" => "required;", "fv-messages" => "Cannot be empty;"} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<%= f.label :end_time, t("property_hires.end_time"), :class => "col-sm-2 control-label" %>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<%= f.datetime_picker :end_time, :no_label => true, :new_record => hire.new_record?, :data=>{"picker-type" => "range", "range" => "end", "fv-validation" => "required;", "fv-messages" => "Cannot be empty;"} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-sm-offset-2 col-sm-5">
|
||||||
|
<div id="property-avaialable-alert" style="margin-bottom: 5px; padding: 10px; display: none;" class="alert alert-success" role="alert"><b>Hooray! </b>This property is available.</div>
|
||||||
|
<div id="property-unavaialable-alert" style="margin-bottom: 5px; padding: 10px; display: none;" class="alert alert-danger" role="alert"><b>Sorry! </b><span> This property is available.</span></div>
|
||||||
|
</div>
|
||||||
|
<% if property.set_unavailibility %>
|
||||||
|
<div class="col-sm-offset-2 col-sm-5">
|
||||||
|
<b>Unavailibility Schedule</b>
|
||||||
|
<div>
|
||||||
|
This property is unavaliable <%= !property.start_date.nil? ? " from " + property.start_date.strftime("%Y-%m-%d") : "" %> <%= !property.end_date.nil? ? " to " + property.end_date.strftime("%Y-%m-%d") : "" %> every
|
||||||
|
<% property.weekdays.each_with_index do |d,i| %>
|
||||||
|
<% if i < (property.weekdays.count - 1) %>
|
||||||
|
<%= Property::WEEKDAYS[d.to_i] + ", " %>
|
||||||
|
<% else %>
|
||||||
|
<%= Property::WEEKDAYS[d.to_i] %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
between <%= property.start_time %> & <%= property.end_time %>.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="" class="col-sm-2 control-label"></label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<a href="/xhr/property_hires/check_availability" id="check-avail-btn" class="btn btn-primary">Check Availibility</a>
|
||||||
|
<img style="display: none;" width="40" src="/assets/spin.gif" id="spinner" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<%= f.label :hiring_person_email, t("property_hires.hiring_person_email"), :class => "col-sm-2 control-label" %>
|
||||||
|
<div class="col-sm-5">
|
||||||
|
<%= f.text_field :hiring_person_email, :class => "form-control", :value => current_user.member_profile.email, :data => {"fv-validation" => "required;", "fv-messages" => "Cannot be empty;"} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<%= f.label :hiring_person_number, t("property_hires.hiring_person_number"), :class => "col-sm-2 control-label" %>
|
||||||
|
<div class="col-sm-5">
|
||||||
|
<%= f.text_field :hiring_person_number, :class => "form-control", :value => current_user.member_profile.mobile_no, :data => {"fv-validation" => "required;", "fv-messages" => "Cannot be empty;"} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<%= f.label :hiring_person_name, t("property_hires.hiring_person_name"), :class => "col-sm-2 control-label" %>
|
||||||
|
<div class="col-sm-5">
|
||||||
|
<%= f.text_field :hiring_person_name, :class => "form-control", :value => (current_user.name rescue ""), :data => {"fv-validation" => "required;", "fv-messages" => "Cannot be empty;"} %>
|
||||||
|
<%= f.hidden_field :hiring_person_id, :value => (current_user.member_profile.id.to_s rescue "") %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<%= f.label :reason_for_hire, t("property_hires.reason_for_hire"), :class => "col-sm-2 control-label" %>
|
||||||
|
<div class="col-sm-5">
|
||||||
|
<%= f.text_field :reason_for_hire, :class => "form-control", :data => {"fv-validation" => "required;", "fv-messages" => "Cannot be empty;"} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<%= f.label :note_for_hire, t("property_hires.note_for_hire"), :class => "col-sm-2 control-label" %>
|
||||||
|
<div class="col-sm-5">
|
||||||
|
<%= f.text_area :note_for_hire, :class => "form-control" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-sm-offset-2 col-sm-10">
|
||||||
|
<%= f.submit t(:save), :class => "btn btn-primary" %>
|
||||||
|
<%= f.hidden_field :property_id, :value => property.id %>
|
||||||
|
<input type="hidden" name="url" value="<%= url %>" />
|
||||||
|
<input type="hidden" id="dates_validated" name="dates_validated" value="0" data-fv-validation="checkForDates;" data-fv-messages="Please make sure first if dates are available.;">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<div style="height: 50px;"></div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
var property_id = "<%= property.id.to_s %>";
|
||||||
|
$("#check-avail-btn").on("click",function(){
|
||||||
|
var el = $(this),
|
||||||
|
url = $(this).attr("href"),
|
||||||
|
spinner = $("#spinner");
|
||||||
|
el.hide();
|
||||||
|
spinner.show();
|
||||||
|
$(".alert").hide();
|
||||||
|
$.ajax({
|
||||||
|
"url" : url,
|
||||||
|
"type" : "post",
|
||||||
|
"data" : {"stime" : $("#p_hire_start_time").val(), "etime" : $("#p_hire_end_time").val(), "property_id" : property_id},
|
||||||
|
"dataType" : "json"
|
||||||
|
}).done(function(data){
|
||||||
|
if(data.success){
|
||||||
|
$("#property-avaialable-alert").show();
|
||||||
|
$("#dates_validated").val("1");
|
||||||
|
}else{
|
||||||
|
$("#property-unavaialable-alert").find("span").text(data.msg);
|
||||||
|
$("#property-unavaialable-alert").show();
|
||||||
|
}
|
||||||
|
spinner.hide();
|
||||||
|
el.show();
|
||||||
|
})
|
||||||
|
return false;
|
||||||
|
})
|
||||||
|
|
||||||
|
$("#unavailable-schedule").on("click",function(){
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
var hireForm = new FormValidator($("#new_p_hire"));
|
||||||
|
hireForm.validate_functions.checkForDates = function(value,element){
|
||||||
|
return value == "1";
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
<%= render_view %>
|
|
@ -0,0 +1 @@
|
||||||
|
<%= render_view %>
|
|
@ -0,0 +1,56 @@
|
||||||
|
<% OrbitHelper.render_css_in_head(["property_hire_fullcalendar.css","property_hire_calendar.scss"]) %>
|
||||||
|
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
|
||||||
|
<script type="text/javascript" src="/assets/property_hire_fullcalendar.min.js"></script>
|
||||||
|
<script type="text/javascript" src="/assets/property_hire_calendar_frontend.js"></script>
|
||||||
|
<%
|
||||||
|
data = action_data
|
||||||
|
property = data["property"]
|
||||||
|
url = data["url"]
|
||||||
|
%>
|
||||||
|
<% if !property.can_be_hired %>
|
||||||
|
<script type="text/javascript">
|
||||||
|
alert("This property is unavailable for hire.");
|
||||||
|
window.location.href = "<%= "/" + I18n.locale.to_s + url %>";
|
||||||
|
</script>
|
||||||
|
<% end %>
|
||||||
|
<h3>Booking schedule for property <b><%= property.title %></b></h3>
|
||||||
|
<div id="orbit_calendar">
|
||||||
|
<div id="sec1">
|
||||||
|
<div class="btn-toolbar" id="navigation">
|
||||||
|
<div id="calendar-nav">
|
||||||
|
<div class="btn-group">
|
||||||
|
<button class="btn btn-default btn-sm" id="prev_month_btn">
|
||||||
|
<i class="icon-chevron-left"></i>
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-default btn-sm" id="next_month_btn">
|
||||||
|
<i class="icon-chevron-right"></i>
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-default btn-sm" id="today_btn">Today</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-inline" id="range_selection"></div>
|
||||||
|
</div>
|
||||||
|
<div id='sec3' class="btn-toolbar">
|
||||||
|
<div class="btn-group calendar_mode">
|
||||||
|
<button class="btn btn-default mode_switch btn-sm" data-mode="agendaDay" >day</button>
|
||||||
|
<button class="btn btn-default mode_switch btn-sm" data-mode="agendaWeek" >week</button>
|
||||||
|
<button class="btn btn-default active mode_switch btn-sm" data-mode="month" >month</button>
|
||||||
|
</div>
|
||||||
|
<button id="refresh_btn" class="btn btn-default btn-sm">
|
||||||
|
<i class="icons-cycle"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div id="view_holder">
|
||||||
|
<h3 id="current_title" class="current_day_title"></h3>
|
||||||
|
<div id="calendar"></div>
|
||||||
|
<div id="calendar_agenda"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="event_quick_view" class="modal" style="width: 300px; display:none; margin:0 0 0 0;"></div>
|
||||||
|
<div id="calendar-loading"></div>
|
||||||
|
<a href="<%= "/" + I18n.locale.to_s + url %>" class="btn btn-warning">Back</a>
|
||||||
|
<script type="text/javascript">
|
||||||
|
var property_id = "<%= property.id.to_s %>";
|
||||||
|
var calendar = new Calendar("#calendar",property_id);
|
||||||
|
</script>
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
# This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
|
||||||
|
|
||||||
|
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
||||||
|
ENGINE_PATH = File.expand_path('../../lib/property_hire/engine', __FILE__)
|
||||||
|
|
||||||
|
# Set up gems listed in the Gemfile.
|
||||||
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
||||||
|
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
||||||
|
|
||||||
|
require 'rails/all'
|
||||||
|
require 'rails/engine/commands'
|
|
@ -0,0 +1,43 @@
|
||||||
|
en:
|
||||||
|
property_hire:
|
||||||
|
property_hire: Property
|
||||||
|
manage_locations: Manage Locations
|
||||||
|
location: Location
|
||||||
|
property_count: Property Count
|
||||||
|
edit_location: Edit Location
|
||||||
|
add_location: Add Location
|
||||||
|
unavailability: Unavailability
|
||||||
|
title: Property Title
|
||||||
|
property_usage: Usage for property
|
||||||
|
note: Note
|
||||||
|
property_number: Property Number
|
||||||
|
can_be_hired: Available for hire
|
||||||
|
purchase_date: Purchase Date
|
||||||
|
owners: Owners
|
||||||
|
other_owner: Other Owner
|
||||||
|
owner_email: Owner Email
|
||||||
|
owner_phone: Owner Phone
|
||||||
|
price: Price
|
||||||
|
set_unavailibility: Set Unavailability
|
||||||
|
start_time: Start Time
|
||||||
|
end_time: End Time
|
||||||
|
weekdays: Weekdays
|
||||||
|
start_date: From Date
|
||||||
|
end_date: To Date
|
||||||
|
description: Unavailability Description
|
||||||
|
unavailibility_note: Unavailability Note
|
||||||
|
property_location: Property Location
|
||||||
|
available_for_hire: Available for hire
|
||||||
|
hire: Hire
|
||||||
|
view_calendar: Calendar
|
||||||
|
image: Property Image
|
||||||
|
actions: Actions
|
||||||
|
start_time: Hire Start Time
|
||||||
|
end_time: Hire End Time
|
||||||
|
hiring_person_email: Hiring Person Email
|
||||||
|
hiring_person_number: Hiring Person Number
|
||||||
|
hiring_person_name: Hiring Person
|
||||||
|
reason_for_hire: Reason For Hire
|
||||||
|
note_for_hire: Note For Hire
|
||||||
|
period: Period
|
||||||
|
passed: Accepted
|
|
@ -0,0 +1,43 @@
|
||||||
|
zh_tw:
|
||||||
|
property_hire:
|
||||||
|
property_hire: Property
|
||||||
|
manage_locations: Manage Locations
|
||||||
|
location: Location
|
||||||
|
property_count: Property Count
|
||||||
|
edit_location: Edit Location
|
||||||
|
add_location: Add Location
|
||||||
|
unavailability: Unavailability
|
||||||
|
title: Property Title
|
||||||
|
property_usage: Usage for property
|
||||||
|
note: Note
|
||||||
|
property_number: Property Number
|
||||||
|
can_be_hired: Available for hire
|
||||||
|
purchase_date: Purchase Date
|
||||||
|
owners: Owners
|
||||||
|
other_owner: Other Owner
|
||||||
|
owner_email: Owner Email
|
||||||
|
owner_phone: Owner Phone
|
||||||
|
price: Price
|
||||||
|
set_unavailibility: Set Unavailability
|
||||||
|
start_time: Start Time
|
||||||
|
end_time: End Time
|
||||||
|
weekdays: Weekdays
|
||||||
|
start_date: From Date
|
||||||
|
end_date: To Date
|
||||||
|
description: Unavailability Description
|
||||||
|
unavailibility_note: Unavailability Note
|
||||||
|
property_location: Property Location
|
||||||
|
available_for_hire: Available for hire
|
||||||
|
hire: Hire
|
||||||
|
view_calendar: Calendar
|
||||||
|
image: Property Image
|
||||||
|
actions: Actions
|
||||||
|
start_time: Hire Start Time
|
||||||
|
end_time: Hire End Time
|
||||||
|
hiring_person_email: Hiring Person Email
|
||||||
|
hiring_person_number: Hiring Person Number
|
||||||
|
hiring_person_name: Hiring Person
|
||||||
|
reason_for_hire: Reason For Hire
|
||||||
|
note_for_hire: Note For Hire
|
||||||
|
period: Period
|
||||||
|
passed: Accepted
|
|
@ -0,0 +1,25 @@
|
||||||
|
Rails.application.routes.draw do
|
||||||
|
|
||||||
|
locales = Site.find_by(site_active: true).in_use_locales rescue I18n.available_locales
|
||||||
|
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
|
||||||
|
post "/xhr/property_hires/check_availability" => "property_hires#check_availability"
|
||||||
|
post "/xhr/property_hires/make_booking" => "property_hires#make_booking"
|
||||||
|
get "/xhr/property_hires/get_bookings" => "property_hires#get_bookings"
|
||||||
|
namespace :admin do
|
||||||
|
resources :property_hires do
|
||||||
|
member do
|
||||||
|
get "edit_location"
|
||||||
|
patch "update_location"
|
||||||
|
delete "destroy_location"
|
||||||
|
get "show_booking_details"
|
||||||
|
get "pass_booking"
|
||||||
|
end
|
||||||
|
collection do
|
||||||
|
get "manage_locations"
|
||||||
|
get "add_location"
|
||||||
|
post "create_location"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
require "property_hire/engine"
|
||||||
|
|
||||||
|
module PropertyHire
|
||||||
|
end
|
|
@ -0,0 +1,57 @@
|
||||||
|
module PropertyHire
|
||||||
|
class Engine < ::Rails::Engine
|
||||||
|
initializer "property_hire" do
|
||||||
|
OrbitApp.registration "PropertyHire", :type => "ModuleApp" do
|
||||||
|
module_label "property_hire.property_hire"
|
||||||
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
|
widget_methods ['widget']
|
||||||
|
widget_settings [{"data_count"=>30}]
|
||||||
|
taggable "Property"
|
||||||
|
categorizable
|
||||||
|
authorizable
|
||||||
|
frontend_enabled
|
||||||
|
data_count 1..30
|
||||||
|
side_bar do
|
||||||
|
head_label_i18n 'property_hire.property_hire', icon_class: "icons-map"
|
||||||
|
available_for "users"
|
||||||
|
active_for_controllers (['admin/property_hires'])
|
||||||
|
head_link_path "admin_property_hires_path"
|
||||||
|
|
||||||
|
context_link 'all',
|
||||||
|
:link_path=>"admin_property_hires_path" ,
|
||||||
|
:priority=>1,
|
||||||
|
:active_for_action=>{'admin/property_hires'=>"index"},
|
||||||
|
:available_for => 'users'
|
||||||
|
|
||||||
|
context_link 'new_',
|
||||||
|
:link_path=>"new_admin_property_hire_path" ,
|
||||||
|
:priority=>2,
|
||||||
|
:active_for_action=>{'admin/property_hires'=>"new"},
|
||||||
|
:available_for => 'sub_managers'
|
||||||
|
|
||||||
|
context_link 'property_hire.manage_locations',
|
||||||
|
:link_path=>"manage_locations_admin_property_hires_path" ,
|
||||||
|
:priority=>2,
|
||||||
|
:active_for_action=>{'admin/property_hires'=>"manage_locations"},
|
||||||
|
:available_for => 'managers'
|
||||||
|
|
||||||
|
context_link 'categories',
|
||||||
|
:link_path=>"admin_module_app_categories_path" ,
|
||||||
|
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'property_hire').id}",
|
||||||
|
:priority=>3,
|
||||||
|
:active_for_action=>{'admin/property_hires'=>'categories'},
|
||||||
|
:active_for_category => 'PropertyHire',
|
||||||
|
:available_for => 'managers'
|
||||||
|
|
||||||
|
context_link 'tags',
|
||||||
|
:link_path=>"admin_module_app_tags_path" ,
|
||||||
|
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'property_hire').id}",
|
||||||
|
:priority=>5,
|
||||||
|
:active_for_action=>{'admin/property_hires'=>'tags'},
|
||||||
|
:active_for_tag => 'PropertyHire',
|
||||||
|
:available_for => 'managers'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,3 @@
|
||||||
|
module PropertyHire
|
||||||
|
VERSION = "0.0.1"
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
# desc "Explaining what the task does"
|
||||||
|
# task :property_hire do
|
||||||
|
# # Task goes here
|
||||||
|
# end
|
|
@ -0,0 +1,20 @@
|
||||||
|
$:.push File.expand_path("../lib", __FILE__)
|
||||||
|
|
||||||
|
# Maintain your gem's version:
|
||||||
|
require "property_hire/version"
|
||||||
|
|
||||||
|
# Describe your gem and declare its dependencies:
|
||||||
|
Gem::Specification.new do |s|
|
||||||
|
s.name = "property_hire"
|
||||||
|
s.version = PropertyHire::VERSION
|
||||||
|
s.authors = ["Harry Bomrah"]
|
||||||
|
s.email = ["harry@rulingcom.com"]
|
||||||
|
s.homepage = "http://www.rulingcom.com"
|
||||||
|
s.summary = "Property hire module"
|
||||||
|
s.description = "Property hire module"
|
||||||
|
s.license = "MIT"
|
||||||
|
|
||||||
|
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
|
||||||
|
s.test_files = Dir["test/**/*"]
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,28 @@
|
||||||
|
== README
|
||||||
|
|
||||||
|
This README would normally document whatever steps are necessary to get the
|
||||||
|
application up and running.
|
||||||
|
|
||||||
|
Things you may want to cover:
|
||||||
|
|
||||||
|
* Ruby version
|
||||||
|
|
||||||
|
* System dependencies
|
||||||
|
|
||||||
|
* Configuration
|
||||||
|
|
||||||
|
* Database creation
|
||||||
|
|
||||||
|
* Database initialization
|
||||||
|
|
||||||
|
* How to run the test suite
|
||||||
|
|
||||||
|
* Services (job queues, cache servers, search engines, etc.)
|
||||||
|
|
||||||
|
* Deployment instructions
|
||||||
|
|
||||||
|
* ...
|
||||||
|
|
||||||
|
|
||||||
|
Please feel free to use a different markup language if you do not plan to run
|
||||||
|
<tt>rake doc:app</tt>.
|
|
@ -0,0 +1,6 @@
|
||||||
|
# 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__)
|
||||||
|
|
||||||
|
Rails.application.load_tasks
|
|
@ -0,0 +1,13 @@
|
||||||
|
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
||||||
|
// listed below.
|
||||||
|
//
|
||||||
|
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
||||||
|
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
||||||
|
//
|
||||||
|
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
||||||
|
// compiled file.
|
||||||
|
//
|
||||||
|
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
||||||
|
// about supported directives.
|
||||||
|
//
|
||||||
|
//= require_tree .
|
|
@ -0,0 +1,15 @@
|
||||||
|
/*
|
||||||
|
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
||||||
|
* listed below.
|
||||||
|
*
|
||||||
|
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
||||||
|
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
||||||
|
*
|
||||||
|
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
||||||
|
* compiled file so the styles you add here take precedence over styles defined in any styles
|
||||||
|
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
||||||
|
* file per style scope.
|
||||||
|
*
|
||||||
|
*= require_tree .
|
||||||
|
*= require_self
|
||||||
|
*/
|
|
@ -0,0 +1,5 @@
|
||||||
|
class ApplicationController < ActionController::Base
|
||||||
|
# Prevent CSRF attacks by raising an exception.
|
||||||
|
# For APIs, you may want to use :null_session instead.
|
||||||
|
protect_from_forgery with: :exception
|
||||||
|
end
|
|
@ -0,0 +1,2 @@
|
||||||
|
module ApplicationHelper
|
||||||
|
end
|
|
@ -0,0 +1,14 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Dummy</title>
|
||||||
|
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
||||||
|
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
||||||
|
<%= csrf_meta_tags %>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<%= yield %>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
||||||
|
load Gem.bin_path('bundler', 'bundle')
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
||||||
|
require_relative '../config/boot'
|
||||||
|
require 'rails/commands'
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
require_relative '../config/boot'
|
||||||
|
require 'rake'
|
||||||
|
Rake.application.run
|
|
@ -0,0 +1,29 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
require 'pathname'
|
||||||
|
|
||||||
|
# path to your application root.
|
||||||
|
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
||||||
|
|
||||||
|
Dir.chdir APP_ROOT do
|
||||||
|
# This script is a starting point to setup your application.
|
||||||
|
# Add necessary setup steps to this file:
|
||||||
|
|
||||||
|
puts "== Installing dependencies =="
|
||||||
|
system "gem install bundler --conservative"
|
||||||
|
system "bundle check || bundle install"
|
||||||
|
|
||||||
|
# puts "\n== Copying sample files =="
|
||||||
|
# unless File.exist?("config/database.yml")
|
||||||
|
# system "cp config/database.yml.sample config/database.yml"
|
||||||
|
# end
|
||||||
|
|
||||||
|
puts "\n== Preparing database =="
|
||||||
|
system "bin/rake db:setup"
|
||||||
|
|
||||||
|
puts "\n== Removing old logs and tempfiles =="
|
||||||
|
system "rm -f log/*"
|
||||||
|
system "rm -rf tmp/cache"
|
||||||
|
|
||||||
|
puts "\n== Restarting application server =="
|
||||||
|
system "touch tmp/restart.txt"
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
# This file is used by Rack-based servers to start the application.
|
||||||
|
|
||||||
|
require ::File.expand_path('../config/environment', __FILE__)
|
||||||
|
run Rails.application
|
|
@ -0,0 +1,26 @@
|
||||||
|
require File.expand_path('../boot', __FILE__)
|
||||||
|
|
||||||
|
require 'rails/all'
|
||||||
|
|
||||||
|
Bundler.require(*Rails.groups)
|
||||||
|
require "property_hire"
|
||||||
|
|
||||||
|
module Dummy
|
||||||
|
class Application < Rails::Application
|
||||||
|
# Settings in config/environments/* take precedence over those specified here.
|
||||||
|
# Application configuration should go into files in config/initializers
|
||||||
|
# -- all .rb files in that directory are automatically loaded.
|
||||||
|
|
||||||
|
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
||||||
|
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
||||||
|
# config.time_zone = 'Central Time (US & Canada)'
|
||||||
|
|
||||||
|
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
||||||
|
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
||||||
|
# config.i18n.default_locale = :de
|
||||||
|
|
||||||
|
# Do not swallow errors in after_commit/after_rollback callbacks.
|
||||||
|
config.active_record.raise_in_transactional_callbacks = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Set up gems listed in the Gemfile.
|
||||||
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
|
||||||
|
|
||||||
|
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
||||||
|
$LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
|
|
@ -0,0 +1,25 @@
|
||||||
|
# SQLite version 3.x
|
||||||
|
# gem install sqlite3
|
||||||
|
#
|
||||||
|
# Ensure the SQLite 3 gem is defined in your Gemfile
|
||||||
|
# gem 'sqlite3'
|
||||||
|
#
|
||||||
|
default: &default
|
||||||
|
adapter: sqlite3
|
||||||
|
pool: 5
|
||||||
|
timeout: 5000
|
||||||
|
|
||||||
|
development:
|
||||||
|
<<: *default
|
||||||
|
database: db/development.sqlite3
|
||||||
|
|
||||||
|
# Warning: The database defined as "test" will be erased and
|
||||||
|
# re-generated from your development database when you run "rake".
|
||||||
|
# Do not set this db to the same as development or production.
|
||||||
|
test:
|
||||||
|
<<: *default
|
||||||
|
database: db/test.sqlite3
|
||||||
|
|
||||||
|
production:
|
||||||
|
<<: *default
|
||||||
|
database: db/production.sqlite3
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Load the Rails application.
|
||||||
|
require File.expand_path('../application', __FILE__)
|
||||||
|
|
||||||
|
# Initialize the Rails application.
|
||||||
|
Rails.application.initialize!
|
|
@ -0,0 +1,41 @@
|
||||||
|
Rails.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 web server when you make code changes.
|
||||||
|
config.cache_classes = false
|
||||||
|
|
||||||
|
# Do not eager load code on boot.
|
||||||
|
config.eager_load = false
|
||||||
|
|
||||||
|
# Show full error reports and disable caching.
|
||||||
|
config.consider_all_requests_local = true
|
||||||
|
config.action_controller.perform_caching = false
|
||||||
|
|
||||||
|
# Don't care if the mailer can't send.
|
||||||
|
config.action_mailer.raise_delivery_errors = false
|
||||||
|
|
||||||
|
# Print deprecation notices to the Rails logger.
|
||||||
|
config.active_support.deprecation = :log
|
||||||
|
|
||||||
|
# Raise an error on page load if there are pending migrations.
|
||||||
|
config.active_record.migration_error = :page_load
|
||||||
|
|
||||||
|
# Debug mode disables concatenation and preprocessing of assets.
|
||||||
|
# This option may cause significant delays in view rendering with a large
|
||||||
|
# number of complex assets.
|
||||||
|
config.assets.debug = true
|
||||||
|
|
||||||
|
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
||||||
|
# yet still be able to expire them through the digest params.
|
||||||
|
config.assets.digest = true
|
||||||
|
|
||||||
|
# Adds additional error checking when serving assets at runtime.
|
||||||
|
# Checks for improperly declared sprockets dependencies.
|
||||||
|
# Raises helpful error messages.
|
||||||
|
config.assets.raise_runtime_errors = true
|
||||||
|
|
||||||
|
# Raises error for missing translations
|
||||||
|
# config.action_view.raise_on_missing_translations = true
|
||||||
|
end
|
|
@ -0,0 +1,79 @@
|
||||||
|
Rails.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
|
||||||
|
|
||||||
|
# Eager load code on boot. This eager loads most of Rails and
|
||||||
|
# your application in memory, allowing both threaded web servers
|
||||||
|
# and those relying on copy on write to perform better.
|
||||||
|
# Rake tasks automatically ignore this option for performance.
|
||||||
|
config.eager_load = true
|
||||||
|
|
||||||
|
# Full error reports are disabled and caching is turned on.
|
||||||
|
config.consider_all_requests_local = false
|
||||||
|
config.action_controller.perform_caching = true
|
||||||
|
|
||||||
|
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
||||||
|
# Add `rack-cache` to your Gemfile before enabling this.
|
||||||
|
# For large-scale production use, consider using a caching reverse proxy like
|
||||||
|
# NGINX, varnish or squid.
|
||||||
|
# config.action_dispatch.rack_cache = true
|
||||||
|
|
||||||
|
# Disable serving static files from the `/public` folder by default since
|
||||||
|
# Apache or NGINX already handles this.
|
||||||
|
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
||||||
|
|
||||||
|
# Compress JavaScripts and CSS.
|
||||||
|
config.assets.js_compressor = :uglifier
|
||||||
|
# config.assets.css_compressor = :sass
|
||||||
|
|
||||||
|
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
||||||
|
config.assets.compile = false
|
||||||
|
|
||||||
|
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
||||||
|
# yet still be able to expire them through the digest params.
|
||||||
|
config.assets.digest = true
|
||||||
|
|
||||||
|
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
||||||
|
|
||||||
|
# Specifies the header that your server uses for sending files.
|
||||||
|
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
||||||
|
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
||||||
|
|
||||||
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||||
|
# config.force_ssl = true
|
||||||
|
|
||||||
|
# Use the lowest log level to ensure availability of diagnostic information
|
||||||
|
# when problems arise.
|
||||||
|
config.log_level = :debug
|
||||||
|
|
||||||
|
# Prepend all log lines with the following tags.
|
||||||
|
# config.log_tags = [ :subdomain, :uuid ]
|
||||||
|
|
||||||
|
# Use a different logger for distributed setups.
|
||||||
|
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
||||||
|
|
||||||
|
# Use a different cache store in production.
|
||||||
|
# config.cache_store = :mem_cache_store
|
||||||
|
|
||||||
|
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
||||||
|
# config.action_controller.asset_host = 'http://assets.example.com'
|
||||||
|
|
||||||
|
# Ignore bad email addresses and do not raise email delivery errors.
|
||||||
|
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
||||||
|
# config.action_mailer.raise_delivery_errors = false
|
||||||
|
|
||||||
|
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
||||||
|
# the I18n.default_locale when a translation cannot be found).
|
||||||
|
config.i18n.fallbacks = true
|
||||||
|
|
||||||
|
# Send deprecation notices to registered listeners.
|
||||||
|
config.active_support.deprecation = :notify
|
||||||
|
|
||||||
|
# Use default logging formatter so that PID and timestamp are not suppressed.
|
||||||
|
config.log_formatter = ::Logger::Formatter.new
|
||||||
|
|
||||||
|
# Do not dump schema after migrations.
|
||||||
|
config.active_record.dump_schema_after_migration = false
|
||||||
|
end
|
|
@ -0,0 +1,42 @@
|
||||||
|
Rails.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 test suite and is wiped
|
||||||
|
# and recreated between test runs. Don't rely on the data there!
|
||||||
|
config.cache_classes = true
|
||||||
|
|
||||||
|
# Do not eager load code on boot. This avoids loading your whole application
|
||||||
|
# just for the purpose of running a single test. If you are using a tool that
|
||||||
|
# preloads Rails for running tests, you may have to set it to true.
|
||||||
|
config.eager_load = false
|
||||||
|
|
||||||
|
# Configure static file server for tests with Cache-Control for performance.
|
||||||
|
config.serve_static_files = true
|
||||||
|
config.static_cache_control = 'public, max-age=3600'
|
||||||
|
|
||||||
|
# Show full error reports and disable caching.
|
||||||
|
config.consider_all_requests_local = true
|
||||||
|
config.action_controller.perform_caching = false
|
||||||
|
|
||||||
|
# Raise exceptions instead of rendering exception templates.
|
||||||
|
config.action_dispatch.show_exceptions = false
|
||||||
|
|
||||||
|
# Disable request forgery protection in test environment.
|
||||||
|
config.action_controller.allow_forgery_protection = false
|
||||||
|
|
||||||
|
# Tell Action Mailer not to deliver emails to the real world.
|
||||||
|
# The :test delivery method accumulates sent emails in the
|
||||||
|
# ActionMailer::Base.deliveries array.
|
||||||
|
config.action_mailer.delivery_method = :test
|
||||||
|
|
||||||
|
# Randomize the order test cases are executed.
|
||||||
|
config.active_support.test_order = :random
|
||||||
|
|
||||||
|
# Print deprecation notices to the stderr.
|
||||||
|
config.active_support.deprecation = :stderr
|
||||||
|
|
||||||
|
# Raises error for missing translations
|
||||||
|
# config.action_view.raise_on_missing_translations = true
|
||||||
|
end
|
|
@ -0,0 +1,11 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Version of your assets, change this if you want to expire all your assets.
|
||||||
|
Rails.application.config.assets.version = '1.0'
|
||||||
|
|
||||||
|
# Add additional assets to the asset load path
|
||||||
|
# Rails.application.config.assets.paths << Emoji.images_path
|
||||||
|
|
||||||
|
# Precompile additional assets.
|
||||||
|
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
||||||
|
# Rails.application.config.assets.precompile += %w( search.js )
|
|
@ -0,0 +1,7 @@
|
||||||
|
# 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 problem that might stem from framework code.
|
||||||
|
# Rails.backtrace_cleaner.remove_silencers!
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
Rails.application.config.action_dispatch.cookies_serializer = :json
|
|
@ -0,0 +1,4 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Configure sensitive parameters which will be filtered from the log file.
|
||||||
|
Rails.application.config.filter_parameters += [:password]
|
|
@ -0,0 +1,16 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Add new inflection rules using the following format. Inflections
|
||||||
|
# are locale specific, and you may define rules for as many different
|
||||||
|
# locales as you wish. All of these examples are active by default:
|
||||||
|
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||||
|
# inflect.plural /^(ox)$/i, '\1en'
|
||||||
|
# inflect.singular /^(ox)en/i, '\1'
|
||||||
|
# inflect.irregular 'person', 'people'
|
||||||
|
# inflect.uncountable %w( fish sheep )
|
||||||
|
# end
|
||||||
|
|
||||||
|
# These inflection rules are supported but not enabled by default:
|
||||||
|
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||||
|
# inflect.acronym 'RESTful'
|
||||||
|
# end
|
|
@ -0,0 +1,4 @@
|
||||||
|
# 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
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
Rails.application.config.session_store :cookie_store, key: '_dummy_session'
|
|
@ -0,0 +1,14 @@
|
||||||
|
# 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 format: [:json] if respond_to?(:wrap_parameters)
|
||||||
|
end
|
||||||
|
|
||||||
|
# To enable root element in JSON for ActiveRecord objects.
|
||||||
|
# ActiveSupport.on_load(:active_record) do
|
||||||
|
# self.include_root_in_json = true
|
||||||
|
# end
|
|
@ -0,0 +1,23 @@
|
||||||
|
# Files in the config/locales directory are used for internationalization
|
||||||
|
# and are automatically loaded by Rails. If you want to use locales other
|
||||||
|
# than English, add the necessary files in this directory.
|
||||||
|
#
|
||||||
|
# To use the locales, use `I18n.t`:
|
||||||
|
#
|
||||||
|
# I18n.t 'hello'
|
||||||
|
#
|
||||||
|
# In views, this is aliased to just `t`:
|
||||||
|
#
|
||||||
|
# <%= t('hello') %>
|
||||||
|
#
|
||||||
|
# To use a different locale, set it with `I18n.locale`:
|
||||||
|
#
|
||||||
|
# I18n.locale = :es
|
||||||
|
#
|
||||||
|
# This would use the information in config/locales/es.yml.
|
||||||
|
#
|
||||||
|
# To learn more, please read the Rails Internationalization guide
|
||||||
|
# available at http://guides.rubyonrails.org/i18n.html.
|
||||||
|
|
||||||
|
en:
|
||||||
|
hello: "Hello world"
|
|
@ -0,0 +1,4 @@
|
||||||
|
Rails.application.routes.draw do
|
||||||
|
|
||||||
|
mount PropertyHire::Engine => "/property_hire"
|
||||||
|
end
|
|
@ -0,0 +1,22 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Your secret key is used 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 attacks.
|
||||||
|
# You can use `rake secret` to generate a secure secret key.
|
||||||
|
|
||||||
|
# Make sure the secrets in this file are kept private
|
||||||
|
# if you're sharing your code publicly.
|
||||||
|
|
||||||
|
development:
|
||||||
|
secret_key_base: 882281beb7903e89814b698c9cc3b1345b45080793fde13c21aaee6cb1bdc1322023b35d0770145c2247ca462c75d286f874282294e143107b5f166d3a41e4c5
|
||||||
|
|
||||||
|
test:
|
||||||
|
secret_key_base: c357fef67e988b6a6efc2ee209eb9b1306fb85c06bac8cb442b1e1989a8444a6cc8b30264f35a65f8f444d741d4bf80db17c248430c482a9e954f583d5fd9658
|
||||||
|
|
||||||
|
# Do not keep production secrets in the repository,
|
||||||
|
# instead read values from the environment.
|
||||||
|
production:
|
||||||
|
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
|
@ -0,0 +1,67 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>The page you were looking for doesn't exist (404)</title>
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #EFEFEF;
|
||||||
|
color: #2E2F30;
|
||||||
|
text-align: center;
|
||||||
|
font-family: arial, sans-serif;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.dialog {
|
||||||
|
width: 95%;
|
||||||
|
max-width: 33em;
|
||||||
|
margin: 4em auto 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.dialog > div {
|
||||||
|
border: 1px solid #CCC;
|
||||||
|
border-right-color: #999;
|
||||||
|
border-left-color: #999;
|
||||||
|
border-bottom-color: #BBB;
|
||||||
|
border-top: #B00100 solid 4px;
|
||||||
|
border-top-left-radius: 9px;
|
||||||
|
border-top-right-radius: 9px;
|
||||||
|
background-color: white;
|
||||||
|
padding: 7px 12% 0;
|
||||||
|
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 100%;
|
||||||
|
color: #730E15;
|
||||||
|
line-height: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.dialog > p {
|
||||||
|
margin: 0 0 1em;
|
||||||
|
padding: 1em;
|
||||||
|
background-color: #F7F7F7;
|
||||||
|
border: 1px solid #CCC;
|
||||||
|
border-right-color: #999;
|
||||||
|
border-left-color: #999;
|
||||||
|
border-bottom-color: #999;
|
||||||
|
border-bottom-left-radius: 4px;
|
||||||
|
border-bottom-right-radius: 4px;
|
||||||
|
border-top-color: #DADADA;
|
||||||
|
color: #666;
|
||||||
|
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- This file lives in public/404.html -->
|
||||||
|
<div class="dialog">
|
||||||
|
<div>
|
||||||
|
<h1>The page you were looking for doesn't exist.</h1>
|
||||||
|
<p>You may have mistyped the address or the page may have moved.</p>
|
||||||
|
</div>
|
||||||
|
<p>If you are the application owner check the logs for more information.</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,67 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>The change you wanted was rejected (422)</title>
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #EFEFEF;
|
||||||
|
color: #2E2F30;
|
||||||
|
text-align: center;
|
||||||
|
font-family: arial, sans-serif;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.dialog {
|
||||||
|
width: 95%;
|
||||||
|
max-width: 33em;
|
||||||
|
margin: 4em auto 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.dialog > div {
|
||||||
|
border: 1px solid #CCC;
|
||||||
|
border-right-color: #999;
|
||||||
|
border-left-color: #999;
|
||||||
|
border-bottom-color: #BBB;
|
||||||
|
border-top: #B00100 solid 4px;
|
||||||
|
border-top-left-radius: 9px;
|
||||||
|
border-top-right-radius: 9px;
|
||||||
|
background-color: white;
|
||||||
|
padding: 7px 12% 0;
|
||||||
|
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 100%;
|
||||||
|
color: #730E15;
|
||||||
|
line-height: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.dialog > p {
|
||||||
|
margin: 0 0 1em;
|
||||||
|
padding: 1em;
|
||||||
|
background-color: #F7F7F7;
|
||||||
|
border: 1px solid #CCC;
|
||||||
|
border-right-color: #999;
|
||||||
|
border-left-color: #999;
|
||||||
|
border-bottom-color: #999;
|
||||||
|
border-bottom-left-radius: 4px;
|
||||||
|
border-bottom-right-radius: 4px;
|
||||||
|
border-top-color: #DADADA;
|
||||||
|
color: #666;
|
||||||
|
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- This file lives in public/422.html -->
|
||||||
|
<div class="dialog">
|
||||||
|
<div>
|
||||||
|
<h1>The change you wanted was rejected.</h1>
|
||||||
|
<p>Maybe you tried to change something you didn't have access to.</p>
|
||||||
|
</div>
|
||||||
|
<p>If you are the application owner check the logs for more information.</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,66 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>We're sorry, but something went wrong (500)</title>
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #EFEFEF;
|
||||||
|
color: #2E2F30;
|
||||||
|
text-align: center;
|
||||||
|
font-family: arial, sans-serif;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.dialog {
|
||||||
|
width: 95%;
|
||||||
|
max-width: 33em;
|
||||||
|
margin: 4em auto 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.dialog > div {
|
||||||
|
border: 1px solid #CCC;
|
||||||
|
border-right-color: #999;
|
||||||
|
border-left-color: #999;
|
||||||
|
border-bottom-color: #BBB;
|
||||||
|
border-top: #B00100 solid 4px;
|
||||||
|
border-top-left-radius: 9px;
|
||||||
|
border-top-right-radius: 9px;
|
||||||
|
background-color: white;
|
||||||
|
padding: 7px 12% 0;
|
||||||
|
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 100%;
|
||||||
|
color: #730E15;
|
||||||
|
line-height: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.dialog > p {
|
||||||
|
margin: 0 0 1em;
|
||||||
|
padding: 1em;
|
||||||
|
background-color: #F7F7F7;
|
||||||
|
border: 1px solid #CCC;
|
||||||
|
border-right-color: #999;
|
||||||
|
border-left-color: #999;
|
||||||
|
border-bottom-color: #999;
|
||||||
|
border-bottom-left-radius: 4px;
|
||||||
|
border-bottom-right-radius: 4px;
|
||||||
|
border-top-color: #DADADA;
|
||||||
|
color: #666;
|
||||||
|
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- This file lives in public/500.html -->
|
||||||
|
<div class="dialog">
|
||||||
|
<div>
|
||||||
|
<h1>We're sorry, but something went wrong.</h1>
|
||||||
|
</div>
|
||||||
|
<p>If you are the application owner check the logs for more information.</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,8 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class NavigationTest < ActionDispatch::IntegrationTest
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class PropertyHireTest < ActiveSupport::TestCase
|
||||||
|
test "truth" do
|
||||||
|
assert_kind_of Module, PropertyHire
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,21 @@
|
||||||
|
# Configure Rails Environment
|
||||||
|
ENV["RAILS_ENV"] = "test"
|
||||||
|
|
||||||
|
require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
|
||||||
|
ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)]
|
||||||
|
ActiveRecord::Migrator.migrations_paths << File.expand_path('../../db/migrate', __FILE__)
|
||||||
|
require "rails/test_help"
|
||||||
|
|
||||||
|
# Filter out Minitest backtrace while allowing backtrace from other libraries
|
||||||
|
# to be shown.
|
||||||
|
Minitest.backtrace_filter = Minitest::BacktraceFilter.new
|
||||||
|
|
||||||
|
# Load support files
|
||||||
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
||||||
|
|
||||||
|
# Load fixtures from the engine
|
||||||
|
if ActiveSupport::TestCase.respond_to?(:fixture_path=)
|
||||||
|
ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
|
||||||
|
ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path
|
||||||
|
ActiveSupport::TestCase.fixtures :all
|
||||||
|
end
|
Loading…
Reference in New Issue