Grosse MàJ

This commit is contained in:
olivier
2008-11-25 22:11:16 +01:00
parent 53195fdfcd
commit 3e719157ea
2980 changed files with 343846 additions and 0 deletions

View File

@ -0,0 +1,79 @@
class AddressesController < ApplicationController
# GET /addresses
# GET /addresses.xml
def index
@addresses = Address.find(:all)
respond_to do |format|
format.html # index.rhtml
format.xml { render :xml => @addresses.to_xml }
end
end
# GET /addresses/1
# GET /addresses/1.xml
def show
@address = Address.find(params[:id])
respond_to do |format|
format.html # show.rhtml
format.xml { render :xml => @address.to_xml }
end
end
# GET /addresses/new
def new
@address = Address.new
end
# GET /addresses/1;edit
def edit
@address = Address.find(params[:id])
end
# POST /addresses
# POST /addresses.xml
def create
@address = Address.new(params[:address])
respond_to do |format|
if @address.save
flash[:notice] = 'Address was successfully created.'
format.html { redirect_to address_url(@address) }
format.xml { head :created, :location => address_url(@address) }
else
format.html { render :action => "new" }
format.xml { render :xml => @address.errors.to_xml }
end
end
end
# PUT /addresses/1
# PUT /addresses/1.xml
def update
@address = Address.find(params[:id])
respond_to do |format|
if @address.update_attributes(params[:address])
flash[:notice] = 'Address was successfully updated.'
format.html { redirect_to address_url(@address) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @address.errors.to_xml }
end
end
end
# DELETE /addresses/1
# DELETE /addresses/1.xml
def destroy
@address = Address.find(params[:id])
@address.destroy
respond_to do |format|
format.html { redirect_to addresses_url }
format.xml { head :ok }
end
end
end

View File

@ -0,0 +1,3 @@
class Admin::AdminController < ApplicationController
before_filter :login_required
end

View File

@ -0,0 +1,80 @@
#class CustomersController < ApplicationController
class Admin::CustomersController < Admin::AdminController
# GET /customers
# GET /customers.xml
def index
@customers = Customer.find(:all)
respond_to do |format|
format.html # index.rhtml
format.xml { render :xml => @customers.to_xml }
end
end
# GET /customers/1
# GET /customers/1.xml
def show
@customer = Customer.find(params[:id])
respond_to do |format|
format.html # show.rhtml
format.xml { render :xml => @customer.to_xml }
end
end
# GET /customers/new
def new
@customer = Customer.new
end
# GET /customers/1;edit
def edit
@customer = Customer.find(params[:id])
end
# POST /customers
# POST /customers.xml
def create
@customer = Customer.new(params[:customer])
respond_to do |format|
if @customer.save
flash[:notice] = 'Customer was successfully created.'
format.html { redirect_to customer_url(@customer) }
format.xml { head :created, :location => customer_url(@customer) }
else
format.html { render :action => "new" }
format.xml { render :xml => @customer.errors.to_xml }
end
end
end
# PUT /customers/1
# PUT /customers/1.xml
def update
@customer = Customer.find(params[:id])
respond_to do |format|
if @customer.update_attributes(params[:customer])
flash[:notice] = 'Customer was successfully updated.'
format.html { redirect_to customer_url(@customer) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @customer.errors.to_xml }
end
end
end
# DELETE /customers/1
# DELETE /customers/1.xml
def destroy
@customer = Customer.find(params[:id])
@customer.destroy
respond_to do |format|
format.html { redirect_to customers_url }
format.xml { head :ok }
end
end
end

View File

@ -0,0 +1,92 @@
# ajout de la biblioth<74>que PP
require "pp"
#class ProductsController < ApplicationController
class Admin::ProductsController < Admin::AdminController
in_place_edit_for :product, :designation
# GET /products
# GET /products.xml
def index
@products = Product.find(:all)
respond_to do |format|
format.html # index.rhtml
format.xml { render :xml => @products.to_xml }
end
end
# GET /products/1
# GET /products/1.xml
def show
@product = Product.find(params[:id])
respond_to do |format|
format.html # show.rhtml
format.xml { render :xml => @product.to_xml }
end
end
# GET /products/new
def new
@product = Product.new
end
# GET /products/1;edit
def edit
@product = Product.find(params[:id])
end
# POST /products
# POST /products.xml
def create
@product = Product.new(params[:product])
@product.type = params[:type] if params[:type]
respond_to do |format|
if @product.save
flash[:notice] = 'Le produit a &#233;t&#233; cr&#233;e avec succ&#232;s.'
format.html { redirect_to product_url(@product) }
format.xml { head :created, :location => product_url(@product) }
else #si erreur alors
format.html { render :action => "new" }
format.xml { render :xml => @product.errors.to_xml }
pp(@product)
end
end
end
# PUT /products/1
# PUT /products/1.xml
def update
@product = Product.find(params[:id])
@product.type = params[:type] if params[:type]
respond_to do |format|
if @product.update_attributes(params[:product])
flash[:notice] = 'Le produit a &#233;t&#233; mis &#224; jour avec succ&#232;s.'
format.html { redirect_to product_url(@product) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @product.errors.to_xml }
end
end
end
# DELETE /products/1
# DELETE /products/1.xml
def destroy
@product = Product.find(params[:id])
@product.destroy
respond_to do |format|
format.html { redirect_to products_url }
format.xml { head :ok }
end
end
end

View File

@ -0,0 +1,92 @@
# ajout de la biblioth<74>que PP
require "pp"
#class ProductsController < ApplicationController
class Admin::ProductsController < Admin::AdminController
in_place_edit_for :product, :designation
# GET /products
# GET /products.xml
def index
@products = Product.find(:all)
respond_to do |format|
format.html # index.rhtml
format.xml { render :xml => @products.to_xml }
end
end
# GET /products/1
# GET /products/1.xml
def show
@product = Product.find(params[:id])
respond_to do |format|
format.html # show.rhtml
format.xml { render :xml => @product.to_xml }
end
end
# GET /products/new
def new
@product = Product.new
end
# GET /products/1;edit
def edit
@product = Product.find(params[:id])
end
# POST /products
# POST /products.xml
def create
@product = Product.new(params[:product])
@product.type = params[:type] if params[:type]
respond_to do |format|
if @product.save
flash[:notice] = 'Le produit a &#233;t&#233; cr&#233;e avec succ&#232;s.'
format.html { redirect_to product_url(@product) }
format.xml { head :created, :location => product_url(@product) }
else #si erreur alors
format.html { render :action => "new" }
format.xml { render :xml => @product.errors.to_xml }
pp(@product)
end
end
end
# PUT /products/1
# PUT /products/1.xml
def update
@product = Product.find(params[:id])
@product.type = params[:type] if params[:type]
respond_to do |format|
if @product.update_attributes(params[:product])
flash[:notice] = 'Le produit a &#233;t&#233; mis &#224; jour avec succ&#232;s.'
format.html { redirect_to product_url(@product) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @product.errors.to_xml }
end
end
end
# DELETE /products/1
# DELETE /products/1.xml
def destroy
@product = Product.find(params[:id])
@product.destroy
respond_to do |format|
format.html { redirect_to products_url }
format.xml { head :ok }
end
end
end

View File

@ -0,0 +1,80 @@
#class SuppliersController < ApplicationController
class Admin::SuppliersController < Admin::AdminController
# GET /suppliers
# GET /suppliers.xml
def index
@suppliers = Supplier.find(:all)
respond_to do |format|
format.html # index.rhtml
format.xml { render :xml => @suppliers.to_xml }
end
end
# GET /suppliers/1
# GET /suppliers/1.xml
def show
@supplier = Supplier.find(params[:id])
respond_to do |format|
format.html # show.rhtml
format.xml { render :xml => @supplier.to_xml }
end
end
# GET /suppliers/new
def new
@supplier = Supplier.new
end
# GET /suppliers/1;edit
def edit
@supplier = Supplier.find(params[:id])
end
# POST /suppliers
# POST /suppliers.xml
def create
@supplier = Supplier.new(params[:supplier])
respond_to do |format|
if @supplier.save
flash[:notice] = 'Supplier was successfully created.'
format.html { redirect_to supplier_url(@supplier) }
format.xml { head :created, :location => supplier_url(@supplier) }
else
format.html { render :action => "new" }
format.xml { render :xml => @supplier.errors.to_xml }
end
end
end
# PUT /suppliers/1
# PUT /suppliers/1.xml
def update
@supplier = Supplier.find(params[:id])
respond_to do |format|
if @supplier.update_attributes(params[:supplier])
flash[:notice] = 'Supplier was successfully updated.'
format.html { redirect_to supplier_url(@supplier) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @supplier.errors.to_xml }
end
end
end
# DELETE /suppliers/1
# DELETE /suppliers/1.xml
def destroy
@supplier = Supplier.find(params[:id])
@supplier.destroy
respond_to do |format|
format.html { redirect_to suppliers_url }
format.xml { head :ok }
end
end
end

View File

@ -0,0 +1,9 @@
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
# Be sure to include AuthenticationSystem in Application Controller instead
include AuthenticatedSystem
# Pick a unique cookie name to distinguish our session data from others'
session :session_key => '_mon_projet_session_id'
end

View File

@ -0,0 +1,22 @@
class ProductsController < ApplicationController
def index
#@products = Product.find(:all)
@products = Product.paginate :page => params[:page], :per_page => 3
respond_to do |format|
format.html # index.rhtml
format.xml { render :xml => @products.to_xml }
end
end
def show
@product = Product.find(params[:id])
respond_to do |format|
format.html # show.rhtml
format.xml { render :xml => @product.to_xml }
end
end
end

View File

@ -0,0 +1,22 @@
class ProductsController < ApplicationController
def index
#@products = Product.find(:all)
@posts = Product.paginate :page => params[:page], :per_page => 3
respond_to do |format|
format.html # index.rhtml
format.xml { render :xml => @products.to_xml }
end
end
def show
@product = Product.find(params[:id])
respond_to do |format|
format.html # show.rhtml
format.xml { render :xml => @product.to_xml }
end
end
end

View File

@ -0,0 +1,31 @@
# This controller handles the login/logout function of the site.
class SessionsController < ApplicationController
# Be sure to include AuthenticationSystem in Application Controller instead
include AuthenticatedSystem
# render new.rhtml
def new
end
def create
self.current_utilisateur = Utilisateur.authenticate(params[:login], params[:password])
if logged_in?
if params[:remember_me] == "1"
self.current_utilisateur.remember_me
cookies[:auth_token] = { :value => self.current_utilisateur.remember_token , :expires => self.current_utilisateur.remember_token_expires_at }
end
redirect_back_or_default('/')
flash[:notice] = "Logged in successfully"
else
render :action => 'new'
end
end
def destroy
self.current_utilisateur.forget_me if logged_in?
cookies.delete :auth_token
reset_session
flash[:notice] = "You have been logged out."
redirect_back_or_default('/')
end
end

View File

@ -0,0 +1,28 @@
class UtilisateursController < ApplicationController
# render new.rhtml
def new
end
def create
cookies.delete :auth_token
reset_session
@utilisateur = Utilisateur.new(params[:utilisateur])
@utilisateur.save!
self.current_utilisateur = @utilisateur
redirect_back_or_default('/')
flash[:notice] = "Thanks for signing up!"
rescue ActiveRecord::RecordInvalid
render :action => 'new'
end
def activate
self.current_utilisateur = params[:activation_code].blank? ? :false : Utilisateur.find_by_activation_code(params[:activation_code])
if logged_in? && !current_utilisateur.activated?
current_utilisateur.activate
flash[:notice] = "Signup complete!"
end
redirect_back_or_default('/')
end
end

View File

@ -0,0 +1,2 @@
module AddressesHelper
end

View File

@ -0,0 +1,2 @@
module Admin::AdminHelper
end

View File

@ -0,0 +1,3 @@
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
end

View File

@ -0,0 +1,2 @@
module CustomersHelper
end

View File

@ -0,0 +1,2 @@
module ProductsHelper
end

View File

@ -0,0 +1,2 @@
module SessionsHelper
end

View File

@ -0,0 +1,2 @@
module SuppliersHelper
end

View File

@ -0,0 +1,2 @@
module UtilisateursHelper
end

View File

@ -0,0 +1,2 @@
class Address < ActiveRecord::Base
end

View File

@ -0,0 +1,3 @@
class Customer < ActiveRecord::Base
has_many :products
end

View File

@ -0,0 +1,5 @@
class Product < ActiveRecord::Base
belongs_to :supplier
belongs_to :customer
validates_presence_of :designation, :message => "ne peut être vide."
end

View File

@ -0,0 +1,5 @@
class Product < ActiveRecord::Base
belongs_to :supplier
belongs_to :customer
validates_presence_of :designation, :message => "ne peut être vide."
end

View File

@ -0,0 +1,3 @@
class Supplier < ActiveRecord::Base
has_many :products
end

View File

@ -0,0 +1,98 @@
require 'digest/sha1'
class Utilisateur < ActiveRecord::Base
# Virtual attribute for the unencrypted password
attr_accessor :password
validates_presence_of :login, :email
validates_presence_of :password, :if => :password_required?
validates_presence_of :password_confirmation, :if => :password_required?
validates_length_of :password, :within => 4..40, :if => :password_required?
validates_confirmation_of :password, :if => :password_required?
validates_length_of :login, :within => 3..40
validates_length_of :email, :within => 3..100
validates_uniqueness_of :login, :email, :case_sensitive => false
before_save :encrypt_password
before_create :make_activation_code
# prevents a user from submitting a crafted form that bypasses activation
# anything else you want your user to change should be added here.
attr_accessible :login, :email, :password, :password_confirmation
# Activates the user in the database.
def activate
@activated = true
self.activated_at = Time.now.utc
self.activation_code = nil
save(false)
end
def activated?
# the existence of an activation code means they have not activated yet
activation_code.nil?
end
# Returns true if the user has just been activated.
def recently_activated?
@activated
end
# Authenticates a user by their login name and unencrypted password. Returns the user or nil.
def self.authenticate(login, password)
u = find :first, :conditions => ['login = ? and activated_at IS NOT NULL', login] # need to get the salt
u && u.authenticated?(password) ? u : nil
end
# Encrypts some data with the salt.
def self.encrypt(password, salt)
Digest::SHA1.hexdigest("--#{salt}--#{password}--")
end
# Encrypts the password with the user salt
def encrypt(password)
self.class.encrypt(password, salt)
end
def authenticated?(password)
crypted_password == encrypt(password)
end
def remember_token?
remember_token_expires_at && Time.now.utc < remember_token_expires_at
end
# These create and unset the fields required for remembering users between browser closes
def remember_me
remember_me_for 2.weeks
end
def remember_me_for(time)
remember_me_until time.from_now.utc
end
def remember_me_until(time)
self.remember_token_expires_at = time
self.remember_token = encrypt("#{email}--#{remember_token_expires_at}")
save(false)
end
def forget_me
self.remember_token_expires_at = nil
self.remember_token = nil
save(false)
end
protected
# before filter
def encrypt_password
return if password.blank?
self.salt = Digest::SHA1.hexdigest("--#{Time.now.to_s}--#{login}--") if new_record?
self.crypted_password = encrypt(password)
end
def password_required?
crypted_password.blank? || !password.blank?
end
def make_activation_code
self.activation_code = Digest::SHA1.hexdigest( Time.now.to_s.split(//).sort_by {rand}.join )
end
end

View File

@ -0,0 +1,24 @@
class UtilisateurMailer < ActionMailer::Base
def signup_notification(utilisateur)
setup_email(utilisateur)
@subject += 'Please activate your new account'
@body[:url] = "http://YOURSITE/activate/#{utilisateur.activation_code}"
end
def activation(utilisateur)
setup_email(utilisateur)
@subject += 'Your account has been activated!'
@body[:url] = "http://YOURSITE/"
end
protected
def setup_email(utilisateur)
@recipients = "#{utilisateur.email}"
@from = "ADMINEMAIL"
@subject = "[YOURSITE] "
@sent_on = Time.now
@body[:utilisateur] = utilisateur
end
end

View File

@ -0,0 +1,11 @@
class UtilisateurObserver < ActiveRecord::Observer
def after_create(utilisateur)
UtilisateurMailer.deliver_signup_notification(utilisateur)
end
def after_save(utilisateur)
UtilisateurMailer.deliver_activation(utilisateur) if utilisateur.recently_activated?
end
end

View File

@ -0,0 +1,2 @@
class Velo < Product
end

View File

@ -0,0 +1,2 @@
class Voiture < Product
end

View File

@ -0,0 +1,32 @@
<h1>Editing address</h1>
<%= error_messages_for :address %>
<% form_for(:address, :url => address_path(@address), :html => { :method => :put }) do |f| %>
<p>
<b>Street</b><br />
<%= f.text_area :street %>
</p>
<p>
<b>Postal code</b><br />
<%= f.text_field :postal_code %>
</p>
<p>
<b>City</b><br />
<%= f.text_field :city %>
</p>
<p>
<b>Country</b><br />
<%= f.text_field :country %>
</p>
<p>
<%= submit_tag "Update" %>
</p>
<% end %>
<%= link_to 'Show', address_path(@address) %> |
<%= link_to 'Back', addresses_path %>

View File

@ -0,0 +1,26 @@
<h1>Listing addresses</h1>
<table>
<tr>
<th>Street</th>
<th>Postal code</th>
<th>City</th>
<th>Country</th>
</tr>
<% for address in @addresses %>
<tr>
<td><%=h address.street %></td>
<td><%=h address.postal_code %></td>
<td><%=h address.city %></td>
<td><%=h address.country %></td>
<td><%= link_to 'Show', address_path(address) %></td>
<td><%= link_to 'Edit', edit_address_path(address) %></td>
<td><%= link_to 'Destroy', address_path(address), :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New address', new_address_path %>

View File

@ -0,0 +1,31 @@
<h1>New address</h1>
<%= error_messages_for :address %>
<% form_for(:address, :url => addresses_path) do |f| %>
<p>
<b>Street</b><br />
<%= f.text_area :street %>
</p>
<p>
<b>Postal code</b><br />
<%= f.text_field :postal_code %>
</p>
<p>
<b>City</b><br />
<%= f.text_field :city %>
</p>
<p>
<b>Country</b><br />
<%= f.text_field :country %>
</p>
<p>
<%= submit_tag "Create" %>
</p>
<% end %>
<%= link_to 'Back', addresses_path %>

View File

@ -0,0 +1,23 @@
<p>
<b>Street:</b>
<%=h @address.street %>
</p>
<p>
<b>Postal code:</b>
<%=h @address.postal_code %>
</p>
<p>
<b>City:</b>
<%=h @address.city %>
</p>
<p>
<b>Country:</b>
<%=h @address.country %>
</p>
<%= link_to 'Edit', edit_address_path(@address) %> |
<%= link_to 'Back', addresses_path %>

View File

@ -0,0 +1,22 @@
<h1>Editing customer</h1>
<%= error_messages_for :customer %>
<% form_for(:customer, :url => customer_path(@customer), :html => { :method => :put }) do |f| %>
<p>
<b>Firstname</b><br />
<%= f.text_field :firstname %>
</p>
<p>
<b>Name</b><br />
<%= f.text_field :name %>
</p>
<p>
<%= submit_tag "Update" %>
</p>
<% end %>
<%= link_to 'Show', customer_path(@customer) %> |
<%= link_to 'Back', customers_path %>

View File

@ -0,0 +1,22 @@
<h1>Listing customers</h1>
<table>
<tr>
<th>Firstname</th>
<th>Name</th>
</tr>
<% for customer in @customers %>
<tr>
<td><%=h customer.firstname %></td>
<td><%=h customer.name %></td>
<td><%= link_to 'Show', customer_path(customer) %></td>
<td><%= link_to 'Edit', edit_customer_path(customer) %></td>
<td><%= link_to 'Destroy', customer_path(customer), :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New customer', new_customer_path %>

View File

@ -0,0 +1,21 @@
<h1>New customer</h1>
<%= error_messages_for :customer %>
<% form_for(:customer, :url => customers_path) do |f| %>
<p>
<b>Firstname</b><br />
<%= f.text_field :firstname %>
</p>
<p>
<b>Name</b><br />
<%= f.text_field :name %>
</p>
<p>
<%= submit_tag "Create" %>
</p>
<% end %>
<%= link_to 'Back', customers_path %>

View File

@ -0,0 +1,13 @@
<p>
<b>Firstname:</b>
<%=h @customer.firstname %>
</p>
<p>
<b>Name:</b>
<%=h @customer.name %>
</p>
<%= link_to 'Edit', edit_customer_path(@customer) %> |
<%= link_to 'Back', customers_path %>

View File

@ -0,0 +1,29 @@
<p>
<b>Designation</b><br />
<%= f.text_field :designation %>
</p>
<p>
<b>Description</b><br />
<%= f.text_area :description %>
</p>
<p>
<b>Crée le</b><br />
<%= f.datetime_select :created_at %>
</p>
<p>
<b>Mis à jour le</b><br />
<%= f.datetime_select :updated_at %>
</p>
<p>
<b>Fournisseur</b><br />
<%= f.select("supplier_id", Supplier.find(:all).collect {|p| [ p.code, p.id ] }, { :include_blank => true }) %>
</p>
<p>
<b>Type de produit</b><br />
<%= select_tag "type", options_for_select([["Voiture", "Voiture"], ["Vélo", "Velo"]]) %>
</p>

View File

@ -0,0 +1,15 @@
<h1>Edition d'un produit</h1>
<%= error_messages_for :product %>
<% form_for(:product, :url => admin_product_path(@product), :html => { :method => :put }) do |f| %>
<%= render :partial => "form", :locals => { :f => f } %>
<p>
<%= submit_tag "Mise à jour" %>
</p>
<% end %>
<%= link_to 'Voir', admin_product_path(@product) %> |
<%= link_to 'Retour', admin_products_path %>

View File

@ -0,0 +1,34 @@
<h1>Liste des produits</h1>
<table>
<tr>
<th>Désignation</th>
<th>Description</th>
<th>Crée le</th>
<th>Mis à jour le</th>
<th>Fournisseur</th>
<th>Type</th>
</tr>
<% for product in @products %>
<tr>
<td><%=h product.designation %></td>
<td><%=h product.description %></td>
<td><%=h product.created_at.strftime("le %d/%m/%Y") %></td>
<td><%=h product.updated_at.strftime("%d/%m/%Y") %></td>
<td><%= link_to product.supplier_id, supplier_path(product.supplier_id) %></td>
<td><%=h product.type%></td>
<td><%= link_to 'Voir', admin_product_path(product) %></td>
<td><%= link_to 'Editer', edit_admin_product_path(product) %></td>
<td><%= link_to 'Supprimer', admin_product_path(product), :confirm => 'Etes vous sûr ?', :method => :delete %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'Nouveau produit', new_admin_product_path %>
<br />
<p><b>Utilisateur connecté : </b><%= current_utilisateur.login if current_utilisateur %>
</p>

View File

@ -0,0 +1,13 @@
<h1>Nouvel élément</h1>
<%= error_messages_for :product %>
<% form_for(:product, :url => admin_products_path) do |f| %>
<%= render :partial => "form", :locals => { :f => f} %>
<p>
<%= submit_tag "Créer" %>
</p>
<% end %>
<%= link_to 'Retour', admin_products_path %>

View File

@ -0,0 +1,23 @@
<p>
<b>Désignation:</b>
<%=h @product.designation %>
</p>
<p>
<b>Description:</b>
<%=h @product.description %>
</p>
<p>
<b>Crée le:</b>
<%=h @product.created_at %>
</p>
<p>
<b>Mis à jour le :</b>
<%=h @product.updated_at %>
</p>
<%= link_to 'Editer', admin_edit_product_path(@product) %> |
<%= link_to 'Retour', admin_products_path %>

View File

@ -0,0 +1,37 @@
<h1>Editing supplier</h1>
<%= error_messages_for :supplier %>
<% form_for(:supplier, :url => supplier_path(@supplier), :html => { :method => :put }) do |f| %>
<p>
<b>Name</b><br />
<%= f.text_field :name %>
</p>
<p>
<b>Description</b><br />
<%= f.text_area :description %>
</p>
<p>
<b>Code</b><br />
<%= f.text_field :code %>
</p>
<p>
<b>Created at</b><br />
<%= f.datetime_select :created_at %>
</p>
<p>
<b>Updated at</b><br />
<%= f.datetime_select :updated_at %>
</p>
<p>
<%= submit_tag "Update" %>
</p>
<% end %>
<%= link_to 'Show', supplier_path(@supplier) %> |
<%= link_to 'Back', suppliers_path %>

View File

@ -0,0 +1,28 @@
<h1>Listing suppliers</h1>
<table>
<tr>
<th>Name</th>
<th>Description</th>
<th>Code</th>
<th>Created at</th>
<th>Updated at</th>
</tr>
<% for supplier in @suppliers %>
<tr>
<td><%=h supplier.name %></td>
<td><%=h supplier.description %></td>
<td><%=h supplier.code %></td>
<td><%=h supplier.created_at %></td>
<td><%=h supplier.updated_at %></td>
<td><%= link_to 'Show', supplier_path(supplier) %></td>
<td><%= link_to 'Edit', edit_supplier_path(supplier) %></td>
<td><%= link_to 'Destroy', supplier_path(supplier), :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New supplier', new_supplier_path %>

View File

@ -0,0 +1,36 @@
<h1>New supplier</h1>
<%= error_messages_for :supplier %>
<% form_for(:supplier, :url => suppliers_path) do |f| %>
<p>
<b>Name</b><br />
<%= f.text_field :name %>
</p>
<p>
<b>Description</b><br />
<%= f.text_area :description %>
</p>
<p>
<b>Code</b><br />
<%= f.text_field :code %>
</p>
<p>
<b>Created at</b><br />
<%= f.datetime_select :created_at %>
</p>
<p>
<b>Updated at</b><br />
<%= f.datetime_select :updated_at %>
</p>
<p>
<%= submit_tag "Create" %>
</p>
<% end %>
<%= link_to 'Back', suppliers_path %>

View File

@ -0,0 +1,28 @@
<p>
<b>Name:</b>
<%=h @supplier.name %>
</p>
<p>
<b>Description:</b>
<%=h @supplier.description %>
</p>
<p>
<b>Code:</b>
<%=h @supplier.code %>
</p>
<p>
<b>Created at:</b>
<%=h @supplier.created_at %>
</p>
<p>
<b>Updated at:</b>
<%=h @supplier.updated_at %>
</p>
<%= link_to 'Edit', edit_supplier_path(@supplier) %> |
<%= link_to 'Back', suppliers_path %>

View File

@ -0,0 +1,18 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>Produits: <%= controller.action_name %></title>
<%= stylesheet_link_tag 'scaffold' %>
<%= javascript_include_tag :defaults %>
</head>
<body>
<p style="color: green"><%= flash[:notice] %></p>
<%= yield %>
</body>
</html>

View File

@ -0,0 +1,18 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>Produits: <%= controller.action_name %></title>
<%= stylesheet_link_tag 'scaffold' %>
<%= javascript_include_tag defaults %>
</head>
<body>
<p style="color: green"><%= flash[:notice] %></p>
<%= yield %>
</body>
</html>

View File

@ -0,0 +1,25 @@
<h1>Liste des produits</h1>
<table>
<tr>
<th>Désignation</th>
<th>Description</th>
<th>Fournisseur</th>
<th>Type</th>
</tr>
<% for product in @products %>
<tr>
<%= @product = product %>
<td><%= in_place_editor_field :product, :designation %></td>
<td><%=h product.description %></td>
<td><%= link_to product.supplier_id, supplier_path(product.supplier_id) %></td>
<td><%=h product.type%></td>
<td><%= link_to 'Voir', product_path(product) %></td>
</tr>
<% end %>
</table>
<%= will_paginate @products %>
<br />

View File

@ -0,0 +1,25 @@
<h1>Liste des produits</h1>
<table>
<tr>
<th>Désignation</th>
<th>Description</th>
<th>Fournisseur</th>
<th>Type</th>
</tr>
<% for product in @products %>
<tr>
<%= @product = product %>
<td><%=h in_place_editor_field :product, :designation %></td>
<td><%=h product.description %></td>
<td><%= link_to product.supplier_id, supplier_path(product.supplier_id) %></td>
<td><%=h product.type%></td>
<td><%= link_to 'Voir', product_path(product) %></td>
</tr>
<% end %>
</table>
<%= will_paginate @products %>
<br />

View File

@ -0,0 +1,11 @@
<p>
<b>Désignation:</b>
<%=h @product.designation %>
</p>
<p>
<b>Description:</b>
<%=h @product.description %>
</p>
<%= link_to 'Retour', products_path %>

View File

@ -0,0 +1,14 @@
<% form_tag session_path do -%>
<p><label for="login">Login</label><br/>
<%= text_field_tag 'login' %></p>
<p><label for="password">Password</label><br/>
<%= password_field_tag 'password' %></p>
<!-- Uncomment this if you want this functionality
<p><label for="remember_me">Remember me:</label>
<%= check_box_tag 'remember_me' %></p>
-->
<p><%= submit_tag 'Log in' %></p>
<% end -%>

View File

@ -0,0 +1,3 @@
<%= @utilisateur.login %>, your account has been activated. You may now start adding your plugins:
<%= @url %>

View File

@ -0,0 +1,8 @@
Your account has been created.
Username: <%= @utilisateur.login %>
Password: <%= @utilisateur.password %>
Visit this url to activate your account:
<%= @url %>

View File

@ -0,0 +1,16 @@
<%= error_messages_for :utilisateur %>
<% form_for :utilisateur, :url => utilisateurs_path do |f| -%>
<p><label for="login">Login</label><br/>
<%= f.text_field :login %></p>
<p><label for="email">Email</label><br/>
<%= f.text_field :email %></p>
<p><label for="password">Password</label><br/>
<%= f.password_field :password %></p>
<p><label for="password_confirmation">Confirm Password</label><br/>
<%= f.password_field :password_confirmation %></p>
<p><%= submit_tag 'Sign up' %></p>
<% end -%>