parlement 0.6 → 0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. data/CHANGES +13 -0
  2. data/README +51 -38
  3. data/app/controllers/account_controller.rb +65 -37
  4. data/app/controllers/application.rb +1 -1
  5. data/app/controllers/elt_controller.rb +1 -0
  6. data/app/models/elt.rb +25 -14
  7. data/app/models/mail.rb +36 -35
  8. data/app/models/mail_notify.rb +23 -0
  9. data/app/views/account/_login.rhtml +1 -1
  10. data/app/views/account/_show.rhtml +22 -5
  11. data/app/views/elt/_elt.rhtml +44 -47
  12. data/app/views/elt/_listByDate.rhtml +7 -7
  13. data/app/views/elt/show.rhtml +3 -3
  14. data/app/views/layouts/top.rhtml +1 -0
  15. data/app/views/person/show.rhtml +5 -0
  16. data/config/environment.rb +1 -1
  17. data/db/ROOT/parlement/Parlement_fr.txt +46 -0
  18. data/db/ROOT/parlement/news/Version_06.txt +25 -0
  19. data/db/ROOT/parlement/news/Version_07.txt +12 -0
  20. data/db/ROOT/parlement/test.txt +14 -5
  21. data/db/ROOT/parlement.txt +2 -0
  22. data/db/development_structure.sql +119 -44
  23. data/db/migrate/004_people_image.rb +9 -0
  24. data/lib/data_import.rb +9 -13
  25. data/public/javascripts/mybehaviour.js +41 -0
  26. data/test/fixtures/img.png +0 -0
  27. data/test/fixtures/mail/avatar +249 -0
  28. data/test/fixtures/people.yml +1 -1
  29. data/test/functional/account_controller_test.rb +108 -56
  30. data/test/functional/elt_controller_test.rb +6 -6
  31. data/test/unit/elt_test.rb +1 -1
  32. data/test/unit/mail_test.rb +17 -0
  33. data/vendor/plugins/engines/CHANGELOG +91 -53
  34. data/vendor/plugins/engines/README +1 -1
  35. data/vendor/plugins/engines/generators/engine/templates/init_engine.erb +6 -4
  36. data/vendor/plugins/engines/generators/engine/templates/test/test_helper.erb +5 -1
  37. data/vendor/plugins/engines/init.rb +8 -3
  38. data/vendor/plugins/engines/lib/engines/action_mailer_extensions.rb +6 -5
  39. data/vendor/plugins/engines/lib/engines/action_view_extensions.rb +10 -6
  40. data/vendor/plugins/engines/lib/engines/active_record_extensions.rb +3 -1
  41. data/vendor/plugins/engines/lib/engines/dependencies_extensions.rb +27 -16
  42. data/vendor/plugins/engines/lib/engines/routing_extensions.rb +28 -0
  43. data/vendor/plugins/engines/lib/engines/testing_extensions.rb +6 -2
  44. data/vendor/plugins/engines/lib/engines.rb +77 -12
  45. data/vendor/plugins/engines/tasks/deprecated_engines.rake +7 -0
  46. data/vendor/plugins/engines/tasks/engines.rake +25 -10
  47. data/vendor/plugins/login_engine/CHANGELOG +8 -0
  48. data/vendor/plugins/login_engine/README +2 -2
  49. data/vendor/plugins/login_engine/app/controllers/user_controller.rb +4 -1
  50. data/vendor/plugins/login_engine/app/views/user/forgot_password.rhtml +1 -1
  51. data/vendor/plugins/login_engine/init_engine.rb +6 -5
  52. data/vendor/plugins/login_engine/lib/login_engine/authenticated_user.rb +1 -1
  53. data/vendor/plugins/output_compression/CHANGELOG +0 -0
  54. data/vendor/plugins/output_compression/MIT-LICENSE +20 -0
  55. data/vendor/plugins/output_compression/README +4 -4
  56. data/vendor/plugins/output_compression/init.rb +1 -2
  57. data/vendor/plugins/output_compression/lib/output_compression.rb +84 -66
  58. data/vendor/plugins/output_compression/{Rakefile → rakefile} +22 -22
  59. data/vendor/plugins/output_compression/test/output_test.rb +11 -0
  60. data/vendor/plugins/output_compression/test/test_controller.rb +3 -0
  61. data/vendor/plugins/output_compression/test/test_helper.rb +14 -0
  62. data/vendor/plugins/responds_to_parent/MIT-LICENSE +20 -0
  63. data/vendor/plugins/responds_to_parent/README +42 -0
  64. data/vendor/plugins/responds_to_parent/Rakefile +22 -0
  65. data/vendor/plugins/responds_to_parent/init.rb +1 -0
  66. data/vendor/plugins/responds_to_parent/lib/responds_to_parent.rb +45 -0
  67. data/vendor/plugins/responds_to_parent/test/responds_to_parent_test.rb +115 -0
  68. metadata +33 -16
  69. data/vendor/plugins/login_engine/tasks/tasks.rake +0 -4
  70. data/vendor/plugins/output_compression/tasks/output_compression_tasks.rake +0 -4
  71. data/vendor/plugins/output_compression/test/output_compression_test.rb +0 -8
  72. /data/db/ROOT/parlement/news/{release0.1.txt → Version_01.txt} +0 -0
  73. /data/db/ROOT/parlement/news/{release0.2.txt → Version_02.txt} +0 -0
  74. /data/db/ROOT/parlement/news/{release0.3.txt → Version_03.txt} +0 -0
  75. /data/db/ROOT/parlement/news/{release0.4.txt → Version_04.txt} +0 -0
  76. /data/db/ROOT/parlement/news/{release0.5.txt → Version_05.txt} +0 -0
@@ -1,7 +1,7 @@
1
- <li id="elt_<%= elt.id %>" class="elt <%= 'titled' if displayTitle?(elt) %>">
1
+ <li id="elt_<%= elt.id %>" class="elt <%= 'titled' if displayTitle? elt %>">
2
2
  <script>setKnobs($('elt_<%= elt.id %>'));</script>
3
3
 
4
- <!-- Here to make sure a text browser could see it all on one line -->
4
+ <!-- The form is here to make sure a text browser can see it all on one line -->
5
5
  <%= form_remote_tag(
6
6
  :update => 'eltChoice_'+elt.id,
7
7
  :url => { :action => 'vote', :id => elt },
@@ -9,6 +9,16 @@
9
9
  :loaded => visual_effect(:Grow, 'eltChoice_'+elt.id, { :queue => 'end' })) %>
10
10
 
11
11
  <% if !elt.new_record? %>
12
+ <span class="eltQuickAdd" id="eltQuickAdd_<%= elt.id %>" title="<%= elt.created_on %>">
13
+ <%= link_to_remote('<span class="icon">&gt;&gt;</span>',
14
+ { :update => 'eltNew_'+elt.id.to_s,
15
+ :url => { :controller => 'elt', :action => 'new', :id => elt },
16
+ :loading => visual_effect(:SwitchOff, 'eltQuickAdd_'+elt.id.to_s),
17
+ :loaded => visual_effect(:BlindDown, 'eltNew_'+elt.id.to_s)+
18
+ visual_effect(:BlindDown, 'eltSubsClose_'+elt.id.to_s)},
19
+ { :href => url_for(:controller => 'elt', :action => 'new', :id => @elt)}) %>
20
+ </span>
21
+
12
22
  <span class="choice" id="eltChoice_<%= elt.id %>">
13
23
  <%= render :partial => '/elt/choice', :locals => { :elt => elt } %>
14
24
  </span>
@@ -16,9 +26,7 @@
16
26
 
17
27
  <% cache :action => 'show', :id => elt.id do %>
18
28
  <% if displayTitle? elt and elt.created_on %>
19
- <span class="created_on">
20
- <%= elt.created_on.strftime('%d/%m/%y %H:%M') %>
21
- </span>
29
+ <span class="created_on"><%= elt.created_on.strftime('%d/%m/%y %H:%M') %></span>
22
30
  <% end %>
23
31
 
24
32
  <% if elt.person %>
@@ -40,52 +48,48 @@
40
48
  </h1>
41
49
  <% end %>
42
50
 
43
- <%= format elt.body %>
44
- <% end %>
45
- <% @controller.expire_fragment( :action => 'show', :id => elt.id) if elt.new_record? %>
51
+ <% formattedBody = format elt.body %>
46
52
 
47
- <span class="eltQuickAdd" id="eltQuickAdd_<%= elt.id %>" title="<%= elt.created_on %>">
48
- <% if !elt.new_record? and elt.elts_count == 0 %>
49
- <%= link_to_remote('<span class="icon">&gt;&gt;</span>',
50
- { :update => 'eltNew_'+elt.id.to_s,
51
- :url => { :controller => 'elt', :action => 'new', :id => elt },
52
- :loading => visual_effect(:SwitchOff, 'eltQuickAdd_'+elt.id.to_s),
53
- :loaded => visual_effect(:BlindDown, 'eltNew_'+elt.id.to_s)+
54
- visual_effect(:BlindDown, 'eltSubsClose_'+elt.id.to_s)},
55
- { :href => url_for(:controller => 'elt', :action => 'new', :id => @elt)}) %>
56
- <% end %>
57
- </span>
53
+ <%= image_tag (elt.person && elt.person.image ? elt.person.image : "/javascripts/blank.gif"),
54
+ :onload => "setSize(this)",
55
+ :class => "avatar" \
56
+ if formattedBody.match(/[.\s]<p>/) %>
57
+
58
+ <%= formattedBody %>
58
59
 
59
- <% for att in elt.attachments %>
60
- <%= link_to image_tag('/attachment/file/'+att.file_relative_path),
61
- '/attachment/file/'+att.file_relative_path %>
60
+ <span class="attachments">
61
+ <% for att in elt.attachments %>
62
+ <%= link_to image_tag("/attachment/file/#{att.file_relative_path}"),
63
+ "/attachment/file/#{att.file_relative_path}" %>
64
+ <% end %>
65
+ </span>
62
66
  <% end %>
67
+ <% @controller.expire_fragment( :action => 'show', :id => elt.id) if elt.new_record? %>
63
68
 
64
69
  <!-- For IE -->&#160;
65
70
 
71
+ <!-- The choice end form, here to make sure it looks nice in text browsers -->
72
+ <%= end_form_tag %>
73
+
74
+ <div class="eltSubs">
66
75
  <span <%= 'style="display: none"' if (eltTop or elt.elts_count < 2) %>
67
76
  class="eltMore" id="eltMore_<%= elt.id %>">
68
77
  <%= link_to_remote(elt.elts_count.to_s+' more',
69
78
  { :update => 'eltSubs_'+elt.id.to_s,
70
79
  :url => { :controller => 'elt', :action => 'list', :id => elt },
71
- :loading => visual_effect(:SwitchOff, 'eltMore_'+elt.id.to_s),
72
- :loaded => visual_effect(:BlindDown, 'eltSubs_'+elt.id.to_s)+
73
- visual_effect(:BlindDown, 'eltSubsClose_'+elt.id.to_s),
74
- :complete => "Behaviour.apply();" },
80
+ :loading => visual_effect(:SwitchOff, "eltMore_#{elt.id.to_s}")+
81
+ visual_effect(:BlindDown, "eltSubs_#{elt.id.to_s}")+
82
+ visual_effect(:BlindDown, "eltSubsClose_#{elt.id.to_s}") },
75
83
  { :href => url_for(:controller => 'elt', :action => 'show', :id => elt) }) %>
76
84
 
77
85
  <%= link_to_remote('Add <span class="icon">&gt;&gt;</span>',
78
- { :update => 'eltNew_'+elt.id.to_s,
86
+ { :update => "eltNew_#{elt.id.to_s}",
79
87
  :url => { :controller => 'elt', :action => 'new', :id => elt },
80
- :loaded => visual_effect(:BlindDown, 'eltNew_'+elt.id.to_s)+
81
- visual_effect(:BlindDown, 'eltSubsClose_'+elt.id.to_s)},
88
+ :loaded => visual_effect(:BlindDown, "eltNew_#{elt.id.to_s}")+
89
+ visual_effect(:BlindDown, "eltSubsClose_#{elt.id.to_s}")},
82
90
  { :href => url_for(:controller => 'elt', :action => 'new', :id => elt)}) %>
83
91
  </span>
84
92
 
85
- <!-- The choice end form, here to make sure it looks nice in text browsers -->
86
- <%= end_form_tag %>
87
-
88
- <div class="eltSubs">
89
93
  <!-- Display automatically one element threads -->
90
94
  <ul <%= 'style="display: none"' unless (eltTop or elt.elts_count == 1) %>
91
95
  id="eltSubs_<%= elt.id %>" class="eltSub">
@@ -100,23 +104,16 @@
100
104
  id="eltSubsClose_<%= elt.id %>" title="<%= elt.created_on %>"
101
105
  class="eltSubsClose">
102
106
  <%= link_to_function('<span class="icon">&lt;&lt;</span> Close',
103
- visual_effect(:BlindUp, 'eltSubs_'+elt.id)+
104
- visual_effect(:BlindUp, 'eltNew_'+elt.id)+
105
- visual_effect(:BlindUp, 'eltSubsClose_'+elt.id)+
106
- visual_effect(:BlindDown, 'eltMore_'+elt.id)) %>
107
-
108
- <% if elt.person %>
109
- <%= link_to(elt.person.name,
110
- :controller => 'person', :action => 'show', :id => elt.person) %>
111
- <% elsif not displayTitle? elt %>
112
- <%= ANONYMOUS_POSTER %>
113
- <% end %>
107
+ visual_effect(:BlindUp, "eltSubs_#{elt.id}")+
108
+ visual_effect(:BlindUp, "eltNew_#{elt.id}")+
109
+ visual_effect(:BlindUp, "eltSubsClose_#{elt.id}")+
110
+ visual_effect(:BlindDown, "eltMore_#{elt.id}")) %>
114
111
 
115
112
  <%= link_to_remote('Add <span class="icon">&gt;&gt;</span>',
116
- { :update => 'eltNew_'+elt.id.to_s,
113
+ { :update => "eltNew_#{elt.id.to_s}",
117
114
  :url => { :controller => 'elt', :action => 'new', :id => elt },
118
- :loading => visual_effect(:BlindDown, 'eltNew_'+elt.id.to_s)+
119
- visual_effect(:BlindDown, 'eltSubsClose_'+elt.id.to_s)},
115
+ :loading => visual_effect(:BlindDown, "eltNew_#{elt.id.to_s}")+
116
+ visual_effect(:BlindDown, "eltSubsClose_#{elt.id.to_s}")},
120
117
  { :href => url_for(:controller => 'elt', :action => 'new', :id => elt)}) %>
121
118
  </span>
122
119
  </div>
@@ -14,13 +14,13 @@
14
14
  :url => { :action => 'listByDate', :id => @elt, :page => e_pages.last },
15
15
  :before => visual_effect(:BlindUp, 'listByDate', { :queue => 'end' }),
16
16
  :loading => visual_effect(:BlindDown, 'listByDate', { :queue => 'end' }) }) \
17
- if e_pages.last != e_pages.current %>
17
+ if e_pages.last != e_pages.current %>
18
18
  <%= link_to_remote('&lt;',
19
19
  { :update => 'listByDate',
20
20
  :url => { :action => 'listByDate', :id => @elt, :page => e_pages.current.next },
21
21
  :before => visual_effect(:BlindUp, 'listByDate', { :queue => 'end' }),
22
22
  :loading => visual_effect(:BlindDown, 'listByDate', { :queue => 'end' }) }) \
23
- if e_pages.current.next and e_pages.current.next != e_pages.last %>
23
+ if e_pages.current.next and e_pages.current.next != e_pages.last %>
24
24
 
25
25
  <span class="pageCount"><%= e_pages.length-e_pages.current.to_i+1 %></span>
26
26
 
@@ -29,22 +29,22 @@
29
29
  :url => { :action => 'listByDate', :id => @elt, :page => e_pages.current.previous },
30
30
  :before => visual_effect(:BlindUp, 'listByDate', { :queue => 'end' }),
31
31
  :loading => visual_effect(:BlindDown, 'listByDate', { :queue => 'end' }) }) \
32
- if e_pages.current.previous and e_pages.current.previous != e_pages.first %>
32
+ if e_pages.current.previous and e_pages.current.previous != e_pages.first %>
33
33
  <%= link_to_remote('&gt;|',
34
34
  { :update => 'listByDate',
35
35
  :url => { :action => 'listByDate', :id => @elt, :page => e_pages.first },
36
36
  :before => visual_effect(:BlindUp, 'listByDate', { :queue => 'end' }),
37
37
  :loading => visual_effect(:BlindDown, 'listByDate', { :queue => 'end' }) }) \
38
- if e_pages.first != e_pages.current %>
38
+ if e_pages.first != e_pages.current %>
39
39
  <% end %>
40
40
 
41
41
  <ul>
42
42
  <% elts.each do |elt| %>
43
- <li class="boxLine elt" title="<%= elt.created_on.strftime('%d/%m %H:%M') %>">
44
- <span class="created_on"><%= elt.created_on.strftime('%d/%m %H:%M') %></span>
43
+ <li class="boxLine elt" title="<%= elt.created_on.strftime '%d/%m %H:%M' %>">
44
+ <span class="created_on"><%= elt.created_on.strftime '%d/%m %H:%M' %></span>
45
45
  <% if elt.person %>
46
46
  <span class="author">
47
- &lt;<%= link_to(elt.person.name, :controller => 'person', :action => 'show', :id => elt.person) %>&gt;
47
+ &lt;<%= link_to elt.person.name, :controller => 'person', :action => 'show', :id => elt.person %>&gt;
48
48
  </span>
49
49
  <% elsif not displayTitle? elt %>
50
50
  <span class="author">&lt;<%= ANONYMOUS_POSTER %>&gt;</span>
@@ -8,18 +8,18 @@
8
8
  </div>
9
9
 
10
10
  <h3 class="boxTitle">Identity</h3>
11
- <div class="box">
11
+ <div class="box" id="identity">
12
12
  <div id="author_<%= @elt.id %>">
13
13
  <%= render :partial => 'account/show', :locals => { :divId => 'author_'+@elt.id } %>
14
14
  </div>
15
15
  </div>
16
16
 
17
- <% if @elt.elts_count > 0 %><h3 class="boxTitle">Highest posts</h3><% end %>
17
+ <h3 class="boxTitle">Highest posts</h3>
18
18
  <div class="box listByVote">
19
19
  <%= render :partial => '/elt/listByVote' %>
20
20
  </div>
21
21
 
22
- <% if @elt.elts_count > 0 %><h3 class="boxTitle">Latest posts</h3><% end %>
22
+ <h3 class="boxTitle">Latest posts</h3>
23
23
  <div class="box listByDate">
24
24
  <%= render :partial => '/elt/listByDate' %>
25
25
  </div>
@@ -34,6 +34,7 @@
34
34
  <div class="links">
35
35
  <a class="title" href="http://leparlement.org">Parlement</a>
36
36
  <span class="signets">
37
+ <a href="/people">people</a>
37
38
  <a href="http://rubyforge.org/projects/parlement">forge</a>
38
39
  <a href="http://www.gnu.org/licenses/gpl.html">GPL</a>
39
40
  </span>
@@ -1,4 +1,9 @@
1
1
  <div class="sidebar">
2
+ <div class="boxTitle">Avatar</div>
3
+ <div class="box" id="identity">
4
+ <%= image_tag (@person.image ? url_for_file_column("person", "image") : ""), :id => "avatar", :class => "avatar" %>
5
+ </div>
6
+
2
7
  <% if @person.subscribed_elts.size > 0 %>
3
8
  <div class="boxTitle">Subscribed elts</div>
4
9
  <% end %>
@@ -64,7 +64,7 @@ require 'rails_file_column'
64
64
  require 'jcode'
65
65
  $KCODE = 'u'
66
66
 
67
- PARLEMENT_VERSION='0.6'
67
+ PARLEMENT_VERSION='0.7'
68
68
 
69
69
  # How many elements are displayed at once
70
70
  PAGE_ELT_LENGTH = 10
@@ -0,0 +1,46 @@
1
+ Parlement (fr)
2
+
3
+ Forum, liste de diffusion, blog, page personnelle, salon de discussion,
4
+ journal.
5
+
6
+ p=. *ET*
7
+
8
+ Un outil d'écriture collaborative basé sur des principes démoractiques.
9
+
10
+ !{float:left;margin-right: 2em;}/attachment/file/architecture.png!
11
+
12
+ Avec le _paper_ nous votons:
13
+ * un jour
14
+ * un lieu
15
+ * un sujet
16
+
17
+ Avec _Internet_ nous pouvons voter:
18
+ * n'importe quand
19
+ * n'importe où
20
+ * n'importe quel sujet
21
+
22
+ C'est une révolution,
23
+ This is a revolution, breaking rules that go back to antic Greece. Rules that
24
+ probably contribute to the feeling of awe one can resent when comes election
25
+ day, but which also restrict our ability to participate in politics.
26
+
27
+ Now we can acquire three new freedoms: freedom of time, of place and of object.
28
+ we can vote from our home, in the middle of the night and on the small issues
29
+ that we care about.
30
+
31
+ There are consequences. For example if you can vote anytime, why not also
32
+ _change your vote_ if you so wish? If votes are permanent, why have dates and
33
+ agendas, except for outside conditions?
34
+
35
+ If you can vote on any issue, then why not allow _everybody to propose polls_?
36
+ No technical limitation limits that ability, but for our own capacity to follow
37
+ all of them. And in fact their number growing, _delegating_ your votes will
38
+ become a required feature, allowing you to concentrate on the parts that
39
+ interest you the most, while delegating your voice to someone you trust on
40
+ other matters.
41
+
42
+ If you can vote from anywhere, then you can vote in front of anybody, this
43
+ means _vote selling_ is a possibility. It is not anti democratic, it's a
44
+ feature. A feature that, yes, could result into an oligarchy, it all depends on
45
+ the value of our votes.
46
+
@@ -0,0 +1,25 @@
1
+ Version 0.6
2
+
3
+ Voting using V and Λ buttons (picturing -1 and +1 values, down and up).
4
+ Clicking on an existing vote resets it (equivalent to a 0 vote).
5
+
6
+ Votes recorded and replicated as mails. Elements also listed by their approval
7
+ (rss feed available).
8
+
9
+ * elements are now acts_as_nested_set AND acts_as_tree
10
+ * list by date, dynamic and managing all sub elements
11
+ * rss now manages _all_ sub elements
12
+ * compress_output
13
+ * google analytics plugin
14
+ * visual_effect queues
15
+ * close or open elements and their sub elements
16
+ * optimisations
17
+ * voting on the web page
18
+ * logging in and out changes appropriately +1 and -1 votes
19
+ * element id now generated from element subject
20
+ * element body now cached
21
+ * some spam tests when creating a new element
22
+ * list by vote
23
+ * possibility to see individual votes when clicking on a vote result
24
+ * Correcting a painful "null character" mishandling when mail is quoted printable
25
+
@@ -0,0 +1,12 @@
1
+ Version 0.7
2
+
3
+ Avatars
4
+
5
+ * avatar initial upload
6
+ * correcting an automatic elt id generation, now removing all non characters
7
+ * avatar upload, reception and emission by mail
8
+ * addition of a "people" page listing all current and past avatars
9
+ * logout now possible in text based browsers
10
+ * attachments now derive their id from their element's subject
11
+ * >> for one liners now better placed as floats
12
+
@@ -1,9 +1,18 @@
1
1
  Testing
2
2
 
3
- You can use the basic part of the system right now (no mailing list or chat, no
4
- vote, no delegation, no signatures, no electoral list, no P2P cluster). Just
5
- click on the *more* links to drill down into the available elements. Click on
6
- the *>>* links to propose new sub elements.
3
+ You can use the system right now:
7
4
 
8
- Do test this here!
5
+ * click on the *_n_ more* links to drill down into the available elements
6
+ * click on the <span class="icon">>></span> links to propose new sub elements
7
+ * click on <span class="choice" style="float:none"><label class="con">V</label>
8
+ or <label class="pro">&#x39B;</label></span> buttons to vote against or for
9
+ an element
9
10
 
11
+ No complex registration required, you can participate anonymously or just fill
12
+ a pseudo (top right corner) in order to be differentiated. This pseudo can be
13
+ password protected and email verified, or not. You choose.
14
+
15
+ I'm open to suggestions and follow closely everything said (every forum also
16
+ being a mailing list, it's easy to follow and answer to)!
17
+
18
+ Tell me what you think!
@@ -1,5 +1,7 @@
1
1
  Parlement
2
2
 
3
+ !/images/ParlementLogo.png!
4
+
3
5
  Forum, mailing list, blog, home page, chat room, newspaper.
4
6
 
5
7
  p=. *AND*
@@ -32,6 +32,18 @@ CREATE TABLE attachments (
32
32
  );
33
33
 
34
34
 
35
+ --
36
+ -- Name: attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: manu
37
+ --
38
+
39
+ CREATE SEQUENCE attachments_id_seq
40
+ START WITH 1
41
+ INCREMENT BY 1
42
+ NO MAXVALUE
43
+ NO MINVALUE
44
+ CACHE 1;
45
+
46
+
35
47
  --
36
48
  -- Name: choices; Type: TABLE; Schema: public; Owner: manu; Tablespace:
37
49
  --
@@ -77,6 +89,17 @@ CREATE TABLE elts (
77
89
  );
78
90
 
79
91
 
92
+ --
93
+ -- Name: elts_id_seq; Type: SEQUENCE; Schema: public; Owner: manu
94
+ --
95
+
96
+ CREATE SEQUENCE elts_id_seq
97
+ INCREMENT BY 1
98
+ NO MAXVALUE
99
+ NO MINVALUE
100
+ CACHE 1;
101
+
102
+
80
103
  --
81
104
  -- Name: engine_schema_info; Type: TABLE; Schema: public; Owner: manu; Tablespace:
82
105
  --
@@ -100,6 +123,18 @@ CREATE TABLE mails (
100
123
  );
101
124
 
102
125
 
126
+ --
127
+ -- Name: mails_id_seq; Type: SEQUENCE; Schema: public; Owner: manu
128
+ --
129
+
130
+ CREATE SEQUENCE mails_id_seq
131
+ START WITH 1
132
+ INCREMENT BY 1
133
+ NO MAXVALUE
134
+ NO MINVALUE
135
+ CACHE 1;
136
+
137
+
103
138
  --
104
139
  -- Name: people; Type: TABLE; Schema: public; Owner: manu; Tablespace:
105
140
  --
@@ -108,10 +143,22 @@ CREATE TABLE people (
108
143
  id text NOT NULL,
109
144
  created_on timestamp with time zone DEFAULT now() NOT NULL,
110
145
  name text,
111
- email text
146
+ email text,
147
+ image text
112
148
  );
113
149
 
114
150
 
151
+ --
152
+ -- Name: people_id_seq; Type: SEQUENCE; Schema: public; Owner: manu
153
+ --
154
+
155
+ CREATE SEQUENCE people_id_seq
156
+ INCREMENT BY 1
157
+ NO MAXVALUE
158
+ NO MINVALUE
159
+ CACHE 1;
160
+
161
+
115
162
  --
116
163
  -- Name: schema_info; Type: TABLE; Schema: public; Owner: manu; Tablespace:
117
164
  --
@@ -131,32 +178,38 @@ CREATE TABLE subscribers (
131
178
  );
132
179
 
133
180
 
181
+ --
182
+ -- Name: subscribers_id_seq; Type: SEQUENCE; Schema: public; Owner: manu
183
+ --
184
+
185
+ CREATE SEQUENCE subscribers_id_seq
186
+ INCREMENT BY 1
187
+ NO MAXVALUE
188
+ NO MINVALUE
189
+ CACHE 1;
190
+
191
+
134
192
  --
135
193
  -- Name: users; Type: TABLE; Schema: public; Owner: manu; Tablespace:
136
194
  --
137
195
 
138
196
  CREATE TABLE users (
139
197
  id serial NOT NULL,
140
- "login" character varying(80) DEFAULT ''::character varying NOT NULL,
141
- salted_password character varying(40) DEFAULT ''::character varying NOT NULL,
142
- email character varying(60) DEFAULT ''::character varying NOT NULL,
198
+ "login" text NOT NULL,
199
+ salted_password character varying(40) NOT NULL,
200
+ email character varying(60),
143
201
  firstname character varying(40),
144
202
  lastname character varying(40),
145
- salt character varying(40) DEFAULT ''::character varying NOT NULL,
203
+ salt character(40) NOT NULL,
146
204
  verified integer DEFAULT 0,
147
205
  "role" character varying(40),
148
- security_token character varying(40),
206
+ security_token character(40),
149
207
  token_expiry timestamp without time zone,
150
- created_at timestamp without time zone,
151
- updated_at timestamp without time zone,
152
- logged_in_at timestamp without time zone,
153
208
  deleted integer DEFAULT 0,
154
209
  delete_after timestamp without time zone
155
210
  );
156
211
 
157
212
 
158
- SET default_with_oids = true;
159
-
160
213
  --
161
214
  -- Name: usersold; Type: TABLE; Schema: public; Owner: manu; Tablespace:
162
215
  --
@@ -261,51 +314,65 @@ ALTER TABLE ONLY usersold
261
314
 
262
315
 
263
316
  --
264
- -- Name: attachments_elt_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: manu
317
+ -- Name: elts_parent; Type: INDEX; Schema: public; Owner: manu; Tablespace:
265
318
  --
266
319
 
267
- ALTER TABLE ONLY attachments
268
- ADD CONSTRAINT attachments_elt_id_fkey FOREIGN KEY (elt_id) REFERENCES elts(id);
320
+ CREATE INDEX elts_parent ON elts USING btree (parent_id);
269
321
 
270
322
 
271
323
  --
272
- -- Name: delegations_delegate_to_fkey; Type: FK CONSTRAINT; Schema: public; Owner: manu
324
+ -- Name: elts_parent_key; Type: INDEX; Schema: public; Owner: manu; Tablespace:
273
325
  --
274
326
 
275
- ALTER TABLE ONLY delegations
276
- ADD CONSTRAINT delegations_delegate_to_fkey FOREIGN KEY (delegate_to) REFERENCES people(id);
327
+ CREATE INDEX elts_parent_key ON elts USING btree (parent_id);
277
328
 
278
329
 
279
330
  --
280
- -- Name: delegations_elt_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: manu
331
+ -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: manu
281
332
  --
282
333
 
283
- ALTER TABLE ONLY delegations
284
- ADD CONSTRAINT delegations_elt_id_fkey FOREIGN KEY (elt_id) REFERENCES elts(id);
334
+ ALTER TABLE ONLY usersold
335
+ ADD CONSTRAINT "$1" FOREIGN KEY (person_id) REFERENCES people(id);
285
336
 
286
337
 
287
338
  --
288
- -- Name: delegations_person_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: manu
339
+ -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: manu
340
+ --
341
+
342
+ ALTER TABLE ONLY subscribers
343
+ ADD CONSTRAINT "$1" FOREIGN KEY (elt_id) REFERENCES elts(id);
344
+
345
+
346
+ --
347
+ -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: manu
289
348
  --
290
349
 
291
350
  ALTER TABLE ONLY delegations
292
- ADD CONSTRAINT delegations_person_id_fkey FOREIGN KEY (person_id) REFERENCES people(id);
351
+ ADD CONSTRAINT "$1" FOREIGN KEY (elt_id) REFERENCES elts(id);
293
352
 
294
353
 
295
354
  --
296
- -- Name: elts_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: manu
355
+ -- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: manu
297
356
  --
298
357
 
299
- ALTER TABLE ONLY elts
300
- ADD CONSTRAINT elts_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES elts(id);
358
+ ALTER TABLE ONLY subscribers
359
+ ADD CONSTRAINT "$2" FOREIGN KEY (person_id) REFERENCES people(id);
301
360
 
302
361
 
303
362
  --
304
- -- Name: elts_person_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: manu
363
+ -- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: manu
305
364
  --
306
365
 
307
- ALTER TABLE ONLY elts
308
- ADD CONSTRAINT elts_person_id_fkey FOREIGN KEY (person_id) REFERENCES people(id);
366
+ ALTER TABLE ONLY delegations
367
+ ADD CONSTRAINT "$2" FOREIGN KEY (person_id) REFERENCES people(id);
368
+
369
+
370
+ --
371
+ -- Name: $3; Type: FK CONSTRAINT; Schema: public; Owner: manu
372
+ --
373
+
374
+ ALTER TABLE ONLY delegations
375
+ ADD CONSTRAINT "$3" FOREIGN KEY (delegate_to) REFERENCES people(id);
309
376
 
310
377
 
311
378
  --
@@ -313,51 +380,59 @@ ALTER TABLE ONLY elts
313
380
  --
314
381
 
315
382
  ALTER TABLE ONLY choices
316
- ADD CONSTRAINT fk_elt_id FOREIGN KEY (elt_id) REFERENCES elts(id);
383
+ ADD CONSTRAINT fk_elt_id FOREIGN KEY (elt_id) REFERENCES elts(id) ON UPDATE CASCADE;
317
384
 
318
385
 
319
386
  --
320
- -- Name: fk_person_id; Type: FK CONSTRAINT; Schema: public; Owner: manu
387
+ -- Name: fk_elt_id; Type: FK CONSTRAINT; Schema: public; Owner: manu
321
388
  --
322
389
 
323
- ALTER TABLE ONLY choices
324
- ADD CONSTRAINT fk_person_id FOREIGN KEY (person_id) REFERENCES people(id);
390
+ ALTER TABLE ONLY attachments
391
+ ADD CONSTRAINT fk_elt_id FOREIGN KEY (elt_id) REFERENCES elts(id) ON UPDATE CASCADE;
325
392
 
326
393
 
327
394
  --
328
- -- Name: mails_elt_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: manu
395
+ -- Name: fk_elt_id; Type: FK CONSTRAINT; Schema: public; Owner: manu
396
+ --
397
+
398
+ ALTER TABLE ONLY elts
399
+ ADD CONSTRAINT fk_elt_id FOREIGN KEY (parent_id) REFERENCES elts(id) ON UPDATE CASCADE;
400
+
401
+
402
+ --
403
+ -- Name: fk_elt_id; Type: FK CONSTRAINT; Schema: public; Owner: manu
329
404
  --
330
405
 
331
406
  ALTER TABLE ONLY mails
332
- ADD CONSTRAINT mails_elt_id_fkey FOREIGN KEY (elt_id) REFERENCES elts(id);
407
+ ADD CONSTRAINT fk_elt_id FOREIGN KEY (elt_id) REFERENCES elts(id) ON UPDATE CASCADE;
333
408
 
334
409
 
335
410
  --
336
- -- Name: subscribers_elt_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: manu
411
+ -- Name: fk_person_id; Type: FK CONSTRAINT; Schema: public; Owner: manu
337
412
  --
338
413
 
339
- ALTER TABLE ONLY subscribers
340
- ADD CONSTRAINT subscribers_elt_id_fkey FOREIGN KEY (elt_id) REFERENCES elts(id);
414
+ ALTER TABLE ONLY users
415
+ ADD CONSTRAINT fk_person_id FOREIGN KEY ("login") REFERENCES people(name) ON UPDATE CASCADE;
341
416
 
342
417
 
343
418
  --
344
- -- Name: subscribers_person_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: manu
419
+ -- Name: fk_person_id; Type: FK CONSTRAINT; Schema: public; Owner: manu
345
420
  --
346
421
 
347
- ALTER TABLE ONLY subscribers
348
- ADD CONSTRAINT subscribers_person_id_fkey FOREIGN KEY (person_id) REFERENCES people(id);
422
+ ALTER TABLE ONLY elts
423
+ ADD CONSTRAINT fk_person_id FOREIGN KEY (person_id) REFERENCES people(id) ON UPDATE CASCADE;
349
424
 
350
425
 
351
426
  --
352
- -- Name: usersold_person_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: manu
427
+ -- Name: fk_person_id; Type: FK CONSTRAINT; Schema: public; Owner: manu
353
428
  --
354
429
 
355
- ALTER TABLE ONLY usersold
356
- ADD CONSTRAINT usersold_person_id_fkey FOREIGN KEY (person_id) REFERENCES people(id);
430
+ ALTER TABLE ONLY choices
431
+ ADD CONSTRAINT fk_person_id FOREIGN KEY (person_id) REFERENCES people(id) ON UPDATE CASCADE;
357
432
 
358
433
 
359
434
  --
360
435
  -- PostgreSQL database dump complete
361
436
  --
362
437
 
363
- INSERT INTO schema_info (version) VALUES (3)
438
+ INSERT INTO schema_info (version) VALUES (4)
@@ -0,0 +1,9 @@
1
+ class PeopleImage < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :people, :image, :text
4
+ end
5
+
6
+ def self.down
7
+ remove_column :people, :image
8
+ end
9
+ end