aboutsummaryrefslogtreecommitdiff
path: root/site
diff options
context:
space:
mode:
Diffstat (limited to 'site')
-rw-r--r--site/app/controllers/agendas_controller.rb2
-rw-r--r--site/app/models/agenda.rb6
-rw-r--r--site/db/schema.rb3
-rw-r--r--site/spec/models/agenda_spec.rb10
4 files changed, 19 insertions, 2 deletions
diff --git a/site/app/controllers/agendas_controller.rb b/site/app/controllers/agendas_controller.rb
index 18a178d..669f364 100644
--- a/site/app/controllers/agendas_controller.rb
+++ b/site/app/controllers/agendas_controller.rb
@@ -17,6 +17,8 @@ class AgendasController < ApplicationController
data = JSON.parse(request.env["rack.input"].read)
Agenda.update_voting_options data['agenda']
Agenda.process_results data data['votes']
+ agenda = Agenda.current
+ agenda.meeting_log = data['lines']
Participation.mark_participations data
end
diff --git a/site/app/models/agenda.rb b/site/app/models/agenda.rb
index 4a02dbb..c15b12e 100644
--- a/site/app/models/agenda.rb
+++ b/site/app/models/agenda.rb
@@ -5,6 +5,7 @@ class Agenda < ActiveRecord::Base
fields do
meeting_time :datetime
email_reminder_sent :boolean, :null => false, :default => false
+ meeting_log :text, :null => false, :default => ''
timestamps
end
@@ -32,7 +33,10 @@ class Agenda < ActiveRecord::Base
end
def update_permitted?
- acting_user.council_member? || acting_user.administrator?
+ return false if meeting_log_changed?
+ return true if acting_user.council_member?
+ return true if acting_user.administrator?
+ false
end
def destroy_permitted?
diff --git a/site/db/schema.rb b/site/db/schema.rb
index bc8535a..39dd08b 100644
--- a/site/db/schema.rb
+++ b/site/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20110624141720) do
+ActiveRecord::Schema.define(:version => 20110627151021) do
create_table "agenda_items", :force => true do |t|
t.string "title"
@@ -34,6 +34,7 @@ ActiveRecord::Schema.define(:version => 20110624141720) do
t.string "state", :default => "open"
t.datetime "key_timestamp"
t.boolean "email_reminder_sent", :default => false, :null => false
+ t.text "meeting_log", :default => "", :null => false
end
add_index "agendas", ["state"], :name => "index_agendas_on_state"
diff --git a/site/spec/models/agenda_spec.rb b/site/spec/models/agenda_spec.rb
index 05212d0..f1de822 100644
--- a/site/spec/models/agenda_spec.rb
+++ b/site/spec/models/agenda_spec.rb
@@ -31,6 +31,16 @@ describe Agenda do
end
end
+ it 'should allow no one to edit or change meeting_log' do
+ a = Factory(:agenda)
+ a.meeting_log = 'changed'
+
+ for u in users_factory(AllRoles)
+ a.should_not be_editable_by(u, :meeting_log)
+ a.should_not be_updatable_by(u)
+ end
+ end
+
def test_migration(object, migration, prohibited, allowed, final_state)
# object - object to migrate
# migration - migration name