cm-admin 0.1.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 (34) hide show
  1. checksums.yaml +7 -0
  2. data/CODE_OF_CONDUCT.md +74 -0
  3. data/Gemfile +4 -0
  4. data/README.md +66 -0
  5. data/Rakefile +6 -0
  6. data/bin/console +13 -0
  7. data/bin/setup +8 -0
  8. data/cm_admin.gemspec +44 -0
  9. data/lib/.DS_Store +0 -0
  10. data/lib/cm_admin.rb +6 -0
  11. data/lib/cm_admin/version.rb +3 -0
  12. data/lib/generators/cm_admin/USAGE +8 -0
  13. data/lib/generators/cm_admin/install_generator.rb +28 -0
  14. data/lib/generators/cm_admin/templates/assets/images/same-logo.png +0 -0
  15. data/lib/generators/cm_admin/templates/assets/stylesheets/_variable.scss +11 -0
  16. data/lib/generators/cm_admin/templates/assets/stylesheets/alignment.scss +111 -0
  17. data/lib/generators/cm_admin/templates/assets/stylesheets/application.css.scss +30 -0
  18. data/lib/generators/cm_admin/templates/assets/stylesheets/devise.scss +98 -0
  19. data/lib/generators/cm_admin/templates/assets/stylesheets/form.scss +131 -0
  20. data/lib/generators/cm_admin/templates/assets/stylesheets/products.scss +21 -0
  21. data/lib/generators/cm_admin/templates/assets/stylesheets/scaffold.scss +241 -0
  22. data/lib/generators/cm_admin/templates/assets/stylesheets/table.scss +90 -0
  23. data/lib/generators/cm_admin/templates/assets/stylesheets/user.scss +25 -0
  24. data/lib/generators/cm_admin/templates/layouts/_navbar.html.slim +9 -0
  25. data/lib/generators/cm_admin/templates/layouts/_side_navbar.html.slim +16 -0
  26. data/lib/generators/cm_admin/templates/layouts/application.html.slim +25 -0
  27. data/lib/generators/cm_admin/templates/layouts/initializer.rb +2 -0
  28. data/lib/generators/cm_admin/templates/views/_filters.html.slim +0 -0
  29. data/lib/generators/cm_admin/templates/views/_form.erb +38 -0
  30. data/lib/generators/cm_admin/templates/views/_table.erb +14 -0
  31. data/lib/generators/cm_admin/templates/views/index.erb +11 -0
  32. data/lib/generators/cm_admin/templates/views/show.erb +8 -0
  33. data/lib/generators/cm_admin/view_generator.rb +57 -0
  34. metadata +117 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f72a2d04ff945602246fef73d1d261915da0aa6ad1f7948fccac7ccbc9d5405b
4
+ data.tar.gz: 3b4c483d404aca09b19fae04979afb1a0e13522a67624e8513c86d9f231e63c6
5
+ SHA512:
6
+ metadata.gz: 643aeabbb0a12109c48dd69fdc93c746939b89d75efa5bc44b7cbe9aa110d5e41676659ee53c7b752449a2ccca5a82a870efe029b1c7eed86f75469cb0dfb540
7
+ data.tar.gz: a0cc12c6c5b664e7cd9fdc14cc084708a6b6f1bd5692bd7f8202d7b26d7f6a46b95fc6cee0b84f91d1c7b493e31450eeae335650d99782fbac8fe8a82daf7ac5
@@ -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 ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in cm_coupon.gemspec
4
+ gemspec
@@ -0,0 +1,66 @@
1
+ # CmAdmin
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/cm_admin`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ First create a new rails project with the following command. If you are adding to existing project skip this
6
+
7
+ ```
8
+ rails new blog -m https://raw.githubusercontent.com/commutatus/cm-rails-template/devise_integration/template.rb
9
+ ```
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'cm_admin'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install cm_admin
26
+
27
+ Assuming we have a model created already or we can create one
28
+
29
+ $ rails g user first_name:string last_name:string
30
+
31
+
32
+ ## Usage
33
+
34
+ For copying layout such as CSS and the layout files
35
+
36
+ $ rails g cm_admin:install
37
+
38
+ For generating the index page views
39
+
40
+ $ rails g cm_admin:view products index title description
41
+
42
+ For generating the show page views
43
+
44
+ $ rails g cm_admin:view products show title description
45
+
46
+ For generating the index page views
47
+
48
+ $ rails g cm_admin:view products form title:string description:string
49
+
50
+ ## Development
51
+
52
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
53
+
54
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
55
+
56
+ ## Contributing
57
+
58
+ Bug reports and pull requests are welcome on GitHub at https://github.com/commutatus/cm-admin. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
59
+
60
+ ## License
61
+
62
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
63
+
64
+ ## Code of Conduct
65
+
66
+ Everyone interacting in the CmAdmin project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/cm-admin/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+
5
+ # You can add fixtures and/or initialization code here to make experimenting
6
+ # with your gem easier. You can also use a different console, if you like.
7
+
8
+ # (If you use this, don't forget to add pry to your Gemfile!)
9
+ # require "pry"
10
+ # Pry.start
11
+
12
+ require "irb"
13
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,44 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "cm_admin/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "cm-admin"
8
+ spec.version = CmAdmin::VERSION
9
+ spec.date = '2020-05-08'
10
+ spec.authors = ["Anbazhagan Palani"]
11
+ spec.email = ["anbu@commutatus.com"]
12
+
13
+ spec.summary = "Setup basic requied components for admin management."
14
+ spec.homepage = "https://github.com/commutatus/cm-admin"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
18
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ end
20
+
21
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
22
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
23
+ # if spec.respond_to?(:metadata)
24
+ # spec.metadata["allowed_push_host"] = "Set to 'http://mygemserver.com'"
25
+ #
26
+ # spec.metadata["homepage_uri"] = spec.homepage
27
+ # spec.metadata["source_code_uri"] = "Put your gem's public repo URL here."
28
+ # spec.metadata["changelog_uri"] = "Put your gem's CHANGELOG.md URL here."
29
+ # else
30
+ # raise "RubyGems 2.0 or newer is required to protect against " \
31
+ # "public gem pushes."
32
+ # end
33
+
34
+ # Specify which files should be added to the gem when it is released.
35
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
36
+
37
+ # spec.bindir = "exe"
38
+ # spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
39
+ # spec.require_paths = ["lib"]
40
+
41
+ spec.add_development_dependency "bundler", "~> 2.0"
42
+ spec.add_development_dependency "rake", "~> 10.0"
43
+ spec.add_development_dependency "rspec", "~> 3.0"
44
+ end
Binary file
@@ -0,0 +1,6 @@
1
+ require "cm_admin/version"
2
+
3
+ module CmAdmin
4
+ class Error < StandardError; end
5
+ # Your code goes here...
6
+ end
@@ -0,0 +1,3 @@
1
+ module CmAdmin
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ rails generate cm_admin Thing
6
+
7
+ This will create:
8
+ what/will/it/create
@@ -0,0 +1,28 @@
1
+ module CmAdmin
2
+ class InstallGenerator < Rails::Generators::Base
3
+ source_root File.expand_path('templates', __dir__)
4
+
5
+ desc <<-DESC.strip_heredoc
6
+ Generates layout for the entire admin panel
7
+
8
+ For example:
9
+ rails g cm_admin:install
10
+
11
+ It copies the respectively layout files and the necessary asset files.
12
+
13
+ DESC
14
+
15
+ def copy_layout_file
16
+ copy_file "layouts/_side_navbar.html.slim", "app/views/layouts/_side_navbar.html.slim"
17
+ copy_file "layouts/_navbar.html.slim", "app/views/layouts/_navbar.html.slim"
18
+ remove_file "app/views/layouts/application.html.erb"
19
+ copy_file "layouts/application.html.slim", "app/views/layouts/application.html.slim"
20
+ end
21
+
22
+ def copy_asset_file
23
+ copy_file "assets/images/same-logo.png", "app/assets/images/same-logo.png"
24
+ directory "assets/stylesheets/", "app/assets/stylesheets/"
25
+ remove_file "app/assets/stylesheets/application.css"
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,11 @@
1
+ $background: #1A1D1F;
2
+ $nav-btn-color: #FFCB05;
3
+ $nav-text-color: white;
4
+ $sidebar-background: #242536;
5
+ $main-background: #F6F8FA;
6
+ $table-background: #ffffff;
7
+ $heading-color: rgb(224, 193, 14);
8
+ $form-control-background: rgba(50,50,50,0.6) !important;
9
+ $nav-active-border: 4px solid #FFCB05;
10
+ $active-bg: #000000;
11
+ $paginate-btn-color: rgb(180, 149, 23);
@@ -0,0 +1,111 @@
1
+ @import '_variable.scss';
2
+
3
+ /*padding css*/
4
+ @for $i from 1 to 39 {
5
+ .p-#{$i} {
6
+ padding: #{$i}px !important;
7
+ }
8
+ .pb-#{$i} {
9
+ padding-bottom: #{$i}px !important;
10
+ }
11
+ .pt-#{$i} {
12
+ padding-top: #{$i}px !important;
13
+ }
14
+ }
15
+
16
+
17
+
18
+ @for $i from 1 to 21 {
19
+ .pr-#{$i*2} {
20
+ padding-right: #{$i*2}px !important;
21
+ }
22
+ .pl-#{$i*2} {
23
+ padding-left: #{$i*2}px !important;
24
+ }
25
+ }
26
+
27
+ /*margin css*/
28
+ .m-auto {
29
+ margin: auto;
30
+ }
31
+
32
+ /*margin css*/
33
+ /*margin top css*/
34
+ .mt-10 {
35
+ margin-top: 10px;
36
+ }
37
+ .mt-20 {
38
+ margin-top: 20px;
39
+ }
40
+ .mt-50 {
41
+ margin-top: 50px;
42
+ }
43
+
44
+ /*margin css*/
45
+ /*margin bottom css*/
46
+ .mb-10 {
47
+ margin-bottom: 20px;
48
+ }
49
+ .mb-24 {
50
+ margin-bottom: 24px;
51
+ }
52
+
53
+ /*margin css*/
54
+ /*margin right css*/
55
+ .mr-10 {
56
+ margin-right: 10px;
57
+ }
58
+ .mr-20 {
59
+ margin-right: 20px;
60
+ }
61
+
62
+ /*margin css*/
63
+ /*margin left css*/
64
+ .ml-10 {
65
+ margin-left: 10px;
66
+ }
67
+ .ml-20 {
68
+ margin-left: 20px;
69
+ }
70
+ .ml-35 {
71
+ margin-left: 35px;
72
+ }
73
+
74
+
75
+ /*alignment css*/
76
+ .align-right {
77
+ text-align: right;
78
+ }
79
+ .align-center {
80
+ text-align: center !important;
81
+ }
82
+ .align-left {
83
+ text-align: left;
84
+ }
85
+
86
+ /*width css*/
87
+ /*width css in pixel*/
88
+ .w-120 {
89
+ width: 120px;
90
+ }
91
+ .w-130 {
92
+ width: 130px;
93
+ }
94
+ .w-160 {
95
+ width: 160px;
96
+ }
97
+ .w-400 {
98
+ width: 400px;
99
+ }
100
+ .w-500 {
101
+ width: 500px;
102
+ }
103
+ .w-600 {
104
+ width: 600px;
105
+ }
106
+
107
+ /*width css*/
108
+ /*width css in %*/
109
+ .w100 {
110
+ width: 100% !important;
111
+ }
@@ -0,0 +1,30 @@
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, or any plugin's
6
+ * 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_tree .
14
+ *= require_self
15
+ *= require font-awesome
16
+ *= require 'select2'
17
+ *= require bootstrap/dist/css/bootstrap
18
+ */
19
+
20
+ .error-color {
21
+ color: red;
22
+ }
23
+
24
+ .select2.select2-container {
25
+ width: 100% !important;
26
+ }
27
+
28
+ .select2-selection {
29
+ height: 40px !important;
30
+ }