Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-fediuk committed Jan 13, 2018
1 parent 2a298ee commit 08ac4e9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 37 deletions.
12 changes: 3 additions & 9 deletions assets/javascripts/admin/i.js.es6
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import SiteSetting from 'admin/components/site-setting';
export default {name: 'df-core-admin', initialize() {
/** @type {String[]} */
const myTypes = [
'df_editor', 'df_password', 'df_textarea', 'paid_membership_plans', 'paypal_buttons'
];
const myTypes = ['df_editor', 'df_password', 'df_textarea', 'paid_membership_plans', 'paypal_buttons'];
SiteSetting.reopen({
/**
* 2015-07-06
Expand All @@ -17,8 +15,7 @@ export default {name: 'df-core-admin', initialize() {
*/
_dfDidInsertElement: function() {
const settingName = this.get('setting.setting');
// Проворачиваем нашу операцию только для наших настроек,
// не затрагивая настройки ядра.
// Проворачиваем нашу операцию только для наших настроек, не затрагивая настройки ядра.
if (-1 < settingName.indexOf('«')) {
this.$().closest('.row.setting').addClass(this.get('setting.setting'));
}
Expand All @@ -27,10 +24,7 @@ export default {name: 'df-core-admin', initialize() {
var type = this.get('setting.type');
return -1 < myTypes.indexOf(type) ? type : this._super();
}.property('setting.type')
/**
* 2015-08-27
* https://meta.discourse.org/t/32572
*/
// 2015-08-27 https://meta.discourse.org/t/32572
,typeClass: function() {
return this.get('componentType').replace(/_/g, '-');
}.property('componentType')
Expand Down
43 changes: 15 additions & 28 deletions plugin.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# name: df-core
# about: A common functionality of my Discourse plugins.
# version: 1.2.7
# version: 1.3.0
# authors: Dmitry Fedyuk
# url: https://discourse.pro
#register_asset 'javascripts/lib/sprintf.js'
Expand Down Expand Up @@ -93,7 +93,7 @@ def request(method, params = {})
core__request method, params
end
end
# 2018-01-09
# 2018-01-12
# 1) "«NameError: uninitialized constant SiteSettings::DefaultsProvider::DistributedCache»
# on `bundle exec rake db:migrate` after upgrading to Discourse v1.9.0.beta11":
# https://github.com/discourse-pro/df-core/issues/1
Expand All @@ -103,36 +103,23 @@ def request(method, params = {})
require 'site_setting_extension'
if defined?(SiteSettings::TypeSupervisor)
SiteSettings::TypeSupervisor.module_eval do
alias_method :core__to_rb_value, :to_rb_value
def to_rb_value(name, value, override_type = nil)
begin
result = core__to_rb_value(name, value, override_type)
rescue ArgumentError
result = value
class <<self
alias_method :core__types, :types
def types
result = @types
if not result
result = core__types
result[:df_editor] = 500;
result[:df_password] = 501; # 2015-08-31 input type=password
result[:df_textarea] = 502; # 2015-08-27 textarea без редактора
result[:paypal_buttons] = 503;
result[:paid_membership_plans] = 504;
end
return result
end
return result
end
end
end
SiteSettingExtension.module_eval do
alias_method :core__types, :types
def types
result = @types
if not result
result = core__types
result[:df_editor] = result.length + 1;
# 2015-08-31
# input type=password
result[:df_password] = result.length + 1;
# 2015-08-27
# textarea без редактора
result[:df_textarea] = result.length + 1;
result[:paypal_buttons] = result.length + 1;
result[:paid_membership_plans] = result.length + 1;
end
return result
end
end
after_initialize do
module ::Df::Core
class Engine < ::Rails::Engine
Expand Down

0 comments on commit 08ac4e9

Please sign in to comment.