cm-admin 0.3.0 → 0.4.0

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.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/CODE_OF_CONDUCT.md +74 -0
  3. data/Gemfile +1 -0
  4. data/Gemfile.lock +21 -20
  5. data/README.md +24 -1
  6. data/app/assets/stylesheets/cm_admin/base/auth.scss +0 -12
  7. data/app/assets/stylesheets/cm_admin/base/filters.scss +8 -7
  8. data/app/assets/stylesheets/cm_admin/base/form.scss +7 -72
  9. data/app/assets/stylesheets/cm_admin/base/navbar.scss +1 -3
  10. data/app/assets/stylesheets/cm_admin/base/quicksearch.scss +7 -0
  11. data/app/assets/stylesheets/cm_admin/base/scaffold.scss +38 -3
  12. data/app/assets/stylesheets/cm_admin/base/show.scss +24 -2
  13. data/app/assets/stylesheets/cm_admin/base/table.scss +270 -253
  14. data/app/assets/stylesheets/cm_admin/components/_dropdown-popup.scss +22 -10
  15. data/app/assets/stylesheets/cm_admin/components/_range.scss +13 -2
  16. data/app/assets/stylesheets/cm_admin/components/_status-tag.scss +2 -1
  17. data/app/assets/stylesheets/cm_admin/helpers/_variable.scss +1 -0
  18. data/app/controllers/cm_admin/application_controller.rb +5 -0
  19. data/app/controllers/cm_admin/exports_controller.rb +1 -1
  20. data/app/controllers/cm_admin/static_controller.rb +12 -0
  21. data/app/helpers/cm_admin/custom_helper.rb +4 -0
  22. data/app/javascript/packs/cm_admin/application.js +14 -1
  23. data/app/javascript/packs/cm_admin/filters.js +331 -16
  24. data/app/javascript/packs/cm_admin/quick_search.js +67 -0
  25. data/app/javascript/packs/cm_admin/scaffolds.js +30 -1
  26. data/app/javascript/stylesheets/cm_admin/application.scss +3 -0
  27. data/app/views/cm_admin/main/_associated_table.html.slim +60 -0
  28. data/app/views/cm_admin/main/_cm_pagy_nav.html.slim +6 -6
  29. data/app/views/cm_admin/main/_filters.html.slim +1 -10
  30. data/app/views/cm_admin/main/_nested_fields.html.slim +7 -0
  31. data/app/views/cm_admin/main/_nested_table_form.html.slim +6 -0
  32. data/app/views/cm_admin/main/_table.html.slim +5 -4
  33. data/app/views/cm_admin/main/_tabs.html.slim +5 -0
  34. data/app/views/cm_admin/main/_top_navbar.html.slim +4 -4
  35. data/app/views/cm_admin/main/associated_index.html.slim +6 -0
  36. data/app/views/cm_admin/main/associated_show.html.slim +6 -0
  37. data/app/views/cm_admin/main/index.html.slim +11 -8
  38. data/app/views/cm_admin/main/show.html.slim +12 -13
  39. data/app/views/cm_admin/static/error_401.html.slim +4 -0
  40. data/app/views/layouts/_left_sidebar_nav.html.slim +7 -3
  41. data/app/views/layouts/_quick_links.html.slim +25 -0
  42. data/app/views/layouts/cm_admin.html.slim +24 -1
  43. data/app/views/layouts/static.html.slim +18 -0
  44. data/bin/console +0 -1
  45. data/cm_admin.gemspec +1 -0
  46. data/config/routes.rb +2 -1
  47. data/config/webpack/environment.js +3 -2
  48. data/lib/.DS_Store +0 -0
  49. data/lib/cm_admin/model.rb +57 -167
  50. data/lib/cm_admin/models/action.rb +15 -1
  51. data/lib/cm_admin/models/cm_show_section.rb +20 -0
  52. data/lib/cm_admin/models/column.rb +49 -4
  53. data/lib/cm_admin/models/controller_method.rb +75 -0
  54. data/lib/cm_admin/models/dsl_method.rb +122 -0
  55. data/lib/cm_admin/models/export.rb +16 -5
  56. data/lib/cm_admin/models/field.rb +2 -1
  57. data/lib/cm_admin/models/filter.rb +67 -2
  58. data/lib/cm_admin/models/form_field.rb +21 -0
  59. data/lib/cm_admin/models/tab.rb +13 -0
  60. data/lib/cm_admin/version.rb +1 -1
  61. data/lib/cm_admin/view_helpers/column_field_helper.rb +29 -0
  62. data/lib/cm_admin/view_helpers/field_display_helper.rb +65 -0
  63. data/lib/cm_admin/view_helpers/filter_helper.rb +190 -0
  64. data/lib/cm_admin/view_helpers/form_field_helper.rb +21 -4
  65. data/lib/cm_admin/view_helpers/form_helper.rb +22 -12
  66. data/lib/cm_admin/view_helpers/manage_column_popup_helper.rb +75 -0
  67. data/lib/cm_admin/view_helpers/navigation_helper.rb +22 -6
  68. data/lib/cm_admin/view_helpers/page_info_helper.rb +36 -0
  69. data/lib/cm_admin/view_helpers.rb +3 -1
  70. data/lib/cm_admin.rb +3 -1
  71. data/lib/generators/cm_admin/install_generator.rb +20 -8
  72. data/package.json +6 -1
  73. data/tmp/cache/webpacker/last-compilation-digest-development +1 -0
  74. data/yarn.lock +35 -5
  75. metadata +41 -7
  76. data/app/controllers/cm_admin/main_controller.rb +0 -8
  77. data/lib/c.png +0 -0
  78. data/lib/cm_admin/view_helpers/field_column_helper.rb +0 -23
  79. data/lib/generators/cm_admin/templates/cm_admin_initializer.rb +0 -4
  80. data/yarn-error.log +0 -44
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35f20e9b85e2ad48730aed1d0f2a9ad1a56d03c951969b85270f74b00990f725
4
- data.tar.gz: 03533bffdcf8d85c46c39d50ef1f011200526e6d5d6b937e82ddfd350d1a2a48
3
+ metadata.gz: 4751c0c816c7922c19331fe581c1467f10c242774e249694842047c41eba4daa
4
+ data.tar.gz: 59913c7529b4f127be8b382fac481b5c7216a919bf217127f288edaf7ba9dd3d
5
5
  SHA512:
6
- metadata.gz: bf6a9cecd5793c32dd963973bd1196413f8c997918501934afd5c8cebf2738565e57876e76afef4a5b3e7b0c4f4d71d3ebf20ea0d291524f2c56f08013781429
7
- data.tar.gz: 287eab8c29339f326b6e70b5255b62d2762eb9439866e879f2454458273a8a38fb55e345f1a11fb9a695a86f5da282c8b3d5a792618bb444550d8af7074d1728
6
+ metadata.gz: 2505314ada96c9d5b481a4738d1e1cba269894da087c51f334bd4b7b0ba904f9e8a2cc1c76524876c7190bef6ec86a029e52d7542d2d5054c73760666b18f813
7
+ data.tar.gz: c0e2d471d76c7c1372491a809dd7a6c962531f02674376e8dcb004f2ca50953f0d5b0cdb253e214bb68d1e94a909a85e3075f8e249ecc60808a7cb57428f8078
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at charithsaivadla@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile CHANGED
@@ -4,6 +4,7 @@ gem 'pagy'
4
4
  gem 'slim'
5
5
  gem "rake", "~> 12.0"
6
6
  gem "rspec", "~> 3.0"
7
+ gem 'cocoon'
7
8
 
8
9
  # Specify your gem's dependencies in cm_admin.gemspec
9
10
  gemspec
data/Gemfile.lock CHANGED
@@ -1,8 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cm_admin (0.1.0)
4
+ cm-admin (0.4.0)
5
5
  axlsx_rails (~> 0.6.1)
6
+ cocoon (~> 1.2.15)
6
7
  pagy (~> 3.13)
7
8
  slim (~> 4.1.0)
8
9
  webpacker (~> 5.2.1)
@@ -10,20 +11,20 @@ PATH
10
11
  GEM
11
12
  remote: https://rubygems.org/
12
13
  specs:
13
- actionpack (6.1.3.2)
14
- actionview (= 6.1.3.2)
15
- activesupport (= 6.1.3.2)
14
+ actionpack (6.1.4.1)
15
+ actionview (= 6.1.4.1)
16
+ activesupport (= 6.1.4.1)
16
17
  rack (~> 2.0, >= 2.0.9)
17
18
  rack-test (>= 0.6.3)
18
19
  rails-dom-testing (~> 2.0)
19
20
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
20
- actionview (6.1.3.2)
21
- activesupport (= 6.1.3.2)
21
+ actionview (6.1.4.1)
22
+ activesupport (= 6.1.4.1)
22
23
  builder (~> 3.1)
23
24
  erubi (~> 1.4)
24
25
  rails-dom-testing (~> 2.0)
25
26
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
26
- activesupport (6.1.3.2)
27
+ activesupport (6.1.4.1)
27
28
  concurrent-ruby (~> 1.0, >= 1.0.2)
28
29
  i18n (>= 1.6, < 2)
29
30
  minitest (>= 5.1)
@@ -38,6 +39,7 @@ GEM
38
39
  marcel (~> 1.0)
39
40
  nokogiri (~> 1.10, >= 1.10.4)
40
41
  rubyzip (>= 1.3.0, < 3)
42
+ cocoon (1.2.15)
41
43
  concurrent-ruby (1.1.9)
42
44
  crass (1.0.6)
43
45
  diff-lcs (1.4.4)
@@ -45,17 +47,15 @@ GEM
45
47
  htmlentities (4.3.4)
46
48
  i18n (1.8.10)
47
49
  concurrent-ruby (~> 1.0)
48
- loofah (2.10.0)
50
+ loofah (2.12.0)
49
51
  crass (~> 1.0.2)
50
52
  nokogiri (>= 1.5.9)
51
53
  marcel (1.0.1)
52
54
  method_source (1.0.0)
53
- mini_portile2 (2.5.3)
54
55
  minitest (5.14.4)
55
- nokogiri (1.11.7)
56
- mini_portile2 (~> 2.5.0)
56
+ nokogiri (1.12.4-x86_64-darwin)
57
57
  racc (~> 1.4)
58
- pagy (3.13.0)
58
+ pagy (3.14.0)
59
59
  racc (1.5.2)
60
60
  rack (2.2.3)
61
61
  rack-proxy (0.7.0)
@@ -65,13 +65,13 @@ GEM
65
65
  rails-dom-testing (2.0.3)
66
66
  activesupport (>= 4.2.0)
67
67
  nokogiri (>= 1.6)
68
- rails-html-sanitizer (1.3.0)
68
+ rails-html-sanitizer (1.4.2)
69
69
  loofah (~> 2.3)
70
- railties (6.1.3.2)
71
- actionpack (= 6.1.3.2)
72
- activesupport (= 6.1.3.2)
70
+ railties (6.1.4.1)
71
+ actionpack (= 6.1.4.1)
72
+ activesupport (= 6.1.4.1)
73
73
  method_source
74
- rake (>= 0.8.7)
74
+ rake (>= 0.13)
75
75
  thor (~> 1.0)
76
76
  rake (12.3.3)
77
77
  rspec (3.10.0)
@@ -87,7 +87,7 @@ GEM
87
87
  diff-lcs (>= 1.2.0, < 2.0)
88
88
  rspec-support (~> 3.10.0)
89
89
  rspec-support (3.10.2)
90
- rubyzip (2.3.0)
90
+ rubyzip (2.3.2)
91
91
  semantic_range (3.0.0)
92
92
  slim (4.1.0)
93
93
  temple (>= 0.7.6, < 0.9)
@@ -108,11 +108,12 @@ PLATFORMS
108
108
  ruby
109
109
 
110
110
  DEPENDENCIES
111
- cm_admin!
111
+ cm-admin!
112
+ cocoon
112
113
  pagy
113
114
  rake (~> 12.0)
114
115
  rspec (~> 3.0)
115
116
  slim
116
117
 
117
118
  BUNDLED WITH
118
- 2.1.4
119
+ 2.2.17
data/README.md CHANGED
@@ -24,7 +24,30 @@ Install the gem
24
24
 
25
25
  $ rails g cm_admin:install
26
26
 
27
- This will generate an initializer which contains the basic setup. This also includes a layout called `admin` which can be used in the application.
27
+ For generating the index page views
28
+
29
+ $ rails g cm_admin:view products index title description
30
+
31
+ For generating the show page views
32
+
33
+ $ rails g cm_admin:view products show title description
34
+
35
+ For generating the form page views
36
+ $ rails g cm_admin:view products form column_name:field_type
37
+ $ rails g cm_admin:view products form title:string description:string
38
+
39
+ Following field types are acceted
40
+
41
+ * input-integer
42
+ * input-string
43
+ * single-select
44
+ * multi-select
45
+ * checkbox
46
+ * radio
47
+
48
+ ## Usage
49
+
50
+ For demo check [here](http://cm-admin.labs.commutatus.com/admin/users/)
28
51
 
29
52
  ## Development
30
53
 
@@ -42,18 +42,6 @@
42
42
 
43
43
  .get-start-btn {
44
44
  width: 100%;
45
- padding: 8px;
46
- @include font($size: $t4-text, $color: $white);
47
- background: linear-gradient(to right, $brand-color 50%, transparent 50%);
48
- background-size: 200% 100%;
49
- background-position: right bottom;
50
- border: 1px solid $white;
51
- border-radius: $radius-4;
52
- @include transition-linear;
53
- &:hover {
54
- background-position: left bottom;
55
- border-color: $brand-color;
56
- }
57
45
  }
58
46
 
59
47
  .forgot-password {
@@ -1,10 +1,6 @@
1
1
  @import "../helpers/index.scss";
2
2
 
3
3
  .cm-filters-v2 {
4
- position: fixed;
5
- top: 140px;
6
- left: 225px;
7
- width: calc(100% - 225px);
8
4
  min-height: 64px;
9
5
  padding: 16px 24px;
10
6
  background-color: $white;
@@ -13,7 +9,7 @@
13
9
  @include flex(row, flex-start, center, wrap);
14
10
  .filter-chips-wrapper {
15
11
  .filter-chip {
16
- margin-left: 16px
12
+ margin-left: 16px;
17
13
  }
18
14
  }
19
15
  .add-filter-btn {
@@ -21,13 +17,15 @@
21
17
  line-height: 22px;
22
18
  font-weight: 600;
23
19
  color: $primary-text-clr;
24
- margin-left: 16px;
25
20
  cursor: pointer;
26
21
  span {
27
22
  margin-right: 4px;
28
23
  }
24
+ &:hover {
25
+ color: $brand-color;
26
+ }
29
27
  }
30
- .clear-btn {
28
+ .clear-btn {
31
29
  position: relative;
32
30
  font-size: $t4-text;
33
31
  line-height: 22px;
@@ -43,6 +41,9 @@
43
41
  height: 32px;
44
42
  border-left: 1px solid $grey-regular-clr;
45
43
  }
44
+ &:hover {
45
+ color: $primary-text-clr;
46
+ }
46
47
  }
47
48
  }
48
49
  }
@@ -72,8 +72,8 @@
72
72
  }
73
73
  }
74
74
 
75
- .custom-form {
76
- max-width: 700px;
75
+ .cm-admin-form {
76
+ max-width: 600px;
77
77
  .form-field {
78
78
  margin-bottom: 20px;
79
79
  .form-label {
@@ -99,70 +99,6 @@
99
99
  }
100
100
  }
101
101
 
102
- .form-select {
103
- //select2 styles
104
- .select2 {
105
- width: 100% !important;
106
- .selection {
107
- //single-select-styles
108
- .select2-selection--single {
109
- height: 39px;
110
- border: 1px solid #c1c7d0;
111
- border-radius: $radius-2;
112
- &:focus {
113
- border-color: #66afe9;
114
- outline: 0;
115
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
116
- }
117
- .select2-selection__rendered {
118
- color: #555555;
119
- line-height: 36px;
120
- .select2-search--inline {
121
- .select2-search__field {
122
- height: 26px !important;
123
- }
124
- }
125
- }
126
- .select2-selection__arrow {
127
- top: 7px;
128
- b {
129
- border-color: #0099ff transparent transparent transparent;
130
- }
131
- }
132
- }
133
- //multi-select-styles
134
- .select2-selection--multiple {
135
- max-height: 39px;
136
- border: 1px solid #c1c7d0;
137
- border-radius: $radius-2;
138
- overflow-y: auto;
139
- .select2-selection__rendered {
140
- .select2-search--inline {
141
- .select2-search__field {
142
- height: 26px !important;
143
- border: none;
144
- }
145
- }
146
- }
147
- }
148
- }
149
- }
150
-
151
- //single-select-arrow-styles
152
- .select2-container--open {
153
- .selection {
154
- .select2-selection--single {
155
- .select2-selection__arrow {
156
- top: 7px;
157
- b {
158
- border-color: transparent transparent #0099ff transparent;
159
- }
160
- }
161
- }
162
- }
163
- }
164
- }
165
-
166
102
  .file-upload {
167
103
  position: relative;
168
104
  display: flex;
@@ -182,8 +118,7 @@
182
118
  opacity: 0;
183
119
  cursor: pointer;
184
120
  }
185
- span {
186
- text-align: center;
121
+ label {
187
122
  color: #0099ff;
188
123
  margin: 0;
189
124
  cursor: pointer;
@@ -196,15 +131,15 @@
196
131
 
197
132
  .radio-label {
198
133
  color: #172b4d;
199
- font-size: size(16);
200
- font-weight: weight(bold);
134
+ font-size: 16px;
135
+ font-weight: 600;
201
136
  margin-left: 8px;
202
137
  }
203
138
 
204
139
  .checkbox-label {
205
140
  color: #172b4d;
206
- font-size: size(16);
207
- font-weight: weight(bold);
141
+ font-size: 16px;
142
+ font-weight: 600;
208
143
  margin-left: 8px;
209
144
  }
210
145
  }
@@ -1,14 +1,12 @@
1
1
  @import "../helpers/index.scss";
2
2
 
3
3
  .cm-navbar {
4
- position: fixed;
5
4
  top: 0;
6
5
  right: 0;
7
6
  left: 225px;
8
7
  display: flex;
9
8
  justify-content: space-between;
10
- width: calc(100% - 225px);
11
- height: 140px;
9
+ min-height: 140px;
12
10
  padding: 24px 24px 16px;
13
11
  background-color: $white;
14
12
  z-index: 2;
@@ -66,4 +66,11 @@
66
66
  padding: 0;
67
67
  }
68
68
  }
69
+ .active-item {
70
+ background: #D9DEE3;
71
+ width: 100%;
72
+ height: 40px;
73
+ float: left;
74
+ border-radius: 2px;
75
+ }
69
76
  }
@@ -1,5 +1,9 @@
1
1
  @import "../helpers/index.scss";
2
2
 
3
+ html {
4
+ overflow: hidden;
5
+ }
6
+
3
7
  body {
4
8
  box-sizing: border-box;
5
9
  width: 100%;
@@ -18,8 +22,6 @@ body {
18
22
  .panel-area {
19
23
  width: calc(100% - 225px);
20
24
  margin-left: 225px;
21
- overflow-y: auto;
22
- overflow-x: hidden;
23
25
  }
24
26
 
25
27
  .components {
@@ -58,4 +60,37 @@ a {
58
60
 
59
61
  .opacity-1 {
60
62
  opacity: 1 !important;
61
- }
63
+ }
64
+
65
+ .page-container {
66
+ height: 100vh;
67
+ }
68
+
69
+ .sticky-container {
70
+ position: sticky;
71
+ top: 0;
72
+ background-color: #fff;
73
+ z-index: 1;
74
+ }
75
+
76
+ .scrollable {
77
+ overflow: auto;
78
+ }
79
+
80
+ .datetime-wrapper {
81
+ position: relative;
82
+ }
83
+
84
+ .cm-admin-static {
85
+ width: auto;
86
+ text-align: center;
87
+ padding: 0 15px;
88
+ }
89
+
90
+ .date-filter-wrapper {
91
+ position: absolute;
92
+ line-height: 28px;
93
+ top: 0;
94
+ opacity: 0;
95
+ z-index: -1;
96
+ }