Fixing issue #19 and also styling homepage

This commit is contained in:
Will Bradley 2014-04-10 19:45:29 -07:00
parent 83442c4bff
commit 13e72fef23
8 changed files with 98 additions and 83 deletions

View File

@ -18,6 +18,7 @@ class ContractsController < ApplicationController
def create
Rails.logger.info "CONTRACT"
Rails.logger.info @contract.inspect
@contract.created_by = current_user.id
respond_to do |format|
if @contract.save
format.html { redirect_to @contract, :notice => 'Contract was successfully created.' }
@ -51,6 +52,6 @@ class ContractsController < ApplicationController
end
def load_users
@users = @users = User.accessible_by(current_ability).sort_by(&:name)
@users = User.accessible_by(current_ability).sort_by(&:name)
end
end

View File

@ -1,6 +1,21 @@
class HomeController < ApplicationController
layout 'resources'
def index
# Alerts
if user_signed_in? && current_user.orientation.blank? then
flash[:alert] = "There's a lot more to see here, but our records show you haven't completed the new member orientation yet. If that's incorrect, please contact a volunteer."
end
if user_signed_in? && current_user.member_status.between?(2,100) then
flash[:alert] = "<!--
Member: <%= current_user.member.inspect
Level: <%= current_user.member_level.inspect
-->
Looks like we haven't acknowledged a recent payment for you yet. This could be because we're slow, but if in doubt please see your profile for payment instructions, consider updating your membership level to something accurate, or contact us.<br/>Thanks for supporting us!"
end
# Fun Stats
@num_certs = UserCertification.count
@recent_certs = UserCertification.where("created_at > ?", DateTime.now - 7.days).count
@num_users = User.count

View File

@ -1,6 +1,9 @@
class Contract < ActiveRecord::Base
belongs_to :user
attr_accessible :user_id, :first_name, :last_name, :cosigner, :signed_at, :document, :document_file_name, :document_content_type, :document_file_size, :document_updated_at
attr_accessible :user_id, :first_name, :last_name, :cosigner,
:signed_at, :document, :document_file_name, :document_content_type,
:document_file_size, :document_updated_at
# :created_by not accessible for security purposes
validates_presence_of :first_name, :signed_at #, :last_name

View File

@ -3,18 +3,7 @@
<%= simple_format Setting.welcome_body %>
<% end %>
<% if user_signed_in? && current_user.orientation.blank? then %>
<p class="alert">There's a lot more to see here, but our records show you haven't completed the new member orientation yet. If that's incorrect, please contact a volunteer.</p>
<% end %>
<% if user_signed_in? && current_user.member_status.between?(2,100) then %>
<%= current_user.member.inspect %>
<%= current_user.member_level.inspect %>
<p class="alert">Looks like we haven't acknowledged a recent payment for you yet. This could be because we're slow, or this app just got started, but if in doubt please see your profile for payment instructions, or consider updating your membership level to something accurate.<br/>Thanks for supporting HeatSync!</p>
<% end %>
<table>
<tr>
<td>
<div class="col-sm-4">
<% if ((can? :read, User) && (@recent_user_names.count > 1)) then %>
<h2>New People: <em>(say hi!)</em></h2>
<ul>
@ -25,6 +14,9 @@
<% end %>
</ul>
<% end %>
</div>
<div class="col-sm-4">
<h2>Cool Stats:</h2>
<dl>
<dt># of People in this DB:</dt>
@ -42,16 +34,12 @@
<dt># of Computers in this DB:</dt>
<dd><%= @num_macs %> (<%= @recent_macs %> seen today)</dd>
</dl>
</div>
</td>
<td>
<div class="col-sm-4">
<h2>Member Resources</h2>
<% if can? :access_doors_remotely, :door_access %>
<ul><li><%= link_to "Remote Door Access", space_api_access_path %></li></ul>
<% end %>
<%= simple_format Setting.member_resources_inset %>
</td>
</tr>
</table>
</div>

View File

@ -2,6 +2,7 @@
<html>
<head>
<title>hsl_members(<%= controller.controller_name %>.<%= controller.action_name %><%= "["+params[:id]+"]" unless params[:id].blank? %>)</title>
<link rel="icon" href="/favicon.ico">
<% if params[:controller] == "resources" %>
<link href="/bootstrap/css/bootstrap.min.css" type="text/css" rel="stylesheet" />
<link href="/bootstrap/css/bootstrap-theme.min.css" type="text/css" rel="stylesheet" />

View File

@ -10,6 +10,7 @@
<link href="/bootstrap/css/bootstrap-theme.min.css" type="text/css" rel="stylesheet" />
<script src="/bootstrap/js/bootstrap.min.js" type="text/javascript" ></script>
<link rel="icon" href="/favicon.ico">
<style>
.resource .thumbnail { height: 150px; position: relative; }

View File

@ -0,0 +1,5 @@
class AddCreatedByToContract < ActiveRecord::Migration
def change
add_column :contracts, :created_by, :integer
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140303030220) do
ActiveRecord::Schema.define(:version => 20140411022819) do
create_table "cards", :force => true do |t|
t.string "card_number"
@ -42,6 +42,7 @@ ActiveRecord::Schema.define(:version => 20140303030220) do
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "cosigner"
t.integer "created_by"
end
create_table "door_logs", :force => true do |t|