plug 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +22 -0
- data/app/assets/config/plug_manifest.js +2 -0
- data/app/assets/javascripts/plug/application.js +15 -0
- data/app/assets/javascripts/plug/features.js +2 -0
- data/app/assets/stylesheets/plug/_settings.scss +865 -0
- data/app/assets/stylesheets/plug/application.scss +35 -0
- data/app/assets/stylesheets/plug/blocks/_nav.scss +6 -0
- data/app/assets/stylesheets/plug/blocks/_plugs.scss +17 -0
- data/app/assets/stylesheets/plug/features.scss +3 -0
- data/app/assets/stylesheets/plug/foundation_and_overrides.scss +59 -0
- data/app/assets/stylesheets/plug/mixins/_bem.scss +17 -0
- data/app/assets/stylesheets/plug/partials/_main.scss +3 -0
- data/app/assets/stylesheets/plug/partials/_utils.scss +3 -0
- data/app/assets/stylesheets/plug/scaffolds.scss +84 -0
- data/app/assets/stylesheets/plug/variables/_colors.scss +5 -0
- data/app/assets/stylesheets/scaffolds.scss +84 -0
- data/app/controllers/plug/application_controller.rb +5 -0
- data/app/controllers/plug/features_controller.rb +71 -0
- data/app/helpers/plug/application_helper.rb +4 -0
- data/app/jobs/plug/application_job.rb +4 -0
- data/app/mailers/plug/application_mailer.rb +6 -0
- data/app/models/plug/application_record.rb +5 -0
- data/app/models/plug/feature.rb +30 -0
- data/app/views/layouts/plug/application.html.haml +11 -0
- data/app/views/plug/features/_form.html.haml +19 -0
- data/app/views/plug/features/edit.html.haml +7 -0
- data/app/views/plug/features/index.html.haml +27 -0
- data/app/views/plug/features/new.html.haml +5 -0
- data/app/views/plug/features/show.html.haml +18 -0
- data/app/views/plug/shared/_head.html.haml +8 -0
- data/app/views/plug/shared/_nav.html.haml +6 -0
- data/config/routes.rb +5 -0
- data/db/migrate/20171207020316_create_plug_features.rb +15 -0
- data/lib/plug/engine.rb +14 -0
- data/lib/plug/version.rb +3 -0
- data/lib/plug.rb +13 -0
- data/lib/tasks/plug_tasks.rake +4 -0
- metadata +251 -0
@@ -0,0 +1,35 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_self
|
14
|
+
*/
|
15
|
+
|
16
|
+
@import 'scaffolds';
|
17
|
+
|
18
|
+
// Variables
|
19
|
+
@import 'variables/colors';
|
20
|
+
|
21
|
+
// Third-party
|
22
|
+
// If you need foundation and font-awesome, uncomment the line in gemspec
|
23
|
+
// @import 'foundation_and_overrides';
|
24
|
+
// @import 'font-awesome';
|
25
|
+
|
26
|
+
// Mixins
|
27
|
+
@import 'mixins/bem';
|
28
|
+
|
29
|
+
// Partials
|
30
|
+
@import 'partials/main';
|
31
|
+
@import 'partials/utils';
|
32
|
+
|
33
|
+
// Blocks
|
34
|
+
@import 'blocks/nav';
|
35
|
+
@import 'blocks/plugs';
|
@@ -0,0 +1,17 @@
|
|
1
|
+
.plugs {
|
2
|
+
margin-top: 2rem;
|
3
|
+
|
4
|
+
@include element('content') {
|
5
|
+
background: $white;
|
6
|
+
border: 1px solid $gallery;
|
7
|
+
|
8
|
+
@include element('item') {
|
9
|
+
padding: .5rem;
|
10
|
+
border-bottom: 1px solid $gallery;
|
11
|
+
|
12
|
+
&:last-of-type {
|
13
|
+
border-bottom: none;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
}
|
17
|
+
}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
@charset 'utf-8';
|
2
|
+
|
3
|
+
@import 'settings';
|
4
|
+
@import 'foundation';
|
5
|
+
|
6
|
+
// 1. Global
|
7
|
+
// ---------
|
8
|
+
$body-background: $alabaster;
|
9
|
+
|
10
|
+
// If you'd like to include motion-ui the foundation-rails gem comes prepackaged with it, uncomment the 3 @imports, if you are not using the gem you need to install the motion-ui sass package.
|
11
|
+
//
|
12
|
+
// @import 'motion-ui/motion-ui';
|
13
|
+
|
14
|
+
// We include everything by default. To slim your CSS, remove components you don't use.
|
15
|
+
|
16
|
+
@include foundation-global-styles;
|
17
|
+
// @include foundation-grid;
|
18
|
+
@include foundation-flex-classes;
|
19
|
+
@include foundation-flex-grid;
|
20
|
+
@include foundation-typography;
|
21
|
+
@include foundation-button;
|
22
|
+
@include foundation-forms;
|
23
|
+
@include foundation-visibility-classes;
|
24
|
+
@include foundation-float-classes;
|
25
|
+
// @include foundation-accordion;
|
26
|
+
// @include foundation-accordion-menu;
|
27
|
+
// @include foundation-badge;
|
28
|
+
// @include foundation-breadcrumbs;
|
29
|
+
@include foundation-button-group;
|
30
|
+
@include foundation-callout;
|
31
|
+
// @include foundation-card;
|
32
|
+
@include foundation-close-button;
|
33
|
+
// @include foundation-drilldown-menu;
|
34
|
+
// @include foundation-dropdown;
|
35
|
+
// @include foundation-dropdown-menu;
|
36
|
+
@include foundation-responsive-embed;
|
37
|
+
@include foundation-label;
|
38
|
+
// @include foundation-media-object;
|
39
|
+
// @include foundation-menu;
|
40
|
+
// @include foundation-menu-icon;
|
41
|
+
// @include foundation-off-canvas;
|
42
|
+
// @include foundation-orbit;
|
43
|
+
// @include foundation-pagination;
|
44
|
+
// @include foundation-progress-bar;
|
45
|
+
// @include foundation-slider;
|
46
|
+
// @include foundation-sticky;
|
47
|
+
@include foundation-reveal;
|
48
|
+
@include foundation-switch;
|
49
|
+
@include foundation-table;
|
50
|
+
// @include foundation-tabs;
|
51
|
+
@include foundation-thumbnail;
|
52
|
+
@include foundation-title-bar;
|
53
|
+
@include foundation-tooltip;
|
54
|
+
@include foundation-top-bar;
|
55
|
+
|
56
|
+
// If you'd like to include motion-ui the foundation-rails gem comes prepackaged with it, uncomment the 3 @imports, if you are not using the gem you need to install the motion-ui sass package.
|
57
|
+
//
|
58
|
+
// @include motion-ui-transitions;
|
59
|
+
// @include motion-ui-animations;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
/// Block Element
|
2
|
+
/// @access public
|
3
|
+
/// @param {String} $element - Element's name
|
4
|
+
@mixin element($element) {
|
5
|
+
&__#{$element} {
|
6
|
+
@content;
|
7
|
+
}
|
8
|
+
}
|
9
|
+
|
10
|
+
/// Block Modifier
|
11
|
+
/// @access public
|
12
|
+
/// @param {String} $modifier - Modifier's name
|
13
|
+
@mixin modifier($modifier) {
|
14
|
+
&--#{$modifier} {
|
15
|
+
@content;
|
16
|
+
}
|
17
|
+
}
|
@@ -0,0 +1,84 @@
|
|
1
|
+
body {
|
2
|
+
background-color: #fff;
|
3
|
+
color: #333;
|
4
|
+
margin: 33px;
|
5
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
6
|
+
font-size: 13px;
|
7
|
+
line-height: 18px;
|
8
|
+
}
|
9
|
+
|
10
|
+
p, ol, ul, td {
|
11
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
12
|
+
font-size: 13px;
|
13
|
+
line-height: 18px;
|
14
|
+
}
|
15
|
+
|
16
|
+
pre {
|
17
|
+
background-color: #eee;
|
18
|
+
padding: 10px;
|
19
|
+
font-size: 11px;
|
20
|
+
}
|
21
|
+
|
22
|
+
a {
|
23
|
+
color: #000;
|
24
|
+
|
25
|
+
&:visited {
|
26
|
+
color: #666;
|
27
|
+
}
|
28
|
+
|
29
|
+
&:hover {
|
30
|
+
color: #fff;
|
31
|
+
background-color: #000;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
th {
|
36
|
+
padding-bottom: 5px;
|
37
|
+
}
|
38
|
+
|
39
|
+
td {
|
40
|
+
padding: 0 5px 7px;
|
41
|
+
}
|
42
|
+
|
43
|
+
div {
|
44
|
+
&.field, &.actions {
|
45
|
+
margin-bottom: 10px;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
#notice {
|
50
|
+
color: green;
|
51
|
+
}
|
52
|
+
|
53
|
+
.field_with_errors {
|
54
|
+
padding: 2px;
|
55
|
+
background-color: red;
|
56
|
+
display: table;
|
57
|
+
}
|
58
|
+
|
59
|
+
#error_explanation {
|
60
|
+
width: 450px;
|
61
|
+
border: 2px solid red;
|
62
|
+
padding: 7px 7px 0;
|
63
|
+
margin-bottom: 20px;
|
64
|
+
background-color: #f0f0f0;
|
65
|
+
|
66
|
+
h2 {
|
67
|
+
text-align: left;
|
68
|
+
font-weight: bold;
|
69
|
+
padding: 5px 5px 5px 15px;
|
70
|
+
font-size: 12px;
|
71
|
+
margin: -7px -7px 0;
|
72
|
+
background-color: #c00;
|
73
|
+
color: #fff;
|
74
|
+
}
|
75
|
+
|
76
|
+
ul li {
|
77
|
+
font-size: 12px;
|
78
|
+
list-style: square;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
label {
|
83
|
+
display: block;
|
84
|
+
}
|
@@ -0,0 +1,84 @@
|
|
1
|
+
body {
|
2
|
+
background-color: #fff;
|
3
|
+
color: #333;
|
4
|
+
margin: 33px;
|
5
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
6
|
+
font-size: 13px;
|
7
|
+
line-height: 18px;
|
8
|
+
}
|
9
|
+
|
10
|
+
p, ol, ul, td {
|
11
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
12
|
+
font-size: 13px;
|
13
|
+
line-height: 18px;
|
14
|
+
}
|
15
|
+
|
16
|
+
pre {
|
17
|
+
background-color: #eee;
|
18
|
+
padding: 10px;
|
19
|
+
font-size: 11px;
|
20
|
+
}
|
21
|
+
|
22
|
+
a {
|
23
|
+
color: #000;
|
24
|
+
|
25
|
+
&:visited {
|
26
|
+
color: #666;
|
27
|
+
}
|
28
|
+
|
29
|
+
&:hover {
|
30
|
+
color: #fff;
|
31
|
+
background-color: #000;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
th {
|
36
|
+
padding-bottom: 5px;
|
37
|
+
}
|
38
|
+
|
39
|
+
td {
|
40
|
+
padding: 0 5px 7px;
|
41
|
+
}
|
42
|
+
|
43
|
+
div {
|
44
|
+
&.field, &.actions {
|
45
|
+
margin-bottom: 10px;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
#notice {
|
50
|
+
color: green;
|
51
|
+
}
|
52
|
+
|
53
|
+
.field_with_errors {
|
54
|
+
padding: 2px;
|
55
|
+
background-color: red;
|
56
|
+
display: table;
|
57
|
+
}
|
58
|
+
|
59
|
+
#error_explanation {
|
60
|
+
width: 450px;
|
61
|
+
border: 2px solid red;
|
62
|
+
padding: 7px 7px 0;
|
63
|
+
margin-bottom: 20px;
|
64
|
+
background-color: #f0f0f0;
|
65
|
+
|
66
|
+
h2 {
|
67
|
+
text-align: left;
|
68
|
+
font-weight: bold;
|
69
|
+
padding: 5px 5px 5px 15px;
|
70
|
+
font-size: 12px;
|
71
|
+
margin: -7px -7px 0;
|
72
|
+
background-color: #c00;
|
73
|
+
color: #fff;
|
74
|
+
}
|
75
|
+
|
76
|
+
ul li {
|
77
|
+
font-size: 12px;
|
78
|
+
list-style: square;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
label {
|
83
|
+
display: block;
|
84
|
+
}
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require_dependency 'plug/application_controller'
|
2
|
+
|
3
|
+
module Plug
|
4
|
+
class FeaturesController < ApplicationController
|
5
|
+
if Rails.version.to_i < 5
|
6
|
+
before_filter :set_feature, only: [:show, :edit, :update, :destroy]
|
7
|
+
else
|
8
|
+
before_action :set_feature, only: [:show, :edit, :update, :destroy]
|
9
|
+
end
|
10
|
+
|
11
|
+
# GET /features
|
12
|
+
def index
|
13
|
+
@features = Feature.all
|
14
|
+
end
|
15
|
+
|
16
|
+
# GET /features/1
|
17
|
+
def show
|
18
|
+
end
|
19
|
+
|
20
|
+
# GET /features/new
|
21
|
+
def new
|
22
|
+
@feature = Feature.new
|
23
|
+
end
|
24
|
+
|
25
|
+
# GET /features/1/edit
|
26
|
+
def edit
|
27
|
+
end
|
28
|
+
|
29
|
+
# POST /features
|
30
|
+
def create
|
31
|
+
@feature = Feature.new(feature_params)
|
32
|
+
|
33
|
+
if @feature.save
|
34
|
+
redirect_to @feature, notice: 'Feature was successfully created.'
|
35
|
+
else
|
36
|
+
render :new
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# PATCH/PUT /features/1
|
41
|
+
def update
|
42
|
+
if @feature.update_attributes(feature_params)
|
43
|
+
redirect_to @feature, notice: 'Feature was successfully updated.'
|
44
|
+
else
|
45
|
+
render :edit
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# DELETE /features/1
|
50
|
+
def destroy
|
51
|
+
@feature.destroy
|
52
|
+
redirect_to features_url, notice: 'Feature was successfully destroyed.'
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
# Use callbacks to share common setup or constraints between actions.
|
57
|
+
def set_feature
|
58
|
+
@feature = Feature.find(params[:id])
|
59
|
+
end
|
60
|
+
|
61
|
+
# Only allow a trusted parameter "white list" through.
|
62
|
+
# TODO: Strong params not available for older Rails
|
63
|
+
def feature_params
|
64
|
+
if Rails.version.to_i < 5
|
65
|
+
ActiveSupport::HashWithIndifferentAccess.new(params[:feature])
|
66
|
+
else
|
67
|
+
params.require(:feature).permit(:name, :description, :state)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Plug
|
2
|
+
class Feature < ApplicationRecord
|
3
|
+
include AASM
|
4
|
+
|
5
|
+
# Validations
|
6
|
+
validates :name, presence: { message: 'Feature name is required' },
|
7
|
+
uniqueness: { message: 'Feature name must be unique', case_sensitive: false }
|
8
|
+
validates :state, presence: { message: 'Feature state is required' }
|
9
|
+
|
10
|
+
# Callbacks
|
11
|
+
before_save { self.slug = name.parameterize }
|
12
|
+
|
13
|
+
# Scopes
|
14
|
+
scope :slug_and_name, ->(arg) { where('slug = ? OR name = ?', arg, arg) }
|
15
|
+
|
16
|
+
# States
|
17
|
+
aasm column: :state do
|
18
|
+
state :enabled, initial: true
|
19
|
+
state :disabled
|
20
|
+
|
21
|
+
event :enable do
|
22
|
+
transitions from: :disabled, to: :enabled
|
23
|
+
end
|
24
|
+
|
25
|
+
event :disable do
|
26
|
+
transitions from: :enabled, to: :disabled
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
= form_for @feature do |f|
|
2
|
+
- if @feature.errors.any?
|
3
|
+
#error_explanation
|
4
|
+
%h2= "#{pluralize(@feature.errors.count, "error")} prohibited this feature from being saved:"
|
5
|
+
%ul
|
6
|
+
- @feature.errors.full_messages.each do |message|
|
7
|
+
%li= message
|
8
|
+
|
9
|
+
.field
|
10
|
+
= f.label :name
|
11
|
+
= f.text_field :name
|
12
|
+
.field
|
13
|
+
= f.label :description
|
14
|
+
= f.text_area :description, rows: 5
|
15
|
+
.field
|
16
|
+
= f.label :state
|
17
|
+
= f.select :state, ['enabled', 'disabled']
|
18
|
+
.actions
|
19
|
+
= f.submit 'Save'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
%h1 Listing features
|
2
|
+
|
3
|
+
%table
|
4
|
+
%thead
|
5
|
+
%tr
|
6
|
+
%th Name
|
7
|
+
%th Description
|
8
|
+
%th Slug
|
9
|
+
%th State
|
10
|
+
%th
|
11
|
+
%th
|
12
|
+
%th
|
13
|
+
|
14
|
+
%tbody
|
15
|
+
- @features.each do |feature|
|
16
|
+
%tr
|
17
|
+
%td= feature.name
|
18
|
+
%td= feature.description
|
19
|
+
%td= feature.slug
|
20
|
+
%td= feature.state
|
21
|
+
%td= link_to 'Show', feature
|
22
|
+
%td= link_to 'Edit', edit_feature_path(feature)
|
23
|
+
%td= link_to 'Destroy', feature, method: :delete, data: { confirm: 'Are you sure?' }
|
24
|
+
|
25
|
+
%br
|
26
|
+
|
27
|
+
= link_to 'New Feature', new_feature_path
|
@@ -0,0 +1,18 @@
|
|
1
|
+
%p#notice= notice
|
2
|
+
|
3
|
+
%p
|
4
|
+
%b Name:
|
5
|
+
= @feature.name
|
6
|
+
%p
|
7
|
+
%b Description:
|
8
|
+
= @feature.description
|
9
|
+
%p
|
10
|
+
%b Slug:
|
11
|
+
= @feature.slug
|
12
|
+
%p
|
13
|
+
%b State:
|
14
|
+
= @feature.state
|
15
|
+
|
16
|
+
= link_to 'Edit', edit_feature_path(@feature)
|
17
|
+
\|
|
18
|
+
= link_to 'Back', features_path
|
data/config/routes.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreatePlugFeatures < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :plug_features do |t|
|
4
|
+
t.string :name
|
5
|
+
t.string :description
|
6
|
+
t.string :slug
|
7
|
+
t.string :state
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
|
12
|
+
add_index :plug_features, :name
|
13
|
+
add_index :plug_features, :slug
|
14
|
+
end
|
15
|
+
end
|
data/lib/plug/engine.rb
ADDED
data/lib/plug/version.rb
ADDED
data/lib/plug.rb
ADDED