wontomedia 0.0.2 → 0.1.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/Rakefile CHANGED
@@ -156,7 +156,7 @@ namespace :test do
156
156
  # now some new "umbrella" test tasks
157
157
 
158
158
  desc "Execute all development tests in test/unit."
159
- Rake::TestTask.new(:dev => "db:test:prepare") do |t|
159
+ Rake::TestTask.new(:devs => "db:test:prepare") do |t|
160
160
  t.libs << "test"
161
161
  t.pattern = 'test/unit/**/*_test.rb'
162
162
  t.verbose = true
@@ -170,16 +170,23 @@ namespace :test do
170
170
  ruby File.join( "policy", "ckFilesUtils", "ckCustomizationFilesPresent.rb" )
171
171
  end
172
172
 
173
+ # alias
174
+ task :integrations => :integration
175
+
173
176
  desc "Execute all the tests for Ruby code."
174
- task :ruby => [ "test:dev", "test:dbmigrations", "test:functionals",
175
- "test:integration", "build", "cucumber:static_ok"]
177
+ task :ruby_tests => [ "test:devs", "test:dbmigrations", "test:functionals",
178
+ "test:integrations", "build", "cucumber:static_ok"]
176
179
  end # namespace :test
177
180
 
178
181
 
179
182
 
180
- # redefine Rail's basic test task so that we get a reasonable execution order
183
+ # replace Rail's basic test task so that we get a reasonable execution order
181
184
  Rake::Task[:test].clear!
182
185
  desc 'Run all unit, functional, integration, and policy checks'
183
- task :test => [ "test:policies", "asset:packager:build_all", "test:dev",
184
- "test:dbmigrations", "test:functionals", "test:javascripts",
185
- "test:integration", "build", "cucumber:ok" ]
186
+ task :tests => [ "test:policies", "asset:packager:build_all",
187
+ # above two have side effects necessary for setup
188
+ "test:devs", "test:dbmigrations", "test:functionals",
189
+ "test:javascripts", "test:integrations", "build",
190
+ "cucumber:ok" ]
191
+ # alias
192
+ task :test => :tests
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :minor: 0
3
- :patch: 2
4
2
  :major: 0
3
+ :minor: 1
4
+ :patch: 0
@@ -18,6 +18,7 @@
18
18
  #++
19
19
 
20
20
 
21
+ require Rails.root.join( 'lib', 'helpers', 'item_helper')
21
22
  require 'yaml'
22
23
 
23
24
  # There is no model matching this controller. It is intended to
@@ -28,8 +29,8 @@ class AdminController < ApplicationController
28
29
  # GET /admin/
29
30
  #
30
31
  # This action renders the primary administration page. This page
31
- # includes links to <tt>/items.yaml</tt> and
32
- # <tt>/connections.n3</tt> so that an administrator can download the
32
+ # includes links to <tt>/w/items.yaml</tt> and
33
+ # <tt>/w/connections.n3</tt> so that an administrator can download the
33
34
  # complete content of a wontology for backup. It also includes form
34
35
  # controls for uploading <tt>.yaml</tt> files of Item records and
35
36
  # <tt>.n3</tt> files of Connection records to be added to the
@@ -117,14 +118,14 @@ class AdminController < ApplicationController
117
118
  :flags => 0
118
119
  )
119
120
  if e.nil?
120
- err_stry = "Couldn't create connection for #{$1} #{$2} #{$3}.\n"
121
+ err_str = "Couldn't create connection for #{$1} #{$2} #{$3}.\n"
121
122
  logger.error(err_str)
122
123
  flash[:error] << err_str
123
124
  else
124
125
  if e.save
125
126
  count += 1
126
127
  else
127
- err_stry = "Couldn't save connection for #{$1} #{$2} #{$3}.\n"
128
+ err_str = "Couldn't save connection for #{$1} #{$2} #{$3}.\n"
128
129
  logger.error(err_str)
129
130
  flash[:error] << err_str
130
131
  end
@@ -107,19 +107,19 @@ class ItemsController < ApplicationController
107
107
  render :action => (@popup_flag ? "newpop" : "new" )
108
108
  else
109
109
  if @popup_flag
110
- @connection_list = []; @item_hash = {}; @connection_hash = {}
110
+ @connection_list = []; @item_hash = {};
111
111
  flash.now[:notice] = 'Item was successfully created.'
112
112
  render :action => "show", :layout => "popup"
113
113
  else
114
114
  flash[:notice] = 'Item was successfully created.'
115
- redirect_to item_path(@item)
115
+ redirect_to item_by_name_path(@item.name)
116
116
  end
117
117
  end
118
118
  end
119
119
 
120
120
  # GET /items/1
121
121
  #
122
- # Note that +show+ is capable of rendering in multiple
122
+ # +show+ is capable of rendering in multiple
123
123
  # formats. <tt>/items/1</tt> and <tt>/items/1.html</tt> yield a
124
124
  # human-readable page in HTML markup. <tt>/items/1.json</tt>
125
125
  # renders all fields from the specified Item as JSON-format text,
@@ -128,13 +128,91 @@ class ItemsController < ApplicationController
128
128
  # returned. When a full web page is generated, information is
129
129
  # included about all other Items which are involved in Connections
130
130
  # that directly reference the requested Item.
131
+ #
132
+ # As for all controller actions, 'show' populates instance variables
133
+ # for the view to use in generating the page. However, unlike most
134
+ # of the other controller methods, the data packaging that the show
135
+ # action does for the its view is relatively extensive and several
136
+ # instance variables are created:
137
+ #
138
+ # * *@item* this variable is populated with a single Item object
139
+ # that holds the model for the page being generated
140
+ # * *@item_hash* is a hash that contains additional Item objects
141
+ # that will be required to render the output page. It is indexed
142
+ # with Item.id values.
143
+ # * *@inverses_map* is a hash indexed by Connection objects which
144
+ # contains other Connection objects. Each time 'show' generates a
145
+ # Connection object for one connection that is implied by the
146
+ # existence of another connection involving *@item*, it creates an
147
+ # entry in this hash. The new entry is indexed by the new
148
+ # Connection object (which has no "id" as it has not been saved to
149
+ # the database) and whose value is the Connection object that
150
+ # implies the new connection. This allows the view to create
151
+ # links to an implied connection's "source" connection without
152
+ # having to go back through the database.
153
+ # * *@connection_list* is an _array_ of _arrays_ of Connection.id
154
+ # values. Each array within @connection_list represents a
155
+ # different logically-similar group of connections, and they are
156
+ # expected (although it is really up to the view) to be rendered
157
+ # into the page from top to bottom in the order they occur in the
158
+ # array.
159
+ # - The first array of Connections inside of @connection_list
160
+ # includes all connections that reference *@item* as their
161
+ # subject item, _and_ which have a predicate item that inherits
162
+ # from value_relationship. (Assuming that's a non-empty set.)
163
+ # - The next some-number-of arrays inside of @connection_list
164
+ # contain (some of) the remaining Connections (if any) that
165
+ # reference *@item* as their subject. Connections are grouped
166
+ # together based on their references to a common predicate item:
167
+ # all of the Connections whose subject is *@item* and which have
168
+ # the _same_ value for *predicate_id*. Based on this definition,
169
+ # all of the arrays in this portion of @connection_list will
170
+ # have two or more element Connection objects. The arrays in
171
+ # this group are placed into @connection_list in order based on
172
+ # the number of Connections in the array: larger arrays are
173
+ # sorted ahead of smaller ones.
174
+ # - The next array in @connection_list, assuming there are
175
+ # Connection objects for it, contains any Connections that
176
+ # reference *@item* as their subject that haven't been included
177
+ # in one of the arrays above. Given the above definitions, the
178
+ # view can expect that all of the *predicate_id* values in the
179
+ # Connections in this array will be different.
180
+ # - The next array in @connection_list contains all of the
181
+ # Connection objects whose *object_id* values are equal to
182
+ # *@item*. Like all the other, this array won't be placed into
183
+ # @connection_list if it would be empty. Also, in the event of
184
+ # that a Connection references *@item* as both its subject and
185
+ # object, that Connection will be included in the appropriate
186
+ # one of the preceding arrays. (In generally, the criteria for
187
+ # placing Connections into the individual arrays contained by
188
+ # @connection_list are "greedy"; a Connection will be placed
189
+ # in only one array, and it will be the earliest-generated array
190
+ # for which it qualifies.) Connections are sorted within this
191
+ # array so that ones who share the same *predicate_id* value are
192
+ # in adjacent positions.
193
+ # - The final array that may be in @connection_list includes all
194
+ # of the (remaining) Connections which, given the definitions
195
+ # above, all reference *@item* as their predicate.
196
+ #
197
+ # Before connections are packaged and the items necessary for their
198
+ # display are gathered, the show action will create temporary,
199
+ # not-saved-to-the-database Connection objects to represent
200
+ # connections implied by existing connection that have the current
201
+ # *@item* as their object. This allows implied connections to be
202
+ # included in the list of connections-with-@item-as-subject near the
203
+ # top of the list of *@item*'s connections.
131
204
  def show
132
205
  begin
133
- @item = Item.find(params[:id])
206
+ @item = params[:name].nil? ?
207
+ Item.find(params[:id]) : Item.find_by_name(params[:name])
134
208
  rescue
135
209
  render :file => "#{RAILS_ROOT}/public/404.html", :status => 404
136
210
  return
137
211
  end
212
+ if @item.nil?
213
+ render :file => "#{RAILS_ROOT}/public/404.html", :status => 404
214
+ return
215
+ end
138
216
 
139
217
  if request.format.json?
140
218
  # huge kludge for testability. Need to ensure that we don't respond
@@ -149,6 +227,7 @@ class ItemsController < ApplicationController
149
227
  return
150
228
  end
151
229
 
230
+ # all of the connections we might want to display
152
231
  used_as_subj = Connection.all( :conditions =>
153
232
  [ "subject_id = ?", @item.id ])
154
233
  used_as_pred = Connection.all( :conditions =>
@@ -156,42 +235,52 @@ class ItemsController < ApplicationController
156
235
  used_as_obj = Connection.all( :conditions =>
157
236
  [ "obj_id = ?", @item.id ])
158
237
 
238
+ @inverses_map = {}
239
+ # create Connection objects for any implied connections we want to list
240
+ used_as_obj.each do |connection|
241
+ if inverse_property_id = TrippleNavigation.
242
+ propertys_inverse( connection.predicate_id )
243
+ new_connection = Connection.new(
244
+ :subject_id => connection.obj_id,
245
+ :predicate_id => inverse_property_id,
246
+ :obj_id => connection.subject_id
247
+ )
248
+ used_as_subj << new_connection
249
+ @inverses_map[new_connection] = connection
250
+ end
251
+ end
252
+
253
+ # find all of the Items referenced by the connections the view will list
159
254
  @item_hash = {}
160
- @connection_hash = {}
161
255
  [ used_as_subj, used_as_pred, used_as_obj ].each do |connection_array|
162
256
  connection_array.each do |connection|
163
- unless @connection_hash.has_key? connection.id
164
- @connection_hash[connection.id] = connection
165
- [ connection.subject, connection.predicate, connection.obj ].
166
- each do |item|
167
- unless @item_hash.has_key? item.id
168
- @item_hash[item.id] = item
169
- end
257
+ [ connection.subject, connection.predicate, connection.obj ].
258
+ each do |item|
259
+ unless @item_hash.has_key? item.id
260
+ @item_hash[item.id] = item
170
261
  end
171
262
  end
172
263
  end
173
264
  end
174
265
 
266
+
175
267
  # now that we've got all the connections to display, order and group them
176
268
  # @connection_list should be an array of arrays, each internal array is
177
269
  # a "section" of the display page, containing .id's of connections
178
270
  @connection_list = []
179
-
180
271
  value_id = Item.find_by_name("value_relationship").id
181
272
  spo_id = Item.find_by_name("sub_property_of").id
182
273
 
183
274
  # first group, all connections *from* this item with value-type predicates
184
275
  connections = []
185
- connections_to_delete = []
186
276
  used_as_subj.each do |connection|
187
277
  if TrippleNavigation.check_properties(
188
278
  :does => connection.predicate_id, :via => spo_id,
189
279
  :inherit_from => value_id )
190
- connections << connection.id
191
- connections_to_delete << connection
280
+ connections << connection
192
281
  end
193
282
  end
194
- used_as_subj -= connections_to_delete # done incrementally, breaks iterator
283
+ used_as_subj -= connections # if done incrementally, breaks iterator
195
284
  unless connections.empty?
196
285
  @connection_list << connections
197
286
  end
@@ -208,7 +297,7 @@ class ItemsController < ApplicationController
208
297
  else
209
298
  pred_counts[connection.predicate_id] += 1
210
299
  end
211
- connection_using_pred[connection.predicate_id] = connection.id
300
+ connection_using_pred[connection.predicate_id] = connection
212
301
  end
213
302
  subj_connections = pred_counts.keys
214
303
  subj_connections.sort! { |a,b| pred_counts[b] <=> pred_counts[a] }
@@ -219,7 +308,7 @@ class ItemsController < ApplicationController
219
308
  used_as_subj.each do |connection|
220
309
  # lazy, more hashes would eliminate rescan
221
310
  if connection.predicate_id == predicate_id
222
- connections << connection.id
311
+ connections << connection
223
312
  end
224
313
  end
225
314
  unless connections.empty?
@@ -237,34 +326,38 @@ class ItemsController < ApplicationController
237
326
  end
238
327
 
239
328
 
240
- obj_connections = used_as_obj.map { |connection| connection.id }
241
- obj_connections.sort! do |a,b|
242
- if @connection_hash[a].predicate_id == @connection_hash[b].predicate_id
243
- @connection_hash[a].obj_id <=> @connection_hash[b].obj_id
329
+ used_as_obj.sort! do |a,b|
330
+ if a.predicate_id == b.predicate_id
331
+ a.obj_id <=> b.obj_id
244
332
  else
245
- @connection_hash[a].predicate_id <=> @connection_hash[b].predicate_id
333
+ a.predicate_id <=> b.predicate_id
246
334
  end
247
335
  end
248
- unless obj_connections.empty?
249
- @connection_list << obj_connections
336
+ unless used_as_obj.empty?
337
+ @connection_list << used_as_obj
250
338
  end
251
339
 
252
340
 
253
- pred_connections = used_as_pred.map { |connection| connection.id }
254
- unless pred_connections.empty?
255
- @connection_list << pred_connections
341
+ unless used_as_pred.empty?
342
+ @connection_list << used_as_pred
256
343
  end
257
344
  end
258
345
 
259
346
  # GET /items/1/edit
260
347
  def edit
261
348
  begin
262
- @this_is_non_information_page = true
263
- @item = Item.find(params[:id])
349
+ @item = params[:name].nil? ?
350
+ Item.find(params[:id]) : Item.find_by_name(params[:name])
264
351
  rescue
265
352
  render :file => "#{RAILS_ROOT}/public/404.html", :status => 404
266
353
  return
267
354
  end
355
+ if @item.nil?
356
+ render :file => "#{RAILS_ROOT}/public/404.html", :status => 404
357
+ return
358
+ end
359
+
360
+ @this_is_non_information_page = true
268
361
  end
269
362
 
270
363
  # PUT /items/1
@@ -286,7 +379,7 @@ class ItemsController < ApplicationController
286
379
 
287
380
  if (@item.flags & Item::DATA_IS_UNALTERABLE) != 0
288
381
  flash[:error] = 'This Item cannot be altered.'
289
- redirect_to item_path(@item)
382
+ redirect_to item_by_name_path(@item.name)
290
383
  elsif (!params[:item].nil? && !params[:item][:name].nil? &&
291
384
  params[:item][:name] =~ /[:.]/ ) ||
292
385
  !@item.update_attributes(params[:item])
@@ -295,7 +388,7 @@ class ItemsController < ApplicationController
295
388
  render :action => "edit"
296
389
  else
297
390
  flash[:notice] = 'Item was successfully updated.'
298
- redirect_to item_path(@item)
391
+ redirect_to item_by_name_path(@item.name)
299
392
  end
300
393
  end
301
394
 
@@ -310,13 +403,13 @@ class ItemsController < ApplicationController
310
403
 
311
404
  if (@item.flags & Item::DATA_IS_UNALTERABLE) != 0
312
405
  flash[:error] = 'This Item cannot be altered.'
313
- redirect_to item_path(@item)
406
+ redirect_to item_by_name_path(@item.name)
314
407
  elsif !(Connection.all( :conditions =>
315
408
  [ "subject_id = ? OR predicate_id = ? OR obj_id = ?",
316
409
  @item.id, @item.id, @item.id ]).empty?)
317
410
  flash[:error] = 'This Item is in use by 1+ Connections. ' +
318
411
  'Those must be modified or deleted first.'
319
- redirect_to item_path(@item)
412
+ redirect_to item_by_name_path(@item.name)
320
413
  else
321
414
  @item.destroy
322
415
  redirect_to items_url
@@ -64,4 +64,22 @@ module ConnectionsHelper
64
64
  @delete_help_icon_used = true
65
65
  end
66
66
  end
67
+
68
+ # This method appends its output directly to the page being built.
69
+ # It takes a Connection model instance and creates an HTML link to
70
+ # that connection. It should be used as an alternative to
71
+ # "generate_connection_links()" for those cases where instead of
72
+ # generating links to the Connection the user is looking at, we're
73
+ # generating a link to the Connection that _implied_ whatever the
74
+ # user is looking at. A popup help icon will be added on the first
75
+ # call to generate_inverse_link for a particular page.
76
+ def generate_inverse_link(con)
77
+ concat(
78
+ link_with_help_icon({
79
+ :destination => link_to( 'View source', connection_path(con) ),
80
+ :already_generated => @viewsource_help_icon_used,
81
+ :help_alt => 'Help view source',
82
+ :which_help =>'ConnectionViewSource' }) )
83
+ @viewsource_help_icon_used = true
84
+ end
67
85
  end
@@ -172,4 +172,10 @@ module FormatHelper
172
172
  ''
173
173
  end
174
174
  end
175
+
176
+ def site_content_url( page_name )
177
+ WontoMedia.site_content_url_prefix +
178
+ page_name +
179
+ WontoMedia.site_content_url_postfix
180
+ end
175
181
  end
@@ -33,12 +33,12 @@ module ItemsHelper
33
33
  # argument Item is different from the page's item, then the +title+
34
34
  # will be displayed as a link to _that_ Item's +show+ page.
35
35
  def self_string_or_other_link(item_id)
36
- n = @item_hash[item_id]
37
- title = h filter_parenthetical n.title
36
+ item = @item_hash[item_id]
37
+ title = h filter_parenthetical item.title
38
38
  if item_id == @item.id # self
39
- text_with_tooltip title, h( n.name )
39
+ text_with_tooltip title, h( item.name )
40
40
  else # other
41
- link_with_tooltip title, h( n.name ), item_path(n)
41
+ link_with_tooltip title, h( item.name ), item_by_name_path(item.name)
42
42
  end
43
43
  end
44
44
 
@@ -82,8 +82,8 @@ module ItemsHelper
82
82
  if (item.flags & Item::DATA_IS_UNALTERABLE) == 0
83
83
  concat(
84
84
  link_with_help_icon({
85
- :destination => link_to( 'Edit&hellip;', edit_item_path(item),
86
- :rel => 'nofollow'),
85
+ :destination => link_to( 'Edit&hellip;',
86
+ edit_item_by_name_path(item.name), :rel => 'nofollow'),
87
87
  :already_generated => @edit_help_icon_used,
88
88
  :help_alt => 'Help edit item',
89
89
  :which_help => 'ItemEdit' }) )
@@ -69,6 +69,7 @@
69
69
  </p>
70
70
  <% end %>
71
71
 
72
-
73
-
74
-
72
+ <hr>
73
+ <pre>
74
+ <%= `top -b -n 1` %>
75
+ </pre>
@@ -57,15 +57,18 @@
57
57
  <% content_tag :tr, :id => connection.id do %>
58
58
  <td class='firstrow secondrow'><%=
59
59
  link_with_tooltip "#{h filter_parenthetical connection.subject.title}",
60
- h( connection.subject.name ), item_path(connection.subject) -%></td>
60
+ h( connection.subject.name ),
61
+ item_by_name_path(connection.subject.name) -%></td>
61
62
  <td class='firstrow secondrow'><%=
62
63
  link_with_tooltip(
63
64
  "#{h filter_parenthetical connection.predicate.title}",
64
- h( connection.predicate.name ), item_path(connection.predicate) )
65
+ h( connection.predicate.name ),
66
+ item_by_name_path(connection.predicate.name) )
65
67
  -%></td>
66
68
  <td class='firstrow secondrow'><%=
67
69
  link_with_tooltip "#{h filter_parenthetical connection.obj.title}",
68
- h( connection.obj.name ), item_path(connection.obj) -%></td>
70
+ h( connection.obj.name ), item_by_name_path(connection.obj.name)
71
+ -%></td>
69
72
  <td class='firstrow secondrow' style="font-size: 80%">
70
73
  <% generate_connection_links(connection) %></td>
71
74
  <!--
@@ -43,7 +43,8 @@
43
43
  <tr><td>
44
44
  <b>Subject:</b>
45
45
  </td><td>
46
- <%= link_to "<b>#{h @subject.title}</b>", item_path(@subject) %> &mdash;
46
+ <%= link_to "<b>#{h @subject.title}</b>",
47
+ item_by_name_path(@subject.name) %> &mdash;
47
48
  (<b><%= h @subject.name %></b>)
48
49
  <p>
49
50
  <%= h @subject.description %>
@@ -53,7 +54,8 @@
53
54
  <tr><td>
54
55
  <b>Predicate:</b>
55
56
  </td><td>
56
- <%= link_to "<b>#{h @predicate.title}</b>", item_path(@predicate) %>
57
+ <%= link_to "<b>#{h @predicate.title}</b>",
58
+ item_by_name_path(@predicate.name) %>
57
59
  &mdash; (<b><%= h @predicate.name %></b>)
58
60
  <p>
59
61
  <%= h @predicate.description %>
@@ -63,8 +65,8 @@
63
65
  <tr><td>
64
66
  <b>Object:</b>
65
67
  </td><td>
66
- <%= link_to "<b>#{h @obj.title}</b>", item_path(@obj) %> &mdash;
67
- (<b><%= h @obj.name %></b>)
68
+ <%= link_to "<b>#{h @obj.title}</b>", item_by_name_path(@obj.name) %>
69
+ &mdash; (<b><%= h @obj.name %></b>)
68
70
  <p>
69
71
  <%= h @obj.description %>
70
72
  </p>
@@ -40,7 +40,8 @@
40
40
  <% nouns_listed = 0
41
41
  @nouns.each do |item| %>
42
42
  <p class="item-title">
43
- <%= link_to "#{h filter_parenthetical item.title}", item_path(item) %>
43
+ <%= link_to "#{h filter_parenthetical item.title}",
44
+ item_by_name_path(item.name) %>
44
45
  </p>
45
46
  <p class="item-desc">
46
47
  <% desc = h item.description
@@ -22,7 +22,7 @@
22
22
  <ul>
23
23
  <% if (@item.flags & Item::DATA_IS_UNALTERABLE) == 0 %>
24
24
  <li>
25
- <%= link_to 'Edit this item', edit_item_path(@item),
25
+ <%= link_to 'Edit this item', edit_item_by_name_path(@item.name),
26
26
  :rel => 'nofollow' -%><%=
27
27
  popup_help_icon "Help edit items", "Help:Popup/ItemEdit" -%>
28
28
  </li>
@@ -43,7 +43,7 @@
43
43
  <% end %>
44
44
 
45
45
  <div class="horizontal-link-list"><ul>
46
- <li><%= link_to 'Cancel,&nbsp;show&nbsp;item', item_path(@item),
46
+ <li><%= link_to 'Cancel,&nbsp;show&nbsp;item', item_by_name_path(@item.name),
47
47
  :rel => 'nofollow' -%></li>
48
48
  <li><%= link_to 'Cancel,&nbsp;show&nbsp;item&nbsp;list', items_path,
49
49
  :rel => 'nofollow' -%></li>
@@ -53,7 +53,8 @@
53
53
  <% content_tag :tr, :id => h(item.name) do %>
54
54
  <td class="firstrow"><%= wrap_item_name h item.name -%></td>
55
55
  <td class="firstrow" style="font-weight: bold; width: 62%;">
56
- <%= link_to filter_parenthetical(h item.title), item_path(item) -%></td>
56
+ <%= link_to filter_parenthetical(h item.title),
57
+ item_by_name_path(item.name) -%></td>
57
58
  <td class="firstrow" style="font-size: 80%;">
58
59
  <% generate_item_links(item) %>
59
60
  </td>
@@ -102,11 +102,9 @@
102
102
  connection_array = array_of_arrays_of_connections.next
103
103
 
104
104
  # check ID of first connection's subject item against "this" item's ID
105
- break if @connection_hash[connection_array[0]].subject_id != @item.id
106
-
107
- connection_array.each do |connection_id|
108
- e = @connection_hash[connection_id]
105
+ break if connection_array[0].subject_id != @item.id
109
106
 
107
+ connection_array.each do |connection|
110
108
  unless list_open_output
111
109
  list_open_output = true
112
110
 
@@ -124,28 +122,32 @@
124
122
  <ul style="list-style-type: none;">
125
123
  <% end
126
124
 
127
- if last_predicate_id != e.predicate_id
125
+ if last_predicate_id != connection.predicate_id
128
126
  if last_predicate_id %>
129
127
  </ul>
130
128
  </li>
131
129
  <% end %>
132
130
  <li>
133
- <%= n = @item_hash[e.predicate_id]
134
- link_with_tooltip (h filter_parenthetical n.title ),
135
- h( n.name ), item_path(n) %>
131
+ <%= item = @item_hash[connection.predicate_id]
132
+ link_with_tooltip (h filter_parenthetical item.title ),
133
+ h( item.name ), item_by_name_path(item.name) %>
136
134
  <ul style="list-style-type: circle;">
137
135
  <% end %>
138
136
 
139
137
  <li>
140
138
  <div style="float: right; font-size: 80%; margin-right: 6em;">
141
- <% generate_connection_links(e) %>
139
+ <% if connection.id
140
+ generate_connection_links(connection)
141
+ else
142
+ generate_inverse_link(@inverses_map[connection])
143
+ end %>
142
144
  </div>
143
- <%= n = @item_hash[e.obj_id]
144
- link_with_tooltip (h filter_parenthetical n.title ),
145
- h( n.name ), item_path(n) %>
145
+ <%= item = @item_hash[connection.obj_id]
146
+ link_with_tooltip (h filter_parenthetical item.title ),
147
+ h( item.name ), item_by_name_path(item.name) %>
146
148
  </li>
147
149
 
148
- <% last_predicate_id = e.predicate_id
150
+ <% last_predicate_id = connection.predicate_id
149
151
 
150
152
  end # .each over connection_array
151
153
  end # while over array-of-connection_array's
@@ -181,17 +183,20 @@
181
183
  end %>
182
184
 
183
185
  <tbody>
184
- <% connection_array.each do |connection_id| %>
186
+ <% connection_array.each do |connection| %>
185
187
  <tr>
186
188
  <td>
187
- <%= e = @connection_hash[connection_id]
188
- self_string_or_other_link(e.subject_id) %>
189
+ <%= self_string_or_other_link(connection.subject_id) %>
189
190
  </td><td class="connectioncolumn">
190
- <%= self_string_or_other_link(e.predicate_id) %>
191
+ <%= self_string_or_other_link(connection.predicate_id) %>
191
192
  </td><td>
192
- <%= self_string_or_other_link(e.obj_id) %>
193
+ <%= self_string_or_other_link(connection.obj_id) %>
193
194
  </td><td style="font-size: 80%">
194
- <% generate_connection_links(e) %>
195
+ <% if connection.id
196
+ generate_connection_links(connection)
197
+ else
198
+ generate_inverse_link(@inverses_map[connection])
199
+ end %>
195
200
  </td>
196
201
  </tr>
197
202
  <% end %>