somatics3 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (189) hide show
  1. data/.document +5 -0
  2. data/LICENSE +20 -0
  3. data/README.rdoc +91 -0
  4. data/Rakefile +72 -0
  5. data/VERSION +1 -0
  6. data/bin/somatics +23 -0
  7. data/bin/somatify +21 -0
  8. data/lib/generators/somatics.rb +37 -0
  9. data/lib/generators/somatics/associated/associated_generator.rb +184 -0
  10. data/lib/generators/somatics/associated/templates/migration.rb +11 -0
  11. data/lib/generators/somatics/attributes/attributes_generator.rb +115 -0
  12. data/lib/generators/somatics/attributes/templates/migration.rb +11 -0
  13. data/lib/generators/somatics/authenticated/authenticated_generator.rb +65 -0
  14. data/lib/generators/somatics/authenticated/templates/partial_form.html.erb +23 -0
  15. data/lib/generators/somatics/authenticated_controller/authenticated_controller_generator.rb +38 -0
  16. data/lib/generators/somatics/authenticated_controller/templates/locales_en.yml +6 -0
  17. data/lib/generators/somatics/authenticated_controller/templates/locales_zh-TW.yml +6 -0
  18. data/lib/generators/somatics/authenticated_controller/templates/login.html.erb +31 -0
  19. data/lib/generators/somatics/authenticated_controller/templates/sessions_controller.rb +11 -0
  20. data/lib/generators/somatics/helper/helper_generator.rb +16 -0
  21. data/lib/generators/somatics/install/install_generator.rb +101 -0
  22. data/lib/generators/somatics/install/templates/config/locales/devise_zh-TW.yml +39 -0
  23. data/lib/generators/somatics/install/templates/config/locales/somatics_en.yml +35 -0
  24. data/lib/generators/somatics/install/templates/config/locales/somatics_zh-TW.yml +35 -0
  25. data/lib/generators/somatics/install/templates/controller_admin.rb +17 -0
  26. data/lib/generators/somatics/install/templates/controller_home.rb +4 -0
  27. data/lib/generators/somatics/install/templates/helper_admin.rb +99 -0
  28. data/lib/generators/somatics/install/templates/initializer_paper_trail.rb +2 -0
  29. data/lib/generators/somatics/install/templates/layout_admin.html.erb +87 -0
  30. data/lib/generators/somatics/install/templates/lib/active_record/diff.rb +61 -0
  31. data/lib/generators/somatics/install/templates/lib/somatic_link_renderer.rb +24 -0
  32. data/lib/generators/somatics/install/templates/lib/tasks/heroku.rake +30 -0
  33. data/lib/generators/somatics/install/templates/lib/tasks/svn.rake +47 -0
  34. data/lib/generators/somatics/install/templates/partial_menu.html.erb +1 -0
  35. data/lib/generators/somatics/install/templates/partial_versions.html.erb +56 -0
  36. data/lib/generators/somatics/install/templates/public/images/somatics/add.png +0 -0
  37. data/lib/generators/somatics/install/templates/public/images/somatics/arrow_collapsed.png +0 -0
  38. data/lib/generators/somatics/install/templates/public/images/somatics/arrow_expanded.png +0 -0
  39. data/lib/generators/somatics/install/templates/public/images/somatics/attachment.png +0 -0
  40. data/lib/generators/somatics/install/templates/public/images/somatics/bullet_arrow_left.png +0 -0
  41. data/lib/generators/somatics/install/templates/public/images/somatics/bullet_arrow_right.png +0 -0
  42. data/lib/generators/somatics/install/templates/public/images/somatics/bullet_diamond.png +0 -0
  43. data/lib/generators/somatics/install/templates/public/images/somatics/bullet_end.png +0 -0
  44. data/lib/generators/somatics/install/templates/public/images/somatics/bullet_go.png +0 -0
  45. data/lib/generators/somatics/install/templates/public/images/somatics/bullet_toggle_minus.png +0 -0
  46. data/lib/generators/somatics/install/templates/public/images/somatics/bullet_toggle_plus.png +0 -0
  47. data/lib/generators/somatics/install/templates/public/images/somatics/c.png +0 -0
  48. data/lib/generators/somatics/install/templates/public/images/somatics/cancel.png +0 -0
  49. data/lib/generators/somatics/install/templates/public/images/somatics/changeset.png +0 -0
  50. data/lib/generators/somatics/install/templates/public/images/somatics/comment.png +0 -0
  51. data/lib/generators/somatics/install/templates/public/images/somatics/comments.png +0 -0
  52. data/lib/generators/somatics/install/templates/public/images/somatics/content-left.png +0 -0
  53. data/lib/generators/somatics/install/templates/public/images/somatics/content-right.png +0 -0
  54. data/lib/generators/somatics/install/templates/public/images/somatics/copy.png +0 -0
  55. data/lib/generators/somatics/install/templates/public/images/somatics/csharp.png +0 -0
  56. data/lib/generators/somatics/install/templates/public/images/somatics/database_key.png +0 -0
  57. data/lib/generators/somatics/install/templates/public/images/somatics/default.png +0 -0
  58. data/lib/generators/somatics/install/templates/public/images/somatics/delete.png +0 -0
  59. data/lib/generators/somatics/install/templates/public/images/somatics/document.png +0 -0
  60. data/lib/generators/somatics/install/templates/public/images/somatics/draft.png +0 -0
  61. data/lib/generators/somatics/install/templates/public/images/somatics/duplicate.png +0 -0
  62. data/lib/generators/somatics/install/templates/public/images/somatics/edit.png +0 -0
  63. data/lib/generators/somatics/install/templates/public/images/somatics/exclamation.png +0 -0
  64. data/lib/generators/somatics/install/templates/public/images/somatics/external.png +0 -0
  65. data/lib/generators/somatics/install/templates/public/images/somatics/fav.png +0 -0
  66. data/lib/generators/somatics/install/templates/public/images/somatics/fav_off.png +0 -0
  67. data/lib/generators/somatics/install/templates/public/images/somatics/feed.png +0 -0
  68. data/lib/generators/somatics/install/templates/public/images/somatics/folder.png +0 -0
  69. data/lib/generators/somatics/install/templates/public/images/somatics/folder_open.png +0 -0
  70. data/lib/generators/somatics/install/templates/public/images/somatics/footer-bg.png +0 -0
  71. data/lib/generators/somatics/install/templates/public/images/somatics/footer-left.png +0 -0
  72. data/lib/generators/somatics/install/templates/public/images/somatics/footer-right.png +0 -0
  73. data/lib/generators/somatics/install/templates/public/images/somatics/group.png +0 -0
  74. data/lib/generators/somatics/install/templates/public/images/somatics/help.png +0 -0
  75. data/lib/generators/somatics/install/templates/public/images/somatics/history.png +0 -0
  76. data/lib/generators/somatics/install/templates/public/images/somatics/image.png +0 -0
  77. data/lib/generators/somatics/install/templates/public/images/somatics/lightning.png +0 -0
  78. data/lib/generators/somatics/install/templates/public/images/somatics/link.png +0 -0
  79. data/lib/generators/somatics/install/templates/public/images/somatics/loading.gif +0 -0
  80. data/lib/generators/somatics/install/templates/public/images/somatics/locked.png +0 -0
  81. data/lib/generators/somatics/install/templates/public/images/somatics/message.png +0 -0
  82. data/lib/generators/somatics/install/templates/public/images/somatics/milestone.png +0 -0
  83. data/lib/generators/somatics/install/templates/public/images/somatics/move.png +0 -0
  84. data/lib/generators/somatics/install/templates/public/images/somatics/news.png +0 -0
  85. data/lib/generators/somatics/install/templates/public/images/somatics/openid-bg.gif +0 -0
  86. data/lib/generators/somatics/install/templates/public/images/somatics/package.png +0 -0
  87. data/lib/generators/somatics/install/templates/public/images/somatics/pdf.png +0 -0
  88. data/lib/generators/somatics/install/templates/public/images/somatics/php.png +0 -0
  89. data/lib/generators/somatics/install/templates/public/images/somatics/plugin.png +0 -0
  90. data/lib/generators/somatics/install/templates/public/images/somatics/projects.png +0 -0
  91. data/lib/generators/somatics/install/templates/public/images/somatics/rails.png +0 -0
  92. data/lib/generators/somatics/install/templates/public/images/somatics/reload.png +0 -0
  93. data/lib/generators/somatics/install/templates/public/images/somatics/report.png +0 -0
  94. data/lib/generators/somatics/install/templates/public/images/somatics/ruby.png +0 -0
  95. data/lib/generators/somatics/install/templates/public/images/somatics/save.png +0 -0
  96. data/lib/generators/somatics/install/templates/public/images/somatics/sort_asc.png +0 -0
  97. data/lib/generators/somatics/install/templates/public/images/somatics/sort_desc.png +0 -0
  98. data/lib/generators/somatics/install/templates/public/images/somatics/stats.png +0 -0
  99. data/lib/generators/somatics/install/templates/public/images/somatics/table_multiple.png +0 -0
  100. data/lib/generators/somatics/install/templates/public/images/somatics/task_done.png +0 -0
  101. data/lib/generators/somatics/install/templates/public/images/somatics/task_late.png +0 -0
  102. data/lib/generators/somatics/install/templates/public/images/somatics/task_parent_end.png +0 -0
  103. data/lib/generators/somatics/install/templates/public/images/somatics/task_todo.png +0 -0
  104. data/lib/generators/somatics/install/templates/public/images/somatics/text.png +0 -0
  105. data/lib/generators/somatics/install/templates/public/images/somatics/text_list_bullets.png +0 -0
  106. data/lib/generators/somatics/install/templates/public/images/somatics/textfield.png +0 -0
  107. data/lib/generators/somatics/install/templates/public/images/somatics/ticket.png +0 -0
  108. data/lib/generators/somatics/install/templates/public/images/somatics/ticket_checked.png +0 -0
  109. data/lib/generators/somatics/install/templates/public/images/somatics/ticket_edit.png +0 -0
  110. data/lib/generators/somatics/install/templates/public/images/somatics/ticket_go.png +0 -0
  111. data/lib/generators/somatics/install/templates/public/images/somatics/ticket_note.png +0 -0
  112. data/lib/generators/somatics/install/templates/public/images/somatics/time.png +0 -0
  113. data/lib/generators/somatics/install/templates/public/images/somatics/time_add.png +0 -0
  114. data/lib/generators/somatics/install/templates/public/images/somatics/toggle_check.png +0 -0
  115. data/lib/generators/somatics/install/templates/public/images/somatics/true.png +0 -0
  116. data/lib/generators/somatics/install/templates/public/images/somatics/unlock.png +0 -0
  117. data/lib/generators/somatics/install/templates/public/images/somatics/user.png +0 -0
  118. data/lib/generators/somatics/install/templates/public/images/somatics/warning.png +0 -0
  119. data/lib/generators/somatics/install/templates/public/images/somatics/wiki_edit.png +0 -0
  120. data/lib/generators/somatics/install/templates/public/images/somatics/xml.png +0 -0
  121. data/lib/generators/somatics/install/templates/public/images/somatics/zip.png +0 -0
  122. data/lib/generators/somatics/install/templates/public/images/somatics/zoom_in.png +0 -0
  123. data/lib/generators/somatics/install/templates/public/javascripts/somatics/base.js +237 -0
  124. data/lib/generators/somatics/install/templates/public/javascripts/somatics/context_menu.js +237 -0
  125. data/lib/generators/somatics/install/templates/public/javascripts/somatics/controls.js +965 -0
  126. data/lib/generators/somatics/install/templates/public/javascripts/somatics/dragdrop.js +974 -0
  127. data/lib/generators/somatics/install/templates/public/javascripts/somatics/effects.js +1123 -0
  128. data/lib/generators/somatics/install/templates/public/javascripts/somatics/prototype.js +6001 -0
  129. data/lib/generators/somatics/install/templates/public/javascripts/somatics/rails.js +175 -0
  130. data/lib/generators/somatics/install/templates/public/javascripts/somatics/select_list_move.js +82 -0
  131. data/lib/generators/somatics/install/templates/public/stylesheets/application.css +863 -0
  132. data/lib/generators/somatics/install/templates/public/stylesheets/somatics/base.css +951 -0
  133. data/lib/generators/somatics/install/templates/public/stylesheets/somatics/context_menu.css +52 -0
  134. data/lib/generators/somatics/install/templates/public/stylesheets/somatics/csshover.htc +122 -0
  135. data/lib/generators/somatics/install/templates/public/stylesheets/somatics/jstoolbar.css +95 -0
  136. data/lib/generators/somatics/install/templates/public/themes/default/stylesheets/application.css +951 -0
  137. data/lib/generators/somatics/install/templates/view_index.html.erb +46 -0
  138. data/lib/generators/somatics/relationship/relationship_generator.rb +173 -0
  139. data/lib/generators/somatics/relationship/templates/migration.rb +11 -0
  140. data/lib/generators/somatics/scaffold/scaffold_generator.rb +24 -0
  141. data/lib/generators/somatics/scaffold/templates/_form.html.erb +23 -0
  142. data/lib/generators/somatics/scaffold/templates/edit.html.erb +6 -0
  143. data/lib/generators/somatics/scaffold/templates/index.html.erb +27 -0
  144. data/lib/generators/somatics/scaffold/templates/new.html.erb +5 -0
  145. data/lib/generators/somatics/scaffold/templates/show.html.erb +12 -0
  146. data/lib/generators/somatics/scaffold_controller/USAGE +20 -0
  147. data/lib/generators/somatics/scaffold_controller/scaffold_controller_generator.rb +108 -0
  148. data/lib/generators/somatics/scaffold_controller/templates/builder_index.xls.builder +24 -0
  149. data/lib/generators/somatics/scaffold_controller/templates/builder_index.xml.builder +10 -0
  150. data/lib/generators/somatics/scaffold_controller/templates/controller.rb +123 -0
  151. data/lib/generators/somatics/scaffold_controller/templates/locales_en.yml +17 -0
  152. data/lib/generators/somatics/scaffold_controller/templates/locales_zh-TW.yml +20 -0
  153. data/lib/generators/somatics/scaffold_controller/templates/partial_bulk.html.erb +12 -0
  154. data/lib/generators/somatics/scaffold_controller/templates/partial_edit.html.erb +7 -0
  155. data/lib/generators/somatics/scaffold_controller/templates/partial_form.html.erb +13 -0
  156. data/lib/generators/somatics/scaffold_controller/templates/partial_list.html.erb +30 -0
  157. data/lib/generators/somatics/scaffold_controller/templates/partial_menu.html.erb +1 -0
  158. data/lib/generators/somatics/scaffold_controller/templates/partial_show.html.erb +31 -0
  159. data/lib/generators/somatics/scaffold_controller/templates/view_edit.html.erb +24 -0
  160. data/lib/generators/somatics/scaffold_controller/templates/view_index.html.erb +27 -0
  161. data/lib/generators/somatics/scaffold_controller/templates/view_new.html.erb +14 -0
  162. data/lib/generators/somatics/scaffold_controller/templates/view_show.html.erb +26 -0
  163. data/lib/generators/somatics/settings/settings_generator.rb +86 -0
  164. data/lib/generators/somatics/settings_controller/USAGE +20 -0
  165. data/lib/generators/somatics/settings_controller/settings_controller_generator.rb +11 -0
  166. data/lib/generators/somatics/settings_controller/templates/builder_index.xls.builder +24 -0
  167. data/lib/generators/somatics/settings_controller/templates/builder_index.xml.builder +10 -0
  168. data/lib/generators/somatics/settings_controller/templates/controller.rb +64 -0
  169. data/lib/generators/somatics/settings_controller/templates/helper.rb +2 -0
  170. data/lib/generators/somatics/settings_controller/templates/locales_en.yml +9 -0
  171. data/lib/generators/somatics/settings_controller/templates/locales_zh-TW.yml +28 -0
  172. data/lib/generators/somatics/settings_controller/templates/migration.rb +17 -0
  173. data/lib/generators/somatics/settings_controller/templates/partial_bulk.html.erb +12 -0
  174. data/lib/generators/somatics/settings_controller/templates/partial_edit.html.erb +7 -0
  175. data/lib/generators/somatics/settings_controller/templates/partial_form.html.erb +15 -0
  176. data/lib/generators/somatics/settings_controller/templates/partial_list.html.erb +28 -0
  177. data/lib/generators/somatics/settings_controller/templates/partial_menu.html.erb +1 -0
  178. data/lib/generators/somatics/settings_controller/templates/partial_show.html.erb +13 -0
  179. data/lib/generators/somatics/settings_controller/templates/view_edit.html.erb +23 -0
  180. data/lib/generators/somatics/settings_controller/templates/view_index.html.erb +22 -0
  181. data/lib/generators/somatics/settings_controller/templates/view_new.html.erb +14 -0
  182. data/lib/generators/somatics/settings_controller/templates/view_show.html.erb +23 -0
  183. data/lib/somatics.rb +9 -0
  184. data/somatics.gemspec +249 -0
  185. data/somatics3.gemspec +248 -0
  186. data/templates/somatics.rb +106 -0
  187. data/test/helper.rb +10 -0
  188. data/test/test_somatics3-generators.rb +7 -0
  189. metadata +398 -0
@@ -0,0 +1,47 @@
1
+ desc "Configure Subversion for Rails"
2
+ task :setup_svn do
3
+ system "svn info"
4
+ if $? != 0
5
+ puts 'Please Import your project to svn before executing this task'
6
+ exit(0)
7
+ end
8
+
9
+ system "svn commit -m 'initial commit'"
10
+
11
+ puts "Add .gitignore"
12
+ system "echo '.svn' > .gitignore"
13
+ system "svn add .gitignore"
14
+ system "svn commit -m 'add .gitignore'"
15
+
16
+ puts "Ignoring .git"
17
+ system "svn propset svn:ignore '.git' ."
18
+
19
+ puts "Removing /log"
20
+ system "svn remove log/*"
21
+ system "svn commit -m 'removing all log files from subversion'"
22
+ system 'svn propset svn:ignore "*.log" log/'
23
+ system "svn update log/"
24
+ system "svn commit -m 'Ignoring all files in /log/ ending in .log'"
25
+
26
+ puts "Ignoring /db"
27
+ system 'svn propset svn:ignore "*.db" db/'
28
+ system "svn update db/"
29
+ system "svn commit -m 'Ignoring all files in /db/ ending in .db'"
30
+
31
+ puts "Renaming database.yml database.example"
32
+ system "svn move config/database.yml config/database.example"
33
+ system "svn commit -m 'Moving database.yml to database.example to provide a template for anyone who checks out the code'"
34
+ system 'svn propset svn:ignore "database.yml" config/'
35
+ system "svn update config/"
36
+ system "svn commit -m 'Ignoring database.yml'"
37
+
38
+ puts "Ignoring /tmp"
39
+ system 'svn propset svn:ignore "*" tmp/'
40
+ system "svn update tmp/"
41
+ system "svn commit -m 'Ignoring all files in /tmp/'"
42
+
43
+ puts "Ignoring /doc"
44
+ system 'svn propset svn:ignore "*" doc/'
45
+ system "svn update doc/"
46
+ system "svn commit -m 'Ignoring all files in /doc/'"
47
+ end
@@ -0,0 +1 @@
1
+ <li><%%= link_to t('Overview'), '/admin', :class => (match_controller?("home")) ? 'selected' : ''%></li>
@@ -0,0 +1,56 @@
1
+ <!-- Audit Trail-->
2
+ <h3>Audit Trail</h3>
3
+ <div class="autoscroll">
4
+ <table class="list issues">
5
+ <thead>
6
+ <tr>
7
+ <th title="">Version #</th>
8
+ <th title="">Modified at</th>
9
+ <th title="">Modified by</th>
10
+ <th title="">Action</th>
11
+ <th title="">Changes</th>
12
+ </tr>
13
+ </thead>
14
+ <tbody>
15
+ <%% unless obj.versions.empty? %>
16
+ <%% obj.versions.each do |version| %>
17
+ <tr id="<%% dom_id(version)%>" class="hascontextmenu <%%= cycle 'odd' , 'even' %> issue">
18
+ <td><%%= version.index %></td>
19
+ <td><%%= version.created_at.to_s(:db) %></td>
20
+ <td>
21
+ <%% unless version.whodunnit.to_i == 0 %>
22
+ <%%= User.find(version.whodunnit.to_i).name %>
23
+ <%% else %>
24
+ <%%= version.whodunnit || 'N/A' %>
25
+ <%% end%>
26
+ </td>
27
+ <td><%%= version.event.humanize %></td>
28
+ <td class="subject">
29
+ <%% if version.event == 'create'%>
30
+ Initial Create
31
+ <%% else %>
32
+ <%% unless version.next.nil? %>
33
+ <%% version.reify.diff(version.next.reify).each do |t| %>
34
+ <%% unless t.first == :updated_at %>
35
+ <p>"<b><%%= t.first.to_s.humanize %></b>" was changed from "<b><%%= t.last.first.to_s rescue '' %></b>" to "<b><%%= t.last.last.to_s rescue '' %></b>"</p>
36
+ <%% end %>
37
+ <%% end rescue 'Undetermined Changes'%>
38
+ <%% else %>
39
+ <%% version.reify.diff(obj).each do |t| %>
40
+ <%% unless t.first == :updated_at %>
41
+ <p>"<b><%%= t.first.to_s.humanize %></b>" was changed from "<b><%%= t.last.first.to_s rescue '' %></b>" to "<b><%%= t.last.last.to_s rescue '' %></b>"</p>
42
+ <%% end %>
43
+ <%% end rescue 'Undetermined Changes'%>
44
+ <%% end %>
45
+ <%% end %>
46
+ </td>
47
+ </tr>
48
+ <%% end %>
49
+ <%% else -%>
50
+ <tr class="datos">
51
+ <td colspan="100" align="center"><%%=t :no_data_available%></td>
52
+ </tr>
53
+ <%% end -%>
54
+ </tbody>
55
+ </table>
56
+ </div>
@@ -0,0 +1,237 @@
1
+ /* redMine - project management software
2
+ Copyright (C) 2006-2008 Jean-Philippe Lang */
3
+
4
+ function checkAll (id, checked) {
5
+ var els = Element.descendants(id);
6
+ for (var i = 0; i < els.length; i++) {
7
+ if (els[i].disabled==false) {
8
+ els[i].checked = checked;
9
+ }
10
+ }
11
+ }
12
+
13
+ function toggleCheckboxesBySelector(selector) {
14
+ boxes = $$(selector);
15
+ var all_checked = true;
16
+ for (i = 0; i < boxes.length; i++) { if (boxes[i].checked == false) { all_checked = false; } }
17
+ for (i = 0; i < boxes.length; i++) { boxes[i].checked = !all_checked; }
18
+ }
19
+
20
+ function showAndScrollTo(id, focus) {
21
+ Element.show(id);
22
+ if (focus!=null) { Form.Element.focus(focus); }
23
+ Element.scrollTo(id);
24
+ }
25
+
26
+ function toggleRowGroup(el) {
27
+ var tr = Element.up(el, 'tr');
28
+ var n = Element.next(tr);
29
+ tr.toggleClassName('open');
30
+ while (n != undefined && !n.hasClassName('group')) {
31
+ Element.toggle(n);
32
+ n = Element.next(n);
33
+ }
34
+ }
35
+
36
+ function toggleFieldset(el) {
37
+ var fieldset = Element.up(el, 'fieldset');
38
+ fieldset.toggleClassName('collapsed');
39
+ Effect.toggle(fieldset.down('div'), 'slide', {duration:0.2});
40
+ }
41
+
42
+ var fileFieldCount = 1;
43
+
44
+ function addFileField() {
45
+ if (fileFieldCount >= 10) return false
46
+ fileFieldCount++;
47
+ var f = document.createElement("input");
48
+ f.type = "file";
49
+ f.name = "attachments[" + fileFieldCount + "][file]";
50
+ f.size = 30;
51
+ var d = document.createElement("input");
52
+ d.type = "text";
53
+ d.name = "attachments[" + fileFieldCount + "][description]";
54
+ d.size = 60;
55
+
56
+ p = document.getElementById("attachments_fields");
57
+ p.appendChild(document.createElement("br"));
58
+ p.appendChild(f);
59
+ p.appendChild(d);
60
+ }
61
+
62
+ function showTab(name) {
63
+ var f = $$('div#content .tab-content');
64
+ for(var i=0; i<f.length; i++){
65
+ Element.hide(f[i]);
66
+ }
67
+ var f = $$('div.tabs a');
68
+ for(var i=0; i<f.length; i++){
69
+ Element.removeClassName(f[i], "selected");
70
+ }
71
+ Element.show('tab-content-' + name);
72
+ Element.addClassName('tab-' + name, "selected");
73
+ return false;
74
+ }
75
+
76
+ function moveTabRight(el) {
77
+ var lis = Element.up(el, 'div.tabs').down('ul').childElements();
78
+ var tabsWidth = 0;
79
+ var i;
80
+ for (i=0; i<lis.length; i++) {
81
+ if (lis[i].visible()) {
82
+ tabsWidth += lis[i].getWidth() + 6;
83
+ }
84
+ }
85
+ if (tabsWidth < Element.up(el, 'div.tabs').getWidth() - 60) {
86
+ return;
87
+ }
88
+ i=0;
89
+ while (i<lis.length && !lis[i].visible()) {
90
+ i++;
91
+ }
92
+ lis[i].hide();
93
+ }
94
+
95
+ function moveTabLeft(el) {
96
+ var lis = Element.up(el, 'div.tabs').down('ul').childElements();
97
+ var i = 0;
98
+ while (i<lis.length && !lis[i].visible()) {
99
+ i++;
100
+ }
101
+ if (i>0) {
102
+ lis[i-1].show();
103
+ }
104
+ }
105
+
106
+ function displayTabsButtons() {
107
+ var lis;
108
+ var tabsWidth = 0;
109
+ var i;
110
+ $$('div.tabs').each(function(el) {
111
+ lis = el.down('ul').childElements();
112
+ for (i=0; i<lis.length; i++) {
113
+ if (lis[i].visible()) {
114
+ tabsWidth += lis[i].getWidth() + 6;
115
+ }
116
+ }
117
+ if ((tabsWidth < el.getWidth() - 60) && (lis[0].visible())) {
118
+ el.down('div.tabs-buttons').hide();
119
+ } else {
120
+ el.down('div.tabs-buttons').show();
121
+ }
122
+ });
123
+ }
124
+
125
+ function setPredecessorFieldsVisibility() {
126
+ relationType = $('relation_relation_type');
127
+ if (relationType && (relationType.value == "precedes" || relationType.value == "follows")) {
128
+ Element.show('predecessor_fields');
129
+ } else {
130
+ Element.hide('predecessor_fields');
131
+ }
132
+ }
133
+
134
+ function promptToRemote(text, param, url) {
135
+ value = prompt(text + ':');
136
+ if (value) {
137
+ new Ajax.Request(url + '?' + param + '=' + encodeURIComponent(value), {asynchronous:true, evalScripts:true});
138
+ return false;
139
+ }
140
+ }
141
+
142
+ function collapseScmEntry(id) {
143
+ var els = document.getElementsByClassName(id, 'browser');
144
+ for (var i = 0; i < els.length; i++) {
145
+ if (els[i].hasClassName('open')) {
146
+ collapseScmEntry(els[i].id);
147
+ }
148
+ Element.hide(els[i]);
149
+ }
150
+ $(id).removeClassName('open');
151
+ }
152
+
153
+ function expandScmEntry(id) {
154
+ var els = document.getElementsByClassName(id, 'browser');
155
+ for (var i = 0; i < els.length; i++) {
156
+ Element.show(els[i]);
157
+ if (els[i].hasClassName('loaded') && !els[i].hasClassName('collapsed')) {
158
+ expandScmEntry(els[i].id);
159
+ }
160
+ }
161
+ $(id).addClassName('open');
162
+ }
163
+
164
+ function scmEntryClick(id) {
165
+ el = $(id);
166
+ if (el.hasClassName('open')) {
167
+ collapseScmEntry(id);
168
+ el.addClassName('collapsed');
169
+ return false;
170
+ } else if (el.hasClassName('loaded')) {
171
+ expandScmEntry(id);
172
+ el.removeClassName('collapsed');
173
+ return false;
174
+ }
175
+ if (el.hasClassName('loading')) {
176
+ return false;
177
+ }
178
+ el.addClassName('loading');
179
+ return true;
180
+ }
181
+
182
+ function scmEntryLoaded(id) {
183
+ Element.addClassName(id, 'open');
184
+ Element.addClassName(id, 'loaded');
185
+ Element.removeClassName(id, 'loading');
186
+ }
187
+
188
+ function randomKey(size) {
189
+ var chars = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z');
190
+ var key = '';
191
+ for (i = 0; i < size; i++) {
192
+ key += chars[Math.floor(Math.random() * chars.length)];
193
+ }
194
+ return key;
195
+ }
196
+
197
+ function observeParentIssueField(url) {
198
+ new Ajax.Autocompleter('issue_parent_issue_id',
199
+ 'parent_issue_candidates',
200
+ url,
201
+ { minChars: 3,
202
+ frequency: 0.5,
203
+ paramName: 'q',
204
+ updateElement: function(value) {
205
+ document.getElementById('issue_parent_issue_id').value = value.id;
206
+ }});
207
+ }
208
+
209
+ /* shows and hides ajax indicator */
210
+ Ajax.Responders.register({
211
+ onCreate: function(){
212
+ if ($('ajax-indicator') && Ajax.activeRequestCount > 0) {
213
+ Element.show('ajax-indicator');
214
+ }
215
+ },
216
+ onComplete: function(){
217
+ if ($('ajax-indicator') && Ajax.activeRequestCount == 0) {
218
+ Element.hide('ajax-indicator');
219
+ }
220
+ }
221
+ });
222
+
223
+ Event.observe(window, 'load', function() {
224
+ $$('.hol').each(function(el) {
225
+ el.hide();
226
+ });
227
+ });
228
+
229
+ Event.observe(window, "ajax:complete", function(event){
230
+ if(event.memo.responseText != 'undefined'){
231
+ $("content").update(event.memo.responseText); // insert content
232
+ }
233
+ });
234
+
235
+ function link_to(url) {
236
+ window.location = url;
237
+ }