taxonomite 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +30 -0
  3. data/lib/taxonomite.rb +6 -0
  4. data/lib/taxonomite/entity.rb +39 -0
  5. data/lib/taxonomite/exceptions.rb +7 -0
  6. data/lib/taxonomite/node.rb +158 -0
  7. data/lib/taxonomite/taxonomite_configuration.rb +17 -0
  8. data/lib/taxonomite/tree.rb +130 -0
  9. data/lib/taxonomite/version.rb +3 -0
  10. data/spec/controllers/taxonomite/taxonomite_controller_spec.rb +31 -0
  11. data/spec/dummy/README.rdoc +28 -0
  12. data/spec/dummy/Rakefile +6 -0
  13. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  14. data/spec/dummy/app/assets/stylesheets/application.css +19 -0
  15. data/spec/dummy/app/assets/stylesheets/scaffold.css +56 -0
  16. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  17. data/spec/dummy/app/controllers/taxonomite_controller.rb +226 -0
  18. data/spec/dummy/app/helpers/application_helper.rb +13 -0
  19. data/spec/dummy/app/helpers/taxonomite_helper.rb +9 -0
  20. data/spec/dummy/app/views/layouts/application.html.erb +22 -0
  21. data/spec/dummy/app/views/shared/_error_messages.html.erb +14 -0
  22. data/spec/dummy/app/views/shared/_flash_messages.html.erb +9 -0
  23. data/spec/dummy/app/views/taxonomite/_node.html.erb +6 -0
  24. data/spec/dummy/app/views/taxonomite/edit.html.erb +49 -0
  25. data/spec/dummy/app/views/taxonomite/index.html.erb +9 -0
  26. data/spec/dummy/app/views/taxonomite/new.html.erb +16 -0
  27. data/spec/dummy/app/views/taxonomite/show.html.erb +28 -0
  28. data/spec/dummy/bin/bundle +3 -0
  29. data/spec/dummy/bin/rails +4 -0
  30. data/spec/dummy/bin/rake +4 -0
  31. data/spec/dummy/bin/setup +29 -0
  32. data/spec/dummy/config.ru +4 -0
  33. data/spec/dummy/config/application.rb +35 -0
  34. data/spec/dummy/config/boot.rb +5 -0
  35. data/spec/dummy/config/environment.rb +5 -0
  36. data/spec/dummy/config/environments/development.rb +38 -0
  37. data/spec/dummy/config/environments/production.rb +76 -0
  38. data/spec/dummy/config/environments/test.rb +42 -0
  39. data/spec/dummy/config/initializers/assets.rb +11 -0
  40. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  41. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  42. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  43. data/spec/dummy/config/initializers/inflections.rb +16 -0
  44. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  45. data/spec/dummy/config/initializers/mongoid.rb +8 -0
  46. data/spec/dummy/config/initializers/session_store.rb +3 -0
  47. data/spec/dummy/config/initializers/wrap_parameters.rb +10 -0
  48. data/spec/dummy/config/locales/en.yml +23 -0
  49. data/spec/dummy/config/mongoid.yml +103 -0
  50. data/spec/dummy/config/routes.rb +10 -0
  51. data/spec/dummy/config/secrets.yml +22 -0
  52. data/spec/dummy/lib/tasks/db_populate.rake +66 -0
  53. data/spec/dummy/lib/util.rb +28 -0
  54. data/spec/dummy/log/development.log +7169 -0
  55. data/spec/dummy/log/test.log +915 -0
  56. data/spec/dummy/public/404.html +67 -0
  57. data/spec/dummy/public/422.html +67 -0
  58. data/spec/dummy/public/500.html +66 -0
  59. data/spec/dummy/public/favicon.ico +0 -0
  60. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/-rejHCRn0GBGCrHMyZAcq10cNOCXaG4dVN13pFMvLgA.cache +0 -0
  61. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/1TWMTorbA_3E6hatKbP5T9n5oDSeVMk68LF8CRn1JjI.cache +1 -0
  62. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/3B4hMNppXANClZ-lGO7Jps_MbXOz_GLxSqnastPo3Sg.cache +0 -0
  63. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/8H7HwvVynNVZNgOjRJ5eAUqlWB8-oDl9VwBJlQSTBQw.cache +2 -0
  64. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/8y77NTXIYLg5cxm011nNxQAil9n5WVHkcp3HuxsFBMY.cache +0 -0
  65. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/AmhMJ3oocG6mNJTk0T7UZTZNv6MhN1nj2WL-k__XZlI.cache +1 -0
  66. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/CbVJZSB6kte1IYJqiASuO95NmINClhlHaFdLKMor0c0.cache +1 -0
  67. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/D05VjCHQqo1_JqnZLVivHPybbW2MCDXAQTDeLMBqYIQ.cache +2 -0
  68. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/GalDJvDt8BphTIma_xp93plZ7ay3K9A9uJk3txZw_00.cache +0 -0
  69. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/HMK_AuhVBxFLR6tGFGS75xvUQp8JlDZBwUddr14DleY.cache +1 -0
  70. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Hac0rR46nAtlqEtr6S-s7g79TUGQAKO_jxYLbyARW4k.cache +0 -0
  71. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/IygAr9Ty7v-NJrroesXGkla15XgRR3nUI7BVZaPZigk.cache +0 -0
  72. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/K46UGuIKOnMfRnYBSmbjd8UJ9LfdCS5OBhkXG00GCvY.cache +1 -0
  73. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/KVHAw7mbk0REIRf0Zrv40JhknZB1lVmcExhj4bfZduY.cache +0 -0
  74. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/LhBEGJtsniGETE6aGB-IrzlM_CxS6iAfBviyrUM2AvA.cache +0 -0
  75. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/PzbUQc7wYDmhK5RZzXNRAHPhpwryEK2aIRRUfbsFMjw.cache +1 -0
  76. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Q2QIHypAobobCW8WZnDEKFQqFczCiXaPAf3Hgk9MA_o.cache +1 -0
  77. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/RnBEbAuuDsDqp3JRLnX8pp-IHFk1d1rGbXxYy6DhkY4.cache +1 -0
  78. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/TIm2-xmbi7CMNL3syzvG5LyRxJtycIGXtwz8Mco3sdA.cache +0 -0
  79. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/U-xdOqbEKMZubNF_Mq_pBnN5uGgDj_w3I9193KH2XIE.cache +1 -0
  80. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/ZEWFmXe3i1eUOHbMoM_K0-6G0ejgZCWT3qF9dyjYEzQ.cache +0 -0
  81. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/_k3G10-SEe8_SHlmwYbslXN42uDRmFGK0Q7nR3VyH7s.cache +2 -0
  82. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/bkkgBW_hSRUeyxOZ8u-7Artvy3oCRMUtd0iTsd8wrtk.cache +0 -0
  83. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/bpttkziOegeD-17ihmHMccaVxwU9_YMeXXsmFpQQh2E.cache +1 -0
  84. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/c0embYAEeyo6qdjqQ-b8QNzuj70uZn-q1c-dhX4aeaQ.cache +0 -0
  85. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/dbpC0p6RBdyEjXhOxUegedCy8aK12GwuakY1DqzSB1k.cache +1 -0
  86. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/exOsm6yrmkOg_T82Brjsyr-e2U5HAJCqiPy1NJjPBJg.cache +0 -0
  87. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/f7S__u6qEm3h40_nJwEAwibtxI3vV-uWkuJAdnyIEho.cache +0 -0
  88. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/lEOEeQNsy0n89Y25rZEAe5P6zFLjkhRpxQ2ZEfi_giM.cache +1 -0
  89. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/m_RzwKTs1azS37mZ7W1stXJCfGBM4xF-Pge7trJaXhY.cache +1 -0
  90. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/nMQn6BRwxARa2nhmNQEdm_5xj6tr2XYpLzE_7Eac2h4.cache +1 -0
  91. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/nl0sTVgLFpHD_1Q4c8NGcatzmud7AWL6yin3iSgziRc.cache +2 -0
  92. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/rKpLfQIjRPLcR43VeI7lwjxj1BWPcxjVoSyDmJru04o.cache +1 -0
  93. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/rhofdc-dVgpC_YOqzpz2yMRHD9LW4sIGBcPdzR-uM6E.cache +1 -0
  94. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/sjZWL1ZezAb-_PmJJS_5mi-Q9X1Jcic0D7F33sUC3vs.cache +0 -0
  95. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/tLUV7eduShLmpqrXfsgemL-zKEBEQQDdqUw-MGoqMA0.cache +0 -0
  96. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/uYLC0l4_HXjqNdRF2mvEqpdcIsQgz0XVMe9YxQ3dnlc.cache +1 -0
  97. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/voPvH6F_x-d5fK63I1IjMzEfTcybOHN-g9q3x4BIGGw.cache +1 -0
  98. data/spec/factories/entity.rb +13 -0
  99. data/spec/factories/taxonomy_taxon.rb +45 -0
  100. data/spec/models/taxonomite/entity_spec.rb +34 -0
  101. data/spec/models/taxonomite/hierarchy_spec.rb +34 -0
  102. data/spec/models/taxonomite/model_spec.rb +39 -0
  103. data/spec/models/taxonomite/taxonomite_spec.rb +11 -0
  104. data/spec/models/taxonomite/tree_spec.rb +56 -0
  105. data/spec/models/taxonomite/zoology.rb +119 -0
  106. data/spec/rails_helper.rb +53 -0
  107. data/spec/spec_helper.rb +32 -0
  108. data/spec/taxonomite_helper.rb +5 -0
  109. data/spec/views/taxonomite/taxonomite/index.html.erb_spec.rb +5 -0
  110. data/spec/views/taxonomite/taxonomite/show.html.erb_spec.rb +5 -0
  111. metadata +456 -0
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,19 @@
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 any plugin's vendor/assets/stylesheets directory 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 bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
16
+
17
+ .nested_place {
18
+ margin-left: 30px;
19
+ }
@@ -0,0 +1,56 @@
1
+ body { background-color: #fff; color: #333; }
2
+
3
+ body, p, ol, ul, td {
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px;
7
+ }
8
+
9
+ pre {
10
+ background-color: #eee;
11
+ padding: 10px;
12
+ font-size: 11px;
13
+ }
14
+
15
+ a { color: #000; }
16
+ a:visited { color: #666; }
17
+ a:hover { color: #fff; background-color:#000; }
18
+
19
+ div.field, div.actions {
20
+ margin-bottom: 10px;
21
+ }
22
+
23
+ #notice {
24
+ color: green;
25
+ }
26
+
27
+ .field_with_errors {
28
+ padding: 2px;
29
+ background-color: red;
30
+ display: table;
31
+ }
32
+
33
+ #error_explanation {
34
+ width: 450px;
35
+ border: 2px solid red;
36
+ padding: 7px;
37
+ padding-bottom: 0;
38
+ margin-bottom: 20px;
39
+ background-color: #f0f0f0;
40
+ }
41
+
42
+ #error_explanation h2 {
43
+ text-align: left;
44
+ font-weight: bold;
45
+ padding: 5px 5px 5px 15px;
46
+ font-size: 12px;
47
+ margin: -7px;
48
+ margin-bottom: 0px;
49
+ background-color: #c00;
50
+ color: #fff;
51
+ }
52
+
53
+ #error_explanation ul li {
54
+ font-size: 12px;
55
+ list-style: square;
56
+ }
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
@@ -0,0 +1,226 @@
1
+ require_dependency "application_controller"
2
+ require 'mongoid'
3
+ require 'taxonomite/node'
4
+ include Taxonomite
5
+
6
+ class TaxonomiteController < ApplicationController
7
+
8
+ def index
9
+ @nodes = Node.all
10
+ end
11
+
12
+ def new
13
+ @node = Node.new
14
+ end
15
+
16
+ def destroy
17
+ poop
18
+ @node = Node.find(params)
19
+ poop
20
+ if @node != nil
21
+ @node.delete
22
+ flash[:message] = "Deleted #{@node.name}"
23
+ redirect_to :action => :index
24
+ else
25
+ redirect_to :action => :edit, :id => params[:id], :error => "Unable to find node #{:id}"
26
+ end
27
+ end
28
+
29
+ def create
30
+ @node = Node.new(node_params)
31
+ if @node.save
32
+ redirect_to :action => 'show', :id => @node.id, :notice => "Created #{@node.name}"
33
+ else
34
+ render 'new'
35
+ end
36
+ rescue Moped::Errors::OperationFailure => err
37
+ # check for the appropriate error message indicating a duplicate index
38
+ if err.message =~ /11000/
39
+ @nodes.errors.add(:node_name, "alread exists for another node")
40
+ else
41
+ @nodes.errors.add(:base, err.message)
42
+ end
43
+
44
+ render 'new'
45
+ end
46
+
47
+ def show
48
+ # must have a valid :id to show that
49
+ if params[:id] == nil
50
+ flash[:message] = "No such node in database"
51
+ render 'index'
52
+ return
53
+ end
54
+
55
+ # try to find the node, but catch if the node cannot be found
56
+ @node = Node.find(params[:id])
57
+
58
+ rescue ::Mongoid::Errors::DocumentNotFound => err
59
+ flash[:error] = "No such node in database."
60
+ render 'index'
61
+ rescue ::Moped::Errors::OperationFailure => err
62
+ # check for the appropriate error message indicating a duplicate index
63
+ # if err.message =~ /name_index/
64
+ # @node.errors.add(:email, "already exists for another account")
65
+ # else
66
+ # @node.errors.add(:base, err.message)
67
+ # end
68
+ flash[:message] = "Duplicate entry for node"
69
+
70
+ render 'index'
71
+ end
72
+
73
+ def edit
74
+ # try to find the node, but catch if the node cannot be found
75
+ @node = Node.find(params[:id])
76
+
77
+ rescue ::Mongoid::Errors::DocumentNotFound => err
78
+ flash[:error] = "No such node in database."
79
+ render 'index'
80
+ rescue ::Moped::Errors::OperationFailure => err
81
+ # check for the appropriate error message indicating a duplicate index
82
+ # if err.message =~ /name_index/
83
+ # @node.errors.add(:email, "already exists for another account")
84
+ # else
85
+ # @node.errors.add(:base, err.message)
86
+ # end
87
+ flash[:message] = "Duplicate entry for node"
88
+
89
+ render 'index'
90
+ end
91
+
92
+ def update
93
+ # try to find the node, but catch if the node cannot be found
94
+ @node = Node.find(params[:id])
95
+ if @node.update_attributes(node_params)
96
+ if @node.save
97
+ redirect_to :action => 'show', :id => @node.id, :notice => "Created #{@node.name}"
98
+ else
99
+ redirect_to(:action => 'show', :id => @node.id, :error => "Utter failure".red)
100
+ end
101
+ else
102
+ puts "BAD NEWS".red.bold
103
+ render 'edit'
104
+ end
105
+
106
+ rescue ::Mongoid::Errors::DocumentNotFound => err
107
+ flash[:error] = "No such node in database."
108
+ render 'edit'
109
+ rescue ::Moped::Errors::OperationFailure => err
110
+ # check for the appropriate error message indicating a duplicate index
111
+ # if err.message =~ /name_index/
112
+ # @node.errors.add(:email, "already exists for another account")
113
+ # else
114
+ # @node.errors.add(:base, err.message)
115
+ # end
116
+ flash[:message] = "Duplicate entry for node"
117
+
118
+ render 'edit'
119
+ end
120
+
121
+ def addchild
122
+ @node = Node.find(params[:id])
123
+ if @node
124
+ child = Node.find(params[:node])
125
+ if child
126
+ if do_addchild(child)
127
+ if @node.save()
128
+ flash[:message] = "#{child.name} added to #{@node.name}"
129
+ else
130
+ flash[:error] = "unable to save #{@node.name}, after attempted addition of child #{child.name}"
131
+ end
132
+ else
133
+ flash[:error] = "unable to add #{child.name} to #{@node.name}"
134
+ end
135
+ else
136
+ flash[:error] = "could not find child #{:node.id}"
137
+ end
138
+ else
139
+ flash[:error] = "could not find node, corresponding to #{:id}"
140
+ end
141
+ # ?? no need to redirect, right? - fall back to page (i.e. edit)
142
+
143
+ render 'edit'
144
+
145
+ # this should not happen if raise_not_found_error = false in mongoid.yml
146
+ rescue ::Mongoid::Errors::DocumentNotFound => err
147
+ flash[:error] = "No such node in database."
148
+ render 'edit'
149
+ end
150
+
151
+ def remchild
152
+ @node = Node.find(params[:id])
153
+ if @node
154
+ child = Node.find(params[:node])
155
+ if child
156
+ if do_remchild(child)
157
+ # !! deprecated if @node.remove_child(child)
158
+ if @node.save()
159
+ flash[:message] = "#{child.name} removed from #{@node.name}"
160
+ else
161
+ flash[:error] = "unable to save #{@node.name}, after attempted removal of child #{child.name}"
162
+ end
163
+ else
164
+ flash[:error] = "unable to remove #{child.name} from #{@node.name}"
165
+ end
166
+ else
167
+ flash[:error] = "could not find child #{:node.id} in #{@node.name}"
168
+ end
169
+ else
170
+ flash[:error] = "could not find node, corresponding to #{:id}"
171
+ end
172
+ # ?? no need to redirect, right? - fall back to page (i.e. edit)
173
+
174
+ render 'edit'
175
+
176
+ # this should not happen if raise_not_found_error = false in mongoid.yml
177
+ rescue ::Mongoid::Errors::DocumentNotFound => err
178
+ flash[:error] = "No such node in database."
179
+ render 'edit'
180
+ end
181
+
182
+ def breakparent
183
+ @node = Node.find(params[:id])
184
+ if @node
185
+ # this could be made more complex so as to avoid specifying whether there is or
186
+ # is not a single parent (not enforcing tree structure in the controller)
187
+ do_remparent
188
+ else
189
+ flash[:error] = "could not find node, corresponding to #{:id}"
190
+ end
191
+
192
+ render 'edit'
193
+
194
+ rescue ::Mongoid::Errors::DocumentNotFound => err
195
+ flash[:error] = "No such node in database."
196
+ render 'edit'
197
+ end
198
+
199
+ private
200
+ # actual method is hidden to keep hidden
201
+ def do_addchild(ch)
202
+ @node.children << ch
203
+ end
204
+
205
+ def do_remchild(ch)
206
+ @node.children.delete(ch)
207
+ end
208
+
209
+ def do_remparent
210
+ @node.parent.delete(@node)
211
+ end
212
+
213
+ def node_params
214
+ params.require(:taxonomite_node).permit(:name, :description)
215
+ end
216
+
217
+ def add_params
218
+ params.require(:node)
219
+ params.permit(:addid)
220
+ end
221
+
222
+ def rem_params
223
+ params.require(:node)
224
+ params.permit(:remid)
225
+ end
226
+ end
@@ -0,0 +1,13 @@
1
+ module ApplicationHelper
2
+ def register_flash_message(key,message)
3
+ flash[key]=message
4
+ end
5
+
6
+ def display_flash_messages()
7
+ render 'shared/flash_messages', :messages => flash
8
+ end
9
+
10
+ def display_flash_errors()
11
+ render 'shared/error_messages'
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ module TaxonomiteHelper
2
+
3
+ def recurs_nodes(nodes)
4
+ nodes.each do |n|
5
+ render partial: 'node', locals: { node: n }
6
+ end
7
+ end
8
+
9
+ end
@@ -0,0 +1,22 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= display_flash_messages %>
12
+ <%= display_flash_errors %>
13
+
14
+ <%= yield %>
15
+
16
+ <ul>
17
+ <li><%= link_to "Select a Taxon", taxonomite_index_path %></li>
18
+ <li><%= link_to "Create a new Taxon", new_taxonomite_path %></li>
19
+ </ul>
20
+
21
+ </body>
22
+ </html>
@@ -0,0 +1,14 @@
1
+
2
+ <% if @place %>
3
+ <% if @place.errors.any? %>
4
+ <div class="error messages">
5
+ <ul>
6
+ <div id="error_explanation">
7
+ <% for message in @place.errors.full_messages %>
8
+ <li><%= message %></li>
9
+ <% end %>
10
+ </div>
11
+ </ul>
12
+ </div>
13
+ <% end %>
14
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <div class="flash-messages">
2
+ <% if messages %>
3
+ <% messages.each do |key, message| %>
4
+ <%= content_tag :div, message, :id => "flash_${name}" %>
5
+ <% end %>
6
+ <% else %>
7
+ No Messages to display
8
+ <% end %>
9
+ </div>
@@ -0,0 +1,6 @@
1
+ <li><%= link_to "#{node.typeifiedname} (#{node.entity_type})", taxonomite_path(node) %></li>
2
+ <% if node.has_children? %>
3
+ <div class="nested_node">
4
+ <%= render partial: 'node', collection: node.children, as: :node %>
5
+ </div>
6
+ <% end %>
@@ -0,0 +1,49 @@
1
+ <h2> Edit a node</h2>
2
+ <% if @node %>
3
+ <ul>
4
+ <%= form_for @node, :url => { :action => :update } do |f| %>
5
+ <%= f.label :name, "Name:" %>
6
+ <%= f.text_field :name %> <br />
7
+ <p><%= f.label :description, "Description:" %>
8
+ <div verticalalign="top">
9
+ <p><%= f.text_area :description, :rows => 5, :cols => 50 %><p/>
10
+ </div>
11
+ </p>
12
+ <p><%= f.submit "Submit", :disable_with => 'Submitting...' %></p>
13
+ <% end %>
14
+ </ul>
15
+ <%= link_to "Delete #{@node.name}.", controller: :taxonomite, action: :destroy, id: @node.id %>
16
+ <ul>
17
+
18
+ </ul>
19
+
20
+ <% if @node.parent %>
21
+ <h3>Parent:</h3>
22
+ <ul>
23
+ <li><%= link_to @node.parent.name, taxonomite_path(@node.parent) %>
24
+ <%= link_to 'break', ['node', :breakparent, :id => @node] %></li>
25
+ </ul>
26
+ <% end %>
27
+
28
+ <% if @node.children.length > 0 %>
29
+ <h3>Children:</h3>
30
+ <ul>
31
+ <% for child in @node.children do %>
32
+ <li><%= link_to child.name, taxonomite_path(child.id) %>
33
+ <%= link_to 'Remove', ['node', :remchild, :node => child] %></li>
34
+ <% end %>
35
+ </ul>
36
+ <% end %>
37
+
38
+ <h3>Add children:</h3>
39
+ <ul>
40
+ <% for p in Taxonomite::Taxon.all.each do %>
41
+ <% unless p == @node || @node.children.find(p) %>
42
+ <li><%= p.name %> (<%= p.entity_type %>) -- <%= link_to 'Add', ['node', :addchild, :node => p] %></li>
43
+ <% end %>
44
+ <% end %>
45
+ </ul>
46
+
47
+ <% else %>
48
+ <p>Unable to find a node.</p>
49
+ <% end %>