acts-as-taggable-on-dynamic 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. data/.travis.yml +2 -0
  2. data/README.md +21 -1
  3. data/lib/acts_as_taggable_on_dynamic/dynamic_tag_helpers.rb +8 -7
  4. data/lib/acts_as_taggable_on_dynamic/rails/version.rb +1 -1
  5. data/samples/demo-plain/.gitignore +15 -0
  6. data/samples/demo-plain/Gemfile +42 -0
  7. data/samples/demo-plain/README.rdoc +261 -0
  8. data/samples/demo-plain/Rakefile +7 -0
  9. data/samples/demo-plain/app/assets/images/rails.png +0 -0
  10. data/samples/demo-plain/app/assets/javascripts/application.js +18 -0
  11. data/samples/demo-plain/app/assets/javascripts/locations.js.coffee +3 -0
  12. data/samples/demo-plain/app/assets/javascripts/users.js.coffee +3 -0
  13. data/samples/demo-plain/app/assets/stylesheets/application.css +13 -0
  14. data/samples/demo-plain/app/assets/stylesheets/locations.css.scss +3 -0
  15. data/samples/demo-plain/app/assets/stylesheets/scaffolds.css.scss +69 -0
  16. data/samples/demo-plain/app/assets/stylesheets/users.css.scss +3 -0
  17. data/samples/demo-plain/app/controllers/application_controller.rb +3 -0
  18. data/samples/demo-plain/app/controllers/locations_controller.rb +83 -0
  19. data/samples/demo-plain/app/controllers/users_controller.rb +83 -0
  20. data/samples/demo-plain/app/helpers/application_helper.rb +2 -0
  21. data/samples/demo-plain/app/helpers/locations_helper.rb +2 -0
  22. data/samples/demo-plain/app/helpers/users_helper.rb +2 -0
  23. data/samples/demo-plain/app/mailers/.gitkeep +0 -0
  24. data/samples/demo-plain/app/models/.gitkeep +0 -0
  25. data/samples/demo-plain/app/models/location.rb +5 -0
  26. data/samples/demo-plain/app/models/user.rb +3 -0
  27. data/samples/demo-plain/app/views/layouts/application.html.erb +14 -0
  28. data/samples/demo-plain/app/views/locations/_form.html.erb +26 -0
  29. data/samples/demo-plain/app/views/locations/edit.html.erb +6 -0
  30. data/samples/demo-plain/app/views/locations/index.html.erb +23 -0
  31. data/samples/demo-plain/app/views/locations/new.html.erb +5 -0
  32. data/samples/demo-plain/app/views/locations/show.html.erb +10 -0
  33. data/samples/demo-plain/app/views/users/_form.html.erb +21 -0
  34. data/samples/demo-plain/app/views/users/edit.html.erb +6 -0
  35. data/samples/demo-plain/app/views/users/index.html.erb +23 -0
  36. data/samples/demo-plain/app/views/users/new.html.erb +5 -0
  37. data/samples/demo-plain/app/views/users/show.html.erb +10 -0
  38. data/samples/demo-plain/config.ru +4 -0
  39. data/samples/demo-plain/config/application.rb +62 -0
  40. data/samples/demo-plain/config/boot.rb +6 -0
  41. data/samples/demo-plain/config/database.yml +25 -0
  42. data/samples/demo-plain/config/environment.rb +5 -0
  43. data/samples/demo-plain/config/environments/development.rb +37 -0
  44. data/samples/demo-plain/config/environments/production.rb +67 -0
  45. data/samples/demo-plain/config/environments/test.rb +37 -0
  46. data/samples/demo-plain/config/initializers/backtrace_silencers.rb +7 -0
  47. data/samples/demo-plain/config/initializers/inflections.rb +15 -0
  48. data/samples/demo-plain/config/initializers/mime_types.rb +5 -0
  49. data/samples/demo-plain/config/initializers/secret_token.rb +7 -0
  50. data/samples/demo-plain/config/initializers/session_store.rb +8 -0
  51. data/samples/demo-plain/config/initializers/wrap_parameters.rb +14 -0
  52. data/samples/demo-plain/config/locales/en.yml +5 -0
  53. data/samples/demo-plain/config/routes.rb +64 -0
  54. data/samples/demo-plain/db/migrate/20130430093942_acts_as_taggable_on_migration.rb +30 -0
  55. data/samples/demo-plain/db/migrate/20130430094215_create_users.rb +9 -0
  56. data/samples/demo-plain/db/migrate/20130430094229_create_locations.rb +9 -0
  57. data/samples/demo-plain/db/schema.rb +45 -0
  58. data/samples/demo-plain/db/seeds.rb +7 -0
  59. data/samples/demo-plain/doc/README_FOR_APP +2 -0
  60. data/samples/demo-plain/lib/assets/.gitkeep +0 -0
  61. data/samples/demo-plain/lib/tasks/.gitkeep +0 -0
  62. data/samples/demo-plain/log/.gitkeep +0 -0
  63. data/samples/demo-plain/public/404.html +26 -0
  64. data/samples/demo-plain/public/422.html +26 -0
  65. data/samples/demo-plain/public/500.html +25 -0
  66. data/samples/demo-plain/public/favicon.ico +0 -0
  67. data/samples/demo-plain/public/robots.txt +5 -0
  68. data/samples/demo-plain/script/rails +6 -0
  69. data/samples/demo-plain/test/fixtures/.gitkeep +0 -0
  70. data/samples/demo-plain/test/fixtures/locations.yml +7 -0
  71. data/samples/demo-plain/test/fixtures/users.yml +7 -0
  72. data/samples/demo-plain/test/functional/.gitkeep +0 -0
  73. data/samples/demo-plain/test/functional/locations_controller_test.rb +49 -0
  74. data/samples/demo-plain/test/functional/users_controller_test.rb +49 -0
  75. data/samples/demo-plain/test/integration/.gitkeep +0 -0
  76. data/samples/demo-plain/test/performance/browsing_test.rb +12 -0
  77. data/samples/demo-plain/test/test_helper.rb +13 -0
  78. data/samples/demo-plain/test/unit/.gitkeep +0 -0
  79. data/samples/demo-plain/test/unit/helpers/locations_helper_test.rb +4 -0
  80. data/samples/demo-plain/test/unit/helpers/users_helper_test.rb +4 -0
  81. data/samples/demo-plain/test/unit/location_test.rb +7 -0
  82. data/samples/demo-plain/test/unit/user_test.rb +7 -0
  83. data/samples/demo-plain/vendor/assets/javascripts/.gitkeep +0 -0
  84. data/samples/demo-plain/vendor/assets/stylesheets/.gitkeep +0 -0
  85. data/samples/demo-plain/vendor/plugins/.gitkeep +0 -0
  86. data/spec/database.yml.sample +17 -1
  87. metadata +82 -1
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the locations controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,69 @@
1
+ body {
2
+ background-color: #fff;
3
+ color: #333;
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px;
7
+ }
8
+
9
+ p, ol, ul, td {
10
+ font-family: verdana, arial, helvetica, sans-serif;
11
+ font-size: 13px;
12
+ line-height: 18px;
13
+ }
14
+
15
+ pre {
16
+ background-color: #eee;
17
+ padding: 10px;
18
+ font-size: 11px;
19
+ }
20
+
21
+ a {
22
+ color: #000;
23
+ &:visited {
24
+ color: #666;
25
+ }
26
+ &:hover {
27
+ color: #fff;
28
+ background-color: #000;
29
+ }
30
+ }
31
+
32
+ div {
33
+ &.field, &.actions {
34
+ margin-bottom: 10px;
35
+ }
36
+ }
37
+
38
+ #notice {
39
+ color: green;
40
+ }
41
+
42
+ .field_with_errors {
43
+ padding: 2px;
44
+ background-color: red;
45
+ display: table;
46
+ }
47
+
48
+ #error_explanation {
49
+ width: 450px;
50
+ border: 2px solid red;
51
+ padding: 7px;
52
+ padding-bottom: 0;
53
+ margin-bottom: 20px;
54
+ background-color: #f0f0f0;
55
+ h2 {
56
+ text-align: left;
57
+ font-weight: bold;
58
+ padding: 5px 5px 5px 15px;
59
+ font-size: 12px;
60
+ margin: -7px;
61
+ margin-bottom: 0px;
62
+ background-color: #c00;
63
+ color: #fff;
64
+ }
65
+ ul li {
66
+ font-size: 12px;
67
+ list-style: square;
68
+ }
69
+ }
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the users controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,83 @@
1
+ class LocationsController < ApplicationController
2
+ # GET /locations
3
+ # GET /locations.json
4
+ def index
5
+ @locations = Location.all
6
+
7
+ respond_to do |format|
8
+ format.html # index.html.erb
9
+ format.json { render json: @locations }
10
+ end
11
+ end
12
+
13
+ # GET /locations/1
14
+ # GET /locations/1.json
15
+ def show
16
+ @location = Location.find(params[:id])
17
+
18
+ respond_to do |format|
19
+ format.html # show.html.erb
20
+ format.json { render json: @location }
21
+ end
22
+ end
23
+
24
+ # GET /locations/new
25
+ # GET /locations/new.json
26
+ def new
27
+ @location = Location.new
28
+
29
+ respond_to do |format|
30
+ format.html # new.html.erb
31
+ format.json { render json: @location }
32
+ end
33
+ end
34
+
35
+ # GET /locations/1/edit
36
+ def edit
37
+ @location = Location.find(params[:id])
38
+ end
39
+
40
+ # POST /locations
41
+ # POST /locations.json
42
+ def create
43
+ @location = Location.new(params[:location])
44
+
45
+ respond_to do |format|
46
+ if @location.save
47
+ format.html { redirect_to @location, notice: 'Location was successfully created.' }
48
+ format.json { render json: @location, status: :created, location: @location }
49
+ else
50
+ format.html { render action: "new" }
51
+ format.json { render json: @location.errors, status: :unprocessable_entity }
52
+ end
53
+ end
54
+ end
55
+
56
+ # PUT /locations/1
57
+ # PUT /locations/1.json
58
+ def update
59
+ @location = Location.find(params[:id])
60
+
61
+ respond_to do |format|
62
+ if @location.update_attributes(params[:location])
63
+ format.html { redirect_to @location, notice: 'Location was successfully updated.' }
64
+ format.json { head :no_content }
65
+ else
66
+ format.html { render action: "edit" }
67
+ format.json { render json: @location.errors, status: :unprocessable_entity }
68
+ end
69
+ end
70
+ end
71
+
72
+ # DELETE /locations/1
73
+ # DELETE /locations/1.json
74
+ def destroy
75
+ @location = Location.find(params[:id])
76
+ @location.destroy
77
+
78
+ respond_to do |format|
79
+ format.html { redirect_to locations_url }
80
+ format.json { head :no_content }
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,83 @@
1
+ class UsersController < ApplicationController
2
+ # GET /users
3
+ # GET /users.json
4
+ def index
5
+ @users = User.all
6
+
7
+ respond_to do |format|
8
+ format.html # index.html.erb
9
+ format.json { render json: @users }
10
+ end
11
+ end
12
+
13
+ # GET /users/1
14
+ # GET /users/1.json
15
+ def show
16
+ @user = User.find(params[:id])
17
+
18
+ respond_to do |format|
19
+ format.html # show.html.erb
20
+ format.json { render json: @user }
21
+ end
22
+ end
23
+
24
+ # GET /users/new
25
+ # GET /users/new.json
26
+ def new
27
+ @user = User.new
28
+
29
+ respond_to do |format|
30
+ format.html # new.html.erb
31
+ format.json { render json: @user }
32
+ end
33
+ end
34
+
35
+ # GET /users/1/edit
36
+ def edit
37
+ @user = User.find(params[:id])
38
+ end
39
+
40
+ # POST /users
41
+ # POST /users.json
42
+ def create
43
+ @user = User.new(params[:user])
44
+
45
+ respond_to do |format|
46
+ if @user.save
47
+ format.html { redirect_to @user, notice: 'User was successfully created.' }
48
+ format.json { render json: @user, status: :created, location: @user }
49
+ else
50
+ format.html { render action: "new" }
51
+ format.json { render json: @user.errors, status: :unprocessable_entity }
52
+ end
53
+ end
54
+ end
55
+
56
+ # PUT /users/1
57
+ # PUT /users/1.json
58
+ def update
59
+ @user = User.find(params[:id])
60
+
61
+ respond_to do |format|
62
+ if @user.update_attributes(params[:user])
63
+ format.html { redirect_to @user, notice: 'User was successfully updated.' }
64
+ format.json { head :no_content }
65
+ else
66
+ format.html { render action: "edit" }
67
+ format.json { render json: @user.errors, status: :unprocessable_entity }
68
+ end
69
+ end
70
+ end
71
+
72
+ # DELETE /users/1
73
+ # DELETE /users/1.json
74
+ def destroy
75
+ @user = User.find(params[:id])
76
+ @user.destroy
77
+
78
+ respond_to do |format|
79
+ format.html { redirect_to users_url }
80
+ format.json { head :no_content }
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module LocationsHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module UsersHelper
2
+ end
File without changes
File without changes
@@ -0,0 +1,5 @@
1
+ class Location < ActiveRecord::Base
2
+ attr_accessible :name
3
+
4
+ acts_as_taggable_dynamic
5
+ end
@@ -0,0 +1,3 @@
1
+ class User < ActiveRecord::Base
2
+ attr_accessible :name
3
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>DemoPlain</title>
5
+ <%= stylesheet_link_tag "application", :media => "all" %>
6
+ <%= javascript_include_tag "application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,26 @@
1
+ <%= tag_context_form_template(@location) %>
2
+ <%= form_for(@location) do |f| %>
3
+ <% if @location.errors.any? %>
4
+ <div id="error_explanation">
5
+ <h2><%= pluralize(@location.errors.count, "error") %> prohibited this location from being saved:</h2>
6
+
7
+ <ul>
8
+ <% @location.errors.full_messages.each do |msg| %>
9
+ <li><%= msg %></li>
10
+ <% end %>
11
+ </ul>
12
+ </div>
13
+ <% end %>
14
+
15
+ <div class="field">
16
+ <%= f.label :name %><br />
17
+ <%= f.text_field :name %>
18
+ </div>
19
+
20
+ <%= tag_context_form(@location) %>
21
+ <%= tag_context_add(@location) %>
22
+
23
+ <div class="actions">
24
+ <%= f.submit %>
25
+ </div>
26
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing location</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @location %> |
6
+ <%= link_to 'Back', locations_path %>
@@ -0,0 +1,23 @@
1
+ <h1>Listing locations</h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <th>Name</th>
6
+ <th></th>
7
+ <th></th>
8
+ <th></th>
9
+ </tr>
10
+
11
+ <% @locations.each do |location| %>
12
+ <tr>
13
+ <td><%= location.name %></td>
14
+ <td><%= link_to 'Show', location %></td>
15
+ <td><%= link_to 'Edit', edit_location_path(location) %></td>
16
+ <td><%= link_to 'Destroy', location, method: :delete, data: { confirm: 'Are you sure?' } %></td>
17
+ </tr>
18
+ <% end %>
19
+ </table>
20
+
21
+ <br />
22
+
23
+ <%= link_to 'New Location', new_location_path %>
@@ -0,0 +1,5 @@
1
+ <h1>New location</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Back', locations_path %>
@@ -0,0 +1,10 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <b>Name:</b>
5
+ <%= @location.name %>
6
+ </p>
7
+
8
+
9
+ <%= link_to 'Edit', edit_location_path(@location) %> |
10
+ <%= link_to 'Back', locations_path %>
@@ -0,0 +1,21 @@
1
+ <%= form_for(@user) do |f| %>
2
+ <% if @user.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @user.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="actions">
19
+ <%= f.submit %>
20
+ </div>
21
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing user</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @user %> |
6
+ <%= link_to 'Back', users_path %>
@@ -0,0 +1,23 @@
1
+ <h1>Listing users</h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <th>Name</th>
6
+ <th></th>
7
+ <th></th>
8
+ <th></th>
9
+ </tr>
10
+
11
+ <% @users.each do |user| %>
12
+ <tr>
13
+ <td><%= user.name %></td>
14
+ <td><%= link_to 'Show', user %></td>
15
+ <td><%= link_to 'Edit', edit_user_path(user) %></td>
16
+ <td><%= link_to 'Destroy', user, method: :delete, data: { confirm: 'Are you sure?' } %></td>
17
+ </tr>
18
+ <% end %>
19
+ </table>
20
+
21
+ <br />
22
+
23
+ <%= link_to 'New User', new_user_path %>