Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add localization to Brazilian Portuguese #6

Open
wants to merge 54 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
9bbd549
Move files to root directory
dro123 Dec 30, 2012
4609562
Remove unneeded or duplicate files
dro123 Dec 30, 2012
cdf7754
Use the plugin name for controllers, views, helpers, etc.
dro123 Dec 30, 2012
5fcd41a
Update to Redmine >= 2.0 and add localization
dro123 Dec 30, 2012
9681a4b
Add plugin settings instead of hardcoding IDs
dro123 Dec 30, 2012
3c1bc29
Update README and bump version to 2.0.0
dro123 Dec 30, 2012
365ad19
Fix screenshot URL in README
dro123 Jan 1, 2013
2d49901
Add rake command to 'Install' in README
dro123 Jan 4, 2013
6e38dbf
Add localization for Simplified Chinese
archonwang Jan 5, 2013
86f1d9b
Use API key for AJAX request for non-public projects
dro123 Jan 8, 2013
64dca91
Use configured custom field ID for issue queries
dro123 Jan 16, 2013
d852780
Update README for cases where authentication is needed
dro123 Jan 17, 2013
3ca9c8f
Allow project managers to change all meetings
dro123 Apr 19, 2014
a38ceb3
Don't send notification mails on create/update
dro123 Apr 19, 2014
7df764e
Add an option to select categories for meetings
dro123 Apr 19, 2014
6f06248
Minor cleanups
dro123 Apr 20, 2014
1c52da1
Add an option to support multiple projects
dro123 Apr 20, 2014
01f0440
Add a default issue status to plugin settings
dro123 Apr 23, 2014
52fa5a3
URL encode meeting room and date filter in AJAX requests
dro123 Apr 23, 2014
d50bcff
Add an option to allow changing of bookings in the past
dro123 May 15, 2014
01cfa32
Add possibility to edit events directly with the mouse
dro123 May 15, 2014
f2c61ef
Limit access to projects based on the user rights and add per project…
dro123 May 15, 2014
987a36a
Add tracker status CSS class names
dro123 Nov 11, 2014
162825f
Add turkish localization file
dro123 Nov 12, 2014
79b2255
Add compatibility with rails >= 4
dro123 Apr 22, 2015
5795b6c
Mark redmine 3.x as supported in the docs
dro123 Apr 22, 2015
126681b
Fix compatibility with rails >= 4
dro123 Apr 23, 2015
3c4fe45
Create pt-br.yml
aceccarelli Jun 15, 2015
46990f4
Merge pull request #20 from aceccarelli/master
dro123 Jun 15, 2015
d1813fb
New libraries, documentation and new features
dro123 Sep 25, 2015
9e153e9
Fix db migrate file ending
dro123 Oct 28, 2015
0ecb33b
Russian translation
ddk85 Oct 29, 2015
bfb1542
Merge pull request #23 from ddk85/master
dro123 Oct 29, 2015
43740cc
Added author_url for easy search code from Redmine
ddk85 Oct 30, 2015
dc68887
Fix Russian translation
ddk85 Oct 30, 2015
6df90f8
Merge pull request #24 from ddk85/master
dro123 Oct 31, 2015
95e5c1a
Add an option to show weekends
dro123 Nov 27, 2015
f117379
Merge branch 'master' of github.com:dro123/redmine_meeting_room_calendar
dro123 Nov 27, 2015
73e0d3d
Respect redmines 'first day of week' setting
dro123 Dec 1, 2015
15a5e6e
Allow overlap
kostyfisik Dec 1, 2015
95abe93
update default value
kostyfisik Dec 1, 2015
9e8fbe6
update default value
kostyfisik Dec 2, 2015
0860ed9
Merge pull request #31 from kostyfisik/master
dro123 Dec 2, 2015
04649f3
Update to fullcalendar 2.9.1 and fix 'all' rooms query for redmine v<3.0
dro123 Oct 4, 2016
cf57070
Respect redmine date and time format settings
dro123 Oct 4, 2016
fc7a435
Add Italian translation
dro123 Jan 21, 2018
8d8f996
Updated the incorrect language identifier
shash66 Mar 27, 2018
2af056c
Merge pull request #47 from shash66/patch-1
dro123 Mar 28, 2018
ab54e52
rails 5.1+ & redmine 4.1 compatibility
vany-egorov Feb 13, 2020
e663093
Merge pull request #51 from x-redmine/release/4.1.x
dro123 Apr 9, 2020
0b1b9c5
Update 001_add_meeting_rooms_to_projects.rb
aescariom May 22, 2020
c639ccf
Merge pull request #52 from aescariom/master
dro123 May 23, 2020
4c4c822
add Japanese language
guskma Jun 24, 2020
d7556d0
Merge pull request #55 from guskma/lang-ja
dro123 Jun 27, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
486 changes: 417 additions & 69 deletions README.md

Large diffs are not rendered by default.

266 changes: 266 additions & 0 deletions app/controllers/meeting_room_calendar_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
class MeetingRoomCalendarController < ApplicationController
unloadable
accept_api_auth :index, :create, :update, :delete, :missing_config

def initialize
super()

@settings = Setting['plugin_redmine_meeting_room_calendar']

# Backward compatibility
@project_id = Setting['plugin_redmine_meeting_room_calendar']['project_id']
@project_ids = Setting['plugin_redmine_meeting_room_calendar']['project_ids'] || []
unless @project_id == nil || @project_id == 0 || @project_id == '0' || @project_id == ''
@project_ids = @project_ids + [@project_id]
Setting['plugin_redmine_meeting_room_calendar']['project_ids'] = @project_ids
else
@project_id = @project_ids[0]
end
Setting['plugin_redmine_meeting_room_calendar']['project_id'] = '0'

@tracker_id = Setting['plugin_redmine_meeting_room_calendar']['tracker_id']
@custom_field_id_room = Setting['plugin_redmine_meeting_room_calendar']['custom_field_id_room']
@custom_field_id_start = Setting['plugin_redmine_meeting_room_calendar']['custom_field_id_start']
@custom_field_id_end = Setting['plugin_redmine_meeting_room_calendar']['custom_field_id_end']
@issue_status_id = Setting['plugin_redmine_meeting_room_calendar']['issue_status_id']
@show_categories = Setting['plugin_redmine_meeting_room_calendar']['show_categories']
@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
@allow_weekends = Setting['plugin_redmine_meeting_room_calendar']['allow_weekends'] || 0
@allow_overlap = Setting['plugin_redmine_meeting_room_calendar']['allow_overlap'] || 0

if check_settings
@start_time = CustomField.find_by_id(@custom_field_id_start).possible_values
@end_time = CustomField.find_by_id(@custom_field_id_end).possible_values
@meeting_rooms = CustomField.find_by_id(@custom_field_id_room).possible_values
end

if Rails::VERSION::MAJOR < 3
@base_url = Redmine::Utils::relative_url_root
else
@base_url = config.relative_url_root
end
end

def index
unless check_settings
redirect_to :action => 'missing_config'
return
end

@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
end
@project_id = @project.id
@user = User.current.id
@user_name = User.current.name
@user_last_name = User.current.name(:lastname_coma_firstname)
@user_is_manager = 0
if User.current.allowed_to?(:edit_project, @project)
@user_is_manager = 1
end
@assignable_users = @project.assignable_users.collect { |user| [user.name, user.id] }
@categories = [['', 0]] + @project.issue_categories.collect { |c| [c.name, c.id] }

@api_key = User.current.api_key
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 }
if @meeting_rooms == nil || @meeting_rooms.count == 0
@meeting_rooms = rooms
else
@meeting_rooms = @meeting_rooms & rooms
end
end

if Setting['plugin_redmine_meeting_room_calendar']['show_project_menu'] != '1'
@project = nil
end
end

def create
@projects = Project.find(@project_ids).select{ |p| p.visible? }.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
redirect_to :action => 'missing_config'
return
end
@project_id = @project.id

unless User.current.allowed_to?(:add_issues, @project)
render_403
return
end

recur_meeting = params[:recur]
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'
recur_type = 1
recur_period = 1
end

while recur_period > 0
week_day = meeting_date.wday # 0->Sunday, 6-> Saturday
if (week_day!=6 && week_day!=0) || (@allow_weekends=='1')
@calendar_issue= Issue.new
@calendar_issue.project_id = project_id
@calendar_issue.tracker_id = @tracker_id
@calendar_issue.subject = params[:subject]
@calendar_issue.author_id = params[:author_id]
@calendar_issue.assigned_to_id = params[:assigned_to_id]
if @show_categories
@calendar_issue.category_id = params[:category_id]
end
@calendar_issue.start_date = meeting_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)
end
orig_mail_notification = User.current.mail_notification
User.current.mail_notification = 'none'
User.current.save
User.current.reload
@calendar_issue.save!
User.current.mail_notification = orig_mail_notification
User.current.save
User.current.reload
else
recur_period +=1
end
meeting_date += recur_type
meeting_end_date += recur_type
recur_period -=1
end
end

def update
@projects = Project.find(@project_ids).select{ |p| p.visible? }.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
redirect_to :action => 'missing_config'
return
end
@project_id = @project.id

unless User.current.allowed_to?(:edit_issues, @project)
render_403
return
end

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
@calendar_issue.project_id = project_id
@calendar_issue.tracker_id = @tracker_id
@calendar_issue = Issue.find(params[:event_id])
@calendar_issue.subject = params[:subject]
@calendar_issue.assigned_to_id = params[:assigned_to_id]
if @show_categories
@calendar_issue.category_id = params[:category_id]
end
@calendar_issue.start_date = meeting_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'
User.current.save
User.current.reload
@calendar_issue.save!
User.current.mail_notification = orig_mail_notification
User.current.save
User.current.reload
end

def delete
@projects = Project.find(@project_ids).select{ |p| p.visible? }.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
redirect_to :action => 'missing_config'
return
end
@project_id = @project.id

unless User.current.allowed_to?(:delete_issues, @project)
render_403
return
end

@calendar_issue = Issue.find(params[:event_id])
begin
@calendar_issue.reload.destroy
rescue ::ActiveRecord::RecordNotFound # raised by #reload if issue no longer exists
# nothing to do, issue was already deleted (eg. by a parent)
end
end

def check_settings
if @project_ids == nil || @project_ids.length == 0 || @project_ids[0].to_s == '0' || @project_ids[0].to_s == ''
return false
end
if @tracker_id == nil || @tracker_id.to_s == '0' || @tracker_id.to_s == ''
return false
end
if @custom_field_id_room == nil || @custom_field_id_room.to_s == '0' || @custom_field_id_room.to_s == ''
return false
end
if @custom_field_id_start == nil || @custom_field_id_start.to_s == '0' || @custom_field_id_start.to_s == ''
return false
end
if @custom_field_id_end == nil || @custom_field_id_end.to_s == '0' || @custom_field_id_end.to_s == ''
return false
end

return true
end

def missing_config

end
end
2 changes: 2 additions & 0 deletions app/helpers/meeting_room_calendar_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module MeetingRoomCalendarHelper
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<%- project_ids = Project.all %>
<p>
<%= label_tag('settings[project_ids]', l(:label_setting_project_id)) %>
<%= select_tag('settings[project_ids]', options_for_select(project_ids.collect{|c| [c.name, c.id]}, (@settings['project_ids'] || [])), :multiple => true) %>
</p>

<%- tracker_ids = Tracker.all %>
<p>
<%= label_tag('settings[tracker_id]', l(:label_setting_tracker_id)) %>
<%= select_tag('settings[tracker_id]', options_for_select([['', 0]] + tracker_ids.collect{|c| [c.name, c.id]}, (@settings['tracker_id'] || 0))) %>
</p>

<%- 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))) %>
</p>
<p>
<%= label_tag('settings[custom_field_id_start]', l(:label_setting_custom_field_id_start)) %>
<%= select_tag('settings[custom_field_id_start]', options_for_select([['', 0]] + custom_fields_issues.collect{|c| [c.name, c.id]}, (@settings['custom_field_id_start'] || 0))) %>
</p>
<p>
<%= label_tag('settings[custom_field_id_end]', l(:label_setting_custom_field_id_end)) %>
<%= select_tag('settings[custom_field_id_end]', options_for_select([['', 0]] + custom_fields_issues.collect{|c| [c.name, c.id]}, (@settings['custom_field_id_end'] || 0))) %>
</p>
<%- issue_status_ids = IssueStatus.all %>
<p>
<%= label_tag('settings[issue_status_id]', l(:label_setting_issue_status_id)) %>
<%= select_tag('settings[issue_status_id]', options_for_select([['', 0]] + issue_status_ids.collect{|c| [c.name, c.id]}, (@settings['issue_status_id'] || 0))) %>
</p>
<p>
<%= label_tag('settings[show_project_menu]', l(:label_setting_show_project_menu)) %>
<%= check_box_tag('settings[show_project_menu]', 1, (@settings['show_project_menu'] == '1')) %>
</p>
<p>
<%= label_tag('settings[show_categories]', l(:label_setting_show_categories)) %>
<%= check_box_tag('settings[show_categories]', 1, (@settings['show_categories'] == '1')) %>
</p>
<p>
<%= label_tag('settings[hide_projects]', l(:label_setting_hide_projects)) %>
<%= check_box_tag('settings[hide_projects]', 1, (@settings['hide_projects'] == '1')) %>
</p>
<p>
<%= label_tag('settings[hide_rooms]', l(:label_setting_hide_rooms)) %>
<%= check_box_tag('settings[hide_rooms]', 1, (@settings['hide_rooms'] == '1')) %>
</p>
<p>
<%= label_tag('settings[allow_changing_old_meetings]', l(:label_setting_allow_changing_old_meetings)) %>
<%= check_box_tag('settings[allow_changing_old_meetings]', 1, (@settings['allow_changing_old_meetings'] == '1')) %>
</p>
<p>
<%= label_tag('settings[allow_drag_and_drop]', l(:label_setting_allow_drag_and_drop)) %>
<%= check_box_tag('settings[allow_drag_and_drop]', 1, (@settings['allow_drag_and_drop'] == '1')) %>
</p>
<p>
<%= 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>
<p>
<%= label_tag('settings[allow_weekends]', l(:label_setting_allow_weekends)) %>
<%= check_box_tag('settings[allow_weekends]', 1, (@settings['allow_weekends'] == '1')) %>
</p>
<p>
<%= label_tag('settings[allow_overlap]', l(:label_setting_allow_overlap)) %>
<%= check_box_tag('settings[allow_overlap]', 1, (@settings['allow_overlap'] == '1')) %>
</p>
Loading