mumukit-platform 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/lib/mumukit/platform/model.rb +20 -0
- data/lib/mumukit/platform/organization/helpers.rb +74 -0
- data/lib/mumukit/platform/organization/profile.rb +21 -0
- data/lib/mumukit/platform/organization/settings.rb +21 -0
- data/lib/mumukit/platform/organization/theme.rb +4 -0
- data/lib/mumukit/platform/organization.rb +6 -1
- data/lib/mumukit/platform/version.rb +1 -1
- data/lib/mumukit/platform.rb +2 -1
- data/mumukit-platform.gemspec +1 -0
- metadata +21 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10368247414796a853826e10a8362828f3ed4be1
|
4
|
+
data.tar.gz: ec28378596c2698e07bd6733b1ae1a4c83ec0641
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4109f60e2317643854be646257eac93dcafe727e0ff02a90de14e96d9f1655dbd45b23aef90bc62df19456bfec66ca286ec8a7e1aa1f840e66796d4f8f0782eb
|
7
|
+
data.tar.gz: a2399e374a6d92a0796ae8752378b7255c85d7c637056da6797194564f2e5670b747da218e2125d486cca3a77191af9d3518ef36cea656b809cf1422a8e4a1dc
|
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2017
|
3
|
+
Copyright (c) 2017 Franco Leonardo Bulgarelli
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'active_model'
|
2
|
+
|
3
|
+
class Mumukit::Platform::Model
|
4
|
+
include ActiveModel::Model
|
5
|
+
|
6
|
+
def self.model_attr_accessor(*keys)
|
7
|
+
attr_accessor(*keys)
|
8
|
+
define_singleton_method :parse do |json|
|
9
|
+
new json.slice(*keys)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.dump(obj)
|
14
|
+
obj.to_json
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.load(json)
|
18
|
+
new JSON.parse(json)
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
|
2
|
+
module Mumukit::Platform::Organization::Helpers
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
delegate :theme_stylesheet_url,
|
7
|
+
:extension_javascript_url, to: :theme
|
8
|
+
|
9
|
+
delegate :login_methods,
|
10
|
+
:login_methods=,
|
11
|
+
:login_settings,
|
12
|
+
:raise_hand_enabled?,
|
13
|
+
:raise_hand_enabled=,
|
14
|
+
:public?,
|
15
|
+
:public=,
|
16
|
+
:private?, to: :settings
|
17
|
+
|
18
|
+
delegate :logo_url,
|
19
|
+
:logo_url=,
|
20
|
+
:locale,
|
21
|
+
:locale=,
|
22
|
+
:locale_json,
|
23
|
+
:description,
|
24
|
+
:description=,
|
25
|
+
:community_link,
|
26
|
+
:terms_of_service,
|
27
|
+
:terms_of_service=,
|
28
|
+
:contact_email,
|
29
|
+
:contact_email=, to: :profile
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
def slug
|
34
|
+
Mumukit::Auth::Slug.join_s name
|
35
|
+
end
|
36
|
+
|
37
|
+
def central?
|
38
|
+
name == 'central'
|
39
|
+
end
|
40
|
+
|
41
|
+
def test?
|
42
|
+
name == 'test'
|
43
|
+
end
|
44
|
+
|
45
|
+
def switch!
|
46
|
+
Mumukit::Platform::Organization.switch! self
|
47
|
+
end
|
48
|
+
|
49
|
+
def to_s
|
50
|
+
name
|
51
|
+
end
|
52
|
+
|
53
|
+
def url_for(path)
|
54
|
+
Mumukit::Platform.application.organic_url_for(name, path)
|
55
|
+
end
|
56
|
+
|
57
|
+
def domain
|
58
|
+
Mumukit::Platform.application.organic_domain(name)
|
59
|
+
end
|
60
|
+
|
61
|
+
module ClassMethods
|
62
|
+
def current
|
63
|
+
Mumukit::Platform::Organization.current
|
64
|
+
end
|
65
|
+
|
66
|
+
def parse(json)
|
67
|
+
json
|
68
|
+
.slice(:name)
|
69
|
+
.merge(theme: Mumukit::Platform::Organization::Theme.parse(json))
|
70
|
+
.merge(settings: Mumukit::Platform::Organization::Settings.parse(json))
|
71
|
+
.merge(profile: Mumukit::Platform::Organization::Profile.parse(json))
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class Mumukit::Platform::Organization::Profile < Mumukit::Platform::Model
|
2
|
+
LOCALES = {
|
3
|
+
en: { facebook_code: :en_US, name: 'English' },
|
4
|
+
es: { facebook_code: :es_LA, name: 'Español' }
|
5
|
+
}.with_indifferent_access
|
6
|
+
|
7
|
+
model_attr_accessor :logo_url,
|
8
|
+
:locale,
|
9
|
+
:description,
|
10
|
+
:contact_email,
|
11
|
+
:terms_of_service,
|
12
|
+
:community_link
|
13
|
+
|
14
|
+
def locale_json
|
15
|
+
LOCALES[locale].to_json
|
16
|
+
end
|
17
|
+
|
18
|
+
def logo_url
|
19
|
+
@logo_url ||= 'https://mumuki.io/logo-alt-large.png'
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class Mumukit::Platform::Organization::Settings < Mumukit::Platform::Model
|
2
|
+
model_attr_accessor :login_methods,
|
3
|
+
:raise_hand_enabled,
|
4
|
+
:public
|
5
|
+
|
6
|
+
def raise_hand_enabled?
|
7
|
+
!!raise_hand_enabled
|
8
|
+
end
|
9
|
+
|
10
|
+
def public?
|
11
|
+
!!public
|
12
|
+
end
|
13
|
+
|
14
|
+
def private?
|
15
|
+
!public?
|
16
|
+
end
|
17
|
+
|
18
|
+
def login_methods
|
19
|
+
@login_methods ||= ['user_pass']
|
20
|
+
end
|
21
|
+
end
|
@@ -11,4 +11,9 @@ module Mumukit::Platform::Organization
|
|
11
11
|
def self.current
|
12
12
|
Thread.current[:organization] || raise('organization not selected')
|
13
13
|
end
|
14
|
-
end
|
14
|
+
end
|
15
|
+
|
16
|
+
require_relative './organization/settings'
|
17
|
+
require_relative './organization/profile'
|
18
|
+
require_relative './organization/theme'
|
19
|
+
require_relative './organization/helpers'
|
data/lib/mumukit/platform.rb
CHANGED
@@ -30,6 +30,7 @@ module Mumukit::Platform
|
|
30
30
|
end
|
31
31
|
|
32
32
|
require_relative './platform/domain'
|
33
|
+
require_relative './platform/model'
|
33
34
|
require_relative './platform/organization'
|
34
35
|
require_relative './platform/organization_mapping'
|
35
36
|
require_relative './platform/application'
|
@@ -45,4 +46,4 @@ module Mumukit::Platform
|
|
45
46
|
extend Mumukit::Platform::WithOrganization
|
46
47
|
extend Mumukit::Platform::WithOrganizationMapping
|
47
48
|
extend Mumukit::Platform::WithWebFramework
|
48
|
-
end
|
49
|
+
end
|
data/mumukit-platform.gemspec
CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.require_paths = ['lib']
|
23
23
|
|
24
24
|
spec.add_dependency 'mumukit-core', '~> 1.0'
|
25
|
+
spec.add_dependency 'activemodel', '>= 4.0'
|
25
26
|
|
26
27
|
spec.add_development_dependency 'bundler', '~> 1.14'
|
27
28
|
spec.add_development_dependency 'rake', '~> 10.0'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumukit-platform
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franco Leonardo Bulgarelli
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mumukit-core
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activemodel
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '4.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '4.0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,7 +100,12 @@ files:
|
|
86
100
|
- lib/mumukit/platform.rb
|
87
101
|
- lib/mumukit/platform/application.rb
|
88
102
|
- lib/mumukit/platform/domain.rb
|
103
|
+
- lib/mumukit/platform/model.rb
|
89
104
|
- lib/mumukit/platform/organization.rb
|
105
|
+
- lib/mumukit/platform/organization/helpers.rb
|
106
|
+
- lib/mumukit/platform/organization/profile.rb
|
107
|
+
- lib/mumukit/platform/organization/settings.rb
|
108
|
+
- lib/mumukit/platform/organization/theme.rb
|
90
109
|
- lib/mumukit/platform/organization_mapping.rb
|
91
110
|
- lib/mumukit/platform/uri.rb
|
92
111
|
- lib/mumukit/platform/version.rb
|