From 2f36954f01d7c9021c1b271b74bf369cda81549f Mon Sep 17 00:00:00 2001 From: Alfonso Juan Dillera Date: Mon, 24 Feb 2014 17:29:49 +0800 Subject: [PATCH 1/8] Added fields for agenda and highlights. --- app/controllers/meetings_controller.rb | 4 ++++ app/views/meetings/_form_meeting.html.erb | 2 ++ app/views/meetings/show_meeting.html.erb | 8 ++++++++ config/locales/en.yml | 4 +++- db/migrate/004_additional_fields.rb | 11 +++++++++++ 5 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 db/migrate/004_additional_fields.rb diff --git a/app/controllers/meetings_controller.rb b/app/controllers/meetings_controller.rb index c1bf9ff..c9536af 100644 --- a/app/controllers/meetings_controller.rb +++ b/app/controllers/meetings_controller.rb @@ -95,6 +95,8 @@ def create_meeting @meeting = Meeting.new(:project => @project, :start_date => DateTime.now, :end_date => DateTime.now + 3600, :author => User.current, :web => false) @meeting.subject = params[:meeting][:subject] @meeting.description = params[:meeting][:description] + @meeting.agenda = params[:meeting][:agenda] + @meeting.highlights = params[:meeting][:highlights] @meeting.location = params[:meeting][:location] @meeting.web = (params[:meeting][:web] == 'on') tdate = Date.parse(params[:meeting][:start_date_date]) @@ -120,6 +122,8 @@ def edit_meeting def update_meeting @meeting.subject = params[:meeting][:subject] @meeting.description = params[:meeting][:description] + @meeting.agenda = params[:meeting][:agenda] + @meeting.highlights = params[:meeting][:highlights] @meeting.location = params[:meeting][:location] @meeting.web = (params[:meeting][:web] == 'on') tdate = Date.parse(params[:meeting][:start_date_date]) diff --git a/app/views/meetings/_form_meeting.html.erb b/app/views/meetings/_form_meeting.html.erb index ab60cbf..3032392 100644 --- a/app/views/meetings/_form_meeting.html.erb +++ b/app/views/meetings/_form_meeting.html.erb @@ -5,6 +5,8 @@

<%= f.text_field :end_date_date, :required => true, :size => 10 %><%= calendar_for('meeting_end_date_date') %>  -  <%= select_time @meeting_tz.utc_to_local(@meeting.end_date_time), :prefix => 'end_time', :minute_step => 5, :time_separator => ':' %>

<%= f.text_area :description, :cols => 60, :rows => 10, :class => 'wiki-edit' %> +

<%= f.text_area :agenda, :cols => 60, :rows => 10, :class => 'wiki-edit' %> +

<%= f.text_area :highlights, :cols => 60, :rows => 10, :class => 'wiki-edit' %> <%= wikitoolbar_for 'meeting_description' %>

<%= label_tag('attachments[1][file]', l(:label_attachment_plural))%><%= render :partial => 'attachments/form' %>

diff --git a/app/views/meetings/show_meeting.html.erb b/app/views/meetings/show_meeting.html.erb index 2240564..74260da 100644 --- a/app/views/meetings/show_meeting.html.erb +++ b/app/views/meetings/show_meeting.html.erb @@ -25,6 +25,14 @@
<%= textilizable @meeting, :description, :attachments => @meeting.attachments %>
+

<%=l(:field_agenda)%>

+
+<%= textilizable @meeting, :agenda %> +
+

<%=l(:field_highlights)%>

+
+<%= textilizable @meeting, :highlights %> +
<%= l(:field_doodle_users) %> diff --git a/config/locales/en.yml b/config/locales/en.yml index ea95f2c..c7bdde4 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -25,6 +25,8 @@ en: field_end_date_date: End field_location: Location field_meeting_web: Use the conference room dedicated to the project + field_agenda: Agenda + field_highlights: Highlights label_doodle_plural: "Doodles" label_title_doodle: "Doodle" @@ -77,4 +79,4 @@ en: cancel_meeting_email1: "The following meeting has been cancelled/deleted" cancel_meeting_email2: "This meeting can be removed from your calendar using the attached file, meeting.ics (instructions depend from the software you are using)." - download_ics: "ICS (ICalendar)" \ No newline at end of file + download_ics: "ICS (ICalendar)" diff --git a/db/migrate/004_additional_fields.rb b/db/migrate/004_additional_fields.rb new file mode 100644 index 0000000..7196527 --- /dev/null +++ b/db/migrate/004_additional_fields.rb @@ -0,0 +1,11 @@ +class AdditionalFields < ActiveRecord::Migration + def up + add_column :meetings, :agenda, :text + add_column :meetings, :highlights, :text + end + + def down + remove_column :meetings, :agenda + remove_column :meetings, :highlights + end +end From 8fa5ddc807e01f8e3de990ef3bdcd845ea5b1adc Mon Sep 17 00:00:00 2001 From: Alfonso Juan Dillera Date: Tue, 25 Feb 2014 18:24:50 +0800 Subject: [PATCH 2/8] Added link to create a new task. --- app/views/meetings/_form_meeting.html.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/meetings/_form_meeting.html.erb b/app/views/meetings/_form_meeting.html.erb index 3032392..7b5238f 100644 --- a/app/views/meetings/_form_meeting.html.erb +++ b/app/views/meetings/_form_meeting.html.erb @@ -3,6 +3,7 @@

<%= f.text_field :location, :size => 80 %>
<%= check_box_tag 'meeting[web]', 'on', @meeting.web %><%= l(:field_meeting_web) %>

<%= f.text_field :start_date_date, :required => true, :size => 10, :onchange => "sync_date('meeting_start_date_date','meeting_end_date_date')" %><%= calendar_for('meeting_start_date_date') %>  -  <%= select_time @meeting_tz.utc_to_local(@meeting.start_date_time), {:prefix => 'start_time', :minute_step => 5, :time_separator => ':' }, { :onchange => "sync_time(this,'start_time','end_time')" } %>   <%= l(:field_time_zone) %>: <%= User.current.time_zone ? User.current.time_zone : ActiveSupport::TimeZone[Setting.plugin_redmine_meetings['meeting_timezone']] %>

<%= f.text_field :end_date_date, :required => true, :size => 10 %><%= calendar_for('meeting_end_date_date') %>  -  <%= select_time @meeting_tz.utc_to_local(@meeting.end_date_time), :prefix => 'end_time', :minute_step => 5, :time_separator => ':' %>

+

<%= link_to l('easy_pages.modules.issues_create_new'), new_project_issue_path(@project) %>

<%= f.text_area :description, :cols => 60, :rows => 10, :class => 'wiki-edit' %>

<%= f.text_area :agenda, :cols => 60, :rows => 10, :class => 'wiki-edit' %> From 6c5ffe2424eb3ee9506be53f020135609d338217 Mon Sep 17 00:00:00 2001 From: Alfonso Juan Dillera Date: Tue, 25 Feb 2014 18:25:25 +0800 Subject: [PATCH 3/8] Added styling to select boxes for hours and minutes. --- assets/stylesheets/redmine_meetings.css | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/assets/stylesheets/redmine_meetings.css b/assets/stylesheets/redmine_meetings.css index 6b6de9e..77817b3 100644 --- a/assets/stylesheets/redmine_meetings.css +++ b/assets/stylesheets/redmine_meetings.css @@ -25,4 +25,6 @@ div.meeting { background-color: #F7A95A; display:block; border: 1px solid black; div.webmeeting { background-color: #A7FAA0; display:block; border: 1px solid black; } div.meeting.day.tooltip { background-color: #F7A95A; display:block; width: 49%; border: 1px solid black; } -div.webmeeting.day.tooltip { background-color: #A7FAA0; display:block; width: 49%; border: 1px solid black; } \ No newline at end of file +div.webmeeting.day.tooltip { background-color: #A7FAA0; display:block; width: 49%; border: 1px solid black; } + +select#start_time_hour, select#start_time_minute, select#end_time_hour, select#end_time_minute{ width: 4%; } From cd496fb3005105d8e6bb3e11c7652a03bff4ef11 Mon Sep 17 00:00:00 2001 From: Alfonso Juan Dillera Date: Tue, 18 Mar 2014 21:10:48 +0800 Subject: [PATCH 4/8] Functionality to add contacts to meetings added. --- app/controllers/meetings_controller.rb | 6 ++++ app/models/meeting.rb | 39 +++++++++++++++++++++-- app/models/meeting_contact.rb | 6 ++++ app/views/meetings/_form_meeting.html.erb | 11 +++++++ app/views/meetings/show_meeting.html.erb | 4 +++ assets/javascripts/redmine_meetings.js | 15 +++++++-- db/migrate/005_create_meeting_contacts.rb | 10 ++++++ test/unit/meeting_contact_test.rb | 9 ++++++ test/unit/meeting_contacts_test.rb | 9 ++++++ 9 files changed, 104 insertions(+), 5 deletions(-) create mode 100644 app/models/meeting_contact.rb create mode 100644 db/migrate/005_create_meeting_contacts.rb create mode 100644 test/unit/meeting_contact_test.rb create mode 100644 test/unit/meeting_contacts_test.rb diff --git a/app/controllers/meetings_controller.rb b/app/controllers/meetings_controller.rb index c9536af..819674b 100644 --- a/app/controllers/meetings_controller.rb +++ b/app/controllers/meetings_controller.rb @@ -106,6 +106,12 @@ def create_meeting @meeting.watcher_user_ids = params[:watchers] @meeting.notify_participants = (params[:meeting][:notify_participants] == 'on') if @meeting.save + if params[:contacts] + params[:contacts].each do |contact| + @meeting.meeting_contacts.create(easy_contact: @meeting.project.easy_contacts.find(contact)) + end + end + attachments = Attachment.attach_files(@meeting, params[:attachments]) render_attachment_warning_if_needed(@meeting) @meeting.deliver() diff --git a/app/models/meeting.rb b/app/models/meeting.rb index 7502d07..430a310 100644 --- a/app/models/meeting.rb +++ b/app/models/meeting.rb @@ -3,6 +3,9 @@ class Meeting < ActiveRecord::Base belongs_to :project belongs_to :author, :class_name => 'User', :foreign_key => 'author_id' + has_many :meeting_contacts, dependent: :destroy + has_many :easy_contacts, through: :meeting_contacts + validates_presence_of :start_date, :end_date, :subject validates_length_of :subject, :maximum => 255 validates_length_of :location, :maximum => 255 @@ -79,19 +82,32 @@ def deliver() watcher_users.each do |w| recipients[w.language] = update_recipients(recipients, w.language, w.mail) end + + easy_contacts.each do |c| + contact = get_contact_email_and_language(c) + + recipients[contact[:language]] = update_recipients(recipients, contact[:language], contact[:email]) + end end + recipients.each do |language,rec| MeetingMailer.send_meeting(self, rec, language).deliver end return true end - + def deliver_cancel() recipients = { author.language => [ author.mail ] } if notify_participants watcher_users.each do |w| recipients[w.language] = update_recipients(recipients, w.language, w.mail) end + + easy_contacts.each do |c| + contact = get_contact_email_and_language(c) + + recipients[contact[:language]] = update_recipients(recipients, contact[:language], contact[:email]) + end end recipients.each do |language,rec| MeetingMailer.cancel_meeting(self, rec, language).deliver @@ -114,7 +130,14 @@ def validate if !valide errors.add(:end_date_date, :greater_than_start_date) end - + end + + def watched_by?(object) + if object.is_a?(EasyContact) + easy_contact_ids.include?(object.id) + else + super + end end private @@ -125,4 +148,16 @@ def update_recipients (list, lang, mail) mails << mail end + def get_contact_email_and_language(object) + contact = {} + custom_fields = object.custom_field_values + + email_custom_field = custom_fields.find{ |cfv| cfv.custom_field.field_format == 'email' } + contact[:email] = email_custom_field.custom_field.custom_values.first.value + + language_custom_field = custom_fields.find{ |cfv| cfv.custom_field.name == 'Language' } + contact[:language] = language_custom_field.nil? ? 'en' : language_custom_field.custom_field.custom_values.first.value + + contact + end end diff --git a/app/models/meeting_contact.rb b/app/models/meeting_contact.rb new file mode 100644 index 0000000..48515df --- /dev/null +++ b/app/models/meeting_contact.rb @@ -0,0 +1,6 @@ +class MeetingContact < ActiveRecord::Base + unloadable + + belongs_to :meeting + belongs_to :easy_contact +end diff --git a/app/views/meetings/_form_meeting.html.erb b/app/views/meetings/_form_meeting.html.erb index 7b5238f..d4ce8fb 100644 --- a/app/views/meetings/_form_meeting.html.erb +++ b/app/views/meetings/_form_meeting.html.erb @@ -24,6 +24,17 @@ <% end -%> <% end -%> + +


+ + +
+ + +
+<% @project.easy_contacts.sort.each do |contact| -%> + +<% end %>

diff --git a/app/views/meetings/show_meeting.html.erb b/app/views/meetings/show_meeting.html.erb index 74260da..1a52fe5 100644 --- a/app/views/meetings/show_meeting.html.erb +++ b/app/views/meetings/show_meeting.html.erb @@ -40,6 +40,10 @@ <% @meeting.watcher_users.collect.sort.each do |user| %>
   <%=h user %> <% end %> + +<% @meeting.easy_contacts.collect.sort.each do |contact| %> +
   <%=h contact %> +<% end %>
<% if @meeting.attachments.any? -%> diff --git a/assets/javascripts/redmine_meetings.js b/assets/javascripts/redmine_meetings.js index abf7838..4247708 100644 --- a/assets/javascripts/redmine_meetings.js +++ b/assets/javascripts/redmine_meetings.js @@ -1,7 +1,7 @@ -function SetAllCheckBoxes(CheckValue) { +function SetCheckBoxes(CheckValue, element) { if (!document.forms['meeting-form']) return; - var objCheckBoxes = document.forms['meeting-form'].elements['watchers_']; + var objCheckBoxes = document.forms['meeting-form'].elements[element]; if (!objCheckBoxes) return; var countCheckBoxes = objCheckBoxes.length; @@ -13,6 +13,15 @@ function SetAllCheckBoxes(CheckValue) { objCheckBoxes[i].checked = CheckValue; } +function SetAllCheckBoxes(CheckValue) { + SetCheckBoxes(CheckValue, 'watchers_'); +} + + +function SetAllContactCheckBoxes(CheckValue) { + SetCheckBoxes(CheckValue, 'contacts_'); +} + function sync_date(from, to) { document.getElementById(to).value = document.getElementById(from).value; } @@ -43,4 +52,4 @@ function start_meeting(url) { var wihe = "width="+screen.availWidth+",height="+screen.availHeight; open(url, "Meeting","directories=no,location=no,resizable=yes,scrollbars=yes,status=no,toolbar=no," + wihe); return false; -} \ No newline at end of file +} diff --git a/db/migrate/005_create_meeting_contacts.rb b/db/migrate/005_create_meeting_contacts.rb new file mode 100644 index 0000000..f6c0df7 --- /dev/null +++ b/db/migrate/005_create_meeting_contacts.rb @@ -0,0 +1,10 @@ +class CreateMeetingContacts < ActiveRecord::Migration + def change + create_table :meeting_contacts do |t| + t.references :meeting + t.references :easy_contact + end + add_index :meeting_contacts, :meeting_id + add_index :meeting_contacts, :easy_contact_id + end +end diff --git a/test/unit/meeting_contact_test.rb b/test/unit/meeting_contact_test.rb new file mode 100644 index 0000000..afbe54c --- /dev/null +++ b/test/unit/meeting_contact_test.rb @@ -0,0 +1,9 @@ +require File.expand_path('../../test_helper', __FILE__) + +class MeetingContactTest < ActiveSupport::TestCase + + # Replace this with your real tests. + def test_truth + assert true + end +end diff --git a/test/unit/meeting_contacts_test.rb b/test/unit/meeting_contacts_test.rb new file mode 100644 index 0000000..acd207a --- /dev/null +++ b/test/unit/meeting_contacts_test.rb @@ -0,0 +1,9 @@ +require File.expand_path('../../test_helper', __FILE__) + +class MeetingContactsTest < ActiveSupport::TestCase + + # Replace this with your real tests. + def test_truth + assert true + end +end From b18d80679121b57aa8250a4e0d79c501f51906b0 Mon Sep 17 00:00:00 2001 From: Alfonso Juan Dillera Date: Wed, 19 Mar 2014 16:45:36 +0800 Subject: [PATCH 5/8] Added save button above the description. --- app/views/meetings/_form_meeting.html.erb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/views/meetings/_form_meeting.html.erb b/app/views/meetings/_form_meeting.html.erb index d4ce8fb..286dd1e 100644 --- a/app/views/meetings/_form_meeting.html.erb +++ b/app/views/meetings/_form_meeting.html.erb @@ -5,6 +5,12 @@

<%= f.text_field :end_date_date, :required => true, :size => 10 %><%= calendar_for('meeting_end_date_date') %>  -  <%= select_time @meeting_tz.utc_to_local(@meeting.end_date_time), :prefix => 'end_time', :minute_step => 5, :time_separator => ':' %>

<%= link_to l('easy_pages.modules.issues_create_new'), new_project_issue_path(@project) %>

+ <% if @meeting.id %> +

<%= submit_tag l(:button_save) %> NOTE: This will submit the form

+ <% else %> +

<%= submit_tag l(:button_create) %> NOTE: This will submit the form

+ <% end %> +

<%= f.text_area :description, :cols => 60, :rows => 10, :class => 'wiki-edit' %>

<%= f.text_area :agenda, :cols => 60, :rows => 10, :class => 'wiki-edit' %>

<%= f.text_area :highlights, :cols => 60, :rows => 10, :class => 'wiki-edit' %> From c663b86a9153145f286978e56fa96edf552a822f Mon Sep 17 00:00:00 2001 From: Alfonso Juan Dillera Date: Sun, 23 Mar 2014 22:09:34 +0800 Subject: [PATCH 6/8] Changed contacts list from checkbox to multi-select listboxes. --- app/controllers/meetings_controller.rb | 10 +++++++++ app/helpers/meetings_helper.rb | 13 ++++++++++++ app/models/meeting.rb | 2 +- app/views/meetings/_form_meeting.html.erb | 23 ++++++++++++++------ app/views/meetings/edit_meeting.html.erb | 1 + app/views/meetings/new_meeting.html.erb | 1 + assets/javascripts/pmgov_customs.js | 7 ++++++ assets/javascripts/redmine_meetings.js | 26 ++++++++--------------- assets/stylesheets/redmine_meetings.css | 22 +++++++++++++++++++ 9 files changed, 80 insertions(+), 25 deletions(-) create mode 100644 assets/javascripts/pmgov_customs.js diff --git a/app/controllers/meetings_controller.rb b/app/controllers/meetings_controller.rb index 819674b..a9e4c62 100644 --- a/app/controllers/meetings_controller.rb +++ b/app/controllers/meetings_controller.rb @@ -139,6 +139,16 @@ def update_meeting @meeting.watcher_user_ids = params[:watchers] @meeting.notify_participants = (params[:meeting][:notify_participants] == 'on') if @meeting.save + # Clean meeting contacts + # Just rebuild the contacts list after the clean up + @meeting.meeting_contacts.delete_all + + if params[:contacts] + params[:contacts].each do |contact| + @meeting.meeting_contacts.create(easy_contact: @meeting.project.easy_contacts.find(contact)) + end + end + attachments = Attachment.attach_files(@meeting, params[:attachments]) render_attachment_warning_if_needed(@meeting) @meeting.deliver() diff --git a/app/helpers/meetings_helper.rb b/app/helpers/meetings_helper.rb index 29d3b70..8155a5a 100644 --- a/app/helpers/meetings_helper.rb +++ b/app/helpers/meetings_helper.rb @@ -271,6 +271,19 @@ def meeting_style_time (meeting, day, min, max, ind) "top: #{top}px; height: #{height}px; z-order: #{top}; position: absolute; left: #{ind * 10}px;" end + def options_for_meeting_contacts + project_list = @project.easy_contacts.reject do |c| + @meeting.easy_contacts.include?(c) + end + + project_list_options = project_list.empty? ? nil : options_from_collection_for_select(project_list, 'id', 'name') + + { + project_contacts: project_list_options, + meeting_contacts: options_from_collection_for_select(@meeting.easy_contacts, 'id', 'name') + } + end + private def each_xml_element(node, name) diff --git a/app/models/meeting.rb b/app/models/meeting.rb index 430a310..3d72c87 100644 --- a/app/models/meeting.rb +++ b/app/models/meeting.rb @@ -153,7 +153,7 @@ def get_contact_email_and_language(object) custom_fields = object.custom_field_values email_custom_field = custom_fields.find{ |cfv| cfv.custom_field.field_format == 'email' } - contact[:email] = email_custom_field.custom_field.custom_values.first.value + contact[:email] = email_custom_field.custom_field.custom_values.find{ |cv| cv.customized_id == object.id }.value language_custom_field = custom_fields.find{ |cfv| cfv.custom_field.name == 'Language' } contact[:language] = language_custom_field.nil? ? 'en' : language_custom_field.custom_field.custom_values.first.value diff --git a/app/views/meetings/_form_meeting.html.erb b/app/views/meetings/_form_meeting.html.erb index 286dd1e..ae57afa 100644 --- a/app/views/meetings/_form_meeting.html.erb +++ b/app/views/meetings/_form_meeting.html.erb @@ -34,13 +34,22 @@


-
- - -
-<% @project.easy_contacts.sort.each do |contact| -%> - -<% end %> + + + + + + + +
+ <%= select_tag 'project_contacts_list', options_for_meeting_contacts[:project_contacts], { multiple: true, size: 10 } %> + + <%= button_tag '→', type: 'button', onclick: "moveOptions($(this.form).find('#project_contacts_list')[0], $(this.form).find('#selected_meeting_contacts')[0]);" %> + <%= button_tag '←', type: 'button', onclick: "moveOptions($(this.form).find('#selected_meeting_contacts')[0], $(this.form).find('#project_contacts_list')[0]);" %> + + <%= select_tag 'contacts[]', options_for_meeting_contacts[:meeting_contacts], { multiple: true, size: 10, id: 'selected_meeting_contacts' } %> +
+

diff --git a/app/views/meetings/edit_meeting.html.erb b/app/views/meetings/edit_meeting.html.erb index 158042e..6e81e66 100644 --- a/app/views/meetings/edit_meeting.html.erb +++ b/app/views/meetings/edit_meeting.html.erb @@ -12,6 +12,7 @@
<% content_for :header_tags do %> + <%= javascript_include_tag 'pmgov_customs.js', :plugin => "redmine_meetings" %> <%= stylesheet_link_tag 'redmine_meetings.css', :plugin => "redmine_meetings" %> <%= javascript_include_tag 'redmine_meetings.js', :plugin => "redmine_meetings" %> <% end %> diff --git a/app/views/meetings/new_meeting.html.erb b/app/views/meetings/new_meeting.html.erb index eefb2d6..4cac12f 100644 --- a/app/views/meetings/new_meeting.html.erb +++ b/app/views/meetings/new_meeting.html.erb @@ -12,6 +12,7 @@
<% content_for :header_tags do %> + <%= javascript_include_tag 'pmgov_customs.js', :plugin => "redmine_meetings" %> <%= stylesheet_link_tag 'redmine_meetings.css', :plugin => "redmine_meetings" %> <%= javascript_include_tag 'redmine_meetings.js', :plugin => "redmine_meetings" %> <% end %> diff --git a/assets/javascripts/pmgov_customs.js b/assets/javascripts/pmgov_customs.js new file mode 100644 index 0000000..45afefa --- /dev/null +++ b/assets/javascripts/pmgov_customs.js @@ -0,0 +1,7 @@ +$(document).ready(function() { + $('#meeting-form').submit(function(e) { + $(this).find('#selected_meeting_contacts option').each(function(i, v){ + $(v).attr('selected', true); + }); + }); +}); diff --git a/assets/javascripts/redmine_meetings.js b/assets/javascripts/redmine_meetings.js index 4247708..1fb414f 100644 --- a/assets/javascripts/redmine_meetings.js +++ b/assets/javascripts/redmine_meetings.js @@ -1,7 +1,7 @@ -function SetCheckBoxes(CheckValue, element) { +function SetAllCheckBoxes(CheckValue) { if (!document.forms['meeting-form']) return; - var objCheckBoxes = document.forms['meeting-form'].elements[element]; + var objCheckBoxes = document.forms['meeting-form'].elements['watchers_']; if (!objCheckBoxes) return; var countCheckBoxes = objCheckBoxes.length; @@ -13,14 +13,6 @@ function SetCheckBoxes(CheckValue, element) { objCheckBoxes[i].checked = CheckValue; } -function SetAllCheckBoxes(CheckValue) { - SetCheckBoxes(CheckValue, 'watchers_'); -} - - -function SetAllContactCheckBoxes(CheckValue) { - SetCheckBoxes(CheckValue, 'contacts_'); -} function sync_date(from, to) { document.getElementById(to).value = document.getElementById(from).value; @@ -38,14 +30,14 @@ function sync_time(obj, from, to) { } function setAutoPreview(url, form, field) { - new Field.Observer(field,2, function(){ - new Ajax.Updater('preview', url, { - asynchronous:true, - evalScripts:true, - method:'post', - parameters:Form.serialize(form) - }); + new Field.Observer(field,2, function(){ + new Ajax.Updater('preview', url, { + asynchronous:true, + evalScripts:true, + method:'post', + parameters:Form.serialize(form) }); + }); } function start_meeting(url) { diff --git a/assets/stylesheets/redmine_meetings.css b/assets/stylesheets/redmine_meetings.css index 77817b3..eb3f4b1 100644 --- a/assets/stylesheets/redmine_meetings.css +++ b/assets/stylesheets/redmine_meetings.css @@ -28,3 +28,25 @@ div.meeting.day.tooltip { background-color: #F7A95A; display:block; width: 49%; div.webmeeting.day.tooltip { background-color: #A7FAA0; display:block; width: 49%; border: 1px solid black; } select#start_time_hour, select#start_time_minute, select#end_time_hour, select#end_time_minute{ width: 4%; } + +table#meeting-form-contacts-table { + width: 35%; +} + +table#meeting-form-contacts-table td { + text-align: center; + vertical-align: middle; +} + +table#meeting-form-contacts-table td.select-box { + width: 45%; +} + + +table#meeting-form-contacts-table td.select-box select { + width: 100%; +} + +table#meeting-form-contacts-table td.buttons { + width: 10%; +} From 2c39b20ff974ae56130e8d7e849f5c1c77a71f55 Mon Sep 17 00:00:00 2001 From: Alfonso Juan Dillera Date: Sun, 23 Mar 2014 22:27:46 +0800 Subject: [PATCH 7/8] Refactored way the way of getting the contact emails. --- app/models/meeting.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/models/meeting.rb b/app/models/meeting.rb index 3d72c87..b36c6de 100644 --- a/app/models/meeting.rb +++ b/app/models/meeting.rb @@ -150,13 +150,12 @@ def update_recipients (list, lang, mail) def get_contact_email_and_language(object) contact = {} - custom_fields = object.custom_field_values - email_custom_field = custom_fields.find{ |cfv| cfv.custom_field.field_format == 'email' } - contact[:email] = email_custom_field.custom_field.custom_values.find{ |cv| cv.customized_id == object.id }.value + email_custom_field = object.custom_values.find{ |cv| cv.custom_field.name =~ /(E|e)(\-|)(M|m)ail/ } + contact[:email] = email_custom_field.value - language_custom_field = custom_fields.find{ |cfv| cfv.custom_field.name == 'Language' } - contact[:language] = language_custom_field.nil? ? 'en' : language_custom_field.custom_field.custom_values.first.value + language_custom_field = object.custom_values.find{ |cv| cv.custom_field.name =~ /(L|l)anguage/ } + contact[:language] = language_custom_field.nil? ? 'en' : language_custom_field.value contact end From 9c8d8bc704afdd1deaec63b8e48916e31f927e8b Mon Sep 17 00:00:00 2001 From: Alfonso Juan Dillera Date: Sat, 17 May 2014 01:46:12 +0800 Subject: [PATCH 8/8] Added action field and only shows highlights and action text boxes when in edit mode. --- app/controllers/meetings_controller.rb | 2 ++ app/views/meetings/_form_meeting.html.erb | 10 +++++++--- app/views/meetings/show_meeting.html.erb | 4 ++++ config/locales/en.yml | 1 + db/migrate/006_add_action_field.rb | 9 +++++++++ 5 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 db/migrate/006_add_action_field.rb diff --git a/app/controllers/meetings_controller.rb b/app/controllers/meetings_controller.rb index a9e4c62..babee24 100644 --- a/app/controllers/meetings_controller.rb +++ b/app/controllers/meetings_controller.rb @@ -97,6 +97,7 @@ def create_meeting @meeting.description = params[:meeting][:description] @meeting.agenda = params[:meeting][:agenda] @meeting.highlights = params[:meeting][:highlights] + @meeting.action = params[:meeting][:action] @meeting.location = params[:meeting][:location] @meeting.web = (params[:meeting][:web] == 'on') tdate = Date.parse(params[:meeting][:start_date_date]) @@ -130,6 +131,7 @@ def update_meeting @meeting.description = params[:meeting][:description] @meeting.agenda = params[:meeting][:agenda] @meeting.highlights = params[:meeting][:highlights] + @meeting.action = params[:meeting][:action] @meeting.location = params[:meeting][:location] @meeting.web = (params[:meeting][:web] == 'on') tdate = Date.parse(params[:meeting][:start_date_date]) diff --git a/app/views/meetings/_form_meeting.html.erb b/app/views/meetings/_form_meeting.html.erb index ae57afa..c0d2c19 100644 --- a/app/views/meetings/_form_meeting.html.erb +++ b/app/views/meetings/_form_meeting.html.erb @@ -11,11 +11,15 @@

<%= submit_tag l(:button_create) %> NOTE: This will submit the form

<% end %> -

<%= f.text_area :description, :cols => 60, :rows => 10, :class => 'wiki-edit' %> -

<%= f.text_area :agenda, :cols => 60, :rows => 10, :class => 'wiki-edit' %> -

<%= f.text_area :highlights, :cols => 60, :rows => 10, :class => 'wiki-edit' %> +

+ <%= f.text_area :description, :cols => 60, :rows => 10, :class => 'wiki-edit' %> <%= wikitoolbar_for 'meeting_description' %>

+

<%= f.text_area :agenda, :cols => 60, :rows => 10, :class => 'wiki-edit' %>

+ <% unless @meeting.new_record? %> +

<%= f.text_area :highlights, :cols => 60, :rows => 10, :class => 'wiki-edit' %>

+

<%= f.text_area :action, :cols => 60, :rows => 10, :class => 'wiki-edit' %>

+ <% end %>

<%= label_tag('attachments[1][file]', l(:label_attachment_plural))%><%= render :partial => 'attachments/form' %>

diff --git a/app/views/meetings/show_meeting.html.erb b/app/views/meetings/show_meeting.html.erb index 1a52fe5..288c18b 100644 --- a/app/views/meetings/show_meeting.html.erb +++ b/app/views/meetings/show_meeting.html.erb @@ -33,6 +33,10 @@
<%= textilizable @meeting, :highlights %>
+

<%=l(:field_action)%>

+
+<%= textilizable @meeting, :action %> +
<%= l(:field_doodle_users) %> diff --git a/config/locales/en.yml b/config/locales/en.yml index c7bdde4..707ab89 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -27,6 +27,7 @@ en: field_meeting_web: Use the conference room dedicated to the project field_agenda: Agenda field_highlights: Highlights + field_action: Action label_doodle_plural: "Doodles" label_title_doodle: "Doodle" diff --git a/db/migrate/006_add_action_field.rb b/db/migrate/006_add_action_field.rb new file mode 100644 index 0000000..cb91284 --- /dev/null +++ b/db/migrate/006_add_action_field.rb @@ -0,0 +1,9 @@ +class AddActionField < ActiveRecord::Migration + def up + add_column :meetings, :action, :text + end + + def down + remove_column :meetings, :action + end +end