This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
$(document).ready(function () { | |
$("#project_postnumber").blur(function(){ | |
$.ajax({url: '/project/postplace', type: 'POST'}) | |
.done(function(response){ | |
$("#project_postplace").val(response); | |
}); | |
}); | |
}); | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Project < ActiveRecord::Base | |
# Sjekker at kolonnen navn er fyllt ut. | |
validates :name, presence: true | |
validates :client_id, presence: true | |
belongs_to :admin | |
belongs_to :client | |
has_many :registerhours, dependent: :destroy | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def index | |
@admin = Admin.all | |
end | |
def new | |
@admin = Admin.new | |
end | |
def destroy | |
@admin.destroy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= f.input :date_today, :collection => [['2 dager siden', Date.today-2], ['I går', Date.yesterday], ['I dag', Date.today.day]], :as :radio_buttons %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Registerhour < ActiveRecord::Base | |
before_save :check_hours | |
belongs_to :project | |
belongs_to :admin | |
validates_presence_of :project, :timetype | |
validate :from_time_cannot_be_after_to_time | |
def from_time_cannot_be_after_to_time | |
if from.present? && from >= to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SQLite3::SQLException: near "to": syntax error: SELECT 1 AS one FROM "registerhours" WHERE (registerhours.to >= '2013-10-15 16:00:00.000000' AND registerhours.from <= '2013-10-15 17:00:00.000000') ORDER BY created_at DESC LIMIT 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.validate_hour(p_id, date_selected, a_id, start_at, end_at) | |
where { | |
(project_id == p_id) & (date_today == date_selected) & (admin_id == a_id) & (from >= start_at) & (from <= end_at) | | |
(project_id == p_id) & (date_today == date_selected) & (admin_id == a_id) & (from <= start_at) & (to >= end_at) | | |
(project_id == p_id) & (date_today == date_selected) & (admin_id == a_id) & (to >= start_at) & (to < end_at) | | |
(project_id == p_id) & (date_today == date_selected) & (admin_id == a_id) & (start_at >= end_at) | |
}.count() | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
thomass@filserver:~$ nmap -Pn 64.5.98.132 | |
Starting Nmap 5.21 ( http://nmap.org ) at 2013-11-13 19:28 CET | |
Nmap scan report for apollo.mavieo.com (64.5.98.132) | |
Host is up (0.22s latency). | |
All 1000 scanned ports on apollo.mavieo.com (64.5.98.132) are filtered (959) or closed (41) | |
Nmap done: 1 IP address (1 host up) scanned in 22.00 seconds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/dev/mapper/vg_server1-lv_root / ext4 defaults,usrquota 1 1 | |
UUID=7c472404-882c-4943-b54b-b23949c9ee98 /boot ext4 defaults 1 2 | |
/dev/mapper/vg_server1-lv_home /home ext4 defaults,usrquota 1 2 | |
/dev/mapper/vg_server1-lv_swap swap swap defaults 0 0 | |
tmpfs /dev/shm tmpfs defaults,noexec,nosuid 0 0 | |
devpts /dev/pts devpts gid=5,mode=620 0 0 | |
sysfs /sys sysfs defaults 0 0 | |
proc /proc proc defaults 0 0 | |
/usr/tmpDSK /tmp ext3 defaults,noauto 0 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RegistrationsController < Devise::RegistrationsController | |
before_filter :configure_permitted_parameters, if: :devise_controller? | |
#def new | |
#flash[:error] = 'Registrations are not open yet, but please check back soon' | |
# nil | |
# render 'static_pages/_sign_up_not_allowed' | |
#end | |
private |