From 3d145d6e548146bc3832e4e9b6a96746770061d0 Mon Sep 17 00:00:00 2001 From: benji Date: Fri, 11 Sep 2015 14:52:26 +0200 Subject: [PATCH] Add bootstrap --- Gemfile | 2 +- Gemfile.lock | 10 +- app/assets/stylesheets/application.css.scss | 6 +- app/assets/stylesheets/forms.css.scss | 38 -- app/assets/stylesheets/purecss.css.scss | 23 - app/assets/stylesheets/transactions.scss | 3 - .../{tables.css.scss => users.css.scss} | 11 +- app/assets/stylesheets/users.scss | 4 - app/views/partials/_form_errors.html.haml | 2 +- app/views/transactions/_new.html.haml | 21 +- app/views/users/show.html.haml | 34 +- .../assets/stylesheets/select2-bootstrap.css | 495 ++++++++++++++++++ 12 files changed, 542 insertions(+), 107 deletions(-) delete mode 100644 app/assets/stylesheets/forms.css.scss delete mode 100644 app/assets/stylesheets/transactions.scss rename app/assets/stylesheets/{tables.css.scss => users.css.scss} (87%) delete mode 100644 app/assets/stylesheets/users.scss create mode 100644 vendor/assets/stylesheets/select2-bootstrap.css diff --git a/Gemfile b/Gemfile index 0c579b9..dd4ef8f 100644 --- a/Gemfile +++ b/Gemfile @@ -89,4 +89,4 @@ gem 'high_voltage', '~> 2.4.0' # Errors on errbit gem 'airbrake' -gem 'font-awesome-sass' +gem 'bootstrap-sass', '~> 3.3.5' diff --git a/Gemfile.lock b/Gemfile.lock index ab5d11e..284d8f7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -43,9 +43,15 @@ GEM activerecord (>= 3.2, <= 4.3) rake (~> 10.4) arel (6.0.3) + autoprefixer-rails (6.0.2) + execjs + json bcrypt (3.1.10) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) + bootstrap-sass (3.3.5.1) + autoprefixer-rails (>= 5.0.0.1) + sass (>= 3.3.0) builder (3.2.2) byebug (6.0.2) cancancan (1.12.0) @@ -101,8 +107,6 @@ GEM i18n (~> 0.5) faraday (0.9.1) multipart-post (>= 1.2, < 3) - font-awesome-sass (4.4.0) - sass (>= 3.2) globalid (0.3.6) activesupport (>= 4.1.0) haml (4.0.7) @@ -283,6 +287,7 @@ PLATFORMS DEPENDENCIES airbrake annotate + bootstrap-sass (~> 3.3.5) byebug cancancan capistrano (~> 3.1) @@ -294,7 +299,6 @@ DEPENDENCIES devise factory_girl_rails faker - font-awesome-sass haml-rails (~> 0.9) high_voltage (~> 2.4.0) jbuilder (~> 2.0) diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index cd3c800..62fec6d 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -16,9 +16,11 @@ *= require select2 *= require_self *= require purecss + *= require select2-bootstrap */ -@import "font-awesome-sprockets"; -@import "font-awesome"; +@import "bootstrap-sprockets"; +@import "bootstrap"; + body { padding: 30px; } diff --git a/app/assets/stylesheets/forms.css.scss b/app/assets/stylesheets/forms.css.scss deleted file mode 100644 index 7fefc2c..0000000 --- a/app/assets/stylesheets/forms.css.scss +++ /dev/null @@ -1,38 +0,0 @@ -.panel { - margin-bottom: 1em; - border-radius: 3px; - border: 1px solid transparent; - .panel-header { - .panel-title { - font-size: 16px; - margin-top: 0; - margin-bottom: 0; - } - padding: 10px 15px; - border-bottom: 1px solid transparent; - } - .panel-body { - padding: 15px; - ul { - margin-bottom: 0px; - margin-top: 0px; - } - } -} - -.panel-default { - border-color: #ddd; - .panel-header { - border-color: #ddd; - background-color: #f5f5f5; - color: #333; - } -} - -.panel-error { - .panel-header { - color: #a94442; - background-color: #f2dede; - } - border: 1px solid #ebccd1; -} diff --git a/app/assets/stylesheets/purecss.css.scss b/app/assets/stylesheets/purecss.css.scss index 74a3630..f6647f5 100644 --- a/app/assets/stylesheets/purecss.css.scss +++ b/app/assets/stylesheets/purecss.css.scss @@ -43,26 +43,3 @@ background-color: rgb(83, 180, 79); color: #fff; } - -fieldset.pure-group-inline { - display: inline-block; - margin: 0; - padding: .35em 0 .75em; - border: 0; - .pure-group-addon { - padding: .5em .6em; - box-shadow: inset 0 1px 3px #ddd; - border: 1px solid #ccc; - white-space: nowrap; - border-collapse: separate; - margin-left: -4px; - &:last-child { - border-radius: 0 4px 4px 0; - } - &:first-child { - margin-left: 0; - border-radius: 4px 0 0 4px; - border-right: 0; - } - } -} diff --git a/app/assets/stylesheets/transactions.scss b/app/assets/stylesheets/transactions.scss deleted file mode 100644 index c402390..0000000 --- a/app/assets/stylesheets/transactions.scss +++ /dev/null @@ -1,3 +0,0 @@ -// Place all the styles related to the transactions controller here. -// They will automatically be included in application.css. -// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/tables.css.scss b/app/assets/stylesheets/users.css.scss similarity index 87% rename from app/assets/stylesheets/tables.css.scss rename to app/assets/stylesheets/users.css.scss index 0739d77..0dd0cb5 100644 --- a/app/assets/stylesheets/tables.css.scss +++ b/app/assets/stylesheets/users.css.scss @@ -31,17 +31,10 @@ table.pure-table-striped { } .data-table-filters { - .panel-body h4 { - margin-top: 0; - margin-bottom: 0; - } .pure-g { padding: 10px; - /* margin-bottom: 20px; */ padding-top: 20px; - /* border-top: 1px solid #bbb; */ &:first-child { - border-top: none; padding-top: 0px; } &:last-child { @@ -68,3 +61,7 @@ table.pure-table-striped { } } } + +.panel-body .form-inline > .input-group > .filter-align { + width: 200px; +} diff --git a/app/assets/stylesheets/users.scss b/app/assets/stylesheets/users.scss deleted file mode 100644 index c160de4..0000000 --- a/app/assets/stylesheets/users.scss +++ /dev/null @@ -1,4 +0,0 @@ -// Place all the styles related to the users controller here. -// They will automatically be included in application.css. -// You can use Sass (SCSS) here: http://sass-lang.com/ -.icon-euro:before { content:"\20AC"; } diff --git a/app/views/partials/_form_errors.html.haml b/app/views/partials/_form_errors.html.haml index 9949979..05d83db 100644 --- a/app/views/partials/_form_errors.html.haml +++ b/app/views/partials/_form_errors.html.haml @@ -1,5 +1,5 @@ #transaction_errors.panel.panel-error.hidden - .panel-header + .panel-heading %h3.panel-title This transaction could not be saved. .panel-body diff --git a/app/views/transactions/_new.html.haml b/app/views/transactions/_new.html.haml index 59c7a2d..ee751b1 100644 --- a/app/views/transactions/_new.html.haml +++ b/app/views/transactions/_new.html.haml @@ -2,22 +2,23 @@ Transaction created! = render 'partials/form_errors', object: @transaction -= form_for @transaction, remote: true, html: { class: "pure-form" } do |f| += form_for @transaction, remote: true, html: { class: "pure-form form-inline" } do |f| - if current_user.penning = f.collection_select :debtor, User.all, :name, :name, - { selected: @transaction.debtor.try(:name) || current_user.name }, { class: 'select2-selector'} + { selected: @transaction.debtor.try(:name) || current_user.name }, { class: 'select2-selector form-control'} - else = f.hidden_field :debtor, value: current_user.name - = f.select :creditor, - options_from_collection_for_select(User.all.order(:name), :name, :name), - { include_blank: true }, - { class: 'select2-selector', size: 50 } + = f.select :creditor, + options_from_collection_for_select(User.all.order(:name), :name, :name), + { include_blank: true }, + { class: 'select2-selector form-control', size: 50 } -# { class: 'select2-selector', size: 50, required: true } - = f.text_field :message, placeholder: "Message", size: 75 + = f.text_field :message, placeholder: "Message", size: 75, class: "form-control" -# = f.text_field :message, required: true, placeholder: "Message", size: 75 - %fieldset.pure-group-inline - %span.icon-euro.pure-group-addon + .input-group + %span.input-group-addon + %span.glyphicon.glyphicon-euro = f.number_field :euros, value: amount(@transaction.amount), - placeholder: "Bedrag", step: 0.01, min: 0.01, class: "pure-group-addon price", size: 20 + placeholder: "Bedrag", step: 0.01, min: 0.01, class: "form-control", size: 20 -# placeholder: "Bedrag", step: 0.01, min: 0.01, class: "pure-group-addon price", size: 20, required: true = f.submit "Send it!", class: "pure-button pure-button-primary" diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index 022c9bb..9da573b 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -3,27 +3,31 @@ = render 'transactions/new' .panel.panel-default.data-table-filters - .panel-header + .panel-heading %h3.panel-title Filters .panel-body .pure-g .bound.input-listen.pure-u-1{ 'data-input-type': 'date-range', 'data-filter-name': 'Time' } - %fieldset.pure-group-inline - %i.fa.fa-calendar.pure-group-addon - %input.lower-bound{type: 'date', placeholder: 'after', class: 'pure-group-addon'} - \- - %fieldset.pure-group-inline - %i.fa.fa-calendar.pure-group-addon - %input.upper-bound{type: 'date', placeholder: 'after', class: 'pure-group-addon'} + %form.form-inline + .input-group + %span.input-group-addon + %span.glyphicon.glyphicon-calendar + %input.lower-bound.form-control.filter-align{type: 'date', placeholder: 'after', class: 'pure-group-addon'} + .input-group + %span.input-group-addon + %span.glyphicon.glyphicon-calendar + %input.upper-bound.form-control.filter-align{type: 'date', placeholder: 'after', class: 'pure-group-addon'} .pure-g .bound.input-listen.pure-u-1{ 'data-input-type': 'number-range', 'data-filter-name': 'Amount' } - %fieldset.pure-group-inline - %span.icon-euro.pure-group-addon - %input.lower-bound.pure-group-addon{type: 'number', placeholder: 'Minimum'} - \- - %fieldset.pure-group-inline - %span.icon-euro.pure-group-addon - %input.upper-bound.pure-group-addon{type: 'number', placeholder: 'Maximum'} + %form.form-inline + .input-group + %span.input-group-addon + %span.glyphicon.glyphicon-euro + %input.lower-bound.form-control.filter-align{type: 'number', placeholder: 'Minimum'} + .input-group + %span.input-group-addon + %span.glyphicon.glyphicon-euro + %input.upper-bound.form-control.filter-align{type: 'number', placeholder: 'Maximum'} .pure-g .input-listen.pure-u-md-1-4{ 'data-input-type': 'text', 'data-filter-name': 'Issuer' } %input{type: 'text', placeholder: 'Filter on Issuer'} diff --git a/vendor/assets/stylesheets/select2-bootstrap.css b/vendor/assets/stylesheets/select2-bootstrap.css new file mode 100644 index 0000000..9efb1a9 --- /dev/null +++ b/vendor/assets/stylesheets/select2-bootstrap.css @@ -0,0 +1,495 @@ +/*! Select2 Bootstrap 3 CSS v1.4.6 | MIT License | github.com/t0m/select2-bootstrap-css */ +/** + * Reset Bootstrap 3 .form-control styles which - if applied to the + * original element Select2 is replacing not be properly being hidden + * when used in a "Bootstrap Input Group with Addon". + **/ +.select2-offscreen, +.select2-offscreen:focus { + width: 1px !important; + height: 1px !important; + position: absolute !important; +}