Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
ready for MPSI access
Browse files Browse the repository at this point in the history
  • Loading branch information
canclini committed Jun 1, 2012
1 parent 1ac147c commit c61078b
Show file tree
Hide file tree
Showing 26 changed files with 628 additions and 248 deletions.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -37,3 +37,4 @@ gem 'jquery-rails'

# To use debugger
# gem 'debugger'
gem 'simple_form'
4 changes: 4 additions & 0 deletions Gemfile.lock
Expand Up @@ -91,6 +91,9 @@ GEM
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
simple_form (2.0.2)
actionpack (~> 3.0)
activemodel (~> 3.0)
sprockets (2.1.3)
hike (~> 1.2)
rack (~> 1.0)
Expand Down Expand Up @@ -121,6 +124,7 @@ DEPENDENCIES
jquery-rails
rails (= 3.2.5)
sass-rails (~> 3.2.3)
simple_form
sqlite3
twitter-bootstrap-rails
uglifier (>= 1.0.3)
1 change: 1 addition & 0 deletions app/assets/javascripts/application.js
Expand Up @@ -12,4 +12,5 @@
//
//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
//= require_tree .
4 changes: 4 additions & 0 deletions app/assets/javascripts/bootstrap.js.coffee
@@ -0,0 +1,4 @@
jQuery ->
$("a[rel=popover]").popover()
$(".tooltip").tooltip()
$("a[rel=tooltip]").tooltip()
3 changes: 3 additions & 0 deletions app/assets/javascripts/patients.js.coffee
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
29 changes: 29 additions & 0 deletions app/assets/stylesheets/bootstrap_and_overrides.css.less
@@ -0,0 +1,29 @@
@import "twitter/bootstrap/bootstrap";
body { padding-top: 60px; }

@import "twitter/bootstrap/responsive";

// Set the correct sprite paths
@iconSpritePath: asset-path('twitter/bootstrap/glyphicons-halflings.png');
@iconWhiteSpritePath: asset-path('twitter/bootstrap/glyphicons-halflings-white.png');

// Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines)
@fontAwesomeEotPath: asset-path('fontawesome-webfont.eot');
@fontAwesomeWoffPath: asset-path('fontawesome-webfont.woff');
@fontAwesomeTtfPath: asset-path('fontawesome-webfont.ttf');
@fontAwesomeSvgzPath: asset-path('fontawesome-webfont.svgz');
@fontAwesomeSvgPath: asset-path('fontawesome-webfont.svg');

// Font Awesome
@import "fontawesome";

// Your custom LESS stylesheets goes here
//
// Since bootstrap was imported above you have access to its mixins which
// you may use and inherit here
//
// If you'd like to override bootstrap's own variables, you can do so here as well
// See http://twitter.github.com/bootstrap/less.html for their names and documentation
//
// Example:
// @linkColor: #ff0000;
84 changes: 84 additions & 0 deletions app/controllers/patients_controller.rb
@@ -0,0 +1,84 @@

class PatientsController < ApplicationController
# GET /patients
# GET /patients.json
def index
@patients = Patient.all

respond_to do |format|
format.html # index.html.erb
format.json { render json: @patients }
end
end

# GET /patients/1
# GET /patients/1.json
def show
@patient = Patient.find(params[:id])

respond_to do |format|
format.html # show.html.erb
format.json { render json: @patient }
end
end

# GET /patients/new
# GET /patients/new.json
def new
@patient = Patient.new

respond_to do |format|
format.html # new.html.erb
format.json { render json: @patient }
end
end

# GET /patients/1/edit
def edit
@patient = Patient.find(params[:id])
end

# POST /patients
# POST /patients.json
def create
@patient = Patient.new(params[:patient])

respond_to do |format|
if @patient.save
format.html { redirect_to @patient, notice: 'Patient was successfully created.' }
format.json { render json: @patient, status: :created, location: @patient }
else
format.html { render action: "new" }
format.json { render json: @patient.errors, status: :unprocessable_entity }
end
end
end

# PUT /patients/1
# PUT /patients/1.json
def update
@patient = Patient.find(params[:id])

respond_to do |format|
if @patient.update_attributes(params[:patient])
format.html { redirect_to @patient, notice: 'Patient was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @patient.errors, status: :unprocessable_entity }
end
end
end

# DELETE /patients/1
# DELETE /patients/1.json
def destroy
@patient = Patient.find(params[:id])
@patient.destroy

respond_to do |format|
format.html { redirect_to patients_url }
format.json { head :no_content }
end
end
end
2 changes: 2 additions & 0 deletions app/helpers/patients_helper.rb
@@ -0,0 +1,2 @@
module PatientsHelper
end
5 changes: 5 additions & 0 deletions app/models/patient.rb
@@ -0,0 +1,5 @@
class Patient < ActiveRecord::Base
attr_accessible :birthdate, :city, :firstname, :gender, :insurance, :insurantnumber, :lastname, :mco, :plz, :street

validates_presence_of :lastname, :firstname, :birthdate, :gender
end
51 changes: 46 additions & 5 deletions app/views/layouts/application.html.erb
@@ -1,14 +1,55 @@
<!DOCTYPE html>
<html>
<head>
<title>Praxis</title>
<head>
<title>Praxis Software</title>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
<![endif]-->
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="#">BlueCare Praxis</a>
<div class="nav-collapse">
<ul class="nav">
<li><%= link_to "Patientenliste", patients_path %></li>
<li><%= link_to "Kalender" %></li>
<li><%= link_to "Info" %></li>
</ul>
<form class="navbar-search pull-right">
<input type="text" class="search-query" placeholder="Search">
</form>
</div>
</div>
</div>
</div>
<div class="container">
<% flash.each do |name, msg| %>
<div class="alert alert-<%= name == :notice ? "success" : "error" %>">
<a class="close" data-dismiss="alert">x</a>
<%= msg %>
</div>
<% end %>
<div class="row">
<div class="span9">
<%= yield %>
</div>
<div class="span3">
<h2>Information</h2>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
</div>
</div>

<%= yield %>

</body>
</body>
</html>
21 changes: 21 additions & 0 deletions app/views/patients/_form.html.erb
@@ -0,0 +1,21 @@
<%= simple_form_for @patient, :html => { :class => 'form-horizontal' } do |f| %>
<fieldset>
<legend><%= controller.action_name.capitalize %> Patient</legend>
<%= f.input :lastname %>
<%= f.input :firstname %>
<%= f.input :gender %>
<%= f.input :birthdate %>
<%= f.input :street %>
<%= f.input :city %>
<%= f.input :plz %>
<%= f.input :insurance %>
<%= f.input :insurantnumber %>
<%= f.input :mco %>

<div class="form-actions">
<%= f.submit nil, :class => 'btn btn-primary' %>
<%= link_to t('.cancel', :default => t("helpers.links.cancel")),
patients_path, :class => 'btn' %>
</div>
</fieldset>
<% end %>
6 changes: 6 additions & 0 deletions app/views/patients/edit.html.erb
@@ -0,0 +1,6 @@
<%- model_class = @patient.class -%>
<div class="page-header">
<h1><%=t '.title', :default => t('helpers.titles.edit', :model => model_class.model_name.human,
:default => "Edit #{model_class.model_name.human}") %></h1>
</div>
<%= render :partial => 'form' %>
38 changes: 38 additions & 0 deletions app/views/patients/index.html.erb
@@ -0,0 +1,38 @@
<%- model_class = Patient.new.class -%>
<div class="page-header">
<h1><%=t '.title', :default => model_class.model_name.human.pluralize %></h1>
</div>
<table class="table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Vorname</th>
<th>Geburtsdatum</th>
<th>Hausarztmodell</th>
<th><%=t '.actions', :default => t("helpers.actions") %></th>
</tr>
</thead>
<tbody>
<% @patients.each do |patient| %>
<tr>
<td><%= link_to patient.lastname, patient_path(patient) %></td>
<td><%= patient.firstname %></td>
<td><%= patient.birthdate %></td>
<td>Nein/Ja/prüfen</td>
<td>
<%= link_to t('.edit', :default => t("helpers.links.edit")),
edit_patient_path(patient), :class => 'btn btn-mini' %>
<%= link_to t('.destroy', :default => t("helpers.links.destroy")),
patient_path(patient),
:method => :delete,
:confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')),
:class => 'btn btn-mini btn-danger' %>
</td>
</tr>
<% end %>
</tbody>
</table>

<%= link_to t('.new', :default => t("helpers.links.new")),
new_patient_path,
:class => 'btn btn-primary' %>
6 changes: 6 additions & 0 deletions app/views/patients/new.html.erb
@@ -0,0 +1,6 @@
<%- model_class = @patient.class -%>
<div class="page-header">
<h1><%=t '.title', :default => t('helpers.titles.new', :model => model_class.model_name.human,
:default => "New #{model_class.model_name.human}") %></h1>
</div>
<%= render :partial => 'form' %>
39 changes: 39 additions & 0 deletions app/views/patients/show.html.erb
@@ -0,0 +1,39 @@
<%- model_class = @patient.class -%>
<div class="page-header">
<h1><%=t '.title', :default => model_class.model_name.human %></h1>
</div>

<dl class="dl-horizontal">
<dt><strong><%= model_class.human_attribute_name(:firstname) %>:</strong></dt>
<dd><%= @patient.firstname %></dd>
<dt><strong><%= model_class.human_attribute_name(:lastname) %>:</strong></dt>
<dd><%= @patient.lastname %></dd>
<dt><strong><%= model_class.human_attribute_name(:gender) %>:</strong></dt>
<dd><%= @patient.gender %></dd>
<dt><strong><%= model_class.human_attribute_name(:birthdate) %>:</strong></dt>
<dd><%= @patient.birthdate %></dd>
<dt><strong><%= model_class.human_attribute_name(:street) %>:</strong></dt>
<dd><%= @patient.street %></dd>
<dt><strong><%= model_class.human_attribute_name(:city) %>:</strong></dt>
<dd><%= @patient.city %></dd>
<dt><strong><%= model_class.human_attribute_name(:plz) %>:</strong></dt>
<dd><%= @patient.plz %></dd>
<dt><strong><%= model_class.human_attribute_name(:insurance) %>:</strong></dt>
<dd><%= @patient.insurance %></dd>
<dt><strong><%= model_class.human_attribute_name(:insurantnumber) %>:</strong></dt>
<dd><%= @patient.insurantnumber %></dd>
<dt><strong><%= model_class.human_attribute_name(:mco) %>:</strong></dt>
<dd><%= @patient.mco %></dd>
</dl>

<div class="form-actions">
<%= link_to t('.back', :default => t("helpers.links.back")),
patients_path, :class => 'btn' %>
<%= link_to t('.edit', :default => t("helpers.links.edit")),
edit_patient_path(@patient), :class => 'btn' %>
<%= link_to t('.destroy', :default => t("helpers.links.destroy")),
patient_path(@patient),
:method => 'delete',
:confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')),
:class => 'btn btn-danger' %>
</div>

0 comments on commit c61078b

Please sign in to comment.