wontomedia 0.1.1 → 0.2.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.
Files changed (49) hide show
  1. data/Rakefile +9 -5
  2. data/VERSION.yml +2 -2
  3. data/app/controllers/admin_controller.rb +34 -11
  4. data/app/controllers/connections_controller.rb +8 -2
  5. data/app/controllers/items_controller.rb +213 -68
  6. data/app/helpers/format_helper.rb +22 -1
  7. data/app/helpers/items_helper.rb +43 -0
  8. data/app/models/connection.rb +128 -100
  9. data/app/models/item.rb +96 -0
  10. data/app/views/connections/_spo_select_controls.html.erb +65 -31
  11. data/app/views/connections/edit.html.erb +7 -2
  12. data/app/views/connections/index.html.erb +11 -4
  13. data/app/views/connections/show.html.erb +13 -5
  14. data/app/views/items/_class_select.html.erb +41 -0
  15. data/app/views/items/_content_examples.html.erb +21 -18
  16. data/app/views/items/_core_tasks.html.erb +40 -5
  17. data/app/views/items/_form_fields.html.erb +4 -4
  18. data/app/views/items/_inline_item_add_form.html.erb +48 -0
  19. data/app/views/items/_inline_scalar_add_form.html.erb +36 -0
  20. data/app/views/items/_most_populous_classes.html.erb +42 -0
  21. data/app/views/items/_type_select.html.erb +28 -26
  22. data/app/views/items/edit.html.erb +8 -2
  23. data/app/views/items/index.html.erb +5 -1
  24. data/app/views/items/new.html.erb +69 -54
  25. data/app/views/items/newpop.html.erb +18 -3
  26. data/app/views/items/show.html.erb +110 -7
  27. data/app/views/layouts/application.html.erb +2 -2
  28. data/app/views/layouts/base.html.erb +4 -2
  29. data/app/views/layouts/home.html.erb +2 -2
  30. data/assets/wontomedia-sample.rb +2 -0
  31. data/config/asset_packages.yml +1 -0
  32. data/config/cucumber.yml +11 -13
  33. data/db/fixtures/connections.yml +85 -4
  34. data/db/fixtures/items.yml +140 -8
  35. data/db/migrate/20100315135952_provide_scalar_objects.rb +32 -0
  36. data/db/migrate/20100321042343_add_timestamp_columns.rb +33 -0
  37. data/db/schema.rb +17 -11
  38. data/default-custom/app/views/items/home.html.erb +1 -1
  39. data/default-custom/public/stylesheets/wm.css +21 -4
  40. data/lib/helpers/connection_helper.rb +84 -1
  41. data/lib/helpers/item_helper.rb +16 -3
  42. data/lib/tasks/cucumber.rake +0 -2
  43. data/public/images/transparent_ltblue_background.png +0 -0
  44. data/public/images/{alert_background.png → transparent_white_background.png} +0 -0
  45. data/public/javascripts/forConnectionsForms.js +182 -41
  46. data/public/javascripts/forItemsForms.js +40 -5
  47. data/public/javascripts/forItemsShow.js +27 -0
  48. data/public/javascripts/itemCreatePopup.js +10 -3
  49. metadata +13 -5
@@ -18,27 +18,32 @@
18
18
  %>
19
19
 
20
20
 
21
- <script type="text/javascript">
22
- function sizeDescDiv(name){
23
- var h = document.viewport.getHeight() / 6;
24
- $(name + "_desc").style.height = h + "px";
25
- var w = $("connection_" + name + "_id").getWidth();
26
- $(name + "_desc").style.width = w + "px";
27
- }
28
- </script>
29
- <style>
30
- div {
31
- overflow: auto;
32
- }
33
- div.desc {
34
- display: table-cell;
35
- text-align: center;
36
- vertical-align: middle;
37
- }
38
- div p {
39
- margin-top: 0.5ex;
40
- }
41
- </style>
21
+ <% content_for :head do %>
22
+ <style>
23
+ div {
24
+ overflow: auto;
25
+ }
26
+ div.desc {
27
+ display: table-cell;
28
+ text-align: center;
29
+ vertical-align: middle;
30
+ }
31
+ div p {
32
+ margin-top: 0.5ex;
33
+ }
34
+ </style>
35
+ <script type="text/javascript">
36
+ // <![CDATA[
37
+ function setDescDivsHeights(names){
38
+ for (var c=0; c < names.length; c++){
39
+ var descDiv = document.getElementById(names[c] + "_desc");
40
+ var h = document.viewport.getHeight() / 8;
41
+ descDiv.style.height = h + "px";
42
+ }
43
+ }
44
+ // ]]>
45
+ </script>
46
+ <% end %>
42
47
 
43
48
 
44
49
  <p class="directions">
@@ -49,7 +54,7 @@
49
54
  </p>
50
55
 
51
56
  <table>
52
- <tr><td style="text-align: right">
57
+ <tr><td style="text-align: right; font-weight: bold;">
53
58
  <%= f.label :subject_id %>
54
59
  </td><td>
55
60
  <%= select_tag "connection[subject_id]",
@@ -82,9 +87,9 @@
82
87
  <p><%= h connection.subject.description %></p>
83
88
  <% end %>
84
89
  </div>
85
- <script type="text/javascript">sizeDescDiv('subject');</script>
90
+ <script type="text/javascript">setDescDivsHeights(['subject']);</script>
86
91
  </td></tr>
87
- <tr><td style="text-align: right">
92
+ <tr><td style="text-align: right; font-weight: bold;">
88
93
  <%= f.label :predicate_id,"Relates to" %>
89
94
  </td><td>
90
95
  <%= select_tag "connection[predicate_id]",
@@ -114,11 +119,40 @@
114
119
  <p><%= h connection.predicate.description %></p>
115
120
  <% end %>
116
121
  </div>
117
- <script type="text/javascript">sizeDescDiv('predicate');</script>
122
+ <script type="text/javascript">setDescDivsHeights(['predicate']);</script>
118
123
  </td></tr>
119
- <tr><td style="text-align: right">
120
- <%= f.label :obj_id, "Object" %>
124
+ <tr><td style="text-align: right;">
125
+ <%= popup_help_icon "Help for connection's subject selection",
126
+ "Help:Popup/ConnectionObjectSelection" %>
127
+ <span style="font-weight: bold;"><%= f.label :obj_id, "Object" %></span>
128
+ <div style="text-aight: right; overflow: visible;">
129
+ <%= image_tag "blank_error_icon.png", :id=>"kind_of_obj_error_icon",
130
+ :alt=>"", :size=>"16x16",
131
+ :style=>"position: relative; left: 0.75em;" %>
132
+ </div>
133
+
121
134
  </td><td>
135
+ <!-- first radio button and text field for object-is-scalar -->
136
+ <%=
137
+ radio_button "connection", "kind_of_obj", 'scalar', :tabindex => '30'
138
+ -%><span style="font-size: 75%;"><%=
139
+ f.label :kind_of_obj, "Value", :value => 'scalar'
140
+ -%></span>
141
+ <%= text_field :connection, :scalar_obj, :size => 30, :tabindex => '34' %>
142
+ <%= popup_help_icon "Help for connection's object selection",
143
+ "Help:Popup/ConnectionObjectScalar" %>
144
+ <span style="padding-left: 4em; font-weight: bold; font-style: italic;"
145
+ >or</span>
146
+
147
+ <br />
148
+
149
+ <!-- then radio button and select control for object-is-item -->
150
+ <%=
151
+ radio_button "connection", "kind_of_obj", 'item', :tabindex => '30'
152
+ -%><span style="font-size: 75%;"><%=
153
+ f.label :kind_of_obj, "Item", :value => 'item'
154
+ -%></span>
155
+ <br />
122
156
  <%= select_tag "connection[obj_id]",
123
157
  options_for_select(
124
158
  [[ "- to this object -", "" ],
@@ -129,12 +163,12 @@
129
163
  end,
130
164
  connection.obj.nil? ? "" : connection.obj.id
131
165
  ),
132
- :tabindex=>'30', :style=>'width: 90%;'
166
+ :tabindex=>'35', :style=>'width: 90%;'
133
167
  %>
134
168
  <%= popup_help_icon "Help for connection's object selection",
135
- "Help:Popup/ConnectionObject" %>
169
+ "Help:Popup/ConnectionObjectItem" %>
136
170
  <%= image_tag "blank_error_icon.png", :id=>"obj_error_icon", :alt=>"",
137
- :size=>"16x16" %>
171
+ :size=>"16x16", :style=>"position: relative; bottom: 3.2ex;" %>
138
172
 
139
173
  <!-- start 'div' differently depending on 'if' -->
140
174
  <% if connection.obj.nil? %>
@@ -146,6 +180,6 @@
146
180
  <p><%= h connection.obj.description %></p>
147
181
  <% end %>
148
182
  </div>
149
- <script type="text/javascript">sizeDescDiv('obj');</script>
183
+ <script type="text/javascript">setDescDivsHeights(['obj']);</script>
150
184
  </td></tr>
151
185
  </table>
@@ -25,8 +25,13 @@
25
25
 
26
26
  <%
27
27
  @title_text = (h @connection.subject.name) + " : " +
28
- (h @connection.predicate.name) + " : " +
29
- (h @connection.obj.name)
28
+ (h @connection.predicate.name) + " : "
29
+ if @connection.kind_of_obj == Connection::OBJECT_KIND_ITEM
30
+ @title_text += (h @connection.obj.name)
31
+ else
32
+ @title_text += "'#{h @connection.scalar_obj}'"
33
+ end
34
+ @window_title_addendum = " (Edit)"
30
35
 
31
36
  # initialize array to define "Glossary Help" box of links:
32
37
  @glossary_help_entries = [
@@ -65,10 +65,17 @@
65
65
  h( connection.predicate.name ),
66
66
  item_by_name_path(connection.predicate.name) )
67
67
  -%></td>
68
- <td class='firstrow secondrow'><%=
69
- link_with_tooltip "#{h filter_parenthetical connection.obj.title}",
70
- h( connection.obj.name ), item_by_name_path(connection.obj.name)
71
- -%></td>
68
+ <td class='firstrow secondrow'>
69
+ <% if connection.kind_of_obj == Connection::OBJECT_KIND_ITEM %>
70
+ <%= link_with_tooltip(
71
+ "#{h filter_parenthetical connection.obj.title}",
72
+ h( connection.obj.name ),
73
+ item_by_name_path(connection.obj.name) )
74
+ -%>
75
+ <% else %>
76
+ <%= h connection.scalar_obj %>
77
+ <% end %>
78
+ </td>
72
79
  <td class='firstrow secondrow' style="font-size: 80%">
73
80
  <% generate_connection_links(connection) %></td>
74
81
  <!--
@@ -20,8 +20,12 @@
20
20
 
21
21
  <%
22
22
  @title_text = (h @subject.name) + " : " +
23
- (h @predicate.name) + " : " +
24
- (h @obj.name)
23
+ (h @predicate.name) + " : "
24
+ if @connection.kind_of_obj == Connection::OBJECT_KIND_ITEM
25
+ @title_text += (h @obj.name)
26
+ else
27
+ @title_text += "'#{h @connection.scalar_obj}'"
28
+ end
25
29
 
26
30
  # initialize array to define "Glossary Help" box of links:
27
31
  @glossary_help_entries = [
@@ -65,11 +69,15 @@
65
69
  <tr><td>
66
70
  <b>Object:</b>
67
71
  </td><td>
72
+ <% if @connection.kind_of_obj == Connection::OBJECT_KIND_ITEM %>
68
73
  <%= link_to "<b>#{h @obj.title}</b>", item_by_name_path(@obj.name) %>
69
74
  &mdash; (<b><%= h @obj.name %></b>)
70
- <p>
71
- <%= h @obj.description %>
72
- </p>
75
+ <p>
76
+ <%= h @obj.description %>
77
+ </p>
78
+ <% else %>
79
+ <%= h @connection.scalar_obj %>
80
+ <% end %>
73
81
  </td></tr>
74
82
  </table>
75
83
 
@@ -0,0 +1,41 @@
1
+ <%
2
+ # WontoMedia - a wontology web application
3
+ # Copyright (C) 2010 - Glen E. Ivey
4
+ # www.wontology.com
5
+ #
6
+ # This program is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU Affero General Public License version
8
+ # 3 as published by the Free Software Foundation.
9
+ #
10
+ # This program is distributed in the hope that it will be useful, but
11
+ # WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Affero General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Affero General Public License
16
+ # along with this program in the file COPYING and/or LICENSE. If not,
17
+ # see "http://www.gnu.org/licenses/".
18
+ %>
19
+
20
+ <%
21
+ # there ought to be a more idiomatic Rails way to get the right
22
+ # name/id on this, but I haven't been able to find it....
23
+ child_class_prefix = (@item.class == Item) ? '' :
24
+ ItemHelper::ITEM_CLASSNAME_TO_SUBTYPE_SHORT[@item.class.to_s] + "_"
25
+ %>
26
+
27
+ <% if show_class_control %>
28
+ <p class="inputpara">
29
+ <%= f.label :class_item_id, "Class" %>
30
+ <%= popup_help_icon "Help for class", "Help:Popup/ItemClass" %>
31
+ <%=
32
+ select_tag "#{child_class_prefix}item[class_item_id]",
33
+ class_options_list_for( @item ),
34
+ :tabindex=>'105'
35
+ %>
36
+ </p><p class="directions">Optional.</p>
37
+ <% else %>
38
+ <%= hidden_field_tag child_class_prefix+'item_class_item_id',
39
+ @item.class_item_id.to_s,
40
+ :name => child_class_prefix+'item[class_item_id]' %>
41
+ <% end %>
@@ -23,7 +23,7 @@
23
23
  displaying the complete set of non-Property items.]</p>
24
24
  <% end %>
25
25
 
26
- <div class="subheading">Recently Added Items</div>
26
+ <h2 class="subheading">Recently Added</h2>
27
27
  <style>
28
28
  .item-title {
29
29
  font-size: 120%;
@@ -37,20 +37,23 @@
37
37
  }
38
38
  </style>
39
39
 
40
- <% nouns_listed = 0
41
- @nouns.each do |item| %>
42
- <p class="item-title">
43
- <%= link_to "#{h filter_parenthetical item.title}",
44
- item_by_name_path(item.name) %>
45
- </p>
46
- <p class="item-desc">
47
- <% desc = h item.description
48
- if desc.length > 180
49
- desc = desc[0,180] + '&hellip;'
50
- end
51
- %>
52
- <%= desc %>
53
- </p>
54
-
55
- <% break if (nouns_listed += 1) >= 20
56
- end %>
40
+ <% # TODO: if the controller made another list just for this, then it
41
+ # could have the database apply the filter/sort/limit, but I don't
42
+ # know if doing this here is slower or faster, so here for now:
43
+ @nouns.reject {|item| (item.flags & Item::DATA_IS_UNALTERABLE) != 0}.
44
+ sort {|a,b|
45
+ (b.updated_at or b.created_at) <=> (a.updated_at or a.created_at) }.
46
+ first(20).each do |item| %>
47
+ <p class="item-title">
48
+ <%= link_to "#{h filter_parenthetical item.title}",
49
+ item_by_name_path(item.name) %>
50
+ </p>
51
+ <p class="item-desc">
52
+ <% desc = h item.description
53
+ if desc.length > 180
54
+ desc = desc[0,180] + '&hellip;'
55
+ end
56
+ %>
57
+ <%= desc %>
58
+ </p><%
59
+ end %>
@@ -16,8 +16,43 @@
16
16
  # along with this program in the file COPYING and/or LICENSE. If not,
17
17
  # see "http://www.gnu.org/licenses/".
18
18
  %>
19
- <% if @display_unimplemented %>
20
- <hr />
21
- <p class="unimplemented">[area to list/"invite users to" core
22
- wontology tasks: browsing, searching, contributing]</p>
23
- <% end -%>
19
+
20
+ <hr />
21
+ <style>
22
+ #add-class-instances-list ul {
23
+ font-size: 115%;
24
+ text-align: center;
25
+ padding: 0;
26
+ margin-bottom: 3.5ex;
27
+ }
28
+ #add-class-instances-list li {
29
+ display: inline;
30
+ line-height: 3.5ex;
31
+ margin: 0 1em;
32
+ }
33
+ #add-class-instances-list span {
34
+ white-space: nowrap;
35
+ }
36
+ </style>
37
+
38
+ <div style="padding-left: 10%;">
39
+ <div id="add-class-instances-list" style="width: 88.9%;">
40
+ <ul><%
41
+ spo_item_id = Item.find_by_name('sub_property_of').id
42
+ @class_list.select do |class_item|
43
+ Connection.first( :conditions => [
44
+ "subject_id = ? AND predicate_id = ?",
45
+ class_item.id, spo_item_id
46
+ ] ).nil?
47
+ end.each do |item| %>
48
+ <li><span><%=
49
+ link_to "Add a new <b>#{h item.name}</b>",
50
+ new_item_path + "?class_item=" + item.id.to_s %>
51
+ <span style="font-size: 80%">(<%=
52
+ link_to "show current", item_by_name_path(item.name)
53
+ -%>)</span>
54
+ </span></li><%
55
+ end %>
56
+ </ul>
57
+ </div>
58
+ </div>
@@ -24,7 +24,7 @@
24
24
  <%= image_tag "blank_error_icon.png", :id=>"title_error_icon", :alt=>"",
25
25
  :size=>"16x16" -%>
26
26
  <br />
27
- <%= f.text_field :title, :tabindex => "2", :style => "width: 95%;" %>
27
+ <%= f.text_field :title, :tabindex => "120", :style => "width: 75%;" %>
28
28
  </p><p class="directions">
29
29
  <span id="title_required">Required.</span>
30
30
  <span id="title_multi_line">One line only</span>
@@ -42,7 +42,7 @@
42
42
  <%= image_tag "blank_status_icon.png", :id=>"name_status_icon", :alt=>"",
43
43
  :size=>"32x16" %>
44
44
  <br />
45
- <%= f.text_field :name, :tabindex => "3", :style => "width: 95%;" %>
45
+ <%= f.text_field :name, :tabindex => "130", :style => "width: 55%;" %>
46
46
  </p><p class="directions">
47
47
  <span id="name_required">Required.</span>
48
48
  <span id="name_start_char">Start with a letter.</span>
@@ -59,8 +59,8 @@
59
59
  <%= image_tag "blank_error_icon.png", :id=>"description_error_icon", :alt=>"",
60
60
  :size=>"16x16" %>
61
61
  <br />
62
- <%= f.text_area :description, :style => "width: 95%; height: 7em",
63
- :tabindex => "4" %>
62
+ <%= f.text_area :description, :style => "width: 95%; height: 15em",
63
+ :tabindex => "140" %>
64
64
  </p><p class="directions">
65
65
  Describe what this item represents.
66
66
  <span id="description_recommended">Recommended.</span>
@@ -0,0 +1,48 @@
1
+ <%
2
+ # WontoMedia - a wontology web application
3
+ # Copyright (C) 2010 - Glen E. Ivey
4
+ # www.wontology.com
5
+ #
6
+ # This program is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU Affero General Public License version
8
+ # 3 as published by the Free Software Foundation.
9
+ #
10
+ # This program is distributed in the hope that it will be useful, but
11
+ # WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Affero General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Affero General Public License
16
+ # along with this program in the file COPYING and/or LICENSE. If not,
17
+ # see "http://www.gnu.org/licenses/".
18
+ %>
19
+
20
+
21
+
22
+ <% form_for( con, :url => connections_path+"?goto=#{@item.name}" ) do |f|
23
+ @connection = con # yes, fibbing to Rails, so shoot me....
24
+ %>
25
+ <%= hidden_field :connection, :subject_id %>
26
+ <%= hidden_field :connection, :predicate_id %>
27
+ <%= hidden_field :connection, :kind_of_obj %>
28
+
29
+ <%= select_tag "connection[obj_id]",
30
+ options_for_select(
31
+ [[ "- to this item -", "" ],
32
+ [ "- create a new item -", "-1" ],
33
+ ] +
34
+ items.map do |item|
35
+ [ h("#{item.name} : #{item.title}"), item.id ]
36
+ end, "" ),
37
+ :style => 'width: 62%;', :onfocus => 'selectOnfocusHandler(this);',
38
+ :onchange => "selectOnchangeHandler(this, '#{con.type_item.id}');"
39
+ %>
40
+
41
+ <%= f.submit "Add", :style => 'width: 3em;' %>
42
+ <% unless @add_item_help_icon_used %>
43
+ <%= popup_help_icon "Help for item-value add",
44
+ "Help:Popup/InlineAddItem" %>
45
+ <% end
46
+ @add_item_help_icon_used = true
47
+ %>
48
+ <% end %>
@@ -0,0 +1,36 @@
1
+ <%
2
+ # WontoMedia - a wontology web application
3
+ # Copyright (C) 2010 - Glen E. Ivey
4
+ # www.wontology.com
5
+ #
6
+ # This program is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU Affero General Public License version
8
+ # 3 as published by the Free Software Foundation.
9
+ #
10
+ # This program is distributed in the hope that it will be useful, but
11
+ # WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Affero General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Affero General Public License
16
+ # along with this program in the file COPYING and/or LICENSE. If not,
17
+ # see "http://www.gnu.org/licenses/".
18
+ %>
19
+
20
+
21
+ <% form_for( con, :url => connections_path+"?goto=#{@item.name}" ) do |f|
22
+ @connection = con # yes, fibbing to Rails, so shoot me....
23
+ %>
24
+ <%= hidden_field :connection, :subject_id %>
25
+ <%= hidden_field :connection, :predicate_id %>
26
+ <%= hidden_field :connection, :kind_of_obj %>
27
+ <%= text_field :connection, :scalar_obj, :size => 40 %>
28
+ <%= f.submit "Add", :style => 'width: 3em;' %>
29
+ <% unless @add_scalar_help_icon_used %>
30
+ <%= popup_help_icon "Help for scalar-value add",
31
+ "Help:Popup/InlineAddScalar" %>
32
+ <% end
33
+ @add_scalar_help_icon_used = true
34
+ %>
35
+ <%= h filter_parenthetical con.type_item.title %>
36
+ <% end %>