Skip to content

Commit

Permalink
New libraries, documentation and new features
Browse files Browse the repository at this point in the history
This commit does several things:
* Update documentation
* Update FullCalendar, jQuery.qtip and jQuery.alerts libraries
* Make the plugin work again with the new libraries
* Rework localization (see documentation)
* Add an option to allow bookings spanning multiple days
* Add an option to show the ticket ID and a link to the ticket
* Disallow adding/editing/deleting while loading
* JS cleanups

INFO: Due to the new libraries the CSS changed as well!

Signed-off-by: Tobias Droste <tdroste@gmx.de>
  • Loading branch information
dro123 committed Sep 26, 2015
1 parent 46990f4 commit d1813fb
Show file tree
Hide file tree
Showing 125 changed files with 16,996 additions and 7,449 deletions.
431 changes: 333 additions & 98 deletions README.md

Large diffs are not rendered by default.

31 changes: 26 additions & 5 deletions app/controllers/meeting_room_calendar_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def initialize
@allow_changing_old_meetings = Setting['plugin_redmine_meeting_room_calendar']['allow_changing_old_meetings'] || 0
@allow_drag_and_drop = Setting['plugin_redmine_meeting_room_calendar']['allow_drag_and_drop'] || 0
@allow_resize = Setting['plugin_redmine_meeting_room_calendar']['allow_resize'] || 0
@allow_multiple_days = Setting['plugin_redmine_meeting_room_calendar']['allow_multiple_days'] || 0

if check_settings
@start_time = CustomField.find_by_id(@custom_field_id_start).possible_values
Expand All @@ -47,11 +48,14 @@ def index
return
end

@projects = Project.find(@project_ids).select{ |p| p.visible? }.collect { |p| [p.name, p.id] }
@projects = Project.find(@project_ids).select{ |p| p.visible? && User.current.allowed_to?(:view_issues, p) }.collect { |p| [p.name, p.id] }
@project = Project.find_by_id(params[:project_id].to_i)
if @project == nil
@project = Project.find_by_id(@project_id.to_i)
end
if @project != nil && (!@project.visible? || !User.current.allowed_to?(:view_issues, @project)) && @projects != nil && @projects.first != nil
@project = Project.find_by_id(@projects.first[1])
end
if @project == nil
redirect_to :action => 'missing_config'
return
Expand All @@ -71,6 +75,10 @@ def index
unless User.current.allowed_to?(:view_issues, @project)
render_403
end

@user_can_add = User.current.allowed_to?(:add_issues, @project)
@user_can_edit = User.current.allowed_to?(:edit_issues, @project)
@user_can_delete = User.current.allowed_to?(:delete_issues, @project)

if @project.project_meeting_rooms && !@project.project_meeting_rooms.empty?
rooms = @project.project_meeting_rooms.split(',').collect { |r| r.strip }
Expand Down Expand Up @@ -107,7 +115,13 @@ def create
recur_type = params[:periodtype].to_i
recur_period = params[:period].to_i
meeting_day = params[:start_date]
if @allow_multiple_days
meeting_end_day = params[:due_date]
else
meeting_end_day = meeting_day
end
meeting_date = Date.parse(meeting_day)
meeting_end_date = Date.parse(meeting_end_day)
project_id = params[:project_id].to_i

if recur_meeting != 'true'
Expand All @@ -128,7 +142,7 @@ def create
@calendar_issue.category_id = params[:category_id]
end
@calendar_issue.start_date = meeting_date
@calendar_issue.due_date = @calendar_issue.start_date
@calendar_issue.due_date = meeting_end_date
@calendar_issue.custom_field_values = params[:custom_field_values]
if @issue_status_id != nil && @issue_status_id != '0' && @issue_status_id != 0
@calendar_issue.status = IssueStatus.find_by_id(@issue_status_id)
Expand All @@ -145,6 +159,7 @@ def create
recur_period +=1
end
meeting_date += recur_type
meeting_end_date += recur_type
recur_period -=1
end
end
Expand All @@ -166,8 +181,14 @@ def update
return
end

meeting_day = params[:start_date]
meeting_date = Date.parse(meeting_day)
meeting_day = params[:start_date]
if @allow_multiple_days
meeting_end_day = params[:due_date]
else
meeting_end_day = meeting_day
end
meeting_date = Date.parse(meeting_day)
meeting_end_date = Date.parse(meeting_end_day)
project_id = params[:project_id].to_i

@calendar_issue = Issue.new
Expand All @@ -180,7 +201,7 @@ def update
@calendar_issue.category_id = params[:category_id]
end
@calendar_issue.start_date = meeting_date
@calendar_issue.due_date = @calendar_issue.start_date
@calendar_issue.due_date = meeting_end_day
@calendar_issue.custom_field_values = params[:custom_field_values]
orig_mail_notification = User.current.mail_notification
User.current.mail_notification = 'none'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
<%= select_tag('settings[tracker_id]', options_for_select([['', 0]] + tracker_ids.collect{|c| [c.name, c.id]}, (@settings['tracker_id'] || 0))) %>
</p>

<%- custom_fields_issues = CustomField.where(type: 'IssueCustomField') %>
<%- if Rails::VERSION::MAJOR >= 4 %>
<%- custom_fields_issues = CustomField.where(type: 'IssueCustomField') %>
<%- else %>
<%- custom_fields_issues = CustomField.find(:all, :conditions => "type = 'IssueCustomField'") %>
<%- end %>
<p>
<%= label_tag('settings[custom_field_id_room]', l(:label_setting_custom_field_id_room)) %>
<%= select_tag('settings[custom_field_id_room]', options_for_select([['', 0]] + custom_fields_issues.collect{|c| [c.name, c.id]}, (@settings['custom_field_id_room'] || 0))) %>
Expand Down Expand Up @@ -56,3 +60,11 @@
<%= label_tag('settings[allow_resize]', l(:label_setting_allow_resize)) %>
<%= check_box_tag('settings[allow_resize]', 1, (@settings['allow_resize'] == '1')) %>
</p>
<p>
<%= label_tag('settings[allow_multiple_days]', l(:label_setting_allow_multiple_days)) %>
<%= check_box_tag('settings[allow_multiple_days]', 1, (@settings['allow_multiple_days'] == '1')) %>
</p>
<p>
<%= label_tag('settings[show_ticket_id]', l(:label_setting_show_ticket_id)) %>
<%= check_box_tag('settings[show_ticket_id]', 1, (@settings['show_ticket_id'] == '1')) %>
</p>
138 changes: 77 additions & 61 deletions app/views/meeting_room_calendar/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
<h2><%= l(:label_name) %></h2>

<%= stylesheet_link_tag 'fullcalendar',:plugin => 'redmine_meeting_room_calendar' %>
<%= stylesheet_link_tag 'jquery-ui-1.7.3.custom.css',:plugin => 'redmine_meeting_room_calendar' %>
<%= stylesheet_link_tag 'fullcalendar',:plugin => 'redmine_meeting_room_calendar',:media => 'print' %>
<%= stylesheet_link_tag 'meeting_calendar',:plugin => 'redmine_meeting_room_calendar' %>
<%= stylesheet_link_tag 'jquery.alerts.css',:plugin => 'redmine_meeting_room_calendar' %>
<%= stylesheet_link_tag 'jquery.qtip/jquery.qtip.min.css',:plugin => 'redmine_meeting_room_calendar' %>
<%= stylesheet_link_tag 'jquery.alerts/jquery.alerts.css',:plugin => 'redmine_meeting_room_calendar' %>
<%= stylesheet_link_tag 'fullcalendar/jquery-ui.min.css',:plugin => 'redmine_meeting_room_calendar' %>
<%= stylesheet_link_tag 'fullcalendar/fullcalendar.min.css',:plugin => 'redmine_meeting_room_calendar' %>
<%= stylesheet_link_tag 'fullcalendar/fullcalendar.print.css',:plugin => 'redmine_meeting_room_calendar',:media => 'print' %>
<%= stylesheet_link_tag 'meeting_calendar.css',:plugin => 'redmine_meeting_room_calendar' %>

<script type="text/javascript">
var baseUrl = "<%= @base_url %>";
Expand All @@ -15,61 +19,62 @@

var pluginName = "meeting_room_calendar";

var user_is_manager = <%= @user_is_manager %>;
var user_last_name = "<%= @user_last_name %>";
var show_categories = "<%= @show_categories %>";
var allow_changing_old_meetings = <%= @allow_changing_old_meetings %>;
var allow_drag_and_drop = <%= @allow_drag_and_drop %>;
var allow_resize = <%= @allow_resize %>;
var user_is_manager = <%= @user_is_manager %>;
var user_can_add = <%= @user_can_add %>;
var user_can_edit = <%= @user_can_edit %>;
var user_can_delete = <%= @user_can_delete %>;
var user_last_name = "<%= @user_last_name %>";
var show_categories = "<%= @show_categories %>";
var allow_changing_old_meetings = <%= @allow_changing_old_meetings %>;
var allow_drag_and_drop = <%= @allow_drag_and_drop %>;
var allow_resize = <%= @allow_resize %>;
var allow_multiple_days = <%= @allow_multiple_days %>;
var hide_rooms = <%= @settings['hide_rooms'] == '1' || 0 %>;
var show_ticket_id = <%= @settings['show_ticket_id'] == '1' || 0 %>;

var current_lang = '<%= I18n.locale %>';

var langBookedBy = "<%= l(:label_booked_by) %>";
var langAssignedTo = "<%= l(:label_assigned_to) %>";
var langCategory = "<%= l(:label_category) %>";
var langStartTime = "<%= l(:label_start_time) %>";
var langEndTime = "<%= l(:label_end_time) %>";
var langInfo = "<%= l(:label_info) %>";
var langAlert = "<%= l(:label_alert) %>";
var langWarningEditPast = "<%= l(:label_warning_edit_past) %>";
var langWarningCreatePast = "<%= l(:label_warning_create_past) %>";
var langWarningUpdatePast = "<%= l(:label_warning_update_past) %>";
var langWarningWeekend = "<%= l(:label_warning_weekend) %>";
var langWarningFieldsMandatory = "<%= l(:label_warning_fields_mandatory) %>";
var langUpdateEvent = "<%= l(:label_update_event) %>";
var langCreateEvent = "<%= l(:label_create_event) %>";
var langInvalidSubject = "<%= l(:label_invalid_subject) %>";
var langRoomAlreadyBooked = "<%= l(:label_room_already_booked) %>";
var langToday = "<%= l(:label_today) %>";
var langDay = "<%= l(:label_day) %>";
var langWeek = "<%= l(:label_week) %>";
var langMonth = "<%= l(:label_month) %>";
var langBookedBy = "<%= l(:label_booked_by) %>";
var langAssignedTo = "<%= l(:label_assigned_to) %>";
var langCategory = "<%= l(:label_category) %>";
var langStartTime = "<%= l(:label_start_time) %>";
var langEndTime = "<%= l(:label_end_time) %>";
var langInfo = "<%= l(:label_info) %>";
var langAlert = "<%= l(:label_alert) %>";
var langWarningEditPast = "<%= l(:label_warning_edit_past) %>";
var langWarningCreatePast = "<%= l(:label_warning_create_past) %>";
var langWarningUpdatePast = "<%= l(:label_warning_update_past) %>";
var langWarningWeekend = "<%= l(:label_warning_weekend) %>";
var langWarningFieldsMandatory = "<%= l(:label_warning_fields_mandatory) %>";
var langUpdateEvent = "<%= l(:label_update_event) %>";
var langCreateEvent = "<%= l(:label_create_event) %>";
var langInvalidSubject = "<%= l(:label_invalid_subject) %>";
var langRoomAlreadyBooked = "<%= l(:label_room_already_booked) %>";
var langRoom = "<%= l(:label_meeting_room) %>";

var langDateTimeTimeTitleFormatDay = "<%= l(:datetime_title_format_day) %>";
var langDateTimeTimeTitleFormatWeek = "<%= l(:datetime_title_format_week) %>";
var langDateTimeTimeTitleFormatMonth = "<%= l(:datetime_title_format_month) %>";
var langDateTimeTimeColumnFormatDay = "<%= l(:datetime_column_format_day) %>";
var langDateTimeTimeColumnFormatWeek = "<%= l(:datetime_column_format_week) %>";
var langDateTimeTimeColumnFormatMonth = "<%= l(:datetime_column_format_month) %>";
var langDateTimeTimeEntryFormatTime = "<%= l(:datetime_entry_format_time) %>";
var tracker_name = "<%= Tracker.find(@tracker_id).name %>";
var all_meeting_rooms = <%= raw(@meeting_rooms.collect { |room| room }) %>;
var all_start_times = <%= raw(@start_time.collect { |time| time }) %>;
var all_end_times = <%= raw(@end_time.collect { |time| time }) %>;

var langDateTimeMin = "<%= l(:datetime_min) %>";
var langDateTimeMax = "<%= l(:datetime_max) %>";
var langDateTimeTimeFormat = "<%= l(:datetime_time_format) %>";
var langAbbrDayNames = <%= raw l(:abbr_day_names) %>;
var langDayNames = <%= raw l(:day_names) %>;
var langAbbrMonthNames = <%= raw l(:abbr_month_names) %>;
var langMonthNames = <%= raw l(:month_names) %>;
var langFirstDay = <%= l(:first_day) %>;
var langDateFormat = "<%= l(:date_format) %>";
var datetime_min = all_start_times[0] + ':00';
var datetime_max = all_end_times[all_end_times.length-1] + ':00';

var api_key = "<%= @api_key %>";
</script>

<%= javascript_include_tag 'jquery-1.7.1.min.js' ,:plugin => 'redmine_meeting_room_calendar'%>
<%= javascript_include_tag 'jquery.qtip-1.0.0-rc3.min.js',:plugin => 'redmine_meeting_room_calendar'%>
<%= javascript_include_tag 'jquery-ui.min.js',:plugin => 'redmine_meeting_room_calendar' %>
<%= javascript_include_tag 'fullcalendar',:plugin => 'redmine_meeting_room_calendar'%>
<%= javascript_include_tag 'meetingcalendar',:plugin => 'redmine_meeting_room_calendar'%>
<%= javascript_include_tag 'jquery.alerts.js',:plugin => 'redmine_meeting_room_calendar'%>
<%= javascript_include_tag 'setup.js',:plugin => 'redmine_meeting_room_calendar'%>
<%= javascript_include_tag 'fullcalendar/lib/jquery-ui.custom.min.js',:plugin => 'redmine_meeting_room_calendar'%>
<%= javascript_include_tag 'fullcalendar/lib/moment.min.js',:plugin => 'redmine_meeting_room_calendar'%>
<%= javascript_include_tag 'fullcalendar/fullcalendar.min.js',:plugin => 'redmine_meeting_room_calendar'%>
<%= javascript_include_tag 'fullcalendar/lang-all.js',:plugin => 'redmine_meeting_room_calendar'%>
<%= javascript_include_tag 'jquery.qtip/jquery.qtip.min.js' ,:plugin => 'redmine_meeting_room_calendar'%>
<%= javascript_include_tag 'jquery.alerts/jquery.alerts.js' ,:plugin => 'redmine_meeting_room_calendar'%>
<%= javascript_include_tag 'meetingcalendar.js',:plugin => 'redmine_meeting_room_calendar'%>

<div style="padding-bottom:15px">
<%= l(:label_goto) %>: <%= text_field_tag :datepicker %>
Expand All @@ -93,29 +98,40 @@
end
%>
<%= label_tag("label_meeting_room", l(:label_meeting_room), html_options = { :style=> "visibility:#{rooms_visibility};" }) %>
<%= select_tag("meeting_rooms",options_for_select(@meeting_rooms), html_options = { :style=> "visibility:#{rooms_visibility};" }) %>
<%= select_tag("meeting_rooms",options_for_select(@meeting_rooms + [[l(:label_all_meeting_rooms), 'all']]), html_options = { :style=> "visibility:#{rooms_visibility};" }) %>
<div id="loading">&nbsp;</div>
</div>
<!-- fullcalendar target div -->
<div id='calendar'></div>
<div class="saveMeetingModal">
<div class="formLayout">
<%= label_tag("meeting_date", l(:label_meeting_date)) %><%= text_field_tag("meeting_date") %><br/>
<%= label_tag(:subject, l(:label_subject)) %><%= text_field_tag :subject,@user_last_name,:maxlength => 255 %><br/>
<%= label_tag("start_time", l(:label_start_time)) %><%= select_tag "start_time", options_for_select(@start_time) %><br/>
<%= label_tag("end_time", l(:label_end_time)) %><%= select_tag "end_time", options_for_select(@end_time) %><br/>
<div id="selected_meeting_room_container">
<%= label_tag("selected_meeting_room", l(:label_meeting_room)) %><%= select_tag "selected_meeting_room", options_for_select(@meeting_rooms) %><br/>
</div>
<% if @settings['allow_multiple_days'] == '1' %>
<%= label_tag(:subject, l(:label_subject)) %><%= text_field_tag :subject,@user_last_name,:maxlength => 255 %><br/>
<%= label_tag("meeting_date", l(:label_meeting_date)) %><%= text_field_tag("meeting_date") %><br/>
<%= label_tag("start_time", l(:label_start_time)) %><%= select_tag "start_time", options_for_select(@start_time) %><br/>
<%= label_tag("meeting_end_date", l(:label_meeting_end_date)) %><%= text_field_tag("meeting_end_date") %><br/>
<%= label_tag("end_time", l(:label_end_time)) %><%= select_tag "end_time", options_for_select(@end_time) %><br/>
<% else %>
<%= label_tag("meeting_date", l(:label_meeting_date)) %><%= text_field_tag("meeting_date") %><br/>
<%= label_tag(:subject, l(:label_subject)) %><%= text_field_tag :subject,@user_last_name,:maxlength => 255 %><br/>
<%= label_tag("start_time", l(:label_start_time)) %><%= select_tag "start_time", options_for_select(@start_time) %><br/>
<%= label_tag("end_time", l(:label_end_time)) %><%= select_tag "end_time", options_for_select(@end_time) %><br/>
<% end %>
<%= label_tag(:assigned_to_id, l(:label_assigne_to)) %> <%= select_tag :assigned_to_id, options_for_select(@assignable_users, @user) %><br/>
<%if @show_categories=='1' %>
<%= label_tag(:category_id, l(:label_category)) %> <%= select_tag :category_id, options_for_select(@categories) %><br/>
<%= label_tag(:category_id, l(:label_category)) %> <%= select_tag :category_id, options_for_select(@categories) %><br/>
<%end %>
<div class="field">
<em style="font-size:9px"><%= l(:label_warning_fields_mandatory) %></em>
</div>
<div class="recurfield">
<%= label_tag('recurCheckbox', l(:label_recur)) %><%= check_box_tag 'recurCheckbox' %><br/>
<div id ="recur_div">
<label></label><%= select_tag "periodtype", options_for_select({l(:label_daily) => 1, l(:label_weekly) => 7, l(:label_biweekly) => 14}, 1) %><br/>
<label></label><%= text_field_tag "period",5,:maxlength => 2, :size => 3 %> <%= l(:label_count) %>
<label></label><%= select_tag "periodtype", options_for_select({l(:label_daily) => 1, l(:label_weekly) => 7, l(:label_biweekly) => 14}, 1) %><br/>
<%= label_tag("period", l(:label_count)) %><%= text_field_tag "period",5,:maxlength => 2, :size => 3 %>
</div>
</div>
</div>
Expand Down
Binary file added assets/images/fullcalendar/animated-overlay.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/jquery.alerts/help.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
Binary file added assets/images/jquery.alerts/title.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/images/ui-bg_diagonals-thick_18_b81900_40x40.png
Binary file not shown.
Binary file removed assets/images/ui-bg_diagonals-thick_20_666666_40x40.png
Binary file not shown.
Binary file removed assets/images/ui-bg_flat_10_000000_40x100.png
Binary file not shown.
Binary file removed assets/images/ui-bg_glass_100_f6f6f6_1x400.png
Binary file not shown.
Binary file removed assets/images/ui-bg_glass_100_fdf5ce_1x400.png
Binary file not shown.
Binary file removed assets/images/ui-bg_glass_65_ffffff_1x400.png
Binary file not shown.
Binary file removed assets/images/ui-bg_gloss-wave_35_f6a828_500x100.png
Diff not rendered.
Diff not rendered.
Binary file removed assets/images/ui-bg_highlight-soft_75_ffe45c_1x100.png
Diff not rendered.
Binary file removed assets/images/ui-icons_222222_256x240.png
Diff not rendered.
Binary file removed assets/images/ui-icons_228ef1_256x240.png
Diff not rendered.
Binary file removed assets/images/ui-icons_ef8c08_256x240.png
Diff not rendered.
Binary file removed assets/images/ui-icons_ffd27a_256x240.png
Diff not rendered.
Binary file removed assets/images/ui-icons_ffffff_256x240.png
Diff not rendered.
Loading

0 comments on commit d1813fb

Please sign in to comment.