Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 390
- Log:
Initial import of Canvass, a donations-based poll application.
- Author:
- rool
- Date:
- Mon Mar 21 14:58:04 +0000 2011
- Size:
- 2171 Bytes
1 | ######################################################################## |
2 | # File:: currencies_controller.rb |
3 | # (C):: Hipposoft 2009, 2010, 2011 |
4 | # |
5 | # Purpose:: Manage the currency list. |
6 | # ---------------------------------------------------------------------- |
7 | # 14-Mar-2009 (ADH): Created. |
8 | # 18-Feb-2011 (ADH): Imported from Artisan. |
9 | ######################################################################## |
10 | |
11 | class CurrenciesController < ApplicationController |
12 | |
13 | uses_prototype( :only => :index ) |
14 | uses_leightbox( :only => :index ) |
15 | |
16 | @@hubssolib_permissions = HubSsoLib::Permissions.new( { |
17 | :index => [ :admin, :webmaster ], |
18 | :show => [ :admin, :webmaster ], |
19 | :create => [ :admin, :webmaster ], |
20 | :new => [ :admin, :webmaster ], |
21 | :edit => [ :admin, :webmaster ], |
22 | :update => [ :admin, :webmaster ], |
23 | :delete => [ :admin, :webmaster ], |
24 | :destroy => [ :admin, :webmaster ], |
25 | } ) |
26 | |
27 | def CurrenciesController.hubssolib_permissions |
28 | @@hubssolib_permissions |
29 | end |
30 | |
31 | # GET /currencies |
32 | def index |
33 | appctrl_search_sort_and_paginate( Currency ) |
34 | end |
35 | |
36 | # GET /currencies/1 |
37 | def show |
38 | @currency = Currency.find( params[ :id ] ) |
39 | end |
40 | |
41 | # GET /currencies/new |
42 | def new |
43 | @currency = Currency.new |
44 | end |
45 | |
46 | # GET /currencies/1/edit |
47 | def edit |
48 | @currency = Currency.find( params[ :id ] ) |
49 | end |
50 | |
51 | # POST /currencies |
52 | def create |
53 | @currency = Currency.new( params[ :currency ] ) |
54 | |
55 | if @currency.save |
56 | appctrl_set_flash :notice |
57 | redirect_to @currency |
58 | else |
59 | render :action => 'new' |
60 | end |
61 | end |
62 | |
63 | # PUT /currencies/1 |
64 | def update |
65 | @currency = Currency.find( params[ :id ] ) |
66 | |
67 | if @currency.update_attributes( params[ :currency ] ) |
68 | appctrl_set_flash :notice |
69 | redirect_to @currency |
70 | else |
71 | render :action => 'edit' |
72 | end |
73 | end |
74 | |
75 | # DELETE /currencies/1 |
76 | def destroy |
77 | @currency = Currency.find( params[ :id ] ) |
78 | |
79 | if ( Currency.count > 1 && @currency.polls.count.zero? && @currency.donations.count.zero? ) |
80 | @currency.destroy |
81 | appctrl_set_flash :notice |
82 | else |
83 | appctrl_set_flash :error |
84 | end |
85 | |
86 | redirect_to currencies_url() |
87 | end |
88 | end |