beyond_canvas 0.1.0.pre → 0.2.0.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 065b4cc184018b0a41cfb7bb63ecc93003050d75df117d49010bfc57ccc1282d
4
- data.tar.gz: c249481c868a9de71728c6e02f08905ea71d9adb357970076ef6cc7f2215698a
3
+ metadata.gz: 49a9a385d6f781b4a883067f73b0d7e901d2d4a46b070966e02d53e4959f7fcf
4
+ data.tar.gz: 78feebc3949210d672dc4cb4f07664cacb7d1cf7c18f91fb369e5f1691abeb1b
5
5
  SHA512:
6
- metadata.gz: 7db8400076fc278cda8e852011989f7337ca02408cba731f56928983ef94f61703f0a3f66805aae8ff00ed34b87d43c9276b844b96eef13b1e947e158b95acf5
7
- data.tar.gz: 9b364f193d29260ba2c2e9c5e8b4c54aeb9c11e8706a4d59e5b3c50c65bead504c174f435f199369671a8bc87d86f83eddc545cdb89ccb918dc24a21567dcd9c
6
+ metadata.gz: 1a0826bcd50861074e3d80a4d600230e07a1d26628072b672ea206bc6847da4f448212f1a44fce8ca8ca641f8336cef120febe2a1f918b29044804be3c29e3db
7
+ data.tar.gz: e886eaca919fc7ae5e4fb3173b97d648d72f0d4621b2368a359da74861ec9ace25ace69ce189c6700dd2a370f9d614e7c8c8916d6022b7d3d0ae2f0a892a1d1a
@@ -15,6 +15,7 @@
15
15
  @mixin button-transparent($background)
16
16
  @if $button-box-shadow != 0
17
17
  box-shadow: $button-box-shadow darken($background, 10%)
18
+ background-color: transparent
18
19
  border: 1px solid $background
19
20
  color: $background
20
21
 
@@ -1,11 +1,26 @@
1
- %card
1
+ .card
2
2
  background: $white
3
3
  border-radius: $card-border-radius
4
4
  box-shadow: $card-box-shadow
5
5
 
6
- .card
6
+ &:not(:last-child)
7
+ margin-bottom: $card-margin
8
+
9
+ &--relative
10
+ position: relative
7
11
 
8
12
  &--padding
9
- @extend %card
10
13
  +padding($card-padding)
11
14
  box-sizing: border-box
15
+
16
+ &__separator
17
+ +margin($card-separator-spacing null)
18
+ border-bottom: 1px solid $card-separator-color
19
+ left: -#{$card-padding}
20
+ position: relative
21
+ width: calc(100% + 2 * #{$card-padding})
22
+
23
+ &__headline
24
+ color: $card-title-color
25
+ font-size: 20px
26
+ margin-bottom: 50px
@@ -23,3 +23,20 @@
23
23
  color: $hint-color
24
24
  font-size: 13px
25
25
  margin-top: 1px
26
+
27
+ &__with-error
28
+ border-left: 2px solid $input-errors-color
29
+
30
+ &__errors
31
+ +padding(5px 7px)
32
+ +position(absolute, calc(100% + 8px) null null 0)
33
+ background-color: $input-errors-color
34
+ border-radius: 3px
35
+ color: $white
36
+ font-size: 13px
37
+ z-index: 1
38
+
39
+ &::before
40
+ +position(absolute, null null 100% 8px)
41
+ +triangle('up', 12px, 6px, $input-errors-color)
42
+ content: ''
@@ -1,5 +1,8 @@
1
1
  .link
2
2
 
3
+ &__icon
4
+ margin-right: 10px
5
+
3
6
  &--primary
4
7
  +color-darken($link-primary-color, 10%)
5
8
 
@@ -10,6 +10,19 @@
10
10
  width: 94%
11
11
 
12
12
  .logo
13
- +margin($logo-margin-top-public auto 34px)
13
+ +margin($logo-margin-top-public auto $logo-margin-bottom-public)
14
14
  display: block
15
- width: $logo-width-public
15
+ width: 238px
16
+
17
+ .body--single-page
18
+ @extend %body
19
+
20
+ .main-wrapper
21
+ +margin(32px auto)
22
+ max-width: 876px
23
+ width: 94%
24
+
25
+ .logo
26
+ +margin($logo-margin-top-public auto $logo-margin-bottom-public)
27
+ display: block
28
+ width: 238px
@@ -53,15 +53,19 @@ $card-border-radius: 3px !default
53
53
  $card-box-shadow: 0 2px 7px rgba($black, .2) !default
54
54
  $card-padding: 40px !global
55
55
  $card-margin: 30px !global
56
+ $card-separator-color: rgb(222, 222, 222) !default
57
+ $card-separator-spacing: 50px !global
58
+ $card-title-color: rgb(247, 133, 96) !default
56
59
 
57
60
  // Labels
58
61
 
59
62
  $label-color: rgb(128, 128, 128) !default
60
63
 
61
- // Text inputs
64
+ // Inputs
62
65
 
63
66
  $input-border-color: rgb(217, 216, 195) !default
64
67
  $input-border-color-focus: $palette-primary !default
68
+ $input-errors-color: $palette-danger !default
65
69
 
66
70
  // Hints
67
71
 
@@ -69,5 +73,5 @@ $hint-color: rgb(158, 158, 158) !default
69
73
 
70
74
  // Logo
71
75
 
72
- $logo-width-public: 238px !default
73
76
  $logo-margin-top-public: 0 !default
77
+ $logo-margin-bottom-public: 34px !default
@@ -1,12 +1,19 @@
1
1
  class BeyondFormBuilder < ActionView::Helpers::FormBuilder
2
2
  def field_wrapper(attribute, args, &block)
3
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
+
4
9
  @template.content_tag(:div, class: 'form__row') do
5
10
  @template.content_tag(:label, label, class: 'input__label') +
6
11
  @template.content_tag(:div, class: 'relative') do
7
- block.call
12
+ block.call +
13
+
14
+ (@template.content_tag(:label, errors, class: "input__errors") unless errors.blank?)
8
15
  end +
9
- (@template.content_tag(:div, args[:hint], class: 'input__hint') if args[:hint].present?)
16
+ (@template.content_tag(:div, args[:hint].html_safe, class: 'input__hint') if args[:hint].present?)
10
17
  end
11
18
  end
12
19
 
@@ -0,0 +1,15 @@
1
+ module BeyondCanvasHelper
2
+ def link_to_with_icon(name = nil, options = nil, fa_icon_class = nil, html_options = nil)
3
+ options ||= {}
4
+
5
+ html_options = convert_options_to_data_attributes(options, html_options)
6
+
7
+ url = url_for(options)
8
+ html_options["href".freeze] ||= url
9
+
10
+ content_tag("a".freeze, name || url, html_options) do
11
+ (fa_icon_class.nil? ? "" : content_tag("i".freeze, nil, class: ["link__icon " + fa_icon_class])) +
12
+ name
13
+ end
14
+ end
15
+ end
@@ -4,6 +4,7 @@ html
4
4
  head
5
5
  = csrf_meta_tags
6
6
  meta content='width=device-width, initial-scale=1.0' name='viewport' /
7
+ link crossorigin="anonymous" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" rel="stylesheet" /
7
8
  = render 'beyond_canvas/custom/public_head'
8
9
 
9
10
  body.body--public
@@ -0,0 +1,19 @@
1
+ doctype html
2
+
3
+ html
4
+ head
5
+ = csrf_meta_tags
6
+ meta content='width=device-width, initial-scale=1.0' name='viewport' /
7
+ link crossorigin="anonymous" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" rel="stylesheet" /
8
+ = render 'beyond_canvas/custom/public_head'
9
+
10
+ body.body--single-page
11
+ main.main class=("#{params[:controller].gsub(/[\/_]/, "-")}--#{params[:action]}")
12
+ .main-wrapper
13
+ - logo = Dir["app/assets/images/logo.*"].first
14
+ - unless logo.nil?
15
+ - if File.extname(logo) == '.svg'
16
+ = inline_svg File.basename(logo), class: 'logo'
17
+ - else
18
+ = image_tag File.basename(logo), class: 'logo'
19
+ = yield
@@ -1,3 +1,3 @@
1
1
  module BeyondCanvas
2
- VERSION = "0.1.0.pre"
2
+ VERSION = "0.2.0.pre"
3
3
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BeyondCanvas
4
+ module FormUtils
5
+ module Generators
6
+ class InstallGenerator < Rails::Generators::Base
7
+ source_root File.expand_path("../../../templates", __FILE__)
8
+
9
+ def copy_initializer
10
+ template "beyond_canvas_form_utils.rb", "config/initializers/beyond_canvas_form_utils.rb"
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
4
+ if html_tag =~ /<(input|textarea|select)/
5
+ error_class = "form__error"
6
+
7
+ doc = Nokogiri::XML(html_tag)
8
+ doc.children.each do |field|
9
+ unless field["type"] == "hidden"
10
+ unless field["class"] =~ /\berror\b/
11
+ field["class"] = "#{field['class']} #{error_class}".strip
12
+ end
13
+ end
14
+ end
15
+
16
+ doc.to_html.html_safe
17
+ else
18
+ html_tag
19
+ end
20
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beyond_canvas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre
4
+ version: 0.2.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: 2019-07-18 00:00:00.000000000 Z
11
+ date: 2019-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bourbon
@@ -92,11 +92,15 @@ files:
92
92
  - app/assets/stylesheets/settings/_variables.sass
93
93
  - app/assets/stylesheets/utilities/_mixins.sass
94
94
  - app/form_builders/beyond_form_builder.rb
95
+ - app/helpers/beyond_canvas_helper.rb
95
96
  - app/views/beyond_canvas/custom/_public_head.html.slim
96
97
  - app/views/layouts/beyond_canvas/public.html.slim
98
+ - app/views/layouts/beyond_canvas/single_page.html.slim
97
99
  - beyond_canvas.gemspec
98
100
  - lib/beyond_canvas.rb
99
101
  - lib/beyond_canvas/version.rb
102
+ - lib/generators/beyond_canvas/form_utils/install_generator.rb
103
+ - lib/generators/templates/beyond_canvas_form_utils.rb
100
104
  homepage: https://github.com/ePages-de/beyond_canvas
101
105
  licenses:
102
106
  - MIT