active_list 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE.txt +20 -0
- data/README.rdoc +46 -0
- data/app/assets/images/active_list.png +0 -0
- data/app/assets/images/active_list.svg +415 -0
- data/app/assets/javascripts/active_list.jquery.js +136 -0
- data/app/assets/stylesheets/active_list.css.scss +7 -0
- data/app/assets/stylesheets/active_list/background.scss +39 -0
- data/app/assets/stylesheets/active_list/minimal.scss +87 -0
- data/app/assets/stylesheets/active_list/theme.scss +189 -0
- data/lib/active_list.rb +61 -0
- data/lib/active_list/action_pack.rb +46 -0
- data/lib/active_list/definition.rb +17 -0
- data/lib/active_list/definition/abstract_column.rb +54 -0
- data/lib/active_list/definition/action_column.rb +76 -0
- data/lib/active_list/definition/association_column.rb +80 -0
- data/lib/active_list/definition/attribute_column.rb +58 -0
- data/lib/active_list/definition/check_box_column.rb +17 -0
- data/lib/active_list/definition/data_column.rb +88 -0
- data/lib/active_list/definition/empty_column.rb +10 -0
- data/lib/active_list/definition/field_column.rb +20 -0
- data/lib/active_list/definition/status_column.rb +10 -0
- data/lib/active_list/definition/table.rb +159 -0
- data/lib/active_list/definition/text_field_column.rb +10 -0
- data/lib/active_list/exporters.rb +17 -0
- data/lib/active_list/exporters/abstract_exporter.rb +55 -0
- data/lib/active_list/exporters/csv_exporter.rb +32 -0
- data/lib/active_list/exporters/excel_csv_exporter.rb +38 -0
- data/lib/active_list/exporters/open_document_spreadsheet_exporter.rb +82 -0
- data/lib/active_list/generator.rb +122 -0
- data/lib/active_list/generator/finder.rb +150 -0
- data/lib/active_list/helpers.rb +33 -0
- data/lib/active_list/rails/engine.rb +13 -0
- data/lib/active_list/renderers.rb +16 -0
- data/lib/active_list/renderers/abstract_renderer.rb +29 -0
- data/lib/active_list/renderers/simple_renderer.rb +356 -0
- data/lib/active_list/version.rb +5 -0
- data/locales/eng.yml +25 -0
- data/locales/fra.yml +25 -0
- data/test/active_list_test.rb +35 -0
- data/test/code_generation_test.rb +31 -0
- data/test/dummy/.gitignore +15 -0
- data/test/dummy/Gemfile +39 -0
- data/test/dummy/Gemfile.lock +132 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/images/rails.png +0 -0
- data/test/dummy/app/assets/javascripts/application.js +16 -0
- data/test/dummy/app/assets/javascripts/contacts.js.coffee +3 -0
- data/test/dummy/app/assets/javascripts/people.js.coffee +3 -0
- data/test/dummy/app/assets/stylesheets/application.css +14 -0
- data/test/dummy/app/assets/stylesheets/contacts.css.scss +3 -0
- data/test/dummy/app/assets/stylesheets/people.css.scss +3 -0
- data/test/dummy/app/assets/stylesheets/scaffolds.css.scss +56 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/contacts_controller.rb +83 -0
- data/test/dummy/app/controllers/people_controller.rb +86 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/helpers/contacts_helper.rb +2 -0
- data/test/dummy/app/helpers/people_helper.rb +2 -0
- data/test/dummy/app/mailers/.gitkeep +0 -0
- data/test/dummy/app/models/.gitkeep +0 -0
- data/test/dummy/app/models/contact.rb +3 -0
- data/test/dummy/app/models/person.rb +3 -0
- data/test/dummy/app/views/contacts/_form.html.erb +37 -0
- data/test/dummy/app/views/contacts/edit.html.erb +6 -0
- data/test/dummy/app/views/contacts/index.html.erb +31 -0
- data/test/dummy/app/views/contacts/new.html.erb +5 -0
- data/test/dummy/app/views/contacts/show.html.erb +30 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/people/_form.html.erb +29 -0
- data/test/dummy/app/views/people/edit.html.erb +6 -0
- data/test/dummy/app/views/people/index.html.erb +30 -0
- data/test/dummy/app/views/people/new.html.erb +5 -0
- data/test/dummy/app/views/people/show.html.erb +20 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +59 -0
- data/test/dummy/config/boot.rb +6 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +40 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +8 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +66 -0
- data/test/dummy/db/migrate/20120510131331_create_people.rb +11 -0
- data/test/dummy/db/migrate/20120510134500_create_contacts.rb +13 -0
- data/test/dummy/db/schema.rb +34 -0
- data/test/dummy/log/.gitkeep +0 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/public/robots.txt +5 -0
- data/test/dummy/script/rails +6 -0
- data/test/people_controller_test.rb +55 -0
- data/test/table_test.rb +15 -0
- data/test/test_helper.rb +30 -0
- metadata +313 -0
@@ -0,0 +1,83 @@
|
|
1
|
+
class ContactsController < ApplicationController
|
2
|
+
# GET /contacts
|
3
|
+
# GET /contacts.json
|
4
|
+
def index
|
5
|
+
@contacts = Contact.all
|
6
|
+
|
7
|
+
respond_to do |format|
|
8
|
+
format.html # index.html.erb
|
9
|
+
format.json { render :json => @contacts }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /contacts/1
|
14
|
+
# GET /contacts/1.json
|
15
|
+
def show
|
16
|
+
@contact = Contact.find(params[:id])
|
17
|
+
|
18
|
+
respond_to do |format|
|
19
|
+
format.html # show.html.erb
|
20
|
+
format.json { render :json => @contact }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /contacts/new
|
25
|
+
# GET /contacts/new.json
|
26
|
+
def new
|
27
|
+
@contact = Contact.new
|
28
|
+
|
29
|
+
respond_to do |format|
|
30
|
+
format.html # new.html.erb
|
31
|
+
format.json { render :json => @contact }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# GET /contacts/1/edit
|
36
|
+
def edit
|
37
|
+
@contact = Contact.find(params[:id])
|
38
|
+
end
|
39
|
+
|
40
|
+
# POST /contacts
|
41
|
+
# POST /contacts.json
|
42
|
+
def create
|
43
|
+
@contact = Contact.new(params[:contact])
|
44
|
+
|
45
|
+
respond_to do |format|
|
46
|
+
if @contact.save
|
47
|
+
format.html { redirect_to @contact, :notice => 'Contact was successfully created.' }
|
48
|
+
format.json { render :json => @contact, :status => :created, :location => @contact }
|
49
|
+
else
|
50
|
+
format.html { render :action => "new" }
|
51
|
+
format.json { render :json => @contact.errors, :status => :unprocessable_entity }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# PUT /contacts/1
|
57
|
+
# PUT /contacts/1.json
|
58
|
+
def update
|
59
|
+
@contact = Contact.find(params[:id])
|
60
|
+
|
61
|
+
respond_to do |format|
|
62
|
+
if @contact.update_attributes(params[:contact])
|
63
|
+
format.html { redirect_to @contact, :notice => 'Contact was successfully updated.' }
|
64
|
+
format.json { head :no_content }
|
65
|
+
else
|
66
|
+
format.html { render :action => "edit" }
|
67
|
+
format.json { render :json => @contact.errors, :status => :unprocessable_entity }
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# DELETE /contacts/1
|
73
|
+
# DELETE /contacts/1.json
|
74
|
+
def destroy
|
75
|
+
@contact = Contact.find(params[:id])
|
76
|
+
@contact.destroy
|
77
|
+
|
78
|
+
respond_to do |format|
|
79
|
+
format.html { redirect_to contacts_url }
|
80
|
+
format.json { head :no_content }
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
class PeopleController < ApplicationController
|
2
|
+
|
3
|
+
list
|
4
|
+
|
5
|
+
# GET /people
|
6
|
+
# GET /people.json
|
7
|
+
def index
|
8
|
+
@people = Person.all
|
9
|
+
|
10
|
+
respond_to do |format|
|
11
|
+
format.html # index.html.erb
|
12
|
+
format.json { render :json => @people }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# GET /people/1
|
17
|
+
# GET /people/1.json
|
18
|
+
def show
|
19
|
+
@person = Person.find(params[:id])
|
20
|
+
|
21
|
+
respond_to do |format|
|
22
|
+
format.html # show.html.erb
|
23
|
+
format.json { render :json => @person }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# GET /people/new
|
28
|
+
# GET /people/new.json
|
29
|
+
def new
|
30
|
+
@person = Person.new
|
31
|
+
|
32
|
+
respond_to do |format|
|
33
|
+
format.html # new.html.erb
|
34
|
+
format.json { render :json => @person }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# GET /people/1/edit
|
39
|
+
def edit
|
40
|
+
@person = Person.find(params[:id])
|
41
|
+
end
|
42
|
+
|
43
|
+
# POST /people
|
44
|
+
# POST /people.json
|
45
|
+
def create
|
46
|
+
@person = Person.new(params[:person])
|
47
|
+
|
48
|
+
respond_to do |format|
|
49
|
+
if @person.save
|
50
|
+
format.html { redirect_to @person, :notice => 'Person was successfully created.' }
|
51
|
+
format.json { render :json => @person, :status => :created, :location => @person }
|
52
|
+
else
|
53
|
+
format.html { render :action => "new" }
|
54
|
+
format.json { render :json => @person.errors, :status => :unprocessable_entity }
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# PUT /people/1
|
60
|
+
# PUT /people/1.json
|
61
|
+
def update
|
62
|
+
@person = Person.find(params[:id])
|
63
|
+
|
64
|
+
respond_to do |format|
|
65
|
+
if @person.update_attributes(params[:person])
|
66
|
+
format.html { redirect_to @person, :notice => 'Person was successfully updated.' }
|
67
|
+
format.json { head :no_content }
|
68
|
+
else
|
69
|
+
format.html { render :action => "edit" }
|
70
|
+
format.json { render :json => @person.errors, :status => :unprocessable_entity }
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# DELETE /people/1
|
76
|
+
# DELETE /people/1.json
|
77
|
+
def destroy
|
78
|
+
@person = Person.find(params[:id])
|
79
|
+
@person.destroy
|
80
|
+
|
81
|
+
respond_to do |format|
|
82
|
+
format.html { redirect_to people_url }
|
83
|
+
format.json { head :no_content }
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
File without changes
|
File without changes
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<%= form_for(@contact) do |f| %>
|
2
|
+
<% if @contact.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%= pluralize(@contact.errors.count, "error") %> prohibited this contact from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% @contact.errors.full_messages.each do |msg| %>
|
8
|
+
<li><%= msg %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= f.label :person_id %><br />
|
16
|
+
<%= f.number_field :person_id %>
|
17
|
+
</div>
|
18
|
+
<div class="field">
|
19
|
+
<%= f.label :address %><br />
|
20
|
+
<%= f.text_area :address %>
|
21
|
+
</div>
|
22
|
+
<div class="field">
|
23
|
+
<%= f.label :phone %><br />
|
24
|
+
<%= f.text_field :phone %>
|
25
|
+
</div>
|
26
|
+
<div class="field">
|
27
|
+
<%= f.label :fax %><br />
|
28
|
+
<%= f.text_field :fax %>
|
29
|
+
</div>
|
30
|
+
<div class="field">
|
31
|
+
<%= f.label :country %><br />
|
32
|
+
<%= f.text_field :country %>
|
33
|
+
</div>
|
34
|
+
<div class="actions">
|
35
|
+
<%= f.submit %>
|
36
|
+
</div>
|
37
|
+
<% end %>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<h1>Listing contacts</h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<tr>
|
5
|
+
<th>Person</th>
|
6
|
+
<th>Address</th>
|
7
|
+
<th>Phone</th>
|
8
|
+
<th>Fax</th>
|
9
|
+
<th>Country</th>
|
10
|
+
<th></th>
|
11
|
+
<th></th>
|
12
|
+
<th></th>
|
13
|
+
</tr>
|
14
|
+
|
15
|
+
<% @contacts.each do |contact| %>
|
16
|
+
<tr>
|
17
|
+
<td><%= contact.person_id %></td>
|
18
|
+
<td><%= contact.address %></td>
|
19
|
+
<td><%= contact.phone %></td>
|
20
|
+
<td><%= contact.fax %></td>
|
21
|
+
<td><%= contact.country %></td>
|
22
|
+
<td><%= link_to 'Show', contact %></td>
|
23
|
+
<td><%= link_to 'Edit', edit_contact_path(contact) %></td>
|
24
|
+
<td><%= link_to 'Destroy', contact, confirm: 'Are you sure?', method: :delete %></td>
|
25
|
+
</tr>
|
26
|
+
<% end %>
|
27
|
+
</table>
|
28
|
+
|
29
|
+
<br />
|
30
|
+
|
31
|
+
<%= link_to 'New Contact', new_contact_path %>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
<b>Person:</b>
|
5
|
+
<%= @contact.person_id %>
|
6
|
+
</p>
|
7
|
+
|
8
|
+
<p>
|
9
|
+
<b>Address:</b>
|
10
|
+
<%= @contact.address %>
|
11
|
+
</p>
|
12
|
+
|
13
|
+
<p>
|
14
|
+
<b>Phone:</b>
|
15
|
+
<%= @contact.phone %>
|
16
|
+
</p>
|
17
|
+
|
18
|
+
<p>
|
19
|
+
<b>Fax:</b>
|
20
|
+
<%= @contact.fax %>
|
21
|
+
</p>
|
22
|
+
|
23
|
+
<p>
|
24
|
+
<b>Country:</b>
|
25
|
+
<%= @contact.country %>
|
26
|
+
</p>
|
27
|
+
|
28
|
+
|
29
|
+
<%= link_to 'Edit', edit_contact_path(@contact) %> |
|
30
|
+
<%= link_to 'Back', contacts_path %>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<%= form_for(@person) do |f| %>
|
2
|
+
<% if @person.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%= pluralize(@person.errors.count, "error") %> prohibited this person from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% @person.errors.full_messages.each do |msg| %>
|
8
|
+
<li><%= msg %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= f.label :name %><br />
|
16
|
+
<%= f.text_field :name %>
|
17
|
+
</div>
|
18
|
+
<div class="field">
|
19
|
+
<%= f.label :born_on %><br />
|
20
|
+
<%= f.date_select :born_on %>
|
21
|
+
</div>
|
22
|
+
<div class="field">
|
23
|
+
<%= f.label :height %><br />
|
24
|
+
<%= f.text_field :height %>
|
25
|
+
</div>
|
26
|
+
<div class="actions">
|
27
|
+
<%= f.submit %>
|
28
|
+
</div>
|
29
|
+
<% end %>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<h1>Listing people</h1>
|
2
|
+
|
3
|
+
|
4
|
+
<%= list -%>
|
5
|
+
|
6
|
+
<table>
|
7
|
+
<tr>
|
8
|
+
<th>Name</th>
|
9
|
+
<th>Born on</th>
|
10
|
+
<th>Height</th>
|
11
|
+
<th></th>
|
12
|
+
<th></th>
|
13
|
+
<th></th>
|
14
|
+
</tr>
|
15
|
+
|
16
|
+
<% @people.each do |person| %>
|
17
|
+
<tr>
|
18
|
+
<td><%= person.name %></td>
|
19
|
+
<td><%= person.born_on %></td>
|
20
|
+
<td><%= person.height %></td>
|
21
|
+
<td><%= link_to 'Show', person %></td>
|
22
|
+
<td><%= link_to 'Edit', edit_person_path(person) %></td>
|
23
|
+
<td><%= link_to 'Destroy', person, confirm: 'Are you sure?', method: :delete %></td>
|
24
|
+
</tr>
|
25
|
+
<% end %>
|
26
|
+
</table>
|
27
|
+
|
28
|
+
<br />
|
29
|
+
|
30
|
+
<%= link_to 'New Person', new_person_path %>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
<b>Name:</b>
|
5
|
+
<%= @person.name %>
|
6
|
+
</p>
|
7
|
+
|
8
|
+
<p>
|
9
|
+
<b>Born on:</b>
|
10
|
+
<%= @person.born_on %>
|
11
|
+
</p>
|
12
|
+
|
13
|
+
<p>
|
14
|
+
<b>Height:</b>
|
15
|
+
<%= @person.height %>
|
16
|
+
</p>
|
17
|
+
|
18
|
+
|
19
|
+
<%= link_to 'Edit', edit_person_path(@person) %> |
|
20
|
+
<%= link_to 'Back', people_path %>
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
if defined?(Bundler)
|
6
|
+
# If you precompile assets before deploying to production, use this line
|
7
|
+
Bundler.require(*Rails.groups(:assets => %w(development test)))
|
8
|
+
# If you want your assets lazily compiled in production, use this line
|
9
|
+
# Bundler.require(:default, :assets, Rails.env)
|
10
|
+
end
|
11
|
+
|
12
|
+
module Dummy
|
13
|
+
class Application < Rails::Application
|
14
|
+
# Settings in config/environments/* take precedence over those specified here.
|
15
|
+
# Application configuration should go into files in config/initializers
|
16
|
+
# -- all .rb files in that directory are automatically loaded.
|
17
|
+
|
18
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
19
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
20
|
+
|
21
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
22
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
23
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
24
|
+
|
25
|
+
# Activate observers that should always be running.
|
26
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
27
|
+
|
28
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
29
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
30
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
31
|
+
|
32
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
33
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
34
|
+
# config.i18n.default_locale = :de
|
35
|
+
|
36
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
37
|
+
config.encoding = "utf-8"
|
38
|
+
|
39
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
40
|
+
config.filter_parameters += [:password]
|
41
|
+
|
42
|
+
# Use SQL instead of Active Record's schema dumper when creating the database.
|
43
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
44
|
+
# like if you have constraints or database-specific column types
|
45
|
+
# config.active_record.schema_format = :sql
|
46
|
+
|
47
|
+
# Enforce whitelist mode for mass assignment.
|
48
|
+
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
49
|
+
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
50
|
+
# parameters by using an attr_accessible or attr_protected declaration.
|
51
|
+
# config.active_record.whitelist_attributes = true
|
52
|
+
|
53
|
+
# Enable the asset pipeline
|
54
|
+
config.assets.enabled = true
|
55
|
+
|
56
|
+
# Version of your assets, change this if you want to expire all your assets
|
57
|
+
config.assets.version = '1.0'
|
58
|
+
end
|
59
|
+
end
|