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 AppBuilder < Rails::AppBuilder | |
def initialize(generator) | |
super(generator) | |
at_exit do | |
postprocess | |
end | |
end | |
def readme |
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
// using Backbone.Pageable https://github.com/wyuenho/backbone-pageable | |
App.Collections.Protocols = Backbone.PageableCollection.extend({ | |
model: App.Models.Protocol, | |
url: '/protocols', | |
state: { | |
firstPage: 1, | |
currentPage: 1, | |
pageSize: 100 |
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 ProtocolsController < ApplicationController | |
respond_to :json | |
before_action :set_protocol, only: [:show, :update, :destroy] | |
def index | |
respond_with @protocols = Protocol.ordered | |
end | |
def show |
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
<% @categories.each do |category, category_count| %> | |
<tr class="<%= category %> value" data-count="<%= category_count %>"> | |
<td><%= category_count %></td><td><%= category_count * 100 / @violations_to_check %>%</td><td><%= category_count %></td><td><i class="icon-arrow-up"></i></td> | |
</tr> | |
<% 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
require 'net/ldap' | |
module LdapAdapter | |
# Add valid users to database | |
mattr_accessor :ldap_create_user | |
@@ldap_create_user = false | |
mattr_accessor :ldap_config | |
# @@ldap_config = "#{Rails.root}/config/ldap.yml" | |
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
# config/initializers/devise.rb | |
# Use this hook to configure devise mailer, warden hooks and so forth. | |
# Many of these configuration options can be set straight in your model. | |
Devise.setup do |config| | |
# snip... | |
config.warden do |manager| | |
manager.default_strategies(:scope => :user).unshift :ldap_authenticatable | |
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
# db/migrate/<timestamp>_devise_create_user.rb | |
# This is pretty much stock rails g devise User | |
# with the only exception being t.boolean :override_ldap, :default => false | |
class DeviseCreateUsers < ActiveRecord::Migration | |
def change | |
create_table(:users) do |t| | |
## Database authenticatable | |
t.string :username, :null => false, :default => "" | |
t.string :email, :null => false, :default => "" |
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
# db/migrate/<timestamp>_devise_create_user.rb | |
class DeviseCreateUsers < ActiveRecord::Migration | |
def change | |
create_table(:users) do |t| | |
## Database authenticatable | |
t.string :username, :null => false, :default => "" | |
t.string :email, :null => false, :default => "" | |
t.string :encrypted_password, :null => false, :default => "" |