anchor_ui-core 5.2.0.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.
Files changed (34) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +52 -0
  3. data/Rakefile +17 -0
  4. data/lib/anchor_ui/core.rb +10 -0
  5. data/lib/anchor_ui/core/assets/base.rb +40 -0
  6. data/lib/anchor_ui/core/assets/concerns/core_ui.rb +71 -0
  7. data/lib/anchor_ui/core/assets/concerns/zip.rb +35 -0
  8. data/lib/anchor_ui/core/errors.rb +13 -0
  9. data/lib/anchor_ui/core/generators/concerns/core.rb +22 -0
  10. data/lib/anchor_ui/core/generators/concerns/install.rb +32 -0
  11. data/lib/anchor_ui/core/http.rb +35 -0
  12. data/lib/anchor_ui/core/railtie.rb +23 -0
  13. data/lib/anchor_ui/core/test/app.rb +5 -0
  14. data/lib/anchor_ui/core/test/concerns/core_ui.rb +42 -0
  15. data/lib/anchor_ui/core/test/concerns/download.rb +25 -0
  16. data/lib/anchor_ui/core/test/concerns/update.rb +28 -0
  17. data/lib/anchor_ui/core/test/concerns/zip.rb +30 -0
  18. data/lib/anchor_ui/core/test/gem.rb +6 -0
  19. data/lib/anchor_ui/core/test/helper.rb +57 -0
  20. data/lib/anchor_ui/core/test/javascript.rb +26 -0
  21. data/lib/anchor_ui/core/version.rb +7 -0
  22. data/lib/anchor_ui/core/zip.rb +20 -0
  23. data/lib/generators/anchor_ui/core/templates/install/application.html.erb +18 -0
  24. data/lib/generators/rails/templates/erb/nested_scaffold/_form.html.erb +48 -0
  25. data/lib/generators/rails/templates/erb/nested_scaffold/edit.html.erb +6 -0
  26. data/lib/generators/rails/templates/erb/nested_scaffold/index.html.erb +42 -0
  27. data/lib/generators/rails/templates/erb/nested_scaffold/new.html.erb +5 -0
  28. data/lib/generators/rails/templates/erb/nested_scaffold/show.html.erb +29 -0
  29. data/lib/generators/rails/templates/erb/scaffold/_form.html.erb +48 -0
  30. data/lib/generators/rails/templates/erb/scaffold/edit.html.erb +6 -0
  31. data/lib/generators/rails/templates/erb/scaffold/index.html.erb +42 -0
  32. data/lib/generators/rails/templates/erb/scaffold/new.html.erb +5 -0
  33. data/lib/generators/rails/templates/erb/scaffold/show.html.erb +29 -0
  34. metadata +146 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e499160cd5ebb2430f14262be916bbb0a6dc2112ea85bf6c4194ade3f6d4476a
4
+ data.tar.gz: e26ff1014c3041b9de3219af5ead18f14c8bb46e47a070375d84a51f35ae3f38
5
+ SHA512:
6
+ metadata.gz: 80ec8566643ec557162341c6e495c271668f785608ee308e7954efd681ee076d5bfb7e98564d4076edb271da694cbba8b6f5dd80a70a592aaaf1c2ebcabbe92a
7
+ data.tar.gz: 3c1ca09269e3fbd6448bcbe32bd8ca0f5a6e8e36e2b24f9dc4f77ba488a640a544dfca11acaf307723d5d2125af6b3cf30824014f0273d42d41dd3a255ce7f95
data/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # AnchorUI - Core
2
+
3
+ Add [CoreUI](https://coreui.io/index.html) to Rails 5 projects and the asset pipeline.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'anchor_ui-core'
11
+ ```
12
+
13
+ And then execute:
14
+ ```bash
15
+ $ bundle
16
+ ```
17
+
18
+ Or install it yourself as:
19
+ ```bash
20
+ $ gem install anchor_ui-core
21
+ ```
22
+
23
+ ## Development
24
+
25
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run
26
+ `rake test` to run the tests. You can also run `bin/console` for an interactive
27
+ prompt that will allow you to experiment.
28
+
29
+ To install this gem onto your local machine, run `bundle exec rake install`. To
30
+ release a new version, update the version number in `version.rb`, and then run
31
+ `bundle exec rake release`, which will create a git tag for the version, push
32
+ git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
33
+
34
+ ## Test
35
+
36
+ To execute the test suite run `bin/test` to reference test script from the bin
37
+ folder of the project.
38
+
39
+ ## Contributing
40
+
41
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/anchor_ui.
42
+ This project is intended to be a safe, welcoming space for collaboration, and
43
+ contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
44
+
45
+ ## License
46
+
47
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
48
+
49
+ ## Code of Conduct
50
+
51
+ Everyone interacting in the AnchorUI project’s codebases, issue trackers, chat
52
+ rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/anchor_ui/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,17 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'bundler/gem_tasks'
8
+ require 'rake/testtask'
9
+
10
+ Rake::TestTask.new(:test) do |t|
11
+ t.libs << 'test'
12
+ t.pattern = 'test/**/*_test.rb'
13
+ t.verbose = false
14
+ t.warning = false
15
+ end
16
+
17
+ task default: :test
@@ -0,0 +1,10 @@
1
+ require 'rails/generators'
2
+ require 'anchor_ui/core/errors'
3
+ require 'anchor_ui/core/http'
4
+ require 'anchor_ui/core/railtie'
5
+ require 'anchor_ui/core/zip'
6
+ require 'anchor_ui/core/assets/concerns/core_ui'
7
+ require 'anchor_ui/core/assets/concerns/zip'
8
+ require 'anchor_ui/core/assets/base'
9
+ require 'anchor_ui/core/generators/concerns/core'
10
+ require 'anchor_ui/core/generators/concerns/install'
@@ -0,0 +1,40 @@
1
+ module AnchorUi
2
+ module Core
3
+ module Assets
4
+ class Base
5
+
6
+ attr_reader :version
7
+
8
+ def initialize(version, tmp_path=nil)
9
+ @version = version
10
+ if tmp_path
11
+ @tmp_path = Pathname.new(tmp_path)
12
+ end
13
+ end
14
+
15
+ private
16
+
17
+ def tmp_path
18
+ @tmp_path || root_path.join('tmp')
19
+ end
20
+
21
+ def read_scss(relative_path, newline: true)
22
+ scss_path = stylesheets_source_path.join(relative_path)
23
+ scss = File.read(scss_path, universal_newline: true)
24
+ if newline
25
+ "#{scss}\n"
26
+ else
27
+ scss
28
+ end
29
+ end
30
+
31
+ def download(url, path)
32
+ content = Http.read(url)
33
+ FileUtils.mkdir_p path.dirname
34
+ File.write path, content
35
+ end
36
+
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,71 @@
1
+ module AnchorUi
2
+ module Core
3
+ module Assets
4
+ module Concerns
5
+ module CoreUi
6
+ extend ActiveSupport::Concern
7
+
8
+ private
9
+
10
+ def javascripts_relative_path
11
+ 'dist/js'
12
+ end
13
+
14
+ def stylesheets_relative_path
15
+ 'scss'
16
+ end
17
+
18
+ def coreui_scss_path
19
+ templates_path.join '_coreui.scss'
20
+ end
21
+
22
+ def compile_coreui_scss(prefix, prepend=nil)
23
+ original_scss = read_scss('coreui.scss')
24
+ imports = original_scss.scan(
25
+ /\@import\ (.+)\;/
26
+ ).flatten.map do |name|
27
+ name.gsub '"', ''
28
+ end
29
+ imports.reject! do |name|
30
+ name.match? /^(node_modules|variables)/
31
+ end
32
+ scss = "@import\n"
33
+ imports.map! do |name|
34
+ " '#{prefix}/#{name}'"
35
+ end
36
+ if prepend
37
+ imports.prepend " '#{prepend}'"
38
+ end
39
+ scss << imports.join(",\n")
40
+ scss << ";\n";
41
+ File.write coreui_scss_path, scss
42
+ end
43
+
44
+ def variables_scss_path
45
+ templates_path.join '_variables.scss'
46
+ end
47
+
48
+ def compile_variables_scss(imports=nil, append=nil)
49
+ scss = ''
50
+ %w(
51
+ variables/_colors.scss
52
+ variables/bootstrap/_variables.scss
53
+ ).each do |relative_path|
54
+ scss << read_scss(relative_path)
55
+ end
56
+ if imports
57
+ scss << imports
58
+ end
59
+ scss << read_scss('_variables.scss', newline: false)
60
+ scss.gsub! /(\/\/.+\n(\@import.+\n\n?)+)/, ''
61
+ if append
62
+ scss << append
63
+ end
64
+ File.write variables_scss_path, scss
65
+ end
66
+
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,35 @@
1
+ module AnchorUi
2
+ module Core
3
+ module Assets
4
+ module Concerns
5
+ module Zip
6
+ extend ActiveSupport::Concern
7
+
8
+ private
9
+
10
+ def directory_name
11
+ "#{asset_name}-#{version}"
12
+ end
13
+
14
+ def unzip
15
+ AnchorUi::Core::Zip.unzip zip_path, tmp_path
16
+ end
17
+
18
+ def clear
19
+ FileUtils.rm_rf zip_path
20
+ FileUtils.rm_rf extraction_path
21
+ end
22
+
23
+ def extraction_path
24
+ tmp_path.join directory_name
25
+ end
26
+
27
+ def zip_path
28
+ tmp_path.join zip_name
29
+ end
30
+
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,13 @@
1
+ module AnchorUi
2
+ module Core
3
+ module Errors
4
+
5
+ class AssetInvalid < StandardError
6
+ end
7
+
8
+ class UrlInvalid < StandardError
9
+ end
10
+
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,22 @@
1
+ module AnchorUi
2
+ module Core
3
+ module Generators
4
+ module Concerns
5
+ module Core
6
+ extend ActiveSupport::Concern
7
+
8
+ private
9
+
10
+ def core_spec
11
+ Gem::Specification.find_by_name 'anchor_ui-core'
12
+ end
13
+
14
+ def core_path
15
+ Pathname.new "#{core_spec.gem_dir}"
16
+ end
17
+
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,32 @@
1
+ module AnchorUi
2
+ module Core
3
+ module Generators
4
+ module Concerns
5
+ module Install
6
+ include Core
7
+
8
+ private
9
+
10
+ def generate_layout(javascript_type, stylesheet_type, stylesheet_name)
11
+ template(
12
+ application_template_path,
13
+ application_layout_relative_path,
14
+ javascript_type: javascript_type,
15
+ stylesheet_type: stylesheet_type,
16
+ stylesheet_name: stylesheet_name
17
+ )
18
+ end
19
+
20
+ def application_template_path
21
+ core_path.join 'lib/generators/anchor_ui/core/templates/install/application.html.erb'
22
+ end
23
+
24
+ def application_layout_relative_path
25
+ 'app/views/layouts/application.html.erb'
26
+ end
27
+
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,35 @@
1
+ module AnchorUi
2
+ module Core
3
+ module Http
4
+ class << self
5
+
6
+ def read(url)
7
+ process get(url)
8
+ end
9
+
10
+ private
11
+
12
+ def get(url)
13
+ uri = URI.parse(url)
14
+ http = Net::HTTP.new(uri.host, uri.port)
15
+ if uri.port == 443
16
+ http.use_ssl = true
17
+ end
18
+ http.get uri.path
19
+ end
20
+
21
+ def process(response)
22
+ case response.code[0]
23
+ when '2'
24
+ response.body.force_encoding 'UTF-8'
25
+ when '3'
26
+ read response['location']
27
+ else
28
+ raise Errors::UrlInvalid
29
+ end
30
+ end
31
+
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,23 @@
1
+ module AnchorUi
2
+ module Core
3
+ class Railtie < Rails::Railtie
4
+
5
+ initializer 'anchor_ui/core.scaffold' do
6
+ # Rails bug? Prepended template path configuration ignored, paths must to be harcoded...
7
+
8
+ require 'rails/generators/erb/scaffold/scaffold_generator'
9
+ class Erb::Generators::ScaffoldGenerator
10
+ extend AnchorUi::Core::Generators::Concerns::Core
11
+ source_root core_path.join('lib/generators/rails/templates/erb/scaffold')
12
+ end
13
+
14
+ require 'generators/erb/erb_generator'
15
+ class NestedScaffold::Generators::ErbGenerator
16
+ extend AnchorUi::Core::Generators::Concerns::Core
17
+ source_root core_path.join('lib/generators/rails/templates/erb/nested_scaffold')
18
+ end
19
+ end
20
+
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,5 @@
1
+ ROOT_PATH = Rails.root
2
+ FIXTURES_PATH = ROOT_PATH.join('test/fixtures')
3
+ TMP_PATH = ROOT_PATH.join('tmp')
4
+
5
+ require_relative 'helper'
@@ -0,0 +1,42 @@
1
+ module AnchorUi
2
+ module Core
3
+ module Test
4
+ module Concerns
5
+ module CoreUi
6
+ extend ActiveSupport::Concern
7
+
8
+ private
9
+
10
+ def version
11
+ '2.1.1'
12
+ end
13
+
14
+ %w(variables coreui).each do |name|
15
+ class_eval <<~RUBY, __FILE__, __LINE__
16
+ def #{name}_name
17
+ '_#{name}.scss'
18
+ end
19
+
20
+ def #{name}_scss_path
21
+ templates_path.join #{name}_name
22
+ end
23
+
24
+ def #{name}_scss
25
+ File.read #{name}_scss_path
26
+ end
27
+
28
+ def fixture_#{name}_scss_path
29
+ FIXTURES_PATH.join #{name}_name
30
+ end
31
+
32
+ def fixture_#{name}_scss
33
+ File.read fixture_#{name}_scss_path
34
+ end
35
+ RUBY
36
+ end
37
+
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,25 @@
1
+ module AnchorUi
2
+ module Core
3
+ module Test
4
+ module Concerns
5
+ module Download
6
+ extend ActiveSupport::Concern
7
+
8
+ private
9
+
10
+ def download(*args)
11
+ self.class.downloads << args
12
+ end
13
+
14
+ class_methods do
15
+
16
+ def downloads
17
+ @downloads ||= []
18
+ end
19
+
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,28 @@
1
+ module AnchorUi
2
+ module Core
3
+ module Test
4
+ module Concerns
5
+ module Update
6
+ extend ActiveSupport::Concern
7
+
8
+ def assert_download(url, path)
9
+ assert_includes klass.downloads, [url, path]
10
+ end
11
+
12
+ def update(*args)
13
+ # Using `system` will create a subshell, so will be impossible to mock downloads
14
+ ARGV.clear
15
+ args.each do |arg|
16
+ ARGV << arg
17
+ end
18
+ ARGV << TMP_PATH.to_s
19
+ quiet do
20
+ load ROOT_PATH.join('bin/update')
21
+ end
22
+ end
23
+
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,30 @@
1
+ module AnchorUi
2
+ module Core
3
+ module Test
4
+ module Concerns
5
+ module Zip
6
+ extend ActiveSupport::Concern
7
+
8
+ private
9
+
10
+ def zip_path
11
+ TMP_PATH.join zip_name
12
+ end
13
+
14
+ def extraction_path
15
+ TMP_PATH.join directory_name
16
+ end
17
+
18
+ def fixture_extraction_path
19
+ FIXTURES_PATH.join directory_name
20
+ end
21
+
22
+ def fixture_zip_path
23
+ FIXTURES_PATH.join zip_name
24
+ end
25
+
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,6 @@
1
+ TEST_PATH = Rails.root.parent
2
+ FIXTURES_PATH = TEST_PATH.join('fixtures')
3
+ ROOT_PATH = TEST_PATH.parent
4
+ TMP_PATH = ROOT_PATH.join('tmp')
5
+
6
+ require_relative 'helper'
@@ -0,0 +1,57 @@
1
+ require 'minitest/mock'
2
+ require 'selenium/webdriver'
3
+ require 'anchor_ui/core/test/concerns/core_ui'
4
+ require 'anchor_ui/core/test/concerns/zip'
5
+ require 'anchor_ui/core/test/concerns/download'
6
+ require 'anchor_ui/core/test/concerns/update'
7
+ require 'anchor_ui/core/test/javascript'
8
+
9
+ Capybara.server = [:puma, Silent: true]
10
+ Capybara.ignore_hidden_elements = false
11
+ ActionDispatch::SystemTestCase.driven_by :selenium, using: :headless_chrome
12
+
13
+ Rails::Generators::TestCase.destination TMP_PATH
14
+
15
+ class ActiveSupport::TestCase
16
+
17
+ teardown do
18
+ FileUtils.rm_rf TMP_PATH
19
+ end
20
+
21
+ private
22
+
23
+ def assert_dir(path)
24
+ assert Dir.exists?(path)
25
+ end
26
+
27
+ def refute_dir(path)
28
+ refute Dir.exists?(path)
29
+ end
30
+
31
+ def mock
32
+ Minitest::Mock.new
33
+ end
34
+
35
+ def quiet
36
+ begin
37
+ original_stderr = $stderr.clone
38
+ original_stdout = $stdout.clone
39
+ $stderr.reopen File::NULL
40
+ $stdout.reopen File::NULL
41
+ output = yield
42
+ rescue Exception => e
43
+ $stdout.reopen original_stdout
44
+ $stderr.reopen original_stderr
45
+ raise e
46
+ ensure
47
+ $stdout.reopen original_stdout
48
+ $stderr.reopen original_stderr
49
+ end
50
+ output
51
+ end
52
+
53
+ def fixtures_path
54
+ FIXTURES_PATH
55
+ end
56
+
57
+ end
@@ -0,0 +1,26 @@
1
+ module AnchorUi
2
+ module Core
3
+ module Test
4
+ class Javascript < ActionDispatch::SystemTestCase
5
+
6
+ private
7
+
8
+ def refute_root_runtime_errors
9
+ visit root_path
10
+ refute_runtime_errors
11
+ end
12
+
13
+ def refute_runtime_errors
14
+ wait
15
+ errors = page.driver.browser.manage.logs.get(:browser)
16
+ refute errors.any?
17
+ end
18
+
19
+ def wait
20
+ sleep 1
21
+ end
22
+
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,7 @@
1
+ module AnchorUi
2
+ module Core
3
+
4
+ VERSION = '5.2.0.1'
5
+
6
+ end
7
+ end
@@ -0,0 +1,20 @@
1
+ module AnchorUi
2
+ module Core
3
+ module Zip
4
+ class << self
5
+
6
+ def unzip(zip_path, destination_path)
7
+ FileUtils.mkdir_p destination_path
8
+ ::Zip::File.open(zip_path) do |zip|
9
+ zip.each do |file|
10
+ file_path = destination_path.join(file.name)
11
+ FileUtils.mkdir_p file_path.dirname
12
+ zip.extract file, file_path
13
+ end
14
+ end
15
+ end
16
+
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,18 @@
1
+ <!DOCTYPE html>
2
+ <html lang="<%%= I18n.locale %>">
3
+ <head>
4
+ <title></title>
5
+ <%%= csrf_meta_tags %>
6
+ <%%= csp_meta_tag %>
7
+ <meta charset="utf-8">
8
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
9
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
10
+ <%%= stylesheet_<%= config[:stylesheet_type] %>_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
11
+ <%%= javascript_<%= config[:javascript_type] %>_tag 'application', 'data-turbolinks-track': 'reload' %>
12
+ </head>
13
+ <body class="app">
14
+ <div class="container">
15
+ <%%= yield %>
16
+ </div>
17
+ </body>
18
+ </html>
@@ -0,0 +1,48 @@
1
+ <div class="card">
2
+ <%%= form_for([@<%= singular_table_name %>.<%= nested_parent_name %>, @<%= singular_table_name %>]) do |form| %>
3
+ <div class="card-header">
4
+ <strong><%%= content_for :title %></strong>
5
+ </div>
6
+ <div class="card-body">
7
+ <%% <%= singular_table_name %>.errors.full_messages.each do |message| %>
8
+ <div class="alert alert-warning alert-dismissible fade show" role="alert">
9
+ <%%= message %>
10
+ <button class="close" type="button" data-dismiss="alert" aria-label="Close">
11
+ <span aria-hidden="true">×</span>
12
+ </button>
13
+ </div>
14
+ <%% end %>
15
+ <%- attributes.each do |attribute| -%>
16
+ <div class="form-group row">
17
+ <%- if attribute.password_digest? -%>
18
+ <div class="col-md-2">
19
+ <%%= form.label :password, class: 'col-form-label' %>
20
+ </div>
21
+ <div class="col-md-10">
22
+ <%%= form.password_field :password, class: 'form-control' %>
23
+ </div>
24
+ </div>
25
+ <div class="form-group row">
26
+ <div class="col-md-2">
27
+ <%%= form.label :password_confirmation, class: 'col-form-label' %>
28
+ </div>
29
+ <div class="col-md-10">
30
+ <%%= form.password_field :password_confirmation, class: 'form-control' %>
31
+ </div>
32
+ <%- else -%>
33
+ <div class="col-md-2">
34
+ <%%= form.label :<%= attribute.column_name %>, class: 'col-form-label' %>
35
+ </div>
36
+ <div class="col-md-10">
37
+ <%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, class: 'form-control' %>
38
+ </div>
39
+ <%- end -%>
40
+ </div>
41
+ <%- end -%>
42
+ </div>
43
+ <div class="card-footer">
44
+ <%%= form.submit class: 'btn btn-sm btn-primary' %>
45
+ <%%= content_for :actions %>
46
+ </div>
47
+ <%% end %>
48
+ </div>
@@ -0,0 +1,6 @@
1
+ <%% content_for :title, 'Editing <%= singular_table_name.titleize %>' %>
2
+ <%% content_for :actions do %>
3
+ <%%= link_to 'Show', [@<%= singular_table_name %>.<%= nested_parent_name %>, @<%= singular_table_name %>], class: 'btn btn-sm btn-secondary' %>
4
+ <%%= link_to 'Back', <%= nested_parent_name %>_<%= index_helper %>_path(@<%= singular_table_name %>.<%= nested_parent_name %>), class: 'btn btn-sm btn-secondary' %>
5
+ <%% end %>
6
+ <%%= render 'form' %>
@@ -0,0 +1,42 @@
1
+ <div class="card">
2
+ <div class="card-header">
3
+ <strong><%= plural_table_name.titleize %></strong>
4
+ </div>
5
+ <div class="card-body">
6
+ <%% if notice %>
7
+ <div class="alert alert-success alert-dismissible fade show" role="alert">
8
+ <%%= notice %>
9
+ <button class="close" type="button" data-dismiss="alert" aria-label="Close">
10
+ <span aria-hidden="true">×</span>
11
+ </button>
12
+ </div>
13
+ <%% end %>
14
+ <table class="table table-responsive-sm">
15
+ <thead>
16
+ <tr>
17
+ <%- attributes.reject(&:password_digest?).each do |attribute| -%>
18
+ <th><%= attribute.human_name %></th>
19
+ <%- end -%>
20
+ <th></th>
21
+ </tr>
22
+ </thead>
23
+ <tbody>
24
+ <%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
25
+ <tr>
26
+ <%- attributes.reject(&:password_digest?).each do |attribute| -%>
27
+ <td><%%= <%= singular_table_name %>.<%= attribute.name %> %></td>
28
+ <%- end -%>
29
+ <td>
30
+ <%%= link_to 'Show', [<%= singular_table_name %>.<%= nested_parent_name %>, <%= singular_table_name %>], class: 'btn btn-sm btn-secondary' %>
31
+ <%%= link_to 'Edit', edit_<%= nested_parent_name %>_<%= singular_table_name %>_path(<%= singular_table_name %>.<%= nested_parent_name %>, <%= singular_table_name %>), class: 'btn btn-sm btn-secondary' %>
32
+ <%%= link_to 'Destroy', [<%= singular_table_name %>.<%= nested_parent_name %>, <%= singular_table_name %>], method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-sm btn-secondary' %>
33
+ </td>
34
+ </tr>
35
+ <%% end %>
36
+ </tbody>
37
+ </table>
38
+ </div>
39
+ <div class="card-footer">
40
+ <%%= link_to 'New <%= singular_table_name.titleize %>', new_<%= nested_parent_name %>_<%= singular_table_name %>_path(params[:<%= nested_parent_name %>_id]), class: 'btn btn-sm btn-primary' %>
41
+ </div>
42
+ </div>
@@ -0,0 +1,5 @@
1
+ <%% content_for :title, 'New <%= singular_table_name.titleize %>' %>
2
+ <%% content_for :actions do %>
3
+ <%%= link_to 'Back', <%= nested_parent_name %>_<%= index_helper %>_path(@<%= singular_table_name %>.<%= nested_parent_name %>), class: 'btn btn-sm btn-secondary' %>
4
+ <%% end %>
5
+ <%%= render 'form' %>
@@ -0,0 +1,29 @@
1
+ <div class="card">
2
+ <div class="card-header">
3
+ <strong>Show <%= singular_table_name.titleize %></strong>
4
+ </div>
5
+ <div class="card-body">
6
+ <%% if notice %>
7
+ <div class="alert alert-success alert-dismissible fade show" role="alert">
8
+ <%%= notice %>
9
+ <button class="close" type="button" data-dismiss="alert" aria-label="Close">
10
+ <span aria-hidden="true">×</span>
11
+ </button>
12
+ </div>
13
+ <%% end %>
14
+ <%- attributes.reject(&:password_digest?).each do |attribute| -%>
15
+ <div class="form-group row">
16
+ <div class="col-md-2">
17
+ <strong><%= attribute.human_name %>:</strong>
18
+ </div>
19
+ <div class="col-md-10">
20
+ <%%= @<%= singular_table_name %>.<%= attribute.name %> %>
21
+ </div>
22
+ </div>
23
+ <%- end -%>
24
+ </div>
25
+ <div class="card-footer">
26
+ <%%= link_to 'Edit', edit_<%= nested_parent_name %>_<%= singular_table_name %>_path(@<%= singular_table_name %>.<%= nested_parent_name %>, @<%= singular_table_name %>), class: 'btn btn-sm btn-primary' %>
27
+ <%%= link_to 'Back', <%= nested_parent_name %>_<%= index_helper %>_path(@<%= singular_table_name %>.<%= nested_parent_name %>), class: 'btn btn-sm btn-secondary' %>
28
+ </div>
29
+ </div>
@@ -0,0 +1,48 @@
1
+ <div class="card">
2
+ <%%= form_with(model: <%= model_resource_name %>, local: true) do |form| %>
3
+ <div class="card-header">
4
+ <strong><%%= content_for :title %></strong>
5
+ </div>
6
+ <div class="card-body">
7
+ <%% <%= singular_table_name %>.errors.full_messages.each do |message| %>
8
+ <div class="alert alert-warning alert-dismissible fade show" role="alert">
9
+ <%%= message %>
10
+ <button class="close" type="button" data-dismiss="alert" aria-label="Close">
11
+ <span aria-hidden="true">×</span>
12
+ </button>
13
+ </div>
14
+ <%% end %>
15
+ <%- attributes.each do |attribute| -%>
16
+ <div class="form-group row">
17
+ <%- if attribute.password_digest? -%>
18
+ <div class="col-md-2">
19
+ <%%= form.label :password, class: 'col-form-label' %>
20
+ </div>
21
+ <div class="col-md-10">
22
+ <%%= form.password_field :password, class: 'form-control' %>
23
+ </div>
24
+ </div>
25
+ <div class="form-group row">
26
+ <div class="col-md-2">
27
+ <%%= form.label :password_confirmation, class: 'col-form-label' %>
28
+ </div>
29
+ <div class="col-md-10">
30
+ <%%= form.password_field :password_confirmation, class: 'form-control' %>
31
+ </div>
32
+ <%- else -%>
33
+ <div class="col-md-2">
34
+ <%%= form.label :<%= attribute.column_name %>, class: 'col-form-label' %>
35
+ </div>
36
+ <div class="col-md-10">
37
+ <%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, class: 'form-control' %>
38
+ </div>
39
+ <%- end -%>
40
+ </div>
41
+ <%- end -%>
42
+ </div>
43
+ <div class="card-footer">
44
+ <%%= form.submit class: 'btn btn-sm btn-primary' %>
45
+ <%%= content_for :actions %>
46
+ </div>
47
+ <%% end %>
48
+ </div>
@@ -0,0 +1,6 @@
1
+ <%% content_for :title, 'Editing <%= singular_table_name.titleize %>' %>
2
+ <%% content_for :actions do %>
3
+ <%%= link_to 'Show', @<%= singular_table_name %>, class: 'btn btn-sm btn-secondary' %>
4
+ <%%= link_to 'Back', <%= index_helper %>_path, class: 'btn btn-sm btn-secondary' %>
5
+ <%% end %>
6
+ <%%= render 'form', <%= singular_table_name %>: @<%= singular_table_name %> %>
@@ -0,0 +1,42 @@
1
+ <div class="card">
2
+ <div class="card-header">
3
+ <strong><%= plural_table_name.titleize %></strong>
4
+ </div>
5
+ <div class="card-body">
6
+ <%% if notice %>
7
+ <div class="alert alert-success alert-dismissible fade show" role="alert">
8
+ <%%= notice %>
9
+ <button class="close" type="button" data-dismiss="alert" aria-label="Close">
10
+ <span aria-hidden="true">×</span>
11
+ </button>
12
+ </div>
13
+ <%% end %>
14
+ <table class="table table-responsive-sm">
15
+ <thead>
16
+ <tr>
17
+ <%- attributes.reject(&:password_digest?).each do |attribute| -%>
18
+ <th><%= attribute.human_name %></th>
19
+ <%- end -%>
20
+ <th></th>
21
+ </tr>
22
+ </thead>
23
+ <tbody>
24
+ <%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
25
+ <tr>
26
+ <%- attributes.reject(&:password_digest?).each do |attribute| -%>
27
+ <td><%%= <%= singular_table_name %>.<%= attribute.name %> %></td>
28
+ <%- end -%>
29
+ <td>
30
+ <%%= link_to 'Show', <%= model_resource_name %>, class: 'btn btn-sm btn-secondary' %>
31
+ <%%= link_to 'Edit', edit_<%= singular_route_name %>_path(<%= singular_table_name %>), class: 'btn btn-sm btn-secondary' %>
32
+ <%%= link_to 'Destroy', <%= model_resource_name %>, method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-sm btn-secondary' %>
33
+ </td>
34
+ </tr>
35
+ <%% end %>
36
+ </tbody>
37
+ </table>
38
+ </div>
39
+ <div class="card-footer">
40
+ <%%= link_to 'New <%= singular_table_name.titleize %>', new_<%= singular_table_name %>_path, class: 'btn btn-sm btn-primary' %>
41
+ </div>
42
+ </div>
@@ -0,0 +1,5 @@
1
+ <%% content_for :title, 'New <%= singular_table_name.titleize %>' %>
2
+ <%% content_for :actions do %>
3
+ <%%= link_to 'Back', <%= index_helper %>_path, class: 'btn btn-sm btn-secondary' %>
4
+ <%% end %>
5
+ <%%= render 'form', <%= singular_table_name %>: @<%= singular_table_name %> %>
@@ -0,0 +1,29 @@
1
+ <div class="card">
2
+ <div class="card-header">
3
+ <strong>Show <%= singular_table_name.titleize %></strong>
4
+ </div>
5
+ <div class="card-body">
6
+ <%% if notice %>
7
+ <div class="alert alert-success alert-dismissible fade show" role="alert">
8
+ <%%= notice %>
9
+ <button class="close" type="button" data-dismiss="alert" aria-label="Close">
10
+ <span aria-hidden="true">×</span>
11
+ </button>
12
+ </div>
13
+ <%% end %>
14
+ <%- attributes.reject(&:password_digest?).each do |attribute| -%>
15
+ <div class="form-group row">
16
+ <div class="col-md-2">
17
+ <strong><%= attribute.human_name %>:</strong>
18
+ </div>
19
+ <div class="col-md-10">
20
+ <%%= @<%= singular_table_name %>.<%= attribute.name %> %>
21
+ </div>
22
+ </div>
23
+ <%- end -%>
24
+ </div>
25
+ <div class="card-footer">
26
+ <%%= link_to 'Edit', edit_<%= singular_table_name %>_path(@<%= singular_table_name %>), class: 'btn btn-sm btn-primary' %>
27
+ <%%= link_to 'Back', <%= index_helper %>_path, class: 'btn btn-sm btn-secondary' %>
28
+ </div>
29
+ </div>
metadata ADDED
@@ -0,0 +1,146 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: anchor_ui-core
3
+ version: !ruby/object:Gem::Version
4
+ version: 5.2.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Anchor Admin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-03-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 5.2.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 5.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: nested_scaffold
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.1.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.1.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: puma
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 3.12.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 3.12.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: capybara
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 3.14.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 3.14.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: selenium-webdriver
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 3.141.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 3.141.0
83
+ description: UI Kit based on open source projects to allow rapid prototypes of internal
84
+ apps.
85
+ email:
86
+ - admin@anchorhealth.com
87
+ executables: []
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - README.md
92
+ - Rakefile
93
+ - lib/anchor_ui/core.rb
94
+ - lib/anchor_ui/core/assets/base.rb
95
+ - lib/anchor_ui/core/assets/concerns/core_ui.rb
96
+ - lib/anchor_ui/core/assets/concerns/zip.rb
97
+ - lib/anchor_ui/core/errors.rb
98
+ - lib/anchor_ui/core/generators/concerns/core.rb
99
+ - lib/anchor_ui/core/generators/concerns/install.rb
100
+ - lib/anchor_ui/core/http.rb
101
+ - lib/anchor_ui/core/railtie.rb
102
+ - lib/anchor_ui/core/test/app.rb
103
+ - lib/anchor_ui/core/test/concerns/core_ui.rb
104
+ - lib/anchor_ui/core/test/concerns/download.rb
105
+ - lib/anchor_ui/core/test/concerns/update.rb
106
+ - lib/anchor_ui/core/test/concerns/zip.rb
107
+ - lib/anchor_ui/core/test/gem.rb
108
+ - lib/anchor_ui/core/test/helper.rb
109
+ - lib/anchor_ui/core/test/javascript.rb
110
+ - lib/anchor_ui/core/version.rb
111
+ - lib/anchor_ui/core/zip.rb
112
+ - lib/generators/anchor_ui/core/templates/install/application.html.erb
113
+ - lib/generators/rails/templates/erb/nested_scaffold/_form.html.erb
114
+ - lib/generators/rails/templates/erb/nested_scaffold/edit.html.erb
115
+ - lib/generators/rails/templates/erb/nested_scaffold/index.html.erb
116
+ - lib/generators/rails/templates/erb/nested_scaffold/new.html.erb
117
+ - lib/generators/rails/templates/erb/nested_scaffold/show.html.erb
118
+ - lib/generators/rails/templates/erb/scaffold/_form.html.erb
119
+ - lib/generators/rails/templates/erb/scaffold/edit.html.erb
120
+ - lib/generators/rails/templates/erb/scaffold/index.html.erb
121
+ - lib/generators/rails/templates/erb/scaffold/new.html.erb
122
+ - lib/generators/rails/templates/erb/scaffold/show.html.erb
123
+ homepage: https://github.com/anchoradmin/anchor_ui.git
124
+ licenses:
125
+ - MIT
126
+ metadata: {}
127
+ post_install_message:
128
+ rdoc_options: []
129
+ require_paths:
130
+ - lib
131
+ required_ruby_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ required_rubygems_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ requirements: []
142
+ rubygems_version: 3.0.1
143
+ signing_key:
144
+ specification_version: 4
145
+ summary: UI Kit for internal apps
146
+ test_files: []