sigbit_admin_rails 0.0.6 → 0.1.0

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
  SHA1:
3
- metadata.gz: 7433712d9c52b41a0b63a609a53a9ff94cc7adac
4
- data.tar.gz: ad950a2299649f840d0d7d618ff480caeef7c972
3
+ metadata.gz: b53d73551c6f0c1f38740f684c8ac29535acd202
4
+ data.tar.gz: 7c650a13f8a66c4a759709cb257d4aaaef36ea55
5
5
  SHA512:
6
- metadata.gz: 0f7ca3984dbd44536ed54f1ebe01d848a0c62927bde7a788e687006d55d5ff95cffbc5d0aa3684d65b07712aaa5527982a0309ef9aa0ee7b4fb62aa09529ad40
7
- data.tar.gz: 27f735b7418a33e92cb157cb45f353c77d8bdf49c0c428f97c2d79efa23cf0dab2bb24314e1ea3960c9650b7a62f1d528fcba89d5dd99a444a4f7664c937d5d6
6
+ metadata.gz: fa289043f88af536057db76ebce0f796a1b1eec31278cbd0e0d842514392cd074259942a0cbc4b29fcbcaff5f1fb68c59c310d29c54d2b3a109acff78d2eb115
7
+ data.tar.gz: 606241b3ea4f7d6ad2b0f79ef2737499a9a169b49c94ac5e71055e8198f876b86ef8e337fcb29abd77fb46fa466cc782b858d9a3b412dbb08d87cc9d0ba77002
@@ -0,0 +1,36 @@
1
+ /*
2
+ By Osvaldas Valutis, www.osvaldas.info
3
+ Available for use under the MIT License
4
+ */
5
+
6
+ 'use strict';
7
+
8
+ ;( function( $, window, document, undefined )
9
+ {
10
+ $( '.inputfile' ).each( function()
11
+ {
12
+ var $input = $( this ),
13
+ $label = $input.next( 'label' ),
14
+ labelVal = $label.html();
15
+
16
+ $input.on( 'change', function( e )
17
+ {
18
+ var fileName = '';
19
+
20
+ if( this.files && this.files.length > 1 )
21
+ fileName = ( this.getAttribute( 'data-multiple-caption' ) || '' ).replace( '{count}', this.files.length );
22
+ else if( e.target.value )
23
+ fileName = e.target.value.split( '\\' ).pop();
24
+
25
+ if( fileName )
26
+ $label.find( 'span' ).html( fileName );
27
+ else
28
+ $label.html( labelVal );
29
+ });
30
+
31
+ // Firefox bug fix
32
+ $input
33
+ .on( 'focus', function(){ $input.addClass( 'has-focus' ); })
34
+ .on( 'blur', function(){ $input.removeClass( 'has-focus' ); });
35
+ });
36
+ })( jQuery, window, document );
@@ -1,4 +1,9 @@
1
- 'use strict';
1
+ //=require jquery.js
2
+ //=require tether.js
3
+ //=require bootstrap.js
4
+ //=require libs/jquery.custom-file-input.js
5
+ //=require libs/jquery.nestable.js
6
+ //=require libs/jquery.sortable.min.js
2
7
 
3
8
  $(document).ready(function() {
4
9
  $('.inputfile').each(function () {
@@ -0,0 +1,22 @@
1
+ .devise-wrapper {
2
+ @include display(flex);
3
+ @include flex-direction(column);
4
+ @include justify-content(center);
5
+ min-height: 100vh;
6
+ width: 100%;
7
+ background-color: $devise-background-color;
8
+
9
+ .devise-container {
10
+ padding-top: $spacer*3;
11
+ padding-bottom: $spacer*3;
12
+ }
13
+
14
+ a.previous-page {
15
+ display: inline-block;
16
+ padding-bottom: $spacer*0.5;
17
+ font-size: $font-size-lg;
18
+ color: $devise-previous-link-color;
19
+
20
+ i { margin-right: $spacer*0.5; }
21
+ }
22
+ }
@@ -9,24 +9,27 @@
9
9
 
10
10
  // sidebar toggle
11
11
  #sidebar-toggle {
12
- @include position(absolute, 0 null -1px 0);
13
- padding: 0 $spacer;
14
- border-radius: 0;
15
- outline: 0 !important;
16
- font-size: 1em;
17
- color: $gray;
18
- transition: opacity 200ms ease;
12
+ display: inline-block;
13
+
14
+ div {
15
+ @include position(absolute, 0 null 0 0);
16
+ padding: 0 $spacer;
17
+ font-size: 1rem;
18
+ color: $gray;
19
+ cursor: pointer;
20
+ line-height: $header-navbar-height;
21
+ }
19
22
 
20
23
  i {
21
24
  margin-right: 0.5em;
22
- font-size: 1.3em;
23
- vertical-align: text-bottom;
25
+ font-size: 1.2em;
24
26
  color: $gray-dark;
25
27
  }
26
28
 
27
29
  &:hover {
28
30
  opacity: 0.7;
29
31
  }
32
+
30
33
  }
31
34
 
32
35
  .navbar-brand {
@@ -51,6 +54,7 @@
51
54
  height: 100%;
52
55
  padding: 0;
53
56
  font-size: 1rem;
57
+ color: $gray-dark;
54
58
 
55
59
  @include media-breakpoint-down(sm) {
56
60
  padding: 0 $spacer;
@@ -66,3 +70,17 @@
66
70
 
67
71
 
68
72
  }
73
+
74
+ #wrapper {
75
+ #sidebar-toggle > div {
76
+ &:nth-child(1) { opacity: 1; visibility: visible; }
77
+ &:nth-child(2) { opacity: 0; visibility: hidden; }
78
+ }
79
+
80
+ &.toggled {
81
+ #sidebar-toggle > div {
82
+ &:nth-child(1) { opacity: 0; visibility: hidden; }
83
+ &:nth-child(2) { opacity: 1; visibility: visible; }
84
+ }
85
+ }
86
+ }
@@ -125,7 +125,7 @@ body {
125
125
 
126
126
  .sidebar-brand {
127
127
  display: block;
128
- width: 100%;
128
+ width: $sidebar-width;
129
129
  height: $header-navbar-height;
130
130
  background: $sidebar-brand-bg url($sidebar-logotype) no-repeat $sidebar-logotype-position;
131
131
  background-size: $sidebar-logotype-size;
@@ -4,13 +4,13 @@
4
4
 
5
5
  @import 'mixins/nestable';
6
6
 
7
+ @import 'components/devise';
7
8
  @import 'components/header-navbar';
8
9
  @import 'components/sidebar';
9
10
  @import 'components/page-header';
10
11
  @import 'components/card';
11
12
  @import 'components/btn-circle';
12
13
  @import 'components/small-action-btns';
13
- @import 'components/action-toolbar';
14
14
  @import 'components/file-input';
15
15
  @import 'components/nestable';
16
16
  @import 'components/sortable';
@@ -673,15 +673,20 @@ $pre-scrollable-max-height: 340px !default;
673
673
  // Logotypes
674
674
  // On mobile the sidebar logotype is replaced with the header navbar logotype
675
675
 
676
- $sidebar-logotype: "http://www.significantbit.se/assets/logotype-white-3c67dd843e7b7c0f1432300d1226e6af0f655e0dff2b26f098659bb4fda48d8a.svg" !default;
676
+ $sidebar-logotype: "https://www.significantbit.se/assets/logotype-white-3c67dd843e7b7c0f1432300d1226e6af0f655e0dff2b26f098659bb4fda48d8a.svg" !default;
677
677
  $sidebar-logotype-position: center center !default;
678
678
  $sidebar-logotype-size: auto 35% !default;
679
679
 
680
- $header-navbar-logotype: "http://www.significantbit.se/assets/logotype-2b1fd527c1bed395289dcef8bdf490100f0c3303786007178694802beb83fbc8.svg" !default;
680
+ $header-navbar-logotype: "https://www.significantbit.se/assets/logotype-2b1fd527c1bed395289dcef8bdf490100f0c3303786007178694802beb83fbc8.svg" !default;
681
681
  $header-navbar-logotype-width: 25% !default;
682
682
  $header-navbar-logotype-height: 60% !default;
683
683
 
684
684
 
685
+ // Devise
686
+
687
+ $devise-background-color: $brand-primary;
688
+ $devise-previous-link-color: white;
689
+
685
690
  // Sidebar
686
691
 
687
692
  $sidebar-bg: #2d2f40 !default;
@@ -0,0 +1,86 @@
1
+ require 'rails/generators/base'
2
+
3
+ module SigbitAdminRails
4
+ module Generators
5
+ module ViewPathTemplates
6
+ extend ActiveSupport::Concern
7
+ included do
8
+ argument :scope, required: false, default: nil,
9
+ desc: "The scope to copy views to"
10
+
11
+ class_option :form_builder, aliases: "-b"
12
+
13
+ public_task :copy_views
14
+ end
15
+
16
+ def copy_views
17
+ view_directory :sessions
18
+ view_directory :passwords
19
+ end
20
+
21
+ protected
22
+
23
+ def view_directory(name, _target_path = nil)
24
+ directory name.to_s, _target_path || "#{target_path}/#{name}" do |content|
25
+ if scope
26
+ content.gsub "devise/shared/links", "#{plural_scope}/shared/links"
27
+ else
28
+ content
29
+ end
30
+ end
31
+ end
32
+
33
+ def target_path
34
+ @target_path ||= "app/views/#{plural_scope ||= :devise}"
35
+ end
36
+
37
+ def plural_scope
38
+ @plural_scope ||= scope.presence && scope.underscore.pluralize
39
+ end
40
+ end
41
+
42
+ class FormForGenerator < Rails::Generators::Base #:nodoc:
43
+ include ViewPathTemplates
44
+ source_root File.expand_path("../../templates/form_for", __FILE__)
45
+ desc "Copies default Devise views to your application."
46
+ end
47
+
48
+ class SimpleFormForGenerator < Rails::Generators::Base #:nodoc:
49
+ include ViewPathTemplates
50
+ source_root File.expand_path("../../templates/simple_form_for", __FILE__)
51
+ desc "Copies simple form enabled views to your application."
52
+ end
53
+
54
+ class ViewsGenerator < Rails::Generators::Base
55
+ source_root File.expand_path("../../templates", __FILE__)
56
+
57
+ desc "Copies Devise views to your application."
58
+
59
+ argument :scope, required: false, default: nil,
60
+ desc: "The scope to copy views to"
61
+
62
+ hook_for :form_builder, aliases: "-b",
63
+ desc: "Form builder to be used",
64
+ default: defined?(SimpleForm) ? "simple_form_for" : "form_for"
65
+
66
+ def copy_devise_layout
67
+ copy_file "layouts/devise.html.erb", "app/views/layouts/devise.html.erb"
68
+ end
69
+
70
+ def setup_devise_initializer
71
+ insert_into_file "config/initializers/devise.rb", before: 'Devise.setup do |config|' do
72
+ <<~BLOCK
73
+ Rails.application.config.to_prepare do
74
+ Devise::SessionsController.layout "devise"
75
+ Devise::RegistrationsController.layout proc { |controller| user_signed_in? ? "application" : "devise" }
76
+ Devise::ConfirmationsController.layout "devise"
77
+ Devise::UnlocksController.layout "devise"
78
+ Devise::PasswordsController.layout "devise"
79
+ end
80
+ BLOCK
81
+ end
82
+ end
83
+
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,24 @@
1
+ <div class="col-sm-8 col-lg-6 offset-sm-2 offset-lg-3">
2
+ <%= link_to new_user_session_path, class: 'previous-page' do %>
3
+ <i class="fa fa-arrow-left" aria-hidden="true"></i><%= t('.sign_in') %>
4
+ <% end %>
5
+ <div class="card">
6
+ <div class="card-block">
7
+ <h2 class="card-title text-xs-center"><%= t('devise.passwords.title') %></h2>
8
+ <p class="card-text text-xs-center"><%= t('devise.passwords.info') %></p>
9
+ <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
10
+
11
+
12
+ <%= devise_error_messages! %>
13
+
14
+ <div class="form-group">
15
+ <%= f.label :email %><br />
16
+ <%= f.email_field :email, autofocus: true %>
17
+ </div>
18
+
19
+ <%= f.submit "Send me reset password instructions", class: 'btn btn-lg btn-primary btn-block' %>
20
+
21
+ <% end %>
22
+ </div>
23
+ </div>
24
+ <%= render "devise/shared/links" %>
@@ -0,0 +1,32 @@
1
+ <div class="col-sm-8 col-lg-6 offset-sm-2 offset-lg-3">
2
+ <div class="card">
3
+ <div class="card-block">
4
+ <h2 class="card-title text-xs-center"><%= t('devise.sessions.new.title') %></h2>
5
+ <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
6
+ <div class="form-group">
7
+ <%= f.label :email %><br />
8
+ <%= f.email_field :email, autofocus: true %>
9
+ </div>
10
+ <div class="form-group">
11
+ <%= f.label :password %><br />
12
+ <%= f.password_field :password, autocomplete: "off" %>
13
+ </div>
14
+
15
+ <div class="row">
16
+ <div class="col-xs-6">
17
+ <div class="form-check">
18
+ <%= f.input :remember_me, as: :boolean if devise_mapping.rememberable? %>
19
+ </div>
20
+ </div>
21
+ <div class="col-xs-6 text-xs-right">
22
+ <%= link_to t('devise.password.forgot'), new_user_password_path %>
23
+ </div>
24
+ </div>
25
+
26
+ <%= f.submit "Log in", class: 'btn btn-lg btn-primary btn-block' %>
27
+ <% end %>
28
+ </div>
29
+ </div>
30
+ </div>
31
+
32
+ <%= render "devise/shared/links" %>
@@ -0,0 +1,21 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>SigbitAdminRails</title>
5
+ <%= csrf_meta_tags %>
6
+
7
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
8
+ <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
9
+ </head>
10
+
11
+ <body>
12
+
13
+ <div class="devise-wrapper">
14
+ <div class="container devise-container">
15
+ <div class="row">
16
+ <%= yield %>
17
+ </div>
18
+ </div>
19
+ </div>
20
+ </body>
21
+ </html>
@@ -0,0 +1,22 @@
1
+ <div class="col-sm-8 col-lg-6 offset-sm-2 offset-lg-3">
2
+ <%= link_to new_user_session_path, class: 'previous-page' do %>
3
+ <i class="fa fa-arrow-left" aria-hidden="true"></i><%= t('.sign_in') %>
4
+ <% end %>
5
+ <div class="card">
6
+ <div class="card-block">
7
+ <h2 class="card-title text-xs-center"><%= t('devise.passwords.title') %></h2>
8
+ <p class="card-text text-xs-center"><%= t('devise.passwords.info') %></p>
9
+ <%= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
10
+
11
+ <%= f.error_notification %>
12
+
13
+ <div class="form-group">
14
+ <%= f.input :email, required: true, autofocus: true, input_html: {class: 'form-control form-control-lg'} %>
15
+ </div>
16
+
17
+ <%= f.button :submit, "Send me reset password instructions", class: 'btn btn-lg btn-primary btn-block' %>
18
+
19
+ <% end %>
20
+ </div>
21
+ </div>
22
+ <%= render "devise/shared/links" %>
@@ -0,0 +1,30 @@
1
+ <div class="col-sm-8 col-lg-6 offset-sm-2 offset-lg-3">
2
+ <div class="card">
3
+ <div class="card-block">
4
+ <h2 class="card-title text-xs-center"><%= t('devise.sessions.new.title') %></h2>
5
+ <%= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
6
+ <div class="form-group">
7
+ <%= f.input :email, required: false, autofocus: true, input_html: {class: 'form-control form-control-lg'} %>
8
+ </div>
9
+ <div class="form-group">
10
+ <%= f.input :password, required: false, input_html: {class: 'form-control form-control-lg'} %>
11
+ </div>
12
+
13
+ <div class="row">
14
+ <div class="col-xs-6">
15
+ <div class="form-check">
16
+ <%= f.input :remember_me, as: :boolean if devise_mapping.rememberable? %>
17
+ </div>
18
+ </div>
19
+ <div class="col-xs-6 text-xs-right">
20
+ <%= link_to t('devise.password.forgot'), new_user_password_path %>
21
+ </div>
22
+ </div>
23
+
24
+ <%= f.button :submit, "Log in", class: 'btn btn-lg btn-primary btn-block' %>
25
+ <% end %>
26
+ </div>
27
+ </div>
28
+ </div>
29
+
30
+ <%= render "devise/shared/links" %>
metadata CHANGED
@@ -1,16 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sigbit_admin_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ante Wall
8
8
  - Andreas Antonsson
9
- - Johan André
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2016-07-06 00:00:00.000000000 Z
12
+ date: 2016-12-22 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: bourbon
@@ -32,14 +31,14 @@ dependencies:
32
31
  requirements:
33
32
  - - "~>"
34
33
  - !ruby/object:Gem::Version
35
- version: 4.0.0.alpha4
34
+ version: 4.0.0.alpha5
36
35
  type: :runtime
37
36
  prerelease: false
38
37
  version_requirements: !ruby/object:Gem::Requirement
39
38
  requirements:
40
39
  - - "~>"
41
40
  - !ruby/object:Gem::Version
42
- version: 4.0.0.alpha4
41
+ version: 4.0.0.alpha5
43
42
  description: Gem for including sigbit-admin and helpers for Rails applications
44
43
  email:
45
44
  - antewall@gmail.com
@@ -47,14 +46,15 @@ executables: []
47
46
  extensions: []
48
47
  extra_rdoc_files: []
49
48
  files:
50
- - assets/javascripts/jquery.nestable.js
51
- - assets/javascripts/jquery.sortable.min.js
49
+ - assets/javascripts/libs/jquery.custom-file-input.js
50
+ - assets/javascripts/libs/jquery.nestable.js
51
+ - assets/javascripts/libs/jquery.sortable.min.js
52
52
  - assets/javascripts/sigbit-admin.js
53
+ - assets/stylesheets/components/_devise.scss
53
54
  - assets/stylesheets/components/_forms.scss
54
55
  - assets/stylesheets/components/_header-navbar.scss
55
56
  - assets/stylesheets/components/_sidebar.scss
56
57
  - assets/stylesheets/components/_toggle-button.scss
57
- - assets/stylesheets/components/action-toolbar.scss
58
58
  - assets/stylesheets/components/btn-circle.scss
59
59
  - assets/stylesheets/components/card.scss
60
60
  - assets/stylesheets/components/file-input.scss
@@ -64,8 +64,13 @@ files:
64
64
  - assets/stylesheets/components/sortable.scss
65
65
  - assets/stylesheets/mixins/nestable.scss
66
66
  - assets/stylesheets/sigbit-admin.scss
67
- - assets/stylesheets/style.scss
68
67
  - assets/stylesheets/variables.scss
68
+ - lib/generators/sigbit_admin_rails/views_generator.rb
69
+ - lib/generators/templates/form_for/passwords/new.html.erb
70
+ - lib/generators/templates/form_for/sessions/new.html.erb
71
+ - lib/generators/templates/layouts/devise.html.erb
72
+ - lib/generators/templates/simple_form_for/passwords/new.html.erb
73
+ - lib/generators/templates/simple_form_for/sessions/new.html.erb
69
74
  - lib/sigbit_admin_rails.rb
70
75
  - lib/sigbit_admin_rails/helpers/application_helper.rb
71
76
  - lib/sigbit_admin_rails/helpers/sidebar_helper.rb
@@ -1,14 +0,0 @@
1
- .action-toolbar {
2
- position: relative;
3
- padding: $action-toolbar-padding;
4
- @include clearfix;
5
-
6
- > * {
7
- margin-left: $spacer/2;
8
- margin-top: 0;
9
- margin-bottom: 0;
10
- &:first-child {
11
- margin-left: 0;
12
- }
13
- }
14
- }
@@ -1,18 +0,0 @@
1
- @import 'bourbon';
2
- @import 'variables';
3
- @import "node_modules/bootstrap/scss/bootstrap";
4
-
5
- @import 'mixins/nestable';
6
-
7
- @import 'components/header-navbar';
8
- @import 'components/sidebar';
9
- @import 'components/page-header';
10
- @import 'components/card';
11
- @import 'components/btn-circle';
12
- @import 'components/small-action-btns';
13
- @import 'components/action-toolbar';
14
- @import 'components/file-input';
15
- @import 'components/nestable';
16
- @import 'components/sortable';
17
- @import 'components/toggle-button';
18
- @import 'components/forms';