Merge branch 'ipn' of github.com:zyphlar/Open-Source-Access-Control-Web-Interface into ipn
This commit is contained in:
commit
45bac6cae4
2
Gemfile
2
Gemfile
|
@ -1,5 +1,7 @@
|
||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
|
#ruby '1.9.3'
|
||||||
|
|
||||||
gem 'rails', '3.2.3'
|
gem 'rails', '3.2.3'
|
||||||
|
|
||||||
# Bundle edge Rails instead:
|
# Bundle edge Rails instead:
|
||||||
|
|
|
@ -12,3 +12,36 @@
|
||||||
*= require_tree .
|
*= require_tree .
|
||||||
*/
|
*/
|
||||||
.caption { display: inline-block; background-color: #eee; border: 1px solid #333; border-radius: 5px; margin-bottom: 1em; }
|
.caption { display: inline-block; background-color: #eee; border: 1px solid #333; border-radius: 5px; margin-bottom: 1em; }
|
||||||
|
.btn {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 4px 10px 4px;
|
||||||
|
margin-bottom: 0;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 18px;
|
||||||
|
color: #333;
|
||||||
|
text-align: center;
|
||||||
|
text-shadow: 0 1px 1px rgba(255,255,255,.75);
|
||||||
|
vertical-align: middle;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
background-image: -moz-linear-gradient(top, #fff, #e6e6e6);
|
||||||
|
background-image: -ms-linear-gradient(top, #fff, #e6e6e6);
|
||||||
|
background-image: -webkit-gradient(linear,0 0,0 100%,from( #fff),to( #e6e6e6));
|
||||||
|
background-image: -webkit-linear-gradient(top, #fff, #e6e6e6);
|
||||||
|
background-image: -o-linear-gradient(top, #fff, #e6e6e6);
|
||||||
|
background-image: linear-gradient(top, #fff, #e6e6e6);
|
||||||
|
background-repeat: repeat-x;
|
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#e6e6e6', GradientType=0);
|
||||||
|
border-color: #e6e6e6 #e6e6e6 #bfbfbf;
|
||||||
|
border-color: rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);
|
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-bottom-color: #bbb;
|
||||||
|
-webkit-border-radius: 4px;
|
||||||
|
-moz-border-radius: 4px;
|
||||||
|
border-radius: 4px;
|
||||||
|
-webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);
|
||||||
|
-moz-box-shadow: inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);
|
||||||
|
box-shadow: inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);
|
||||||
|
cursor: pointer;
|
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class IpnsController < ApplicationController
|
class IpnsController < ApplicationController
|
||||||
load_and_authorize_resource :ipn, :except => [:new, :create]
|
load_and_authorize_resource :ipn, :except => [:new, :create]
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!, :except => [:new, :create]
|
||||||
|
|
||||||
protect_from_forgery :except => [:create]
|
protect_from_forgery :except => [:create]
|
||||||
|
|
||||||
|
@ -19,9 +19,9 @@ class IpnsController < ApplicationController
|
||||||
@ipn.data = params.to_json
|
@ipn.data = params.to_json
|
||||||
@ipn.save
|
@ipn.save
|
||||||
render :nothing => true
|
render :nothing => true
|
||||||
unless @ipn.validate!
|
#unless @ipn.validate!
|
||||||
Rails.logger.error "Unable to validate IPN: #{@ipn.inspect}"
|
# Rails.logger.error "Unable to validate IPN: #{@ipn.inspect}"
|
||||||
end
|
#end
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate
|
def validate
|
||||||
|
@ -41,4 +41,4 @@ class IpnsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,7 +6,7 @@ class UserCertificationsController < ApplicationController
|
||||||
|
|
||||||
# Load users and certs based on current ability
|
# Load users and certs based on current ability
|
||||||
before_filter :only => [:new, :edit, :create, :update] do
|
before_filter :only => [:new, :edit, :create, :update] do
|
||||||
@users = User.where(:hidden => false).accessible_by(current_ability).sort_by(&:name)
|
@users = User.where(:hidden => [false,nil]).accessible_by(current_ability).sort_by(&:name)
|
||||||
@certifications = Certification.accessible_by(current_ability).sort_by(&:name)
|
@certifications = Certification.accessible_by(current_ability).sort_by(&:name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,8 @@ class Card < ActiveRecord::Base
|
||||||
require 'open-uri'
|
require 'open-uri'
|
||||||
|
|
||||||
attr_accessible :id, :user_id, :name, :card_number, :card_permissions
|
attr_accessible :id, :user_id, :name, :card_number, :card_permissions
|
||||||
validates_uniqueness_of :id,:card_number
|
validates_presence_of :user_id, :card_number, :card_permissions
|
||||||
|
validates_uniqueness_of :id, :card_number
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
||||||
def upload_to_door
|
def upload_to_door
|
||||||
|
|
|
@ -1,12 +1,17 @@
|
||||||
class UserCertification < ActiveRecord::Base
|
class UserCertification < ActiveRecord::Base
|
||||||
attr_accessible :certification_id, :user_id
|
attr_accessible :certification_id, :user_id
|
||||||
|
|
||||||
|
validates_presence_of :certification_id, :user_id
|
||||||
validates_uniqueness_of :certification_id, :scope => :user_id, :message => 'already exists for this user.' # Makes sure users don't get certified twice
|
validates_uniqueness_of :certification_id, :scope => :user_id, :message => 'already exists for this user.' # Makes sure users don't get certified twice
|
||||||
|
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
belongs_to :certification
|
belongs_to :certification
|
||||||
|
|
||||||
def user_name
|
def user_name
|
||||||
self.user.name unless self.user.blank?
|
if self.user.blank?
|
||||||
|
""
|
||||||
|
else
|
||||||
|
self.user.name
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,9 +11,10 @@
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<% @card.user_id = params[:user] if params[:user].present? %>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<%= f.label :user %><br />
|
<%= f.label :user %><br />
|
||||||
<%= collection_select(:card, :user_id, User.all.sort_by(&:name), :id, :name) %>
|
<%= collection_select(:card, :user_id, User.all.sort_by(&:name), :id, :name, :include_blank => true) %>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<%= f.label :name, "Card Note" %><br />
|
<%= f.label :name, "Card Note" %><br />
|
||||||
|
|
|
@ -8,13 +8,10 @@
|
||||||
<%= simple_format @certification.description %>
|
<%= simple_format @certification.description %>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<b>Certified Users:</b>
|
<p>
|
||||||
<ul>
|
<b>Certified Users:</b>
|
||||||
<% @certification_users.each do |user| %>
|
<%= link_to "Click Here", user_certifications_path %>
|
||||||
<li><%= link_to user.name, user %></li>
|
</p>
|
||||||
<% end %>
|
|
||||||
<% if @certification_users.blank? then %><li>n/a</li><% end %>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<% if can? :update, @certification %><%= link_to 'Edit', edit_certification_path(@certification) %> |<% end %>
|
<% if can? :update, @certification %><%= link_to 'Edit', edit_certification_path(@certification) %> |<% end %>
|
||||||
<%= link_to 'Back', certifications_path %>
|
<%= link_to 'Back', certifications_path %>
|
||||||
|
|
|
@ -11,13 +11,14 @@
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<% @user_certification.user_id = params[:user] if params[:user].present? %>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<%= f.label :user_id, "User" %><br />
|
<%= f.label :user_id, "User" %><br />
|
||||||
<%= collection_select(:user_certification, :user_id, @users, :id, :name) %>
|
<%= collection_select(:user_certification, :user_id, @users, :id, :name, :include_blank => true) %>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<%= f.label :certification_id, "Certification" %><br />
|
<%= f.label :certification_id, "Certification" %><br />
|
||||||
<%= collection_select(:user_certification, :certification_id, @certifications, :id, :name) %>
|
<%= collection_select(:user_certification, :certification_id, @certifications, :id, :name, :include_blank => true) %>
|
||||||
</div>
|
</div>
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<%= f.submit %>
|
<%= f.submit %>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<p>
|
<p>
|
||||||
<b>User:</b>
|
<b>User:</b>
|
||||||
<%= @user_certification.user.name %>
|
<%= link_to @user_certification.user.name, @user_certification.user %>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<p>
|
<p>
|
||||||
<b>Card:</b>
|
<b>Card:</b><%= link_to "+ Add", (new_card_path+"?user="+@user.id.to_s), :class => 'btn' if can? :create, Card %>
|
||||||
<% if current_user.admin? then %>
|
<% if current_user.admin? then %>
|
||||||
<% @user.cards.each do |c| %>
|
<% @user.cards.each do |c| %>
|
||||||
<%= link_to c.card_number, c %><%= "," unless c == @user.cards.last %>
|
<%= link_to c.card_number, c %><%= "," unless c == @user.cards.last %>
|
||||||
|
@ -84,7 +84,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<b>Certifications:</b>
|
<b>Certifications:</b><%= link_to "+ Add", (new_user_certification_path+"?user="+@user.id.to_s), :class => 'btn' if can? :create, UserCertification %>
|
||||||
<ul>
|
<ul>
|
||||||
<% @user.certifications.each do |certification| %>
|
<% @user.certifications.each do |certification| %>
|
||||||
<li><%= link_to certification.name, certification %></li>
|
<li><%= link_to certification.name, certification %></li>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user