Skip to content

Commit

Permalink
Goodbye Ruby 1.8 :-)
Browse files Browse the repository at this point in the history
  • Loading branch information
leikind committed Aug 3, 2014
1 parent 13ad8f5 commit a1f20f9
Show file tree
Hide file tree
Showing 18 changed files with 170 additions and 174 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "bundler/gem_tasks"
require 'rdoc/task'

task :default => :rdoc
task default: :rdoc

desc 'Generate documentation for the wice_grid plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
Expand Down
4 changes: 2 additions & 2 deletions lib/wice/active_record_column_wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def wg_initialize_request_parameters #:nodoc:

# Preprocess incoming parameters for datetime, if what's coming in is
# a datetime (with custom_filter it can be anything else, and not
# the datetime hash {:fr => ..., :to => ...})
# the datetime hash {fr: ..., to: ...})
if @request_params
if (@column.type == :datetime || @column.type == :timestamp) && @request_params.is_a?(Hash)
[:fr, :to].each do |sym|
Expand All @@ -47,7 +47,7 @@ def wg_initialize_request_parameters #:nodoc:

# Preprocess incoming parameters for date, if what's coming in is
# a date (with custom_filter it can be anything else, and not
# the date hash {:fr => ..., :to => ...})
# the date hash {fr: ..., to: ...})
if @column.type == :date && @request_params.is_a?(Hash)
[:fr, :to].each do |sym|
if @request_params[sym]
Expand Down
8 changes: 4 additions & 4 deletions lib/wice/columns.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ def yield_declaration #:nodoc:
declaration = yield_declaration_of_column_filter
if declaration
{
:filterName => self.name,
:detached => detachness,
:declaration => declaration
filterName: self.name,
detached: detachness,
declaration: declaration
}
end
end
Expand Down Expand Up @@ -245,7 +245,7 @@ def has_auto_reloading_calendar? #:nodoc:
protected

def form_parameter_template(v) #:nodoc:
{@grid.name => {:f => {self.attribute_name_fully_qualified_for_all_but_main_table_columns => v}}}.to_query
{@grid.name => {f: {self.attribute_name_fully_qualified_for_all_but_main_table_columns => v}}}.to_query
end

def form_parameter_name(v) #:nodoc:
Expand Down
11 changes: 5 additions & 6 deletions lib/wice/columns/column_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def initialize(grid_obj, html, param_name, select_all_buttons, object_property,
''
else
selected = params[grid_name] && params[grid_name][param_name] && params[grid_name][param_name].index(object.send(object_property).to_s)
check_box_tag("#{grid_name}[#{param_name}][]", object.send(object_property), selected, :id => nil)
check_box_tag("#{grid_name}[#{param_name}][]", object.send(object_property), selected, id: nil)
end
end
end
Expand All @@ -35,12 +35,11 @@ def name #:nodoc:
return '' unless @select_all_buttons

content_tag(:div, '',
:class => 'clickable select-all',
:title => NlMessage['select_all']) + ' ' +
class: 'clickable select-all',
title: NlMessage['select_all']) + ' ' +
content_tag(:div, '',
:class => 'clickable deselect-all',
:title => NlMessage['deselect_all'])

class: 'clickable deselect-all',
title: NlMessage['deselect_all'])
end

end
Expand Down
20 changes: 9 additions & 11 deletions lib/wice/columns/column_custom_dropdown.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@ def render_filter_internal(params) #:nodoc:
@custom_filter = @custom_filter.call if @custom_filter.kind_of? Proc

if @custom_filter.kind_of? Array

@custom_filter = [[@filter_all_label, nil]] + @custom_filter.map{|label, value|
[label.to_s, value.to_s]
}

end

select_options = {:name => @parameter_name + '[]', :id => @dom_id, :class => 'custom-dropdown form-control'}
select_options = {name: @parameter_name + '[]', id: @dom_id, class: 'custom-dropdown form-control'}

if @turn_off_select_toggling
select_toggle = ''
Expand All @@ -35,14 +33,14 @@ def render_filter_internal(params) #:nodoc:
expand_icon_style, collapse_icon_style = collapse_icon_style, expand_icon_style if select_options[:multiple]

select_toggle = content_tag(:span, '',
:title => NlMessage['expand'],
:class => 'expand-multi-select-icon clickable',
:style => expand_icon_style
title: NlMessage['expand'],
class: 'expand-multi-select-icon clickable',
style: expand_icon_style
) +
content_tag(:span, '',
:title => NlMessage['collapse'],
:class => 'collapse-multi-select-icon clickable',
:style => collapse_icon_style
title: NlMessage['collapse'],
class: 'collapse-multi-select-icon clickable',
style: collapse_icon_style
)
else
select_options[:multiple] = false
Expand All @@ -65,8 +63,8 @@ def render_filter_internal(params) #:nodoc:

def yield_declaration_of_column_filter #:nodoc:
{
:templates => [@query_without_equals_sign],
:ids => [@dom_id]
templates: [@query_without_equals_sign],
ids: [@dom_id]
}
end

Expand Down
4 changes: 2 additions & 2 deletions lib/wice/columns/column_date.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class ViewColumnDate < ViewColumnDatetime #:nodoc:

def render_standard_filter_internal(params) #:nodoc:
'<div class="date-filter">' +
select_date(params[:fr], {:include_blank => true, :prefix => @name1, :id => @dom_id}) + '<br/>' +
select_date(params[:to], {:include_blank => true, :prefix => @name2, :id => @dom_id2}) +
select_date(params[:fr], {include_blank: true, prefix: @name1, id: @dom_id}) + '<br/>' +
select_date(params[:to], {include_blank: true, prefix: @name2, id: @dom_id2}) +
'</div>'
end

Expand Down
32 changes: 16 additions & 16 deletions lib/wice/columns/column_datetime.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,42 +27,42 @@ def prepare_for_standard_filter #:nodoc:

@queris_ids = x.call(:fr) + x.call(:to)

_, _, @name1, _ = form_parameter_name_id_and_query({:fr => ''})
_, _, @name2, _ = form_parameter_name_id_and_query({:to => ''})
_, _, @name1, _ = form_parameter_name_id_and_query({fr: ''})
_, _, @name2, _ = form_parameter_name_id_and_query({to: ''})
end


def prepare_for_calendar_filter #:nodoc:
query, _, @name1, @dom_id = form_parameter_name_id_and_query(:fr => '')
query2, _, @name2, @dom_id2 = form_parameter_name_id_and_query(:to => '')
query, _, @name1, @dom_id = form_parameter_name_id_and_query(fr: '')
query2, _, @name2, @dom_id2 = form_parameter_name_id_and_query(to: '')

@queris_ids = [[query, @dom_id], [query2, @dom_id2] ]
end


def render_standard_filter_internal(params) #:nodoc:
'<div class="date-filter">' +
select_datetime(params[:fr], {:include_blank => true, :prefix => @name1}) + '<br/>' +
select_datetime(params[:to], {:include_blank => true, :prefix => @name2}) +
select_datetime(params[:fr], {include_blank: true, prefix: @name1}) + '<br/>' +
select_datetime(params[:to], {include_blank: true, prefix: @name2}) +
'</div>'
end

def render_calendar_filter_internal(params) #:nodoc:

calendar_data_from = prepare_data_for_calendar(
:initial_date => params[:fr],
:title => NlMessage['date_selector_tooltip_from'],
:name => @name1,
:fire_event => auto_reload,
:grid_name => self.grid.name
initial_date: params[:fr],
title: NlMessage['date_selector_tooltip_from'],
name: @name1,
fire_event: auto_reload,
grid_name: self.grid.name
)

calendar_data_to = prepare_data_for_calendar(
:initial_date => params[:to],
:title => NlMessage['date_selector_tooltip_to'],
:name => @name2,
:fire_event => auto_reload,
:grid_name => self.grid.name
initial_date: params[:to],
title: NlMessage['date_selector_tooltip_to'],
name: @name2,
fire_event: auto_reload,
grid_name: self.grid.name
)

calendar_data_from.the_other_datepicker_id_to = calendar_data_to.dom_id
Expand Down
8 changes: 4 additions & 4 deletions lib/wice/columns/column_integer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ class ViewColumnInteger < ViewColumn #:nodoc:
def render_filter_internal(params) #:nodoc:
@contains_a_text_input = true

@query, _, parameter_name, @dom_id = form_parameter_name_id_and_query(:eq => '')
@query, _, parameter_name, @dom_id = form_parameter_name_id_and_query(eq: '')

opts = {:size => 3, :id => @dom_id, :class => 'range-start'}
opts = {size: 3, id: @dom_id, class: 'range-start'}

opts[:class] += ' form-control input-sm'

Expand All @@ -23,8 +23,8 @@ def render_filter_internal(params) #:nodoc:

def yield_declaration_of_column_filter #:nodoc:
{
:templates => [@query],
:ids => [@dom_id]
templates: [@query],
ids: [@dom_id]
}
end

Expand Down
14 changes: 7 additions & 7 deletions lib/wice/columns/column_range.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ class ViewColumnRange < ViewColumn #:nodoc:
def render_filter_internal(params) #:nodoc:
@contains_a_text_input = true

@query, _, parameter_name, @dom_id = form_parameter_name_id_and_query(:fr => '')
@query2, _, parameter_name2, @dom_id2 = form_parameter_name_id_and_query(:to => '')
@query, _, parameter_name, @dom_id = form_parameter_name_id_and_query(fr: '')
@query2, _, parameter_name2, @dom_id2 = form_parameter_name_id_and_query(to: '')

opts1 = {:size => 2, :id => @dom_id, :class => 'form-control input-sm range-start'}
opts2 = {:size => 2, :id => @dom_id2, :class => 'form-control input-sm range-end'}
opts1 = {size: 2, id: @dom_id, class: 'form-control input-sm range-start'}
opts2 = {size: 2, id: @dom_id2, class: 'form-control input-sm range-end'}

if auto_reload
opts1[:class] += ' auto-reload'
Expand All @@ -22,13 +22,13 @@ def render_filter_internal(params) #:nodoc:
content_tag(
:div,
text_field_tag(parameter_name, params[:fr], opts1) + text_field_tag(parameter_name2, params[:to], opts2),
:class => 'form-inline')
class: 'form-inline')
end

def yield_declaration_of_column_filter #:nodoc:
{
:templates => [@query, @query2],
:ids => [@dom_id, @dom_id2]
templates: [@query, @query2],
ids: [@dom_id, @dom_id2]
}
end

Expand Down
22 changes: 11 additions & 11 deletions lib/wice/columns/column_string.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,38 @@ def render_filter_internal(params) #:nodoc:
if negation
self.auto_reloading_input_with_negation_checkbox = true if auto_reload

@query, _, parameter_name, @dom_id = form_parameter_name_id_and_query(:v => '')
@query2, _, parameter_name2, @dom_id2 = form_parameter_name_id_and_query(:n => '')
@query, _, parameter_name, @dom_id = form_parameter_name_id_and_query(v: '')
@query2, _, parameter_name2, @dom_id2 = form_parameter_name_id_and_query(n: '')

'<div class="text-filter-container">' +
text_field_tag(parameter_name, params[:v], :size => 8, :id => @dom_id, :class => css_class) +
text_field_tag(parameter_name, params[:v], size: 8, id: @dom_id, class: css_class) +
if defined?(Wice::Defaults::NEGATION_CHECKBOX_LABEL) && ! Wice::ConfigurationProvider.value_for(:NEGATION_CHECKBOX_LABEL).blank?
Wice::ConfigurationProvider.value_for(:NEGATION_CHECKBOX_LABEL)
else
''
end +
check_box_tag(parameter_name2, '1', (params[:n] == '1'),
:id => @dom_id2,
:title => NlMessage['negation_checkbox_title'],
:class => "negation-checkbox #{css_class}") +
id: @dom_id2,
title: NlMessage['negation_checkbox_title'],
class: "negation-checkbox #{css_class}") +
'</div>'
else
@query, _, parameter_name, @dom_id = form_parameter_name_id_and_query('')
text_field_tag(parameter_name, (params.blank? ? '' : params), :size => 8, :id => @dom_id, :class => css_class)
text_field_tag(parameter_name, (params.blank? ? '' : params), size: 8, id: @dom_id, class: css_class)
end
end


def yield_declaration_of_column_filter #:nodoc:
if negation
{
:templates => [@query, @query2],
:ids => [@dom_id, @dom_id2]
templates: [@query, @query2],
ids: [@dom_id, @dom_id2]
}
else
{
:templates => [@query],
:ids => [@dom_id]
templates: [@query],
ids: [@dom_id]
}
end
end
Expand Down
Loading

0 comments on commit a1f20f9

Please sign in to comment.