1+ # frozen_string_literal: true
2+
13require 'tailoring'
24
35module ApplicationHelper
@@ -18,7 +20,7 @@ def active_on_current_path_link_to(name, path, options = {})
1820 classes += ' active'
1921 options [ :class ] = classes
2022 end
21- return link_to ( name , path , options )
23+ link_to ( name , path , options )
2224 end
2325
2426 def labeled ( label , tags = nil , options = { } , &block )
@@ -36,9 +38,9 @@ def labeled(label, tags = nil, options = {}, &block)
3638 tags = tags . html_safe
3739
3840 if tags =~ /id\s *=\s *"([^"]+)"/
39- target = ' for="' + $1 + '"'
41+ target = ' for="' + Regexp . last_match ( 1 ) + '"'
4042 else
41- fail 'Cannot label a tag without an id'
43+ raise 'Cannot label a tag without an id'
4244 end
4345
4446 cls = [ ]
@@ -56,7 +58,7 @@ def labeled(label, tags = nil, options = {}, &block)
5658 when :label_last
5759 label_start + tags + label_text + label_end
5860 else
59- fail 'invalid :order option for labeled()'
61+ raise 'invalid :order option for labeled()'
6062 end
6163 end
6264
@@ -79,7 +81,7 @@ def bs_labeled_field(label, field, options = {})
7981 str << '</label>'
8082 else
8183 label = label_tag label , nil , class : 'control-label'
82- str += raw ( " <div class=\ " form-group\" >" + raw ( label ) + raw ( field ) + '</div>' )
84+ str += raw ( ' <div class="form-group">' + raw ( label ) + raw ( field ) + '</div>' )
8385 end
8486 raw ( str )
8587 end
@@ -89,14 +91,14 @@ def use_datatables(table_selector, options = {})
8991 bJQueryUI : true ,
9092 bSort : false
9193 } . merge options
92- script = <<EOS
93- <script type="text/javascript">
94- <!--
95- $(document).ready(function() {
96- $('#{ escape_javascript table_selector } ').dataTable(#{ options . to_json } );
97- });
98- //-->
99- </script>
94+ script = <<~ EOS
95+ <script type="text/javascript">
96+ <!--
97+ $(document).ready(function() {
98+ $('#{ escape_javascript table_selector } ').dataTable(#{ options . to_json } );
99+ });
100+ //-->
101+ </script>
100102EOS
101103 raw ( script )
102104 end
0 commit comments