@@ -24,19 +24,14 @@ def convert_changes_string(string, hstore_columns: nil)
24
24
diffs
25
25
end
26
26
27
- def collection_for_delete_state
28
- [ [ 'Deleted' , :only_deleted ] , [ 'All' , :with_deleted ] ]
29
- end
30
-
31
27
def render_admin_sorting_buttons ( instance , column : :sort , html_attrs : nil )
32
28
scope = instance . class . to_s . split ( '::' ) . last . underscore
33
29
html = [ :first , :up , :down , :last , :remove ] . map do |action |
34
30
if action == :remove && instance . try ( column ) . nil?
35
31
''
36
32
else
37
33
html_opts = {
38
- method : :put ,
39
-
34
+ method : :put
40
35
} . merge ( html_attrs || { } )
41
36
link_to action . to_s . camelize , send ( "admin_#{ scope } _path" , instance , "#{ scope } [#{ column } ]" => action , redirect_to : url_for ) , html_opts
42
37
end
@@ -120,4 +115,23 @@ def render_admin_data_table(data: nil, total: nil, bordered: true, striped: true
120
115
}
121
116
render partial : 'admin/base/data_table' , locals : locals
122
117
end
118
+
119
+ def admin_link_to ( text , link , icon : nil , size : nil , color : nil , round : false , **html_opts )
120
+ html_opts ||= { }
121
+ classes = html_opts [ :class ] . to_s . split ( ' ' )
122
+ classes << 'btn'
123
+ classes << { l : 'btn-lg' , m : 'btn-sm' , s : 'btn-xs' } [ size . to_sym ] if size
124
+ classes << 'btn-round' if round
125
+ classes << "btn-#{ color } " if color
126
+ html_opts [ :class ] = classes . select ( &:present? ) . join ( ' ' )
127
+ link_to link , html_opts do
128
+ text = "<i class=\" fa fa-#{ icon } \" ></i> #{ text } " if icon
129
+ text . html_safe
130
+ end
131
+ end
132
+
133
+ def admin_app_button_to ( text , link , icon : , **html_opts )
134
+ html_opts ||= { }
135
+ admin_link_to ( text , link , icon : icon , class : "btn-app #{ html_opts . delete ( :class ) } " , **html_opts )
136
+ end
123
137
end
0 commit comments