plug 0.1.16 → 0.1.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +32 -10
- data/app/assets/javascripts/plug/application.js +5 -0
- data/app/assets/javascripts/plug/trix-core.js +12 -0
- data/app/assets/stylesheets/plug/application.scss +2 -0
- data/app/assets/stylesheets/plug/blocks/_state.scss +4 -2
- data/app/assets/stylesheets/plug/milligram.scss +632 -599
- data/app/assets/stylesheets/plug/trix-overrides.scss +8 -0
- data/app/assets/stylesheets/plug/trix.scss +374 -0
- data/app/controllers/plug/api/features_controller.rb +21 -0
- data/app/controllers/plug/application_controller.rb +2 -0
- data/app/controllers/plug/features_controller.rb +2 -5
- data/app/models/plug/resources/feature.rb +15 -0
- data/app/models/plug/resources/site_notice.rb +0 -2
- data/app/models/plug/site_notice.rb +0 -1
- data/app/services/plug/task_execution_service.rb +18 -0
- data/app/views/plug/features/index.html.haml +6 -6
- data/app/views/plug/shared/_head.html.haml +1 -1
- data/app/views/plug/shared/_nav.html.haml +1 -1
- data/app/views/plug/site_notices/_form.html.haml +3 -2
- data/app/views/plug/site_notices/index.html.haml +7 -7
- data/config/routes.rb +2 -0
- data/db/migrate/20171207020316_create_plug_features.rb +1 -1
- data/db/migrate/20180128202026_add_notice_to_plug_features.rb +1 -1
- data/db/migrate/20180403024712_create_plug_site_notices.rb +1 -1
- data/lib/generators/plug/templates/plug.rb +1 -0
- data/lib/plug/version.rb +1 -1
- metadata +9 -5
- data/app/models/plug/concerns/themeable.rb +0 -16
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rake'
|
2
|
+
|
3
|
+
module Plug
|
4
|
+
class TaskExecutionService
|
5
|
+
attr_reader :name
|
6
|
+
|
7
|
+
def initialize(name: nil)
|
8
|
+
raise 'Task name is required' if name.nil?
|
9
|
+
|
10
|
+
@name = name
|
11
|
+
end
|
12
|
+
|
13
|
+
def call
|
14
|
+
Rails.application.load_tasks
|
15
|
+
Rake::Task[name].execute
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -19,10 +19,10 @@
|
|
19
19
|
%table
|
20
20
|
%thead
|
21
21
|
%tr
|
22
|
-
%th Name
|
22
|
+
%th{ width: 200 } Name
|
23
23
|
%th Description
|
24
|
-
%th Slug
|
25
|
-
%th State
|
24
|
+
%th{ width: 200 } Slug
|
25
|
+
%th{ width: 150, align: 'center' } State
|
26
26
|
|
27
27
|
- if Plug.allow_delete
|
28
28
|
%th Actions
|
@@ -33,11 +33,11 @@
|
|
33
33
|
%td= link_to feature.name, edit_feature_path(feature), class: 'strong'
|
34
34
|
%td= feature.description
|
35
35
|
%td= feature.slug
|
36
|
-
%td
|
36
|
+
%td{ width: 150, align: 'center' }
|
37
37
|
- if feature.state == 'enabled'
|
38
|
-
%i.fas.fa-check-circle.fa-2x.
|
38
|
+
%i.fas.fa-check-circle.fa-2x.state.state--enabled
|
39
39
|
- else
|
40
|
-
%i.fas.fa-times-circle.fa-2x.
|
40
|
+
%i.fas.fa-times-circle.fa-2x.state.state--disabled
|
41
41
|
|
42
42
|
- if Plug.allow_delete
|
43
43
|
%td= link_to 'Destroy', feature, method: :delete, data: { confirm: 'Are you sure?' }
|
@@ -11,13 +11,14 @@
|
|
11
11
|
= f.text_field :name
|
12
12
|
.field
|
13
13
|
= f.label :notice
|
14
|
-
= f.
|
14
|
+
= f.hidden_field :notice
|
15
|
+
%trix-editor{ input: 'site_notice_notice' }
|
15
16
|
.field
|
16
17
|
= f.label :state
|
17
18
|
= f.select :state, ['enabled', 'disabled']
|
18
19
|
.field
|
19
20
|
= f.label :theme
|
20
|
-
= f.select :theme, Plug.themes
|
21
|
+
= f.select :theme, Plug.themes
|
21
22
|
.actions.clearfix
|
22
23
|
.float-left
|
23
24
|
= link_to 'Back', site_notices_path, class: 'button'
|
@@ -15,10 +15,10 @@
|
|
15
15
|
%table
|
16
16
|
%thead
|
17
17
|
%tr
|
18
|
-
%th Name
|
18
|
+
%th{ width: 200 } Name
|
19
19
|
%th Notice
|
20
|
-
%th Slug
|
21
|
-
%th State
|
20
|
+
%th{ width: 200 } Slug
|
21
|
+
%th{ width: 150, align: 'center' } State
|
22
22
|
|
23
23
|
- if Plug.allow_delete
|
24
24
|
%th Actions
|
@@ -27,13 +27,13 @@
|
|
27
27
|
- @site_notices.each do |site_notice|
|
28
28
|
%tr
|
29
29
|
%td= link_to site_notice.name, edit_site_notice_path(site_notice), class: 'strong'
|
30
|
-
%td= site_notice.notice
|
30
|
+
%td= site_notice.notice.html_safe
|
31
31
|
%td= site_notice.slug
|
32
|
-
%td
|
32
|
+
%td{ width: 150, align: 'center' }
|
33
33
|
- if site_notice.state == 'enabled'
|
34
|
-
%i.fas.fa-check-circle.fa-2x.
|
34
|
+
%i.fas.fa-check-circle.fa-2x.state.state--enabled
|
35
35
|
- else
|
36
|
-
%i.fas.fa-times-circle.fa-2x.
|
36
|
+
%i.fas.fa-times-circle.fa-2x.state.state--disabled
|
37
37
|
|
38
38
|
- if Plug.allow_delete
|
39
39
|
%td= link_to 'Destroy', site_notice, method: :delete, data: { confirm: 'Are you sure?' }
|
data/config/routes.rb
CHANGED
@@ -10,6 +10,8 @@ Plug::Engine.routes.draw do
|
|
10
10
|
namespace :api, defaults: { format: :json } do
|
11
11
|
get '/site_notices/:slug', to: 'site_notices#show'
|
12
12
|
get '/site_notices', to: 'site_notices#index'
|
13
|
+
get '/features/:slug', to: 'features#show'
|
14
|
+
get '/features', to: 'features#index'
|
13
15
|
end
|
14
16
|
|
15
17
|
post '/task', to: 'features#task_execution', as: :task_execution
|
data/lib/plug/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plug
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-02-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -208,6 +208,7 @@ files:
|
|
208
208
|
- app/assets/images/favicon.png
|
209
209
|
- app/assets/javascripts/plug/application.js
|
210
210
|
- app/assets/javascripts/plug/features.js
|
211
|
+
- app/assets/javascripts/plug/trix-core.js
|
211
212
|
- app/assets/stylesheets/plug/_settings.scss
|
212
213
|
- app/assets/stylesheets/plug/application.scss
|
213
214
|
- app/assets/stylesheets/plug/blocks/_alert.scss
|
@@ -222,9 +223,12 @@ files:
|
|
222
223
|
- app/assets/stylesheets/plug/normalize.scss
|
223
224
|
- app/assets/stylesheets/plug/partials/_main.scss
|
224
225
|
- app/assets/stylesheets/plug/partials/_utils.scss
|
226
|
+
- app/assets/stylesheets/plug/trix-overrides.scss
|
227
|
+
- app/assets/stylesheets/plug/trix.scss
|
225
228
|
- app/assets/stylesheets/plug/variables/_colors.scss
|
226
229
|
- app/assets/stylesheets/plug/variables/_typography.scss
|
227
230
|
- app/controllers/plug/api/api_controller.rb
|
231
|
+
- app/controllers/plug/api/features_controller.rb
|
228
232
|
- app/controllers/plug/api/site_notices_controller.rb
|
229
233
|
- app/controllers/plug/application_controller.rb
|
230
234
|
- app/controllers/plug/features_controller.rb
|
@@ -233,10 +237,11 @@ files:
|
|
233
237
|
- app/mailers/plug/application_mailer.rb
|
234
238
|
- app/models/plug/application_record.rb
|
235
239
|
- app/models/plug/concerns/model_helpers.rb
|
236
|
-
- app/models/plug/concerns/themeable.rb
|
237
240
|
- app/models/plug/feature.rb
|
241
|
+
- app/models/plug/resources/feature.rb
|
238
242
|
- app/models/plug/resources/site_notice.rb
|
239
243
|
- app/models/plug/site_notice.rb
|
244
|
+
- app/services/plug/task_execution_service.rb
|
240
245
|
- app/views/layouts/plug/application.html.haml
|
241
246
|
- app/views/plug/features/_form.html.haml
|
242
247
|
- app/views/plug/features/_task.html.haml
|
@@ -281,8 +286,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
281
286
|
- !ruby/object:Gem::Version
|
282
287
|
version: '0'
|
283
288
|
requirements: []
|
284
|
-
|
285
|
-
rubygems_version: 2.5.1
|
289
|
+
rubygems_version: 3.0.3
|
286
290
|
signing_key:
|
287
291
|
specification_version: 4
|
288
292
|
summary: Rails engine that can plug/unplug features
|