beyond_canvas 0.7.0.pre → 0.8.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/Rakefile +45 -14
  4. data/app/assets/config/beyond_canvas_manifest.js +1 -0
  5. data/app/assets/javascripts/beyond_canvas.js +2 -2
  6. data/app/assets/javascripts/{buttons.js → beyond_canvas/buttons.js} +0 -0
  7. data/app/assets/javascripts/{flash.js → beyond_canvas/flash.js} +0 -0
  8. data/app/assets/stylesheets/beyond_canvas.sass +22 -0
  9. data/app/assets/stylesheets/{components → beyond_canvas/components}/_actions.sass +0 -0
  10. data/app/assets/stylesheets/{components → beyond_canvas/components}/_buttons.sass +0 -0
  11. data/app/assets/stylesheets/{components → beyond_canvas/components}/_cards.sass +0 -0
  12. data/app/assets/stylesheets/{components → beyond_canvas/components}/_comments.sass +0 -0
  13. data/app/assets/stylesheets/{components → beyond_canvas/components}/_flash.sass +0 -0
  14. data/app/assets/stylesheets/{components → beyond_canvas/components}/_forms.sass +0 -0
  15. data/app/assets/stylesheets/{components → beyond_canvas/components}/_inputs.sass +0 -0
  16. data/app/assets/stylesheets/{components → beyond_canvas/components}/_links.sass +0 -0
  17. data/app/assets/stylesheets/{components → beyond_canvas/components}/_main.sass +0 -0
  18. data/app/assets/stylesheets/{components → beyond_canvas/components}/_margins.sass +0 -0
  19. data/app/assets/stylesheets/{components → beyond_canvas/components}/_notices.sass +0 -0
  20. data/app/assets/stylesheets/{components → beyond_canvas/components}/_relative.sass +0 -0
  21. data/app/assets/stylesheets/{components → beyond_canvas/components}/_tables.sass +0 -0
  22. data/app/assets/stylesheets/{components → beyond_canvas/components}/spinner.sass +0 -0
  23. data/app/assets/stylesheets/{settings → beyond_canvas/settings}/_reset_css.sass +0 -0
  24. data/app/assets/stylesheets/{settings → beyond_canvas/settings}/_typography.sass +0 -0
  25. data/app/assets/stylesheets/{settings → beyond_canvas/settings}/_variables.sass +0 -0
  26. data/app/assets/stylesheets/{utilities → beyond_canvas/utilities}/_mixins.sass +0 -0
  27. data/app/controllers/beyond_canvas/application_controller.rb +59 -0
  28. data/app/form_builders/beyond_canvas/form_builder.rb +28 -0
  29. data/app/helpers/beyond_canvas/application_helper.rb +51 -0
  30. data/app/helpers/beyond_canvas/locale_switch_helper.rb +14 -0
  31. data/app/views/beyond_canvas/shared/_locale_switch.html.slim +6 -0
  32. data/app/views/layouts/beyond_canvas/public.html.slim +1 -0
  33. data/config/initializers/beyond_canvas/form_utils.rb +20 -0
  34. data/config/routes.rb +5 -0
  35. data/lib/beyond_canvas.rb +7 -13
  36. data/lib/beyond_canvas/engine.rb +14 -0
  37. data/lib/beyond_canvas/version.rb +3 -1
  38. data/lib/generators/beyond_canvas/custom_styles_generator.rb +2 -2
  39. data/lib/generators/beyond_canvas/install_generator.rb +2 -3
  40. metadata +90 -41
  41. data/.gitignore +0 -17
  42. data/CHANGELOG.md +0 -104
  43. data/CONTRIBUTING.md +0 -48
  44. data/Gemfile +0 -4
  45. data/Gemfile.lock +0 -115
  46. data/app/assets/stylesheets/_beyond_canvas.sass +0 -22
  47. data/app/form_builders/beyond_form_builder.rb +0 -27
  48. data/app/helpers/beyond_canvas_helper.rb +0 -49
  49. data/beyond_canvas.gemspec +0 -27
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 57ce3075063f9f943f9b4a4fa47580696046a4d23563e70a3fc1a40c578592f9
4
- data.tar.gz: b7a63f7471c95a67c8c436a6291826878d79acf913faeb13539f3604c1341820
3
+ metadata.gz: 2acef59a9ae541489e52ccf230292331c5b6f57ec6a60f33fe2dd855d2878726
4
+ data.tar.gz: 7fa922eb178452ae2a009324e8430d8048db63a80b38ab69037efd4a991f184e
5
5
  SHA512:
6
- metadata.gz: cb70bf7931a673e05d1040923d9c4fdfaffd1c50a6a9f03e3b5b9aca0937c488d03923b6971a9c69d871ab0f6291493dec782399b6097d69e24cbc12aad841c8
7
- data.tar.gz: 93f84bcd9bc6027fe4e25ea77213ae8a818d6edb0c4f0f683d71da5ff9fb7fbd14768aaa80edf31197a04a01661ce58de76561afd34f0a03d6269651163408fb
6
+ metadata.gz: e4892640c0a1504fa9db3770513d7cc299770874d31a66e808b6c9062b12c43b4fda572ce80ca969c6829d899117251b3b5026e349af3f4569430a9968d71d90
7
+ data.tar.gz: 3c1871a932673141c76d45e78687ac2031c1ad965df09e24d2b91d812fc37242e91fccf5977786c81eded84ceececf3aadc9d2f70fa957070a45a8b59e3ad2bf
data/README.md CHANGED
@@ -17,13 +17,13 @@
17
17
  $ bundle install
18
18
  ```
19
19
 
20
- 1. Restart your server and rename `application.css` to `application.scss` or `application.sass` (in case you prefer to use `sass` syntax):
20
+ 1. Restart your server and rename `application.css` to `application.scss` or `application.sass` (in case you prefer to use the `sass` syntax):
21
21
 
22
22
  ```bash
23
23
  $ mv app/assets/stylesheets/application.css app/assets/stylesheets/application.scss
24
24
  ```
25
25
 
26
- 1. Delete _all_ Sprockets directives in `application.scss` (`require`, `require_tree` and `require_self`) and use Sass’s native `@import` instead ([why?](https://content.pivotal.io/blog/structure-your-sass-files-with-import)).
26
+ 1. Delete _all_ Sprockets directives in `application.scss` (`require`, `require_tree` and `require_self`) and use Sass’s native `@import` instead ([Here's why?](https://content.pivotal.io/blog/structure-your-sass-files-with-import)).
27
27
 
28
28
  1. Import Beyond Canvas at the beginning of `application.scss`. Any other styles must be imported after Beyond Canvas to avoid issues:
29
29
 
@@ -50,7 +50,7 @@
50
50
 
51
51
  ## Style Customization
52
52
 
53
- Beyond Canvas comes with _out-of-the-box_ styles to make your app look as a Beyond integrated one. If you want to customize the gem styles, follow these instructions:
53
+ Beyond Canvas comes with _out-of-the-box_ styles to make your app look like as a Beyond integrated one. If you want to customize the gem styles, follow these instructions:
54
54
 
55
55
  1. Run the custom style generator:
56
56
 
data/Rakefile CHANGED
@@ -1,22 +1,53 @@
1
- require "colorize"
2
- require "bundler/gem_tasks"
1
+ # frozen_string_literal: true
2
+
3
+ ################################################################################
4
+ # Setup
5
+ ################################################################################
6
+
7
+ begin
8
+ require 'bundler/setup'
9
+ rescue LoadError
10
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
11
+ end
12
+
13
+ ################################################################################
14
+ # RDoc
15
+ ################################################################################
16
+
17
+ require 'rdoc/task'
18
+
19
+ RDoc::Task.new(:rdoc) do |rdoc|
20
+ rdoc.rdoc_dir = 'rdoc'
21
+ rdoc.title = 'BeyondCanvasz'
22
+ rdoc.options << '--line-numbers'
23
+ rdoc.rdoc_files.include('README.md')
24
+ rdoc.rdoc_files.include('lib/**/*.rb')
25
+ end
26
+
27
+ require 'bundler/gem_tasks'
28
+
29
+ ################################################################################
30
+ # Custom rake tasks
31
+ ################################################################################
32
+
33
+ require 'colorize'
3
34
 
4
35
  namespace :release do
5
- namespace :prepare do
36
+ desc 'Update beyond_canvas_custom_styles.sass generator template to latest version'
37
+ task :custom_styles do |_task, _args|
38
+ ORIG = 'app/assets/stylesheets/beyond_canvas/settings/_variables.sass'
39
+ DEST = 'lib/generators/templates/beyond_canvas_custom_styles.sass'
6
40
 
7
- desc "Update beyond_canvas_custom_styles.sass generator template file to its latest version"
8
- task :custom_styles do |task, args|
9
- ORIG = "app/assets/stylesheets/settings/_variables.sass"
10
- DEST = "lib/generators/templates/beyond_canvas_custom_styles.sass"
41
+ dest_file = File.open(DEST, 'w')
11
42
 
12
- dest_file = File.open(DEST, 'w')
13
- File.open(ORIG, 'r').each do |line|
14
- next if line.include?("!global")
15
- line.start_with?("$") ? dest_file.print("// " + line.gsub(" !default", "")) : dest_file.print(line)
16
- end
17
- dest_file.close
43
+ File.open(ORIG, 'r').each do |line|
44
+ next if line.include?('!global')
18
45
 
19
- puts "Ok".green
46
+ line.start_with?('$') ? dest_file.print('// ' + line.gsub(' !default', '')) : dest_file.print(line)
20
47
  end
48
+
49
+ dest_file.close
50
+
51
+ puts 'Ok'.green
21
52
  end
22
53
  end
@@ -0,0 +1 @@
1
+ //= link_directory ../stylesheets .css
@@ -1,2 +1,2 @@
1
- //= require flash
2
- //= require buttons
1
+ //= require beyond_canvas/flash
2
+ //= require beyond_canvas/buttons
@@ -0,0 +1,22 @@
1
+ @import 'bourbon'
2
+
3
+ @import 'beyond_canvas/settings/variables'
4
+ @import 'beyond_canvas/settings/reset_css'
5
+ @import 'beyond_canvas/settings/typography'
6
+
7
+ @import 'beyond_canvas/utilities/mixins'
8
+
9
+ @import 'beyond_canvas/components/actions'
10
+ @import 'beyond_canvas/components/buttons'
11
+ @import 'beyond_canvas/components/cards'
12
+ @import 'beyond_canvas/components/comments'
13
+ @import 'beyond_canvas/components/flash'
14
+ @import 'beyond_canvas/components/forms'
15
+ @import 'beyond_canvas/components/inputs'
16
+ @import 'beyond_canvas/components/links'
17
+ @import 'beyond_canvas/components/main'
18
+ @import 'beyond_canvas/components/margins'
19
+ @import 'beyond_canvas/components/notices'
20
+ @import 'beyond_canvas/components/relative'
21
+ @import 'beyond_canvas/components/tables'
22
+ @import 'beyond_canvas/components/spinner'
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BeyondCanvas
4
+ class ApplicationController < ActionController::Base
5
+ protect_from_forgery with: :exception
6
+ before_action :set_locale
7
+
8
+ ############################################################################
9
+ # Locale management
10
+ ############################################################################
11
+
12
+ def update_locale
13
+ if I18n.available_locales.map(&:to_s).include? app_locale_params[:locale]
14
+ session[:locale] = app_locale_params[:locale]
15
+ set_locale
16
+ end
17
+
18
+ redirect_back(fallback_location: main_app.root_path)
19
+ end
20
+
21
+ private
22
+
23
+ ############################################################################
24
+ # Locale management
25
+ ############################################################################
26
+
27
+ #
28
+ # Sets the I18n.locale to either +session[ :locale ]+ or the browser
29
+ # compatible locale (if +session[ :locale ]+ is not set)
30
+ #
31
+ def set_locale
32
+ I18n.locale = session[:locale] || session[:locale] = browser_compatible_locale
33
+ end
34
+
35
+ #
36
+ # Reads the +HTTP_ACCEPT_LANGUAGE+ header and searches a compatible locale
37
+ # on +I18n.available_locales+. If no compatible language is found, it
38
+ # returns +I18n.default_locale+.
39
+ #
40
+ # @return [String] a browser compatible language string or
41
+ # +I18n.default_locale+. (e.g. +'en-GB'+)
42
+ #
43
+ def browser_compatible_locale
44
+ browser_locales = HTTP::Accept::Languages.parse(request.headers['HTTP_ACCEPT_LANGUAGE'])
45
+ available_locales = HTTP::Accept::Languages::Locales.new(I18n.available_locales.map(&:to_s))
46
+
47
+ locales = available_locales & browser_locales
48
+
49
+ locales.empty? ? I18n.default_locale : locales.first
50
+ end
51
+
52
+ #
53
+ # Strong parameters for locale switch
54
+ #
55
+ def app_locale_params
56
+ params.require(:app).permit(:locale)
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BeyondCanvas
4
+ class FormBuilder < ActionView::Helpers::FormBuilder
5
+ def field_wrapper(attribute, args, &block)
6
+ label = args[:label].present? ? args[:label] : attribute.to_s.humanize
7
+
8
+ errors = object.errors[attribute].join(', ') if object.respond_to?(:errors) && object.errors.include?(attribute)
9
+
10
+ @template.content_tag(:div, class: 'form__row') do
11
+ @template.content_tag(:label, label, class: 'input__label') +
12
+ @template.content_tag(:div, class: 'relative') do
13
+ block.call +
14
+ (@template.content_tag(:label, errors, class: 'input__error') unless errors.blank?)
15
+ end +
16
+ (@template.content_tag(:div, args[:hint].html_safe, class: 'input__hint') if args[:hint].present?)
17
+ end
18
+ end
19
+
20
+ [:email, :text, :password, :file].each do |method|
21
+ define_method :"#{method}_field" do |attribute, args = {}|
22
+ field_wrapper(attribute, args) do
23
+ super(attribute, args)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BeyondCanvas
4
+ module ApplicationHelper
5
+ def link_to_with_icon(name = nil, options = nil, fa_class = nil, html_options = nil)
6
+ options ||= {}
7
+
8
+ html_options = convert_options_to_data_attributes(options, html_options)
9
+
10
+ url = url_for(options)
11
+ html_options['href'] ||= url
12
+
13
+ content_tag('a', name || url, html_options) do
14
+ (fa_class.nil? ? '' : content_tag('i', nil, class: ['link__icon ' + fa_class])) +
15
+ name
16
+ end
17
+ end
18
+
19
+ def get_flash_icon(key)
20
+ case key
21
+ when 'success'
22
+ 'fas fa-check'
23
+ when 'info'
24
+ 'fas fa-info'
25
+ when 'warning'
26
+ 'fas fa-exclamation'
27
+ when 'error'
28
+ 'far fa-times-circle'
29
+ else
30
+ 'fas fa-info'
31
+ end
32
+ end
33
+
34
+ [:success, :info, :warning, :error].each do |method|
35
+ define_method :"notice_#{method}" do |message|
36
+ content_tag('div', class: "notice notice--#{method}") do
37
+ content_tag('i', nil, class: "notice__icon #{get_flash_icon(method.to_s)}") +
38
+ content_tag('span', message, class: 'notice__message')
39
+ end
40
+ end
41
+ end
42
+
43
+ def logo_image_tag(logo_path)
44
+ if File.extname(logo_path) == '.svg'
45
+ inline_svg_tag logo_path, class: 'logo', alt: 'logo'
46
+ else
47
+ image_tag logo_path, class: 'logo', alt: 'logo'
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BeyondCanvas
4
+ module LocaleSwitchHelper
5
+ def translate_locale(locale)
6
+ if I18n.exists?("locales.#{locale}")
7
+ I18n.t("locales.#{locale}")
8
+ else
9
+ logger.debug "[BeyondCanvas] Missing translation: #{I18n.locale}.locales.#{locale}".yellow
10
+ locale
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,6 @@
1
+ - if defined?(I18n) && I18n.available_locales.count > 1
2
+ = form_for :app, url: beyond_canvas.update_locale_path, method: :put do |f|
3
+ = f.select :locale, I18n.available_locales.collect { |l| [translate_locale(l), l] },
4
+ { selected: I18n.locale },
5
+ class: 'select--locale',
6
+ onchange: 'this.form.submit()'
@@ -6,6 +6,7 @@ html
6
6
  body.body--public
7
7
  main.main class=("#{params[:controller].gsub(/[\/_]/, "-")}--#{params[:action]}")
8
8
  = render 'beyond_canvas/shared/flash'
9
+ = render 'beyond_canvas/shared/locale_switch'
9
10
  .main-wrapper
10
11
  = render 'beyond_canvas/shared/logo'
11
12
  = yield
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ ActionView::Base.field_error_proc = proc do |html_tag, _instance|
4
+ if html_tag =~ /<(input|textarea|select)/
5
+ error_class = 'input__error'
6
+
7
+ doc = Nokogiri::XML(html_tag)
8
+ doc.children.each do |field|
9
+ next if field['type'] == 'hidden'
10
+
11
+ next if field['class'] =~ /\berror\b/
12
+
13
+ field['class'] = "#{field['class']} #{error_class}".strip
14
+ end
15
+
16
+ doc.to_html.html_safe
17
+ else
18
+ html_tag
19
+ end
20
+ end
data/config/routes.rb ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ BeyondCanvas::Engine.routes.draw do
4
+ put '/locale', to: 'application#update_locale', as: :update_locale
5
+ end
data/lib/beyond_canvas.rb CHANGED
@@ -1,20 +1,14 @@
1
- require "beyond_canvas/version"
1
+ # frozen_string_literal: true
2
2
 
3
- require "bourbon"
4
- require "slim-rails"
5
- require "inline_svg"
3
+ require 'beyond_canvas/engine'
6
4
 
7
- module BeyondCanvas
8
- class Error < StandardError; end
5
+ require 'colorize'
9
6
 
10
- class Engine < ::Rails::Engine
11
- config.before_initialize do
12
- if config.action_view.javascript_expansions
13
- config.action_view.javascript_expansions[:beyond_canvas] = %w(beyond_canvas)
14
- end
15
- end
16
- end
7
+ require 'bourbon'
8
+ require 'slim-rails'
9
+ require 'inline_svg'
17
10
 
11
+ module BeyondCanvas
18
12
  class << self
19
13
  attr_accessor :configuration
20
14
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BeyondCanvas
4
+ class Engine < ::Rails::Engine
5
+ isolate_namespace BeyondCanvas
6
+
7
+ initializer 'local_helper.action_controller' do
8
+ ActiveSupport.on_load :action_controller do
9
+ helper BeyondCanvas::ApplicationHelper
10
+ helper BeyondCanvas::LocaleSwitchHelper
11
+ end
12
+ end
13
+ end
14
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module BeyondCanvas
2
- VERSION = "0.7.0.pre".freeze
4
+ VERSION = '0.8.0.pre'
3
5
  end
@@ -3,10 +3,10 @@
3
3
  module BeyondCanvas
4
4
  module Generators
5
5
  class CustomStylesGenerator < Rails::Generators::Base
6
- source_root File.expand_path("../../templates", __FILE__)
6
+ source_root File.expand_path('../templates', __dir__)
7
7
 
8
8
  def copy_initializer
9
- template "beyond_canvas_custom_styles.sass", "app/assets/stylesheets/_beyond_canvas_custom_styles.sass"
9
+ template 'beyond_canvas_custom_styles.sass', 'app/assets/stylesheets/_beyond_canvas_custom_styles.sass'
10
10
  end
11
11
  end
12
12
  end
@@ -3,11 +3,10 @@
3
3
  module BeyondCanvas
4
4
  module Generators
5
5
  class InstallGenerator < Rails::Generators::Base
6
- source_root File.expand_path("../../templates", __FILE__)
6
+ source_root File.expand_path('../templates', __dir__)
7
7
 
8
8
  def copy_initializer
9
- template "beyond_canvas.rb", "config/initializers/beyond_canvas.rb"
10
- template "beyond_canvas_form_utils.rb", "config/initializers/beyond_canvas_form_utils.rb"
9
+ template 'beyond_canvas.rb', 'config/initializers/beyond_canvas.rb'
11
10
  end
12
11
  end
13
12
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beyond_canvas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0.pre
4
+ version: 0.8.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Unai Abrisketa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-17 00:00:00.000000000 Z
11
+ date: 2020-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bourbon
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '5.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '5.1'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: colorize
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -17,7 +31,7 @@ dependencies:
17
31
  - - "~>"
18
32
  - !ruby/object:Gem::Version
19
33
  version: '0.8'
20
- type: :development
34
+ type: :runtime
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
@@ -25,33 +39,53 @@ dependencies:
25
39
  - !ruby/object:Gem::Version
26
40
  version: '0.8'
27
41
  - !ruby/object:Gem::Dependency
28
- name: bourbon
42
+ name: http-accept
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: '5.1'
47
+ version: '2.1'
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: '5.1'
54
+ version: '2.1'
41
55
  - !ruby/object:Gem::Dependency
42
- name: slim-rails
56
+ name: inline_svg
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: '3.2'
61
+ version: '1.5'
48
62
  type: :runtime
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: '3.2'
68
+ version: '1.5'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rails
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 6.0.2
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: 6.0.2.1
79
+ type: :runtime
80
+ prerelease: false
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - "~>"
84
+ - !ruby/object:Gem::Version
85
+ version: 6.0.2
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: 6.0.2.1
55
89
  - !ruby/object:Gem::Dependency
56
90
  name: sassc-rails
57
91
  requirement: !ruby/object:Gem::Requirement
@@ -67,19 +101,33 @@ dependencies:
67
101
  - !ruby/object:Gem::Version
68
102
  version: '2.1'
69
103
  - !ruby/object:Gem::Dependency
70
- name: inline_svg
104
+ name: slim-rails
71
105
  requirement: !ruby/object:Gem::Requirement
72
106
  requirements:
73
107
  - - "~>"
74
108
  - !ruby/object:Gem::Version
75
- version: '1.5'
109
+ version: '3.2'
76
110
  type: :runtime
77
111
  prerelease: false
78
112
  version_requirements: !ruby/object:Gem::Requirement
79
113
  requirements:
80
114
  - - "~>"
81
115
  - !ruby/object:Gem::Version
82
- version: '1.5'
116
+ version: '3.2'
117
+ - !ruby/object:Gem::Dependency
118
+ name: rubocop
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: 0.80.0
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: 0.80.0
83
131
  description: |2
84
132
  Beyond Canvas is an open-source framework that provides CSS styles for apps
85
133
  designed and developed for the online shop software Beyond
@@ -89,45 +137,46 @@ executables: []
89
137
  extensions: []
90
138
  extra_rdoc_files: []
91
139
  files:
92
- - ".gitignore"
93
- - CHANGELOG.md
94
- - CONTRIBUTING.md
95
- - Gemfile
96
- - Gemfile.lock
97
140
  - LICENSE
98
141
  - README.md
99
142
  - Rakefile
143
+ - app/assets/config/beyond_canvas_manifest.js
100
144
  - app/assets/javascripts/beyond_canvas.js
101
- - app/assets/javascripts/buttons.js
102
- - app/assets/javascripts/flash.js
103
- - app/assets/stylesheets/_beyond_canvas.sass
104
- - app/assets/stylesheets/components/_actions.sass
105
- - app/assets/stylesheets/components/_buttons.sass
106
- - app/assets/stylesheets/components/_cards.sass
107
- - app/assets/stylesheets/components/_comments.sass
108
- - app/assets/stylesheets/components/_flash.sass
109
- - app/assets/stylesheets/components/_forms.sass
110
- - app/assets/stylesheets/components/_inputs.sass
111
- - app/assets/stylesheets/components/_links.sass
112
- - app/assets/stylesheets/components/_main.sass
113
- - app/assets/stylesheets/components/_margins.sass
114
- - app/assets/stylesheets/components/_notices.sass
115
- - app/assets/stylesheets/components/_relative.sass
116
- - app/assets/stylesheets/components/_tables.sass
117
- - app/assets/stylesheets/components/spinner.sass
118
- - app/assets/stylesheets/settings/_reset_css.sass
119
- - app/assets/stylesheets/settings/_typography.sass
120
- - app/assets/stylesheets/settings/_variables.sass
121
- - app/assets/stylesheets/utilities/_mixins.sass
122
- - app/form_builders/beyond_form_builder.rb
123
- - app/helpers/beyond_canvas_helper.rb
145
+ - app/assets/javascripts/beyond_canvas/buttons.js
146
+ - app/assets/javascripts/beyond_canvas/flash.js
147
+ - app/assets/stylesheets/beyond_canvas.sass
148
+ - app/assets/stylesheets/beyond_canvas/components/_actions.sass
149
+ - app/assets/stylesheets/beyond_canvas/components/_buttons.sass
150
+ - app/assets/stylesheets/beyond_canvas/components/_cards.sass
151
+ - app/assets/stylesheets/beyond_canvas/components/_comments.sass
152
+ - app/assets/stylesheets/beyond_canvas/components/_flash.sass
153
+ - app/assets/stylesheets/beyond_canvas/components/_forms.sass
154
+ - app/assets/stylesheets/beyond_canvas/components/_inputs.sass
155
+ - app/assets/stylesheets/beyond_canvas/components/_links.sass
156
+ - app/assets/stylesheets/beyond_canvas/components/_main.sass
157
+ - app/assets/stylesheets/beyond_canvas/components/_margins.sass
158
+ - app/assets/stylesheets/beyond_canvas/components/_notices.sass
159
+ - app/assets/stylesheets/beyond_canvas/components/_relative.sass
160
+ - app/assets/stylesheets/beyond_canvas/components/_tables.sass
161
+ - app/assets/stylesheets/beyond_canvas/components/spinner.sass
162
+ - app/assets/stylesheets/beyond_canvas/settings/_reset_css.sass
163
+ - app/assets/stylesheets/beyond_canvas/settings/_typography.sass
164
+ - app/assets/stylesheets/beyond_canvas/settings/_variables.sass
165
+ - app/assets/stylesheets/beyond_canvas/utilities/_mixins.sass
166
+ - app/controllers/beyond_canvas/application_controller.rb
167
+ - app/form_builders/beyond_canvas/form_builder.rb
168
+ - app/helpers/beyond_canvas/application_helper.rb
169
+ - app/helpers/beyond_canvas/locale_switch_helper.rb
124
170
  - app/views/beyond_canvas/custom/_public_head.html.slim
125
171
  - app/views/beyond_canvas/shared/_flash.html.slim
126
172
  - app/views/beyond_canvas/shared/_head.html.slim
173
+ - app/views/beyond_canvas/shared/_locale_switch.html.slim
127
174
  - app/views/beyond_canvas/shared/_logo.html.slim
128
175
  - app/views/layouts/beyond_canvas/public.html.slim
129
- - beyond_canvas.gemspec
176
+ - config/initializers/beyond_canvas/form_utils.rb
177
+ - config/routes.rb
130
178
  - lib/beyond_canvas.rb
179
+ - lib/beyond_canvas/engine.rb
131
180
  - lib/beyond_canvas/version.rb
132
181
  - lib/generators/beyond_canvas/custom_styles_generator.rb
133
182
  - lib/generators/beyond_canvas/install_generator.rb
data/.gitignore DELETED
@@ -1,17 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- # rspec failure tracking
11
- .rspec_status
12
-
13
- # Environment variables
14
- .env
15
-
16
- # Apple file system
17
- .DS_Store
data/CHANGELOG.md DELETED
@@ -1,104 +0,0 @@
1
- ### v0.7.0.pre
2
-
3
- * deprecations
4
- * Use custom `stylesheet_link_tag` and `javascript_include_tag` on head
5
-
6
- * enhancements
7
- * Make `lib/generators/templates/beyond_canvas_form_utils.rb` rubocop compatible
8
-
9
- * features
10
- * Add loading buttons
11
-
12
- ### v0.6.4.pre
13
-
14
- * bug-fixes
15
- * Fix requiting to create the `_head.html.*` on the project instead of the gem itself
16
-
17
- ### v0.6.3.pre
18
-
19
- * bug-fixes
20
- * Add `slim-rails` dependency
21
- * Fix requiring dependencies on `Engine`
22
-
23
- * deprecations
24
- * Remove `neat` dependency as is no longer maintained
25
-
26
- ### v0.6.2.pre
27
-
28
- * bug-fixes
29
- * Fix button `border-color`
30
- * Fix error-input's `border-color`
31
-
32
- * deprecations
33
- * Update error-input's class to `.input__error`
34
-
35
- ### v0.6.1.pre
36
-
37
- * bug-fixes
38
- * Fix `logo_image_tag`
39
-
40
- ### v0.6.0.pre
41
-
42
- * deprecations
43
- * Rename `notice` flash types in favor of `info` flash types
44
- * Rename `beyond_canvas:form_utils:install` rake task in favor of `beyond_canvas:install`
45
-
46
- * bug-fixes
47
- * Fix `p` tag `font-size` and change `rem` to `px` on typography
48
- * Fix button styles
49
-
50
- * enhancements
51
- * Update how the public layout logo is handled. Now the logo is set via `config/initializers/beyond_canvas.rb` initializer and it also supports web URLs
52
-
53
- * features
54
- * Add notice boxes
55
- * Add custom styles generator
56
- * Add a rake task (`beyond_canvas:release:prepare`) that creates or updates the `beyond_canvas_custom_styles.sass` generator template
57
-
58
- ### v0.5.0.pre
59
-
60
- * features
61
- * Add select box styles
62
-
63
- ### v0.4.0.pre
64
-
65
- * bug-fixes
66
- * Fix transparent button bottom border
67
- * Fix list styles
68
-
69
- * features
70
- * Add table styles
71
- * Add comment styles
72
- * Add margin styles
73
- * Add input type file
74
-
75
- ### v0.3.0.pre
76
-
77
- * features
78
- * Add flash messages
79
- * Add CHANGELOG file
80
- * Add CONTRIBUTING file
81
- * Add Rakefile
82
-
83
- ### v0.2.1.pre
84
-
85
- * bug-fixes
86
- * Fix headline margin on card
87
- * Fix gem name
88
-
89
- ### v0.2.0.pre
90
-
91
- * features
92
- * Add Beyond form utils
93
- * Add single page layout
94
- * Add lins with icons
95
- * Add FontAwesome
96
- * Add input errors
97
-
98
- * enhancements
99
- * Improve styles
100
-
101
- ### v0.1.0.pre
102
-
103
- * features
104
- * First pre-release of the gem
data/CONTRIBUTING.md DELETED
@@ -1,48 +0,0 @@
1
- # Contributing to Beyond API Ruby Client
2
-
3
- We love pull requests from everyone. Here are some ways _you_ can contribute:
4
-
5
- * by using alpha, beta, and prerelease versions
6
- * by reporting bugs
7
- * by suggesting new features
8
- * by writing or editing documentation
9
- * by writing specifications
10
- * by writing code (**no patch is too small**: fix typos, add comments, clean up inconsistent whitespace)
11
- * by refactoring code
12
- * by closing [issues][]
13
- * by reviewing patches
14
-
15
- [issues]: https://github.com/ePages-de/beyond_canvasssues
16
-
17
- ## Submitting an Issue
18
-
19
- * We use the [GitHub issue tracker][issues] to track bugs and features.
20
- * Before submitting a bug report or feature request, check to make sure it hasn't already been submitted.
21
- * When submitting a bug report, please include a [Gist][] that includes a stack trace and any details that may be necessary to reproduce the bug, including your gem version, Ruby version, and operating system. Ideally, a bug report should include a pull request with failing specs.
22
-
23
- [gist]: https://gist.github.com/
24
-
25
- ## Cleaning up issues
26
-
27
- * Issues that have no response from the submitter will be closed after 30 days.
28
- * Issues will be closed once they're assumed to be fixed or answered. If the maintainer is wrong, it can be opened again.
29
- * If your issue is closed by mistake, please understand and explain the issue. We will happily reopen the issue.
30
-
31
- ## Submitting a Pull Request
32
-
33
- 1. [Fork][fork] the [official repository][repo].
34
- 2. [Create a topic branch.][branch]
35
- 3. Implement your feature or bug fix.
36
- 4. Add, commit, and push your changes.
37
- 5. [Submit a pull request.][pr]
38
-
39
- ## Notes
40
-
41
- * Please don't update the Gem version.
42
-
43
- [repo]: https://github.com/ePages-de/beyond_canvas/tree/master
44
- [fork]: https://help.github.com/articles/fork-a-repo/
45
- [branch]: https://help.github.com/articles/creating-and-deleting-branches-within-your-repository/
46
- [pr]: https://help.github.com/articles/using-pull-requests/
47
-
48
- Inspired by https://github.com/thoughtbot/factory_bot/blob/master/CONTRIBUTING.md
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in beyond_api.gemspec
4
- gemspec
data/Gemfile.lock DELETED
@@ -1,115 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- beyond_canvas (0.7.0.pre)
5
- bourbon (~> 5.1)
6
- inline_svg (~> 1.5)
7
- sassc-rails (~> 2.1)
8
- slim-rails (~> 3.2)
9
-
10
- GEM
11
- remote: https://rubygems.org/
12
- specs:
13
- actionpack (6.0.2.1)
14
- actionview (= 6.0.2.1)
15
- activesupport (= 6.0.2.1)
16
- rack (~> 2.0, >= 2.0.8)
17
- rack-test (>= 0.6.3)
18
- rails-dom-testing (~> 2.0)
19
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
20
- actionview (6.0.2.1)
21
- activesupport (= 6.0.2.1)
22
- builder (~> 3.1)
23
- erubi (~> 1.4)
24
- rails-dom-testing (~> 2.0)
25
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
26
- activesupport (6.0.2.1)
27
- concurrent-ruby (~> 1.0, >= 1.0.2)
28
- i18n (>= 0.7, < 2)
29
- minitest (~> 5.1)
30
- tzinfo (~> 1.1)
31
- zeitwerk (~> 2.2)
32
- bourbon (5.1.0)
33
- sass (~> 3.4)
34
- thor (~> 0.19)
35
- builder (3.2.4)
36
- colorize (0.8.1)
37
- concurrent-ruby (1.1.6)
38
- crass (1.0.6)
39
- erubi (1.9.0)
40
- ffi (1.12.2)
41
- i18n (1.8.2)
42
- concurrent-ruby (~> 1.0)
43
- inline_svg (1.7.0)
44
- activesupport (>= 3.0)
45
- nokogiri (>= 1.6)
46
- loofah (2.4.0)
47
- crass (~> 1.0.2)
48
- nokogiri (>= 1.5.9)
49
- method_source (0.9.2)
50
- mini_portile2 (2.4.0)
51
- minitest (5.14.0)
52
- nokogiri (1.10.8)
53
- mini_portile2 (~> 2.4.0)
54
- rack (2.2.2)
55
- rack-test (1.1.0)
56
- rack (>= 1.0, < 3)
57
- rails-dom-testing (2.0.3)
58
- activesupport (>= 4.2.0)
59
- nokogiri (>= 1.6)
60
- rails-html-sanitizer (1.3.0)
61
- loofah (~> 2.3)
62
- railties (6.0.2.1)
63
- actionpack (= 6.0.2.1)
64
- activesupport (= 6.0.2.1)
65
- method_source
66
- rake (>= 0.8.7)
67
- thor (>= 0.20.3, < 2.0)
68
- rake (13.0.1)
69
- rb-fsevent (0.10.3)
70
- rb-inotify (0.10.1)
71
- ffi (~> 1.0)
72
- sass (3.7.4)
73
- sass-listen (~> 4.0.0)
74
- sass-listen (4.0.0)
75
- rb-fsevent (~> 0.9, >= 0.9.4)
76
- rb-inotify (~> 0.9, >= 0.9.7)
77
- sassc (2.2.1)
78
- ffi (~> 1.9)
79
- sassc-rails (2.1.2)
80
- railties (>= 4.0.0)
81
- sassc (>= 2.0)
82
- sprockets (> 3.0)
83
- sprockets-rails
84
- tilt
85
- slim (4.0.1)
86
- temple (>= 0.7.6, < 0.9)
87
- tilt (>= 2.0.6, < 2.1)
88
- slim-rails (3.2.0)
89
- actionpack (>= 3.1)
90
- railties (>= 3.1)
91
- slim (>= 3.0, < 5.0)
92
- sprockets (4.0.0)
93
- concurrent-ruby (~> 1.0)
94
- rack (> 1, < 3)
95
- sprockets-rails (3.2.1)
96
- actionpack (>= 4.0)
97
- activesupport (>= 4.0)
98
- sprockets (>= 3.0.0)
99
- temple (0.8.2)
100
- thor (0.20.3)
101
- thread_safe (0.3.6)
102
- tilt (2.0.10)
103
- tzinfo (1.2.6)
104
- thread_safe (~> 0.1)
105
- zeitwerk (2.2.2)
106
-
107
- PLATFORMS
108
- ruby
109
-
110
- DEPENDENCIES
111
- beyond_canvas!
112
- colorize (~> 0.8)
113
-
114
- BUNDLED WITH
115
- 2.0.2
@@ -1,22 +0,0 @@
1
- @import 'bourbon'
2
-
3
- @import 'settings/variables'
4
- @import 'settings/reset_css'
5
- @import 'settings/typography'
6
-
7
- @import 'utilities/mixins'
8
-
9
- @import 'components/actions'
10
- @import 'components/buttons'
11
- @import 'components/cards'
12
- @import 'components/comments'
13
- @import 'components/flash'
14
- @import 'components/forms'
15
- @import 'components/inputs'
16
- @import 'components/links'
17
- @import 'components/main'
18
- @import 'components/margins'
19
- @import 'components/notices'
20
- @import 'components/relative'
21
- @import 'components/tables'
22
- @import 'components/spinner'
@@ -1,27 +0,0 @@
1
- class BeyondFormBuilder < ActionView::Helpers::FormBuilder
2
- def field_wrapper(attribute, args, &block)
3
- label = args[:label].present? ? args[:label] : attribute.to_s.humanize
4
-
5
- if self.object.respond_to?(:errors) && self.object.errors.include?(attribute)
6
- errors = self.object.errors[attribute].join(", ")
7
- end
8
-
9
- @template.content_tag(:div, class: 'form__row') do
10
- @template.content_tag(:label, label, class: 'input__label') +
11
- @template.content_tag(:div, class: 'relative') do
12
- block.call +
13
-
14
- (@template.content_tag(:label, errors, class: "input__error") unless errors.blank?)
15
- end +
16
- (@template.content_tag(:div, args[:hint].html_safe, class: 'input__hint') if args[:hint].present?)
17
- end
18
- end
19
-
20
- [:email, :text, :password, :file].each do |method|
21
- define_method :"#{method}_field" do |attribute, args = {}|
22
- field_wrapper(attribute, args) do
23
- super(attribute, args)
24
- end
25
- end
26
- end
27
- end
@@ -1,49 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module BeyondCanvasHelper
4
- def link_to_with_icon(name = nil, options = nil, fa_icon_class = nil, html_options = nil)
5
- options ||= {}
6
-
7
- html_options = convert_options_to_data_attributes(options, html_options)
8
-
9
- url = url_for(options)
10
- html_options["href".freeze] ||= url
11
-
12
- content_tag("a".freeze, name || url, html_options) do
13
- (fa_icon_class.nil? ? "" : content_tag("i".freeze, nil, class: ["link__icon " + fa_icon_class])) +
14
- name
15
- end
16
- end
17
-
18
- def get_flash_icon(key)
19
- case key
20
- when "success"
21
- "fas fa-check"
22
- when "info"
23
- "fas fa-info"
24
- when "warning"
25
- "fas fa-exclamation"
26
- when "error"
27
- "far fa-times-circle"
28
- else
29
- "fas fa-info"
30
- end
31
- end
32
-
33
- [:success, :info, :warning, :error].each do |method|
34
- define_method :"notice_#{method}" do |message|
35
- content_tag("div".freeze, class: "notice notice--#{method}") do
36
- content_tag("i".freeze, nil, class: "notice__icon #{get_flash_icon(method.to_s)}") +
37
- content_tag("span".freeze, message, class: "notice__message")
38
- end
39
- end
40
- end
41
-
42
- def logo_image_tag(logo)
43
- if File.extname(logo) == '.svg'
44
- inline_svg logo, class: 'logo', alt: 'logo'
45
- else
46
- image_tag logo, class: 'logo', alt: 'logo'
47
- end
48
- end
49
- end
@@ -1,27 +0,0 @@
1
- lib = File.expand_path("../lib", __FILE__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require "beyond_canvas/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "beyond_canvas"
7
- spec.version = BeyondCanvas::VERSION
8
- spec.authors = ["Unai Abrisketa"]
9
- spec.email = ["u.abrisketa@epages.com"]
10
-
11
- spec.summary = "Open-source framework that provides CSS styles"
12
- spec.description = <<-DESC
13
- Beyond Canvas is an open-source framework that provides CSS styles for apps
14
- designed and developed for the online shop software Beyond
15
- DESC
16
- spec.homepage = "https://github.com/ePages-de/beyond_canvas"
17
- spec.license = "MIT"
18
-
19
- spec.files = `git ls-files`.split("\n")
20
-
21
- spec.add_development_dependency "colorize", "~> 0.8"
22
-
23
- spec.add_dependency "bourbon", "~> 5.1"
24
- spec.add_dependency "slim-rails", "~> 3.2"
25
- spec.add_dependency "sassc-rails", "~> 2.1"
26
- spec.add_dependency "inline_svg", "~> 1.5"
27
- end