Skip to content

Commit 18debef

Browse files
committed
make byots a plugin setting
refs CNVS-18526 test plan - remove ticketing system mL - it should use the plugin settings Change-Id: Iaed00f254f3de500e518c38b57cf666898103836 Reviewed-on: https://gerrit.instructure.com/50566 Reviewed-by: Cody Cutrer <cody@instructure.com> Tested-by: Jenkins Product-Review: Rob Orton <rob@instructure.com> QA-Review: Rob Orton <rob@instructure.com>
1 parent ade2d11 commit 18debef

3 files changed

Lines changed: 49 additions & 0 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<%= fields_for :settings, OpenObject.new(settings) do |f| %>
2+
<table style="width: 500px;" class="formtable">
3+
<tr>
4+
<td colspan="2">
5+
<%= mt :description, "Ticketing System setup" %>
6+
</td>
7+
</tr>
8+
<tr>
9+
<td><%= f.blabel :type, :en => "Ticketing System type" %></td>
10+
<td><%= f.select :type, Canvas::Plugin.all_for_tag(:byots).map { |p| [p.name, p.id] } %>
11+
</tr>
12+
</table>
13+
<% end %>

lib/canvas/plugins/default_plugins.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,3 +318,12 @@
318318
:settings_partial => 'plugins/panda_pub_settings',
319319
:validator => 'PandaPubValidator'
320320
})
321+
Canvas::Plugin.register('byots', nil, {
322+
:name => lambda{ t :name, 'Ticketing System' },
323+
:description => lambda{ t :description, 'Ticketing system configurations' },
324+
:author => 'Instructure',
325+
:author_website => 'http://www.instructure.com',
326+
:version => '1.0.0',
327+
:settings_partial => 'plugins/ticketing_system_settings',
328+
:validator => 'TicketingSystemValidator'
329+
})
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#
2+
# Copyright (C) 2015 Instructure, Inc.
3+
#
4+
# This file is part of Canvas.
5+
#
6+
# Canvas is free software: you can redistribute it and/or modify it under
7+
# the terms of the GNU Affero General Public License as published by the Free
8+
# Software Foundation, version 3 of the License.
9+
#
10+
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
11+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12+
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
13+
# details.
14+
#
15+
# You should have received a copy of the GNU Affero General Public License along
16+
# with this program. If not, see <http://www.gnu.org/licenses/>.
17+
#
18+
19+
module Canvas::Plugins::Validators::TicketingSystemValidator
20+
def self.validate(settings, plugin_setting)
21+
if Canvas::Plugin.find(settings[:type])
22+
settings.slice(:type)
23+
else
24+
raise("could not find plugin for #{settings[:type]}")
25+
end
26+
end
27+
end

0 commit comments

Comments
 (0)