ruby on rails - How could I change the element width on server side by client device width -


i want show desktop device width of 960px

= line_chart chart_data, { 'width': "960px"} 

and provide mobile device width of 320ox

= line_chart chart_data, { 'width': "320px"} 

but have no idea how in server side, (view helper)

i use gem https://github.com/airblade/chartjs-ror in projecy.

thanks

it's better things on client side, if insist on server side, can use gem 'useragent', , do:

    = line_chart chart_data, { 'width' => (user_agent.mobile? ? '320px' : '960px') }  

Comments