itsf_backend 3.0.2 → 3.0.3

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: 0aa67a62f46eec27de9f3bc8d811708cfaa93f3d
4
- data.tar.gz: 36d7dd982be6f157d03691c1ae801400a6357130
3
+ metadata.gz: 5691ac4f916cbb8e579376b552022c306c95ed07
4
+ data.tar.gz: 14463dc4f14178a8522811d95cdf2938193d5fda
5
5
  SHA512:
6
- metadata.gz: 57b945928db7e7c0e25b0dfbecc86e057469e6aa003eaad4516f8fb5454207b9b5989b697e3ba39b797a5acfbd6c82847d88ebeea8fcecac312a819778643894
7
- data.tar.gz: 9ee3d1316d314b955f42ceef014f4b39fc346fc424560d6938f2788d50d0035765e40282d835a9b1e1b0d0603744b956267c52daee041bc99fb1654f77c19f8c
6
+ metadata.gz: 688ea40c5f9318eda64cfb22cf7a55822dd6acb91da6e9aef5e1d8dce891949af889839fa16f74ea92253bbf00330e86d51b6dd3ab6e17c5ccdfea195672a1d2
7
+ data.tar.gz: 9219bcb15f27ffcf73da09eb96cebe624a43cf516825abd49f980f9308095861b85309d1bf710f21aae1b38f93d99972913fb2789b9d00ea89dda71fb53c612e
@@ -28,8 +28,9 @@
28
28
  @import "application/navigation-logo.css.less";
29
29
  @import "application/panel-footer-pagination.css.less";
30
30
  @import "application/panel-with-actions.css.less";
31
- @import "application/sidebar.css.less";
31
+ /* @import "application/sidebar.css.less"; */
32
32
  @import "application/table-actions.css.less";
33
33
  @import "application/table-responsive.css.less";
34
34
  @import "application/tab-with-nav.css.less";
35
35
  @import "application/ui-autocomplete.css.less";
36
+ @import "application/vertical-navigation.css.less";
@@ -0,0 +1,5 @@
1
+ @media (min-width: 768px) {
2
+ #vertical-navigation {
3
+ margin-top: 60px;
4
+ }
5
+ }
@@ -1,6 +1,7 @@
1
1
  module Itsf::Backend
2
2
  class DashboardController < Configuration.dashboard_base_controller.constantize
3
3
  helper Itsf::Backend::ApplicationHelper
4
+ helper Itsf::Backend::BootstrapHelper
4
5
  helper MultiClientHelper if Itsf::Backend.features?(:multi_client)
5
6
 
6
7
  layout 'itsf/backend/base'
@@ -1,6 +1,7 @@
1
1
  module Itsf::Backend
2
2
  class HomeController < Configuration.home_base_controller.constantize
3
3
  helper Itsf::Backend::ApplicationHelper
4
+ helper Itsf::Backend::BootstrapHelper
4
5
  helper MultiClientHelper if Itsf::Backend.features?(:multi_client)
5
6
 
6
7
  def index
@@ -0,0 +1,9 @@
1
+ module Itsf
2
+ module Backend
3
+ module BootstrapHelper
4
+ def accordion_menu(options = {}, &block)
5
+ Bootstrap::AccordionMenu.new(self, options, &block).perform
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,24 @@
1
+ module Bootstrap
2
+ class AccordionMenu
3
+ def initialize(view, options = {}, &block)
4
+ options.reverse_merge!(identifier: SecureRandom.urlsafe_base64, icon: 'folder-open')
5
+
6
+ @identifier = options.delete(:identifier)
7
+ @title = options.delete(:title)
8
+ @icon = options.delete(:icon)
9
+ @view = view
10
+ @block = block
11
+ end
12
+
13
+ def perform
14
+ items = @view.capture { @block.call(self) }
15
+ @view.render partial: 'bootstrap/accordion_menu', locals: { identifier: @identifier, title: @title, items: items, icon: @icon }
16
+ end
17
+
18
+ def item(options = {})
19
+ options.reverse_merge!(icon: nil, target: nil, title: nil, item_count: nil)
20
+
21
+ @view.render partial: 'bootstrap/accordion_menu/item', locals: options
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,10 @@
1
+ .accordion-menu.panel-group{ id: "accordion-menu-#{identifier}" }
2
+ .panel.panel-default
3
+ .panel-heading
4
+ %h4.panel-title
5
+ %a{"data-parent" => "#accordion-menu-#{identifier}", "data-toggle" => "collapse", href: "#accordion-menu-collapse-#{identifier}" }
6
+ %span{ class: "glyphicon.glyphicon-#{icon}" }
7
+ = title
8
+ .panel-collapse.collapse.in{ id: "accordion-menu-collapse-#{identifier}" }
9
+ %table.table.table-striped.table-hover.table-condensed
10
+ = items
@@ -0,0 +1,8 @@
1
+ %tr
2
+ %td
3
+ = link_to(target) do
4
+ %span{ class: "glyphicon glyphicon-#{icon}" }
5
+ = title
6
+ - unless item_count.nil?
7
+ %span.badge.pull-right
8
+ = item_count
@@ -1,21 +1,10 @@
1
- #engine-navigations
2
- #accordion.panel-group
3
- - Itsf::Backend::Configuration.backend_engines.each do |engine|
4
- - if !respond_to?(:engine_policy) || engine_policy(engine).access?
5
- .panel.panel-default
6
- .panel-heading
7
- %h4.panel-title
8
- %a{"data-parent" => "#accordion", "data-toggle" => "collapse", :href => "#collapse-#{engine.name.underscore.dasherize.gsub('/', '-')}"}
9
- = t("classes.#{engine.name.underscore}")
10
- .panel-collapse.collapse.in{ id: "collapse-#{engine.name.underscore.dasherize.gsub('/', '-')}" }
11
- %div.list-group
12
- = link_to(send(engine.engine_name).root_path, class: 'list-group-item') do
13
- = t(".home")
14
- - controllers = engine.to_s.gsub('::Engine', '::Configuration').constantize.registered_controllers.call
15
- - controllers.each do |kontroller|
16
- - resource_klass = kontroller.resource_class
17
- - if !Itsf::Backend.features?(:pundit) || policy(resource_klass).index?
18
- = link_to(send(engine.engine_name).url_for(controller: "/#{kontroller.controller_path}"), class: 'list-group-item') do
19
- = resource_klass.model_name.human(count: :other)
20
- %span.badge.badge-default= kontroller.resource_count.respond_to?(:call) ? instance_exec(&kontroller.resource_count) : kontroller.resource_count
21
-
1
+ - Itsf::Backend::Configuration.backend_engines.each do |engine|
2
+ - if !respond_to?(:engine_policy) || engine_policy(engine).access?
3
+ = accordion_menu(identifier: engine.name.parameterize, title: t("classes.#{engine.name.underscore}"), icon: 'menu-down') do |menu|
4
+ = menu.item(icon: 'home', target: send(engine.engine_name).root_path, title: t(".home"))
5
+ - controllers = engine.to_s.gsub('::Engine', '::Configuration').constantize.registered_controllers.call
6
+ - controllers.each do |kontroller|
7
+ - resource_klass = kontroller.resource_class
8
+ - if !Itsf::Backend.features?(:pundit) || policy(resource_klass).index?
9
+ - resource_count = kontroller.resource_count.respond_to?(:call) ? instance_exec(&kontroller.resource_count) : kontroller.resource_count
10
+ = menu.item(icon: 'list', target: send(engine.engine_name).url_for(controller: "/#{kontroller.controller_path}"), title: resource_klass.model_name.human(count: :other), item_count: resource_count)
@@ -33,16 +33,18 @@
33
33
  %body
34
34
  #auxiliary-navigation
35
35
  = render 'layouts/itsf/backend/auxiliary_navigation'
36
- #wrapper
37
- #sidebar-wrapper.brand-primary-background-color
38
- = render 'layouts/itsf/backend/vertical_navigation'
39
36
 
40
- #page-content-wrapper
41
- .container-fluid
42
- .row
43
- .col-lg-12
44
- = bootstrap_flash
45
- = yield
37
+ .container-fluid
38
+ .row
39
+ .col-md-3.col-lg-2
40
+ #vertical-navigation
41
+ = render 'layouts/itsf/backend/vertical_navigation'
42
+ .col-md-9.col-lg-10
43
+ .container-fluid
44
+ .row
45
+ .col-lg-12
46
+ = bootstrap_flash
47
+ = yield
46
48
 
47
49
 
48
50
  %footer.footer-sticky
@@ -1,5 +1,5 @@
1
1
  module Itsf
2
2
  module Backend
3
- VERSION = '3.0.2'
3
+ VERSION = '3.0.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itsf_backend
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
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: 2017-03-09 00:00:00.000000000 Z
11
+ date: 2017-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -494,6 +494,7 @@ files:
494
494
  - app/assets/stylesheets/itsf/backend/application/table-actions.css.less
495
495
  - app/assets/stylesheets/itsf/backend/application/table-responsive.css.less
496
496
  - app/assets/stylesheets/itsf/backend/application/ui-autocomplete.css.less
497
+ - app/assets/stylesheets/itsf/backend/application/vertical-navigation.css.less
497
498
  - app/assets/stylesheets/itsf/backend/bootstrap_and_overrides.css.less
498
499
  - app/assets/stylesheets/itsf/backend/vendor/jquery.dragtable.css
499
500
  - app/assets/stylesheets/itsf/backend/vendor/timeline.min.css
@@ -535,13 +536,16 @@ files:
535
536
  - app/forms/concerns/form/additional_submit_buttons.rb
536
537
  - app/forms/concerns/form/ui_autocomplete.rb
537
538
  - app/helpers/itsf/backend/application_helper.rb
539
+ - app/helpers/itsf/backend/bootstrap_helper.rb
538
540
  - app/inputs/fake_checkbox_input.rb
539
541
  - app/inputs/fake_text_input.rb
540
542
  - app/policies/itsf/backend/base_policy.rb
541
543
  - app/policies/itsf/backend/dashboard_policy.rb
542
544
  - app/policies/itsf/backend/engine_policy.rb
543
545
  - app/policies/itsf/backend/service/base_policy.rb
544
- - app/presenters/bootstrap_table_presenter.rb.old
546
+ - app/renderers/bootstrap/accordion_menu.rb
547
+ - app/views/bootstrap/_accordion_menu.haml
548
+ - app/views/bootstrap/accordion_menu/_item.haml
545
549
  - app/views/itsf/backend/dashboard/_dashboard_panel.html.haml
546
550
  - app/views/itsf/backend/dashboard/_head_extras.html.haml
547
551
  - app/views/itsf/backend/dashboard/index.html.haml
@@ -1,106 +0,0 @@
1
- class BootstrapTablePresenter < Admino::Table::Presenter
2
- private
3
-
4
- def table_html_options
5
- { class: 'table table-striped table-hover table-admino table-scrollable table-condensed' }
6
- end
7
-
8
- def head_row(collection_klass, query, view_context)
9
- HeadRow.new(collection_klass, query, view_context)
10
- end
11
-
12
- def resource_row(resource, view_context)
13
- ResourceRow.new(resource, view_context)
14
- end
15
-
16
- class HeadRow < Admino::Table::HeadRow
17
- def column(*args, &block)
18
- attribute_name, label, html_options = parse_column_args(args)
19
-
20
- if label.nil?
21
- label = column_label(attribute_name)
22
- elsif label.is_a? Symbol
23
- label = column_label(label)
24
- end
25
-
26
- html_options = complete_column_html_options(
27
- attribute_name,
28
- html_options
29
- )
30
-
31
- # sorting_scope = html_options.delete(:sorting)
32
- # sorting_html_options = html_options.delete(:sorting_html_options) { {} }
33
-
34
- # if sorting_scope
35
- # raise ArgumentError, 'query object is required' unless query
36
- # label = query.sorting.scope_link(sorting_scope, label, sorting_html_options)
37
- # end
38
- if Itsf::Backend.features?(:ransack)
39
- html_options.reverse_merge!(sortable: true, sortable_options: [])
40
- sortable = html_options.delete(:sortable)
41
- sortable_options = html_options.delete(:sortable_options)
42
- if sortable_options.empty?
43
- sortable_options << attribute_name
44
- sortable_options << resource_klass.human_attribute_name(attribute_name)
45
- end
46
-
47
-
48
- if sortable
49
- label = h.sort_link(h.instance_variable_get("@q"), *sortable_options)
50
- # label = h.sort_link(h.instance_variable_get("@q"), attribute_name)
51
- else
52
- label = label.to_s
53
- end
54
- end
55
-
56
- @columns << h.content_tag(:th, label, html_options)
57
- end
58
- end
59
-
60
- class ResourceRow < Admino::Table::ResourceRow
61
- # def to_html
62
- # buffer = @columns
63
-
64
- # if @actions.any?
65
- # html_options = column_html_options(:actions)
66
- # buffer << h.content_tag(:td, html_options) do
67
- # actions_wrapper do
68
- # @actions.join(" ").html_safe
69
- # end
70
- # end
71
- # end
72
-
73
- # buffer.html_safe
74
- # end
75
-
76
- # def actions_wrapper(&block)
77
- # h.content_tag(:div, { class: 'btn-group' }, &block)
78
- # end
79
-
80
- # def edit_action_url
81
- # view_context.edit_resource_url(resource)
82
- # end
83
-
84
- # def destroy_action_url
85
- # view_context.resource_url(resource)
86
- # end
87
-
88
- # def show_action_html_options
89
- # { class: 'btn btn-default btn-xs' }
90
- # end
91
-
92
- # def edit_action_html_options
93
- # { class: 'btn btn-default btn-xs' }
94
- # end
95
-
96
- # def destroy_action_html_options
97
- # {
98
- # method: :delete,
99
- # class: 'btn btn-danger btn-xs',
100
- # data: {
101
- # confirm: I18n.t('confirmations.delete')
102
- # }
103
- # }
104
- # end
105
- end
106
- end