bookkeeper 0.0.1.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.md +22 -0
- data/Rakefile +44 -0
- data/app/assets/javascripts/bookkeeper.js +10 -0
- data/app/assets/javascripts/bookkeeper/bootstrap-datepicker.js +470 -0
- data/app/assets/stylesheets/bookkeeper.css +13 -0
- data/app/assets/stylesheets/bookkeeper/datepicker.css +182 -0
- data/app/assets/stylesheets/bookkeeper/scaffold.css +56 -0
- data/app/controllers/bookkeeper/application_controller.rb +5 -0
- data/app/controllers/bookkeeper/purchases_controller.rb +74 -0
- data/app/helpers/bookkeeper/application_helper.rb +4 -0
- data/app/inputs/datepicker_input.rb +9 -0
- data/app/models/bookkeeper/purchase.rb +11 -0
- data/app/uploaders/receipt_uploader.rb +57 -0
- data/app/views/bookkeeper/purchases/_form.html.erb +17 -0
- data/app/views/bookkeeper/purchases/edit.html.erb +6 -0
- data/app/views/bookkeeper/purchases/index.html.erb +34 -0
- data/app/views/bookkeeper/purchases/new.html.erb +5 -0
- data/app/views/bookkeeper/purchases/show.html.erb +34 -0
- data/app/views/layouts/bookkeeper/application.html.erb +14 -0
- data/config/initializers/carrierwave.rb +6 -0
- data/config/initializers/simple_form.rb +142 -0
- data/config/initializers/simple_form_bootstrap.rb +45 -0
- data/config/initializers/validates_timeliness.rb +40 -0
- data/config/locales/simple_form.en.yml +26 -0
- data/config/locales/validates_timeliness.en.yml +16 -0
- data/config/routes.rb +3 -0
- data/db/migrate/20130215165240_create_bookkeeper_purchases.rb +13 -0
- data/lib/bookkeeper.rb +4 -0
- data/lib/bookkeeper/engine.rb +17 -0
- data/lib/bookkeeper/version.rb +3 -0
- data/lib/tasks/bookkeeper_tasks.rake +4 -0
- data/lib/templates/erb/scaffold/_form.html.erb +13 -0
- data/spec/assets/images/receipt.jpg +0 -0
- data/spec/controllers/bookkeeper/purchases_controller_spec.rb +156 -0
- data/spec/dummy/README.rdoc +261 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/images/glyphicons-halflings-white.png +0 -0
- data/spec/dummy/app/assets/images/glyphicons-halflings.png +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +16 -0
- data/spec/dummy/app/assets/javascripts/bootstrap.js +2268 -0
- data/spec/dummy/app/assets/stylesheets/application.css +14 -0
- data/spec/dummy/app/assets/stylesheets/bootstrap-responsive.css +1109 -0
- data/spec/dummy/app/assets/stylesheets/bootstrap.css +6158 -0
- data/spec/dummy/app/assets/stylesheets/font-awesome-ie7.min.css +22 -0
- data/spec/dummy/app/assets/stylesheets/font-awesome.min.css +33 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +65 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/schema.rb +26 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/font/FontAwesome.otf +0 -0
- data/spec/dummy/public/font/fontawesome-webfont.eot +0 -0
- data/spec/dummy/public/font/fontawesome-webfont.svg +284 -0
- data/spec/dummy/public/font/fontawesome-webfont.ttf +0 -0
- data/spec/dummy/public/font/fontawesome-webfont.woff +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/factories/bookkeeper_purchases.rb +15 -0
- data/spec/models/bookkeeper/purchase_spec.rb +51 -0
- data/spec/routing/bookkeeper/purchases_routing_spec.rb +37 -0
- data/spec/spec_helper.rb +19 -0
- data/spec/uploaders/receipt_uploader_spec.rb +26 -0
- data/spec/views/bookkeeper/purchases/edit.html.erb_spec.rb +22 -0
- data/spec/views/bookkeeper/purchases/index.html.erb_spec.rb +26 -0
- data/spec/views/bookkeeper/purchases/new.html.erb_spec.rb +22 -0
- data/spec/views/bookkeeper/purchases/show.html.erb_spec.rb +19 -0
- metadata +396 -0
@@ -0,0 +1,34 @@
|
|
1
|
+
<h1>Listing purchases</h1>
|
2
|
+
|
3
|
+
<table class='table table-striped table-condensed table-bordered'>
|
4
|
+
<thead>
|
5
|
+
<tr>
|
6
|
+
<th>Title</th>
|
7
|
+
<th>Description</th>
|
8
|
+
<th>Purchase date</th>
|
9
|
+
<th>Warranty duration</th>
|
10
|
+
<th>Receipt</th>
|
11
|
+
<th></th>
|
12
|
+
</tr>
|
13
|
+
</thead>
|
14
|
+
<tbody>
|
15
|
+
<% @purchases.each do |purchase| %>
|
16
|
+
<tr>
|
17
|
+
<td><%= purchase.title %></td>
|
18
|
+
<td><%= purchase.description %></td>
|
19
|
+
<td><%=l purchase.purchase_date rescue '' %></td>
|
20
|
+
<td><%= purchase.warranty_duration %></td>
|
21
|
+
<td><%= link_to "<i class='icon-download-alt'></i> #{purchase.receipt.file.filename}".html_safe, purchase.receipt.url, class: 'btn btn-mini' if purchase.receipt.file %></td>
|
22
|
+
<td>
|
23
|
+
<%= link_to '<i class="icon-search"></i> Show'.html_safe, purchase, class: 'btn btn-mini' %>
|
24
|
+
<%= link_to '<i class="icon-pencil"></i> Edit'.html_safe, edit_purchase_path(purchase), class: 'btn btn-mini' %>
|
25
|
+
<%= link_to '<i class="icon-remove"></i> Destroy'.html_safe, purchase, method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-mini btn-danger' %>
|
26
|
+
</td>
|
27
|
+
</tr>
|
28
|
+
<% end %>
|
29
|
+
</tbody>
|
30
|
+
</table>
|
31
|
+
|
32
|
+
<br />
|
33
|
+
|
34
|
+
<%= link_to '<i class="icon-plus"></i> New Purchase'.html_safe, new_purchase_path, class: 'btn' %>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
<b>Title:</b>
|
5
|
+
<%= @purchase.title %>
|
6
|
+
</p>
|
7
|
+
|
8
|
+
<p>
|
9
|
+
<b>Description:</b>
|
10
|
+
<%= @purchase.description %>
|
11
|
+
</p>
|
12
|
+
|
13
|
+
<p>
|
14
|
+
<b>Purchase date:</b>
|
15
|
+
<%= @purchase.purchase_date %>
|
16
|
+
</p>
|
17
|
+
|
18
|
+
<p>
|
19
|
+
<b>Warranty duration:</b>
|
20
|
+
<%= @purchase.warranty_duration %>
|
21
|
+
</p>
|
22
|
+
|
23
|
+
<p>
|
24
|
+
<b>Receipt:</b>
|
25
|
+
<% if ['png', 'jpg', 'jpeg', 'gif'].include?(@purchase.receipt.file.extension.downcase) %>
|
26
|
+
<%= link_to image_tag(@purchase.receipt.thumb.url), @purchase.receipt.url %>
|
27
|
+
<% else %>
|
28
|
+
<%= link_to "<i class='icon-download-alt'></i> #{@purchase.receipt.file.filename}".html_safe, @purchase.receipt.url, class: 'btn' %>
|
29
|
+
<% end %>
|
30
|
+
</p>
|
31
|
+
|
32
|
+
|
33
|
+
<%= link_to '<i class="icon-pencil"></i> Edit'.html_safe, edit_purchase_path(@purchase), class: 'btn' %>
|
34
|
+
<%= link_to '<i class="icon-arrow-left"></i> Back'.html_safe, purchases_path, class: 'btn' %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Bookkeeper</title>
|
5
|
+
<%= stylesheet_link_tag "bookkeeper/application", :media => "all" %>
|
6
|
+
<%= javascript_include_tag "bookkeeper/application" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1,142 @@
|
|
1
|
+
# Use this setup block to configure all options available in SimpleForm.
|
2
|
+
SimpleForm.setup do |config|
|
3
|
+
# Wrappers are used by the form builder to generate a
|
4
|
+
# complete input. You can remove any component from the
|
5
|
+
# wrapper, change the order or even add your own to the
|
6
|
+
# stack. The options given below are used to wrap the
|
7
|
+
# whole input.
|
8
|
+
config.wrappers :default, :class => :input,
|
9
|
+
:hint_class => :field_with_hint, :error_class => :field_with_errors do |b|
|
10
|
+
## Extensions enabled by default
|
11
|
+
# Any of these extensions can be disabled for a
|
12
|
+
# given input by passing: `f.input EXTENSION_NAME => false`.
|
13
|
+
# You can make any of these extensions optional by
|
14
|
+
# renaming `b.use` to `b.optional`.
|
15
|
+
|
16
|
+
# Determines whether to use HTML5 (:email, :url, ...)
|
17
|
+
# and required attributes
|
18
|
+
b.use :html5
|
19
|
+
|
20
|
+
# Calculates placeholders automatically from I18n
|
21
|
+
# You can also pass a string as f.input :placeholder => "Placeholder"
|
22
|
+
b.use :placeholder
|
23
|
+
|
24
|
+
## Optional extensions
|
25
|
+
# They are disabled unless you pass `f.input EXTENSION_NAME => :lookup`
|
26
|
+
# to the input. If so, they will retrieve the values from the model
|
27
|
+
# if any exists. If you want to enable the lookup for any of those
|
28
|
+
# extensions by default, you can change `b.optional` to `b.use`.
|
29
|
+
|
30
|
+
# Calculates maxlength from length validations for string inputs
|
31
|
+
b.optional :maxlength
|
32
|
+
|
33
|
+
# Calculates pattern from format validations for string inputs
|
34
|
+
b.optional :pattern
|
35
|
+
|
36
|
+
# Calculates min and max from length validations for numeric inputs
|
37
|
+
b.optional :min_max
|
38
|
+
|
39
|
+
# Calculates readonly automatically from readonly attributes
|
40
|
+
b.optional :readonly
|
41
|
+
|
42
|
+
## Inputs
|
43
|
+
b.use :label_input
|
44
|
+
b.use :hint, :wrap_with => { :tag => :span, :class => :hint }
|
45
|
+
b.use :error, :wrap_with => { :tag => :span, :class => :error }
|
46
|
+
end
|
47
|
+
|
48
|
+
# The default wrapper to be used by the FormBuilder.
|
49
|
+
config.default_wrapper = :default
|
50
|
+
|
51
|
+
# Define the way to render check boxes / radio buttons with labels.
|
52
|
+
# Defaults to :nested for bootstrap config.
|
53
|
+
# :inline => input + label
|
54
|
+
# :nested => label > input
|
55
|
+
config.boolean_style = :nested
|
56
|
+
|
57
|
+
# Default class for buttons
|
58
|
+
config.button_class = 'btn'
|
59
|
+
|
60
|
+
# Method used to tidy up errors. Specify any Rails Array method.
|
61
|
+
# :first lists the first message for each field.
|
62
|
+
# Use :to_sentence to list all errors for each field.
|
63
|
+
# config.error_method = :first
|
64
|
+
|
65
|
+
# Default tag used for error notification helper.
|
66
|
+
config.error_notification_tag = :div
|
67
|
+
|
68
|
+
# CSS class to add for error notification helper.
|
69
|
+
config.error_notification_class = 'alert alert-error'
|
70
|
+
|
71
|
+
# ID to add for error notification helper.
|
72
|
+
# config.error_notification_id = nil
|
73
|
+
|
74
|
+
# Series of attempts to detect a default label method for collection.
|
75
|
+
# config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
|
76
|
+
|
77
|
+
# Series of attempts to detect a default value method for collection.
|
78
|
+
# config.collection_value_methods = [ :id, :to_s ]
|
79
|
+
|
80
|
+
# You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
|
81
|
+
# config.collection_wrapper_tag = nil
|
82
|
+
|
83
|
+
# You can define the class to use on all collection wrappers. Defaulting to none.
|
84
|
+
# config.collection_wrapper_class = nil
|
85
|
+
|
86
|
+
# You can wrap each item in a collection of radio/check boxes with a tag,
|
87
|
+
# defaulting to :span. Please note that when using :boolean_style = :nested,
|
88
|
+
# SimpleForm will force this option to be a label.
|
89
|
+
# config.item_wrapper_tag = :span
|
90
|
+
|
91
|
+
# You can define a class to use in all item wrappers. Defaulting to none.
|
92
|
+
# config.item_wrapper_class = nil
|
93
|
+
|
94
|
+
# How the label text should be generated altogether with the required text.
|
95
|
+
# config.label_text = lambda { |label, required| "#{required} #{label}" }
|
96
|
+
|
97
|
+
# You can define the class to use on all labels. Default is nil.
|
98
|
+
config.label_class = 'control-label'
|
99
|
+
|
100
|
+
# You can define the class to use on all forms. Default is simple_form.
|
101
|
+
# config.form_class = :simple_form
|
102
|
+
|
103
|
+
# You can define which elements should obtain additional classes
|
104
|
+
# config.generate_additional_classes_for = [:wrapper, :label, :input]
|
105
|
+
|
106
|
+
# Whether attributes are required by default (or not). Default is true.
|
107
|
+
# config.required_by_default = true
|
108
|
+
|
109
|
+
# Tell browsers whether to use default HTML5 validations (novalidate option).
|
110
|
+
# Default is enabled.
|
111
|
+
config.browser_validations = false
|
112
|
+
|
113
|
+
# Collection of methods to detect if a file type was given.
|
114
|
+
# config.file_methods = [ :mounted_as, :file?, :public_filename ]
|
115
|
+
|
116
|
+
# Custom mappings for input types. This should be a hash containing a regexp
|
117
|
+
# to match as key, and the input type that will be used when the field name
|
118
|
+
# matches the regexp as value.
|
119
|
+
# config.input_mappings = { /count/ => :integer }
|
120
|
+
|
121
|
+
# Custom wrappers for input types. This should be a hash containing an input
|
122
|
+
# type as key and the wrapper that will be used for all inputs with specified type.
|
123
|
+
# config.wrapper_mappings = { :string => :prepend }
|
124
|
+
|
125
|
+
# Default priority for time_zone inputs.
|
126
|
+
# config.time_zone_priority = nil
|
127
|
+
|
128
|
+
# Default priority for country inputs.
|
129
|
+
# config.country_priority = nil
|
130
|
+
|
131
|
+
# Default size for text inputs.
|
132
|
+
# config.default_input_size = 50
|
133
|
+
|
134
|
+
# When false, do not use translations for labels.
|
135
|
+
# config.translate_labels = true
|
136
|
+
|
137
|
+
# Automatically discover new inputs in Rails' autoload path.
|
138
|
+
# config.inputs_discovery = true
|
139
|
+
|
140
|
+
# Cache SimpleForm inputs discovery
|
141
|
+
# config.cache_discovery = !Rails.env.development?
|
142
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# Use this setup block to configure all options available in SimpleForm.
|
2
|
+
SimpleForm.setup do |config|
|
3
|
+
config.wrappers :bootstrap, :tag => 'div', :class => 'control-group', :error_class => 'error' do |b|
|
4
|
+
b.use :html5
|
5
|
+
b.use :placeholder
|
6
|
+
b.use :label
|
7
|
+
b.wrapper :tag => 'div', :class => 'controls' do |ba|
|
8
|
+
ba.use :input
|
9
|
+
ba.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
|
10
|
+
ba.use :hint, :wrap_with => { :tag => 'p', :class => 'help-block' }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
config.wrappers :prepend, :tag => 'div', :class => "control-group", :error_class => 'error' do |b|
|
15
|
+
b.use :html5
|
16
|
+
b.use :placeholder
|
17
|
+
b.use :label
|
18
|
+
b.wrapper :tag => 'div', :class => 'controls' do |input|
|
19
|
+
input.wrapper :tag => 'div', :class => 'input-prepend' do |prepend|
|
20
|
+
prepend.use :input
|
21
|
+
end
|
22
|
+
input.use :hint, :wrap_with => { :tag => 'span', :class => 'help-block' }
|
23
|
+
input.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
config.wrappers :append, :tag => 'div', :class => "control-group", :error_class => 'error' do |b|
|
28
|
+
b.use :html5
|
29
|
+
b.use :placeholder
|
30
|
+
b.use :label
|
31
|
+
b.wrapper :tag => 'div', :class => 'controls' do |input|
|
32
|
+
input.wrapper :tag => 'div', :class => 'input-append' do |append|
|
33
|
+
append.use :input
|
34
|
+
end
|
35
|
+
input.use :hint, :wrap_with => { :tag => 'span', :class => 'help-block' }
|
36
|
+
input.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# Wrappers for forms and inputs using the Twitter Bootstrap toolkit.
|
41
|
+
# Check the Bootstrap docs (http://twitter.github.com/bootstrap)
|
42
|
+
# to learn about the different styles for forms and inputs,
|
43
|
+
# buttons and other elements.
|
44
|
+
config.default_wrapper = :bootstrap
|
45
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
ValidatesTimeliness.setup do |config|
|
2
|
+
# Extend ORM/ODMs for full support (:active_record, :mongoid).
|
3
|
+
# config.extend_orms = [ :active_record ]
|
4
|
+
#
|
5
|
+
# Default timezone
|
6
|
+
# config.default_timezone = :utc
|
7
|
+
#
|
8
|
+
# Set the dummy date part for a time type values.
|
9
|
+
# config.dummy_date_for_time_type = [ 2000, 1, 1 ]
|
10
|
+
#
|
11
|
+
# Ignore errors when restriction options are evaluated
|
12
|
+
# config.ignore_restriction_errors = false
|
13
|
+
#
|
14
|
+
# Re-display invalid values in date/time selects
|
15
|
+
# config.enable_date_time_select_extension!
|
16
|
+
#
|
17
|
+
# Handle multiparameter date/time values strictly
|
18
|
+
# config.enable_multiparameter_extension!
|
19
|
+
#
|
20
|
+
# Shorthand date and time symbols for restrictions
|
21
|
+
# config.restriction_shorthand_symbols.update(
|
22
|
+
# :now => lambda { Time.current },
|
23
|
+
# :today => lambda { Date.current }
|
24
|
+
# )
|
25
|
+
#
|
26
|
+
# Use the plugin date/time parser which is stricter and extendable
|
27
|
+
# config.use_plugin_parser = false
|
28
|
+
#
|
29
|
+
# Add one or more formats making them valid. e.g. add_formats(:date, 'd(st|rd|th) of mmm, yyyy')
|
30
|
+
# config.parser.add_formats()
|
31
|
+
#
|
32
|
+
# Remove one or more formats making them invalid. e.g. remove_formats(:date, 'dd/mm/yyy')
|
33
|
+
# config.parser.remove_formats()
|
34
|
+
#
|
35
|
+
# Change the amiguous year threshold when parsing a 2 digit year
|
36
|
+
# config.parser.ambiguous_year_threshold = 30
|
37
|
+
#
|
38
|
+
# Treat ambiguous dates, such as 01/02/1950, as a Non-US date.
|
39
|
+
# config.parser.remove_us_formats
|
40
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
en:
|
2
|
+
simple_form:
|
3
|
+
"yes": 'Yes'
|
4
|
+
"no": 'No'
|
5
|
+
required:
|
6
|
+
text: 'required'
|
7
|
+
mark: '*'
|
8
|
+
# You can uncomment the line below if you need to overwrite the whole required html.
|
9
|
+
# When using html, text and mark won't be used.
|
10
|
+
# html: '<abbr title="required">*</abbr>'
|
11
|
+
error_notification:
|
12
|
+
default_message: "Please review the problems below:"
|
13
|
+
# Labels and hints examples
|
14
|
+
# labels:
|
15
|
+
# defaults:
|
16
|
+
# password: 'Password'
|
17
|
+
# user:
|
18
|
+
# new:
|
19
|
+
# email: 'E-mail to sign in.'
|
20
|
+
# edit:
|
21
|
+
# email: 'E-mail.'
|
22
|
+
# hints:
|
23
|
+
# defaults:
|
24
|
+
# username: 'User name to sign in.'
|
25
|
+
# password: 'No special characters, please.'
|
26
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
en:
|
2
|
+
errors:
|
3
|
+
messages:
|
4
|
+
invalid_date: "is not a valid date"
|
5
|
+
invalid_time: "is not a valid time"
|
6
|
+
invalid_datetime: "is not a valid datetime"
|
7
|
+
is_at: "must be at %{restriction}"
|
8
|
+
before: "must be before %{restriction}"
|
9
|
+
on_or_before: "must be on or before %{restriction}"
|
10
|
+
after: "must be after %{restriction}"
|
11
|
+
on_or_after: "must be on or after %{restriction}"
|
12
|
+
validates_timeliness:
|
13
|
+
error_value_formats:
|
14
|
+
date: '%Y-%m-%d'
|
15
|
+
time: '%H:%M:%S'
|
16
|
+
datetime: '%Y-%m-%d %H:%M:%S'
|
data/config/routes.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateBookkeeperPurchases < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :bookkeeper_purchases do |t|
|
4
|
+
t.string :title, nil: false
|
5
|
+
t.text :description
|
6
|
+
t.date :purchase_date
|
7
|
+
t.integer :warranty_duration
|
8
|
+
t.string :receipt
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
add_index :bookkeeper_purchases, :title
|
12
|
+
end
|
13
|
+
end
|
data/lib/bookkeeper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'validates_timeliness'
|
2
|
+
require 'rmagick'
|
3
|
+
require 'carrierwave'
|
4
|
+
require 'simple_form'
|
5
|
+
|
6
|
+
module Bookkeeper
|
7
|
+
class Engine < ::Rails::Engine
|
8
|
+
isolate_namespace Bookkeeper
|
9
|
+
|
10
|
+
config.generators do |g|
|
11
|
+
g.test_framework :rspec, :fixture => false
|
12
|
+
g.fixture_replacement :factory_girl, :dir => 'spec/factories'
|
13
|
+
g.assets false
|
14
|
+
g.helper false
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%%= simple_form_for(@<%= singular_table_name %>) do |f| %>
|
2
|
+
<%%= f.error_notification %>
|
3
|
+
|
4
|
+
<div class="form-inputs">
|
5
|
+
<%- attributes.each do |attribute| -%>
|
6
|
+
<%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %>
|
7
|
+
<%- end -%>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<div class="form-actions">
|
11
|
+
<%%= f.button :submit %>
|
12
|
+
</div>
|
13
|
+
<%% end %>
|