parlement 0.12 → 0.13

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.
@@ -0,0 +1,19 @@
1
+ class CreateVisits < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :visits do |t|
4
+ t.column :person_id, :string
5
+ t.column :elt_id, :string, :null => false
6
+ t.column :created_on, :datetime, :null => false
7
+ t.column :updated_on, :datetime
8
+ t.column :filter, :integer, :default => 0
9
+ end
10
+
11
+ execute 'ALTER TABLE visits ADD CONSTRAINT visits_elt_person_key UNIQUE ( elt_id, person_id ) '
12
+ execute 'ALTER TABLE visits ADD CONSTRAINT visits_elt_id FOREIGN KEY ( elt_id ) REFERENCES elts( id ) ON UPDATE CASCADE ON DELETE CASCADE'
13
+ execute 'ALTER TABLE visits ADD CONSTRAINT visits_person_id FOREIGN KEY ( person_id ) REFERENCES people( id ) ON UPDATE CASCADE ON DELETE CASCADE '
14
+ end
15
+
16
+ def self.down
17
+ drop_table :visits
18
+ end
19
+ end
@@ -0,0 +1,18 @@
1
+ class CreateOldVisits < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :old_visits do |t|
4
+ t.column :person_id, :string
5
+ t.column :elt_id, :string, :null => false
6
+ t.column :created_on, :datetime, :null => false
7
+ t.column :updated_on, :datetime
8
+ t.column :filter, :integer, :default => 0
9
+ end
10
+
11
+ execute 'ALTER TABLE old_visits ADD CONSTRAINT old_visits_elt_person_key UNIQUE ( elt_id, person_id ) '
12
+ execute 'ALTER TABLE old_visits ADD CONSTRAINT old_visits_elt_id FOREIGN KEY ( elt_id ) REFERENCES elts( id ) ON UPDATE CASCADE ON DELETE CASCADE'
13
+ end
14
+
15
+ def self.down
16
+ drop_table :old_visits
17
+ end
18
+ end
@@ -0,0 +1,9 @@
1
+ class AddPersonLastLogin < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :people, :last_login, :datetime
4
+ end
5
+
6
+ def self.down
7
+ remove_column :people, :last_login
8
+ end
9
+ end
data/db/schema.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  # migrations feature of ActiveRecord to incrementally modify your database, and
3
3
  # then regenerate this schema definition.
4
4
 
5
- ActiveRecord::Schema.define(:version => 6) do
5
+ ActiveRecord::Schema.define(:version => 9) do
6
6
 
7
7
  create_table "attachments", :force => true do |t|
8
8
  t.column "elt_id", :text, :null => false
@@ -58,11 +58,22 @@ ActiveRecord::Schema.define(:version => 6) do
58
58
  t.column "file", :text
59
59
  end
60
60
 
61
+ create_table "old_visits", :force => true do |t|
62
+ t.column "person_id", :string
63
+ t.column "elt_id", :string, :null => false
64
+ t.column "created_on", :datetime, :null => false
65
+ t.column "updated_on", :datetime
66
+ t.column "filter", :integer, :default => 0
67
+ end
68
+
69
+ add_index "old_visits", ["person_id", "elt_id"], :name => "old_visits_elt_person_key", :unique => true
70
+
61
71
  create_table "people", :force => true do |t|
62
72
  t.column "created_on", :datetime, :null => false
63
73
  t.column "name", :text
64
74
  t.column "email", :text
65
75
  t.column "image", :text
76
+ t.column "last_login", :datetime
66
77
  end
67
78
 
68
79
  add_index "people", ["name"], :name => "people_name_key", :unique => true
@@ -106,4 +117,14 @@ ActiveRecord::Schema.define(:version => 6) do
106
117
 
107
118
  add_index "usersold", ["person_id"], :name => "usersold_person_id_key", :unique => true
108
119
 
120
+ create_table "visits", :force => true do |t|
121
+ t.column "person_id", :string
122
+ t.column "elt_id", :string, :null => false
123
+ t.column "created_on", :datetime, :null => false
124
+ t.column "updated_on", :datetime
125
+ t.column "filter", :integer, :default => 0
126
+ end
127
+
128
+ add_index "visits", ["person_id", "elt_id"], :name => "visits_elt_person_key", :unique => true
129
+
109
130
  end
Binary file
Binary file
@@ -15,6 +15,9 @@ var myrules = {
15
15
 
16
16
  /* Called for each element to set its knobs */
17
17
  function setKnobs(elt) {
18
+ // To not filter out the top element
19
+ if (elt.parentNode.getAttribute('class') == 'top') return;
20
+
18
21
  var knobOpened = document.createElement("a");
19
22
  Element.addClassName(knobOpened, "knobOpened");
20
23
  knobOpened.href = "#";
@@ -37,10 +40,12 @@ function setKnobs(elt) {
37
40
  * the filter
38
41
  */
39
42
  function setKnob(elt, result) {
43
+ // To not filter out the top element
44
+ if (elt.parentNode.getAttribute('class') == 'top') return;
45
+
40
46
  var f = document.filterForm.filter;
41
47
  var filter = parseInt(f.options[f.selectedIndex].value);
42
48
 
43
- Element.removeClassName(elt, 'opened');
44
49
  if (filter == 'null' || result >= filter) {
45
50
  Element.removeClassName(elt, 'closed');
46
51
  } else if (result < filter) {
@@ -114,9 +119,14 @@ function setCookie(name, value) {
114
119
 
115
120
 
116
121
  /*
117
- * This is not the value itself, but an index
122
+ * The parameter 'filter' is not the value itself, but an index!
118
123
  */
119
- function setFilter(filter) {
124
+ function setFilter(filter, elt) {
125
+ setCookie('filter', document.filterForm.filter.selectedIndex);
126
+
127
+ new Ajax.Updater('listByVote', '/elt/listByVote/'+elt, { asynchronous:true, evalScripts:true });
128
+ new Ajax.Updater('listByDate', '/elt/listByDate/'+elt, { asynchronous:true, evalScripts:true });
129
+
120
130
  document.getElementsByClassName('result').each( function(result) {
121
131
  //alert(parseInt(result.innerHTML)+', '+filter);
122
132
  Element.removeClassName(result.parentNode.parentNode.parentNode, 'opened');
@@ -126,7 +136,6 @@ function setFilter(filter) {
126
136
  Element.addClassName(result.parentNode.parentNode.parentNode, 'closed');
127
137
  }
128
138
  });
129
- setCookie('filter', document.filterForm.filter.selectedIndex);
130
139
  }
131
140
 
132
141
  function setFilterFromCookie() {
@@ -67,8 +67,7 @@ h1 input {
67
67
 
68
68
  #elt_parlement > form > .created_on, #elt_parlement > .knobOpened,
69
69
  #elt_parlement > * > h1 a, #elt_fr > form > .created_on, #elt_fr > .knobOpened,
70
- #elt_fr > * > h1 a {
71
- display: none; }
70
+ #elt_fr > * > h1 a { display: none; }
72
71
 
73
72
  legend, a:link, select, input[type='Button'], input[type='submit'] { color: #3b76ae; }
74
73
  a:visited { color: #1b568e; }
@@ -136,6 +135,10 @@ h1 .help {
136
135
  / __| |/ _` |/ _ \ '_ \ / _` | '__|
137
136
  \__ \ | (_| | __/ |_) | (_| | |
138
137
  |___/_|\__,_|\___|_.__/ \__,_|_| */
138
+ #spinner img {
139
+ position: absolute;
140
+ right: 4.5%;
141
+ top: 3em; }
139
142
  .sidebar, .links {
140
143
  text-align: center;
141
144
  background: white;
@@ -168,22 +171,26 @@ h1 .help {
168
171
  letter-spacing: 0.5em; }
169
172
  .signets { font-size: smaller; }
170
173
 
171
- .boxTitle {
172
- color: #ff4;
173
- text-align: left;
174
- font-size: medium;
175
- font-weight: bolder;
176
- padding: 0.3em 0.6em;
177
- border: outset thin #3b76ae;
178
- background: #3b76ae url(/images/Sleep-Deprivation-5.JPG); }
179
174
  .box {
180
- padding: 1px;
181
175
  background: #ccc;
182
176
  font-size: smaller;
183
177
  margin-bottom: 1em;
184
178
  padding-bottom: 0.5em;
185
179
  border: outset thin #ccc;
186
180
  border-top: none; }
181
+ .boxTitle {
182
+ color: #ff4;
183
+ text-align: left;
184
+ font-size: medium;
185
+ font-weight: bolder;
186
+ padding: 0.3em 0.6em;
187
+ background: #3b76ae url(/images/Sleep-Deprivation-5.JPG); }
188
+ .feed {
189
+ width: 28px;
190
+ height: 28px;
191
+ float: right;
192
+ margin: 1px 5px 0 0; }
193
+ .feed img { max-width: 100%; }
187
194
  .boxLine {
188
195
  text-align: left;
189
196
  margin-left: 1em; }
@@ -193,30 +200,33 @@ h1 .help {
193
200
  .boxMore {
194
201
  text-align: right;
195
202
  font-weight: bolder; }
203
+ .box .filter { display: none; }
204
+ .box:hover .filter { display: inline; }
196
205
 
197
- #identity form { display: block; }
198
- #identity #edit, #identity iframe { display: none; }
199
- #identity:hover #edit { display: block; }
200
- #identity fieldset#edit {
206
+ .identity form { display: block; }
207
+ .identity #edit, .identity iframe { display: none; }
208
+ .identity:hover #edit { display: block; }
209
+ .identity fieldset#edit {
201
210
  border: solid thin yellow;
202
211
  padding: 0.5em 0;
203
212
  margin: 0.5em 0; }
204
- #identity fieldset#edit label { color: #3b76ae; }
213
+ .identity fieldset#edit label { color: #3b76ae; }
205
214
  img.avatar {
206
215
  float: left;
207
216
  width: auto;
208
217
  max-width: 30%;
209
218
  _max-width: none;
210
219
  margin-right: 1em; }
211
- #identity img.avatar {
220
+ .identity img.avatar {
212
221
  float: none;
213
222
  margin: 0 auto;
214
223
  display: block;
215
224
  max-width: 90%;
216
225
  _max-width: none;
217
226
  width: expression((offsetWidth > document.body.offsetWidth*0.3) ? "100%" : offsetWidth); }
227
+ .elt .identity img.avatar { float: left; }
218
228
 
219
- #filter {
229
+ #filter select {
220
230
  border: none;
221
231
  text-align: center; }
222
232
  form#filterForm a {
@@ -224,20 +234,20 @@ form#filterForm a {
224
234
  font-weight: bolder; }
225
235
  form#filterForm input[type='submit'] { display: none; }
226
236
 
227
- div.listByDate ul, div.listByVote ul {
237
+ #listByDate ul, #listByVote ul {
228
238
  margin: 0 3px;
229
239
  padding: 0; }
230
- div#listByDate li.boxLine, div#listByVote li.boxLine {
240
+ #listByDate ul li.boxLine, #listByVote ul li.boxLine {
231
241
  background: none;
232
242
  border-bottom: solid 1px #fd8; }
233
- div#listByDate .created_on, div#listByVote .created_on { display: none; }
234
- div#listByDate .author, div#listByVote .author { font-size: smaller; }
235
- div#listByDate .result, div#listByVote .result {
243
+ #listByDate .created_on, #listByVote .created_on { display: none; }
244
+ #listByDate .author, #listByVote .author { font-size: smaller; }
245
+ #listByDate .result, #listByVote .result {
236
246
  font-weight: bolder;
237
247
  float: right;
238
248
  color: blue; }
239
249
 
240
- div#subscription + .boxLine + .boxLineR { font-size: smaller; }
250
+ div#listSubscribers .boxLineR { font-size: smaller; }
241
251
 
242
252
  .box h4 {
243
253
  margin: 0;
@@ -417,27 +427,21 @@ li.pager {
417
427
  border: solid 1px #fd8;
418
428
  text-decoration: none;
419
429
  font-weight: bolder;
420
- position: absolute;
421
- background: white;
422
- margin-left: -2%; }
430
+ background: white; }
431
+ .knobOpened {;
432
+ margin-left: -16px;
433
+ position: absolute; }
423
434
  .knobOpened:link, .knobOpened:visited, .knobClosed:link, .knobClosed:visited {
424
435
  color: orange; }
425
436
 
426
- .closed ul.eltSub, .closed ul.eltNew { display: block; }
427
-
428
- .knobClosed, .closed .knobOpened, .opened .knobClosed, .closed .opened .knobClosed,
429
- .closed p, .closed pre, .closed blockquote, .closed ol, .closed hr, .closed ul,
430
- .closed img, .closed label, .closed .result, .closed div.tooLarge,
431
- .closed .eltQuickAdd, .closed .author {
432
- display: none; }
433
- .knobOpened, .closed .knobClosed, .opened .knobOpened, .opened p, .opened pre,
434
- .opened blockquote, .opened ol, .opened hr, .opened ul, .opened img, .opened div.tooLarge,
435
- .opened .eltQuickAdd {
436
- display: block; }
437
- .opened label, .opened .result, .opened .author { display: inline; }
438
-
439
- .closed { color: #ddd; }
440
- .closed .opened { color: black; }
437
+ .closed .knobOpened, .elt .knobClosed,
438
+ .closed form, .closed ul.eltSub, .closed ul.eltNew, .closed .eltSubsClose { display: none; }
439
+
440
+ .closed, .closed .knobClosed {
441
+ position: relative;
442
+ background: white;
443
+ display: inline;
444
+ right: 8px; }
441
445
 
442
446
  /* _ _
443
447
  _ __ ___ ___ ____ | |__ ___ _ __ __| | ___ _ __
@@ -0,0 +1,10 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class VisitTest < Test::Unit::TestCase
4
+ fixtures :visits
5
+
6
+ # Replace this with your real tests.
7
+ def test_truth
8
+ assert true
9
+ end
10
+ end