Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
multiscan committed Jan 22, 2013
1 parent 7536f6d commit 6ef57f0
Show file tree
Hide file tree
Showing 88 changed files with 1,392 additions and 47 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,6 @@ gem 'thin'
# To use debugger
# gem 'debugger'

gem 'memoist'
gem 'will_paginate', '~> 3.0'

4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ GEM
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
memoist (0.2.0)
mime-types (1.19)
multi_json (1.5.0)
nokogiri (1.5.5)
Expand Down Expand Up @@ -192,6 +193,7 @@ GEM
warden (1.2.1)
rack (>= 1.0)
websocket (1.0.4)
will_paginate (3.0.4)
xpath (1.0.0)
nokogiri (~> 1.3)

Expand All @@ -214,6 +216,7 @@ DEPENDENCIES
haml-rails
jquery-rails
launchy (>= 2.1.2)
memoist
quiet_assets (>= 1.0.1)
rails (= 3.2.9)
rolify (>= 3.2.0)
Expand All @@ -223,3 +226,4 @@ DEPENDENCIES
sqlite3
thin
uglifier (>= 1.0.3)
will_paginate (~> 3.0)
72 changes: 72 additions & 0 deletions NOTES
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
Namespaces:

There's no real "Rails way" for admin interfaces, actually - you can find every possible solution in a number of applications. DHH has implied that he prefers namespaces (with HTTP Basic authentication), but that has remained a simple implication and not one of the official Rails Opinions.

That said, I've found good success with that approach lately (namespacing + HTTP Basic). It looks like this:

routes.rb:

map.namespace :admin do |admin|
admin.resources :users
admin.resources :posts
end
admin/users_controller.rb:

class Admin::UsersController < ApplicationController
before_filter :admin_required
# ...
end
application.rb

class ApplicationController < ActionController::Base
# ...

protected
def admin_required
authenticate_or_request_with_http_basic do |user_name, password|
user_name == 'admin' && password == 's3cr3t'
end if RAILS_ENV == 'production' || params[:admin_http]
end
end




Generations
always appended
rails generate ... --no-controller-specs --no-view-specs --no-helper-specs --skip-stylesheets --skip-javascripts --skip-helpers
resource lab
name:string nick:string
resource location
name:string
resource publisher
name:string
resource book
title:string author:string editor:string call1:string
call2:string call3:string call4:string collation:string
isbn:string edition:string publisher:reference collection:string
language:string abstract:text toc:text idx:text notes:text
publication_year:integer price:float currency:string
resource item
lab:reference room:reference user:reference inv:integer
status:string price:float currency:string inventoriable:reference
inventoriable_type:string
resource borrowing
user:reference item:reference return_date:date



Library of Congress Query
--------------------------
http://www.loc.gov/standards/sru/specs/search-retrieve.html
http://www.loc.gov/standards/sru/resources/schemas.html

exemple:
http://z3950.loc.gov:7090/voyager?version=1.1&operation=searchRetrieve&query=bath.isbn%3D<ISBN>&maximumRecords=1&recordSchema=mods



a scuola ai buoni un premio, ai cattivi la punizione
ma in seguito nella vita è meno chiara la divisione
Giorgio Gaber

2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

require File.expand_path('../config/application', __FILE__)

Psychopad::Application.load_tasks
Thot::Application.load_tasks
57 changes: 57 additions & 0 deletions app/assets/images/thot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/thot_200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/thot_36l.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/thot_36r.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 48 additions & 1 deletion app/assets/stylesheets/application.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,57 @@
*/
@import "bootstrap_and_overrides";

.content {
.content {
background-color: #eee;
padding: 20px;
margin: 0 -20px; /* negative indent the amount of the padding to maintain the grid system */
@include border-radius(0 0 6px 6px);
@include box-shadow(0 1px 2px rgba(0,0,0,0.15));
}

.booklist {
li {
margin-bottom: 1em;
padding: 1em;
position: relative;
.title {
width: 100%;
font-size: 130%;
}
.author {
width: 100%;
}
.editor {
width: 100%
}
.publisher {
width: 50%;
}
}
}

/*
.logo {
background-image: url(image_path("thot_36r.png")), url(image_path("thot_36l.png"));
background-repeat: no-repeat;
background-position: left center, right center;
// background: url(image_path("thot_36r.png")) no-repeat left center;
padding-left: 40px;
padding-right: 40px;
height: 40px;
}
*/
.navbar {
.logo {
background-image: url(image_path("thot_36r.png")), url(image_path("thot_36l.png"));
background-repeat: no-repeat;
background-position: left center, right center;
padding: 0 50px;
}
}

span.spacer {
display: inline;
padding-left: 3em;
}

83 changes: 83 additions & 0 deletions app/controllers/books_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
class BooksController < ApplicationController
# GET /books
# GET /books.json
def index
@books = Book.all

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

# GET /books/1
# GET /books/1.json
def show
@book = Book.find(params[:id])

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

# GET /books/new
# GET /books/new.json
def new
@book = Book.new

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

# GET /books/1/edit
def edit
@book = Book.find(params[:id])
end

# POST /books
# POST /books.json
def create
@book = Book.new(params[:book])

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

# PUT /books/1
# PUT /books/1.json
def update
@book = Book.find(params[:id])

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

# DELETE /books/1
# DELETE /books/1.json
def destroy
@book = Book.find(params[:id])
@book.destroy

respond_to do |format|
format.html { redirect_to books_url }
format.json { head :no_content }
end
end
end
2 changes: 2 additions & 0 deletions app/controllers/borrowings_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class BorrowingsController < ApplicationController
end
3 changes: 3 additions & 0 deletions app/controllers/db_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class DbController < ApplicationController

end
20 changes: 20 additions & 0 deletions app/controllers/deg_isbns_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
class DegIsbnsController < ApplicationController
def index
@degisbns=DegIsbn.order("count DESC").paginate(:page=>params[:page], :per_page=>50)
end

# GET /isbn_dedup/1
def show
@isbn=DegIsbn.find(params["id"])
@books=@isbn.books
end

# GET /isbn_dedup/1/edit
def edit
@isbn=DegIsbn.find(params["id"])
@books=@isbn.books
end

def update
end
end
13 changes: 13 additions & 0 deletions app/controllers/isbn_dedup_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class IsbnDedupController < ApplicationController

def index
@degisbns=DegIsbn.order("count ASC")
end

# GET /isbn_dedup/1
def edit
end

def update
end
end
2 changes: 2 additions & 0 deletions app/controllers/items_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class ItemsController < ApplicationController
end
2 changes: 2 additions & 0 deletions app/controllers/labs_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class LabsController < ApplicationController
end
2 changes: 2 additions & 0 deletions app/controllers/locations_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class LocationsController < ApplicationController
end
2 changes: 2 additions & 0 deletions app/controllers/publishers_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class PublishersController < ApplicationController
end
12 changes: 12 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
module ApplicationHelper
def long_text(t)
t.gsub("\n", "<br/>").gsub("\t", "<span class='spacer'>&nbsp;</span>").html_safe;
end

# def item_status(item)
# item.user? ?
# case item.user.name
# when "Missing "
# "missing"
# when "mistery"
# "mistery"
# end
end
2 changes: 2 additions & 0 deletions app/helpers/books_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module BooksHelper
end
2 changes: 2 additions & 0 deletions app/helpers/borrowings_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module BorrowingsHelper
end
2 changes: 2 additions & 0 deletions app/helpers/db_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module DbHelper
end
2 changes: 2 additions & 0 deletions app/helpers/deg_isbns_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module DegIsbnsHelper
end
2 changes: 2 additions & 0 deletions app/helpers/isbn_dedup_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module IsbnDedupHelper
end
Loading

0 comments on commit 6ef57f0

Please sign in to comment.