administrador 0.0.8.pre → 0.0.9.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: 72f3ee1f30bc307527f3ee950a6d2cfaaf1b2e52e7cfac3dbf59c45e70f2d206
4
- data.tar.gz: 4098c436692c9e12111115927e33f4f3cebbea76c254e9f9cc9143e27a20c529
3
+ metadata.gz: 46048331e06682dab34b2e1c9547ec55069fc7e8808b58c895c2aec832e59c60
4
+ data.tar.gz: 2268651c5949d3d63ab414ecfbd9b0492dec267edf2bacbb06f39eafb014ec4f
5
5
  SHA512:
6
- metadata.gz: '059972c6e93e90557716bb18f09e921b4e0deafbc246b4bea703cad5d49b9c64e68939eab8d7299dda120b1b1a39b0b742cc0f24af3d5cf6a6bf49d0297f2e4d'
7
- data.tar.gz: '0859d6c37619b08ce66d863163978efed06e3e364d3ad8c236475bab6e800d74a57cc93997706e5aaba6c4dab7aca18a181a168bd4f378d698c038162a7d5d61'
6
+ metadata.gz: eb7ed2cd43aa10b92f6d9447f084bf5c073d06a736372080cbd120351a92bc7cf7998a7fade196b27ccf17925c645bbd81bb2830fd26f1e782d32481078a5b11
7
+ data.tar.gz: 2a6a06e9f69e3224050ecb876aba79d72c64d0f0d5c335b0df79c28d91a306eba8e261f75932de17e800a00d7ec2b5cf31b9ef369cc7ba66285e787fbbf69869
@@ -0,0 +1,104 @@
1
+ # Usage:
2
+ #
3
+ # Put all the content that is not in the sidebar in a container with the id #main-content a trigger button and add a sidebar.
4
+ #
5
+ # <body>
6
+ # <div id="main-content">
7
+ # <button data-sidebar-trigger="#example-sidebar">
8
+ # Toggle the example sidebar!
9
+ # </button>
10
+ # </div>
11
+ # <aside
12
+ # id="example-sidebar">
13
+ # data-sidebar-load="/de/backend/authentifizierung/user_sidebar.html"
14
+ # data-sidebar-mode="overlay"
15
+ # data-sidebar-position="right"
16
+ # data-sidebar-size="20rem"
17
+ # data-sidebar-state="closed"
18
+ # <h3>Hello from the example sidebar!</h3>
19
+ # </aside>
20
+ # </body>
21
+ #
22
+ # Options:
23
+ #
24
+ # load: Passing an url to load will load the content of the url via ajax and display it in the sidebar.
25
+ # mode:
26
+ # push: This will decrease the size of the main content, making room for the sidebar.
27
+ # overlay: This will show the sidebar on top of the content, without moving it.
28
+ # modal: Like overlay, but with a modal background.
29
+ # position: left|right|top|bottom
30
+ # size: size that the sidebar will take up (width for left and right, height for top and bottom). Pass any css size in px, rem or whatever you like.
31
+ #
32
+ $ ->
33
+ $('body').on 'click', '#sidebar-modal-background', ->
34
+ target = $("##{$(@).data('sidebar-target')}")
35
+ closeModal(target)
36
+
37
+ $('[data-sidebar-position]').each (_, e) ->
38
+ position = $(@).data('sidebar-position')
39
+ $(e).addClass("sidebar sidebar-#{position}")
40
+ if $(@).data('sidebar-state') == 'opened'
41
+ openModal($(@))
42
+
43
+ $('[data-sidebar-trigger]').on 'click', ->
44
+ target = $($(@).data('sidebar-trigger'))
45
+ state = target.data('sidebar-state')
46
+
47
+ if state == 'closed'
48
+ openModal(target)
49
+ else
50
+ closeModal(target)
51
+
52
+ openModal = (target) ->
53
+ main_content = $('#main-content')
54
+
55
+ position = target.data('sidebar-position')
56
+ mode = target.data('sidebar-mode')
57
+ size_attribute = if position in ['top', 'bottom'] then 'height' else 'width'
58
+ size = target.data('sidebar-size')
59
+
60
+ target.css("display", "inherit")
61
+ target.css(size_attribute, size)
62
+ main_content.css("margin-#{position}", size) if mode == 'push'
63
+
64
+
65
+ # modal
66
+ if mode == 'modal'
67
+ $("body").append("<div id=\"sidebar-modal-background\" data-sidebar-target=\"#{target.attr('id')}\"></div>")
68
+
69
+ # load
70
+ if target.data('sidebar-load')
71
+ url = target.data('sidebar-load')
72
+ $.ajax
73
+ type: 'GET'
74
+ url: url
75
+ success: (response) ->
76
+ $(target).html(response)
77
+ return
78
+
79
+ # set state
80
+ target.data('sidebar-state', 'opened')
81
+
82
+ closeModal = (target) ->
83
+ main_content = $('#main-content')
84
+
85
+ position = target.data('sidebar-position')
86
+ mode = target.data('sidebar-mode')
87
+ size_attribute = if position in ['top', 'bottom'] then 'height' else 'width'
88
+ size = target.data('sidebar-size')
89
+
90
+ # push
91
+ if mode == 'push'
92
+ main_content.css("margin-#{position}", size)
93
+
94
+ # modal
95
+ if mode == 'modal'
96
+ $("#sidebar-modal-background").remove()
97
+
98
+ target.css(size_attribute, '0px')
99
+
100
+ if mode == 'push'
101
+ main_content.css("margin-#{position}", '0px')
102
+
103
+ # set state
104
+ target.data('sidebar-state', 'closed')
@@ -0,0 +1,13 @@
1
+ #main-breadcrumbs {
2
+ background-color: #e2e6ea;
3
+ margin-top: 4rem;
4
+ }
5
+
6
+ #main-breadcrumbs ol.breadcrumb {
7
+ background-color: inherit !important;
8
+ margin-bottom: 0;
9
+ /*
10
+ padding-left: 0;
11
+ padding-right: 0;
12
+ */
13
+ }
@@ -2,6 +2,10 @@ body {
2
2
  font-family: 'Poppins', sans-serif;
3
3
  }
4
4
 
5
+ #main-container {
6
+ padding-top: 1rem;
7
+ }
8
+
5
9
  #main-navbar-tools .navbar-nav {
6
10
  flex-direction: row;
7
11
  flex-wrap: wrap;
@@ -35,9 +39,3 @@ body {
35
39
  #main-sidebar-bottom-content .btn {
36
40
  margin-bottom: 0.75rem;
37
41
  }
38
-
39
- #main-breadcrumbs ol.breadcrumb {
40
- background-color: inherit !important;
41
- padding-left: 0;
42
- padding-right: 0;
43
- }
@@ -0,0 +1,51 @@
1
+ .sidebar {
2
+ position: fixed;
3
+ z-index: 3000;
4
+ overflow-x: hidden;
5
+ transition: 0.5s;
6
+ }
7
+
8
+ .sidebar-left {
9
+ height: 100%;
10
+ width: 0;
11
+ top: 0;
12
+ left: 0;
13
+ }
14
+ .sidebar-right {
15
+ height: 100%;
16
+ width: 0;
17
+ top: 0;
18
+ right: 0;
19
+ }
20
+ .sidebar-top {
21
+ width: 100%;
22
+ height: 0;
23
+ left: 0;
24
+ top: 0;
25
+ }
26
+ .sidebar-bottom {
27
+ width: 100%;
28
+ height: 0;
29
+ left: 0;
30
+ bottom: 0;
31
+ }
32
+
33
+ #sidebar-modal-background {
34
+ position: fixed;
35
+ z-index: 2000;
36
+ left: 0;
37
+ top: 0;
38
+ width: 100%;
39
+ height: 100%;
40
+ background-color: rgb(0,0,0);
41
+ background-color: rgba(0,0,0,0.4);
42
+ }
43
+
44
+ #main-content {
45
+ transition: margin .5s;
46
+ }
47
+
48
+ /* @media screen and (max-height: 450px) {
49
+ .sidebar {padding-top: 15px;}
50
+ .sidebar a {font-size: 18px;}
51
+ } */
@@ -16,6 +16,15 @@ module Administrador
16
16
  end
17
17
  end
18
18
 
19
+ def url_for?(*routable)
20
+ begin
21
+ c.url_for(*routable)
22
+ true
23
+ rescue ActionController::UrlGeneratrionError
24
+ false
25
+ end
26
+ end
27
+
19
28
  def generate_breadcrumbs!
20
29
  [].tap do |breadcrumbs|
21
30
  breadcrumbs << { label: t('.home'), url: c.administrador.root_path, link_html_options: {}, li_html_options: {}}
@@ -24,9 +33,10 @@ module Administrador
24
33
  breadcrumbs << { label: t("classes.#{c.current_engine.name.underscore}"), url: send(c.current_engine.engine_name).root_path, link_html_options: {}, li_html_options: {} }
25
34
  end
26
35
 
27
- # if c.respond_to?(:resource_class, true)
28
- # breadcrumbs << { label: c.resource_class.model_name.human(count: :other), url: c.url_for(action: :index), link_html_options: {}, li_html_options: {} }
29
- # end
36
+ # if c.respond_to?(:resource_class, true) && c.respond_to?(:available_rest_actions) && c.available_rest_actions.include?(:index)
37
+ if c.respond_to?(:resource_class, true) && url_for?(action: :index)
38
+ breadcrumbs << { label: c.resource_class.model_name.human(count: :other), url: c.url_for(action: :index), link_html_options: {}, li_html_options: {} }
39
+ end
30
40
 
31
41
  if r = c.instance_variable_get(:@resource).presence
32
42
  if r.persisted?
@@ -40,7 +50,7 @@ module Administrador
40
50
 
41
51
  action_namespace = c.respond_to?(:service_class, true) ? :service : :default
42
52
 
43
- if %w(new edit).include?(c.action_name)
53
+ if %w(new edit).include?(c.action_name) && url_for?(action: c.action_name)
44
54
  breadcrumbs << { label: t("controller.breadcrumbs_concern.actions.#{action_namespace}.#{c.action_name}"), url: { action: c.action_name }, link_html_options: {}, li_html_options: {} }
45
55
  end
46
56
 
@@ -43,11 +43,13 @@
43
43
  .col-12.px-0
44
44
  #main-navbar.mb-4
45
45
  = render '/administrador/application/navbar'
46
- .container-fluid
46
+ #main-breadcrumbs.container-fluid
47
+ .row
48
+ .col-12
49
+ = breadcrumbs(self).render
50
+ #main-container.container-fluid
47
51
  .row
48
52
  .col-12
49
- #main-breadcrumbs
50
- = breadcrumbs(self).render
51
53
  #main-content
52
54
  #flash-messages
53
55
  = administrador_helper(self).flash_messages
@@ -1,3 +1,3 @@
1
1
  module Administrador
2
- VERSION = '0.0.8.pre'.freeze
2
+ VERSION = '0.0.9.pre'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: administrador
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8.pre
4
+ version: 0.0.9.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Vasquez Angel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-01 00:00:00.000000000 Z
11
+ date: 2019-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -58,84 +58,84 @@ dependencies:
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 0.0.16.pre
61
+ version: 0.0.18.pre
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 0.0.16.pre
68
+ version: 0.0.18.pre
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rao-component
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 0.0.16.pre
75
+ version: 0.0.18.pre
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 0.0.16.pre
82
+ version: 0.0.18.pre
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rao-resource_controller
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 0.0.16.pre
89
+ version: 0.0.18.pre
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 0.0.16.pre
96
+ version: 0.0.18.pre
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rao-resources_controller
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 0.0.16.pre
103
+ version: 0.0.18.pre
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: 0.0.16.pre
110
+ version: 0.0.18.pre
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rao-service_controller
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: 0.0.16.pre
117
+ version: 0.0.18.pre
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: 0.0.16.pre
124
+ version: 0.0.18.pre
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rao-view_helper
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ">="
130
130
  - !ruby/object:Gem::Version
131
- version: 0.0.16.pre
131
+ version: 0.0.18.pre
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
- version: 0.0.16.pre
138
+ version: 0.0.18.pre
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: route_translator
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -372,17 +372,20 @@ files:
372
372
  - Rakefile
373
373
  - app/assets/config/administrador_manifest.js
374
374
  - app/assets/javascripts/administrador/application.js
375
+ - app/assets/javascripts/administrador/application/sidebar.js.coffee~
375
376
  - app/assets/stylesheets/administrador/application.css
376
377
  - app/assets/stylesheets/administrador/application/bootstrap-btn-responsive.css
377
378
  - app/assets/stylesheets/administrador/application/bootstrap-btn-xs.css
378
379
  - app/assets/stylesheets/administrador/application/bootstrap-circular-buttons.css
379
380
  - app/assets/stylesheets/administrador/application/bootstrap-table-xs.css
381
+ - app/assets/stylesheets/administrador/application/breadcrumbs.css
380
382
  - app/assets/stylesheets/administrador/application/colors.css
381
383
  - app/assets/stylesheets/administrador/application/engine-sidebar.css
382
384
  - app/assets/stylesheets/administrador/application/forms.css
383
385
  - app/assets/stylesheets/administrador/application/layout.css
384
386
  - app/assets/stylesheets/administrador/application/page-actions.css
385
387
  - app/assets/stylesheets/administrador/application/query_form.css
388
+ - app/assets/stylesheets/administrador/application/sidebar.css~
386
389
  - app/concerns/administrador/controller/application_concern.rb
387
390
  - app/concerns/administrador/controller/engine_concern.rb
388
391
  - app/concerns/administrador/controller/resource_concern.rb