redmineup 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/doc/CHANGELOG +4 -1
- data/lib/redmineup/currency.rb +1 -1
- data/lib/redmineup/helpers/calendars_helper.rb +22 -0
- data/lib/redmineup/hooks/views_layouts_hook.rb +1 -0
- data/lib/redmineup/patches/compatibility/application_controller_patch.rb +32 -0
- data/lib/redmineup/patches/compatibility/routing_mapper_patch.rb +27 -0
- data/lib/redmineup/patches/compatibility/user_patch.rb +21 -0
- data/lib/redmineup/patches/compatibility_patch.rb +7 -0
- data/lib/redmineup/version.rb +1 -1
- data/lib/redmineup.rb +2 -3
- data/test/acts_as_taggable/rup_acts_as_taggable_test.rb +1 -1
- data/vendor/assets/stylesheets/calendars.css +15 -0
- data/vendor/assets/stylesheets/money.css +1 -1
- metadata +8 -6
- data/app/views/redmine_crm/redmineup_calendar/_calendar.html.erb +0 -34
- data/lib/redmineup/compatibility/application_controller_patch.rb +0 -33
- data/lib/redmineup/compatibility/routing_mapper_patch.rb +0 -25
- data/lib/redmineup/helpers/rup_calendar_helper.rb +0 -146
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1f4c8d29e3e301d443f1ff3ba42e1f259d7e9920b0dd08b817c776e362dc001
|
4
|
+
data.tar.gz: fd4c8e149fb512e67a8d02a4efbc46f38341935a6da1b781fb675fdfb19353cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b5b31109d40245e2c939a91a88a11f1536b0899aea8a032f773acaf0390f2f23cce5ff40161a8ade27bedb77e13a5604f339f2b61a85609f4d2a70113f93f66
|
7
|
+
data.tar.gz: 106630460ba9b8cb2bb3e80de47834e5f88cda5c6631f4a2fd90ea6921afab7f268c3460ff012251ff201d850e758b3bf690b588c980fcc90b84ea1de7ccbb51
|
data/doc/CHANGELOG
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
== Redmine UP gem changelog
|
2
2
|
|
3
3
|
Redmine UP gem - general functions for plugins (tags, vote, viewing, currency)
|
4
|
-
Copyright (C) 2011-2023 RedmineUP
|
4
|
+
Copyright (C) 2011-2023 Kirill Bezrukov (RedmineUP)
|
5
5
|
https://www.redmineup.com/
|
6
6
|
|
7
|
+
== 2023-10-12 v1.0.3
|
8
|
+
|
9
|
+
|
7
10
|
== 2023-10-12 v1.0.1
|
8
11
|
|
9
12
|
* RedmineUp module renamed to Redmineup
|
data/lib/redmineup/currency.rb
CHANGED
@@ -40,7 +40,7 @@ module Redmineup
|
|
40
40
|
Redmine::MenuManager.map(:admin_menu).push(:redmineup_money,
|
41
41
|
{ controller: 'redmineup', action: 'settings', id: 'money' },
|
42
42
|
caption: :label_redmineup_money,
|
43
|
-
html: { class: 'icon icon-
|
43
|
+
html: { class: 'icon icon-redmineup-money' })
|
44
44
|
|
45
45
|
end
|
46
46
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Redmineup
|
2
|
+
module CalendarsHelper
|
3
|
+
|
4
|
+
def calendar_day_css_classes(calendar, day)
|
5
|
+
css = day.month==calendar.month ? +'even' : +'odd'
|
6
|
+
css << " today" if User.current.today == day
|
7
|
+
css << " nwday" if non_working_week_days.include?(day.cwday)
|
8
|
+
css
|
9
|
+
end
|
10
|
+
|
11
|
+
def non_working_week_days
|
12
|
+
@non_working_week_days ||= begin
|
13
|
+
days = Setting.non_working_week_days
|
14
|
+
if days.is_a?(Array) && days.size < 7
|
15
|
+
days.map(&:to_i)
|
16
|
+
else
|
17
|
+
[]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Redmineup
|
2
|
+
module Patches
|
3
|
+
module Compatibility
|
4
|
+
module ApplicationControllerPatch
|
5
|
+
def self.included(base) # :nodoc:
|
6
|
+
base.extend(ClassMethods)
|
7
|
+
base.class_eval do
|
8
|
+
unloadable # Send unloadable so it will not be unloaded in development
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
module ClassMethods
|
13
|
+
def before_action(*filters, &block)
|
14
|
+
before_filter(*filters, &block)
|
15
|
+
end
|
16
|
+
|
17
|
+
def after_action(*filters, &block)
|
18
|
+
after_filter(*filters, &block)
|
19
|
+
end
|
20
|
+
|
21
|
+
def skip_before_action(*filters, &block)
|
22
|
+
skip_before_filter(*filters, &block)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
unless ActionController::Base.methods.include?(:before_action)
|
31
|
+
ActionController::Base.send(:include,Redmineup::Patches::Compatibility::ApplicationControllerPatch)
|
32
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Redmineup
|
2
|
+
module Patches
|
3
|
+
module Compatibility
|
4
|
+
module RoutingMapperPatch
|
5
|
+
def self.included(base)
|
6
|
+
base.send(:include, InstanceMethods)
|
7
|
+
|
8
|
+
base.class_eval do
|
9
|
+
alias_method :constraints_without_redmineup, :constraints
|
10
|
+
alias_method :constraints, :constraints_with_redmineup
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
module InstanceMethods
|
15
|
+
def constraints_with_redmineup(options = {}, &block)
|
16
|
+
options[:object_type] = /.+/ if options[:object_type] && options[:object_type].is_a?(Regexp)
|
17
|
+
constraints_without_redmineup(options, &block)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
unless ActionDispatch::Routing::Mapper.included_modules.include?(Redmineup::Patches::Compatibility::RoutingMapperPatch)
|
26
|
+
ActionDispatch::Routing::Mapper.send(:include, Redmineup::Patches::Compatibility::RoutingMapperPatch)
|
27
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Redmineup
|
2
|
+
module Patches
|
3
|
+
module Compatibility
|
4
|
+
module UserPatch
|
5
|
+
def self.included(base)
|
6
|
+
base.send(:include, InstanceMethods)
|
7
|
+
end
|
8
|
+
|
9
|
+
module InstanceMethods
|
10
|
+
def atom_key
|
11
|
+
rss_key
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
unless ActionDispatch::Routing::Mapper.included_modules.include?(Redmineup::Patches::Compatibility::UserPatch)
|
20
|
+
ActionDispatch::Routing::Mapper.send(:include, Redmineup::Patches::Compatibility::UserPatch)
|
21
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
if Redmine::VERSION.to_s < "4"
|
2
|
+
require 'redmineup/patches/compatibility/application_controller_patch'
|
3
|
+
end
|
4
|
+
if Redmine::VERSION.to_s < "5"
|
5
|
+
require 'redmineup/patches/compatibility/user_patch'
|
6
|
+
end
|
7
|
+
require 'redmineup/patches/compatibility/routing_mapper_patch'
|
data/lib/redmineup/version.rb
CHANGED
data/lib/redmineup.rb
CHANGED
@@ -40,11 +40,9 @@ require 'redmineup/liquid/drops/issue_relations_drop'
|
|
40
40
|
|
41
41
|
require 'redmineup/helpers/external_assets_helper'
|
42
42
|
require 'redmineup/helpers/form_tag_helper'
|
43
|
-
require 'redmineup/helpers/
|
43
|
+
require 'redmineup/helpers/calendars_helper'
|
44
44
|
require 'redmineup/assets_manager'
|
45
45
|
|
46
|
-
require 'redmineup/compatibility/application_controller_patch'
|
47
|
-
require 'redmineup/compatibility/routing_mapper_patch'
|
48
46
|
require 'redmineup/patches/liquid_patch' unless BigDecimal.respond_to?(:new)
|
49
47
|
|
50
48
|
module Redmineup
|
@@ -60,6 +58,7 @@ end
|
|
60
58
|
Redmineup::AssetsManager.install_assets
|
61
59
|
|
62
60
|
if defined?(ActionView::Base)
|
61
|
+
ActionView::Base.send :include, Redmineup::CalendarsHelper
|
63
62
|
ActionView::Base.send :include, Redmineup::ExternalAssetsHelper
|
64
63
|
ActionView::Base.send :include, Redmineup::FormTagHelper
|
65
64
|
end
|
@@ -338,7 +338,7 @@ class RupActsAsTaggableTest < ActiveSupport::TestCase
|
|
338
338
|
|
339
339
|
def test_tags_condition
|
340
340
|
assert_equal "(tags_TABLE.name LIKE #{tags(:feature).id} OR tags_TABLE.name LIKE #{tags(:bug).id})",
|
341
|
-
Issue.send(:tags_condition, [tags(:feature), tags(:bug)], 'tags_TABLE')
|
341
|
+
Issue.send(:tags_condition, [tags(:feature), tags(:bug)], 'tags_TABLE').gsub("'", "")
|
342
342
|
end
|
343
343
|
|
344
344
|
def test_all_tags_list
|
@@ -0,0 +1,15 @@
|
|
1
|
+
table.cal {width: 100%; margin: 0 0 6px 0; border: 1px solid #c0c0c0; border-spacing: 0; border-radius: 3px;}
|
2
|
+
table.cal thead th {width: 14%; background-color:#EEEEEE; padding: 4px; }
|
3
|
+
table.cal thead th.week-number {width: auto;}
|
4
|
+
table.cal tbody tr {height: 100px;}
|
5
|
+
table.cal td .icon {padding-top: 2px; padding-bottom: 3px;}
|
6
|
+
table.cal td {border: 1px solid #d7d7d7; vertical-align: top; font-size: 0.9em; border-bottom: 0; border-right: 0;}
|
7
|
+
table.cal td.week-number { background-color:#EEEEEE; padding: 4px; border:none; font-size: 1em;}
|
8
|
+
table.cal td p.day-num {font-size: 1.1em; text-align:right;}
|
9
|
+
table.cal td.odd p.day-num {color: #bbb;}
|
10
|
+
table.cal td.today {background:#ffffdd;}
|
11
|
+
table.cal td.today p.day-num {font-weight: bold;}
|
12
|
+
table.cal td.nwday:not(.odd) {background-color:#f1f1f1;}
|
13
|
+
table.cal .starting a.issue, p.cal.legend .starting {background: url(../images/bullet_go.png) no-repeat -1px -2px; padding-left:16px;}
|
14
|
+
table.cal .ending a.issue, p.cal.legend .ending {background: url(../images/bullet_end.png) no-repeat -1px -2px; padding-left:16px;}
|
15
|
+
table.cal .starting.ending a.issue, p.cal.legend .starting.ending {background: url(../images/bullet_diamond.png) no-repeat -1px -2px; padding-left:16px;}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redmineup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RedmineUP
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -113,7 +113,6 @@ files:
|
|
113
113
|
- README.md
|
114
114
|
- Rakefile
|
115
115
|
- app/controllers/redmineup_controller.rb
|
116
|
-
- app/views/redmine_crm/redmineup_calendar/_calendar.html.erb
|
117
116
|
- app/views/redmineup/_money.html.erb
|
118
117
|
- app/views/redmineup/settings.html.erb
|
119
118
|
- bitbucket-pipelines.yml
|
@@ -143,16 +142,14 @@ files:
|
|
143
142
|
- lib/redmineup/acts_as_votable/voter.rb
|
144
143
|
- lib/redmineup/assets_manager.rb
|
145
144
|
- lib/redmineup/colors_helper.rb
|
146
|
-
- lib/redmineup/compatibility/application_controller_patch.rb
|
147
|
-
- lib/redmineup/compatibility/routing_mapper_patch.rb
|
148
145
|
- lib/redmineup/currency.rb
|
149
146
|
- lib/redmineup/currency/formatting.rb
|
150
147
|
- lib/redmineup/currency/heuristics.rb
|
151
148
|
- lib/redmineup/currency/loader.rb
|
152
149
|
- lib/redmineup/engine.rb
|
150
|
+
- lib/redmineup/helpers/calendars_helper.rb
|
153
151
|
- lib/redmineup/helpers/external_assets_helper.rb
|
154
152
|
- lib/redmineup/helpers/form_tag_helper.rb
|
155
|
-
- lib/redmineup/helpers/rup_calendar_helper.rb
|
156
153
|
- lib/redmineup/helpers/tags_helper.rb
|
157
154
|
- lib/redmineup/helpers/vote_helper.rb
|
158
155
|
- lib/redmineup/hooks/views_layouts_hook.rb
|
@@ -167,6 +164,10 @@ files:
|
|
167
164
|
- lib/redmineup/liquid/filters/base.rb
|
168
165
|
- lib/redmineup/liquid/filters/colors.rb
|
169
166
|
- lib/redmineup/money_helper.rb
|
167
|
+
- lib/redmineup/patches/compatibility/application_controller_patch.rb
|
168
|
+
- lib/redmineup/patches/compatibility/routing_mapper_patch.rb
|
169
|
+
- lib/redmineup/patches/compatibility/user_patch.rb
|
170
|
+
- lib/redmineup/patches/compatibility_patch.rb
|
170
171
|
- lib/redmineup/patches/liquid_patch.rb
|
171
172
|
- lib/redmineup/settings.rb
|
172
173
|
- lib/redmineup/settings/money.rb
|
@@ -222,6 +223,7 @@ files:
|
|
222
223
|
- vendor/assets/javascripts/Chart.bundle.min.js
|
223
224
|
- vendor/assets/javascripts/select2.js
|
224
225
|
- vendor/assets/javascripts/select2_helpers.js
|
226
|
+
- vendor/assets/stylesheets/calendars.css
|
225
227
|
- vendor/assets/stylesheets/money.css
|
226
228
|
- vendor/assets/stylesheets/select2.css
|
227
229
|
homepage: https://www.redmineup.com
|
@@ -1,34 +0,0 @@
|
|
1
|
-
<ul class="cal">
|
2
|
-
<li scope="col" title="<%= l(:label_week) %>" class="calhead week-number"></li>
|
3
|
-
<% 7.times do |i| %>
|
4
|
-
<li scope="col" class="calhead"><%= day_name((calendar.first_wday + i) % 7) %></li>
|
5
|
-
<% end %>
|
6
|
-
<% calendar.format_month.each_slice(7) do |week| %>
|
7
|
-
<li class='week-number'>
|
8
|
-
<span class="label-week"><%= l(:label_week) %></span> <%= calendar.week_number week.first %>
|
9
|
-
</li>
|
10
|
-
<% week.each do |day| %>
|
11
|
-
<li class="<%= calendar.day_css_classes day %> calbody">
|
12
|
-
<p class="day-num"><%= day.day %>
|
13
|
-
<span class="abbr-day">(<%= abbr_day_name(day.cwday) %>)</span>
|
14
|
-
</p>
|
15
|
-
<% calendar.events_on(day).each do |i| %>
|
16
|
-
<% if i.is_a? Issue %>
|
17
|
-
<%= tag.div class: [ i.css_classes, 'tooltip hascontextmenu', starting: day == i.start_date, ending: day == i.due_date] do %>
|
18
|
-
<%= "#{i.project} -" unless @project && @project == i.project %>
|
19
|
-
<%= link_to_issue i, :truncate => 30 %>
|
20
|
-
<span class="tip"><%= render_issue_tooltip i %></span>
|
21
|
-
<%= check_box_tag 'ids[]', i.id, false, :style => 'display:none;', :id => nil %>
|
22
|
-
<% end %>
|
23
|
-
<% else %>
|
24
|
-
<span class="icon icon-package">
|
25
|
-
<%= "#{i.project} -" unless @project && @project == i.project %>
|
26
|
-
<%= link_to_version i %>
|
27
|
-
</span>
|
28
|
-
<% end %>
|
29
|
-
<% end %>
|
30
|
-
</li>
|
31
|
-
<% end %>
|
32
|
-
<% end %>
|
33
|
-
</ul>
|
34
|
-
<%= context_menu %>
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module Redmineup
|
2
|
-
module Patches
|
3
|
-
module ApplicationControllerPatch
|
4
|
-
def self.included(base) # :nodoc:
|
5
|
-
base.extend(ClassMethods)
|
6
|
-
base.class_eval do
|
7
|
-
unloadable # Send unloadable so it will not be unloaded in development
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
module ClassMethods
|
12
|
-
def before_action(*filters, &block)
|
13
|
-
before_filter(*filters, &block)
|
14
|
-
end
|
15
|
-
|
16
|
-
def after_action(*filters, &block)
|
17
|
-
after_filter(*filters, &block)
|
18
|
-
end
|
19
|
-
|
20
|
-
def skip_before_action(*filters, &block)
|
21
|
-
skip_before_filter(*filters, &block)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
unless ActionController::Base.methods.include?(:before_action)
|
29
|
-
ActionController::Base.send(
|
30
|
-
:include,
|
31
|
-
Redmineup::Patches::ApplicationControllerPatch
|
32
|
-
)
|
33
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
module Redmineup
|
2
|
-
module Patches
|
3
|
-
module RoutingMapperPatch
|
4
|
-
def self.included(base)
|
5
|
-
base.send(:include, InstanceMethods)
|
6
|
-
|
7
|
-
base.class_eval do
|
8
|
-
alias_method :constraints_without_redmineup, :constraints
|
9
|
-
alias_method :constraints, :constraints_with_redmineup
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
module InstanceMethods
|
14
|
-
def constraints_with_redmineup(options = {}, &block)
|
15
|
-
options[:object_type] = /.+/ if options[:object_type] && options[:object_type].is_a?(Regexp)
|
16
|
-
constraints_without_redmineup(options, &block)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
unless ActionDispatch::Routing::Mapper.included_modules.include?(Redmineup::Patches::RoutingMapperPatch)
|
24
|
-
ActionDispatch::Routing::Mapper.send(:include, Redmineup::Patches::RoutingMapperPatch)
|
25
|
-
end
|
@@ -1,146 +0,0 @@
|
|
1
|
-
module RedmineUp
|
2
|
-
module CalendarHelper
|
3
|
-
# Simple class to compute the start and end dates of a calendar
|
4
|
-
class Calendar
|
5
|
-
attr_reader :startdt, :enddt
|
6
|
-
|
7
|
-
def initialize(date, options={}, lang = current_language, period = :month)
|
8
|
-
@date = date
|
9
|
-
@events = []
|
10
|
-
@ending_events_by_days = {}
|
11
|
-
@starting_events_by_days = {}
|
12
|
-
# ADDED FOR CONTACTS-DEALS
|
13
|
-
@start_date_field = options[:start_date_field] || "start_date"
|
14
|
-
@due_date_field = options[:due_date_field] || "due_date"
|
15
|
-
# /ADDED FOR CONTACTS-DEALS
|
16
|
-
set_language_if_valid lang
|
17
|
-
case period
|
18
|
-
when :month
|
19
|
-
@startdt = Date.civil(date.year, date.month, 1)
|
20
|
-
@enddt = (@startdt >> 1)-1
|
21
|
-
# starts from the first day of the week
|
22
|
-
@startdt = @startdt - (@startdt.cwday - first_wday)%7
|
23
|
-
# ends on the last day of the week
|
24
|
-
@enddt = @enddt + (last_wday - @enddt.cwday)%7
|
25
|
-
when :week
|
26
|
-
@startdt = date - (date.cwday - first_wday)%7
|
27
|
-
@enddt = date + (last_wday - date.cwday)%7
|
28
|
-
else
|
29
|
-
raise 'Invalid period'
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def format_month
|
34
|
-
(@startdt..@enddt).to_a
|
35
|
-
end
|
36
|
-
|
37
|
-
def week_number(day)
|
38
|
-
(day + (11 - day.cwday) % 7).cweek
|
39
|
-
end
|
40
|
-
|
41
|
-
def day_css_classes(day)
|
42
|
-
css = day.month==month ? +'even' : +'odd'
|
43
|
-
css << " today" if User.current.today == day
|
44
|
-
css << " nwday" if non_working_week_days.include?(day.cwday)
|
45
|
-
css
|
46
|
-
end
|
47
|
-
|
48
|
-
# Sets calendar events
|
49
|
-
def events=(events)
|
50
|
-
@events = events
|
51
|
-
# CHANGED FOR CONTACTS-DEALS
|
52
|
-
@ending_events_by_days = @events.group_by {|event| event.send(@start_date_field) ? event.send(@start_date_field).to_date : event.due_date}
|
53
|
-
@starting_events_by_days = @events.group_by {|event| event.send(@due_date_field) ? event.send(@due_date_field).to_date : event.start_date}
|
54
|
-
# /CHANGED FOR CONTACTS-DEALS
|
55
|
-
end
|
56
|
-
|
57
|
-
# Returns events for the given day
|
58
|
-
def events_on(day)
|
59
|
-
((@ending_events_by_days[day] || []) + (@starting_events_by_days[day] || [])).uniq
|
60
|
-
end
|
61
|
-
|
62
|
-
# Calendar current month
|
63
|
-
def month
|
64
|
-
@date.month
|
65
|
-
end
|
66
|
-
|
67
|
-
# Return the first day of week
|
68
|
-
# 1 = Monday ... 7 = Sunday
|
69
|
-
def first_wday
|
70
|
-
case Setting.start_of_week.to_i
|
71
|
-
when 1
|
72
|
-
@first_dow ||= (1 - 1)%7 + 1
|
73
|
-
when 6
|
74
|
-
@first_dow ||= (6 - 1)%7 + 1
|
75
|
-
when 7
|
76
|
-
@first_dow ||= (7 - 1)%7 + 1
|
77
|
-
else
|
78
|
-
@first_dow ||= (l(:general_first_day_of_week).to_i - 1)%7 + 1
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
def last_wday
|
83
|
-
@last_dow ||= (first_wday + 5)%7 + 1
|
84
|
-
end
|
85
|
-
|
86
|
-
def abbr_day_name(day)
|
87
|
-
::I18n.t('date.abbr_day_names')[day % 7]
|
88
|
-
end
|
89
|
-
|
90
|
-
def current_language
|
91
|
-
::I18n.locale
|
92
|
-
end
|
93
|
-
|
94
|
-
def set_language_if_valid(lang)
|
95
|
-
if l = find_language(lang)
|
96
|
-
::I18n.locale = l
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
def find_language(lang)
|
101
|
-
@@languages_lookup ||=
|
102
|
-
valid_languages.inject({}) do |k, v|
|
103
|
-
k[v.to_s.downcase] = v
|
104
|
-
k
|
105
|
-
end
|
106
|
-
@@languages_lookup[lang.to_s.downcase]
|
107
|
-
end
|
108
|
-
|
109
|
-
def valid_languages
|
110
|
-
::I18n.available_locales
|
111
|
-
end
|
112
|
-
|
113
|
-
def l(*args)
|
114
|
-
case args.size
|
115
|
-
when 1
|
116
|
-
::I18n.t(*args)
|
117
|
-
when 2
|
118
|
-
if args.last.is_a?(Hash)
|
119
|
-
::I18n.t(*args.first, **args.last)
|
120
|
-
elsif args.last.is_a?(String)
|
121
|
-
::I18n.t(args.first, :value => args.last)
|
122
|
-
else
|
123
|
-
::I18n.t(args.first, :count => args.last)
|
124
|
-
end
|
125
|
-
else
|
126
|
-
raise "Translation string with multiple values: #{args.first}"
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
def non_working_week_days
|
131
|
-
@non_working_week_days ||= begin
|
132
|
-
days = Setting.non_working_week_days
|
133
|
-
if days.is_a?(Array) && days.size < 7
|
134
|
-
days.map(&:to_i)
|
135
|
-
else
|
136
|
-
[]
|
137
|
-
end
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
unless ActionView::Base.included_modules.include?(RedmineUp::CalendarHelper)
|
145
|
-
ActionView::Base.send(:include, RedmineUp::CalendarHelper)
|
146
|
-
end
|