admix 0.23.1 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/app/assets/javascripts/admix/application.js.coffee +30 -2
- data/app/assets/stylesheets/admix/application.css +6 -1
- data/app/assets/stylesheets/admix/wice_grid.css.scss +143 -0
- data/app/controllers/admix/inherited_controller.rb +13 -34
- data/app/controllers/admix/registrations_controller.rb +2 -0
- data/app/controllers/admix/rest_controller.rb +46 -0
- data/app/helpers/admix/tab.rb +33 -0
- data/app/helpers/admix_helper.rb +76 -0
- data/app/views/admix/inherited/_actions.haml +7 -0
- data/app/views/admix/inherited/_column_actions.haml +3 -0
- data/app/views/admix/inherited/_empty_grid.haml +3 -0
- data/app/views/admix/inherited/_form_config.haml +0 -0
- data/app/views/admix/inherited/_grid.haml +5 -0
- data/app/views/admix/inherited/_grid_actions.haml +1 -0
- data/app/views/admix/inherited/_grid_columns.haml +11 -0
- data/app/views/admix/inherited/edit.html.haml +3 -3
- data/app/views/admix/inherited/form.html.haml +52 -0
- data/app/views/admix/inherited/index.html.haml +3 -5
- data/app/views/admix/inherited/new.html.haml +3 -3
- data/app/views/admix/inherited/show.html.haml +3 -5
- data/app/views/admix/rest/_actions.haml +7 -0
- data/app/views/admix/rest/_column_actions.haml +3 -0
- data/app/views/admix/rest/_empty_grid.haml +3 -0
- data/app/views/admix/rest/_form_config.haml +0 -0
- data/app/views/admix/rest/_grid.haml +5 -0
- data/app/views/admix/rest/_grid_actions.haml +1 -0
- data/app/views/admix/rest/_grid_columns.haml +11 -0
- data/app/views/admix/rest/edit.html.haml +5 -0
- data/app/views/admix/rest/form.html.haml +50 -0
- data/app/views/admix/rest/index.html.haml +3 -0
- data/app/views/admix/rest/new.html.haml +3 -0
- data/app/views/admix/rest/show.html.haml +3 -0
- data/app/views/layouts/admix/{admix.html.haml → admix.haml} +2 -2
- data/app/views/layouts/admix/{login.html.haml → login.haml} +1 -1
- data/config/admix_navigation.rb +34 -49
- data/config/application.rb +0 -2
- data/config/initializers/admix.rb +0 -3
- data/config/initializers/wice_grid_config.rb +142 -0
- data/config/locales/admix.pt-BR.yml +10 -3
- data/config/locales/wice_grid.yml +502 -0
- data/lib/admix.rb +1 -3
- data/lib/admix/engine.rb +28 -0
- data/lib/admix/version.rb +2 -2
- metadata +51 -71
- data/app/views/admix/inherited/_form.html.haml +0 -14
- data/app/views/admix/inherited/_table_actions.html.haml +0 -3
- data/config/initializers/locale.rb +0 -1
- data/lib/admix/table-actions.rb +0 -17
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b21db47058f105b7f1253aa41d9f65a0d27d4198
|
4
|
+
data.tar.gz: 015c9f53129ed8172c0c06ba6396992469b9aa84
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0269db074ca54532844648e6bb8944dbc9886ba56fca0b3bc19a7f5459bcf4808ad6d68beb9d196de87cc287e4c9c543e9354801ac5e3b544b7bdd5f3d6a55f9
|
7
|
+
data.tar.gz: af39710bf0b7f34c6b9364ebbe1839a553af6ad8c6e6cf27287760f9ebed4ec50e0b483d34e25dd9e9365677fc87050ed326c8198fa8c43c0b00ea97f23e06eb
|
@@ -1,9 +1,11 @@
|
|
1
|
+
|
1
2
|
#= require jquery
|
2
3
|
#= require jquery_ujs
|
3
4
|
#= require underscore
|
4
5
|
#= require backbone
|
5
6
|
#= require jquery/jquery.livequery
|
6
7
|
#= require fancybox
|
8
|
+
#= require wice_grid
|
7
9
|
#= require jquery.ui.all
|
8
10
|
#= require bootstrap
|
9
11
|
#= require ../../nicedit/nicEdit
|
@@ -12,7 +14,13 @@
|
|
12
14
|
# ./tipsy_init
|
13
15
|
#= require jquery.qtip.js
|
14
16
|
#= require jquery.globalmoney
|
17
|
+
#= require ckeditor/init
|
18
|
+
#= require jquery.meio.mask.min
|
19
|
+
#= require jquery.ui.addresspicker
|
15
20
|
|
21
|
+
#= require angular.min
|
22
|
+
#= require angular-ui.min
|
23
|
+
#= require gmaps
|
16
24
|
|
17
25
|
|
18
26
|
Backbone.emulateHTTP = true
|
@@ -29,7 +37,7 @@ $ ->
|
|
29
37
|
style:
|
30
38
|
classes: 'qtip-bootstrap'
|
31
39
|
|
32
|
-
$('.
|
40
|
+
$('.zoom-image').livequery ->
|
33
41
|
$(@).fancybox();
|
34
42
|
|
35
43
|
$('.currency').livequery ->
|
@@ -44,4 +52,24 @@ $ ->
|
|
44
52
|
$(this).datepicker
|
45
53
|
altFormat: "yy-mm-dd"
|
46
54
|
dateFormat: "dd/mm/yy"
|
47
|
-
altField: $(this).next()
|
55
|
+
altField: $(this).next()
|
56
|
+
|
57
|
+
$(".cell, .phone").livequery ->
|
58
|
+
$(@).setMask('(84) 9999-9999')
|
59
|
+
|
60
|
+
$(".cep").livequery ->
|
61
|
+
$(@).setMask('99999-999')
|
62
|
+
|
63
|
+
# window.admix = angular.module('admix', ['ui'])
|
64
|
+
# .config(["$httpProvider", function(provider) {
|
65
|
+
# provider.defaults.headers.common['X-CSRF-Token'] = $('meta[name=csrf-token]').attr('content');
|
66
|
+
# .controller 'FormController', ($scope) ->
|
67
|
+
# console.log 'init From Controller'
|
68
|
+
# $scope.method = $(AdmixForm._method).val()
|
69
|
+
# $scope.authenticity_token = $(AdmixForm.authenticity_token).val()
|
70
|
+
# $scope.utf8 = $(AdmixForm.utf8).val()
|
71
|
+
|
72
|
+
# console.log $scope
|
73
|
+
|
74
|
+
|
75
|
+
# angular.bootstrap(document, ['admix'])
|
@@ -15,6 +15,7 @@
|
|
15
15
|
*= require ./admix_bootstrap
|
16
16
|
*= require ./style
|
17
17
|
*= require jquery.qtip.css
|
18
|
+
*= require ./wice_grid
|
18
19
|
*= require_self
|
19
20
|
*/
|
20
21
|
|
@@ -25,4 +26,8 @@
|
|
25
26
|
|
26
27
|
form abbr {
|
27
28
|
color: red;
|
28
|
-
}
|
29
|
+
}
|
30
|
+
|
31
|
+
#gmapa img {
|
32
|
+
max-width: none;
|
33
|
+
}
|
@@ -0,0 +1,143 @@
|
|
1
|
+
@mixin icon-dimensions {
|
2
|
+
width: 16px;
|
3
|
+
height: 16px;
|
4
|
+
}
|
5
|
+
|
6
|
+
.wg-detached-filter{
|
7
|
+
a.date-label {text-decoration: none;}
|
8
|
+
a.date-label:hover {text-decoration: line-through;}
|
9
|
+
}
|
10
|
+
|
11
|
+
.wice-grid{
|
12
|
+
|
13
|
+
.clickable{
|
14
|
+
cursor: pointer;
|
15
|
+
margin-bottom: 2px;
|
16
|
+
margin-right: 2px;
|
17
|
+
}
|
18
|
+
|
19
|
+
|
20
|
+
a.date-label {text-decoration: none;}
|
21
|
+
a.date-label:hover {text-decoration: line-through;}
|
22
|
+
|
23
|
+
.ui-datepicker-trigger, .wg-detached-filter .ui-datepicker-trigger{
|
24
|
+
cursor: pointer;
|
25
|
+
}
|
26
|
+
|
27
|
+
.desc, .asc{
|
28
|
+
padding-right: 18px;
|
29
|
+
text-decoration:none;
|
30
|
+
}
|
31
|
+
|
32
|
+
.desc {
|
33
|
+
background: transparent url(/assets/icons/grid/arrow_down.gif) right no-repeat
|
34
|
+
}
|
35
|
+
.asc {
|
36
|
+
background: transparent url(/assets/icons/grid/arrow_up.gif) right no-repeat
|
37
|
+
}
|
38
|
+
|
39
|
+
.submit.clickable{
|
40
|
+
background: transparent url(/assets/icons/grid/table_refresh.png) no-repeat;
|
41
|
+
@include icon-dimensions;
|
42
|
+
}
|
43
|
+
|
44
|
+
.reset.clickable{
|
45
|
+
background: transparent url(/assets/icons/grid/table.png) no-repeat;
|
46
|
+
@include icon-dimensions;
|
47
|
+
}
|
48
|
+
|
49
|
+
|
50
|
+
.wg-show-filter.clickable,
|
51
|
+
.wg-hide-filter.clickable{
|
52
|
+
background: transparent url(/assets/icons/grid/page_white_find.png) no-repeat;
|
53
|
+
@include icon-dimensions;
|
54
|
+
}
|
55
|
+
|
56
|
+
|
57
|
+
.export-to-csv-button.clickable{
|
58
|
+
background: transparent url(/assets/icons/grid/page_white_excel.png) no-repeat;
|
59
|
+
@include icon-dimensions;
|
60
|
+
}
|
61
|
+
|
62
|
+
.clickable.select-all{
|
63
|
+
background: transparent url(/assets/icons/grid/tick_all.png) no-repeat;
|
64
|
+
@include icon-dimensions;
|
65
|
+
float:left;
|
66
|
+
}
|
67
|
+
|
68
|
+
.clickable.deselect-all{
|
69
|
+
background: transparent url(/assets/icons/grid/untick_all.png) no-repeat;
|
70
|
+
@include icon-dimensions;
|
71
|
+
float:left;
|
72
|
+
}
|
73
|
+
|
74
|
+
.custom-dropdown-container {
|
75
|
+
position: relative;
|
76
|
+
padding-right: 18px;
|
77
|
+
|
78
|
+
|
79
|
+
.collapse-multi-select-icon, .expand-multi-select-icon{
|
80
|
+
width: 12px;
|
81
|
+
height: 12px;
|
82
|
+
position:absolute;
|
83
|
+
top:0;
|
84
|
+
right:0;
|
85
|
+
}
|
86
|
+
|
87
|
+
.collapse-multi-select-icon{
|
88
|
+
background: transparent url(/assets/icons/grid/collapse.gif) no-repeat;
|
89
|
+
}
|
90
|
+
|
91
|
+
.expand-multi-select-icon{
|
92
|
+
background: transparent url(/assets/icons/grid/expand.gif) no-repeat;
|
93
|
+
}
|
94
|
+
|
95
|
+
}
|
96
|
+
|
97
|
+
.text-filter-container {
|
98
|
+
position: relative; padding-right: 13px;
|
99
|
+
.negation-checkbox {
|
100
|
+
position:absolute;
|
101
|
+
top:0;
|
102
|
+
right:0;
|
103
|
+
}
|
104
|
+
}
|
105
|
+
|
106
|
+
|
107
|
+
/* in case of twitter bootstrap :) */
|
108
|
+
thead th select{
|
109
|
+
width: auto;
|
110
|
+
}
|
111
|
+
|
112
|
+
.pagination{
|
113
|
+
margin: 0px;
|
114
|
+
float: left;
|
115
|
+
}
|
116
|
+
|
117
|
+
|
118
|
+
tr.wg-filter-row input[type=text] {
|
119
|
+
width: 100px;
|
120
|
+
}
|
121
|
+
|
122
|
+
.pagination_status {
|
123
|
+
font-weight: bold;
|
124
|
+
float: right;
|
125
|
+
}
|
126
|
+
|
127
|
+
}
|
128
|
+
|
129
|
+
.wice-grid-query-panel{
|
130
|
+
li {list-style-type: none; }
|
131
|
+
|
132
|
+
ul {margin-left: 0 }
|
133
|
+
|
134
|
+
a.wice-grid-delete-query .delete-icon{
|
135
|
+
background: transparent url(/assets/icons/grid/delete.png) no-repeat;
|
136
|
+
float: left;
|
137
|
+
@include icon-dimensions;
|
138
|
+
}
|
139
|
+
}
|
140
|
+
|
141
|
+
.table-striped td.active-filter {
|
142
|
+
background-color: #f9f9e9 !important;
|
143
|
+
}
|
@@ -1,25 +1,20 @@
|
|
1
1
|
module Admix
|
2
2
|
class InheritedController < Admix::AdmixController
|
3
|
+
|
3
4
|
helper :all
|
4
5
|
|
5
6
|
inherit_resources
|
6
|
-
include InheritedResources::DSL
|
7
7
|
|
8
|
+
include InheritedResources::DSL
|
8
9
|
rescue_from ActiveRecord::DeleteRestrictionError do |exception|
|
9
10
|
#resource.errors.add(:base, exception)
|
10
11
|
flash[:alert] = I18n.t('errors.dependent')
|
11
12
|
redirect_to collection_url
|
12
13
|
end
|
13
14
|
|
14
|
-
# destroy! do |success, failure|
|
15
|
-
# failure.html { redirect_to polymorphic_path(resource) }
|
16
|
-
# end
|
17
|
-
|
18
15
|
# TODO: Add authorization here.
|
19
|
-
|
20
16
|
|
21
|
-
|
22
|
-
before_filter :generate_datagrid , only: [:index ]
|
17
|
+
before_filter :load_grid , only: [:index ]
|
23
18
|
|
24
19
|
|
25
20
|
# Add a breadcrumb, in this case nested resources. ;)
|
@@ -31,22 +26,29 @@ module Admix
|
|
31
26
|
}
|
32
27
|
|
33
28
|
before_filter -> { breadcrumbs.add t("#{collection_name}.#{collection_name}"), collection_url, :i18n => false }
|
34
|
-
before_filter -> { breadcrumbs.add "#{
|
29
|
+
before_filter -> { breadcrumbs.add "#{crumb_field}" , resource_url, :i18n => false } , except: [:index, :new, :create ]
|
35
30
|
before_filter -> { breadcrumbs.add t("admix.crud.new.title"), :i18n => false } , only: [:new ]
|
36
31
|
before_filter -> { @crumb_field = crumb_field } , only: [:edit ]
|
37
32
|
|
38
33
|
protected
|
39
34
|
|
40
35
|
def crumb_field
|
41
|
-
if resource.respond_to?(:name)
|
36
|
+
field_name = if resource.respond_to?(:name)
|
42
37
|
:name
|
43
38
|
elsif resource.respond_to?(:title)
|
44
39
|
:title
|
45
40
|
elsif resource.respond_to?(:email)
|
46
41
|
:email
|
47
42
|
else
|
48
|
-
"Implement crumb_field method in #{self}"
|
43
|
+
raise "Implement crumb_field method in #{self}"
|
49
44
|
end
|
45
|
+
|
46
|
+
resource[field_name]
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
def load_grid
|
51
|
+
@grid = initialize_grid(resource_class)
|
50
52
|
end
|
51
53
|
|
52
54
|
def collection_name
|
@@ -61,28 +63,5 @@ module Admix
|
|
61
63
|
raise "TODO: We need implement this in #{self}"
|
62
64
|
end
|
63
65
|
|
64
|
-
def generate_datagrid
|
65
|
-
@report = report
|
66
|
-
@assets = @report.assets.paginate(:page => params[:page], :per_page => 10)
|
67
|
-
end
|
68
|
-
|
69
|
-
def report
|
70
|
-
datagrid_class.new(params[datagrid_param_name])
|
71
|
-
end
|
72
|
-
|
73
|
-
def datagrid_class
|
74
|
-
@datagrid_class = guess_datagrid_class
|
75
|
-
end
|
76
|
-
|
77
|
-
private
|
78
|
-
def guess_datagrid_class
|
79
|
-
"#{self.class.name}".gsub("Controller", "Datagrid").constantize
|
80
|
-
end
|
81
|
-
|
82
|
-
def datagrid_param_name
|
83
|
-
guess_datagrid_class.to_s.underscore.gsub('/', '_')
|
84
|
-
end
|
85
|
-
|
86
|
-
|
87
66
|
end
|
88
67
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
class Admix::RestController < Admix::AdmixController
|
2
|
+
|
3
|
+
inherit_resources
|
4
|
+
|
5
|
+
before_filter -> {
|
6
|
+
if defined?(parent_type)
|
7
|
+
breadcrumbs.add t("#{parent_type.to_s.gsub('_', '').pluralize}.#{parent_type.to_s.gsub('_', '').pluralize}") , polymorphic_path([:admix, parent_class])
|
8
|
+
breadcrumbs.add "#{parent.name}" , parent_url
|
9
|
+
end
|
10
|
+
}
|
11
|
+
|
12
|
+
before_filter -> { breadcrumbs.add t("#{collection_name}.#{collection_name}"), collection_url, :i18n => false }
|
13
|
+
before_filter -> { breadcrumbs.add "#{crumb_field}" , resource_url, :i18n => false } , except: [:index, :new, :create ]
|
14
|
+
before_filter -> { breadcrumbs.add t("admix.crud.new.title"), :i18n => false } , only: [:new ]
|
15
|
+
before_filter -> { @crumb_field = crumb_field } , only: [:edit ]
|
16
|
+
|
17
|
+
protected
|
18
|
+
|
19
|
+
def crumb_field
|
20
|
+
field_name = if resource.respond_to?(:name)
|
21
|
+
:name
|
22
|
+
elsif resource.respond_to?(:title)
|
23
|
+
:title
|
24
|
+
elsif resource.respond_to?(:email)
|
25
|
+
:email
|
26
|
+
else
|
27
|
+
raise "Implement crumb_field method in #{self}"
|
28
|
+
end
|
29
|
+
|
30
|
+
resource[field_name]
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
def load_grid
|
35
|
+
@grid = initialize_grid(resource_class)
|
36
|
+
end
|
37
|
+
|
38
|
+
def collection_name
|
39
|
+
@collection_name = resource_class.to_s.underscore.pluralize.gsub("::", "_")
|
40
|
+
end
|
41
|
+
|
42
|
+
def resource_name
|
43
|
+
resource_class.to_s.downcase
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Admix
|
2
|
+
class Tab
|
3
|
+
|
4
|
+
# include ActionView::Helpers::CaptureHelper
|
5
|
+
# include ActionView::Helpers::TagHelper
|
6
|
+
|
7
|
+
attr_reader :tab_id, :header, :content, :view_context, :options
|
8
|
+
|
9
|
+
def initialize(view_context, tab_name, tab_id = nil, options={}, &block)
|
10
|
+
@view_context ||= view_context
|
11
|
+
@tab_id = "tab-#{tab_name}".parameterize.to_sym unless tab_id
|
12
|
+
@tab_name = tab_name
|
13
|
+
|
14
|
+
@options = options
|
15
|
+
|
16
|
+
@header = view_context.content_tag :li, class: (options[:first] ? 'active' : '') do
|
17
|
+
view_context.link_to(@tab_name, "##{@tab_id}")
|
18
|
+
end
|
19
|
+
|
20
|
+
@content = ''.html_safe
|
21
|
+
yield(self)
|
22
|
+
end
|
23
|
+
|
24
|
+
def tab_header(&block)
|
25
|
+
@header = block_given? ? @view_context.capture(&block) : ''
|
26
|
+
end
|
27
|
+
|
28
|
+
def tab_content(&block)
|
29
|
+
@content = block_given? ? @view_context.capture(&block) : ''
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
data/app/helpers/admix_helper.rb
CHANGED
@@ -10,4 +10,80 @@ module AdmixHelper
|
|
10
10
|
I18n.t("#{model_name}.#{input_name}", scope: :"simple_form.labels", default: [:"defaults.#{input_name}"])
|
11
11
|
end
|
12
12
|
|
13
|
+
def column_actions(grid)
|
14
|
+
render partial: 'column_actions', locals: {grid: grid}
|
15
|
+
end
|
16
|
+
|
17
|
+
def action_edit(obj)
|
18
|
+
link_edit(obj, image_tag('admix/page_edit.png'))
|
19
|
+
end
|
20
|
+
|
21
|
+
def link_edit(obj, link_content=nil, classes='')
|
22
|
+
link_content ||= image_tag('admix/page_edit.png')
|
23
|
+
link_to(link_content, edit_resource_url(obj), class: "btn #{classes}", title:'Editar registro')
|
24
|
+
end
|
25
|
+
|
26
|
+
def action_show(obj)
|
27
|
+
link_to(image_tag('admix/zoom.png'), resource_url(obj), class: 'btn', title:'Visualizar registro')
|
28
|
+
end
|
29
|
+
|
30
|
+
def action_destroy(obj)
|
31
|
+
link_destroy(obj, image_tag('admix/cancel.png'))
|
32
|
+
end
|
33
|
+
|
34
|
+
def link_destroy(obj, link_content=nil, classes='')
|
35
|
+
link_content ||= image_tag('admix/cancel.png')
|
36
|
+
link_to(link_content, resource_url(obj), method: :delete, data: { confirm: t('admix.crud.destroy_confirm') }, class: "btn #{classes}", title:'Deletar registro')
|
37
|
+
end
|
38
|
+
|
39
|
+
def grid_actions_for(obj, actions = [:show, :edit, :destroy], &block)
|
40
|
+
|
41
|
+
yield(actions) if block_given?
|
42
|
+
|
43
|
+
html = ''
|
44
|
+
|
45
|
+
actions.each do |action_name|
|
46
|
+
html += send("action_#{action_name}", obj)
|
47
|
+
end
|
48
|
+
|
49
|
+
raw html
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
def admix_tab(tab_name, tab_id = nil, options={}, &block)
|
55
|
+
@admix_tabs ||= []
|
56
|
+
if @admix_tabs.length == 0
|
57
|
+
options[:first] = true
|
58
|
+
end
|
59
|
+
@admix_tabs << Admix::Tab.new(self, tab_name, tab_id, options, &block)
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
def nav_items
|
64
|
+
items = {}
|
65
|
+
|
66
|
+
build_menu = lambda { |item, menu|
|
67
|
+
|
68
|
+
item[:key] = menu.id
|
69
|
+
item[:name] = menu.text
|
70
|
+
item[:url] = menu.href
|
71
|
+
item[:options] = menu.options
|
72
|
+
|
73
|
+
if menu.children.length > 0
|
74
|
+
subitems = []
|
75
|
+
menu.children.each do |c|
|
76
|
+
subitems << build_menu.call({}, c)
|
77
|
+
end
|
78
|
+
item[:items] = subitems
|
79
|
+
end
|
80
|
+
|
81
|
+
item
|
82
|
+
|
83
|
+
}
|
84
|
+
build_menu.call(items, ActiveMenu::get('admix-nav'))
|
85
|
+
items
|
86
|
+
|
87
|
+
end
|
88
|
+
|
13
89
|
end
|