wontomedia 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -22,10 +22,6 @@ var nameAjaxStart = 400; // to avoid unnecessary server traffic,
22
22
 
23
23
 
24
24
 
25
- // package of code to implement required-inputs-can't-be-empty checks
26
- // (for items/new page)
27
-
28
-
29
25
  // define fields subject to check, order they occur in form
30
26
  var requiredItemElements = [ "sti_type", "title", "name", "description",
31
27
  "submit" ];
@@ -37,6 +33,7 @@ var indexDescription = 3;
37
33
  var maxLengths = [ 0, 255, 80, 65535 ];
38
34
 
39
35
  // globals w/ defaults, real values figured in plumbEvent...()
36
+ var thereIsAClassControl = false;
40
37
  var thereIsATypeControl = false;
41
38
  var originalItemName = "";
42
39
  var controlNamePrefix = "";
@@ -59,7 +56,6 @@ var ajaxRequestInProgress = null;
59
56
 
60
57
 
61
58
  function plumbEventHandlersToItemCreationElements(customizationSelector){
62
- thereIsATypeControl = ($('item_sti_type') != null);
63
59
  for (var c=0; c < requiredItemElements.length-2; c++)
64
60
  itemFormErrors["item_" + requiredItemElements[c]] =
65
61
  creatingNewItem ? -1 : false;
@@ -81,6 +77,16 @@ function plumbEventHandlersToItemCreationElements(customizationSelector){
81
77
  }
82
78
 
83
79
 
80
+ var testing = $('item_sti_type');
81
+ if (testing != null && testing.type != "hidden")
82
+ thereIsATypeControl = true;
83
+ else
84
+ itemFormErrors['item_sti_type'] = false
85
+
86
+ testing = $(controlNamePrefix + 'item_class_item_id')
87
+ thereIsAClassControl = testing != null && testing.type != "hidden";
88
+
89
+
84
90
  itemSubmit = $(controlNamePrefix + 'item_submit');
85
91
  if (thereIsATypeControl){
86
92
  var ck = $(controlNamePrefix + 'item_sti_type').value;
@@ -89,6 +95,12 @@ function plumbEventHandlersToItemCreationElements(customizationSelector){
89
95
  }
90
96
 
91
97
 
98
+ if (thereIsAClassControl && thereIsATypeControl){
99
+ $(controlNamePrefix + 'item_class_item_id').
100
+ observe('change', classSelectOnchange);
101
+ }
102
+
103
+
92
104
  if (thereIsATypeControl){
93
105
  var a = $('item_sti_type');
94
106
  a.observe('keyup',
@@ -222,6 +234,9 @@ function plumbEventHandlersToItemCreationElements(customizationSelector){
222
234
  function(ev){
223
235
  if (!okToSubmitItemForm())
224
236
  ev.stop();
237
+ else
238
+ if (thereIsATypeControl)
239
+ $('item_sti_type').disabled = false;
225
240
  }
226
241
  );
227
242
  }
@@ -484,6 +499,26 @@ function okToSubmitItemForm(){
484
499
  return !errors;
485
500
  }
486
501
 
502
+
503
+ function classSelectOnchange(){
504
+ var class_ctrl = $(controlNamePrefix + 'item_class_item_id');
505
+ var type_ctrl = $('item_sti_type');
506
+ var class_val = class_ctrl.value;
507
+
508
+ type_ctrl.disabled = false;
509
+ if ( class_val.search( /^[0-9]+$/ ) == -1 )
510
+ return;
511
+ else {
512
+ var new_type = class_to_type['id' + class_val];
513
+ if (typeof new_type == 'undefined')
514
+ return;
515
+
516
+ type_ctrl.value = new_type;
517
+ type_ctrl.disabled = true;
518
+ }
519
+ }
520
+
521
+
487
522
  // function to highlight help text based on Type <select> element state
488
523
  function typeSelectOnchange(){
489
524
  var sel = $('item_sti_type');
@@ -0,0 +1,27 @@
1
+ // WontoMedia - a wontology web application
2
+ // Copyright (C) 2010 - Glen E. Ivey
3
+ // www.wontology.com
4
+ //
5
+ // This program is free software: you can redistribute it and/or modify
6
+ // it under the terms of the GNU Affero General Public License version
7
+ // 3 as published by the Free Software Foundation.
8
+ //
9
+ // This program is distributed in the hope that it will be useful,
10
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ // GNU Affero General Public License for more details.
13
+ //
14
+ // You should have received a copy of the GNU Affero General Public License
15
+ // along with this program in the file COPYING and/or LICENSE. If not,
16
+ // see <http://www.gnu.org/licenses/>.
17
+
18
+
19
+ function selectOnfocusHandler(ctrl){
20
+ ctrl.lastValue = ctrl.value;
21
+ }
22
+
23
+ function selectOnchangeHandler(ctrl, class_item_name){
24
+ if (ctrl.value == "-1"){
25
+ itemCreatePopup(ctrl, ctrl.lastValue, null, class_item_name);
26
+ }
27
+ }
@@ -20,14 +20,19 @@ var itemSelectElementHavingNewItemAdded = null;
20
20
  var nounVerbCodeOfNewItemBeingAdded = "";
21
21
  var priorValueOfSelectElementHavingNewItemAdded = "";
22
22
 
23
- function itemCreatePopup(selectElem, itemType, priorValue){
23
+ function itemCreatePopup(selectElem, priorValue, popupType, popupClass){
24
24
  itemSelectElementHavingNewItemAdded = selectElem;
25
- nounVerbCodeOfNewItemBeingAdded = itemType;
25
+ nounVerbCodeOfNewItemBeingAdded = popupType;
26
26
  priorValueOfSelectElementHavingNewItemAdded = priorValue;
27
27
 
28
28
  var l = window.location;
29
29
  var newpop = l.protocol + "//" + l.hostname + ":" + l.port +
30
- "/w/items/new-pop?type=" + itemType;
30
+ "/w/items/new-pop?";
31
+ if (popupType)
32
+ newpop += "popup_type=" + popupType;
33
+ else if (popupClass)
34
+ newpop += "class_item=" + popupClass;
35
+
31
36
  Modalbox.show(newpop, {
32
37
  title: "Create a new item",
33
38
  height: itemCreatePopup_Height(),
@@ -53,6 +58,8 @@ function itemCreatePopup_Submit(buttonElement){
53
58
  postUrl = l.protocol + "//" + l.hostname + ":" + l.port +
54
59
  buttonElement.form.action;
55
60
 
61
+ if (thereIsATypeControl) // disabled controls aren't "successful"
62
+ $('item_sti_type').disabled = false;
56
63
  Modalbox.show(postUrl, {
57
64
  title: "Create a new item",
58
65
  height: itemCreatePopup_Height(),
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
8
- - 1
9
- version: 0.1.1
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Glen E. Ivey
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-14 00:00:00 -08:00
17
+ date: 2010-03-22 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -66,10 +66,14 @@ files:
66
66
  - app/views/connections/new.html.erb
67
67
  - app/views/connections/show.html.erb
68
68
  - app/views/items/_active_content.html.erb
69
+ - app/views/items/_class_select.html.erb
69
70
  - app/views/items/_content_examples.html.erb
70
71
  - app/views/items/_core_tasks.html.erb
71
72
  - app/views/items/_form_fields.html.erb
73
+ - app/views/items/_inline_item_add_form.html.erb
74
+ - app/views/items/_inline_scalar_add_form.html.erb
72
75
  - app/views/items/_list_outbound_links.html.erb
76
+ - app/views/items/_most_populous_classes.html.erb
73
77
  - app/views/items/_screen_select.html.erb
74
78
  - app/views/items/_show_outbound_links.html.erb
75
79
  - app/views/items/_topic_list.html.erb
@@ -121,6 +125,8 @@ files:
121
125
  - db/migrate/20090529171508_add_flags_to_connections.rb
122
126
  - db/migrate/20090605213800_flags_columns_not_null.rb
123
127
  - db/migrate/20090605215028_flags_columns_default_zero.rb
128
+ - db/migrate/20100315135952_provide_scalar_objects.rb
129
+ - db/migrate/20100321042343_add_timestamp_columns.rb
124
130
  - db/schema.rb
125
131
  - default-custom/app/views/items/_home_introductory_text.html.erb
126
132
  - default-custom/app/views/items/home.html.erb
@@ -146,13 +152,14 @@ files:
146
152
  - public/dispatch.cgi
147
153
  - public/dispatch.fcgi
148
154
  - public/dispatch.rb
149
- - public/images/alert_background.png
150
155
  - public/images/blank_error_icon.png
151
156
  - public/images/blank_status_icon.png
152
157
  - public/images/error_error_icon.png
153
158
  - public/images/error_status_icon.png
154
159
  - public/images/good_status_icon.png
155
160
  - public/images/help_icon.png
161
+ - public/images/transparent_ltblue_background.png
162
+ - public/images/transparent_white_background.png
156
163
  - public/images/twitter_icon.png
157
164
  - public/images/warn_error_icon.png
158
165
  - public/images/working_status_icon.gif
@@ -165,6 +172,7 @@ files:
165
172
  - public/javascripts/fancybox.js
166
173
  - public/javascripts/forConnectionsForms.js
167
174
  - public/javascripts/forItemsForms.js
175
+ - public/javascripts/forItemsShow.js
168
176
  - public/javascripts/itemCreatePopup.js
169
177
  - public/javascripts/itemTitleToName.js
170
178
  - public/javascripts/jquery.js