forked from arkhitech/redmine_update_reminder
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #132 from southbridgeio/develop
Develop
- Loading branch information
Showing
29 changed files
with
351 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class Intouch::TelegramChatSubscription < ActiveRecord::Base | ||
belongs_to :issue | ||
|
||
validates_presence_of :issue_id, :chat_id | ||
|
||
def self.table_name | ||
'intouch_telegram_chat_subscriptions' | ||
end | ||
|
||
def self.find_by_chat_id(chat_id) | ||
# Telegram group id is always negative | ||
where("ABS(#{table_name}.chat_id) = ?", chat_id.abs).take | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
class TelegramGroupChat < ActiveRecord::Base | ||
unloadable | ||
def self.find_by_tid(chat_id) | ||
return nil if chat_id.nil? | ||
# Telegram group id is always negative | ||
where("ABS(#{table_name}.tid) = ?", chat_id.abs).take | ||
end | ||
end |
58 changes: 58 additions & 0 deletions
58
app/views/projects/settings/intouch/issue_update/_telegram_group.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<% kind = dom_id(telegram_group) %> | ||
<h4><%= telegram_group.title %></h4> | ||
<%= check_box_tag "intouch_settings[telegram_settings][groups][#{telegram_group.id}][only_unassigned]", '1', | ||
settings_source.telegram_settings.try(:[], 'groups').try(:[], telegram_group.id.to_s). | ||
try(:[], 'only_unassigned'), | ||
id: "telegram_groups_#{telegram_group.id}_only_unassigned" | ||
%> | ||
<%= label_tag "telegram_groups_#{telegram_group.id}_only_unassigned", | ||
t('intouch.project.settings.issue_update.telegram_groups.only_unassigned') %> | ||
<%= check_box_tag "intouch_settings[telegram_settings][groups][#{telegram_group.id}][anytime]", '1', | ||
settings_source.telegram_settings.try(:[], 'groups').try(:[], telegram_group.id.to_s). | ||
try(:[], 'anytime'), | ||
id: "telegram_groups_#{telegram_group.id}_anytime" | ||
%> | ||
<%= label_tag "telegram_groups_#{telegram_group.id}_anytime", | ||
t('intouch.project.settings.issue_update.telegram_groups.anytime') %> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th><%= t('field_status') %> \ <%= t('field_priority') %></th> | ||
<% priorities.each do |priority| %> | ||
<th> | ||
<%= check_box_tag "#{kind}_priority_#{priority.id}", '1', false, class: 'prioritySelectAll', | ||
data: { kind: kind, priority_id: priority.id } | ||
%> | ||
<%= label_tag "#{kind}_priority_#{priority.id}", priority.name %> | ||
</th> | ||
<% end %> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<% statuses.each do |status| %> | ||
<tr> | ||
<th> | ||
<%= check_box_tag "#{kind}_status_#{status.id}", '1', false, class: 'statusSelectAll', | ||
data: {kind: kind, status_id: status.id} | ||
%> | ||
<%= label_tag "#{kind}_status_#{status.id}", status.name %> | ||
</th> | ||
<% priorities.each do |priority| %> | ||
|
||
<td> | ||
<%= check_box_tag "intouch_settings[telegram_settings][groups][#{telegram_group.id}][#{status.id}][]", priority.id, | ||
settings_source.telegram_settings.try(:[], 'groups').try(:[], telegram_group.id.to_s). | ||
try(:[], status.id.to_s).try(:include?, priority.id.to_s), | ||
class: 'intouchPriorityStatusCheckbox', | ||
data: {kind: kind, priority_id: priority.id, status_id: status.id} | ||
%> | ||
</td> | ||
|
||
<% end %> | ||
</tr> | ||
|
||
|
||
<% end %> | ||
</tbody> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
document.getElementById('telegram-groups-list').insertAdjacentHTML('beforeend', "<%= escape_javascript(render partial: 'projects/settings/intouch/issue_update/telegram_group', | ||
locals: { telegram_group: @telegram_group, priorities: @priorities, statuses: @statuses, settings_source: @settings_source }) %>") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.