UI refinements #2417

* Add a confirm dialog on re-opening an agenda
* Show the tab (minutes or agenda) of the currently editable content
* Add the author and a comment to the open and close agenda actions
pull/6827/head
Felix Schäfer 14 years ago
parent fed787cfb8
commit bfa82efb1d
  1. 1
      app/controllers/meetings_controller.rb
  2. 10
      app/models/meeting_agenda.rb
  3. 2
      app/views/meeting_contents/_show.html.erb
  4. 3
      config/locales/de.yml
  5. 3
      config/locales/en.yml
  6. 11
      features/meeting_close.feature
  7. 27
      features/meetings_show.feature
  8. 3
      spec/controllers/meetings_controller_spec.rb
  9. 3
      spec/models/meeting_agenda_spec.rb

@ -13,6 +13,7 @@ class MeetingsController < ApplicationController
end
def show
params[:tab] = "minutes" if @meeting.agenda.present? && @meeting.agenda.locked?
end
def create

@ -1,10 +1,12 @@
class MeetingAgenda < MeetingContent
def lock!
update_attribute :locked, true
# TODO: internationalize the comments
def lock!(user = User.current)
update_attributes :locked => true, :author => user, :comment => "Agenda closed"
end
def unlock!
update_attribute :locked, false
def unlock!(user = User.current)
update_attributes :locked => false, :author => user, :comment => "Agenda opened"
end
def editable?

@ -3,7 +3,7 @@
<div class="contextual">
<%= link_to l(:button_edit), "#", :class => 'icon icon-edit', :accesskey => accesskey(:edit), :onclick => "Element.show(\"edit-#{content_type}\"); Element.hide(\"#{content_type}-text\"); return false;" if authorize_for(content_type.pluralize, 'update') && content.editable? %>
<%= link_to_if_authorized(l(:label_history), {:controller => content_type.pluralize, :action => 'history', :meeting_id => content.meeting}, :class => 'icon icon-history') %>
<%= content.locked? ? link_to_if_authorized(l(:label_meeting_open), {:controller => content_type.pluralize, :action => 'open', :meeting_id => content.meeting}, :method => :put, :class => 'icon icon-lock') : link_to_if_authorized(l(:label_meeting_close), {:controller => content_type.pluralize, :action => 'close', :meeting_id => content.meeting}, :method => :put, :class => 'icon icon-lock') %>
<%= (content.locked? ? link_to_if_authorized(l(:label_meeting_open), {:controller => content_type.pluralize, :action => 'open', :meeting_id => content.meeting}, :method => :put, :class => 'icon icon-lock', :confirm => l(:text_meeting_agenda_open_are_you_sure)) : link_to_if_authorized(l(:label_meeting_close), {:controller => content_type.pluralize, :action => 'close', :meeting_id => content.meeting}, :method => :put, :class => 'icon icon-lock')) if content_type == "meeting_agenda" %>
</div>
<h2><%=l :"label_#{content_type}" %></h2>
<% if authorize_for(content_type.pluralize, 'update') && content.editable? -%>

@ -20,4 +20,5 @@ de:
permission_view_meetings: "Meetings ansehen"
permission_create_meeting_agendas: "Agenden anlegen/bearbeiten"
permission_create_meeting_minutes: "Protokolle anlegen/bearbeiten"
text_in_hours: "in Stunden"
text_in_hours: "in Stunden"
text_meeting_agenda_open_are_you_sure: "Nicht-gespeicherte Inhalte des Protokolls werden durch diese Aktion verworfen! Weitermachen?"

@ -20,4 +20,5 @@ en:
permission_view_meetings: "View meetings"
permission_create_meeting_agendas: "Manage agendas"
permission_create_meeting_minutes: "Manage minutes"
text_in_hours: "in hours"
text_in_hours: "in hours"
text_meeting_agenda_open_are_you_sure: "Unsaved content in the minutes will be lost! Continue?"

@ -23,6 +23,7 @@ Feature: Close and open meeting agendas
When I login as "alice"
And I go to the Meetings page for the project called "dingens"
And I click on "Bobs Meeting"
And I click on "Agenda"
Then I should not see "Close" within ".meeting_agenda"
@javascript
@ -34,6 +35,7 @@ Feature: Close and open meeting agendas
And I go to the Meetings page for the project called "dingens"
And I click on "Bobs Meeting"
And I click on "Close"
And I click on "Agenda"
Then I should not see "Close" within ".meeting_agenda"
And I should see "Open" within ".meeting_agenda"
@ -42,12 +44,14 @@ Feature: Close and open meeting agendas
Given the role "user" may have the following rights:
| view_meetings |
| close_meeting_agendas |
And the meeting "Bobs Meeting" has 1 agenda with:
| locked | true |
# This won't work because the needed "click on open" has a confirm() which cucumber doesn't seem to handle
# And the meeting "Bobs Meeting" has 1 agenda with:
# | locked | true |
When I login as "alice"
And I go to the Meetings page for the project called "dingens"
And I click on "Bobs Meeting"
And I click on "Open"
And I click on "Agenda"
# And I click on "Open"
Then I should not see "Open" within ".meeting_agenda"
And I should see "Close" within ".meeting_agenda"
@ -61,4 +65,5 @@ Feature: Close and open meeting agendas
When I login as "alice"
And I go to the Meetings page for the project called "dingens"
And I click on "Bobs Meeting"
And I click on "Agenda"
Then I should not see "Edit" within ".meeting_agenda"

@ -15,20 +15,41 @@ Feature: Show meetings
And the user "alice" is a "user" in the project "dingens"
And there is 1 meeting in project "dingens" created by "bob" with:
| title | Bobs Meeting |
@javascript
Scenario: Navigate to a meeting page with an open agenda
Given the role "user" may have the following rights:
| view_meetings |
When I login as "alice"
And I go to the Meetings page for the project called "dingens"
And I click on "Bobs Meeting"
Then I should see "Agenda" within ".meeting_agenda" # I should see the Agenda tab
@javascript
Scenario: Navigate to a meeting page with a closed agenda
Given the role "user" may have the following rights:
| view_meetings |
And the meeting "Bobs Meeting" has 1 agenda with:
| locked | true |
When I login as "alice"
And I go to the Meetings page for the project called "dingens"
And I click on "Bobs Meeting"
Then I should see "Minutes" within ".meeting_minutes" # I should see the Minutes tab
@javascript
Scenario: Navigate to a meeting page with an open agenda and the permission to edit the minutes
Given the role "user" may have the following rights:
| view_meetings |
| create_meeting_minutes |
When I login as "alice"
And I go to the Meetings page for the project called "dingens"
And I click on "Bobs Meeting"
# Make sure we're on the right tab
And I click on "Minutes"
Then I should not see "Edit" within ".meeting_minutes"
@javascript
Scenario: Navigate to a meeting page with a closed agenda
Scenario: Navigate to a meeting page with a closed agenda and the permission to edit the agenda
Given the role "user" may have the following rights:
| view_meetings |
| create_meeting_agendas |
@ -37,4 +58,6 @@ Feature: Show meetings
When I login as "alice"
And I go to the Meetings page for the project called "dingens"
And I click on "Bobs Meeting"
# Make sure we're on the right tab
And I click on "Agenda"
Then I should not see "Edit" within ".meeting_agenda"

@ -27,7 +27,8 @@ describe MeetingsController do
before(:each) do
@m = mock_model(Meeting)
Meeting.stub!(:find).and_return(@m)
@m.stub(:project).and_return(@p)
@m.stub!(:project).and_return(@p)
@m.stub!(:agenda).stub!(:present?).and_return(false)
end
describe "html" do
before(:each) do

@ -6,6 +6,7 @@ describe "MeetingAgenda" do
@a = Factory.build :meeting_agenda, :text => "Some content...\n\nMore content!\n\nExtraordinary content!!"
end
# TODO: Test the right user and messages are set in the history
describe "#lock!" do
it "locks the agenda" do
@a.save
@ -25,7 +26,7 @@ describe "MeetingAgenda" do
end
end
# a meeting agendat is editable when it is not locked
# a meeting agenda is editable when it is not locked
describe "#editable?" do
it "is editable when not locked" do
@a.editable?.should be_true

Loading…
Cancel
Save